|
|
!(function(){var Ea=Math.pow;var Yo=(Ci,Ft,re)=>new Promise((ue,we)=>{var Ye=w=>{try{J(re.next(w))}catch(Le){we(Le)}},me=w=>{try{J(re.throw(w))}catch(Le){we(Le)}},J=w=>w.done?ue(w.value):Promise.resolve(w.value).then(Ye,me);J((re=re.apply(Ci,Ft)).next())});(self.webpackChunk=self.webpackChunk||[]).push([[3615],{65966:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return ei}});var ue=re(20439),we=re(50298),Ye=re(62646),me=re(43403),J=re(92310),w=re.n(J),Le=re(29301),P=re(76846),f=re(96452),ne=re(6089),I=re(80402),k=re(34280),T=re(49658),M=re(59301),O=re(14809),X=re(77900),G=re(8654);function j(Ce){var Ne=Ce.prefixCls,pe=Ce.align,Je=Ce.arrow,ot=Ce.arrowPos,Qe=Je||{},Z=Qe.className,ve=Qe.content,Be=ot.x,Ze=Be===void 0?0:Be,lt=ot.y,yt=lt===void 0?0:lt,Yt=M.useRef();if(!pe||!pe.points)return null;var gt={position:"absolute"};if(pe.autoArrow!==!1){var Se=pe.points[0],kt=pe.points[1],Nt=Se[0],qt=Se[1],Te=kt[0],Re=kt[1];Nt===Te||!["t","b"].includes(Nt)?gt.top=yt:Nt==="t"?gt.top=0:gt.bottom=0,qt===Re||!["l","r"].includes(qt)?gt.left=Ze:qt==="l"?gt.left=0:gt.right=0}return M.createElement("div",{ref:Yt,className:w()("".concat(Ne,"-arrow"),Z),style:gt},ve)}function $(Ce){var Ne=Ce.prefixCls,pe=Ce.open,Je=Ce.zIndex,ot=Ce.mask,Qe=Ce.motion;return ot?M.createElement(X.default,(0,O.Z)({},Qe,{motionAppear:!0,visible:pe,removeOnLeave:!0}),function(Z){var ve=Z.className;return M.createElement("div",{style:{zIndex:Je},className:w()("".concat(Ne,"-mask"),ve)})}):null}var N=M.memo(function(Ce){var Ne=Ce.children;return Ne},function(Ce,Ne){return Ne.cache}),V=N,fe=M.forwardRef(function(Ce,Ne){var pe=Ce.popup,Je=Ce.className,ot=Ce.prefixCls,Qe=Ce.style,Z=Ce.target,ve=Ce.onVisibleChanged,Be=Ce.open,Ze=Ce.keepDom,lt=Ce.fresh,yt=Ce.onClick,Yt=Ce.mask,gt=Ce.arrow,Se=Ce.arrowPos,kt=Ce.align,Nt=Ce.motion,qt=Ce.maskMotion,Te=Ce.forceRender,Re=Ce.getPopupContainer,st=Ce.autoDestroy,vt=Ce.portal,je=Ce.zIndex,Dt=Ce.onMouseEnter,Ct=Ce.onMouseLeave,Et=Ce.onPointerEnter,Ut=Ce.onPointerDownCapture,Xt=Ce.ready,Xe=Ce.offsetX,Vt=Ce.offsetY,De=Ce.offsetR,xe=Ce.offsetB,Ee=Ce.onAlign,U=Ce.onPrepare,H=Ce.stretch,ae=Ce.targetWidth,ce=Ce.targetHeight,ye=typeof pe=="function"?pe():pe,ct=Be||Ze,_t=(Re==null?void 0:Re.length)>0,ut=M.useState(!Re||!_t),Gt=(0,we.Z)(ut,2),ni=Gt[0],di=Gt[1];if((0,k.Z)(function(){!ni&&_t&&Z&&di(!0)},[ni,_t,Z]),!ni)return null;var ti="auto",Tt={left:"-1000vw",top:"-1000vh",right:ti,bottom:ti};if(Xt||!Be){var ai,Di=kt.points,Ti=kt.dynamicInset||((ai=kt._experimental)===null||ai===void 0?void 0:ai.dynamicInset),Ii=Ti&&Di[0][1]==="r",mi=Ti&&Di[0][0]==="b";Ii?(Tt.right=De,Tt.left=ti):(Tt.left=Xe,Tt.right=ti),mi?(Tt.bottom=xe,Tt.top=ti):(Tt.top=Vt,Tt.bottom=ti)}var ui={};return H&&(H.includes("height")&&ce?ui.height=ce:H.includes("minHeight")&&ce&&(ui.minHeight=ce),H.includes("width")&&ae?ui.width=ae:H.includes("minWidth")&&ae&&(ui.minWidth=ae)),Be||(ui.pointerEvents="none"),M.createElement(vt,{open:Te||ct,getContainer:Re&&function(){return Re(Z)},autoDestroy:st},M.createElement($,{prefixCls:ot,open:Be,zIndex:je,mask:Yt,motion:qt}),M.createElement(Le.Z,{onResize:Ee,disabled:!Be},function(Wi){return M.createElement(X.default,(0,O.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Te,leavedClassName:"".concat(ot,"-hidden")},Nt,{onAppearPrepare:U,onEnterPrepare:U,visible:Be,onVisibleChanged:function(on){var qi;Nt==null||(qi=Nt.onVisibleChanged)===null||qi===void 0||qi.call(Nt,on),ve(on)}}),function(Ui,on){var qi=Ui.className,lr=Ui.style,Li=w()(ot,qi,Je);return M.createElement("div",{ref:(0,G.sQ)(Wi,Ne,on),className:Li,style:(0,ue.Z)((0,ue.Z)((0,ue.Z)((0,ue.Z)({"--arrow-x":"".concat(Se.x||0,"px"),"--arrow-y":"".concat(Se.y||0,"px")},Tt),ui),lr),{},{boxSizing:"border-box",zIndex:je},Qe),onMouseEnter:Dt,onMouseLeave:Ct,onPointerEnter:Et,onClick:yt,onPointerDownCapture:Ut},gt&&M.createElement(j,{prefixCls:ot,arrow:gt,arrowPos:Se,align:kt}),M.createElement(V,{cache:!Be&&!lt},ye))})}))}),be=fe,Ae=M.forwardRef(function(Ce,Ne){var pe=Ce.children,Je=Ce.getTriggerDOMNode,ot=(0,G.Yr)(pe),Qe=M.useCallback(function(ve){(0,G.mH)(Ne,Je?Je(ve):ve)},[Je]),Z=(0,G.x1)(Qe,(0,G.C4)(pe));return ot?M.cloneElement(pe,{ref:Z}):pe}),se=Ae,ke=M.createContext(null),We=ke;function ze(Ce){return Ce?Array.isArray(Ce)?Ce:[Ce]:[]}function Rt(Ce,Ne,pe,Je){return M.useMemo(function(){var ot=ze(pe!=null?pe:Ne),Qe=ze(Je!=null?Je:Ne),Z=new Set(ot),ve=new Set(Qe);return Ce&&(Z.has("hover")&&(Z.delete("hover"),Z.add("click")),ve.has("hover")&&(ve.delete("hover"),ve.add("click"))),[Z,ve]},[Ce,Ne,pe,Je])}var te=re(29194);function z(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],pe=arguments.length>2?arguments[2]:void 0;return pe?Ce[0]===Ne[0]:Ce[0]===Ne[0]&&Ce[1]===Ne[1]}function q(Ce,Ne,pe,Je){for(var ot=pe.points,Qe=Object.keys(Ce),Z=0;Z<Qe.length;Z+=1){var ve,Be=Qe[Z];if(z((ve=Ce[Be])===null||ve===void 0?void 0:ve.points,ot,Je))return"".concat(Ne,"-placement-").concat(Be)}return""}function Q(Ce,Ne,pe,Je){return Ne||(pe?{motionName:"".concat(Ce,"-").concat(pe)}:Je?{motionName:Je}:null)}function de(Ce){return Ce.ownerDocument.defaultView}function ie(Ce){for(var Ne=[],pe=Ce==null?void 0:Ce.parentElement,Je=["hidden","scroll","clip","auto"];pe;){var ot=de(pe).getComputedStyle(pe),Qe=ot.overflowX,Z=ot.overflowY,ve=ot.overflow;[Qe,Z,ve].some(function(Be){return Je.includes(Be)})&&Ne.push(pe),pe=pe.parentElement}return Ne}function L(Ce){var Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ce)?Ne:Ce}function A(Ce){return L(parseFloat(Ce),0)}function W(Ce,Ne){var pe=(0,ue.Z)({},Ce);return(Ne||[]).forEach(function(Je){if(!(Je instanceof HTMLBodyElement||Je instanceof HTMLHtmlElement)){var ot=de(Je).getComputedStyle(Je),Qe=ot.overflow,Z=ot.overflowClipMargin,ve=ot.borderTopWidth,Be=ot.borderBottomWidth,Ze=ot.borderLeftWidth,lt=ot.borderRightWidth,yt=Je.getBoundingClientRect(),Yt=Je.offsetHeight,gt=Je.clientHeight,Se=Je.offsetWidth,kt=Je.clientWidth,Nt=A(ve),qt=A(Be),Te=A(Ze),Re=A(lt),st=L(Math.round(yt.width/Se*1e3)/1e3),vt=L(Math.round(yt.height/Yt*1e3)/1e3),je=(Se-kt-Te-Re)*st,Dt=(Yt-gt-Nt-qt)*vt,Ct=Nt*vt,Et=qt*vt,Ut=Te*st,Xt=Re*st,Xe=0,Vt=0;if(Qe==="clip"){var De=A(Z);Xe=De*st,Vt=De*vt}var xe=yt.x+Ut-Xe,Ee=yt.y+Ct-Vt,U=xe+yt.width+2*Xe-Ut-Xt-je,H=Ee+yt.height+2*Vt-Ct-Et-Dt;pe.left=Math.max(pe.left,xe),pe.top=Math.max(pe.top,Ee),pe.right=Math.min(pe.right,U),pe.bottom=Math.min(pe.bottom,H)}}),pe}function le(Ce){var Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,pe="".concat(Ne),Je=pe.match(/^(.*)\%$/);return Je?Ce*(parseFloat(Je[1])/100):parseFloat(pe)}function et(Ce,Ne){var pe=Ne||[],Je=(0,we.Z)(pe,2),ot=Je[0],Qe=Je[1];return[le(Ce.width,ot),le(Ce.height,Qe)]}function pt(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ce[0],Ce[1]]}function Kt(Ce,Ne){var pe=Ne[0],Je=Ne[1],ot,Qe;return pe==="t"?Qe=Ce.y:pe==="b"?Qe=Ce.y+Ce.height:Qe=Ce.y+Ce.height/2,Je==="l"?ot=Ce.x:Je==="r"?ot=Ce.x+Ce.width:ot=Ce.x+Ce.width/2,{x:ot,y:Qe}}function Pe(Ce,Ne){var pe={t:"b",b:"t",l:"r",r:"l"};return Ce.map(function(Je,ot){return ot===Ne?pe[Je]||"c":Je}).join("")}function Zt(Ce,Ne,pe,Je,ot,Qe,Z){var ve=M.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:ot[Je]||{}}),Be=(0,we.Z)(ve,2),Ze=Be[0],lt=Be[1],yt=M.useRef(0),Yt=M.useMemo(function(){return Ne?ie(Ne):[]},[Ne]),gt=M.useRef({}),Se=function(){gt.current={}};Ce||Se();var kt=(0,ne.Z)(function(){if(Ne&&pe&&Ce){let rr=function(pn,sr){var es=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vn,cs=ct.x+pn,xs=ct.y+sr,ws=cs+mi,Ms=xs+Ii,fi=Math.max(cs,es.left),Bi=Math.max(xs,es.top),Dn=Math.min(ws,es.right),Un=Math.min(Ms,es.bottom);return Math.max(0,(Dn-fi)*(Un-Bi))},Mi=function(){Mn=ct.y+Oi,Qi=Mn+Ii,Ln=ct.x+vi,$n=Ln+mi};var Te,Re,st,vt,je=Ne,Dt=je.ownerDocument,Ct=de(je),Et=Ct.getComputedStyle(je),Ut=Et.position,Xt=je.style.left,Xe=je.style.top,Vt=je.style.right,De=je.style.bottom,xe=je.style.overflow,Ee=(0,ue.Z)((0,ue.Z)({},ot[Je]),Qe),U=Dt.createElement("div");(Te=je.parentElement)===null||Te===void 0||Te.appendChild(U),U.style.left="".concat(je.offsetLeft,"px"),U.style.top="".concat(je.offsetTop,"px"),U.style.position=Ut,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 H;if(Array.isArray(pe))H={x:pe[0],y:pe[1],width:0,height:0};else{var ae,ce,ye=pe.getBoundingClientRect();ye.x=(ae=ye.x)!==null&&ae!==void 0?ae:ye.left,ye.y=(ce=ye.y)!==null&&ce!==void 0?ce:ye.top,H={x:ye.x,y:ye.y,width:ye.width,height:ye.height}}var ct=je.getBoundingClientRect(),_t=Ct.getComputedStyle(je),ut=_t.height,Gt=_t.width;ct.x=(Re=ct.x)!==null&&Re!==void 0?Re:ct.left,ct.y=(st=ct.y)!==null&&st!==void 0?st:ct.top;var ni=Dt.documentElement,di=ni.clientWidth,ti=ni.clientHeight,Tt=ni.scrollWidth,ai=ni.scrollHeight,Di=ni.scrollTop,Ti=ni.scrollLeft,Ii=ct.height,mi=ct.width,ui=H.height,Wi=H.width,Ui={left:0,top:0,right:di,bottom:ti},on={left:-Ti,top:-Di,right:Tt-Ti,bottom:ai-Di},qi=Ee.htmlRegion,lr="visible",Li="visibleFirst";qi!=="scroll"&&qi!==Li&&(qi=lr);var Ni=qi===Li,dn=W(on,Yt),Fi=W(Ui,Yt),vn=qi===lr?Fi:dn,an=Ni?Fi:vn;je.style.left="auto",je.style.top="auto",je.style.right="0",je.style.bottom="0";var Vi=je.getBoundingClientRect();je.style.left=Xt,je.style.top=Xe,je.style.right=Vt,je.style.bottom=De,je.style.overflow=xe,(vt=je.parentElement)===null||vt===void 0||vt.removeChild(U);var hn=L(Math.round(mi/parseFloat(Gt)*1e3)/1e3),kn=L(Math.round(Ii/parseFloat(ut)*1e3)/1e3);if(hn===0||kn===0||(0,P.Sh)(pe)&&!(0,te.Z)(pe))return;var Dr=Ee.offset,ki=Ee.targetOffset,oi=et(ct,Dr),Me=(0,we.Z)(oi,2),tt=Me[0],xt=Me[1],ht=et(H,ki),St=(0,we.Z)(ht,2),at=St[0],ft=St[1];H.x-=at,H.y-=ft;var Pt=Ee.points||[],Jt=(0,we.Z)(Pt,2),hi=Jt[0],Xi=Jt[1],li=pt(Xi),$i=pt(hi),Pi=Kt(H,li),ji=Kt(ct,$i),Gi=(0,ue.Z)({},Ee),vi=Pi.x-ji.x+tt,Oi=Pi.y-ji.y+xt,nn=rr(vi,Oi),Ki=rr(vi,Oi,Fi),wi=Kt(H,["t","l"]),rn=Kt(ct,["t","l"]),Si=Kt(H,["b","r"]),Hi=Kt(ct,["b","r"]),Bn=Ee.overflow||{},Ji=Bn.adjustX,Yi=Bn.adjustY,yn=Bn.shiftX,bn=Bn.shiftY,Nn=function(sr){return typeof sr=="boolean"?sr:sr>=0},Mn,Qi,Ln,$n;Mi();var xr=Nn(Yi),xn=$i[0]===li[0];if(xr&&$i[0]==="t"&&(Qi>an.bottom||gt.current.bt)){var An=Oi;xn?An-=Ii-ui:An=wi.y-Hi.y-xt;var fr=rr(vi,An),Er=rr(vi,An,Fi);fr>nn||fr===nn&&(!Ni||Er>=Ki)?(gt.current.bt=!0,Oi=An,xt=-xt,Gi.points=[Pe($i,0),Pe(li,0)]):gt.current.bt=!1}if(xr&&$i[0]==="b"&&(Mn<an.top||gt.current.tb)){var ur=Oi;xn?ur+=Ii-ui:ur=Si.y-rn.y-xt;var Ir=rr(vi,ur),wn=rr(vi,ur,Fi);Ir>nn||Ir===nn&&(!Ni||wn>=Ki)?(gt.current.tb=!0,Oi=ur,xt=-xt,Gi.points=[Pe($i,0),Pe(li,0)]):gt.current.tb=!1}var Xn=Nn(Ji),Cr=$i[1]===li[1];if(Xn&&$i[1]==="l"&&($n>an.right||gt.current.rl)){var Gn=vi;Cr?Gn-=mi-Wi:Gn=wi.x-Hi.x-tt;var pr=rr(Gn,Oi),Rn=rr(Gn,Oi,Fi);pr>nn||pr===nn&&(!Ni||Rn>=Ki)?(gt.current.rl=!0,vi=Gn,tt=-tt,Gi.points=[Pe($i,1),Pe(li,1)]):gt.current.rl=!1}if(Xn&&$i[1]==="r"&&(Ln<an.left||gt.current.lr)){var Jn=vi;Cr?Jn+=mi-Wi:Jn=Si.x-rn.x-tt;var mr=rr(Jn,Oi),Ai=rr(Jn,Oi,Fi);mr>nn||mr===nn&&(!Ni||Ai>=Ki)?(gt.current.lr=!0,vi=Jn,tt=-tt,Gi.points=[Pe($i,1),Pe(li,1)]):gt.current.lr=!1}Mi();var Tn=yn===!0?0:yn;typeof Tn=="number"&&(Ln<Fi.left&&(vi-=Ln-Fi.left-tt,H.x+Wi<Fi.left+Tn&&(vi+=H.x-Fi.left+Wi-Tn)),$n>Fi.right&&(vi-=$n-Fi.right-tt,H.x>Fi.right-Tn&&(vi+=H.x-Fi.right+Tn)));var cr=bn===!0?0:bn;typeof cr=="number"&&(Mn<Fi.top&&(Oi-=Mn-Fi.top-xt,H.y+ui<Fi.top+cr&&(Oi+=H.y-Fi.top+ui-cr)),Qi>Fi.bottom&&(Oi-=Qi-Fi.bottom-xt,H.y>Fi.bottom-cr&&(Oi+=H.y-Fi.bottom+cr)));var gr=ct.x+vi,hr=gr+mi,Jr=ct.y+Oi,en=Jr+Ii,bi=H.x,xi=bi+Wi,Sn=H.y,_r=Sn+ui,Wn=Math.max(gr,bi),tr=Math.min(hr,xi),Kn=(Wn+tr)/2,us=Kn-gr,ir=Math.max(Jr,Sn),Qr=Math.min(en,_r),Wr=(ir+Qr)/2,Kr=Wr-Jr;Z==null||Z(Ne,Gi);var nr=Vi.right-ct.x-(vi+ct.width),jr=Vi.bottom-ct.y-(Oi+ct.height);hn===1&&(vi=Math.round(vi),nr=Math.round(nr)),kn===1&&(Oi=Math.round(Oi),jr=Math.round(jr));var ms={ready:!0,offsetX:vi/hn,offsetY:Oi/kn,offsetR:nr/hn,offsetB:jr/kn,arrowX:us/hn,arrowY:Kr/kn,scaleX:hn,scaleY:kn,align:Gi};lt(ms)}}),Nt=function(){yt.current+=1;var Re=yt.current;Promise.resolve().then(function(){yt.current===Re&&kt()})},qt=function(){lt(function(Re){return(0,ue.Z)((0,ue.Z)({},Re),{},{ready:!1})})};return(0,k.Z)(qt,[Je]),(0,k.Z)(function(){Ce||qt()},[Ce]),[Ze.ready,Ze.offsetX,Ze.offsetY,Ze.offsetR,Ze.offsetB,Ze.arrowX,Ze.arrowY,Ze.scaleX,Ze.scaleY,Ze.align,Nt]}var It=re(95190);function bt(Ce,Ne,pe,Je,ot){(0,k.Z)(function(){if(Ce&&Ne&&pe){let yt=function(){Je(),ot()};var Qe=Ne,Z=pe,ve=ie(Qe),Be=ie(Z),Ze=de(Z),lt=new Set([Ze].concat((0,It.Z)(ve),(0,It.Z)(Be)));return lt.forEach(function(Yt){Yt.addEventListener("scroll",yt,{passive:!0})}),Ze.addEventListener("resize",yt,{passive:!0}),Je(),function(){lt.forEach(function(Yt){Yt.removeEventListener("scroll",yt),Ze.removeEventListener("resize",yt)})}}},[Ce,Ne,pe])}var Oe=re(48736);function mt(Ce,Ne,pe,Je,ot,Qe,Z,ve){var Be=M.useRef(Ce);Be.current=Ce;var Ze=M.useRef(!1);M.useEffect(function(){if(Ne&&Je&&(!ot||Qe)){var yt=function(){Ze.current=!1},Yt=function(st){var vt;Be.current&&!Z(((vt=st.composedPath)===null||vt===void 0||(vt=vt.call(st))===null||vt===void 0?void 0:vt[0])||st.target)&&!Ze.current&&ve(!1)},gt=de(Je);gt.addEventListener("pointerdown",yt,!0),gt.addEventListener("mousedown",Yt,!0),gt.addEventListener("contextmenu",Yt,!0);var Se=(0,f.A)(pe);if(Se&&(Se.addEventListener("mousedown",Yt,!0),Se.addEventListener("contextmenu",Yt,!0)),0)var kt,Nt,qt,Te;return function(){gt.removeEventListener("pointerdown",yt,!0),gt.removeEventListener("mousedown",Yt,!0),gt.removeEventListener("contextmenu",Yt,!0),Se&&(Se.removeEventListener("mousedown",Yt,!0),Se.removeEventListener("contextmenu",Yt,!0))}}},[Ne,pe,Je,ot,Qe]);function lt(){Ze.current=!0}return lt}var $e=["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 jt(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:me.Z,Ne=M.forwardRef(function(pe,Je){var ot=pe.prefixCls,Qe=ot===void 0?"rc-trigger-popup":ot,Z=pe.children,ve=pe.action,Be=ve===void 0?"hover":ve,Ze=pe.showAction,lt=pe.hideAction,yt=pe.popupVisible,Yt=pe.defaultPopupVisible,gt=pe.onPopupVisibleChange,Se=pe.afterPopupVisibleChange,kt=pe.mouseEnterDelay,Nt=pe.mouseLeaveDelay,qt=Nt===void 0?.1:Nt,Te=pe.focusDelay,Re=pe.blurDelay,st=pe.mask,vt=pe.maskClosable,je=vt===void 0?!0:vt,Dt=pe.getPopupContainer,Ct=pe.forceRender,Et=pe.autoDestroy,Ut=pe.destroyPopupOnHide,Xt=pe.popup,Xe=pe.popupClassName,Vt=pe.popupStyle,De=pe.popupPlacement,xe=pe.builtinPlacements,Ee=xe===void 0?{}:xe,U=pe.popupAlign,H=pe.zIndex,ae=pe.stretch,ce=pe.getPopupClassNameFromAlign,ye=pe.fresh,ct=pe.alignPoint,_t=pe.onPopupClick,ut=pe.onPopupAlign,Gt=pe.arrow,ni=pe.popupMotion,di=pe.maskMotion,ti=pe.popupTransitionName,Tt=pe.popupAnimation,ai=pe.maskTransitionName,Di=pe.maskAnimation,Ti=pe.className,Ii=pe.getTriggerDOMNode,mi=(0,Ye.Z)(pe,$e),ui=Et||Ut||!1,Wi=M.useState(!1),Ui=(0,we.Z)(Wi,2),on=Ui[0],qi=Ui[1];(0,k.Z)(function(){qi((0,T.Z)())},[]);var lr=M.useRef({}),Li=M.useContext(We),Ni=M.useMemo(function(){return{registerSubPopup:function(Bi,Dn){lr.current[Bi]=Dn,Li==null||Li.registerSubPopup(Bi,Dn)}}},[Li]),dn=(0,I.Z)(),Fi=M.useState(null),vn=(0,we.Z)(Fi,2),an=vn[0],Vi=vn[1],hn=M.useRef(null),kn=(0,ne.Z)(function(fi){hn.current=fi,(0,P.Sh)(fi)&&an!==fi&&Vi(fi),Li==null||Li.registerSubPopup(dn,fi)}),Dr=M.useState(null),ki=(0,we.Z)(Dr,2),oi=ki[0],Me=ki[1],tt=M.useRef(null),xt=(0,ne.Z)(function(fi){(0,P.Sh)(fi)&&oi!==fi&&(Me(fi),tt.current=fi)}),ht=M.Children.only(Z),St=(ht==null?void 0:ht.props)||{},at={},ft=(0,ne.Z)(function(fi){var Bi,Dn,Un=oi;return(Un==null?void 0:Un.contains(fi))||((Bi=(0,f.A)(Un))===null||Bi===void 0?void 0:Bi.host)===fi||fi===Un||(an==null?void 0:an.contains(fi))||((Dn=(0,f.A)(an))===null||Dn===void 0?void 0:Dn.host)===fi||fi===an||Object.values(lr.current).some(function(In){return(In==null?void 0:In.contains(fi))||fi===In})}),Pt=Q(Qe,ni,Tt,ti),Jt=Q(Qe,di,Di,ai),hi=M.useState(Yt||!1),Xi=(0,we.Z)(hi,2),li=Xi[0],$i=Xi[1],Pi=yt!=null?yt:li,ji=(0,ne.Z)(function(fi){yt===void 0&&$i(fi)});(0,k.Z)(function(){$i(yt||!1)},[yt]);var Gi=M.useRef(Pi);Gi.current=Pi;var vi=M.useRef([]);vi.current=[];var Oi=(0,ne.Z)(function(fi){var Bi;ji(fi),((Bi=vi.current[vi.current.length-1])!==null&&Bi!==void 0?Bi:Pi)!==fi&&(vi.current.push(fi),gt==null||gt(fi))}),nn=M.useRef(),Ki=function(){clearTimeout(nn.current)},wi=function(Bi){var Dn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ki(),Dn===0?Oi(Bi):nn.current=setTimeout(function(){Oi(Bi)},Dn*1e3)};M.useEffect(function(){return Ki},[]);var rn=M.useState(!1),Si=(0,we.Z)(rn,2),Hi=Si[0],Bn=Si[1];(0,k.Z)(function(fi){(!fi||Pi)&&Bn(!0)},[Pi]);var Ji=M.useState(null),Yi=(0,we.Z)(Ji,2),yn=Yi[0],bn=Yi[1],Nn=M.useState(null),Mn=(0,we.Z)(Nn,2),Qi=Mn[0],Ln=Mn[1],$n=function(Bi){Ln([Bi.clientX,Bi.clientY])},xr=Zt(Pi,an,ct&&Qi!==null?Qi:oi,De,Ee,U,ut),xn=(0,we.Z)(xr,11),An=xn[0],fr=xn[1],Er=xn[2],ur=xn[3],Ir=xn[4],wn=xn[5],Xn=xn[6],Cr=xn[7],Gn=xn[8],pr=xn[9],Rn=xn[10],Jn=Rt(on,Be,Ze,lt),mr=(0,we.Z)(Jn,2),Ai=mr[0],Tn=mr[1],cr=Ai.has("click"),gr=Tn.has("click")||Tn.has("contextMenu"),hr=(0,ne.Z)(function(){Hi||Rn()}),Jr=function(){Gi.current&&ct&&gr&&wi(!1)};bt(Pi,oi,an,hr,Jr),(0,k.Z)(function(){hr()},[Qi,De]),(0,k.Z)(function(){Pi&&!(Ee!=null&&Ee[De])&&hr()},[JSON.stringify(U)]);var en=M.useMemo(function(){var fi=q(Ee,Qe,pr,ct);return w()(fi,ce==null?void 0:ce(pr))},[pr,ce,Ee,Qe,ct]);M.useImperativeHandle(Je,function(){return{nativeElement:tt.current,popupElement:hn.current,forceAlign:hr}});var bi=M.useState(0),xi=(0,we.Z)(bi,2),Sn=xi[0],_r=xi[1],Wn=M.useState(0),tr=(0,we.Z)(Wn,2),Kn=tr[0],us=tr[1],ir=function(){if(ae&&oi){var Bi=oi.getBoundingClientRect();_r(Bi.width),us(Bi.height)}},Qr=function(){ir(),hr()},Wr=function(Bi){Bn(!1),Rn(),Se==null||Se(Bi)},Kr=function(){return new Promise(function(Bi){ir(),bn(function(){return Bi})})};(0,k.Z)(function(){yn&&(Rn(),yn(),bn(null))},[yn]);function nr(fi,Bi,Dn,Un){at[fi]=function(In){var kr;Un==null||Un(In),wi(Bi,Dn);for(var gs=arguments.length,ar=new Array(gs>1?gs-1:0),ts=1;ts<gs;ts++)ar[ts-1]=arguments[ts];(kr=St[fi])===null||kr===void 0||kr.call.apply(kr,[St,In].concat(ar))}}(cr||gr)&&(at.onClick=function(fi){var Bi;Gi.current&&gr?wi(!1):!Gi.current&&cr&&($n(fi),wi(!0));for(var Dn=arguments.length,Un=new Array(Dn>1?Dn-1:0),In=1;In<Dn;In++)Un[In-1]=arguments[In];(Bi=St.onClick)===null||Bi===void 0||Bi.call.apply(Bi,[St,fi].concat(Un))});var jr=mt(Pi,gr,oi,an,st,je,ft,wi),ms=Ai.has("hover"),rr=Tn.has("hover"),Mi,pn;ms&&(nr("onMouseEnter",!0,kt,function(fi){$n(fi)}),nr("onPointerEnter",!0,kt,function(fi){$n(fi)}),Mi=function(Bi){(Pi||Hi)&&an!==null&&an!==void 0&&an.contains(Bi.target)&&wi(!0,kt)},ct&&(at.onMouseMove=function(fi){var Bi;(Bi=St.onMouseMove)===null||Bi===void 0||Bi.call(St,fi)})),rr&&(nr("onMouseLeave",!1,qt),nr("onPointerLeave",!1,qt),pn=function(){wi(!1,qt)}),Ai.has("focus")&&nr("onFocus",!0,Te),Tn.has("focus")&&nr("onBlur",!1,Re),Ai.has("contextMenu")&&(at.onContextMenu=function(fi){var Bi;Gi.current&&Tn.has("contextMenu")?wi(!1):($n(fi),wi(!0)),fi.preventDefault();for(var Dn=arguments.length,Un=new Array(Dn>1?Dn-1:0),In=1;In<Dn;In++)Un[In-1]=arguments[In];(Bi=St.onContextMenu)===null||Bi===void 0||Bi.call.apply(Bi,[St,fi].concat(Un))}),Ti&&(at.className=w()(St.className,Ti));var sr=(0,ue.Z)((0,ue.Z)({},St),at),es={},cs=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];cs.forEach(function(fi){mi[fi]&&(es[fi]=function(){for(var Bi,Dn=arguments.length,Un=new Array(Dn),In=0;In<Dn;In++)Un[In]=arguments[In];(Bi=sr[fi])===null||Bi===void 0||Bi.call.apply(Bi,[sr].concat(Un)),mi[fi].apply(mi,Un)})});var xs=M.cloneElement(ht,(0,ue.Z)((0,ue.Z)({},sr),es)),ws={x:wn,y:Xn},Ms=Gt?(0,ue.Z)({},Gt!==!0?Gt:{}):null;return M.createElement(M.Fragment,null,M.createElement(Le.Z,{disabled:!Pi,ref:xt,onResize:Qr},M.createElement(se,{getTriggerDOMNode:Ii},xs)),M.createElement(We.Provider,{value:Ni},M.createElement(be,{portal:Ce,ref:kn,prefixCls:Qe,popup:Xt,className:w()(Xe,en),style:Vt,target:oi,onMouseEnter:Mi,onMouseLeave:pn,onPointerEnter:Mi,zIndex:H,open:Pi,keepDom:Hi,fresh:ye,onClick:_t,onPointerDownCapture:jr,mask:st,motion:Pt,maskMotion:Jt,onVisibleChanged:Wr,onPrepare:Kr,forceRender:Ct,autoDestroy:ui,getPopupContainer:Dt,align:pr,arrow:Ms,arrowPos:ws,ready:An,offsetX:fr,offsetY:Er,offsetR:ur,offsetB:Ir,onAlign:hr,stretch:ae,targetWidth:Sn/Cr,targetHeight:Kn/Gn})))});return Ne}var ei=jt(me.Z)},64018:function(){var Ci,Ft,re,ue=!1,we,Ye;window.PR_SHOULD_USE_CONTINUATION=!0;var me,J;(function(){var w=window,Le=["break,continue,do,else,for,if,return,while"],P=[Le,"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"],ne=[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"],I=[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",M=[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",X=[Le,"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"],G=[Le,"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"],j=[Le,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],$=[ne,k,I,M,O,X,G,j],N=/^(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",fe="kwd",be="com",Ae="typ",se="lit",ke="pun",We="pln",ze="tag",Rt="dec",te="src",z="atn",q="atv",Q="nocode",de="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function ie(Ne){for(var pe=0,Je=!1,ot=!1,Qe=0,Z=Ne.length;Qe<Z;++Qe){var ve=Ne[Qe];if(ve.ignoreCase)ot=!0;else if(/[a-z]/i.test(ve.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Je=!0,ot=!1;break}}var Be={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(Se){var kt=Se.charCodeAt(0);if(kt!==92)return kt;var Nt=Se.charAt(1);return kt=Be[Nt],kt||("0"<=Nt&&Nt<="7"?parseInt(Se.substring(1),8):Nt==="u"||Nt==="x"?parseInt(Se.substring(2),16):Se.charCodeAt(1))}function lt(Se){if(Se<32)return(Se<16?"\\x0":"\\x")+Se.toString(16);var kt=String.fromCharCode(Se);return kt==="\\"||kt==="-"||kt==="]"||kt==="^"?"\\"+kt:kt}function yt(Se){var kt=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")),Nt=[],qt=kt[0]==="^",Te=["["];qt&&Te.push("^");for(var Re=qt?1:0,st=kt.length;Re<st;++Re){var vt=kt[Re];if(/\\[bdsw]/i.test(vt))Te.push(vt);else{var je=Ze(vt),Dt;Re+2<st&&kt[Re+1]==="-"?(Dt=Ze(kt[Re+2]),Re+=2):Dt=je,Nt.push([je,Dt]),Dt<65||je>122||(Dt<65||je>90||Nt.push([Math.max(65,je)|32,Math.min(Dt,90)|32]),Dt<97||je>122||Nt.push([Math.max(97,je)&-33,Math.min(Dt,122)&-33]))}}Nt.sort(function(Xt,Xe){return Xt[0]-Xe[0]||Xe[1]-Xt[1]});for(var Ct=[],Et=[],Re=0;Re<Nt.length;++Re){var Ut=Nt[Re];Ut[0]<=Et[1]+1?Et[1]=Math.max(Et[1],Ut[1]):Ct.push(Et=Ut)}for(var Re=0;Re<Ct.length;++Re){var Ut=Ct[Re];Te.push(lt(Ut[0])),Ut[1]>Ut[0]&&(Ut[1]+1>Ut[0]&&Te.push("-"),Te.push(lt(Ut[1])))}return Te.push("]"),Te.join("")}function Yt(Se){for(var kt=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")),Nt=kt.length,qt=[],Te=0,Re=0;Te<Nt;++Te){var st=kt[Te];if(st==="(")++Re;else if(st.charAt(0)==="\\"){var vt=+st.substring(1);vt&&(vt<=Re?qt[vt]=-1:kt[Te]=lt(vt))}}for(var Te=1;Te<qt.length;++Te)qt[Te]===-1&&(qt[Te]=++pe);for(var Te=0,Re=0;Te<Nt;++Te){var st=kt[Te];if(st==="(")++Re,qt[Re]||(kt[Te]="(?:");else if(st.charAt(0)==="\\"){var vt=+st.substring(1);vt&&vt<=Re&&(kt[Te]="\\"+qt[vt])}}for(var Te=0;Te<Nt;++Te)kt[Te]==="^"&&kt[Te+1]!=="^"&&(kt[Te]="");if(Se.ignoreCase&&Je)for(var Te=0;Te<Nt;++Te){var st=kt[Te],je=st.charAt(0);st.length>=2&&je==="["?kt[Te]=yt(st):je!=="\\"&&(kt[Te]=st.replace(/[a-zA-Z]/g,function(Et){var Ut=Et.charCodeAt(0);return"["+String.fromCharCode(Ut&-33,Ut|32)+"]"}))}return kt.join("")}for(var gt=[],Qe=0,Z=Ne.length;Qe<Z;++Qe){var ve=Ne[Qe];if(ve.global||ve.multiline)throw new Error(""+ve);gt.push("(?:"+Yt(ve)+")")}return new RegExp(gt.join("|"),ot?"gi":"g")}function L(Ne,pe){var Je=/(?:^|\s)nocode(?:\s|$)/,ot=[],Qe=0,Z=[],ve=0;function Be(Ze){var lt=Ze.nodeType;if(lt==1){if(Je.test(Ze.className))return;for(var yt=Ze.firstChild;yt;yt=yt.nextSibling)Be(yt);var Yt=Ze.nodeName.toLowerCase();(Yt==="br"||Yt==="li")&&(ot[ve]=`
|
|
|
`,Z[ve<<1]=Qe++,Z[ve++<<1|1]=Ze)}else if(lt==3||lt==4){var gt=Ze.nodeValue;gt.length&&(pe?gt=gt.replace(/\r\n?/g,`
|
|
|
`):gt=gt.replace(/[ \t\r\n]+/g," "),ot[ve]=gt,Z[ve<<1]=Qe,Qe+=gt.length,Z[ve++<<1|1]=Ze)}}return Be(Ne),{sourceCode:ot.join("").replace(/\n$/,""),spans:Z}}function A(Ne,pe,Je,ot,Qe){if(Je){var Z={sourceNode:Ne,pre:1,langExtension:null,numberLines:null,sourceCode:Je,spans:null,basePos:pe,decorations:null};ot(Z),Qe.push.apply(Qe,Z.decorations)}}var W=/\S/;function le(Ne){for(var pe=void 0,Je=Ne.firstChild;Je;Je=Je.nextSibling){var ot=Je.nodeType;pe=ot===1?pe?Ne:Je:ot===3&&W.test(Je.nodeValue)?Ne:pe}return pe===Ne?void 0:pe}function et(Ne,pe){var Je={},ot;(function(){for(var ve=Ne.concat(pe),Be=[],Ze={},lt=0,yt=ve.length;lt<yt;++lt){var Yt=ve[lt],gt=Yt[3];if(gt)for(var Se=gt.length;--Se>=0;)Je[gt.charAt(Se)]=Yt;var kt=Yt[1],Nt=""+kt;Ze.hasOwnProperty(Nt)||(Be.push(kt),Ze[Nt]=null)}Be.push(/[\0-\uffff]/),ot=ie(Be)})();var Qe=pe.length,Z=function(ve){for(var Be=ve.sourceCode,Ze=ve.basePos,lt=ve.sourceNode,yt=[Ze,We],Yt=0,gt=Be.match(ot)||[],Se={},kt=0,Nt=gt.length;kt<Nt;++kt){var qt=gt[kt],Te=Se[qt],Re=void 0,st;if(typeof Te=="string")st=!1;else{var vt=Je[qt.charAt(0)];if(vt)Re=qt.match(vt[1]),Te=vt[0];else{for(var je=0;je<Qe;++je)if(vt=pe[je],Re=qt.match(vt[1]),Re){Te=vt[0];break}Re||(Te=We)}st=Te.length>=5&&Te.substring(0,5)==="lang-",st&&!(Re&&typeof Re[1]=="string")&&(st=!1,Te=te),st||(Se[qt]=Te)}var Dt=Yt;if(Yt+=qt.length,!st)yt.push(Ze+Dt,Te);else{var Ct=Re[1],Et=qt.indexOf(Ct),Ut=Et+Ct.length;Re[2]&&(Ut=qt.length-Re[2].length,Et=Ut-Ct.length);var Xt=Te.substring(5);A(lt,Ze+Dt,qt.substring(0,Et),Z,yt),A(lt,Ze+Dt+Et,Ct,Oe(Xt,Ct),yt),A(lt,Ze+Dt+Ut,qt.substring(Ut),Z,yt)}}ve.decorations=yt};return Z}function pt(Ne){var pe=[],Je=[];Ne.tripleQuotedStrings?pe.push([V,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ne.multiLineStrings?pe.push([V,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):pe.push([V,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ne.verbatimStrings&&Je.push([V,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ot=Ne.hashComments;ot&&(Ne.cStyleComments?(ot>1?pe.push([be,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):pe.push([be,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Je.push([V,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):pe.push([be,/^#[^\r\n]*/,null,"#"])),Ne.cStyleComments&&(Je.push([be,/^\/\/[^\r\n]*/,null]),Je.push([be,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Qe=Ne.regexLiterals;if(Qe){var Z=Qe>1?"":`
|
|
|
\r`,ve=Z?".":"[\\S\\s]",Be="/(?=[^/*"+Z+"])(?:[^/\\x5B\\x5C"+Z+"]|\\x5C"+ve+"|\\x5B(?:[^\\x5C\\x5D"+Z+"]|\\x5C"+ve+")*(?:\\x5D|$))+/";Je.push(["lang-regex",RegExp("^"+de+"("+Be+")")])}var Ze=Ne.types;Ze&&Je.push([Ae,Ze]);var lt=(""+Ne.keywords).replace(/^ | $/g,"");lt.length&&Je.push([fe,new RegExp("^(?:"+lt.replace(/[\s,]+/g,"|")+")\\b"),null]),pe.push([We,/^\s+/,null,` \r
|
|
|
\xA0`]);var yt="^.[^\\s\\w.$@'\"`/\\\\]*";return Ne.regexLiterals&&(yt+="(?!s*/)"),Je.push([se,/^@[a-z_$][a-z_$@0-9]*/i,null],[Ae,/^(?:[@_]?[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],[ke,new RegExp(yt),null]),et(pe,Je)}var Kt=pt({keywords:$,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Pe(Ne,pe,Je){for(var ot=/(?:^|\s)nocode(?:\s|$)/,Qe=/\r\n?|\n/,Z=Ne.ownerDocument,ve=Z.createElement("li");Ne.firstChild;)ve.appendChild(Ne.firstChild);var Be=[ve];function Ze(kt){var Nt=kt.nodeType;if(Nt==1&&!ot.test(kt.className))if(kt.nodeName==="br")lt(kt),kt.parentNode&&kt.parentNode.removeChild(kt);else for(var qt=kt.firstChild;qt;qt=qt.nextSibling)Ze(qt);else if((Nt==3||Nt==4)&&Je){var Te=kt.nodeValue,Re=Te.match(Qe);if(Re){var st=Te.substring(0,Re.index);kt.nodeValue=st;var vt=Te.substring(Re.index+Re[0].length);if(vt){var je=kt.parentNode;je.insertBefore(Z.createTextNode(vt),kt.nextSibling)}lt(kt),st||kt.parentNode.removeChild(kt)}}}function lt(kt){for(;!kt.nextSibling;)if(kt=kt.parentNode,!kt)return;function Nt(Re,st){var vt=st?Re.cloneNode(!1):Re,je=Re.parentNode;if(je){var Dt=Nt(je,1),Ct=Re.nextSibling;Dt.appendChild(vt);for(var Et=Ct;Et;Et=Ct)Ct=Et.nextSibling,Dt.appendChild(Et)}return vt}for(var qt=Nt(kt.nextSibling,0),Te;(Te=qt.parentNode)&&Te.nodeType===1;)qt=Te;Be.push(qt)}for(var yt=0;yt<Be.length;++yt)Ze(Be[yt]);pe===(pe|0)&&Be[0].setAttribute("value",pe);var Yt=Z.createElement("ol");Yt.className="linenums";for(var gt=Math.max(0,pe-1|0)||0,yt=0,Se=Be.length;yt<Se;++yt)ve=Be[yt],ve.className="L"+(yt+gt)%10,ve.firstChild||ve.appendChild(Z.createTextNode("\xA0")),Yt.appendChild(ve);Ne.appendChild(Yt)}function Zt(Ne){var pe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);pe=pe&&+pe[1]<=8;var Je=/\n/g,ot=Ne.sourceCode,Qe=ot.length,Z=0,ve=Ne.spans,Be=ve.length,Ze=0,lt=Ne.decorations,yt=lt.length,Yt=0;lt[yt]=Qe;var gt,Se;for(Se=gt=0;Se<yt;)lt[Se]!==lt[Se+2]?(lt[gt++]=lt[Se++],lt[gt++]=lt[Se++]):Se+=2;for(yt=gt,Se=gt=0;Se<yt;){for(var kt=lt[Se],Nt=lt[Se+1],qt=Se+2;qt+2<=yt&<[qt+1]===Nt;)qt+=2;lt[gt++]=kt,lt[gt++]=Nt,Se=qt}yt=lt.length=gt;var Te=Ne.sourceNode,Re="";Te&&(Re=Te.style.display,Te.style.display="none");try{for(var st=null;Ze<Be;){var vt=ve[Ze],je=ve[Ze+2]||Qe,Dt=lt[Yt+2]||Qe,qt=Math.min(je,Dt),Ct=ve[Ze+1],Et;if(Ct.nodeType!==1&&(Et=ot.substring(Z,qt))){pe&&(Et=Et.replace(Je,"\r")),Ct.nodeValue=Et;var Ut=Ct.ownerDocument,Xt=Ut.createElement("span");Xt.className=lt[Yt+1];var Xe=Ct.parentNode;Xe.replaceChild(Xt,Ct),Xt.appendChild(Ct),Z<je&&(ve[Ze+1]=Ct=Ut.createTextNode(ot.substring(qt,je)),Xe.insertBefore(Ct,Xt.nextSibling))}Z=qt,Z>=je&&(Ze+=2),Z>=Dt&&(Yt+=2)}}finally{Te&&(Te.style.display=Re)}}var It={};function bt(Ne,pe){for(var Je=pe.length;--Je>=0;){var ot=pe[Je];It.hasOwnProperty(ot)?w.console&&console.warn("cannot override language handler %s",ot):It[ot]=Ne}}function Oe(Ne,pe){return Ne&&It.hasOwnProperty(Ne)||(Ne=/^\s*</.test(pe)?"default-markup":"default-code"),It[Ne]}bt(Kt,["default-code"]),bt(et([],[[We,/^[^<?]+/],[Rt,/^<!\w[^>]*(?:>|$)/],[be,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[ke,/^(?:<[%?]|[%?]>)/],["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"]),bt(et([[We,/^[\s]+/,null,` \r
|
|
|
`],[q,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[ze,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[z,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[ke,/^[=<>\/]+/],["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"]),bt(et([],[[q,/^[\s\S]+/]]),["uq.val"]),bt(pt({keywords:ne,hashComments:!0,cStyleComments:!0,types:N}),["c","cc","cpp","cxx","cyc","m"]),bt(pt({keywords:"null,true,false"}),["json"]),bt(pt({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:N}),["cs"]),bt(pt({keywords:I,cStyleComments:!0}),["java"]),bt(pt({keywords:j,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),bt(pt({keywords:X,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),bt(pt({keywords:O,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),bt(pt({keywords:G,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),bt(pt({keywords:M,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),bt(pt({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),bt(et([],[[V,/^[\s\S]+/]]),["regex"]);function mt(Ne){var pe=Ne.langExtension;try{var Je=L(Ne.sourceNode,Ne.pre),ot=Je.sourceCode;Ne.sourceCode=ot,Ne.spans=Je.spans,Ne.basePos=0,Oe(pe,ot)(Ne),Zt(Ne)}catch(Qe){w.console&&console.log(Qe&&Qe.stack||Qe)}}function $e(Ne,pe,Je){var ot=Je||!1,Qe=pe||null,Z=document.createElement("div");Z.innerHTML="<pre>"+Ne+"</pre>",Z=Z.firstChild,ot&&Pe(Z,ot,!0);var ve={langExtension:Qe,numberLines:ot,sourceNode:Z,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return mt(ve),Z.innerHTML}function jt(Ne,pe){var Je=pe||document.body,ot=Je.ownerDocument||document;function Qe(vt){return Je.getElementsByTagName(vt)}for(var Z=[Qe("pre"),Qe("code"),Qe("xmp")],ve=[],Be=0;Be<Z.length;++Be)for(var Ze=0,lt=Z[Be].length;Ze<lt;++Ze)ve.push(Z[Be][Ze]);Z=null;var yt=Date;yt.now||(yt={now:function(){return+new Date}});var Yt=0,gt=/\blang(?:uage)?-([\w.]+)(?!\S)/,Se=/\bprettyprint\b/,kt=/\bprettyprinted\b/,Nt=/pre|xmp/i,qt=/^code$/i,Te=/^(?:pre|code|xmp)$/i,Re={};function st(){for(var vt=w.PR_SHOULD_USE_CONTINUATION?yt.now()+250:1/0;Yt<ve.length&&yt.now()<vt;Yt++){for(var je=ve[Yt],Dt=Re,Ct=je;Ct=Ct.previousSibling;){var Et=Ct.nodeType,Ut=(Et===7||Et===8)&&Ct.nodeValue;if(Ut?!/^\??prettify\b/.test(Ut):Et!==3||/\S/.test(Ct.nodeValue))break;if(Ut){Dt={},Ut.replace(/\b(\w+)=([\w:.%+-]+)/g,function(_t,ut,Gt){Dt[ut]=Gt});break}}var Xt=je.className;if((Dt!==Re||Se.test(Xt))&&!kt.test(Xt)){for(var Xe=!1,Vt=je.parentNode;Vt;Vt=Vt.parentNode){var De=Vt.tagName;if(Te.test(De)&&Vt.className&&Se.test(Vt.className)){Xe=!0;break}}if(!Xe){je.className+=" prettyprinted";var xe=Dt.lang;if(!xe){xe=Xt.match(gt);var Ee;!xe&&(Ee=le(je))&&qt.test(Ee.tagName)&&(xe=Ee.className.match(gt)),xe&&(xe=xe[1])}var U;if(Nt.test(je.tagName))U=1;else{var H=je.currentStyle,ae=ot.defaultView,ce=H?H.whiteSpace:ae&&ae.getComputedStyle?ae.getComputedStyle(je,null).getPropertyValue("white-space"):0;U=ce&&ce.substring(0,3)==="pre"}var ye=Dt.linenums;(ye=ye==="true"||+ye)||(ye=Xt.match(/\blinenums\b(?::(\d+))?/),ye=ye?ye[1]&&ye[1].length?+ye[1]:!0:!1),ye&&Pe(je,ye,U);var ct={langExtension:xe,sourceNode:je,numberLines:ye,pre:U,sourceCode:null,basePos:null,spans:null,decorations:null};mt(ct)}}}Yt<ve.length?w.setTimeout(st,250):typeof Ne=="function"&&Ne()}st()}var ei=w.PR={createSimpleLexer:et,registerLangHandler:bt,sourceDecorator:pt,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:q,PR_COMMENT:be,PR_DECLARATION:Rt,PR_KEYWORD:fe,PR_LITERAL:se,PR_NOCODE:Q,PR_PLAIN:We,PR_PUNCTUATION:ke,PR_SOURCE:te,PR_STRING:V,PR_TAG:ze,PR_TYPE:Ae,prettyPrintOne:ue?w.prettyPrintOne=$e:me=$e,prettyPrint:J=ue?w.prettyPrint=jt:J=jt},Ce=w.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return ei})})()},25769:function(Ci,Ft,re){"use strict";var ue=re(98040),we={"text/plain":"Text","text/html":"Url",default:"Text"},Ye="Copy to clipboard: #{key}, Enter";function me(w){var Le=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return w.replace(/#{\s*key\s*}/g,Le)}function J(w,Le){var P,f,ne,I,k,T,M=!1;Le||(Le={}),P=Le.debug||!1;try{ne=ue(),I=document.createRange(),k=document.getSelection(),T=document.createElement("span"),T.textContent=w,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(X){if(X.stopPropagation(),Le.format)if(X.preventDefault(),typeof X.clipboardData=="undefined"){P&&console.warn("unable to use e.clipboardData"),P&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var G=we[Le.format]||we.default;window.clipboardData.setData(G,w)}else X.clipboardData.clearData(),X.clipboardData.setData(Le.format,w);Le.onCopy&&(X.preventDefault(),Le.onCopy(X.clipboardData))}),document.body.appendChild(T),I.selectNodeContents(T),k.addRange(I);var O=document.execCommand("copy");if(!O)throw new Error("copy command was unsuccessful");M=!0}catch(X){P&&console.error("unable to copy using execCommand: ",X),P&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(Le.format||"text",w),Le.onCopy&&Le.onCopy(window.clipboardData),M=!0}catch(G){P&&console.error("unable to copy using clipboardData: ",G),P&&console.error("falling back to prompt"),f=me("message"in Le?Le.message:Ye),window.prompt(f,w)}}finally{k&&(typeof k.removeRange=="function"?k.removeRange(I):k.removeAllRanges()),T&&document.body.removeChild(T),ne()}return M}Ci.exports=J},53184:function(Ci,Ft,re){"use strict";var ue,we;function Ye(me,J,w){var Le=function(P,f){return me.js_beautify(P,f)};return Le.js=me.js_beautify,Le.css=J.css_beautify,Le.html=w.html_beautify,Le.js_beautify=me.js_beautify,Le.css_beautify=J.css_beautify,Le.html_beautify=w.html_beautify,Le}ue=[re(58553),re(87804),re(40998)],we=function(me,J,w){return Ye(me,J,w)}.apply(Ft,ue),we!==void 0&&(Ci.exports=we)},87804:function(Ci,Ft){var re,ue;(function(){var we;(function(){"use strict";var me=[,,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 ne(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}ne.prototype.get_indent_size=function(k,T){var M=this.__base_string_length;return T=T||0,k<0&&(M=0),M+=k*this.__indent_size,M+=T,M},ne.prototype.get_indent_string=function(k,T){var M=this.__base_string;return T=T||0,k<0&&(k=0,M=""),T+=k*this.__indent_size,this.__ensure_cache(T),M+=this.__cache[T],M},ne.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},ne.prototype.__add_column=function(){var k=this.__cache.length,T=0,M="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,M=new Array(T+1).join(this.__indent_string)),k&&(M+=new Array(k+1).join(" ")),this.__cache.push(M)};function I(k,T){this.__indent_cache=new ne(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()}I.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},I.prototype.get_line_number=function(){return this.__lines.length},I.prototype.get_indent_string=function(k,T){return this.__indent_cache.get_indent_string(k,T)},I.prototype.get_indent_size=function(k,T){return this.__indent_cache.get_indent_size(k,T)},I.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},I.prototype.add_new_line=function(k){return this.is_empty()||!k&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},I.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 M=this.__lines.join(`
|
|
|
`);return k!==`
|
|
|
`&&(M=M.replace(/[\n]/g,k)),M},I.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},I.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)},I.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},I.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()},I.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(" "))},I.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()},I.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},I.prototype.just_added_newline=function(){return this.current_line.is_empty()},I.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},I.prototype.ensure_empty_line_above=function(k,T){for(var M=this.__lines.length-2;M>=0;){var O=this.__lines[M];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(M+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}M--}},P.exports.Output=I},,,,function(P){function f(k,T){this.raw_options=ne(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 M=this.raw_options[k],O=T||[];return typeof M=="object"?M!==null&&typeof M.concat=="function"&&(O=M.concat()):typeof M=="string"&&(O=M.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var M=this.raw_options[k],O=M===void 0?!!T:!!M;return O},f.prototype._get_characters=function(k,T){var M=this.raw_options[k],O=T||"";return typeof M=="string"&&(O=M.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var M=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(M,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,M){var O=this._get_selection_list(k,T,M);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,M){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(M=M||[T[0]],!this._is_valid_selection(M,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,M);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(M){return T.indexOf(M)===-1})};function ne(k,T){var M={};k=I(k);var O;for(O in k)O!==T&&(M[O]=k[O]);if(T&&k[T])for(O in k[T])M[O]=k[T][O];return M}function I(k){var T={},M;for(M in k){var O=M.replace(/-/g,"_");T[O]=k[M]}return T}P.exports.Options=f,P.exports.normalizeOpts=I,P.exports.mergeOpts=ne},,function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function ne(I){this.__input=I||"",this.__input_length=this.__input.length,this.__position=0}ne.prototype.restart=function(){this.__position=0},ne.prototype.back=function(){this.__position>0&&(this.__position-=1)},ne.prototype.hasNext=function(){return this.__position<this.__input_length},ne.prototype.next=function(){var I=null;return this.hasNext()&&(I=this.__input.charAt(this.__position),this.__position+=1),I},ne.prototype.peek=function(I){var k=null;return I=I||0,I+=this.__position,I>=0&&I<this.__input_length&&(k=this.__input.charAt(I)),k},ne.prototype.__match=function(I,k){I.lastIndex=k;var T=I.exec(this.__input);return T&&!(f&&I.sticky)&&T.index!==k&&(T=null),T},ne.prototype.test=function(I,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(I,k):!1},ne.prototype.testChar=function(I,k){var T=this.peek(k);return I.lastIndex=0,T!==null&&I.test(T)},ne.prototype.match=function(I){var k=this.__match(I,this.__position);return k?this.__position+=k[0].length:k=null,k},ne.prototype.read=function(I,k,T){var M="",O;return I&&(O=this.match(I),O&&(M+=O[0])),k&&(O||!I)&&(M+=this.readUntil(k,T)),M},ne.prototype.readUntil=function(I,k){var T="",M=this.__position;I.lastIndex=this.__position;var O=I.exec(this.__input);return O?(M=O.index,k&&(M+=O[0].length)):M=this.__input_length,T=this.__input.substring(this.__position,M),this.__position=M,T},ne.prototype.readUntilAfter=function(I){return this.readUntil(I,!0)},ne.prototype.get_regexp=function(I,k){var T=null,M="g";return k&&f&&(M="y"),typeof I=="string"&&I!==""?T=new RegExp(I,M):I&&(T=new RegExp(I.source,M)),T},ne.prototype.get_literal_regexp=function(I){return RegExp(I.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ne.prototype.peekUntilAfter=function(I){var k=this.__position,T=this.readUntilAfter(I);return this.__position=k,T},ne.prototype.lookBack=function(I){var k=this.__position-1;return k>=I.length&&this.__input.substring(k-I.length,k).toLowerCase()===I},P.exports.InputScanner=ne},,,,,function(P){function f(ne,I){ne=typeof ne=="string"?ne:ne.source,I=typeof I=="string"?I:I.source,this.__directives_block_pattern=new RegExp(ne+/ beautify( \w+[:]\w+)+ /.source+I,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(ne+/\sbeautify\signore:end\s/.source+I,"g")}f.prototype.get_directives=function(ne){if(!ne.match(this.__directives_block_pattern))return null;var I={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(ne);k;)I[k[1]]=k[2],k=this.__directive_pattern.exec(ne);return I},f.prototype.readIgnored=function(ne){return ne.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},,function(P,f,ne){var I=ne(16).Beautifier,k=ne(17).Options;function T(M,O){var X=new I(M,O);return X.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,ne){var I=ne(17).Options,k=ne(2).Output,T=ne(8).InputScanner,M=ne(13).Directives,O=new M(/\/\*/,/\*\//),X=/\r\n|[\r\n]/,G=/\r\n|[\r\n]/g,j=/\s/,$=/(?:\s|\n)+/g,N=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,V=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function fe(be,Ae){this._source_text=be||"",this._options=new I(Ae),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"]}fe.prototype.eatString=function(be){var Ae="";for(this._ch=this._input.next();this._ch;){if(Ae+=this._ch,this._ch==="\\")Ae+=this._input.next();else if(be.indexOf(this._ch)!==-1||this._ch===`
|
|
|
`)break;this._ch=this._input.next()}return Ae},fe.prototype.eatWhitespace=function(be){for(var Ae=j.test(this._input.peek()),se=0;j.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 Ae},fe.prototype.foundNestedPseudoClass=function(){for(var be=0,Ae=1,se=this._input.peek(Ae);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;Ae++,se=this._input.peek(Ae)}return!1},fe.prototype.print_string=function(be){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(be)},fe.prototype.preserveSingleSpace=function(be){be&&(this._output.space_before_token=!0)},fe.prototype.indent=function(){this._indentLevel++},fe.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},fe.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var be=this._source_text,Ae=this._options.eol;Ae==="auto"&&(Ae=`
|
|
|
`,be&&X.test(be||"")&&(Ae=be.match(X)[0])),be=be.replace(G,`
|
|
|
`);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 ke=0,We=!1,ze=!1,Rt=!1,te=!1,z=!1,q=this._ch,Q=!1,de,ie,L;de=this._input.read($),ie=de!=="",L=q,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),q=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var A=this._input.read(N),W=O.get_directives(A);W&&W.ignore==="start"&&(A+=O.readIgnored(this._input)),this.print_string(A),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(ie),this.print_string(this._ch);var le=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);le.match(/[ :]$/)&&(le=this.eatString(": ").replace(/\s+$/,""),this.print_string(le),this._output.space_before_token=!0),ke===0&&le.indexOf(":")!==-1&&(ze=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(ie),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var et=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);et.match(/[ :]$/)&&(et=this.eatString(": ").replace(/\s+$/,""),this.print_string(et),this._output.space_before_token=!0),ke===0&&et.indexOf(":")!==-1?(ze=!0,this.indent()):et in this.NESTED_AT_RULE?(this._nestedLevel+=1,et in this.CONDITIONAL_GROUP_RULE&&(Rt=!0)):ke===0&&!ze&&(te=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(ie),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")ze&&(ze=!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)):(L==="("?this._output.space_before_token=!1:L!==","&&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(),L==="{"&&this._output.trim(!0),ze&&(this.outdent(),ze=!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])){Q=!0;break}(We||Rt)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!te&&ke===0?(this.print_string(":"),ze||(ze=!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 Kt=L==='"'||L==="'";this.preserveSingleSpace(Kt||ie),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")Q=!1,ke===0?(ze&&(this.outdent(),ze=!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(),ke++,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(")")),ke&&(ke--,this.outdent()));else{var Pe=!1;this._input.lookBack("with")&&(Pe=!0),this.preserveSingleSpace(ie||Pe),this.print_string(this._ch),ze&&L==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),ke++,this.indent())}else if(this._ch===")")ke&&(ke--,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&&(!ze||z)&&ke===0&&!te?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!ze&&ke===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&&j.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(ie),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),j.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 Zt=L==='"'||L==="'";this.preserveSingleSpace(Zt||ie),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
|
`&&Q&&this._output.add_new_line()}var It=this._output.get_code(Ae);return It},P.exports.Beautifier=fe},function(P,f,ne){var I=ne(6).Options;function k(T){I.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 M=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||M;var O=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var X=0;X<O.length;X++)O[X]!=="expand"?this.brace_style="collapse":this.brace_style=O[X]}k.prototype=new I,P.exports.Options=k}],J={};function w(P){var f=J[P];if(f!==void 0)return f.exports;var ne=J[P]={exports:{}};return me[P](ne,ne.exports,w),ne.exports}var Le=w(15);we=Le})();var Ye=we;re=[],ue=function(){return{css_beautify:Ye}}.apply(Ft,re),ue!==void 0&&(Ci.exports=ue)})()},40998:function(Ci,Ft,re){var ue,we;(function(){var Ye;(function(){"use strict";var Le=[,,function(I){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 X=this.__items.length-1;X>=0;X--)if(this.__items[X].match(O))return!0;return!1},k.prototype.set_indent=function(O,X){this.is_empty()&&(this.__indent_count=O||0,this.__alignment_count=X||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 X=O.lastIndexOf(`
|
|
|
`);X!==-1?this.__character_count=O.length-X: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,X){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)),X=X||"",O.indent_level>0&&(X=new Array(O.indent_level+1).join(this.__indent_string)),this.__base_string=X,this.__base_string_length=X.length}T.prototype.get_indent_size=function(O,X){var G=this.__base_string_length;return X=X||0,O<0&&(G=0),G+=O*this.__indent_size,G+=X,G},T.prototype.get_indent_string=function(O,X){var G=this.__base_string;return X=X||0,O<0&&(O=0,G=""),X+=O*this.__indent_size,this.__ensure_cache(X),G+=this.__cache[X],G},T.prototype.__ensure_cache=function(O){for(;O>=this.__cache.length;)this.__add_column()},T.prototype.__add_column=function(){var O=this.__cache.length,X=0,G="";this.__indent_size&&O>=this.__indent_size&&(X=Math.floor(O/this.__indent_size),O-=X*this.__indent_size,G=new Array(X+1).join(this.__indent_string)),O&&(G+=new Array(O+1).join(" ")),this.__cache.push(G)};function M(O,X){this.__indent_cache=new T(O,X),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()}M.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},M.prototype.get_line_number=function(){return this.__lines.length},M.prototype.get_indent_string=function(O,X){return this.__indent_cache.get_indent_string(O,X)},M.prototype.get_indent_size=function(O,X){return this.__indent_cache.get_indent_size(O,X)},M.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},M.prototype.add_new_line=function(O){return this.is_empty()||!O&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},M.prototype.get_code=function(O){this.trim(!0);var X=this.current_line.pop();X&&(X[X.length-1]===`
|
|
|
`&&(X=X.replace(/\n+$/g,"")),this.current_line.push(X)),this._end_with_newline&&this.__add_outputline();var G=this.__lines.join(`
|
|
|
`);return O!==`
|
|
|
`&&(G=G.replace(/[\n]/g,O)),G},M.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},M.prototype.set_indent=function(O,X){return O=O||0,X=X||0,this.next_line.set_indent(O,X),this.__lines.length>1?(this.current_line.set_indent(O,X),!0):(this.current_line.set_indent(),!1)},M.prototype.add_raw_token=function(O){for(var X=0;X<O.newlines;X++)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},M.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()},M.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(" "))},M.prototype.remove_indent=function(O){for(var X=this.__lines.length;O<X;)this.__lines[O]._remove_indent(),O++;this.current_line._remove_wrap_indent()},M.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},M.prototype.just_added_newline=function(){return this.current_line.is_empty()},M.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},M.prototype.ensure_empty_line_above=function(O,X){for(var G=this.__lines.length-2;G>=0;){var j=this.__lines[G];if(j.is_empty())break;if(j.item(0).indexOf(O)!==0&&j.item(-1)!==X){this.__lines.splice(G+1,0,new k(this)),this.previous_line=this.__lines[this.__lines.length-2];break}G--}},I.exports.Output=M},function(I){function k(T,M,O,X){this.type=T,this.text=M,this.comments_before=null,this.newlines=O||0,this.whitespace_before=X||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}I.exports.Token=k},,,function(I){function k(O,X){this.raw_options=T(O,X),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,X){var G=this.raw_options[O],j=X||[];return typeof G=="object"?G!==null&&typeof G.concat=="function"&&(j=G.concat()):typeof G=="string"&&(j=G.split(/[^a-zA-Z0-9_\/\-]+/)),j},k.prototype._get_boolean=function(O,X){var G=this.raw_options[O],j=G===void 0?!!X:!!G;return j},k.prototype._get_characters=function(O,X){var G=this.raw_options[O],j=X||"";return typeof G=="string"&&(j=G.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),j},k.prototype._get_number=function(O,X){var G=this.raw_options[O];X=parseInt(X,10),isNaN(X)&&(X=0);var j=parseInt(G,10);return isNaN(j)&&(j=X),j},k.prototype._get_selection=function(O,X,G){var j=this._get_selection_list(O,X,G);if(j.length!==1)throw new Error("Invalid Option Value: The option '"+O+`' can only be one of the following values:
|
|
|
`+X+`
|
|
|
You passed in: '`+this.raw_options[O]+"'");return j[0]},k.prototype._get_selection_list=function(O,X,G){if(!X||X.length===0)throw new Error("Selection list cannot be empty.");if(G=G||[X[0]],!this._is_valid_selection(G,X))throw new Error("Invalid Default Value!");var j=this._get_array(O,G);if(!this._is_valid_selection(j,X))throw new Error("Invalid Option Value: The option '"+O+`' can contain only the following values:
|
|
|
`+X+`
|
|
|
You passed in: '`+this.raw_options[O]+"'");return j},k.prototype._is_valid_selection=function(O,X){return O.length&&X.length&&!O.some(function(G){return X.indexOf(G)===-1})};function T(O,X){var G={};O=M(O);var j;for(j in O)j!==X&&(G[j]=O[j]);if(X&&O[X])for(j in O[X])G[j]=O[X][j];return G}function M(O){var X={},G;for(G in O){var j=G.replace(/-/g,"_");X[j]=O[G]}return X}I.exports.Options=k,I.exports.normalizeOpts=M,I.exports.mergeOpts=T},,function(I){var k=RegExp.prototype.hasOwnProperty("sticky");function T(M){this.__input=M||"",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 M=null;return this.hasNext()&&(M=this.__input.charAt(this.__position),this.__position+=1),M},T.prototype.peek=function(M){var O=null;return M=M||0,M+=this.__position,M>=0&&M<this.__input_length&&(O=this.__input.charAt(M)),O},T.prototype.__match=function(M,O){M.lastIndex=O;var X=M.exec(this.__input);return X&&!(k&&M.sticky)&&X.index!==O&&(X=null),X},T.prototype.test=function(M,O){return O=O||0,O+=this.__position,O>=0&&O<this.__input_length?!!this.__match(M,O):!1},T.prototype.testChar=function(M,O){var X=this.peek(O);return M.lastIndex=0,X!==null&&M.test(X)},T.prototype.match=function(M){var O=this.__match(M,this.__position);return O?this.__position+=O[0].length:O=null,O},T.prototype.read=function(M,O,X){var G="",j;return M&&(j=this.match(M),j&&(G+=j[0])),O&&(j||!M)&&(G+=this.readUntil(O,X)),G},T.prototype.readUntil=function(M,O){var X="",G=this.__position;M.lastIndex=this.__position;var j=M.exec(this.__input);return j?(G=j.index,O&&(G+=j[0].length)):G=this.__input_length,X=this.__input.substring(this.__position,G),this.__position=G,X},T.prototype.readUntilAfter=function(M){return this.readUntil(M,!0)},T.prototype.get_regexp=function(M,O){var X=null,G="g";return O&&k&&(G="y"),typeof M=="string"&&M!==""?X=new RegExp(M,G):M&&(X=new RegExp(M.source,G)),X},T.prototype.get_literal_regexp=function(M){return RegExp(M.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},T.prototype.peekUntilAfter=function(M){var O=this.__position,X=this.readUntilAfter(M);return this.__position=O,X},T.prototype.lookBack=function(M){var O=this.__position-1;return O>=M.length&&this.__input.substring(O-M.length,O).toLowerCase()===M},I.exports.InputScanner=T},function(I,k,T){var M=T(8).InputScanner,O=T(3).Token,X=T(10).TokenStream,G=T(11).WhitespacePattern,j={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},$=function(N,V){this._input=new M(N),this._options=V||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new G(this._input)};$.prototype.tokenize=function(){this._input.restart(),this.__tokens=new X,this._reset();for(var N,V=new O(j.START,""),fe=null,be=[],Ae=new X;V.type!==j.EOF;){for(N=this._get_next_token(V,fe);this._is_comment(N);)Ae.add(N),N=this._get_next_token(V,fe);Ae.isEmpty()||(N.comments_before=Ae,Ae=new X),N.parent=fe,this._is_opening(N)?(be.push(fe),fe=N):fe&&this._is_closing(N,fe)&&(N.opened=fe,fe.closed=N,fe=be.pop(),N.parent=fe),N.previous=V,V.next=N,this.__tokens.add(N),V=N}return this.__tokens},$.prototype._is_first_token=function(){return this.__tokens.isEmpty()},$.prototype._reset=function(){},$.prototype._get_next_token=function(N,V){this._readWhitespace();var fe=this._input.read(/.+/g);return fe?this._create_token(j.RAW,fe):this._create_token(j.EOF,"")},$.prototype._is_comment=function(N){return!1},$.prototype._is_opening=function(N){return!1},$.prototype._is_closing=function(N,V){return!1},$.prototype._create_token=function(N,V){var fe=new O(N,V,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return fe},$.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},I.exports.Tokenizer=$,I.exports.TOKEN=j},function(I){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 M=null;return T=T||0,T+=this.__position,T>=0&&T<this.__tokens_length&&(M=this.__tokens[T]),M},k.prototype.add=function(T){this.__parent_token&&(T.parent=this.__parent_token),this.__tokens.push(T),this.__tokens_length+=1},I.exports.TokenStream=k},function(I,k,T){var M=T(12).Pattern;function O(X,G){M.call(this,X,G),G?this._line_regexp=this._input.get_regexp(G._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}O.prototype=new M,O.prototype.__set_whitespace_patterns=function(X,G){X+="\\t ",G+="\\n\\r",this._match_pattern=this._input.get_regexp("["+X+G+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+G+"]")},O.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var X=this._input.read(this._match_pattern);if(X===" ")this.whitespace_before_token=" ";else if(X){var G=this.__split(this._newline_regexp,X);this.newline_count=G.length-1,this.whitespace_before_token=G[this.newline_count]}return X},O.prototype.matching=function(X,G){var j=this._create();return j.__set_whitespace_patterns(X,G),j._update(),j},O.prototype._create=function(){return new O(this._input,this)},O.prototype.__split=function(X,G){X.lastIndex=0;for(var j=0,$=[],N=X.exec(G);N;)$.push(G.substring(j,N.index)),j=N.index+N[0].length,N=X.exec(G);return j<G.length?$.push(G.substring(j,G.length)):$.push(""),$},I.exports.WhitespacePattern=O},function(I){function k(T,M){this._input=T,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,M&&(this._starting_pattern=this._input.get_regexp(M._starting_pattern,!0),this._match_pattern=this._input.get_regexp(M._match_pattern,!0),this._until_pattern=this._input.get_regexp(M._until_pattern),this._until_after=M._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 M=this._create();return M._until_after=!0,M._until_pattern=this._input.get_regexp(T),M._update(),M},k.prototype.until=function(T){var M=this._create();return M._until_after=!1,M._until_pattern=this._input.get_regexp(T),M._update(),M},k.prototype.starting_with=function(T){var M=this._create();return M._starting_pattern=this._input.get_regexp(T,!0),M._update(),M},k.prototype.matching=function(T){var M=this._create();return M._match_pattern=this._input.get_regexp(T,!0),M._update(),M},k.prototype._create=function(){return new k(this._input,this)},k.prototype._update=function(){},I.exports.Pattern=k},function(I){function k(T,M){T=typeof T=="string"?T:T.source,M=typeof M=="string"?M:M.source,this.__directives_block_pattern=new RegExp(T+/ beautify( \w+[:]\w+)+ /.source+M,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(T+/\sbeautify\signore:end\s/.source+M,"g")}k.prototype.get_directives=function(T){if(!T.match(this.__directives_block_pattern))return null;var M={};this.__directive_pattern.lastIndex=0;for(var O=this.__directive_pattern.exec(T);O;)M[O[1]]=O[2],O=this.__directive_pattern.exec(T);return M},k.prototype.readIgnored=function(T){return T.readUntilAfter(this.__directives_end_ignore_pattern)},I.exports.Directives=k},function(I,k,T){var M=T(12).Pattern,O={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function X(G,j){M.call(this,G,j),this.__template_pattern=null,this._disabled=Object.assign({},O),this._excluded=Object.assign({},O),j&&(this.__template_pattern=this._input.get_regexp(j.__template_pattern),this._excluded=Object.assign(this._excluded,j._excluded),this._disabled=Object.assign(this._disabled,j._disabled));var $=new M(G);this.__patterns={handlebars_comment:$.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:$.starting_with(/{{{/).until_after(/}}}/),handlebars:$.starting_with(/{{/).until_after(/}}/),php:$.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:$.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:$.starting_with(/{%/).until_after(/%}/),django_value:$.starting_with(/{{/).until_after(/}}/),django_comment:$.starting_with(/{#/).until_after(/#}/),smarty:$.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:$.starting_with(/{\*/).until_after(/\*}/),smarty_literal:$.starting_with(/{literal}/).until_after(/{\/literal}/)}}X.prototype=new M,X.prototype._create=function(){return new X(this._input,this)},X.prototype._update=function(){this.__set_templated_pattern()},X.prototype.disable=function(G){var j=this._create();return j._disabled[G]=!0,j._update(),j},X.prototype.read_options=function(G){var j=this._create();for(var $ in O)j._disabled[$]=G.templating.indexOf($)===-1;return j._update(),j},X.prototype.exclude=function(G){var j=this._create();return j._excluded[G]=!0,j._update(),j},X.prototype.read=function(){var G="";this._match_pattern?G=this._input.read(this._starting_pattern):G=this._input.read(this._starting_pattern,this.__template_pattern);for(var j=this._read_template();j;)this._match_pattern?j+=this._input.read(this._match_pattern):j+=this._input.readUntil(this.__template_pattern),G+=j,j=this._read_template();return this._until_after&&(G+=this._input.readUntilAfter(this._until_pattern)),G},X.prototype.__set_templated_pattern=function(){var G=[];this._disabled.php||G.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||G.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||G.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||G.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(G.push(this.__patterns.django._starting_pattern.source),G.push(this.__patterns.django_value._starting_pattern.source),G.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||G.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&G.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+G.join("|")+")")},X.prototype._read_template=function(){var G="",j=this._input.peek();if(j==="<"){var $=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&$==="?"&&(G=G||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&$==="%"&&(G=G||this.__patterns.erb.read())}else j==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(G=G||this.__patterns.handlebars_comment.read(),G=G||this.__patterns.handlebars_unescaped.read(),G=G||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(G=G||this.__patterns.django_value.read()),this._excluded.django||(G=G||this.__patterns.django_comment.read(),G=G||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(G=G||this.__patterns.smarty_comment.read(),G=G||this.__patterns.smarty_literal.read(),G=G||this.__patterns.smarty.read()));return G},I.exports.TemplatablePattern=X},,,,function(I,k,T){var M=T(19).Beautifier,O=T(20).Options;function X(G,j,$,N){var V=new M(G,j,$,N);return V.beautify()}I.exports=X,I.exports.defaultOptions=function(){return new O}},function(I,k,T){var M=T(20).Options,O=T(2).Output,X=T(21).Tokenizer,G=T(21).TOKEN,j=/\r\n|[\r\n]/,$=/\r\n|[\r\n]/g,N=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)};N.prototype.current_line_has_match=function(te){return this._output.current_line.has_match(te)},N.prototype.set_space_before_token=function(te,z){this._output.space_before_token=te,this._output.non_breaking_space=z},N.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},N.prototype.add_raw_token=function(te){this._output.add_raw_token(te)},N.prototype.print_preserved_newlines=function(te){var z=0;te.type!==G.TEXT&&te.previous.type!==G.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 q=0;q<z;q++)this.print_newline(q>0);return z!==0},N.prototype.traverse_whitespace=function(te){return te.whitespace_before||te.newlines?(this.print_preserved_newlines(te)||(this._output.space_before_token=!0),!0):!1},N.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},N.prototype.print_newline=function(te){this._output.add_new_line(te)},N.prototype.print_token=function(te){te.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(te.text))},N.prototype.indent=function(){this.indent_level++},N.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},N.prototype.get_full_indent=function(te){return te=this.indent_level+(te||0),te<1?"":this._output.get_indent_string(te)};var V=function(te){for(var z=null,q=te.next;q.type!==G.EOF&&te.closed!==q;){if(q.type===G.ATTRIBUTE&&q.text==="type"){q.next&&q.next.type===G.EQUALS&&q.next.next&&q.next.next.type===G.VALUE&&(z=q.next.next.text);break}q=q.next}return z},fe=function(te,z){var q=null,Q=null;return z.closed?(te==="script"?q="text/javascript":te==="style"&&(q="text/css"),q=V(z)||q,q.search("text/css")>-1?Q="css":q.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?Q="javascript":q.search(/(text|application|dojo)\/(x-)?(html)/)>-1?Q="html":q.search(/test\/null/)>-1&&(Q="null"),Q):null};function be(te,z){return z.indexOf(te)!==-1}function Ae(te,z,q){this.parent=te||null,this.tag=z?z.tag_name:"",this.indent_level=q||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 Ae(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 q=this._current_frame;q&&te.indexOf(q.tag)===-1;){if(z&&z.indexOf(q.tag)!==-1){q=null;break}q=q.parent}return q},se.prototype.try_pop=function(te,z){var q=this._get_frame([te],z);return this._try_pop_frame(q)},se.prototype.indent_to_tag=function(te){var z=this._get_frame(te);z&&(this._printer.indent_level=z.indent_level)};function ke(te,z,q,Q){this._source_text=te||"",z=z||{},this._js_beautify=q,this._css_beautify=Q,this._tag_stack=null;var de=new M(z,"html");this._options=de,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"}ke.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&&j.test(te)&&(z=te.match(j)[0])),te=te.replace($,`
|
|
|
`);var q=te.match(/^[\t ]*/)[0],Q={text:"",type:""},de=new We(this._options),ie=new N(this._options,q),L=new X(te,this._options).tokenize();this._tag_stack=new se(ie);for(var A=null,W=L.next();W.type!==G.EOF;)W.type===G.TAG_OPEN||W.type===G.COMMENT?(A=this._handle_tag_open(ie,W,de,Q,L),de=A):W.type===G.ATTRIBUTE||W.type===G.EQUALS||W.type===G.VALUE||W.type===G.TEXT&&!de.tag_complete?A=this._handle_inside_tag(ie,W,de,Q):W.type===G.TAG_CLOSE?A=this._handle_tag_close(ie,W,de):W.type===G.TEXT?A=this._handle_text(ie,W,de):W.type===G.CONTROL_FLOW_OPEN?A=this._handle_control_flow_open(ie,W):W.type===G.CONTROL_FLOW_CLOSE?A=this._handle_control_flow_close(ie,W):ie.add_raw_token(W),Q=A,W=L.next();var le=ie._output.get_code(z);return le},ke.prototype._handle_control_flow_open=function(te,z){var q={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(),q},ke.prototype._handle_control_flow_close=function(te,z){var q={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),q},ke.prototype._handle_tag_close=function(te,z,q){var Q={text:z.text,type:z.type};return te.alignment_size=0,q.tag_complete=!0,te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),q.is_unformatted?te.add_raw_token(z):(q.tag_start_char==="<"&&(te.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&q.has_wrapped_attrs&&te.print_newline(!1)),te.print_token(z)),q.indent_content&&!(q.is_unformatted||q.is_content_unformatted)&&(te.indent(),q.indent_content=!1),!q.is_inline_element&&!(q.is_unformatted||q.is_content_unformatted)&&te.set_wrap_point(),Q},ke.prototype._handle_inside_tag=function(te,z,q,Q){var de=q.has_wrapped_attrs,ie={text:z.text,type:z.type};return te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),q.is_unformatted?te.add_raw_token(z):q.tag_start_char==="{"&&z.type===G.TEXT?te.print_preserved_newlines(z)?(z.newlines=0,te.add_raw_token(z)):te.print_token(z):(z.type===G.ATTRIBUTE?te.set_space_before_token(!0):(z.type===G.EQUALS||z.type===G.VALUE&&z.previous.type===G.EQUALS)&&te.set_space_before_token(!1),z.type===G.ATTRIBUTE&&q.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(te.traverse_whitespace(z),de=de||z.newlines!==0),this._is_wrap_attributes_force&&q.attr_count>=this._options.wrap_attributes_min_attrs&&(Q.type!==G.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(te.print_newline(!1),de=!0)),te.print_token(z),de=de||te.previous_token_wrapped(),q.has_wrapped_attrs=de),ie},ke.prototype._handle_text=function(te,z,q){var Q={text:z.text,type:"TK_CONTENT"};return q.custom_beautifier_name?this._print_custom_beatifier_text(te,z,q):q.is_unformatted||q.is_content_unformatted?te.add_raw_token(z):(te.traverse_whitespace(z),te.print_token(z)),Q},ke.prototype._print_custom_beatifier_text=function(te,z,q){var Q=this;if(z.text!==""){var de=z.text,ie,L=1,A="",W="";q.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?ie=this._js_beautify:q.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?ie=this._css_beautify:q.custom_beautifier_name==="html"&&(ie=function(Zt,It){var bt=new ke(Zt,It,Q._js_beautify,Q._css_beautify);return bt.beautify()}),this._options.indent_scripts==="keep"?L=0:this._options.indent_scripts==="separate"&&(L=-te.indent_level);var le=te.get_full_indent(L);if(de=de.replace(/\n[ \t]*$/,""),q.custom_beautifier_name!=="html"&&de[0]==="<"&&de.match(/^(<!--|<!\[CDATA\[)/)){var et=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(de);if(!et){te.add_raw_token(z);return}A=le+et[1]+`
|
|
|
`,de=et[4],et[5]&&(W=le+et[5]),de=de.replace(/\n[ \t]*$/,""),(et[2]||et[3].indexOf(`
|
|
|
`)!==-1)&&(et=et[3].match(/[ \t]+$/),et&&(z.whitespace_before=et[0]))}if(de)if(ie){var pt=function(){this.eol=`
|
|
|
`};pt.prototype=this._options.raw_options;var Kt=new pt;de=ie(le+de,Kt)}else{var Pe=z.whitespace_before;Pe&&(de=de.replace(new RegExp(`
|
|
|
(`+Pe+")?","g"),`
|
|
|
`)),de=le+de.replace(/\n/g,`
|
|
|
`+le)}A&&(de?de=A+de+`
|
|
|
`+W:de=A+W),te.print_newline(!1),de&&(z.text=de,z.whitespace_before="",z.newlines=0,te.add_raw_token(z),te.print_newline(!0))}},ke.prototype._handle_tag_open=function(te,z,q,Q,de){var ie=this._get_tag_open_token(z);if((q.is_unformatted||q.is_content_unformatted)&&!q.is_empty_element&&z.type===G.TAG_OPEN&&!ie.is_start_tag?(te.add_raw_token(z),ie.start_tag_token=this._tag_stack.try_pop(ie.tag_name)):(te.traverse_whitespace(z),this._set_tag_position(te,z,ie,q,Q),ie.is_inline_element||te.set_wrap_point(),te.print_token(z)),ie.is_start_tag&&this._is_wrap_attributes_force){var L=0,A;do A=de.peek(L),A.type===G.ATTRIBUTE&&(ie.attr_count+=1),L+=1;while(A.type!==G.EOF&&A.type!==G.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(ie.alignment_size=z.text.length+1),!ie.tag_complete&&!ie.is_unformatted&&(te.alignment_size=ie.alignment_size),ie};var We=function(te,z,q){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="",!q)this.tag_complete=!0;else{var Q;this.tag_start_char=q.text[0],this.text=q.text,this.tag_start_char==="<"?(Q=q.text.match(/^<([^\s>]*)/),this.tag_check=Q?Q[1]:""):(Q=q.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=Q?Q[1]:"",(q.text.startsWith("{{#>")||q.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&q.next!==null?this.tag_check=q.next.text.split(" ")[0]:this.tag_check=q.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),q.type===G.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||q.closed&&q.closed.text==="/>";var de=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(de=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!te.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(de)))}};ke.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},ke.prototype._set_tag_position=function(te,z,q,Q,de){if(q.is_empty_element||(q.is_end_tag?q.start_tag_token=this._tag_stack.try_pop(q.tag_name):(this._do_optional_end_element(q)&&(q.is_inline_element||te.print_newline(!1)),this._tag_stack.record_tag(q),(q.tag_name==="script"||q.tag_name==="style")&&!(q.is_unformatted||q.is_content_unformatted)&&(q.custom_beautifier_name=fe(q.tag_check,z)))),be(q.tag_check,this._options.extra_liners)&&(te.print_newline(!1),te._output.just_added_blankline()||te.print_newline(!0)),q.is_empty_element){if(q.tag_start_char==="{"&&q.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),q.indent_content=!0;var ie=te.current_line_has_match(/{{#if/);ie||te.print_newline(!1)}q.tag_name==="!--"&&de.type===G.TAG_CLOSE&&Q.is_end_tag&&q.text.indexOf(`
|
|
|
`)===-1||(q.is_inline_element||q.is_unformatted||te.print_newline(!1),this._calcluate_parent_multiline(te,q))}else if(q.is_end_tag){var L=!1;L=q.start_tag_token&&q.start_tag_token.multiline_content,L=L||!q.is_inline_element&&!(Q.is_inline_element||Q.is_unformatted)&&!(de.type===G.TAG_CLOSE&&q.start_tag_token===Q)&&de.type!=="TK_CONTENT",(q.is_content_unformatted||q.is_unformatted)&&(L=!1),L&&te.print_newline(!1)}else q.indent_content=!q.custom_beautifier_name,q.tag_start_char==="<"&&(q.tag_name==="html"?q.indent_content=this._options.indent_inner_html:q.tag_name==="head"?q.indent_content=this._options.indent_head_inner_html:q.tag_name==="body"&&(q.indent_content=this._options.indent_body_inner_html)),!(q.is_inline_element||q.is_unformatted)&&(de.type!=="TK_CONTENT"||q.is_content_unformatted)&&te.print_newline(!1),this._calcluate_parent_multiline(te,q)},ke.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 ze=["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"];ke.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"&&ze.indexOf(te.tag_name)!==-1){var q=te.parent.parent;(!q||Rt.indexOf(q.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}},I.exports.Beautifier=ke},function(I,k,T){var M=T(6).Options;function O(X){M.call(this,X,"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 M,I.exports.Options=O},function(I,k,T){var M=T(9).Tokenizer,O=T(9).TOKEN,X=T(13).Directives,G=T(14).TemplatablePattern,j=T(12).Pattern,$={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},N=new X(/<\!--/,/-->/),V=function(fe,be){M.call(this,fe,be),this._current_tag_name="";var Ae=new G(this._input).read_options(this._options),se=new j(this._input);if(this.__patterns={word:Ae.until(/[\n\r\t <]/),word_control_flow_close_excluded:Ae.until(/[\n\r\t <}]/),single_quote:Ae.until_after(/'/),double_quote:Ae.until_after(/"/),attribute:Ae.until(/[\n\r\t =>]|\/>/),element_name:Ae.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 ke=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=se.matching(ke).until_after(ke)}};V.prototype=new M,V.prototype._is_comment=function(fe){return!1},V.prototype._is_opening=function(fe){return fe.type===$.TAG_OPEN||fe.type===$.CONTROL_FLOW_OPEN},V.prototype._is_closing=function(fe,be){return fe.type===$.TAG_CLOSE&&be&&((fe.text===">"||fe.text==="/>")&&be.text[0]==="<"||fe.text==="}}"&&be.text[0]==="{"&&be.text[1]==="{")||fe.type===$.CONTROL_FLOW_CLOSE&&fe.text==="}"&&be.text.endsWith("{")},V.prototype._reset=function(){this._current_tag_name=""},V.prototype._get_next_token=function(fe,be){var Ae=null;this._readWhitespace();var se=this._input.peek();return se===null?this._create_token($.EOF,""):(Ae=Ae||this._read_open_handlebars(se,be),Ae=Ae||this._read_attribute(se,fe,be),Ae=Ae||this._read_close(se,be),Ae=Ae||this._read_script_and_style(se,fe),Ae=Ae||this._read_control_flows(se,be),Ae=Ae||this._read_raw_content(se,fe,be),Ae=Ae||this._read_content_word(se,be),Ae=Ae||this._read_comment_or_cdata(se),Ae=Ae||this._read_processing(se),Ae=Ae||this._read_open(se,be),Ae=Ae||this._create_token($.UNKNOWN,this._input.next()),Ae)},V.prototype._read_comment_or_cdata=function(fe){var be=null,Ae=null,se=null;if(fe==="<"){var ke=this._input.peek(1);ke==="!"&&(Ae=this.__patterns.comment.read(),Ae?(se=N.get_directives(Ae),se&&se.ignore==="start"&&(Ae+=N.readIgnored(this._input))):Ae=this.__patterns.cdata.read()),Ae&&(be=this._create_token($.COMMENT,Ae),be.directives=se)}return be},V.prototype._read_processing=function(fe){var be=null,Ae=null,se=null;if(fe==="<"){var ke=this._input.peek(1);(ke==="!"||ke==="?")&&(Ae=this.__patterns.conditional_comment.read(),Ae=Ae||this.__patterns.processing.read()),Ae&&(be=this._create_token($.COMMENT,Ae),be.directives=se)}return be},V.prototype._read_open=function(fe,be){var Ae=null,se=null;return(!be||be.type===$.CONTROL_FLOW_OPEN)&&fe==="<"&&(Ae=this._input.next(),this._input.peek()==="/"&&(Ae+=this._input.next()),Ae+=this.__patterns.element_name.read(),se=this._create_token($.TAG_OPEN,Ae)),se},V.prototype._read_open_handlebars=function(fe,be){var Ae=null,se=null;return(!be||be.type===$.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&fe==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(Ae=this.__patterns.handlebars_comment.read(),Ae=Ae||this.__patterns.handlebars.read(),se=this._create_token($.COMMENT,Ae)):(Ae=this.__patterns.handlebars_open.read(),se=this._create_token($.TAG_OPEN,Ae))),se},V.prototype._read_control_flows=function(fe,be){var Ae="",se=null;if(!this._options.templating.includes("angular"))return se;if(fe==="@"){if(Ae=this.__patterns.angular_control_flow_start.read(),Ae==="")return se;for(var ke=Ae.endsWith("(")?1:0,We=0;!(Ae.endsWith("{")&&ke===We);){var ze=this._input.next();if(ze===null)break;ze==="("?ke++:ze===")"&&We++,Ae+=ze}se=this._create_token($.CONTROL_FLOW_OPEN,Ae)}else fe==="}"&&be&&be.type===$.CONTROL_FLOW_OPEN&&(Ae=this._input.next(),se=this._create_token($.CONTROL_FLOW_CLOSE,Ae));return se},V.prototype._read_close=function(fe,be){var Ae=null,se=null;return be&&be.type===$.TAG_OPEN&&(be.text[0]==="<"&&(fe===">"||fe==="/"&&this._input.peek(1)===">")?(Ae=this._input.next(),fe==="/"&&(Ae+=this._input.next()),se=this._create_token($.TAG_CLOSE,Ae)):be.text[0]==="{"&&fe==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),se=this._create_token($.TAG_CLOSE,"}}"))),se},V.prototype._read_attribute=function(fe,be,Ae){var se=null,ke="";if(Ae&&Ae.text[0]==="<")if(fe==="=")se=this._create_token($.EQUALS,this._input.next());else if(fe==='"'||fe==="'"){var We=this._input.next();fe==='"'?We+=this.__patterns.double_quote.read():We+=this.__patterns.single_quote.read(),se=this._create_token($.VALUE,We)}else ke=this.__patterns.attribute.read(),ke&&(be.type===$.EQUALS?se=this._create_token($.VALUE,ke):se=this._create_token($.ATTRIBUTE,ke));return se},V.prototype._is_content_unformatted=function(fe){return this._options.void_elements.indexOf(fe)===-1&&(this._options.content_unformatted.indexOf(fe)!==-1||this._options.unformatted.indexOf(fe)!==-1)},V.prototype._read_raw_content=function(fe,be,Ae){var se="";if(Ae&&Ae.text[0]==="{")se=this.__patterns.handlebars_raw_close.read();else if(be.type===$.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var ke=be.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ke)&&(se=this._input.readUntil(new RegExp("</"+ke+"[\\n\\r\\t ]*?>","ig")))}return se?this._create_token($.TEXT,se):null},V.prototype._read_script_and_style=function(fe,be){if(be.type===$.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var Ae=be.opened.text.substr(1).toLowerCase();if(Ae==="script"||Ae==="style"){var se=this._read_comment_or_cdata(fe);if(se)return se.type=$.TEXT,se;var ke=this._input.readUntil(new RegExp("</"+Ae+"[\\n\\r\\t ]*?>","ig"));if(ke)return this._create_token($.TEXT,ke)}}return null},V.prototype._read_content_word=function(fe,be){var Ae="";return this._options.unformatted_content_delimiter&&fe===this._options.unformatted_content_delimiter[0]&&(Ae=this.__patterns.unformatted_content_delimiter.read()),Ae||(Ae=be&&be.type===$.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),Ae?this._create_token($.TEXT,Ae):null},I.exports.Tokenizer=V,I.exports.TOKEN=$}],P={};function f(I){var k=P[I];if(k!==void 0)return k.exports;var T=P[I]={exports:{}};return Le[I](T,T.exports,f),T.exports}var ne=f(18);Ye=ne})();var me=Ye;if(1)ue=[re,re(58553),re(87804)],we=function(Le){var P=re(58553),f=re(87804);return{html_beautify:function(ne,I){return me(ne,I,P.js_beautify,f.css_beautify)}}}.apply(Ft,ue),we!==void 0&&(Ci.exports=we);else var J,w})()},58553:function(Ci,Ft){var re,ue;(function(){var we;(function(){"use strict";var me=[function(P,f,ne){var I=ne(1).Beautifier,k=ne(5).Options;function T(M,O){var X=new I(M,O);return X.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,ne){var I=ne(2).Output,k=ne(3).Token,T=ne(4),M=ne(5).Options,O=ne(7).Tokenizer,X=ne(7).line_starters,G=ne(7).positionable_operators,j=ne(7).TOKEN;function $(A,W){return W.indexOf(A)!==-1}function N(A){return A.replace(/^\s+/g,"")}function V(A){for(var W={},le=0;le<A.length;le++)W[A[le].replace(/-/g,"_")]=A[le];return W}function fe(A,W){return A&&A.type===j.RESERVED&&A.text===W}function be(A,W){return A&&A.type===j.RESERVED&&$(A.text,W)}var Ae=["case","return","do","if","throw","else","await","break","continue","async"],se=["before-newline","after-newline","preserve-newline"],ke=V(se),We=[ke.before_newline,ke.preserve_newline],ze={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Rt(A,W){W.multiline_frame||W.mode===ze.ForInitializer||W.mode===ze.Conditional||A.remove_indent(W.start_line_index)}function te(A){A=A.replace(T.allLineBreaks,`
|
|
|
`);for(var W=[],le=A.indexOf(`
|
|
|
`);le!==-1;)W.push(A.substring(0,le)),A=A.substring(le+1),le=A.indexOf(`
|
|
|
`);return A.length&&W.push(A),W}function z(A){return A===ze.ArrayLiteral}function q(A){return $(A,[ze.Expression,ze.ForInitializer,ze.Conditional])}function Q(A,W){for(var le=0;le<A.length;le++){var et=A[le].trim();if(et.charAt(0)!==W)return!1}return!0}function de(A,W){for(var le=0,et=A.length,pt;le<et;le++)if(pt=A[le],pt&&pt.indexOf(W)!==0)return!1;return!0}function ie(A,W){W=W||{},this._source_text=A||"",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 M(W)}ie.prototype.create_flags=function(A,W){var le=0;A&&(le=A.indentation_level,!this._output.just_added_newline()&&A.line_indent_level>le&&(le=A.line_indent_level));var et={mode:W,parent:A,last_token:A?A.last_token:new k(j.START_BLOCK,""),last_word:A?A.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:le,alignment:0,line_indent_level:A?A.line_indent_level:le,start_line_index:this._output.get_line_number(),ternary_depth:0};return et},ie.prototype._reset=function(A){var W=A.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new I(this._options,W),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(ze.BlockStatement);var le=new O(A,this._options);return this._tokens=le.tokenize(),A},ie.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var A,W=this._reset(this._source_text),le=this._options.eol;this._options.eol==="auto"&&(le=`
|
|
|
`,W&&T.lineBreak.test(W||"")&&(le=W.match(T.lineBreak)[0]));for(var et=this._tokens.next();et;)this.handle_token(et),this._last_last_text=this._flags.last_token.text,this._flags.last_token=et,et=this._tokens.next();return A=this._output.get_code(le),A},ie.prototype.handle_token=function(A,W){A.type===j.START_EXPR?this.handle_start_expr(A):A.type===j.END_EXPR?this.handle_end_expr(A):A.type===j.START_BLOCK?this.handle_start_block(A):A.type===j.END_BLOCK?this.handle_end_block(A):A.type===j.WORD?this.handle_word(A):A.type===j.RESERVED?this.handle_word(A):A.type===j.SEMICOLON?this.handle_semicolon(A):A.type===j.STRING?this.handle_string(A):A.type===j.EQUALS?this.handle_equals(A):A.type===j.OPERATOR?this.handle_operator(A):A.type===j.COMMA?this.handle_comma(A):A.type===j.BLOCK_COMMENT?this.handle_block_comment(A,W):A.type===j.COMMENT?this.handle_comment(A,W):A.type===j.DOT?this.handle_dot(A):A.type===j.EOF?this.handle_eof(A):A.type===j.UNKNOWN?this.handle_unknown(A,W):this.handle_unknown(A,W)},ie.prototype.handle_whitespace_and_comments=function(A,W){var le=A.newlines,et=this._options.keep_array_indentation&&z(this._flags.mode);if(A.comments_before)for(var pt=A.comments_before.next();pt;)this.handle_whitespace_and_comments(pt,W),this.handle_token(pt,W),pt=A.comments_before.next();if(et)for(var Kt=0;Kt<le;Kt+=1)this.print_newline(Kt>0,W);else if(this._options.max_preserve_newlines&&le>this._options.max_preserve_newlines&&(le=this._options.max_preserve_newlines),this._options.preserve_newlines&&le>1){this.print_newline(!1,W);for(var Pe=1;Pe<le;Pe+=1)this.print_newline(!0,W)}};var L=["async","break","continue","return","throw","yield"];ie.prototype.allow_wrap_or_preserved_newline=function(A,W){if(W=W===void 0?!1:W,!this._output.just_added_newline()){var le=this._options.preserve_newlines&&A.newlines||W,et=$(this._flags.last_token.text,G)||$(A.text,G);if(et){var pt=$(this._flags.last_token.text,G)&&$(this._options.operator_position,We)||$(A.text,G);le=le&&pt}if(le)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(be(this._flags.last_token,L))return;this._output.set_wrap_point()}}},ie.prototype.print_newline=function(A,W){if(!W&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==j.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var le=this._tokens.peek();this._flags.mode===ze.Statement&&!(this._flags.if_block&&fe(le,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(A)&&(this._flags.multiline_frame=!0)},ie.prototype.print_token_line_indentation=function(A){this._output.just_added_newline()&&(this._options.keep_array_indentation&&A.newlines&&(A.text==="["||z(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(A.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))},ie.prototype.print_token=function(A){if(this._output.raw){this._output.add_raw_token(A);return}if(this._options.comma_first&&A.previous&&A.previous.type===j.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var W=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(W),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(A),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(A),this._output.non_breaking_space=!0,this._output.add_token(A.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},ie.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ie.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))},ie.prototype.set_mode=function(A){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,A),this._flags=this.create_flags(this._previous_flags,A),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ie.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===ze.Statement&&Rt(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},ie.prototype.start_of_object_property=function(){return this._flags.parent.mode===ze.ObjectLiteral&&this._flags.mode===ze.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"]))},ie.prototype.start_of_statement=function(A){var W=!1;return W=W||be(this._flags.last_token,["var","let","const"])&&A.type===j.WORD,W=W||fe(this._flags.last_token,"do"),W=W||!(this._flags.parent.mode===ze.ObjectLiteral&&this._flags.mode===ze.Statement)&&be(this._flags.last_token,L)&&!A.newlines,W=W||fe(this._flags.last_token,"else")&&!(fe(A,"if")&&!A.comments_before),W=W||this._flags.last_token.type===j.END_EXPR&&(this._previous_flags.mode===ze.ForInitializer||this._previous_flags.mode===ze.Conditional),W=W||this._flags.last_token.type===j.WORD&&this._flags.mode===ze.BlockStatement&&!this._flags.in_case&&!(A.text==="--"||A.text==="++")&&this._last_last_text!=="function"&&A.type!==j.WORD&&A.type!==j.RESERVED,W=W||this._flags.mode===ze.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"])),W?(this.set_mode(ze.Statement),this.indent(),this.handle_whitespace_and_comments(A,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(A,be(A,["do","for","if","while"])),!0):!1},ie.prototype.handle_start_expr=function(A){this.start_of_statement(A)||this.handle_whitespace_and_comments(A);var W=ze.Expression;if(A.text==="["){if(this._flags.last_token.type===j.WORD||this._flags.last_token.text===")"){be(this._flags.last_token,X)&&(this._output.space_before_token=!0),this.print_token(A),this.set_mode(W),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}W=ze.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()),$(this._flags.last_token.type,[j.START_EXPR,j.END_EXPR,j.WORD,j.OPERATOR,j.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===j.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,W=ze.ForInitializer):$(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,W=ze.Conditional):$(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&A.whitespace_before===""?this._output.space_before_token=!1:($(this._flags.last_token.text,X)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===j.EQUALS||this._flags.last_token.type===j.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(A);else if(this._flags.last_token.type===j.WORD){this._output.space_before_token=!1;var le=this._tokens.peek(-3);if(this._options.space_after_named_function&&le){var et=this._tokens.peek(-4);be(le,["async","function"])||le.text==="*"&&be(et,["async","function"])?this._output.space_before_token=!0:this._flags.mode===ze.ObjectLiteral?(le.text==="{"||le.text===","||le.text==="*"&&(et.text==="{"||et.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(A);(this._flags.last_token.type===j.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&($(this._last_last_text,["function","yield"])||this._flags.mode===ze.ObjectLiteral&&$(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===j.START_BLOCK?this.print_newline():(this._flags.last_token.type===j.END_EXPR||this._flags.last_token.type===j.START_EXPR||this._flags.last_token.type===j.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===j.COMMA)&&this.allow_wrap_or_preserved_newline(A,A.newlines),this.print_token(A),this.set_mode(W),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},ie.prototype.handle_end_expr=function(A){for(;this._flags.mode===ze.Statement;)this.restore_mode();this.handle_whitespace_and_comments(A),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(A,A.text==="]"&&z(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===j.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(A),this.restore_mode(),Rt(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===ze.Conditional&&(this._previous_flags.mode=ze.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},ie.prototype.handle_start_block=function(A){this.handle_whitespace_and_comments(A);var W=this._tokens.peek(),le=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===j.END_EXPR?(this.set_mode(ze.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(ze.BlockStatement):le&&($(le.text,[":",","])&&$(W.type,[j.STRING,j.WORD,j.RESERVED])||$(W.text,["get","set","..."])&&$(le.type,[j.WORD,j.RESERVED]))?$(this._last_last_text,["class","interface"])&&!$(le.text,[":",","])?this.set_mode(ze.BlockStatement):this.set_mode(ze.ObjectLiteral):this._flags.last_token.type===j.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(ze.BlockStatement):$(this._flags.last_token.type,[j.EQUALS,j.START_EXPR,j.COMMA,j.OPERATOR])||be(this._flags.last_token,["return","throw","import","default"])?this.set_mode(ze.ObjectLiteral):this.set_mode(ze.BlockStatement),this._flags.last_token&&be(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var et=!W.comments_before&&W.text==="}",pt=et&&this._flags.last_word==="function"&&this._flags.last_token.type===j.END_EXPR;if(this._options.brace_preserve_inline){var Kt=0,Pe=null;this._flags.inline_frame=!0;do if(Kt+=1,Pe=this._tokens.peek(Kt-1),Pe.newlines){this._flags.inline_frame=!1;break}while(Pe.type!==j.EOF&&!(Pe.type===j.END_BLOCK&&Pe.opened===A))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&A.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==j.OPERATOR&&(pt||this._flags.last_token.type===j.EQUALS||be(this._flags.last_token,Ae)&&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===j.START_EXPR||this._flags.last_token.type===j.COMMA)&&((this._flags.last_token.type===j.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(A),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==j.OPERATOR&&this._flags.last_token.type!==j.START_EXPR&&($(this._flags.last_token.type,[j.START_BLOCK,j.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(A),this.indent(),!et&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},ie.prototype.handle_end_block=function(A){for(this.handle_whitespace_and_comments(A);this._flags.mode===ze.Statement;)this.restore_mode();var W=this._flags.last_token.type===j.START_BLOCK;this._flags.inline_frame&&!W?this._output.space_before_token=!0:this._options.brace_style==="expand"?W||this.print_newline():W||(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(A)},ie.prototype.handle_word=function(A){if(A.type===j.RESERVED){if($(A.text,["set","get"])&&this._flags.mode!==ze.ObjectLiteral)A.type=j.WORD;else if(A.text==="import"&&$(this._tokens.peek().text,["(","."]))A.type=j.WORD;else if($(A.text,["as","from"])&&!this._flags.import_block)A.type=j.WORD;else if(this._flags.mode===ze.ObjectLiteral){var W=this._tokens.peek();W.text===":"&&(A.type=j.WORD)}}if(this.start_of_statement(A)?be(this._flags.last_token,["var","let","const"])&&A.type===j.WORD&&(this._flags.declaration_statement=!0):A.newlines&&!q(this._flags.mode)&&(this._flags.last_token.type!==j.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==j.EQUALS&&(this._options.preserve_newlines||!be(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(A),this.print_newline()):this.handle_whitespace_and_comments(A),this._flags.do_block&&!this._flags.do_while)if(fe(A,"while")){this._output.space_before_token=!0,this.print_token(A),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&&fe(A,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===ze.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&be(A,["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(A),this._flags.in_case=!0;return}if((this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR||this._flags.last_token.type===j.EQUALS||this._flags.last_token.type===j.OPERATOR)&&!this.start_of_object_property()&&!($(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===ze.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(A),fe(A,"function")){($(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!($(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===j.OPERATOR))&&!this._output.just_added_blankline()&&!A.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===j.RESERVED||this._flags.last_token.type===j.WORD?be(this._flags.last_token,["get","set","new","export"])||be(this._flags.last_token,L)?this._output.space_before_token=!0:fe(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===j.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(q(this._flags.mode)||z(this._flags.mode))||this.print_newline(),this.print_token(A),this._flags.last_word=A.text;return}var le="NONE";if(this._flags.last_token.type===j.END_BLOCK?this._previous_flags.inline_frame?le="SPACE":be(A,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&A.newlines?le="NEWLINE":(le="SPACE",this._output.space_before_token=!0):le="NEWLINE":this._flags.last_token.type===j.SEMICOLON&&this._flags.mode===ze.BlockStatement?le="NEWLINE":this._flags.last_token.type===j.SEMICOLON&&q(this._flags.mode)?le="SPACE":this._flags.last_token.type===j.STRING?le="NEWLINE":this._flags.last_token.type===j.RESERVED||this._flags.last_token.type===j.WORD||this._flags.last_token.text==="*"&&($(this._last_last_text,["function","yield"])||this._flags.mode===ze.ObjectLiteral&&$(this._last_last_text,["{",","]))?le="SPACE":this._flags.last_token.type===j.START_BLOCK?this._flags.inline_frame?le="SPACE":le="NEWLINE":this._flags.last_token.type===j.END_EXPR&&(this._output.space_before_token=!0,le="NEWLINE"),be(A,X)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?le="SPACE":le="NEWLINE"),be(A,["else","catch","finally"]))if((!(this._flags.last_token.type===j.END_BLOCK&&this._previous_flags.mode===ze.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&A.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var et=this._output.current_line;et.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else le==="NEWLINE"?be(this._flags.last_token,Ae)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&be(A,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==j.END_EXPR?(this._flags.last_token.type!==j.START_EXPR||!be(A,["var","let","const"]))&&this._flags.last_token.text!==":"&&(fe(A,"if")&&fe(A.previous,"else")?this._output.space_before_token=!0:this.print_newline()):be(A,X)&&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():le==="SPACE"&&(this._output.space_before_token=!0);A.previous&&(A.previous.type===j.WORD||A.previous.type===j.RESERVED)&&(this._output.space_before_token=!0),this.print_token(A),this._flags.last_word=A.text,A.type===j.RESERVED&&(A.text==="do"?this._flags.do_block=!0:A.text==="if"?this._flags.if_block=!0:A.text==="import"?this._flags.import_block=!0:this._flags.import_block&&fe(A,"from")&&(this._flags.import_block=!1))},ie.prototype.handle_semicolon=function(A){this.start_of_statement(A)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(A);for(var W=this._tokens.peek();this._flags.mode===ze.Statement&&!(this._flags.if_block&&fe(W,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(A)},ie.prototype.handle_string=function(A){A.text.startsWith("`")&&A.newlines===0&&A.whitespace_before===""&&(A.previous.text===")"||this._flags.last_token.type===j.WORD)||(this.start_of_statement(A)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(A),this._flags.last_token.type===j.RESERVED||this._flags.last_token.type===j.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR||this._flags.last_token.type===j.EQUALS||this._flags.last_token.type===j.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(A):A.text.startsWith("`")&&this._flags.last_token.type===j.END_EXPR&&(A.previous.text==="]"||A.previous.text===")")&&A.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(A)},ie.prototype.handle_equals=function(A){this.start_of_statement(A)||this.handle_whitespace_and_comments(A),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(A),this._output.space_before_token=!0},ie.prototype.handle_comma=function(A){this.handle_whitespace_and_comments(A,!0),this.print_token(A),this._output.space_before_token=!0,this._flags.declaration_statement?(q(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(A)):this._flags.mode===ze.ObjectLiteral||this._flags.mode===ze.Statement&&this._flags.parent.mode===ze.ObjectLiteral?(this._flags.mode===ze.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(A)},ie.prototype.handle_operator=function(A){var W=A.text==="*"&&(be(this._flags.last_token,["function","yield"])||$(this._flags.last_token.type,[j.START_BLOCK,j.COMMA,j.END_BLOCK,j.SEMICOLON])),le=$(A.text,["-","+"])&&($(this._flags.last_token.type,[j.START_BLOCK,j.START_EXPR,j.EQUALS,j.OPERATOR])||$(this._flags.last_token.text,X)||this._flags.last_token.text===",");if(!this.start_of_statement(A)){var et=!W;this.handle_whitespace_and_comments(A,et)}if(A.text==="*"&&this._flags.last_token.type===j.DOT){this.print_token(A);return}if(A.text==="::"){this.print_token(A);return}if($(A.text,["-","+"])&&this.start_of_object_property()){this.print_token(A);return}if(this._flags.last_token.type===j.OPERATOR&&$(this._options.operator_position,We)&&this.allow_wrap_or_preserved_newline(A),A.text===":"&&this._flags.in_case){this.print_token(A),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==j.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,Kt=!0,Pe=!1;if(A.text===":"?this._flags.ternary_depth===0?pt=!1:(this._flags.ternary_depth-=1,Pe=!0):A.text==="?"&&(this._flags.ternary_depth+=1),!le&&!W&&this._options.preserve_newlines&&$(A.text,G)){var Zt=A.text===":",It=Zt&&Pe,bt=Zt&&!Pe;switch(this._options.operator_position){case ke.before_newline:this._output.space_before_token=!bt,this.print_token(A),(!Zt||It)&&this.allow_wrap_or_preserved_newline(A),this._output.space_before_token=!0;return;case ke.after_newline:this._output.space_before_token=!0,!Zt||It?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(A):this._output.space_before_token=!1,this.print_token(A),this._output.space_before_token=!0;return;case ke.preserve_newline:bt||this.allow_wrap_or_preserved_newline(A),pt=!(this._output.just_added_newline()||bt),this._output.space_before_token=pt,this.print_token(A),this._output.space_before_token=!0;return}}if(W){this.allow_wrap_or_preserved_newline(A),pt=!1;var Oe=this._tokens.peek();Kt=Oe&&$(Oe.type,[j.WORD,j.RESERVED])}else if(A.text==="...")this.allow_wrap_or_preserved_newline(A),pt=this._flags.last_token.type===j.START_BLOCK,Kt=!1;else if($(A.text,["--","++","!","~"])||le){if((this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR)&&this.allow_wrap_or_preserved_newline(A),pt=!1,Kt=!1,A.newlines&&(A.text==="--"||A.text==="++"||A.text==="~")){var mt=be(this._flags.last_token,Ae)&&A.newlines;mt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(mt,!0)}this._flags.last_token.text===";"&&q(this._flags.mode)&&(pt=!0),this._flags.last_token.type===j.RESERVED?pt=!0:this._flags.last_token.type===j.END_EXPR?pt=!(this._flags.last_token.text==="]"&&(A.text==="--"||A.text==="++")):this._flags.last_token.type===j.OPERATOR&&(pt=$(A.text,["--","-","++","+"])&&$(this._flags.last_token.text,["--","-","++","+"]),$(A.text,["+","-"])&&$(this._flags.last_token.text,["--","++"])&&(Kt=!0)),(this._flags.mode===ze.BlockStatement&&!this._flags.inline_frame||this._flags.mode===ze.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(A),this._output.space_before_token=Kt},ie.prototype.handle_block_comment=function(A,W){if(this._output.raw){this._output.add_raw_token(A),A.directives&&A.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(A.directives){this.print_newline(!1,W),this.print_token(A),A.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!T.newline.test(A.text)&&!A.newlines){this._output.space_before_token=!0,this.print_token(A),this._output.space_before_token=!0;return}else this.print_block_commment(A,W)},ie.prototype.print_block_commment=function(A,W){var le=te(A.text),et,pt=!1,Kt=!1,Pe=A.whitespace_before,Zt=Pe.length;if(this.print_newline(!1,W),this.print_token_line_indentation(A),this._output.add_token(le[0]),this.print_newline(!1,W),le.length>1){for(le=le.slice(1),pt=Q(le,"*"),Kt=de(le,Pe),pt&&(this._flags.alignment=1),et=0;et<le.length;et++)pt?(this.print_token_line_indentation(A),this._output.add_token(N(le[et]))):Kt&&le[et]?(this.print_token_line_indentation(A),this._output.add_token(le[et].substring(Zt))):(this._output.current_line.set_indent(-1),this._output.add_token(le[et])),this.print_newline(!1,W);this._flags.alignment=0}},ie.prototype.handle_comment=function(A,W){A.newlines?this.print_newline(!1,W):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(A),this.print_newline(!1,W)},ie.prototype.handle_dot=function(A){this.start_of_statement(A)||this.handle_whitespace_and_comments(A,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),be(this._flags.last_token,Ae)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(A,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(A)},ie.prototype.handle_unknown=function(A,W){this.print_token(A),A.text[A.text.length-1]===`
|
|
|
`&&this.print_newline(!1,W)},ie.prototype.handle_eof=function(A){for(;this._flags.mode===ze.Statement;)this.restore_mode();this.handle_whitespace_and_comments(A)},P.exports.Beautifier=ie},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 ne(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}ne.prototype.get_indent_size=function(k,T){var M=this.__base_string_length;return T=T||0,k<0&&(M=0),M+=k*this.__indent_size,M+=T,M},ne.prototype.get_indent_string=function(k,T){var M=this.__base_string;return T=T||0,k<0&&(k=0,M=""),T+=k*this.__indent_size,this.__ensure_cache(T),M+=this.__cache[T],M},ne.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},ne.prototype.__add_column=function(){var k=this.__cache.length,T=0,M="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,M=new Array(T+1).join(this.__indent_string)),k&&(M+=new Array(k+1).join(" ")),this.__cache.push(M)};function I(k,T){this.__indent_cache=new ne(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()}I.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},I.prototype.get_line_number=function(){return this.__lines.length},I.prototype.get_indent_string=function(k,T){return this.__indent_cache.get_indent_string(k,T)},I.prototype.get_indent_size=function(k,T){return this.__indent_cache.get_indent_size(k,T)},I.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},I.prototype.add_new_line=function(k){return this.is_empty()||!k&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},I.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 M=this.__lines.join(`
|
|
|
`);return k!==`
|
|
|
`&&(M=M.replace(/[\n]/g,k)),M},I.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},I.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)},I.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},I.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()},I.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(" "))},I.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()},I.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},I.prototype.just_added_newline=function(){return this.current_line.is_empty()},I.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},I.prototype.ensure_empty_line_above=function(k,T){for(var M=this.__lines.length-2;M>=0;){var O=this.__lines[M];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(M+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}M--}},P.exports.Output=I},function(P){function f(ne,I,k,T){this.type=ne,this.text=I,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 ne="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",I="\\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",M="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",O="(?:"+M+"|["+ne+k+"])",X="(?:"+M+"|["+I+k+T+"])*";f.identifier=new RegExp(O+X,"g"),f.identifierStart=new RegExp(O),f.identifierMatch=new RegExp("(?:"+M+"|["+I+k+T+"])+");var G=/[\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,ne){var I=ne(6).Options,k=["before-newline","after-newline","preserve-newline"];function T(M){I.call(this,M,"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 X=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var G=0;G<X.length;G++)X[G]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=X[G];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 I,P.exports.Options=T},function(P){function f(k,T){this.raw_options=ne(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 M=this.raw_options[k],O=T||[];return typeof M=="object"?M!==null&&typeof M.concat=="function"&&(O=M.concat()):typeof M=="string"&&(O=M.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var M=this.raw_options[k],O=M===void 0?!!T:!!M;return O},f.prototype._get_characters=function(k,T){var M=this.raw_options[k],O=T||"";return typeof M=="string"&&(O=M.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var M=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(M,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,M){var O=this._get_selection_list(k,T,M);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,M){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(M=M||[T[0]],!this._is_valid_selection(M,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,M);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(M){return T.indexOf(M)===-1})};function ne(k,T){var M={};k=I(k);var O;for(O in k)O!==T&&(M[O]=k[O]);if(T&&k[T])for(O in k[T])M[O]=k[T][O];return M}function I(k){var T={},M;for(M in k){var O=M.replace(/-/g,"_");T[O]=k[M]}return T}P.exports.Options=f,P.exports.normalizeOpts=I,P.exports.mergeOpts=ne},function(P,f,ne){var I=ne(8).InputScanner,k=ne(9).Tokenizer,T=ne(9).TOKEN,M=ne(13).Directives,O=ne(4),X=ne(12).Pattern,G=ne(14).TemplatablePattern;function j(Q,de){return de.indexOf(Q)!==-1}var $={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},N=new M(/\/\*/,/\*\//),V=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,fe=/[0-9]/,be=/[^\d\.]/,Ae=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),se=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";se=se.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),se="\\?\\.(?!\\d) "+se,se=se.replace(/ /g,"|");var ke=new RegExp(se),We="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),ze=We.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Rt=new RegExp("^(?:"+ze.join("|")+")$"),te,z=function(Q,de){k.call(this,Q,de),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var ie=new X(this._input),L=new G(this._input).read_options(this._options);this.__patterns={template:L,identifier:L.starting_with(O.identifier).matching(O.identifierMatch),number:ie.matching(V),punct:ie.matching(ke),comment:ie.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:ie.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:ie.matching(/<!--/),html_comment_end:ie.matching(/-->/),include:ie.starting_with(/#include/).until_after(O.lineBreak),shebang:ie.starting_with(/#!/).until_after(O.lineBreak),xml:ie.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:L.until(/['\\\n\r\u2028\u2029]/),double_quote:L.until(/["\\\n\r\u2028\u2029]/),template_text:L.until(/[`\\$]/),template_expression:L.until(/[`}\\]/)}};z.prototype=new k,z.prototype._is_comment=function(Q){return Q.type===$.COMMENT||Q.type===$.BLOCK_COMMENT||Q.type===$.UNKNOWN},z.prototype._is_opening=function(Q){return Q.type===$.START_BLOCK||Q.type===$.START_EXPR},z.prototype._is_closing=function(Q,de){return(Q.type===$.END_BLOCK||Q.type===$.END_EXPR)&&de&&(Q.text==="]"&&de.text==="["||Q.text===")"&&de.text==="("||Q.text==="}"&&de.text==="{")},z.prototype._reset=function(){te=!1},z.prototype._get_next_token=function(Q,de){var ie=null;this._readWhitespace();var L=this._input.peek();return L===null?this._create_token($.EOF,""):(ie=ie||this._read_non_javascript(L),ie=ie||this._read_string(L),ie=ie||this._read_pair(L,this._input.peek(1)),ie=ie||this._read_word(Q),ie=ie||this._read_singles(L),ie=ie||this._read_comment(L),ie=ie||this._read_regexp(L,Q),ie=ie||this._read_xml(L,Q),ie=ie||this._read_punctuation(),ie=ie||this._create_token($.UNKNOWN,this._input.next()),ie)},z.prototype._read_word=function(Q){var de;if(de=this.__patterns.identifier.read(),de!=="")return de=de.replace(O.allLineBreaks,`
|
|
|
`),!(Q.type===$.DOT||Q.type===$.RESERVED&&(Q.text==="set"||Q.text==="get"))&&Rt.test(de)?(de==="in"||de==="of")&&(Q.type===$.WORD||Q.type===$.STRING)?this._create_token($.OPERATOR,de):this._create_token($.RESERVED,de):this._create_token($.WORD,de);if(de=this.__patterns.number.read(),de!=="")return this._create_token($.WORD,de)},z.prototype._read_singles=function(Q){var de=null;return Q==="("||Q==="["?de=this._create_token($.START_EXPR,Q):Q===")"||Q==="]"?de=this._create_token($.END_EXPR,Q):Q==="{"?de=this._create_token($.START_BLOCK,Q):Q==="}"?de=this._create_token($.END_BLOCK,Q):Q===";"?de=this._create_token($.SEMICOLON,Q):Q==="."&&be.test(this._input.peek(1))?de=this._create_token($.DOT,Q):Q===","&&(de=this._create_token($.COMMA,Q)),de&&this._input.next(),de},z.prototype._read_pair=function(Q,de){var ie=null;return Q==="#"&&de==="{"&&(ie=this._create_token($.START_BLOCK,Q+de)),ie&&(this._input.next(),this._input.next()),ie},z.prototype._read_punctuation=function(){var Q=this.__patterns.punct.read();if(Q!=="")return Q==="="?this._create_token($.EQUALS,Q):Q==="?."?this._create_token($.DOT,Q):this._create_token($.OPERATOR,Q)},z.prototype._read_non_javascript=function(Q){var de="";if(Q==="#"){if(this._is_first_token()&&(de=this.__patterns.shebang.read(),de))return this._create_token($.UNKNOWN,de.trim()+`
|
|
|
`);if(de=this.__patterns.include.read(),de)return this._create_token($.UNKNOWN,de.trim()+`
|
|
|
`);Q=this._input.next();var ie="#";if(this._input.hasNext()&&this._input.testChar(fe)){do Q=this._input.next(),ie+=Q;while(this._input.hasNext()&&Q!=="#"&&Q!=="=");return Q==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(ie+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(ie+="{}",this._input.next(),this._input.next())),this._create_token($.WORD,ie)}this._input.back()}else if(Q==="<"&&this._is_first_token()){if(de=this.__patterns.html_comment_start.read(),de){for(;this._input.hasNext()&&!this._input.testChar(O.newline);)de+=this._input.next();return te=!0,this._create_token($.COMMENT,de)}}else if(te&&Q==="-"&&(de=this.__patterns.html_comment_end.read(),de))return te=!1,this._create_token($.COMMENT,de);return null},z.prototype._read_comment=function(Q){var de=null;if(Q==="/"){var ie="";if(this._input.peek(1)==="*"){ie=this.__patterns.block_comment.read();var L=N.get_directives(ie);L&&L.ignore==="start"&&(ie+=N.readIgnored(this._input)),ie=ie.replace(O.allLineBreaks,`
|
|
|
`),de=this._create_token($.BLOCK_COMMENT,ie),de.directives=L}else this._input.peek(1)==="/"&&(ie=this.__patterns.comment.read(),de=this._create_token($.COMMENT,ie))}return de},z.prototype._read_string=function(Q){if(Q==="`"||Q==="'"||Q==='"'){var de=this._input.next();return this.has_char_escapes=!1,Q==="`"?de+=this._read_string_recursive("`",!0,"${"):de+=this._read_string_recursive(Q),this.has_char_escapes&&this._options.unescape_strings&&(de=q(de)),this._input.peek()===Q&&(de+=this._input.next()),de=de.replace(O.allLineBreaks,`
|
|
|
`),this._create_token($.STRING,de)}return null},z.prototype._allow_regexp_or_xml=function(Q){return Q.type===$.RESERVED&&j(Q.text,["return","case","throw","else","do","typeof","yield"])||Q.type===$.END_EXPR&&Q.text===")"&&Q.opened.previous.type===$.RESERVED&&j(Q.opened.previous.text,["if","while","for"])||j(Q.type,[$.COMMENT,$.START_EXPR,$.START_BLOCK,$.START,$.END_BLOCK,$.OPERATOR,$.EQUALS,$.EOF,$.SEMICOLON,$.COMMA])},z.prototype._read_regexp=function(Q,de){if(Q==="/"&&this._allow_regexp_or_xml(de)){for(var ie=this._input.next(),L=!1,A=!1;this._input.hasNext()&&(L||A||this._input.peek()!==Q)&&!this._input.testChar(O.newline);)ie+=this._input.peek(),L?L=!1:(L=this._input.peek()==="\\",this._input.peek()==="["?A=!0:this._input.peek()==="]"&&(A=!1)),this._input.next();return this._input.peek()===Q&&(ie+=this._input.next(),ie+=this._input.read(O.identifier)),this._create_token($.STRING,ie)}return null},z.prototype._read_xml=function(Q,de){if(this._options.e4x&&Q==="<"&&this._allow_regexp_or_xml(de)){var ie="",L=this.__patterns.xml.read_match();if(L){for(var A=L[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),W=A.indexOf("{")===0,le=0;L;){var et=!!L[1],pt=L[2],Kt=!!L[L.length-1]||pt.slice(0,8)==="![CDATA[";if(!Kt&&(pt===A||W&&pt.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(et?--le:++le),ie+=L[0],le<=0)break;L=this.__patterns.xml.read_match()}return L||(ie+=this._input.match(/[\s\S]*/g)[0]),ie=ie.replace(O.allLineBreaks,`
|
|
|
`),this._create_token($.STRING,ie)}}return null};function q(Q){for(var de="",ie=0,L=new I(Q),A=null;L.hasNext();)if(A=L.match(/([\s]|[^\\]|\\\\)+/g),A&&(de+=A[0]),L.peek()==="\\"){if(L.next(),L.peek()==="x")A=L.match(/x([0-9A-Fa-f]{2})/g);else if(L.peek()==="u")A=L.match(/u([0-9A-Fa-f]{4})/g),A||(A=L.match(/u\{([0-9A-Fa-f]+)\}/g));else{de+="\\",L.hasNext()&&(de+=L.next());continue}if(!A||(ie=parseInt(A[1],16),ie>126&&ie<=255&&A[0].indexOf("x")===0))return Q;ie>=0&&ie<32||ie>1114111?de+="\\"+A[0]:ie===34||ie===39||ie===92?de+="\\"+String.fromCharCode(ie):de+=String.fromCharCode(ie)}return de}z.prototype._read_string_recursive=function(Q,de,ie){var L,A;Q==="'"?A=this.__patterns.single_quote:Q==='"'?A=this.__patterns.double_quote:Q==="`"?A=this.__patterns.template_text:Q==="}"&&(A=this.__patterns.template_expression);for(var W=A.read(),le="";this._input.hasNext();){if(le=this._input.next(),le===Q||!de&&O.newline.test(le)){this._input.back();break}else le==="\\"&&this._input.hasNext()?(L=this._input.peek(),L==="x"||L==="u"?this.has_char_escapes=!0:L==="\r"&&this._input.peek(1)===`
|
|
|
`&&this._input.next(),le+=this._input.next()):ie&&(ie==="${"&&le==="$"&&this._input.peek()==="{"&&(le+=this._input.next()),ie===le&&(Q==="`"?le+=this._read_string_recursive("}",de,"`"):le+=this._read_string_recursive("`",de,"${"),this._input.hasNext()&&(le+=this._input.next())));le+=A.read(),W+=le}return W},P.exports.Tokenizer=z,P.exports.TOKEN=$,P.exports.positionable_operators=Ae.slice(),P.exports.line_starters=We.slice()},function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function ne(I){this.__input=I||"",this.__input_length=this.__input.length,this.__position=0}ne.prototype.restart=function(){this.__position=0},ne.prototype.back=function(){this.__position>0&&(this.__position-=1)},ne.prototype.hasNext=function(){return this.__position<this.__input_length},ne.prototype.next=function(){var I=null;return this.hasNext()&&(I=this.__input.charAt(this.__position),this.__position+=1),I},ne.prototype.peek=function(I){var k=null;return I=I||0,I+=this.__position,I>=0&&I<this.__input_length&&(k=this.__input.charAt(I)),k},ne.prototype.__match=function(I,k){I.lastIndex=k;var T=I.exec(this.__input);return T&&!(f&&I.sticky)&&T.index!==k&&(T=null),T},ne.prototype.test=function(I,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(I,k):!1},ne.prototype.testChar=function(I,k){var T=this.peek(k);return I.lastIndex=0,T!==null&&I.test(T)},ne.prototype.match=function(I){var k=this.__match(I,this.__position);return k?this.__position+=k[0].length:k=null,k},ne.prototype.read=function(I,k,T){var M="",O;return I&&(O=this.match(I),O&&(M+=O[0])),k&&(O||!I)&&(M+=this.readUntil(k,T)),M},ne.prototype.readUntil=function(I,k){var T="",M=this.__position;I.lastIndex=this.__position;var O=I.exec(this.__input);return O?(M=O.index,k&&(M+=O[0].length)):M=this.__input_length,T=this.__input.substring(this.__position,M),this.__position=M,T},ne.prototype.readUntilAfter=function(I){return this.readUntil(I,!0)},ne.prototype.get_regexp=function(I,k){var T=null,M="g";return k&&f&&(M="y"),typeof I=="string"&&I!==""?T=new RegExp(I,M):I&&(T=new RegExp(I.source,M)),T},ne.prototype.get_literal_regexp=function(I){return RegExp(I.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ne.prototype.peekUntilAfter=function(I){var k=this.__position,T=this.readUntilAfter(I);return this.__position=k,T},ne.prototype.lookBack=function(I){var k=this.__position-1;return k>=I.length&&this.__input.substring(k-I.length,k).toLowerCase()===I},P.exports.InputScanner=ne},function(P,f,ne){var I=ne(8).InputScanner,k=ne(3).Token,T=ne(10).TokenStream,M=ne(11).WhitespacePattern,O={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},X=function(G,j){this._input=new I(G),this._options=j||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new M(this._input)};X.prototype.tokenize=function(){this._input.restart(),this.__tokens=new T,this._reset();for(var G,j=new k(O.START,""),$=null,N=[],V=new T;j.type!==O.EOF;){for(G=this._get_next_token(j,$);this._is_comment(G);)V.add(G),G=this._get_next_token(j,$);V.isEmpty()||(G.comments_before=V,V=new T),G.parent=$,this._is_opening(G)?(N.push($),$=G):$&&this._is_closing(G,$)&&(G.opened=$,$.closed=G,$=N.pop(),G.parent=$),G.previous=j,j.next=G,this.__tokens.add(G),j=G}return this.__tokens},X.prototype._is_first_token=function(){return this.__tokens.isEmpty()},X.prototype._reset=function(){},X.prototype._get_next_token=function(G,j){this._readWhitespace();var $=this._input.read(/.+/g);return $?this._create_token(O.RAW,$):this._create_token(O.EOF,"")},X.prototype._is_comment=function(G){return!1},X.prototype._is_opening=function(G){return!1},X.prototype._is_closing=function(G,j){return!1},X.prototype._create_token=function(G,j){var $=new k(G,j,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return $},X.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=X,P.exports.TOKEN=O},function(P){function f(ne){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=ne}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 ne=null;return this.hasNext()&&(ne=this.__tokens[this.__position],this.__position+=1),ne},f.prototype.peek=function(ne){var I=null;return ne=ne||0,ne+=this.__position,ne>=0&&ne<this.__tokens_length&&(I=this.__tokens[ne]),I},f.prototype.add=function(ne){this.__parent_token&&(ne.parent=this.__parent_token),this.__tokens.push(ne),this.__tokens_length+=1},P.exports.TokenStream=f},function(P,f,ne){var I=ne(12).Pattern;function k(T,M){I.call(this,T,M),M?this._line_regexp=this._input.get_regexp(M._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}k.prototype=new I,k.prototype.__set_whitespace_patterns=function(T,M){T+="\\t ",M+="\\n\\r",this._match_pattern=this._input.get_regexp("["+T+M+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+M+"]")},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 M=this.__split(this._newline_regexp,T);this.newline_count=M.length-1,this.whitespace_before_token=M[this.newline_count]}return T},k.prototype.matching=function(T,M){var O=this._create();return O.__set_whitespace_patterns(T,M),O._update(),O},k.prototype._create=function(){return new k(this._input,this)},k.prototype.__split=function(T,M){T.lastIndex=0;for(var O=0,X=[],G=T.exec(M);G;)X.push(M.substring(O,G.index)),O=G.index+G[0].length,G=T.exec(M);return O<M.length?X.push(M.substring(O,M.length)):X.push(""),X},P.exports.WhitespacePattern=k},function(P){function f(ne,I){this._input=ne,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,I&&(this._starting_pattern=this._input.get_regexp(I._starting_pattern,!0),this._match_pattern=this._input.get_regexp(I._match_pattern,!0),this._until_pattern=this._input.get_regexp(I._until_pattern),this._until_after=I._until_after)}f.prototype.read=function(){var ne=this._input.read(this._starting_pattern);return(!this._starting_pattern||ne)&&(ne+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),ne},f.prototype.read_match=function(){return this._input.match(this._match_pattern)},f.prototype.until_after=function(ne){var I=this._create();return I._until_after=!0,I._until_pattern=this._input.get_regexp(ne),I._update(),I},f.prototype.until=function(ne){var I=this._create();return I._until_after=!1,I._until_pattern=this._input.get_regexp(ne),I._update(),I},f.prototype.starting_with=function(ne){var I=this._create();return I._starting_pattern=this._input.get_regexp(ne,!0),I._update(),I},f.prototype.matching=function(ne){var I=this._create();return I._match_pattern=this._input.get_regexp(ne,!0),I._update(),I},f.prototype._create=function(){return new f(this._input,this)},f.prototype._update=function(){},P.exports.Pattern=f},function(P){function f(ne,I){ne=typeof ne=="string"?ne:ne.source,I=typeof I=="string"?I:I.source,this.__directives_block_pattern=new RegExp(ne+/ beautify( \w+[:]\w+)+ /.source+I,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(ne+/\sbeautify\signore:end\s/.source+I,"g")}f.prototype.get_directives=function(ne){if(!ne.match(this.__directives_block_pattern))return null;var I={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(ne);k;)I[k[1]]=k[2],k=this.__directive_pattern.exec(ne);return I},f.prototype.readIgnored=function(ne){return ne.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},function(P,f,ne){var I=ne(12).Pattern,k={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function T(M,O){I.call(this,M,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 X=new I(M);this.__patterns={handlebars_comment:X.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:X.starting_with(/{{{/).until_after(/}}}/),handlebars:X.starting_with(/{{/).until_after(/}}/),php:X.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:X.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:X.starting_with(/{%/).until_after(/%}/),django_value:X.starting_with(/{{/).until_after(/}}/),django_comment:X.starting_with(/{#/).until_after(/#}/),smarty:X.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:X.starting_with(/{\*/).until_after(/\*}/),smarty_literal:X.starting_with(/{literal}/).until_after(/{\/literal}/)}}T.prototype=new I,T.prototype._create=function(){return new T(this._input,this)},T.prototype._update=function(){this.__set_templated_pattern()},T.prototype.disable=function(M){var O=this._create();return O._disabled[M]=!0,O._update(),O},T.prototype.read_options=function(M){var O=this._create();for(var X in k)O._disabled[X]=M.templating.indexOf(X)===-1;return O._update(),O},T.prototype.exclude=function(M){var O=this._create();return O._excluded[M]=!0,O._update(),O},T.prototype.read=function(){var M="";this._match_pattern?M=this._input.read(this._starting_pattern):M=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),M+=O,O=this._read_template();return this._until_after&&(M+=this._input.readUntilAfter(this._until_pattern)),M},T.prototype.__set_templated_pattern=function(){var M=[];this._disabled.php||M.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||M.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||M.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||M.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(M.push(this.__patterns.django._starting_pattern.source),M.push(this.__patterns.django_value._starting_pattern.source),M.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||M.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&M.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+M.join("|")+")")},T.prototype._read_template=function(){var M="",O=this._input.peek();if(O==="<"){var X=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&X==="?"&&(M=M||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&X==="%"&&(M=M||this.__patterns.erb.read())}else O==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(M=M||this.__patterns.handlebars_comment.read(),M=M||this.__patterns.handlebars_unescaped.read(),M=M||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(M=M||this.__patterns.django_value.read()),this._excluded.django||(M=M||this.__patterns.django_comment.read(),M=M||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(M=M||this.__patterns.smarty_comment.read(),M=M||this.__patterns.smarty_literal.read(),M=M||this.__patterns.smarty.read()));return M},P.exports.TemplatablePattern=T}],J={};function w(P){var f=J[P];if(f!==void 0)return f.exports;var ne=J[P]={exports:{}};return me[P](ne,ne.exports,w),ne.exports}var Le=w(0);we=Le})();var Ye=we;re=[],ue=function(){return{js_beautify:Ye}}.apply(Ft,re),ue!==void 0&&(Ci.exports=ue)})()},32834:function(Ci){(function(Ft,re){Ci.exports=re()})(this,function(){"use strict";function Ft(De,xe){for(var Ee=0;Ee<xe.length;Ee++){var U=xe[Ee];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(De,U.key,U)}}function re(De,xe,Ee){return xe&&Ft(De.prototype,xe),Ee&&Ft(De,Ee),De}function ue(De,xe){if(De){if(typeof De=="string")return we(De,xe);var Ee=Object.prototype.toString.call(De).slice(8,-1);if(Ee==="Object"&&De.constructor&&(Ee=De.constructor.name),Ee==="Map"||Ee==="Set")return Array.from(De);if(Ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ee))return we(De,xe)}}function we(De,xe){(xe==null||xe>De.length)&&(xe=De.length);for(var Ee=0,U=new Array(xe);Ee<xe;Ee++)U[Ee]=De[Ee];return U}function Ye(De,xe){var Ee=typeof Symbol!="undefined"&&De[Symbol.iterator]||De["@@iterator"];if(Ee)return(Ee=Ee.call(De)).next.bind(Ee);if(Array.isArray(De)||(Ee=ue(De))||xe&&De&&typeof De.length=="number"){Ee&&(De=Ee);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 me={exports:{}};function J(){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 w(De){me.exports.defaults=De}me.exports={defaults:J(),getDefaults:J,changeDefaults:w};var Le=/[&<>"']/,P=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,ne=/[<>"']|&(?!#?\w+;)/g,I={"&":"&","<":"<",">":">",'"':""","'":"'"},k=function(xe){return I[xe]};function T(De,xe){if(xe){if(Le.test(De))return De.replace(P,k)}else if(f.test(De))return De.replace(ne,k);return De}var M=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function O(De){return De.replace(M,function(xe,Ee){return Ee=Ee.toLowerCase(),Ee==="colon"?":":Ee.charAt(0)==="#"?Ee.charAt(1)==="x"?String.fromCharCode(parseInt(Ee.substring(2),16)):String.fromCharCode(+Ee.substring(1)):""})}var X=/(^|[^\[])\^/g;function G(De,xe){De=De.source||De,xe=xe||"";var Ee={replace:function(H,ae){return ae=ae.source||ae,ae=ae.replace(X,"$1"),De=De.replace(H,ae),Ee},getRegex:function(){return new RegExp(De,xe)}};return Ee}var j=/[^\w:]/g,$=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function N(De,xe,Ee){if(De){var U;try{U=decodeURIComponent(O(Ee)).replace(j,"").toLowerCase()}catch(H){return null}if(U.indexOf("javascript:")===0||U.indexOf("vbscript:")===0||U.indexOf("data:")===0)return null}xe&&!$.test(Ee)&&(Ee=se(xe,Ee));try{Ee=encodeURI(Ee).replace(/%25/g,"%")}catch(H){return null}return Ee}var V={},fe=/^[^:]+:\/*[^/]*$/,be=/^([^:]+:)[\s\S]*$/,Ae=/^([^:]+:\/*[^/]*)[\s\S]*$/;function se(De,xe){V[" "+De]||(fe.test(De)?V[" "+De]=De+"/":V[" "+De]=Rt(De,"/",!0)),De=V[" "+De];var Ee=De.indexOf(":")===-1;return xe.substring(0,2)==="//"?Ee?xe:De.replace(be,"$1")+xe:xe.charAt(0)==="/"?Ee?xe:De.replace(Ae,"$1")+xe:De+xe}var ke={exec:function(){}};function We(De){for(var xe=1,Ee,U;xe<arguments.length;xe++){Ee=arguments[xe];for(U in Ee)Object.prototype.hasOwnProperty.call(Ee,U)&&(De[U]=Ee[U])}return De}function ze(De,xe){var Ee=De.replace(/\|/g,function(ae,ce,ye){for(var ct=!1,_t=ce;--_t>=0&&ye[_t]==="\\";)ct=!ct;return ct?"|":" |"}),U=Ee.split(/ \|/),H=0;if(U.length>xe)U.splice(xe);else for(;U.length<xe;)U.push("");for(;H<U.length;H++)U[H]=U[H].trim().replace(/\\\|/g,"|");return U}function Rt(De,xe,Ee){var U=De.length;if(U===0)return"";for(var H=0;H<U;){var ae=De.charAt(U-H-1);if(ae===xe&&!Ee)H++;else if(ae!==xe&&Ee)H++;else break}return De.substr(0,U-H)}function te(De,xe){if(De.indexOf(xe[1])===-1)return-1;for(var Ee=De.length,U=0,H=0;H<Ee;H++)if(De[H]==="\\")H++;else if(De[H]===xe[0])U++;else if(De[H]===xe[1]&&(U--,U<0))return H;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 q(De,xe){if(xe<1)return"";for(var Ee="";xe>1;)xe&1&&(Ee+=De),xe>>=1,De+=De;return Ee+De}var Q={escape:T,unescape:O,edit:G,cleanUrl:N,resolveUrl:se,noopTest:ke,merge:We,splitCells:ze,rtrim:Rt,findClosingBracket:te,checkSanitizeDeprecation:z,repeatString:q},de=me.exports.defaults,ie=Q.rtrim,L=Q.splitCells,A=Q.escape,W=Q.findClosingBracket;function le(De,xe,Ee){var U=xe.href,H=xe.title?A(xe.title):null,ae=De[1].replace(/\\([\[\]])/g,"$1");return De[0].charAt(0)!=="!"?{type:"link",raw:Ee,href:U,title:H,text:ae}:{type:"image",raw:Ee,href:U,title:H,text:A(ae)}}function et(De,xe){var Ee=De.match(/^(\s+)(?:```)/);if(Ee===null)return xe;var U=Ee[1];return xe.split(`
|
|
|
`).map(function(H){var ae=H.match(/^\s+/);if(ae===null)return H;var ce=ae[0];return ce.length>=U.length?H.slice(U.length):H}).join(`
|
|
|
`)}var pt=function(){function De(Ee){this.options=Ee||de}var xe=De.prototype;return xe.space=function(U){var H=this.rules.block.newline.exec(U);if(H)return H[0].length>1?{type:"space",raw:H[0]}:{raw:`
|
|
|
`}},xe.code=function(U){var H=this.rules.block.code.exec(U);if(H){var ae=H[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:H[0],codeBlockStyle:"indented",text:this.options.pedantic?ae:ie(ae,`
|
|
|
`)}}},xe.fences=function(U){var H=this.rules.block.fences.exec(U);if(H){var ae=H[0],ce=et(ae,H[3]||"");return{type:"code",raw:ae,lang:H[2]?H[2].trim():H[2],text:ce}}},xe.heading=function(U){var H=this.rules.block.heading.exec(U);if(H){var ae=H[2].trim();if(/#$/.test(ae)){var ce=ie(ae,"#");(this.options.pedantic||!ce||/ $/.test(ce))&&(ae=ce.trim())}return{type:"heading",raw:H[0],depth:H[1].length,text:ae}}},xe.nptable=function(U){var H=this.rules.block.nptable.exec(U);if(H){var ae={type:"table",header:L(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
|
|
|
`):[],raw:H[0]};if(ae.header.length===ae.align.length){var ce=ae.align.length,ye;for(ye=0;ye<ce;ye++)/^ *-+: *$/.test(ae.align[ye])?ae.align[ye]="right":/^ *:-+: *$/.test(ae.align[ye])?ae.align[ye]="center":/^ *:-+ *$/.test(ae.align[ye])?ae.align[ye]="left":ae.align[ye]=null;for(ce=ae.cells.length,ye=0;ye<ce;ye++)ae.cells[ye]=L(ae.cells[ye],ae.header.length);return ae}}},xe.hr=function(U){var H=this.rules.block.hr.exec(U);if(H)return{type:"hr",raw:H[0]}},xe.blockquote=function(U){var H=this.rules.block.blockquote.exec(U);if(H){var ae=H[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:H[0],text:ae}}},xe.list=function(U){var H=this.rules.block.list.exec(U);if(H){var ae=H[0],ce=H[2],ye=ce.length>1,ct={type:"list",raw:ae,ordered:ye,start:ye?+ce.slice(0,-1):"",loose:!1,items:[]},_t=H[0].match(this.rules.block.item),ut=!1,Gt,ni,di,ti,Tt,ai,Di,Ti,Ii,mi=_t.length;di=this.rules.block.listItemStart.exec(_t[0]);for(var ui=0;ui<mi;ui++){if(Gt=_t[ui],ae=Gt,this.options.pedantic||(Ii=Gt.match(new RegExp("\\n\\s*\\n {0,"+(di[0].length-1)+"}\\S")),Ii&&(Tt=Gt.length-Ii.index+_t.slice(ui+1).join(`
|
|
|
`).length,ct.raw=ct.raw.substring(0,ct.raw.length-Tt),Gt=Gt.substring(0,Ii.index),ae=Gt,mi=ui+1)),ui!==mi-1){if(ti=this.rules.block.listItemStart.exec(_t[ui+1]),this.options.pedantic?ti[1].length>di[1].length:ti[1].length>=di[0].length||ti[1].length>3){_t.splice(ui,2,_t[ui]+(!this.options.pedantic&&ti[1].length<di[0].length&&!_t[ui].match(/\n$/)?"":`
|
|
|
`)+_t[ui+1]),ui--,mi--;continue}else(!this.options.pedantic||this.options.smartLists?ti[2][ti[2].length-1]!==ce[ce.length-1]:ye===(ti[2].length===1))&&(Tt=_t.slice(ui+1).join(`
|
|
|
`).length,ct.raw=ct.raw.substring(0,ct.raw.length-Tt),ui=mi-1);di=ti}ni=Gt.length,Gt=Gt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~Gt.indexOf(`
|
|
|
`)&&(ni-=Gt.length,Gt=this.options.pedantic?Gt.replace(/^ {1,4}/gm,""):Gt.replace(new RegExp("^ {1,"+ni+"}","gm"),"")),Gt=ie(Gt,`
|
|
|
`),ui!==mi-1&&(ae=ae+`
|
|
|
`),ai=ut||/\n\n(?!\s*$)/.test(ae),ui!==mi-1&&(ut=ae.slice(-2)===`
|
|
|
|
|
|
`,ai||(ai=ut)),ai&&(ct.loose=!0),this.options.gfm&&(Di=/^\[[ xX]\] /.test(Gt),Ti=void 0,Di&&(Ti=Gt[1]!==" ",Gt=Gt.replace(/^\[[ xX]\] +/,""))),ct.items.push({type:"list_item",raw:ae,task:Di,checked:Ti,loose:ai,text:Gt})}return ct}},xe.html=function(U){var H=this.rules.block.html.exec(U);if(H)return{type:this.options.sanitize?"paragraph":"html",raw:H[0],pre:!this.options.sanitizer&&(H[1]==="pre"||H[1]==="script"||H[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(H[0]):A(H[0]):H[0]}},xe.def=function(U){var H=this.rules.block.def.exec(U);if(H){H[3]&&(H[3]=H[3].substring(1,H[3].length-1));var ae=H[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:ae,raw:H[0],href:H[2],title:H[3]}}},xe.table=function(U){var H=this.rules.block.table.exec(U);if(H){var ae={type:"table",header:L(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
|
|
|
`):[]};if(ae.header.length===ae.align.length){ae.raw=H[0];var ce=ae.align.length,ye;for(ye=0;ye<ce;ye++)/^ *-+: *$/.test(ae.align[ye])?ae.align[ye]="right":/^ *:-+: *$/.test(ae.align[ye])?ae.align[ye]="center":/^ *:-+ *$/.test(ae.align[ye])?ae.align[ye]="left":ae.align[ye]=null;for(ce=ae.cells.length,ye=0;ye<ce;ye++)ae.cells[ye]=L(ae.cells[ye].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},xe.lheading=function(U){var H=this.rules.block.lheading.exec(U);if(H)return{type:"heading",raw:H[0],depth:H[2].charAt(0)==="="?1:2,text:H[1]}},xe.paragraph=function(U){var H=this.rules.block.paragraph.exec(U);if(H)return{type:"paragraph",raw:H[0],text:H[1].charAt(H[1].length-1)===`
|
|
|
`?H[1].slice(0,-1):H[1]}},xe.text=function(U){var H=this.rules.block.text.exec(U);if(H)return{type:"text",raw:H[0],text:H[0]}},xe.escape=function(U){var H=this.rules.inline.escape.exec(U);if(H)return{type:"escape",raw:H[0],text:A(H[1])}},xe.tag=function(U,H,ae){var ce=this.rules.inline.tag.exec(U);if(ce)return!H&&/^<a /i.test(ce[0])?H=!0:H&&/^<\/a>/i.test(ce[0])&&(H=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(ce[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ce[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:ce[0],inLink:H,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):A(ce[0]):ce[0]}},xe.link=function(U){var H=this.rules.inline.link.exec(U);if(H){var ae=H[2].trim();if(!this.options.pedantic&&/^</.test(ae)){if(!/>$/.test(ae))return;var ce=ie(ae.slice(0,-1),"\\");if((ae.length-ce.length)%2===0)return}else{var ye=W(H[2],"()");if(ye>-1){var ct=H[0].indexOf("!")===0?5:4,_t=ct+H[1].length+ye;H[2]=H[2].substring(0,ye),H[0]=H[0].substring(0,_t).trim(),H[3]=""}}var ut=H[2],Gt="";if(this.options.pedantic){var ni=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ut);ni&&(ut=ni[1],Gt=ni[3])}else Gt=H[3]?H[3].slice(1,-1):"";return ut=ut.trim(),/^</.test(ut)&&(this.options.pedantic&&!/>$/.test(ae)?ut=ut.slice(1):ut=ut.slice(1,-1)),le(H,{href:ut&&ut.replace(this.rules.inline._escapes,"$1"),title:Gt&&Gt.replace(this.rules.inline._escapes,"$1")},H[0])}},xe.reflink=function(U,H){var ae;if((ae=this.rules.inline.reflink.exec(U))||(ae=this.rules.inline.nolink.exec(U))){var ce=(ae[2]||ae[1]).replace(/\s+/g," ");if(ce=H[ce.toLowerCase()],!ce||!ce.href){var ye=ae[0].charAt(0);return{type:"text",raw:ye,text:ye}}return le(ae,ce,ae[0])}},xe.emStrong=function(U,H,ae){ae===void 0&&(ae="");var ce=this.rules.inline.emStrong.lDelim.exec(U);if(ce&&!(ce[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 ye=ce[1]||ce[2]||"";if(!ye||ye&&(ae===""||this.rules.inline.punctuation.exec(ae))){var ct=ce[0].length-1,_t,ut,Gt=ct,ni=0,di=ce[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(di.lastIndex=0,H=H.slice(-1*U.length+ct);(ce=di.exec(H))!=null;)if(_t=ce[1]||ce[2]||ce[3]||ce[4]||ce[5]||ce[6],!!_t){if(ut=_t.length,ce[3]||ce[4]){Gt+=ut;continue}else if((ce[5]||ce[6])&&ct%3&&!((ct+ut)%3)){ni+=ut;continue}if(Gt-=ut,!(Gt>0))return ut=Math.min(ut,ut+Gt+ni),Math.min(ct,ut)%2?{type:"em",raw:U.slice(0,ct+ce.index+ut+1),text:U.slice(1,ct+ce.index+ut)}:{type:"strong",raw:U.slice(0,ct+ce.index+ut+1),text:U.slice(2,ct+ce.index+ut-1)}}}}},xe.codespan=function(U){var H=this.rules.inline.code.exec(U);if(H){var ae=H[2].replace(/\n/g," "),ce=/[^ ]/.test(ae),ye=/^ /.test(ae)&&/ $/.test(ae);return ce&&ye&&(ae=ae.substring(1,ae.length-1)),ae=A(ae,!0),{type:"codespan",raw:H[0],text:ae}}},xe.br=function(U){var H=this.rules.inline.br.exec(U);if(H)return{type:"br",raw:H[0]}},xe.del=function(U){var H=this.rules.inline.del.exec(U);if(H)return{type:"del",raw:H[0],text:H[2]}},xe.autolink=function(U,H){var ae=this.rules.inline.autolink.exec(U);if(ae){var ce,ye;return ae[2]==="@"?(ce=A(this.options.mangle?H(ae[1]):ae[1]),ye="mailto:"+ce):(ce=A(ae[1]),ye=ce),{type:"link",raw:ae[0],text:ce,href:ye,tokens:[{type:"text",raw:ce,text:ce}]}}},xe.url=function(U,H){var ae;if(ae=this.rules.inline.url.exec(U)){var ce,ye;if(ae[2]==="@")ce=A(this.options.mangle?H(ae[0]):ae[0]),ye="mailto:"+ce;else{var ct;do ct=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(ct!==ae[0]);ce=A(ae[0]),ae[1]==="www."?ye="http://"+ce:ye=ce}return{type:"link",raw:ae[0],text:ce,href:ye,tokens:[{type:"text",raw:ce,text:ce}]}}},xe.inlineText=function(U,H,ae){var ce=this.rules.inline.text.exec(U);if(ce){var ye;return H?ye=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):A(ce[0]):ce[0]:ye=A(this.options.smartypants?ae(ce[0]):ce[0]),{type:"text",raw:ce[0],text:ye}}},De}(),Kt=Q.noopTest,Pe=Q.edit,Zt=Q.merge,It={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:Kt,table:Kt,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};It._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,It._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,It.def=Pe(It.def).replace("label",It._label).replace("title",It._title).getRegex(),It.bullet=/(?:[*+-]|\d{1,9}[.)])/,It.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,It.item=Pe(It.item,"gm").replace(/bull/g,It.bullet).getRegex(),It.listItemStart=Pe(/^( *)(bull) */).replace("bull",It.bullet).getRegex(),It.list=Pe(It.list).replace(/bull/g,It.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+It.def.source+")").getRegex(),It._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",It._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,It.html=Pe(It.html,"i").replace("comment",It._comment).replace("tag",It._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),It.paragraph=Pe(It._paragraph).replace("hr",It.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",It._tag).getRegex(),It.blockquote=Pe(It.blockquote).replace("paragraph",It.paragraph).getRegex(),It.normal=Zt({},It),It.gfm=Zt({},It.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*|$)"}),It.gfm.nptable=Pe(It.gfm.nptable).replace("hr",It.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",It._tag).getRegex(),It.gfm.table=Pe(It.gfm.table).replace("hr",It.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",It._tag).getRegex(),It.pedantic=Zt({},It.normal,{html:Pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",It._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:Kt,paragraph:Pe(It.normal._paragraph).replace("hr",It.hr).replace("heading",` *#{1,6} *[^
|
|
|
]`).replace("lheading",It.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var bt={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Kt,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:Kt,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};bt._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",bt.punctuation=Pe(bt.punctuation).replace(/punctuation/g,bt._punctuation).getRegex(),bt.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,bt.escapedEmSt=/\\\*|\\_/g,bt._comment=Pe(It._comment).replace("(?:-->|$)","-->").getRegex(),bt.emStrong.lDelim=Pe(bt.emStrong.lDelim).replace(/punct/g,bt._punctuation).getRegex(),bt.emStrong.rDelimAst=Pe(bt.emStrong.rDelimAst,"g").replace(/punct/g,bt._punctuation).getRegex(),bt.emStrong.rDelimUnd=Pe(bt.emStrong.rDelimUnd,"g").replace(/punct/g,bt._punctuation).getRegex(),bt._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,bt._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,bt._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])?)+(?![-_])/,bt.autolink=Pe(bt.autolink).replace("scheme",bt._scheme).replace("email",bt._email).getRegex(),bt._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,bt.tag=Pe(bt.tag).replace("comment",bt._comment).replace("attribute",bt._attribute).getRegex(),bt._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,bt._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,bt._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,bt.link=Pe(bt.link).replace("label",bt._label).replace("href",bt._href).replace("title",bt._title).getRegex(),bt.reflink=Pe(bt.reflink).replace("label",bt._label).getRegex(),bt.reflinkSearch=Pe(bt.reflinkSearch,"g").replace("reflink",bt.reflink).replace("nolink",bt.nolink).getRegex(),bt.normal=Zt({},bt),bt.pedantic=Zt({},bt.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:Pe(/^!?\[(label)\]\((.*?)\)/).replace("label",bt._label).getRegex(),reflink:Pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",bt._label).getRegex()}),bt.gfm=Zt({},bt.normal,{escape:Pe(bt.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),bt.gfm.url=Pe(bt.gfm.url,"i").replace("email",bt.gfm._extended_email).getRegex(),bt.breaks=Zt({},bt.gfm,{br:Pe(bt.br).replace("{2,}","*").getRegex(),text:Pe(bt.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Oe={block:It,inline:bt},mt=pt,$e=me.exports.defaults,jt=Oe.block,ei=Oe.inline,Ce=Q.repeatString;function Ne(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 pe(De){var xe="",Ee,U,H=De.length;for(Ee=0;Ee<H;Ee++)U=De.charCodeAt(Ee),Math.random()>.5&&(U="x"+U.toString(16)),xe+="&#"+U+";";return xe}var Je=function(){function De(Ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ee||$e,this.options.tokenizer=this.options.tokenizer||new mt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var U={block:jt.normal,inline:ei.normal};this.options.pedantic?(U.block=jt.pedantic,U.inline=ei.pedantic):this.options.gfm&&(U.block=jt.gfm,this.options.breaks?U.inline=ei.breaks:U.inline=ei.gfm),this.tokenizer.rules=U}De.lex=function(U,H){var ae=new De(H);return ae.lex(U)},De.lexInline=function(U,H){var ae=new De(H);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,H,ae){H===void 0&&(H=[]),ae===void 0&&(ae=!0),this.options.pedantic&&(U=U.replace(/^ +$/gm,""));for(var ce,ye,ct,_t;U;){if(ce=this.tokenizer.space(U)){U=U.substring(ce.raw.length),ce.type&&H.push(ce);continue}if(ce=this.tokenizer.code(U)){U=U.substring(ce.raw.length),_t=H[H.length-1],_t&&_t.type==="paragraph"?(_t.raw+=`
|
|
|
`+ce.raw,_t.text+=`
|
|
|
`+ce.text):H.push(ce);continue}if(ce=this.tokenizer.fences(U)){U=U.substring(ce.raw.length),H.push(ce);continue}if(ce=this.tokenizer.heading(U)){U=U.substring(ce.raw.length),H.push(ce);continue}if(ce=this.tokenizer.nptable(U)){U=U.substring(ce.raw.length),H.push(ce);continue}if(ce=this.tokenizer.hr(U)){U=U.substring(ce.raw.length),H.push(ce);continue}if(ce=this.tokenizer.blockquote(U)){U=U.substring(ce.raw.length),ce.tokens=this.blockTokens(ce.text,[],ae),H.push(ce);continue}if(ce=this.tokenizer.list(U)){for(U=U.substring(ce.raw.length),ct=ce.items.length,ye=0;ye<ct;ye++)ce.items[ye].tokens=this.blockTokens(ce.items[ye].text,[],!1);H.push(ce);continue}if(ce=this.tokenizer.html(U)){U=U.substring(ce.raw.length),H.push(ce);continue}if(ae&&(ce=this.tokenizer.def(U))){U=U.substring(ce.raw.length),this.tokens.links[ce.tag]||(this.tokens.links[ce.tag]={href:ce.href,title:ce.title});continue}if(ce=this.tokenizer.table(U)){U=U.substring(ce.raw.length),H.push(ce);continue}if(ce=this.tokenizer.lheading(U)){U=U.substring(ce.raw.length),H.push(ce);continue}if(ae&&(ce=this.tokenizer.paragraph(U))){U=U.substring(ce.raw.length),H.push(ce);continue}if(ce=this.tokenizer.text(U)){U=U.substring(ce.raw.length),_t=H[H.length-1],_t&&_t.type==="text"?(_t.raw+=`
|
|
|
`+ce.raw,_t.text+=`
|
|
|
`+ce.text):H.push(ce);continue}if(U){var ut="Infinite loop on byte: "+U.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return H},xe.inline=function(U){var H,ae,ce,ye,ct,_t,ut=U.length;for(H=0;H<ut;H++)switch(_t=U[H],_t.type){case"paragraph":case"text":case"heading":{_t.tokens=[],this.inlineTokens(_t.text,_t.tokens);break}case"table":{for(_t.tokens={header:[],cells:[]},ye=_t.header.length,ae=0;ae<ye;ae++)_t.tokens.header[ae]=[],this.inlineTokens(_t.header[ae],_t.tokens.header[ae]);for(ye=_t.cells.length,ae=0;ae<ye;ae++)for(ct=_t.cells[ae],_t.tokens.cells[ae]=[],ce=0;ce<ct.length;ce++)_t.tokens.cells[ae][ce]=[],this.inlineTokens(ct[ce],_t.tokens.cells[ae][ce]);break}case"blockquote":{this.inline(_t.tokens);break}case"list":{for(ye=_t.items.length,ae=0;ae<ye;ae++)this.inline(_t.items[ae].tokens);break}}return U},xe.inlineTokens=function(U,H,ae,ce){H===void 0&&(H=[]),ae===void 0&&(ae=!1),ce===void 0&&(ce=!1);var ye,ct,_t=U,ut,Gt,ni;if(this.tokens.links){var di=Object.keys(this.tokens.links);if(di.length>0)for(;(ut=this.tokenizer.rules.inline.reflinkSearch.exec(_t))!=null;)di.includes(ut[0].slice(ut[0].lastIndexOf("[")+1,-1))&&(_t=_t.slice(0,ut.index)+"["+Ce("a",ut[0].length-2)+"]"+_t.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ut=this.tokenizer.rules.inline.blockSkip.exec(_t))!=null;)_t=_t.slice(0,ut.index)+"["+Ce("a",ut[0].length-2)+"]"+_t.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(ut=this.tokenizer.rules.inline.escapedEmSt.exec(_t))!=null;)_t=_t.slice(0,ut.index)+"++"+_t.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;U;){if(Gt||(ni=""),Gt=!1,ye=this.tokenizer.escape(U)){U=U.substring(ye.raw.length),H.push(ye);continue}if(ye=this.tokenizer.tag(U,ae,ce)){U=U.substring(ye.raw.length),ae=ye.inLink,ce=ye.inRawBlock;var ti=H[H.length-1];ti&&ye.type==="text"&&ti.type==="text"?(ti.raw+=ye.raw,ti.text+=ye.text):H.push(ye);continue}if(ye=this.tokenizer.link(U)){U=U.substring(ye.raw.length),ye.type==="link"&&(ye.tokens=this.inlineTokens(ye.text,[],!0,ce)),H.push(ye);continue}if(ye=this.tokenizer.reflink(U,this.tokens.links)){U=U.substring(ye.raw.length);var Tt=H[H.length-1];ye.type==="link"?(ye.tokens=this.inlineTokens(ye.text,[],!0,ce),H.push(ye)):Tt&&ye.type==="text"&&Tt.type==="text"?(Tt.raw+=ye.raw,Tt.text+=ye.text):H.push(ye);continue}if(ye=this.tokenizer.emStrong(U,_t,ni)){U=U.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],ae,ce),H.push(ye);continue}if(ye=this.tokenizer.codespan(U)){U=U.substring(ye.raw.length),H.push(ye);continue}if(ye=this.tokenizer.br(U)){U=U.substring(ye.raw.length),H.push(ye);continue}if(ye=this.tokenizer.del(U)){U=U.substring(ye.raw.length),ye.tokens=this.inlineTokens(ye.text,[],ae,ce),H.push(ye);continue}if(ye=this.tokenizer.autolink(U,pe)){U=U.substring(ye.raw.length),H.push(ye);continue}if(!ae&&(ye=this.tokenizer.url(U,pe))){U=U.substring(ye.raw.length),H.push(ye);continue}if(ye=this.tokenizer.inlineText(U,ce,Ne)){U=U.substring(ye.raw.length),ye.raw.slice(-1)!=="_"&&(ni=ye.raw.slice(-1)),Gt=!0,ct=H[H.length-1],ct&&ct.type==="text"?(ct.raw+=ye.raw,ct.text+=ye.text):H.push(ye);continue}if(U){var ai="Infinite loop on byte: "+U.charCodeAt(0);if(this.options.silent){console.error(ai);break}else throw new Error(ai)}}return H},re(De,null,[{key:"rules",get:function(){return{block:jt,inline:ei}}}]),De}(),ot=me.exports.defaults,Qe=Q.cleanUrl,Z=Q.escape,ve=function(){function De(Ee){this.options=Ee||ot}var xe=De.prototype;return xe.code=function(U,H,ae){var ce=(H||"").match(/\S*/)[0];if(this.options.highlight){var ye=this.options.highlight(U,ce);ye!=null&&ye!==U&&(ae=!0,U=ye)}return U=U.replace(/\n$/,"")+`
|
|
|
`,ce?'<pre><code class="'+this.options.langPrefix+Z(ce,!0)+'">'+(ae?U:Z(U,!0))+`</code></pre>
|
|
|
`:"<pre><code>"+(ae?U:Z(U,!0))+`</code></pre>
|
|
|
`},xe.blockquote=function(U){return`<blockquote>
|
|
|
`+U+`</blockquote>
|
|
|
`},xe.html=function(U){return U},xe.heading=function(U,H,ae,ce){return this.options.headerIds?"<h"+H+' id="'+this.options.headerPrefix+ce.slug(ae)+'">'+U+"</h"+H+`>
|
|
|
`:"<h"+H+">"+U+"</h"+H+`>
|
|
|
`},xe.hr=function(){return this.options.xhtml?`<hr/>
|
|
|
`:`<hr>
|
|
|
`},xe.list=function(U,H,ae){var ce=H?"ol":"ul",ye=H&&ae!==1?' start="'+ae+'"':"";return"<"+ce+ye+`>
|
|
|
`+U+"</"+ce+`>
|
|
|
`},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,H){return H&&(H="<tbody>"+H+"</tbody>"),`<table>
|
|
|
<thead>
|
|
|
`+U+`</thead>
|
|
|
`+H+`</table>
|
|
|
`},xe.tablerow=function(U){return`<tr>
|
|
|
`+U+`</tr>
|
|
|
`},xe.tablecell=function(U,H){var ae=H.header?"th":"td",ce=H.align?"<"+ae+' align="'+H.align+'">':"<"+ae+">";return ce+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,H,ae){if(U=Qe(this.options.sanitize,this.options.baseUrl,U),U===null)return ae;var ce='<a href="'+Z(U)+'"';return H&&(ce+=' title="'+H+'"'),ce+=">"+ae+"</a>",ce},xe.image=function(U,H,ae){if(U=Qe(this.options.sanitize,this.options.baseUrl,U),U===null)return ae;var ce='<img src="'+U+'" alt="'+ae+'"';return H&&(ce+=' title="'+H+'"'),ce+=this.options.xhtml?"/>":">",ce},xe.text=function(U){return U},De}(),Be=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,H,ae){return""+ae},xe.image=function(U,H,ae){return""+ae},xe.br=function(){return""},De}(),Ze=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,H){var ae=U,ce=0;if(this.seen.hasOwnProperty(ae)){ce=this.seen[U];do ce++,ae=U+"-"+ce;while(this.seen.hasOwnProperty(ae))}return H||(this.seen[U]=ce,this.seen[ae]=0),ae},xe.slug=function(U,H){H===void 0&&(H={});var ae=this.serialize(U);return this.getNextSafeSlug(ae,H.dryrun)},De}(),lt=ve,yt=Be,Yt=Ze,gt=me.exports.defaults,Se=Q.unescape,kt=function(){function De(Ee){this.options=Ee||gt,this.options.renderer=this.options.renderer||new lt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new yt,this.slugger=new Yt}De.parse=function(U,H){var ae=new De(H);return ae.parse(U)},De.parseInline=function(U,H){var ae=new De(H);return ae.parseInline(U)};var xe=De.prototype;return xe.parse=function(U,H){H===void 0&&(H=!0);var ae="",ce,ye,ct,_t,ut,Gt,ni,di,ti,Tt,ai,Di,Ti,Ii,mi,ui,Wi,Ui,on=U.length;for(ce=0;ce<on;ce++)switch(Tt=U[ce],Tt.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(Tt.tokens),Tt.depth,Se(this.parseInline(Tt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(Tt.text,Tt.lang,Tt.escaped);continue}case"table":{for(di="",ni="",_t=Tt.header.length,ye=0;ye<_t;ye++)ni+=this.renderer.tablecell(this.parseInline(Tt.tokens.header[ye]),{header:!0,align:Tt.align[ye]});for(di+=this.renderer.tablerow(ni),ti="",_t=Tt.cells.length,ye=0;ye<_t;ye++){for(Gt=Tt.tokens.cells[ye],ni="",ut=Gt.length,ct=0;ct<ut;ct++)ni+=this.renderer.tablecell(this.parseInline(Gt[ct]),{header:!1,align:Tt.align[ct]});ti+=this.renderer.tablerow(ni)}ae+=this.renderer.table(di,ti);continue}case"blockquote":{ti=this.parse(Tt.tokens),ae+=this.renderer.blockquote(ti);continue}case"list":{for(ai=Tt.ordered,Di=Tt.start,Ti=Tt.loose,_t=Tt.items.length,ti="",ye=0;ye<_t;ye++)mi=Tt.items[ye],ui=mi.checked,Wi=mi.task,Ii="",mi.task&&(Ui=this.renderer.checkbox(ui),Ti?mi.tokens.length>0&&mi.tokens[0].type==="text"?(mi.tokens[0].text=Ui+" "+mi.tokens[0].text,mi.tokens[0].tokens&&mi.tokens[0].tokens.length>0&&mi.tokens[0].tokens[0].type==="text"&&(mi.tokens[0].tokens[0].text=Ui+" "+mi.tokens[0].tokens[0].text)):mi.tokens.unshift({type:"text",text:Ui}):Ii+=Ui),Ii+=this.parse(mi.tokens,Ti),ti+=this.renderer.listitem(Ii,Wi,ui);ae+=this.renderer.list(ti,ai,Di);continue}case"html":{ae+=this.renderer.html(Tt.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(Tt.tokens));continue}case"text":{for(ti=Tt.tokens?this.parseInline(Tt.tokens):Tt.text;ce+1<on&&U[ce+1].type==="text";)Tt=U[++ce],ti+=`
|
|
|
`+(Tt.tokens?this.parseInline(Tt.tokens):Tt.text);ae+=H?this.renderer.paragraph(ti):ti;continue}default:{var qi='Token with "'+Tt.type+'" type was not found.';if(this.options.silent){console.error(qi);return}else throw new Error(qi)}}return ae},xe.parseInline=function(U,H){H=H||this.renderer;var ae="",ce,ye,ct=U.length;for(ce=0;ce<ct;ce++)switch(ye=U[ce],ye.type){case"escape":{ae+=H.text(ye.text);break}case"html":{ae+=H.html(ye.text);break}case"link":{ae+=H.link(ye.href,ye.title,this.parseInline(ye.tokens,H));break}case"image":{ae+=H.image(ye.href,ye.title,ye.text);break}case"strong":{ae+=H.strong(this.parseInline(ye.tokens,H));break}case"em":{ae+=H.em(this.parseInline(ye.tokens,H));break}case"codespan":{ae+=H.codespan(ye.text);break}case"br":{ae+=H.br();break}case"del":{ae+=H.del(this.parseInline(ye.tokens,H));break}case"text":{ae+=H.text(ye.text);break}default:{var _t='Token with "'+ye.type+'" type was not found.';if(this.options.silent){console.error(_t);return}else throw new Error(_t)}}return ae},De}(),Nt=Je,qt=kt,Te=pt,Re=ve,st=Be,vt=Ze,je=Q.merge,Dt=Q.checkSanitizeDeprecation,Ct=Q.escape,Et=me.exports.getDefaults,Ut=me.exports.changeDefaults,Xt=me.exports.defaults;function Xe(De,xe,Ee){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"&&(Ee=xe,xe=null),xe=je({},Xe.defaults,xe||{}),Dt(xe),Ee){var U=xe.highlight,H;try{H=Nt.lex(De,xe)}catch(ct){return Ee(ct)}var ae=function(_t){var ut;if(!_t)try{xe.walkTokens&&Xe.walkTokens(H,xe.walkTokens),ut=qt.parse(H,xe)}catch(Gt){_t=Gt}return xe.highlight=U,_t?Ee(_t):Ee(null,ut)};if(!U||U.length<3||(delete xe.highlight,!H.length))return ae();var ce=0;Xe.walkTokens(H,function(ct){ct.type==="code"&&(ce++,setTimeout(function(){U(ct.text,ct.lang,function(_t,ut){if(_t)return ae(_t);ut!=null&&ut!==ct.text&&(ct.text=ut,ct.escaped=!0),ce--,ce===0&&ae()})},0))}),ce===0&&ae();return}try{var ye=Nt.lex(De,xe);return xe.walkTokens&&Xe.walkTokens(ye,xe.walkTokens),qt.parse(ye,xe)}catch(ct){if(ct.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,xe.silent)return"<p>An error occurred:</p><pre>"+Ct(ct.message+"",!0)+"</pre>";throw ct}}Xe.options=Xe.setOptions=function(De){return je(Xe.defaults,De),Ut(Xe.defaults),Xe},Xe.getDefaults=Et,Xe.defaults=Xt,Xe.use=function(De){var xe=je({},De);if(De.renderer&&function(){var U=Xe.defaults.renderer||new Re,H=function(ye){var ct=U[ye];U[ye]=function(){for(var _t=arguments.length,ut=new Array(_t),Gt=0;Gt<_t;Gt++)ut[Gt]=arguments[Gt];var ni=De.renderer[ye].apply(U,ut);return ni===!1&&(ni=ct.apply(U,ut)),ni}};for(var ae in De.renderer)H(ae);xe.renderer=U}(),De.tokenizer&&function(){var U=Xe.defaults.tokenizer||new Te,H=function(ye){var ct=U[ye];U[ye]=function(){for(var _t=arguments.length,ut=new Array(_t),Gt=0;Gt<_t;Gt++)ut[Gt]=arguments[Gt];var ni=De.tokenizer[ye].apply(U,ut);return ni===!1&&(ni=ct.apply(U,ut)),ni}};for(var ae in De.tokenizer)H(ae);xe.tokenizer=U}(),De.walkTokens){var Ee=Xe.defaults.walkTokens;xe.walkTokens=function(U){De.walkTokens(U),Ee&&Ee(U)}}Xe.setOptions(xe)},Xe.walkTokens=function(De,xe){for(var Ee=Ye(De),U;!(U=Ee()).done;){var H=U.value;switch(xe(H),H.type){case"table":{for(var ae=Ye(H.tokens.header),ce;!(ce=ae()).done;){var ye=ce.value;Xe.walkTokens(ye,xe)}for(var ct=Ye(H.tokens.cells),_t;!(_t=ct()).done;)for(var ut=_t.value,Gt=Ye(ut),ni;!(ni=Gt()).done;){var di=ni.value;Xe.walkTokens(di,xe)}break}case"list":{Xe.walkTokens(H.items,xe);break}default:H.tokens&&Xe.walkTokens(H.tokens,xe)}}},Xe.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({},Xe.defaults,xe||{}),Dt(xe);try{var Ee=Nt.lexInline(De,xe);return xe.walkTokens&&Xe.walkTokens(Ee,xe.walkTokens),qt.parseInline(Ee,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}},Xe.Parser=qt,Xe.parser=qt.parse,Xe.Renderer=Re,Xe.TextRenderer=st,Xe.Lexer=Nt,Xe.lexer=Nt.lex,Xe.Tokenizer=Te,Xe.Slugger=vt,Xe.parse=Xe;var Vt=Xe;return Vt})},11690:function(Ci){const Ft=/[&<>"']/,re=/[&<>"']/g,ue=/[<>"']|&(?!#?\w+;)/,we=/[<>"']|&(?!#?\w+;)/g,Ye={"&":"&","<":"<",">":">",'"':""","'":"'"},me=se=>Ye[se];function J(se,ke){if(ke){if(Ft.test(se))return se.replace(re,me)}else if(ue.test(se))return se.replace(we,me);return se}const w=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Le(se){return se.replace(w,(ke,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,ke){se=se.source||se,ke=ke||"";const We={replace:(ze,Rt)=>(Rt=Rt.source||Rt,Rt=Rt.replace(P,"$1"),se=se.replace(ze,Rt),We),getRegex:()=>new RegExp(se,ke)};return We}const ne=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(se,ke,We){if(se){let ze;try{ze=decodeURIComponent(Le(We)).replace(ne,"").toLowerCase()}catch(Rt){return null}if(ze.indexOf("javascript:")===0||ze.indexOf("vbscript:")===0||ze.indexOf("data:")===0)return null}ke&&!I.test(We)&&(We=G(ke,We));try{We=encodeURI(We).replace(/%25/g,"%")}catch(ze){return null}return We}const T={},M=/^[^:]+:\/*[^/]*$/,O=/^([^:]+:)[\s\S]*$/,X=/^([^:]+:\/*[^/]*)[\s\S]*$/;function G(se,ke){T[" "+se]||(M.test(se)?T[" "+se]=se+"/":T[" "+se]=V(se,"/",!0)),se=T[" "+se];const We=se.indexOf(":")===-1;return ke.substring(0,2)==="//"?We?ke:se.replace(O,"$1")+ke:ke.charAt(0)==="/"?We?ke:se.replace(X,"$1")+ke:se+ke}const j={exec:function(){}};function $(se){let ke=1,We,ze;for(;ke<arguments.length;ke++){We=arguments[ke];for(ze in We)Object.prototype.hasOwnProperty.call(We,ze)&&(se[ze]=We[ze])}return se}function N(se,ke){const We=se.replace(/\|/g,(te,z,q)=>{let Q=!1,de=z;for(;--de>=0&&q[de]==="\\";)Q=!Q;return Q?"|":" |"}),ze=We.split(/ \|/);let Rt=0;if(ze.length>ke)ze.splice(ke);else for(;ze.length<ke;)ze.push("");for(;Rt<ze.length;Rt++)ze[Rt]=ze[Rt].trim().replace(/\\\|/g,"|");return ze}function V(se,ke,We){const ze=se.length;if(ze===0)return"";let Rt=0;for(;Rt<ze;){const te=se.charAt(ze-Rt-1);if(te===ke&&!We)Rt++;else if(te!==ke&&We)Rt++;else break}return se.substr(0,ze-Rt)}function fe(se,ke){if(se.indexOf(ke[1])===-1)return-1;const We=se.length;let ze=0,Rt=0;for(;Rt<We;Rt++)if(se[Rt]==="\\")Rt++;else if(se[Rt]===ke[0])ze++;else if(se[Rt]===ke[1]&&(ze--,ze<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 Ae(se,ke){if(ke<1)return"";let We="";for(;ke>1;)ke&1&&(We+=se),ke>>=1,se+=se;return We+se}Ci.exports={escape:J,unescape:Le,edit:f,cleanUrl:k,resolveUrl:G,noopTest:j,merge:$,splitCells:N,rtrim:V,findClosingBracket:fe,checkSanitizeDeprecation:be,repeatString:Ae}},75918:function(Ci,Ft,re){"use strict";re.d(Ft,{Wi:function(){return w},Z0:function(){return Le},aU:function(){return J},eZ:function(){return f},wY:function(){return P}});var ue=re(4348),we=re(69323),Ye=re(13268),me=function(ne,I,k,T){function M(O){return O instanceof k?O:new k(function(X){X(O)})}return new(k||(k=Promise))(function(O,X){function G(N){try{$(T.next(N))}catch(V){X(V)}}function j(N){try{$(T.throw(N))}catch(V){X(V)}}function $(N){N.done?O(N.value):M(N.value).then(G,j)}$((T=T.apply(ne,I||[])).next())})};class J extends we.JT{constructor(I,k="",T="",M=!0,O){super(),this._onDidChange=this._register(new ue.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=I,this._label=k,this._cssClass=T,this._enabled=M,this._actionCallback=O}get id(){return this._id}get label(){return this._label}set label(I){this._setLabel(I)}_setLabel(I){this._label!==I&&(this._label=I,this._onDidChange.fire({label:I}))}get tooltip(){return this._tooltip||""}set tooltip(I){this._setTooltip(I)}_setTooltip(I){this._tooltip!==I&&(this._tooltip=I,this._onDidChange.fire({tooltip:I}))}get class(){return this._cssClass}set class(I){this._setClass(I)}_setClass(I){this._cssClass!==I&&(this._cssClass=I,this._onDidChange.fire({class:I}))}get enabled(){return this._enabled}set enabled(I){this._setEnabled(I)}_setEnabled(I){this._enabled!==I&&(this._enabled=I,this._onDidChange.fire({enabled:I}))}get checked(){return this._checked}set checked(I){this._setChecked(I)}_setChecked(I){this._checked!==I&&(this._checked=I,this._onDidChange.fire({checked:I}))}run(I,k){return me(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(I))})}}class w extends we.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new ue.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new ue.Q5),this.onDidRun=this._onDidRun.event}run(I,k){return me(this,void 0,void 0,function*(){if(!I.enabled)return;this._onBeforeRun.fire({action:I});let T;try{yield this.runAction(I,k)}catch(M){T=M}this._onDidRun.fire({action:I,error:T})})}runAction(I,k){return me(this,void 0,void 0,function*(){yield I.run(k)})}}class Le extends J{constructor(I){super(Le.ID,I,I?"separator text":"separator"),this.checked=!1,this.enabled=!1}}Le.ID="vs.actions.separator";class P{constructor(I,k,T,M){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=I,this.label=k,this.class=M,this._actions=T}get actions(){return this._actions}dispose(){}run(){return me(this,void 0,void 0,function*(){})}}class f extends J{constructor(){super(f.ID,Ye.N("submenu.empty","(empty)"),void 0,!1)}}f.ID="vs.actions.empty"},76068:function(Ci,Ft,re){"use strict";re.d(Ft,{ok:function(){return ue}});function ue(we,Ye){if(!we)throw new Error(Ye?`Assertion failed (${Ye})`:"Assertion Failed")}},52615:function(Ci,Ft,re){"use strict";re.d(Ft,{CM:function(){return J},JL:function(){return w},dT:function(){return P},fK:function(){return me},lA:function(){return Le}});var ue=re(4348);class we{constructor(){this._icons=new Map,this._onDidRegister=new ue.Q5}add(ne){const I=this._icons.get(ne.id);I?ne.description?I.description=ne.description:console.error(`Duplicate registration of codicon ${ne.id}`):(this._icons.set(ne.id,ne),this._onDidRegister.fire(ne))}get(ne){return this._icons.get(ne)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Ye=new we,me=Ye;function J(f,ne){return new Le(f,ne)}function w(f){return f?f.replace(/\$\((.*?)\)/g,(ne,I)=>` ${I} `).trim():""}class Le{constructor(ne,I,k){this.id=ne,this.definition=I,this.description=k,Ye.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 ne=new RegExp(`^(${f.iconNameExpression})(${f.iconModifierExpression})?$`);function I(M){if(M instanceof Le)return["codicon","codicon-"+M.id];const O=ne.exec(M.id);if(!O)return I(Le.error);let[,X,G]=O;const j=["codicon","codicon-"+X];return G&&j.push("codicon-modifier-"+G.substr(1)),j}f.asClassNameArray=I;function k(M){return I(M).join(" ")}f.asClassName=k;function T(M){return"."+I(M).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"})}(Le||(Le={}))},79881:function(Ci,Ft,re){"use strict";re.d(Ft,{B8:function(){return I},Cp:function(){return me},F0:function(){return P},L6:function(){return ne},VV:function(){return Le},b1:function(){return f},dL:function(){return Ye},ri:function(){return J}});class ue{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(T){setTimeout(()=>{throw T.stack?new Error(T.message+`
|
|
|
|
|
|
`+T.stack):T},0)}}emit(T){this.listeners.forEach(M=>{M(T)})}onUnexpectedError(T){this.unexpectedErrorHandler(T),this.emit(T)}onUnexpectedExternalError(T){this.unexpectedErrorHandler(T)}}const we=new ue;function Ye(k){Le(k)||we.onUnexpectedError(k)}function me(k){Le(k)||we.onUnexpectedExternalError(k)}function J(k){if(k instanceof Error){let{name:T,message:M}=k;const O=k.stacktrace||k.stack;return{$isError:!0,name:T,message:M,stack:O}}return k}const w="Canceled";function Le(k){return k instanceof Error&&k.name===w&&k.message===w}function P(){const k=new Error(w);return k.name=k.message,k}function f(k){return k?new Error(`Illegal argument: ${k}`):new Error("Illegal argument")}function ne(k){return k?new Error(`Illegal state: ${k}`):new Error("Illegal state")}class I extends Error{constructor(T){super("NotSupported"),T&&(this.message=T)}}},4348:function(Ci,Ft,re){"use strict";re.d(Ft,{D0:function(){return I},E7:function(){return k},K3:function(){return ne},Q5:function(){return f},ZD:function(){return T},ju:function(){return J}});var ue=re(79881),we=re(69323),Ye=re(34502),me=re(95830),J;(function(M){M.None=()=>we.JT.None;function O(q){return(Q,de=null,ie)=>{let L=!1,A;return A=q(W=>{if(!L)return A?A.dispose():L=!0,Q.call(de,W)},null,ie),L&&A.dispose(),A}}M.once=O;function X(q,Q){return fe((de,ie=null,L)=>q(A=>de.call(ie,Q(A)),null,L))}M.map=X;function G(q,Q){return fe((de,ie=null,L)=>q(A=>{Q(A),de.call(ie,A)},null,L))}M.forEach=G;function j(q,Q){return fe((de,ie=null,L)=>q(A=>Q(A)&&de.call(ie,A),null,L))}M.filter=j;function $(q){return q}M.signal=$;function N(...q){return(Q,de=null,ie)=>(0,we.F8)(...q.map(L=>L(A=>Q.call(de,A),null,ie)))}M.any=N;function V(q,Q,de){let ie=de;return X(q,L=>(ie=Q(ie,L),ie))}M.reduce=V;function fe(q){let Q;const de=new f({onFirstListenerAdd(){Q=q(de.fire,de)},onLastListenerRemove(){Q.dispose()}});return de.event}function be(q,Q,de=100,ie=!1,L){let A,W,le,et=0;const pt=new f({leakWarningThreshold:L,onFirstListenerAdd(){A=q(Kt=>{et++,W=Q(W,Kt),ie&&!le&&(pt.fire(W),W=void 0),clearTimeout(le),le=setTimeout(()=>{const Pe=W;W=void 0,le=void 0,(!ie||et>1)&&pt.fire(Pe),et=0},de)})},onLastListenerRemove(){A.dispose()}});return pt.event}M.debounce=be;function Ae(q,Q=(de,ie)=>de===ie){let de=!0,ie;return j(q,L=>{const A=de||!Q(L,ie);return de=!1,ie=L,A})}M.latch=Ae;function se(q,Q){return[M.filter(q,Q),M.filter(q,de=>!Q(de))]}M.split=se;function ke(q,Q=!1,de=[]){let ie=de.slice(),L=q(le=>{ie?ie.push(le):W.fire(le)});const A=()=>{ie&&ie.forEach(le=>W.fire(le)),ie=null},W=new f({onFirstListenerAdd(){L||(L=q(le=>W.fire(le)))},onFirstListenerDidAdd(){ie&&(Q?setTimeout(A):A())},onLastListenerRemove(){L&&L.dispose(),L=null}});return W.event}M.buffer=ke;class We{constructor(Q){this.event=Q}map(Q){return new We(X(this.event,Q))}forEach(Q){return new We(G(this.event,Q))}filter(Q){return new We(j(this.event,Q))}reduce(Q,de){return new We(V(this.event,Q,de))}latch(){return new We(Ae(this.event))}debounce(Q,de=100,ie=!1,L){return new We(be(this.event,Q,de,ie,L))}on(Q,de,ie){return this.event(Q,de,ie)}once(Q,de,ie){return O(this.event)(Q,de,ie)}}function ze(q){return new We(q)}M.chain=ze;function Rt(q,Q,de=ie=>ie){const ie=(...le)=>W.fire(de(...le)),L=()=>q.on(Q,ie),A=()=>q.removeListener(Q,ie),W=new f({onFirstListenerAdd:L,onLastListenerRemove:A});return W.event}M.fromNodeEventEmitter=Rt;function te(q,Q,de=ie=>ie){const ie=(...le)=>W.fire(de(...le)),L=()=>q.addEventListener(Q,ie),A=()=>q.removeEventListener(Q,ie),W=new f({onFirstListenerAdd:L,onLastListenerRemove:A});return W.event}M.fromDOMEventEmitter=te;function z(q){return new Promise(Q=>O(q)(Q))}M.toPromise=z})(J||(J={}));class w{constructor(O){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${O}_${w._idPool++}`}start(O){this._stopWatch=new me.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}}}w._idPool=0;let Le=-1;class P{constructor(O,X=Math.random().toString(18).slice(2,5)){this.customThreshold=O,this.name=X,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(O){let X=Le;if(typeof this.customThreshold=="number"&&(X=this.customThreshold),X<=0||O<X)return;this._stacks||(this._stacks=new Map);const G=new Error().stack.split(`
|
|
|
`).slice(3).join(`
|
|
|
`),j=this._stacks.get(G)||0;if(this._stacks.set(G,j+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=X*.5;let $,N=0;for(const[V,fe]of this._stacks)(!$||N<fe)&&($=V,N=fe);console.warn(`[${this.name}] potential listener LEAK detected, having ${O} listeners already. MOST frequent listener (${N}):`),console.warn($)}return()=>{const $=this._stacks.get(G)||0;this._stacks.set(G,$-1)}}}class f{constructor(O){var X;this._disposed=!1,this._options=O,this._leakageMon=Le>0?new P(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((X=this._options)===null||X===void 0)&&X._profName?new w(this._options._profName):void 0}get event(){return this._event||(this._event=(O,X,G)=>{var j;this._listeners||(this._listeners=new Ye.S);const $=this._listeners.isEmpty();$&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const N=this._listeners.push(X?[O,X]:O);$&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,O,X);const V=(j=this._leakageMon)===null||j===void 0?void 0:j.check(this._listeners.size),fe=(0,we.OF)(()=>{V&&V(),this._disposed||(N(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return G instanceof we.SL?G.add(fe):Array.isArray(G)&&G.push(fe),fe}),this._event}fire(O){var X,G;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Ye.S);for(let j of this._listeners)this._deliveryQueue.push([j,O]);for((X=this._perfMon)===null||X===void 0||X.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[j,$]=this._deliveryQueue.shift();try{typeof j=="function"?j.call(void 0,$):j[0].call(j[1],$)}catch(N){(0,ue.dL)(N)}}(G=this._perfMon)===null||G===void 0||G.stop()}}dispose(){var O,X,G,j,$;this._disposed||(this._disposed=!0,(O=this._listeners)===null||O===void 0||O.clear(),(X=this._deliveryQueue)===null||X===void 0||X.clear(),(j=(G=this._options)===null||G===void 0?void 0:G.onLastListenerRemove)===null||j===void 0||j.call(G),($=this._leakageMon)===null||$===void 0||$.dispose())}}class ne extends f{constructor(O){super(O),this._isPaused=0,this._eventQueue=new Ye.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 I extends ne{constructor(O){var X;super(O),this._delay=(X=O.delay)!==null&&X!==void 0?X: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(X,G,j)=>O($=>{const N=this.buffers[this.buffers.length-1];N?N.push(()=>X.call(G,$)):X.call(G,$)},void 0,j)}bufferEvents(O){const X=[];this.buffers.push(X);const G=O();return this.buffers.pop(),X.forEach(j=>j()),G}}class T{constructor(){this.listening=!1,this.inputEvent=J.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,Ft,re){"use strict";re.d(Ft,{I:function(){return ue}});function ue(we){const Ye=this;let me=!1,J;return function(){return me||(me=!0,J=we.apply(Ye,arguments)),J}}},88226:function(Ci,Ft,re){"use strict";re.d(Ft,{$:function(){return ue}});var ue;(function(we){function Ye(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}we.is=Ye;const me=Object.freeze([]);function J(){return me}we.empty=J;function*w(N){yield N}we.single=w;function Le(N){return N||me}we.from=Le;function P(N){return!N||N[Symbol.iterator]().next().done===!0}we.isEmpty=P;function f(N){return N[Symbol.iterator]().next().value}we.first=f;function ne(N,V){for(const fe of N)if(V(fe))return!0;return!1}we.some=ne;function I(N,V){for(const fe of N)if(V(fe))return fe}we.find=I;function*k(N,V){for(const fe of N)V(fe)&&(yield fe)}we.filter=k;function*T(N,V){let fe=0;for(const be of N)yield V(be,fe++)}we.map=T;function*M(...N){for(const V of N)for(const fe of V)yield fe}we.concat=M;function*O(N){for(const V of N)for(const fe of V)yield fe}we.concatNested=O;function X(N,V,fe){let be=fe;for(const Ae of N)be=V(be,Ae);return be}we.reduce=X;function*G(N,V,fe=N.length){for(V<0&&(V+=N.length),fe<0?fe+=N.length:fe>N.length&&(fe=N.length);V<fe;V++)yield N[V]}we.slice=G;function j(N,V=Number.POSITIVE_INFINITY){const fe=[];if(V===0)return[fe,N];const be=N[Symbol.iterator]();for(let Ae=0;Ae<V;Ae++){const se=be.next();if(se.done)return[fe,we.empty()];fe.push(se.value)}return[fe,{[Symbol.iterator](){return be}}]}we.consume=j;function $(N,V,fe=(be,Ae)=>be===Ae){const be=N[Symbol.iterator](),Ae=V[Symbol.iterator]();for(;;){const se=be.next(),ke=Ae.next();if(se.done!==ke.done)return!1;if(se.done)return!0;if(!fe(se.value,ke.value))return!1}}we.equals=$})(ue||(ue={}))},69323:function(Ci,Ft,re){"use strict";re.d(Ft,{B9:function(){return T},F8:function(){return M},JT:function(){return G},Jz:function(){return $},OF:function(){return O},SL:function(){return X},Wf:function(){return k},XK:function(){return j},dk:function(){return ne}});var ue=re(17845),we=re(88226);const Ye=!1;let me=null;function J(N){me=N}if(Ye){const N="__is_disposable_tracked__";J(new class{trackDisposable(V){const fe=new Error("Potentially leaked disposable").stack;setTimeout(()=>{V[N]||console.log(fe)},3e3)}setParent(V,fe){if(V&&V!==G.None)try{V[N]=!0}catch(be){}}markAsDisposed(V){if(V&&V!==G.None)try{V[N]=!0}catch(fe){}}markAsSingleton(V){}})}function w(N){return me==null||me.trackDisposable(N),N}function Le(N){me==null||me.markAsDisposed(N)}function P(N,V){me==null||me.setParent(N,V)}function f(N,V){if(me)for(const fe of N)me.setParent(fe,V)}function ne(N){return me==null||me.markAsSingleton(N),N}class I extends Error{constructor(V){super(`Encountered errors while disposing of store. Errors: [${V.join(", ")}]`),this.errors=V}}function k(N){return typeof N.dispose=="function"&&N.dispose.length===0}function T(N){if(we.$.is(N)){let V=[];for(const fe of N)if(fe)try{fe.dispose()}catch(be){V.push(be)}if(V.length===1)throw V[0];if(V.length>1)throw new I(V);return Array.isArray(N)?[]:N}else if(N)return N.dispose(),N}function M(...N){const V=O(()=>T(N));return f(N,V),V}function O(N){const V=w({dispose:(0,ue.I)(()=>{Le(V),N()})});return V}class X{constructor(){this._toDispose=new Set,this._isDisposed=!1,w(this)}dispose(){this._isDisposed||(Le(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?X.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}}X.DISABLE_DISPOSED_WARNING=!1;class G{constructor(){this._store=new X,w(this),P(this._store,this)}dispose(){Le(this),this._store.dispose()}_register(V){if(V===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(V)}}G.None=Object.freeze({dispose(){}});class j{constructor(){this._isDisposed=!1,w(this)}get value(){return this._isDisposed?void 0:this._value}set value(V){var fe;this._isDisposed||V===this._value||((fe=this._value)===null||fe===void 0||fe.dispose(),V&&P(V,this),this._value=V)}clear(){this.value=void 0}dispose(){var V;this._isDisposed=!0,Le(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 ${constructor(V){this.object=V}dispose(){}}},34502:function(Ci,Ft,re){"use strict";re.d(Ft,{S:function(){return we}});class ue{constructor(me){this.element=me,this.next=ue.Undefined,this.prev=ue.Undefined}}ue.Undefined=new ue(void 0);class we{constructor(){this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ue.Undefined}clear(){let me=this._first;for(;me!==ue.Undefined;){const J=me.next;me.prev=ue.Undefined,me.next=ue.Undefined,me=J}this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}unshift(me){return this._insert(me,!1)}push(me){return this._insert(me,!0)}_insert(me,J){const w=new ue(me);if(this._first===ue.Undefined)this._first=w,this._last=w;else if(J){const P=this._last;this._last=w,w.prev=P,P.next=w}else{const P=this._first;this._first=w,w.next=P,P.prev=w}this._size+=1;let Le=!1;return()=>{Le||(Le=!0,this._remove(w))}}shift(){if(this._first!==ue.Undefined){const me=this._first.element;return this._remove(this._first),me}}pop(){if(this._last!==ue.Undefined){const me=this._last.element;return this._remove(this._last),me}}_remove(me){if(me.prev!==ue.Undefined&&me.next!==ue.Undefined){const J=me.prev;J.next=me.next,me.next.prev=J}else me.prev===ue.Undefined&&me.next===ue.Undefined?(this._first=ue.Undefined,this._last=ue.Undefined):me.next===ue.Undefined?(this._last=this._last.prev,this._last.next=ue.Undefined):me.prev===ue.Undefined&&(this._first=this._first.next,this._first.prev=ue.Undefined);this._size-=1}*[Symbol.iterator](){let me=this._first;for(;me!==ue.Undefined;)yield me.element,me=me.next}}},23345:function(Ci,Ft,re){"use strict";re.d(Ft,{$L:function(){return be},ED:function(){return $},IJ:function(){return V},OS:function(){return We},WE:function(){return se},dz:function(){return N},gn:function(){return Ae},li:function(){return O},r:function(){return te},tY:function(){return fe},xS:function(){return ke}});var ue=re(97671),we;const Ye="en";let me=!1,J=!1,w=!1,Le=!1,P=!1,f=!1,ne=!1,I,k=null,T=null,M;const O=typeof self=="object"?self:typeof re.g=="object"?re.g:{};let X;typeof O.vscode!="undefined"&&typeof O.vscode.process!="undefined"?X=O.vscode.process:typeof ue!="undefined"&&(X=ue);const G=typeof((we=X==null?void 0:X.versions)===null||we===void 0?void 0:we.electron)=="string"&&X.type==="renderer";if(typeof navigator=="object"&&!G)M=navigator.userAgent,me=M.indexOf("Windows")>=0,J=M.indexOf("Macintosh")>=0,ne=(M.indexOf("Macintosh")>=0||M.indexOf("iPad")>=0||M.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,w=M.indexOf("Linux")>=0,f=!0,I=navigator.language,k=I;else if(typeof X=="object"){me=X.platform==="win32",J=X.platform==="darwin",w=X.platform==="linux",Le=w&&!!X.env.SNAP&&!!X.env.SNAP_REVISION,I=Ye,k=Ye;const z=X.env.VSCODE_NLS_CONFIG;if(z)try{const q=JSON.parse(z),Q=q.availableLanguages["*"];I=q.locale,k=Q||Ye,T=q._translationsConfigFile}catch(q){}P=!0}else console.error("Unable to resolve platform.");let j=0;J?j=1:me?j=3:w&&(j=2);const $=me,N=J,V=w,fe=P,be=f,Ae=ne,se=M,ke=function(){if(O.setImmediate)return O.setImmediate.bind(O);if(typeof O.postMessage=="function"&&!O.importScripts){let Q=[];O.addEventListener("message",ie=>{if(ie.data&&ie.data.vscodeSetImmediateId)for(let L=0,A=Q.length;L<A;L++){const W=Q[L];if(W.id===ie.data.vscodeSetImmediateId){Q.splice(L,1),W.callback();return}}});let de=0;return ie=>{const L=++de;Q.push({id:L,callback:ie}),O.postMessage({vscodeSetImmediateId:L},"*")}}if(typeof(X==null?void 0:X.nextTick)=="function")return X.nextTick.bind(X);const q=Promise.resolve();return Q=>q.then(Q)}(),We=J||ne?2:me?1:3;let ze=!0,Rt=!1;function te(){if(!Rt){Rt=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,ze=new Uint16Array(z.buffer)[0]===513}return ze}},95830:function(Ci,Ft,re){"use strict";re.d(Ft,{G:function(){return Ye}});var ue=re(23345);const we=ue.li.performance&&typeof ue.li.performance.now=="function";class Ye{constructor(J){this._highResolution=we&&J,this._startTime=this._now(),this._stopTime=-1}static create(J=!0){return new Ye(J)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?ue.li.performance.now():Date.now()}}},82983:function(Ci,Ft,re){"use strict";re.d(Ft,{$i:function(){return et},C8:function(){return It},GF:function(){return I},HO:function(){return de},IO:function(){return k},K7:function(){return Zt},Kw:function(){return mt},LC:function(){return O},Mh:function(){return ke},P1:function(){return We},PJ:function(){return $e},Qe:function(){return pt},R1:function(){return ne},RP:function(){return W},S6:function(){return jt},TT:function(){return $},Ut:function(){return L},V8:function(){return X},WU:function(){return Ye},YK:function(){return Rt},YU:function(){return me},ZG:function(){return ze},ZH:function(){return z},ab:function(){return Kt},c1:function(){return bt},df:function(){return be},ec:function(){return J},fi:function(){return ei},fy:function(){return w},j3:function(){return Le},j_:function(){return V},m5:function(){return ue},mK:function(){return fe},mr:function(){return T},oH:function(){return pe},oL:function(){return P},ok:function(){return se},ow:function(){return G},qq:function(){return Ae},qu:function(){return j},rL:function(){return te},uS:function(){return Oe},un:function(){return f},uq:function(){return M},vH:function(){return Q},xe:function(){return Pe},zY:function(){return N}});function ue(Z){return!Z||typeof Z!="string"?!0:Z.trim().length===0}const we=/{(\d+)}/g;function Ye(Z,...ve){return ve.length===0?Z:Z.replace(we,function(Be,Ze){const lt=parseInt(Ze,10);return isNaN(lt)||lt<0||lt>=ve.length?Be:ve[lt]})}function me(Z){return Z.replace(/[<>&]/g,function(ve){switch(ve){case"<":return"<";case">":return">";case"&":return"&";default:return ve}})}function J(Z){return Z.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function w(Z,ve=" "){const Be=Le(Z,ve);return P(Be,ve)}function Le(Z,ve){if(!Z||!ve)return Z;const Be=ve.length;if(Be===0||Z.length===0)return Z;let Ze=0;for(;Z.indexOf(ve,Ze)===Ze;)Ze=Ze+Be;return Z.substring(Ze)}function P(Z,ve){if(!Z||!ve)return Z;const Be=ve.length,Ze=Z.length;if(Be===0||Ze===0)return Z;let lt=Ze,yt=-1;for(;yt=Z.lastIndexOf(ve,lt-1),!(yt===-1||yt+Be!==lt);){if(yt===0)return"";lt=yt}return Z.substring(0,lt)}function f(Z){return Z.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function ne(Z){return Z.replace(/\*/g,"")}function I(Z,ve,Be={}){if(!Z)throw new Error("Cannot create regex from empty string");ve||(Z=J(Z)),Be.wholeWord&&(/\B/.test(Z.charAt(0))||(Z="\\b"+Z),/\B/.test(Z.charAt(Z.length-1))||(Z=Z+"\\b"));let Ze="";return Be.global&&(Ze+="g"),Be.matchCase||(Ze+="i"),Be.multiline&&(Ze+="m"),Be.unicode&&(Ze+="u"),new RegExp(Z,Ze)}function k(Z){return Z.source==="^"||Z.source==="^$"||Z.source==="$"||Z.source==="^\\s*$"?!1:!!(Z.exec("")&&Z.lastIndex===0)}function T(Z){return(Z.global?"g":"")+(Z.ignoreCase?"i":"")+(Z.multiline?"m":"")+(Z.unicode?"u":"")}function M(Z){return Z.split(/\r\n|\r|\n/)}function O(Z){for(let ve=0,Be=Z.length;ve<Be;ve++){const Ze=Z.charCodeAt(ve);if(Ze!==32&&Ze!==9)return ve}return-1}function X(Z,ve=0,Be=Z.length){for(let Ze=ve;Ze<Be;Ze++){const lt=Z.charCodeAt(Ze);if(lt!==32&<!==9)return Z.substring(ve,Ze)}return Z.substring(ve,Be)}function G(Z,ve=Z.length-1){for(let Be=ve;Be>=0;Be--){const Ze=Z.charCodeAt(Be);if(Ze!==32&&Ze!==9)return Be}return-1}function j(Z,ve){return Z<ve?-1:Z>ve?1:0}function $(Z,ve,Be=0,Ze=Z.length,lt=0,yt=ve.length){for(;Be<Ze&<<yt;Be++,lt++){let Se=Z.charCodeAt(Be),kt=ve.charCodeAt(lt);if(Se<kt)return-1;if(Se>kt)return 1}const Yt=Ze-Be,gt=yt-lt;return Yt<gt?-1:Yt>gt?1:0}function N(Z,ve){return V(Z,ve,0,Z.length,0,ve.length)}function V(Z,ve,Be=0,Ze=Z.length,lt=0,yt=ve.length){for(;Be<Ze&<<yt;Be++,lt++){let Se=Z.charCodeAt(Be),kt=ve.charCodeAt(lt);if(Se===kt)continue;if(Se>=128||kt>=128)return $(Z.toLowerCase(),ve.toLowerCase(),Be,Ze,lt,yt);fe(Se)&&(Se-=32),fe(kt)&&(kt-=32);const Nt=Se-kt;if(Nt!==0)return Nt}const Yt=Ze-Be,gt=yt-lt;return Yt<gt?-1:Yt>gt?1:0}function fe(Z){return Z>=97&&Z<=122}function be(Z){return Z>=65&&Z<=90}function Ae(Z,ve){return Z.length===ve.length&&V(Z,ve)===0}function se(Z,ve){const Be=ve.length;return ve.length>Z.length?!1:V(Z,ve,0,Be)===0}function ke(Z,ve){let Be,Ze=Math.min(Z.length,ve.length);for(Be=0;Be<Ze;Be++)if(Z.charCodeAt(Be)!==ve.charCodeAt(Be))return Be;return Ze}function We(Z,ve){let Be,Ze=Math.min(Z.length,ve.length);const lt=Z.length-1,yt=ve.length-1;for(Be=0;Be<Ze;Be++)if(Z.charCodeAt(lt-Be)!==ve.charCodeAt(yt-Be))return Be;return Ze}function ze(Z){return 55296<=Z&&Z<=56319}function Rt(Z){return 56320<=Z&&Z<=57343}function te(Z,ve){return(Z-55296<<10)+(ve-56320)+65536}function z(Z,ve,Be){const Ze=Z.charCodeAt(Be);if(ze(Ze)&&Be+1<ve){const lt=Z.charCodeAt(Be+1);if(Rt(lt))return te(Ze,lt)}return Ze}function q(Z,ve){const Be=Z.charCodeAt(ve-1);if(Rt(Be)&&ve>1){const Ze=Z.charCodeAt(ve-2);if(ze(Ze))return te(Ze,Be)}return Be}function Q(Z,ve){const Be=Ce.getInstance(),Ze=ve,lt=Z.length,yt=z(Z,lt,ve);ve+=yt>=65536?2:1;let Yt=Be.getGraphemeBreakType(yt);for(;ve<lt;){const gt=z(Z,lt,ve),Se=Be.getGraphemeBreakType(gt);if(ei(Yt,Se))break;ve+=gt>=65536?2:1,Yt=Se}return ve-Ze}function de(Z,ve){const Be=Ce.getInstance(),Ze=ve,lt=q(Z,ve);ve-=lt>=65536?2:1;let yt=Be.getGraphemeBreakType(lt);for(;ve>0;){const Yt=q(Z,ve),gt=Be.getGraphemeBreakType(Yt);if(ei(gt,yt))break;ve-=Yt>=65536?2:1,yt=gt}return Ze-ve}const ie=/(?:[\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 L(Z){return ie.test(Z)}const A=/(?:[\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 W(Z){return A.test(Z)}const le=/^[\t\n\r\x20-\x7E]*$/;function et(Z){return le.test(Z)}const pt=/[\u2028\u2029]/;function Kt(Z){return pt.test(Z)}function Pe(Z){for(let ve=0,Be=Z.length;ve<Be;ve++)if(Zt(Z.charCodeAt(ve)))return!0;return!1}function Zt(Z){return Z=+Z,Z>=11904&&Z<=55215||Z>=63744&&Z<=64255||Z>=65281&&Z<=65374}function It(Z){return Z>=127462&&Z<=127487||Z===8986||Z===8987||Z===9200||Z===9203||Z>=9728&&Z<=10175||Z===11088||Z===11093||Z>=127744&&Z<=128591||Z>=128640&&Z<=128764||Z>=128992&&Z<=129003||Z>=129280&&Z<=129535||Z>=129648&&Z<=129750}const bt="\uFEFF";function Oe(Z){return!!(Z&&Z.length>0&&Z.charCodeAt(0)===65279)}function mt(Z,ve=!1){return Z?(ve&&(Z=Z.replace(/\\./g,"")),Z.toLowerCase()!==Z):!1}function $e(Z){return Z=Z%(2*26),Z<26?String.fromCharCode(97+Z):String.fromCharCode(65+Z-26)}function jt(Z){return Ce.getInstance().getGraphemeBreakType(Z)}function ei(Z,ve){return Z===0?ve!==5&&ve!==7:Z===2&&ve===3?!1:Z===4||Z===2||Z===3||ve===4||ve===2||ve===3?!0:!(Z===8&&(ve===8||ve===9||ve===11||ve===12)||(Z===11||Z===9)&&(ve===9||ve===10)||(Z===12||Z===10)&&ve===10||ve===5||ve===13||ve===7||Z===1||Z===13&&ve===14||Z===6&&ve===6)}class Ce{constructor(){this._data=Ne()}static getInstance(){return Ce._INSTANCE||(Ce._INSTANCE=new Ce),Ce._INSTANCE}getGraphemeBreakType(ve){if(ve<32)return ve===10?3:ve===13?2:4;if(ve<127)return 0;const Be=this._data,Ze=Be.length/3;let lt=1;for(;lt<=Ze;)if(ve<Be[3*lt])lt=2*lt;else if(ve>Be[3*lt+1])lt=2*lt+1;else return Be[3*lt+2];return 0}}Ce._INSTANCE=null;function Ne(){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 pe(Z,ve){if(Z===0)return 0;const Be=Je(Z,ve);if(Be!==void 0)return Be;const Ze=q(ve,Z);return Z-=ot(Ze),Z}function Je(Z,ve){let Be=q(ve,Z);for(Z-=ot(Be);Qe(Be)||Be===65039||Be===8419;){if(Z===0)return;Be=q(ve,Z),Z-=ot(Be)}if(It(Be)){if(Z>=0){const Ze=q(ve,Z);Ze===8205&&(Z-=ot(Ze))}return Z}}function ot(Z){return Z>=65536?2:1}function Qe(Z){return 127995<=Z&&Z<=127999}},72999:function(Ci,Ft,re){"use strict";re.d(Ft,{$E:function(){return O},$K:function(){return Le},D8:function(){return k},HD:function(){return we},IU:function(){return X},Jp:function(){return P},Kn:function(){return Ye},cW:function(){return ne},f6:function(){return G},hj:function(){return me},jn:function(){return J},kJ:function(){return ue},mf:function(){return I},o8:function(){return w},p_:function(){return f},vE:function(){return j}});function ue($){return Array.isArray($)}function we($){return typeof $=="string"}function Ye($){return typeof $=="object"&&$!==null&&!Array.isArray($)&&!($ instanceof RegExp)&&!($ instanceof Date)}function me($){return typeof $=="number"&&!isNaN($)}function J($){return $===!0||$===!1}function w($){return typeof $=="undefined"}function Le($){return!P($)}function P($){return w($)||$===null}function f($,N){if(!$)throw new Error(N?`Unexpected type, expected '${N}'`:"Unexpected type")}function ne($){if(P($))throw new Error("Assertion Failed: argument is undefined or null");return $}function I($){return typeof $=="function"}function k($,N){const V=Math.min($.length,N.length);for(let fe=0;fe<V;fe++)T($[fe],N[fe])}function T($,N){if(we(N)){if(typeof $!==N)throw new Error(`argument does not match constraint: typeof ${N}`)}else if(I(N)){try{if($ instanceof N)return}catch(V){}if(!P($)&&$.constructor===N||N.length===1&&N.call(void 0,$)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function M($){let N=[],V=Object.getPrototypeOf($);for(;Object.prototype!==V;)N=N.concat(Object.getOwnPropertyNames(V)),V=Object.getPrototypeOf(V);return N}function O($){const N=[];for(const V of M($))typeof $[V]=="function"&&N.push(V);return N}function X($,N){const V=be=>function(){const Ae=Array.prototype.slice.call(arguments,0);return N(be,Ae)};let fe={};for(const be of $)fe[be]=V(be);return fe}function G($){return $===null?void 0:$}function j($,N="Unreachable"){throw new Error(N)}},13268:function(Ci,Ft,re){"use strict";re.d(Ft,{N:function(){return we}});function ue(Ye,me){let J;return me.length===0?J=Ye:J=Ye.replace(/\{(\d+)\}/g,function(w,Le){const P=Le[0];return typeof me[P]!="undefined"?me[P]:w}),J}function we(Ye,me,...J){return ue(me,J)}},96236:function(Ci,Ft,re){"use strict";re.d(Ft,{BH:function(){return X},NZ:function(){return G},U8:function(){return j},co:function(){return O},eH:function(){return M},vr:function(){return T}});var ue=re(75918),we=re(52615),Ye=re(4348),me=re(88226),J=re(69323),w=re(34502),Le=re(35884),P=re(90689),f=re(16925),ne=re(49055),I=function($,N,V,fe){var be=arguments.length,Ae=be<3?N:fe===null?fe=Object.getOwnPropertyDescriptor(N,V):fe,se;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Ae=Reflect.decorate($,N,V,fe);else for(var ke=$.length-1;ke>=0;ke--)(se=$[ke])&&(Ae=(be<3?se(Ae):be>3?se(N,V,Ae):se(N,V))||Ae);return be>3&&Ae&&Object.defineProperty(N,V,Ae),Ae},k=function($,N){return function(V,fe){N(V,fe,$)}};function T($){return $.command!==void 0}class M{constructor(N){this.id=M._idPool++,this._debugName=N}}M._idPool=0,M.CommandPalette=new M("CommandPalette"),M.EditorContext=new M("EditorContext"),M.SimpleEditorContext=new M("SimpleEditorContext"),M.EditorContextCopy=new M("EditorContextCopy"),M.EditorContextPeek=new M("EditorContextPeek"),M.MenubarEditMenu=new M("MenubarEditMenu"),M.MenubarCopy=new M("MenubarCopy"),M.MenubarGoMenu=new M("MenubarGoMenu"),M.MenubarSelectionMenu=new M("MenubarSelectionMenu"),M.InlineCompletionsActions=new M("InlineCompletionsActions");const O=(0,f.yh)("menuService"),X=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Ye.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:$=>$===M.CommandPalette}}addCommand($){return this.addCommands(me.$.single($))}addCommands($){for(const N of $)this._commands.set(N.id,N);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,J.OF)(()=>{let N=!1;for(const V of $)N=this._commands.delete(V.id)||N;N&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand($){return this._commands.get($)}getCommands(){const $=new Map;return this._commands.forEach((N,V)=>$.set(V,N)),$}appendMenuItem($,N){return this.appendMenuItems(me.$.single({id:$,item:N}))}appendMenuItems($){const N=new Set,V=new w.S;for(const{id:fe,item:be}of $){let Ae=this._menuItems.get(fe);Ae||(Ae=new w.S,this._menuItems.set(fe,Ae)),V.push(Ae.push(be)),N.add(fe)}return this._onDidChangeMenu.fire(N),(0,J.OF)(()=>{if(V.size>0){for(let fe of V)fe();this._onDidChangeMenu.fire(N),V.clear()}})}getMenuItems($){let N;return this._menuItems.has($)?N=[...this._menuItems.get($)]:N=[],$===M.CommandPalette&&this._appendImplicitItems(N),N}_appendImplicitItems($){const N=new Set;for(const V of $)T(V)&&(N.add(V.command.id),V.alt&&N.add(V.alt.id));this._commands.forEach((V,fe)=>{N.has(fe)||$.push({command:V})})}};class G extends ue.wY{constructor(N,V,fe,be){super(`submenuitem.${N.submenu.id}`,typeof N.title=="string"?N.title:N.title.value,[],"submenu"),this.item=N,this._menuService=V,this._contextKeyService=fe,this._options=be}get actions(){const N=[],V=this._menuService.createMenu(this.item.submenu,this._contextKeyService),fe=V.getActions(this._options);V.dispose();for(const[,be]of fe)be.length>0&&(N.push(...be),N.push(new ue.Z0));return N.length&&N.pop(),N}}let j=class Tp{constructor(N,V,fe,be,Ae){var se,ke;if(this._commandService=Ae,this.id=N.id,this.label=fe!=null&&fe.renderShortTitle&&N.shortTitle?typeof N.shortTitle=="string"?N.shortTitle:N.shortTitle.value:typeof N.title=="string"?N.title:N.title.value,this.tooltip=(ke=typeof N.tooltip=="string"?N.tooltip:(se=N.tooltip)===null||se===void 0?void 0:se.value)!==null&&ke!==void 0?ke:"",this.enabled=!N.precondition||be.contextMatchesRules(N.precondition),this.checked=void 0,N.toggled){const We=N.toggled.condition?N.toggled:{condition:N.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=N,this.alt=V?new Tp(V,void 0,fe,be,Ae):void 0,this._options=fe,ne.kS.isThemeIcon(N.icon)&&(this.class=we.dT.asClassName(N.icon))}dispose(){}run(...N){var V,fe;let be=[];return!((V=this._options)===null||V===void 0)&&V.arg&&(be=[...be,this._options.arg]),!((fe=this._options)===null||fe===void 0)&&fe.shouldForwardArgs&&(be=[...be,...N]),this._commandService.executeCommand(this.id,...be)}};j=I([k(3,P.i6),k(4,Le.H)],j)},35884:function(Ci,Ft,re){"use strict";re.d(Ft,{H:function(){return Le},P:function(){return P}});var ue=re(4348),we=re(88226),Ye=re(69323),me=re(34502),J=re(72999),w=re(16925);const Le=(0,w.yh)("commandService"),P=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new ue.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(f,ne){if(!f)throw new Error("invalid command");if(typeof f=="string"){if(!ne)throw new Error("invalid command");return this.registerCommand({id:f,handler:ne})}if(f.description){const O=[];for(let G of f.description.args)O.push(G.constraint);const X=f.handler;f.handler=function(G,...j){return(0,J.D8)(j,O),X(G,...j)}}const{id:I}=f;let k=this._commands.get(I);k||(k=new me.S,this._commands.set(I,k));let T=k.unshift(f),M=(0,Ye.OF)(()=>{T();const O=this._commands.get(I);O!=null&&O.isEmpty()&&this._commands.delete(I)});return this._onDidRegisterCommand.fire(I),M}registerCommandAlias(f,ne){return P.registerCommand(f,(I,...k)=>I.get(Le).executeCommand(ne,...k))}getCommand(f){const ne=this._commands.get(f);if(!(!ne||ne.isEmpty()))return we.$.first(ne)}getCommands(){const f=new Map;for(const ne of this._commands.keys()){const I=this.getCommand(ne);I&&f.set(ne,I)}return f}};P.registerCommand("noop",()=>{})},90689:function(Ci,Ft,re){"use strict";re.d(Ft,{Ao:function(){return Le},Eq:function(){return te},Fb:function(){return P},K8:function(){return Q},i6:function(){return Rt},uy:function(){return ze}});var ue=re(23345),we=re(82983),Ye=re(16925);let me=ue.WE||"";const J=new Map;J.set("false",!1),J.set("true",!0),J.set("isMac",ue.dz),J.set("isLinux",ue.IJ),J.set("isWindows",ue.ED),J.set("isWeb",ue.$L),J.set("isMacNative",ue.dz&&!ue.$L),J.set("isEdge",me.indexOf("Edg/")>=0),J.set("isFirefox",me.indexOf("Firefox")>=0),J.set("isChrome",me.indexOf("Chrome")>=0),J.set("isSafari",me.indexOf("Safari")>=0);const w=Object.prototype.hasOwnProperty;class Le{static has(L){return k.create(L)}static equals(L,A){return T.create(L,A)}static regex(L,A){return be.create(L,A)}static not(L){return G.create(L)}static and(...L){return ke.create(L,null)}static or(...L){return We.create(L,null,!0)}static deserialize(L,A=!1){if(L)return this._deserializeOrExpression(L,A)}static _deserializeOrExpression(L,A){let W=L.split("||");return We.create(W.map(le=>this._deserializeAndExpression(le,A)),null,!0)}static _deserializeAndExpression(L,A){let W=L.split("&&");return ke.create(W.map(le=>this._deserializeOne(le,A)),null)}static _deserializeOne(L,A){if(L=L.trim(),L.indexOf("!=")>=0){let W=L.split("!=");return X.create(W[0].trim(),this._deserializeValue(W[1],A))}if(L.indexOf("==")>=0){let W=L.split("==");return T.create(W[0].trim(),this._deserializeValue(W[1],A))}if(L.indexOf("=~")>=0){let W=L.split("=~");return be.create(W[0].trim(),this._deserializeRegexValue(W[1],A))}if(L.indexOf(" in ")>=0){let W=L.split(" in ");return M.create(W[0].trim(),W[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(L)){const W=L.split(">=");return N.create(W[0].trim(),W[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(L)){const W=L.split(">");return $.create(W[0].trim(),W[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(L)){const W=L.split("<=");return fe.create(W[0].trim(),W[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(L)){const W=L.split("<");return V.create(W[0].trim(),W[1].trim())}return/^\!\s*/.test(L)?G.create(L.substr(1).trim()):k.create(L)}static _deserializeValue(L,A){if(L=L.trim(),L==="true")return!0;if(L==="false")return!1;let W=/^'([^']*)'$/.exec(L);return W?W[1].trim():L}static _deserializeRegexValue(L,A){if((0,we.m5)(L)){if(A)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let W=L.indexOf("/"),le=L.lastIndexOf("/");if(W===le||W<0){if(A)throw new Error(`bad regexp-value '${L}', missing /-enclosure`);return console.warn(`bad regexp-value '${L}', missing /-enclosure`),null}let et=L.slice(W+1,le),pt=L[le+1]==="i"?"i":"";try{return new RegExp(et,pt)}catch(Kt){if(A)throw new Error(`bad regexp-value '${L}', parse error: ${Kt}`);return console.warn(`bad regexp-value '${L}', parse error: ${Kt}`),null}}}function P(ie,L){const A=ie?ie.substituteConstants():void 0,W=L?L.substituteConstants():void 0;return!A&&!W?!0:!A||!W?!1:A.equals(W)}function f(ie,L){return ie.cmp(L)}class ne{constructor(){this.type=0}cmp(L){return this.type-L.type}equals(L){return L.type===this.type}substituteConstants(){return this}evaluate(L){return!1}serialize(){return"false"}keys(){return[]}negate(){return I.INSTANCE}}ne.INSTANCE=new ne;class I{constructor(){this.type=1}cmp(L){return this.type-L.type}equals(L){return L.type===this.type}substituteConstants(){return this}evaluate(L){return!0}serialize(){return"true"}keys(){return[]}negate(){return ne.INSTANCE}}I.INSTANCE=new I;class k{constructor(L,A){this.key=L,this.negated=A,this.type=2}static create(L,A=null){const W=J.get(L);return typeof W=="boolean"?W?I.INSTANCE:ne.INSTANCE:new k(L,A)}cmp(L){return L.type!==this.type?this.type-L.type:z(this.key,L.key)}equals(L){return L.type===this.type?this.key===L.key:!1}substituteConstants(){const L=J.get(this.key);return typeof L=="boolean"?L?I.INSTANCE:ne.INSTANCE:this}evaluate(L){return!!L.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=G.create(this.key,this)),this.negated}}class T{constructor(L,A,W){this.key=L,this.value=A,this.negated=W,this.type=4}static create(L,A,W=null){if(typeof A=="boolean")return A?k.create(L,W):G.create(L,W);const le=J.get(L);return typeof le=="boolean"?A===(le?"true":"false")?I.INSTANCE:ne.INSTANCE:new T(L,A,W)}cmp(L){return L.type!==this.type?this.type-L.type:q(this.key,this.value,L.key,L.value)}equals(L){return L.type===this.type?this.key===L.key&&this.value===L.value:!1}substituteConstants(){const L=J.get(this.key);if(typeof L=="boolean"){const A=L?"true":"false";return this.value===A?I.INSTANCE:ne.INSTANCE}return this}evaluate(L){return L.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=X.create(this.key,this.value,this)),this.negated}}class M{constructor(L,A){this.key=L,this.valueKey=A,this.type=10,this.negated=null}static create(L,A){return new M(L,A)}cmp(L){return L.type!==this.type?this.type-L.type:q(this.key,this.valueKey,L.key,L.valueKey)}equals(L){return L.type===this.type?this.key===L.key&&this.valueKey===L.valueKey:!1}substituteConstants(){return this}evaluate(L){const A=L.getValue(this.valueKey),W=L.getValue(this.key);return Array.isArray(A)?A.indexOf(W)>=0:typeof W=="string"&&typeof A=="object"&&A!==null?w.call(A,W):!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(L){this._actual=L,this.type=11}static create(L){return new O(L)}cmp(L){return L.type!==this.type?this.type-L.type:this._actual.cmp(L._actual)}equals(L){return L.type===this.type?this._actual.equals(L._actual):!1}substituteConstants(){return this}evaluate(L){return!this._actual.evaluate(L)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class X{constructor(L,A,W){this.key=L,this.value=A,this.negated=W,this.type=5}static create(L,A,W=null){if(typeof A=="boolean")return A?G.create(L,W):k.create(L,W);const le=J.get(L);return typeof le=="boolean"?A===(le?"true":"false")?ne.INSTANCE:I.INSTANCE:new X(L,A,W)}cmp(L){return L.type!==this.type?this.type-L.type:q(this.key,this.value,L.key,L.value)}equals(L){return L.type===this.type?this.key===L.key&&this.value===L.value:!1}substituteConstants(){const L=J.get(this.key);if(typeof L=="boolean"){const A=L?"true":"false";return this.value===A?ne.INSTANCE:I.INSTANCE}return this}evaluate(L){return L.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 G{constructor(L,A){this.key=L,this.negated=A,this.type=3}static create(L,A=null){const W=J.get(L);return typeof W=="boolean"?W?ne.INSTANCE:I.INSTANCE:new G(L,A)}cmp(L){return L.type!==this.type?this.type-L.type:z(this.key,L.key)}equals(L){return L.type===this.type?this.key===L.key:!1}substituteConstants(){const L=J.get(this.key);return typeof L=="boolean"?L?ne.INSTANCE:I.INSTANCE:this}evaluate(L){return!L.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 j(ie,L){if(typeof ie=="string"){const A=parseFloat(ie);isNaN(A)||(ie=A)}return typeof ie=="string"||typeof ie=="number"?L(ie):ne.INSTANCE}class ${constructor(L,A,W){this.key=L,this.value=A,this.negated=W,this.type=12}static create(L,A,W=null){return j(A,le=>new $(L,le,W))}cmp(L){return L.type!==this.type?this.type-L.type:q(this.key,this.value,L.key,L.value)}equals(L){return L.type===this.type?this.key===L.key&&this.value===L.value:!1}substituteConstants(){return this}evaluate(L){return typeof this.value=="string"?!1:parseFloat(L.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=fe.create(this.key,this.value,this)),this.negated}}class N{constructor(L,A,W){this.key=L,this.value=A,this.negated=W,this.type=13}static create(L,A,W=null){return j(A,le=>new N(L,le,W))}cmp(L){return L.type!==this.type?this.type-L.type:q(this.key,this.value,L.key,L.value)}equals(L){return L.type===this.type?this.key===L.key&&this.value===L.value:!1}substituteConstants(){return this}evaluate(L){return typeof this.value=="string"?!1:parseFloat(L.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(L,A,W){this.key=L,this.value=A,this.negated=W,this.type=14}static create(L,A,W=null){return j(A,le=>new V(L,le,W))}cmp(L){return L.type!==this.type?this.type-L.type:q(this.key,this.value,L.key,L.value)}equals(L){return L.type===this.type?this.key===L.key&&this.value===L.value:!1}substituteConstants(){return this}evaluate(L){return typeof this.value=="string"?!1:parseFloat(L.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=N.create(this.key,this.value,this)),this.negated}}class fe{constructor(L,A,W){this.key=L,this.value=A,this.negated=W,this.type=15}static create(L,A,W=null){return j(A,le=>new fe(L,le,W))}cmp(L){return L.type!==this.type?this.type-L.type:q(this.key,this.value,L.key,L.value)}equals(L){return L.type===this.type?this.key===L.key&&this.value===L.value:!1}substituteConstants(){return this}evaluate(L){return typeof this.value=="string"?!1:parseFloat(L.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 be{constructor(L,A){this.key=L,this.regexp=A,this.type=7,this.negated=null}static create(L,A){return new be(L,A)}cmp(L){if(L.type!==this.type)return this.type-L.type;if(this.key<L.key)return-1;if(this.key>L.key)return 1;const A=this.regexp?this.regexp.source:"",W=L.regexp?L.regexp.source:"";return A<W?-1:A>W?1:0}equals(L){if(L.type===this.type){const A=this.regexp?this.regexp.source:"",W=L.regexp?L.regexp.source:"";return this.key===L.key&&A===W}return!1}substituteConstants(){return this}evaluate(L){let A=L.getValue(this.key);return this.regexp?this.regexp.test(A):!1}serialize(){const L=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${L}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Ae.create(this)),this.negated}}class Ae{constructor(L){this._actual=L,this.type=8}static create(L){return new Ae(L)}cmp(L){return L.type!==this.type?this.type-L.type:this._actual.cmp(L._actual)}equals(L){return L.type===this.type?this._actual.equals(L._actual):!1}substituteConstants(){return this}evaluate(L){return!this._actual.evaluate(L)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function se(ie){let L=null;for(let A=0,W=ie.length;A<W;A++){const le=ie[A].substituteConstants();if(ie[A]!==le&&L===null){L=[];for(let et=0;et<A;et++)L[et]=ie[et]}L!==null&&(L[A]=le)}return L===null?ie:L}class ke{constructor(L,A){this.expr=L,this.negated=A,this.type=6}static create(L,A){return ke._normalizeArr(L,A)}cmp(L){if(L.type!==this.type)return this.type-L.type;if(this.expr.length<L.expr.length)return-1;if(this.expr.length>L.expr.length)return 1;for(let A=0,W=this.expr.length;A<W;A++){const le=f(this.expr[A],L.expr[A]);if(le!==0)return le}return 0}equals(L){if(L.type===this.type){if(this.expr.length!==L.expr.length)return!1;for(let A=0,W=this.expr.length;A<W;A++)if(!this.expr[A].equals(L.expr[A]))return!1;return!0}return!1}substituteConstants(){const L=se(this.expr);return L===this.expr?this:ke.create(L,this.negated)}evaluate(L){for(let A=0,W=this.expr.length;A<W;A++)if(!this.expr[A].evaluate(L))return!1;return!0}static _normalizeArr(L,A){const W=[];let le=!1;for(const et of L)if(et){if(et.type===1){le=!0;continue}if(et.type===0)return ne.INSTANCE;if(et.type===6){W.push(...et.expr);continue}W.push(et)}if(W.length===0&&le)return I.INSTANCE;if(W.length!==0){if(W.length===1)return W[0];W.sort(f);for(let et=1;et<W.length;et++)W[et-1].equals(W[et])&&(W.splice(et,1),et--);if(W.length===1)return W[0];for(;W.length>1;){const et=W[W.length-1];if(et.type!==9)break;W.pop();const pt=W.pop(),Kt=W.length===0,Pe=We.create(et.expr.map(Zt=>ke.create([Zt,pt],null)),null,Kt);Pe&&(W.push(Pe),W.sort(f))}return W.length===1?W[0]:new ke(W,A)}}serialize(){return this.expr.map(L=>L.serialize()).join(" && ")}keys(){const L=[];for(let A of this.expr)L.push(...A.keys());return L}negate(){if(!this.negated){const L=[];for(let A of this.expr)L.push(A.negate());this.negated=We.create(L,this,!0)}return this.negated}}class We{constructor(L,A){this.expr=L,this.negated=A,this.type=9}static create(L,A,W){return We._normalizeArr(L,A,W)}cmp(L){if(L.type!==this.type)return this.type-L.type;if(this.expr.length<L.expr.length)return-1;if(this.expr.length>L.expr.length)return 1;for(let A=0,W=this.expr.length;A<W;A++){const le=f(this.expr[A],L.expr[A]);if(le!==0)return le}return 0}equals(L){if(L.type===this.type){if(this.expr.length!==L.expr.length)return!1;for(let A=0,W=this.expr.length;A<W;A++)if(!this.expr[A].equals(L.expr[A]))return!1;return!0}return!1}substituteConstants(){const L=se(this.expr);return L===this.expr?this:We.create(L,this.negated,!1)}evaluate(L){for(let A=0,W=this.expr.length;A<W;A++)if(this.expr[A].evaluate(L))return!0;return!1}static _normalizeArr(L,A,W){let le=[],et=!1;if(L){for(let pt=0,Kt=L.length;pt<Kt;pt++){const Pe=L[pt];if(Pe){if(Pe.type===0){et=!0;continue}if(Pe.type===1)return I.INSTANCE;if(Pe.type===9){le=le.concat(Pe.expr);continue}le.push(Pe)}}if(le.length===0&&et)return ne.INSTANCE;le.sort(f)}if(le.length!==0){if(le.length===1)return le[0];for(let pt=1;pt<le.length;pt++)le[pt-1].equals(le[pt])&&(le.splice(pt,1),pt--);if(le.length===1)return le[0];if(W){for(let pt=0;pt<le.length;pt++)for(let Kt=pt+1;Kt<le.length;Kt++)Q(le[pt],le[Kt])&&(le.splice(Kt,1),Kt--);if(le.length===1)return le[0]}return new We(le,A)}}serialize(){return this.expr.map(L=>L.serialize()).join(" || ")}keys(){const L=[];for(let A of this.expr)L.push(...A.keys());return L}negate(){if(!this.negated){let L=[];for(let A of this.expr)L.push(A.negate());for(;L.length>1;){const A=L.shift(),W=L.shift(),le=[];for(const pt of de(A))for(const Kt of de(W))le.push(ke.create([pt,Kt],null));const et=L.length===0;L.unshift(We.create(le,null,et))}this.negated=L[0]}return this.negated}}class ze extends k{constructor(L,A,W){super(L,null),this._defaultValue=A,typeof W=="object"?ze._info.push(Object.assign(Object.assign({},W),{key:L})):W!==!0&&ze._info.push({key:L,description:W,type:A!=null?typeof A:void 0})}static all(){return ze._info.values()}bindTo(L){return L.createKey(this.key,this._defaultValue)}getValue(L){return L.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(L){return T.create(this.key,L)}}ze._info=[];const Rt=(0,Ye.yh)("contextKeyService"),te="setContext";function z(ie,L){return ie<L?-1:ie>L?1:0}function q(ie,L,A,W){return ie<A?-1:ie>A?1:L<W?-1:L>W?1:0}function Q(ie,L){if(L.type===6&&ie.type!==9&&ie.type!==6){for(const le of L.expr)if(ie.equals(le))return!0}const A=ie.negate(),W=de(A).concat(de(L));W.sort(f);for(let le=0;le<W.length;le++){const pt=W[le].negate();for(let Kt=le+1;Kt<W.length;Kt++){const Pe=W[Kt];if(pt.equals(Pe))return!0}}return!1}function de(ie){return ie.type===9?ie.expr:[ie]}},16925:function(Ci,Ft,re){"use strict";re.d(Ft,{I8:function(){return ue},TG:function(){return we},jt:function(){return J},yh:function(){return me}});var ue;(function(w){w.serviceIds=new Map,w.DI_TARGET="$di$target",w.DI_DEPENDENCIES="$di$dependencies";function Le(P){return P[w.DI_DEPENDENCIES]||[]}w.getServiceDependencies=Le})(ue||(ue={}));const we=me("instantiationService");function Ye(w,Le,P,f){Le[ue.DI_TARGET]===Le?Le[ue.DI_DEPENDENCIES].push({id:w,index:P,optional:f}):(Le[ue.DI_DEPENDENCIES]=[{id:w,index:P,optional:f}],Le[ue.DI_TARGET]=Le)}function me(w){if(ue.serviceIds.has(w))return ue.serviceIds.get(w);const Le=function(P,f,ne){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ye(Le,P,ne,!1)};return Le.toString=()=>w,ue.serviceIds.set(w,Le),Le}function J(w){return function(Le,P,f){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Ye(w,Le,f,!0)}}},44650:function(Ci,Ft,re){"use strict";re.d(Ft,{B:function(){return me}});var ue=re(76068),we=re(72999);class Ye{constructor(){this.data=new Map}add(w,Le){ue.ok(we.HD(w)),ue.ok(we.Kn(Le)),ue.ok(!this.data.has(w),"There is already an extension with this id"),this.data.set(w,Le)}as(w){return this.data.get(w)||null}}const me=new Ye},66213:function(Ci,Ft,re){"use strict";re.d(Ft,{e:function(){return ue}});var ue;(function(we){we.DARK="dark",we.LIGHT="light",we.HIGH_CONTRAST="hc"})(ue||(ue={}))},49055:function(Ci,Ft,re){"use strict";re.d(Ft,{EN:function(){return f},IP:function(){return k},Ic:function(){return O},XE:function(){return Le},bB:function(){return X},kS:function(){return ne},m6:function(){return I}});var ue=re(52615),we=re(4348),Ye=re(69323),me=re(16925),J=re(44650),w=re(66213);const Le=(0,me.yh)("themeService");var P;(function(G){function j($){return $&&typeof $=="object"&&typeof $.id=="string"}G.isThemeColor=j})(P||(P={}));function f(G){return{id:G}}var ne;(function(G){function j(Ae){return Ae&&typeof Ae=="object"&&typeof Ae.id=="string"&&(typeof Ae.color=="undefined"||P.isThemeColor(Ae.color))}G.isThemeIcon=j;const $=new RegExp(`^\\$\\((${ue.dT.iconNameExpression}(?:${ue.dT.iconModifierExpression})?)\\)$`);function N(Ae){const se=$.exec(Ae);if(!se)return;let[,ke]=se;return{id:ke}}G.fromString=N;function V(Ae,se){let ke=Ae.id;const We=ke.lastIndexOf("~");return We!==-1&&(ke=ke.substring(0,We)),se&&(ke=`${ke}~${se}`),{id:ke}}G.modify=V;function fe(Ae,se){var ke,We;return Ae.id===se.id&&((ke=Ae.color)===null||ke===void 0?void 0:ke.id)===((We=se.color)===null||We===void 0?void 0:We.id)}G.isEqual=fe;function be(Ae,se){return{id:Ae.id,color:se?f(se):void 0}}G.asThemeIcon=be,G.asClassNameArray=ue.dT.asClassNameArray,G.asClassName=ue.dT.asClassName,G.asCSSSelector=ue.dT.asCSSSelector})(ne||(ne={}));function I(G){switch(G){case w.e.DARK:return"vs-dark";case w.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(j){return this.themingParticipants.push(j),this.onThemingParticipantAddedEmitter.fire(j),(0,Ye.OF)(()=>{const $=this.themingParticipants.indexOf(j);this.themingParticipants.splice($,1)})}getThemingParticipants(){return this.themingParticipants}}let M=new T;J.B.add(k.ThemingContribution,M);function O(G){return M.onColorThemeChange(G)}class X extends Ye.JT{constructor(j){super(),this.themeService=j,this.theme=j.getColorTheme(),this._register(this.themeService.onDidColorThemeChange($=>this.onThemeChange($)))}onThemeChange(j){this.theme=j,this.updateStyles()}updateStyles(){}}},16632:function(Ci,Ft,re){"use strict";var ue=re(14809),we=re(20439),Ye=re(4635),me=re(50298),J=re(62646),w=re(92310),Le=re.n(w),P=re(18929),f=re(59301),ne=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],I=(0,f.forwardRef)(function(k,T){var M=k.prefixCls,O=M===void 0?"rc-checkbox":M,X=k.className,G=k.style,j=k.checked,$=k.disabled,N=k.defaultChecked,V=N===void 0?!1:N,fe=k.type,be=fe===void 0?"checkbox":fe,Ae=k.title,se=k.onChange,ke=(0,J.Z)(k,ne),We=(0,f.useRef)(null),ze=(0,f.useRef)(null),Rt=(0,P.Z)(V,{value:j}),te=(0,me.Z)(Rt,2),z=te[0],q=te[1];(0,f.useImperativeHandle)(T,function(){return{focus:function(L){var A;(A=We.current)===null||A===void 0||A.focus(L)},blur:function(){var L;(L=We.current)===null||L===void 0||L.blur()},input:We.current,nativeElement:ze.current}});var Q=Le()(O,X,(0,Ye.Z)((0,Ye.Z)({},"".concat(O,"-checked"),z),"".concat(O,"-disabled"),$)),de=function(L){$||("checked"in k||q(L.target.checked),se==null||se({target:(0,we.Z)((0,we.Z)({},k),{},{type:be,checked:L.target.checked}),stopPropagation:function(){L.stopPropagation()},preventDefault:function(){L.preventDefault()},nativeEvent:L.nativeEvent}))};return f.createElement("span",{className:Q,title:Ae,style:G,ref:ze},f.createElement("input",(0,ue.Z)({},ke,{className:"".concat(O,"-input"),ref:We,onChange:de,disabled:$,checked:!!z,type:be})),f.createElement("span",{className:"".concat(O,"-inner")}))});Ft.Z=I},96478:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return Ae}});var ue=re(14809),we=re(4635),Ye=re(50298),me=re(62646),J=re(65966),w=re(92310),Le=re.n(w),P=re(8654),f=re(59301),ne=re(10228),I=re(16089),k=ne.Z.ESC,T=ne.Z.TAB;function M(se){var ke=se.visible,We=se.triggerRef,ze=se.onVisibleChange,Rt=se.autoFocus,te=se.overlayRef,z=f.useRef(!1),q=function(){if(ke){var L,A;(L=We.current)===null||L===void 0||(A=L.focus)===null||A===void 0||A.call(L),ze==null||ze(!1)}},Q=function(){var L;return(L=te.current)!==null&&L!==void 0&&L.focus?(te.current.focus(),z.current=!0,!0):!1},de=function(L){switch(L.keyCode){case k:q();break;case T:{var A=!1;z.current||(A=Q()),A?L.preventDefault():q();break}}};f.useEffect(function(){return ke?(window.addEventListener("keydown",de),Rt&&(0,I.Z)(Q,3),function(){window.removeEventListener("keydown",de),z.current=!1}):function(){z.current=!1}},[ke])}var O=(0,f.forwardRef)(function(se,ke){var We=se.overlay,ze=se.arrow,Rt=se.prefixCls,te=(0,f.useMemo)(function(){var q;return typeof We=="function"?q=We():q=We,q},[We]),z=(0,P.sQ)(ke,(0,P.C4)(te));return f.createElement(f.Fragment,null,ze&&f.createElement("div",{className:"".concat(Rt,"-arrow")}),f.cloneElement(te,{ref:(0,P.Yr)(te)?z:void 0}))}),X=O,G={adjustX:1,adjustY:1},j=[0,0],$={topLeft:{points:["bl","tl"],overflow:G,offset:[0,-4],targetOffset:j},top:{points:["bc","tc"],overflow:G,offset:[0,-4],targetOffset:j},topRight:{points:["br","tr"],overflow:G,offset:[0,-4],targetOffset:j},bottomLeft:{points:["tl","bl"],overflow:G,offset:[0,4],targetOffset:j},bottom:{points:["tc","bc"],overflow:G,offset:[0,4],targetOffset:j},bottomRight:{points:["tr","br"],overflow:G,offset:[0,4],targetOffset:j}},N=$,V=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function fe(se,ke){var We,ze=se.arrow,Rt=ze===void 0?!1:ze,te=se.prefixCls,z=te===void 0?"rc-dropdown":te,q=se.transitionName,Q=se.animation,de=se.align,ie=se.placement,L=ie===void 0?"bottomLeft":ie,A=se.placements,W=A===void 0?N:A,le=se.getPopupContainer,et=se.showAction,pt=se.hideAction,Kt=se.overlayClassName,Pe=se.overlayStyle,Zt=se.visible,It=se.trigger,bt=It===void 0?["hover"]:It,Oe=se.autoFocus,mt=se.overlay,$e=se.children,jt=se.onVisibleChange,ei=(0,me.Z)(se,V),Ce=f.useState(),Ne=(0,Ye.Z)(Ce,2),pe=Ne[0],Je=Ne[1],ot="visible"in se?Zt:pe,Qe=f.useRef(null),Z=f.useRef(null),ve=f.useRef(null);f.useImperativeHandle(ke,function(){return Qe.current});var Be=function(qt){Je(qt),jt==null||jt(qt)};M({visible:ot,triggerRef:ve,onVisibleChange:Be,autoFocus:Oe,overlayRef:Z});var Ze=function(qt){var Te=se.onOverlayClick;Je(!1),Te&&Te(qt)},lt=function(){return f.createElement(X,{ref:Z,overlay:mt,prefixCls:z,arrow:Rt})},yt=function(){return typeof mt=="function"?lt:lt()},Yt=function(){var qt=se.minOverlayWidthMatchTrigger,Te=se.alignPoint;return"minOverlayWidthMatchTrigger"in se?qt:!Te},gt=function(){var qt=se.openClassName;return qt!==void 0?qt:"".concat(z,"-open")},Se=f.cloneElement($e,{className:Le()((We=$e.props)===null||We===void 0?void 0:We.className,ot&>()),ref:(0,P.Yr)($e)?(0,P.sQ)(ve,(0,P.C4)($e)):void 0}),kt=pt;return!kt&&bt.indexOf("contextMenu")!==-1&&(kt=["click"]),f.createElement(J.Z,(0,ue.Z)({builtinPlacements:W},ei,{prefixCls:z,ref:Qe,popupClassName:Le()(Kt,(0,we.Z)({},"".concat(z,"-show-arrow"),Rt)),popupStyle:Pe,action:bt,showAction:et,hideAction:kt,popupPlacement:L,popupAlign:de,popupTransitionName:q,popupAnimation:Q,popupVisible:ot,stretch:Yt()?"minWidth":"",popup:yt(),onPopupVisibleChange:Be,onPopupClick:Ze,getPopupContainer:le}),Se)}var be=f.forwardRef(fe),Ae=be},20922:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return bt}});var ue=re(14809),we=re(4635),Ye=re(93664),me=re(50298),J=re(62646),w=re(99153),Le=re(84851);function P(){return typeof BigInt=="function"}function f(Oe){return!Oe&&Oe!==0&&!Number.isNaN(Oe)||!String(Oe).trim()}function ne(Oe){var mt=Oe.trim(),$e=mt.startsWith("-");$e&&(mt=mt.slice(1)),mt=mt.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),mt.startsWith(".")&&(mt="0".concat(mt));var jt=mt||"0",ei=jt.split("."),Ce=ei[0]||"0",Ne=ei[1]||"0";Ce==="0"&&Ne==="0"&&($e=!1);var pe=$e?"-":"";return{negative:$e,negativeStr:pe,trimStr:jt,integerStr:Ce,decimalStr:Ne,fullStr:"".concat(pe).concat(jt)}}function I(Oe){var mt=String(Oe);return!Number.isNaN(Number(mt))&&mt.includes("e")}function k(Oe){var mt=String(Oe);if(I(Oe)){var $e=Number(mt.slice(mt.indexOf("e-")+2)),jt=mt.match(/\.(\d+)/);return jt!=null&&jt[1]&&($e+=jt[1].length),$e}return mt.includes(".")&&M(mt)?mt.length-mt.indexOf(".")-1:0}function T(Oe){var mt=String(Oe);if(I(Oe)){if(Oe>Number.MAX_SAFE_INTEGER)return String(P()?BigInt(Oe).toString():Number.MAX_SAFE_INTEGER);if(Oe<Number.MIN_SAFE_INTEGER)return String(P()?BigInt(Oe).toString():Number.MIN_SAFE_INTEGER);mt=Oe.toFixed(k(mt))}return ne(mt).fullStr}function M(Oe){return typeof Oe=="number"?!Number.isNaN(Oe):Oe?/^\s*-?\d+(\.\d+)?\s*$/.test(Oe)||/^\s*-?\d+\.\s*$/.test(Oe)||/^\s*-?\.\d+\s*$/.test(Oe):!1}var O=function(){function Oe(mt){if((0,w.Z)(this,Oe),(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(mt)){this.empty=!0;return}if(this.origin=String(mt),mt==="-"||Number.isNaN(mt)){this.nan=!0;return}var $e=mt;if(I($e)&&($e=Number($e)),$e=typeof $e=="string"?$e:T($e),M($e)){var jt=ne($e);this.negative=jt.negative;var ei=jt.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,Le.Z)(Oe,[{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($e){var jt="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd($e,"0"));return BigInt(jt)}},{key:"negate",value:function(){var $e=new Oe(this.toString());return $e.negative=!$e.negative,$e}},{key:"cal",value:function($e,jt,ei){var Ce=Math.max(this.getDecimalStr().length,$e.getDecimalStr().length),Ne=this.alignDecimal(Ce),pe=$e.alignDecimal(Ce),Je=jt(Ne,pe).toString(),ot=ei(Ce),Qe=ne(Je),Z=Qe.negativeStr,ve=Qe.trimStr,Be="".concat(Z).concat(ve.padStart(ot+1,"0"));return new Oe("".concat(Be.slice(0,-ot),".").concat(Be.slice(-ot)))}},{key:"add",value:function($e){if(this.isInvalidate())return new Oe($e);var jt=new Oe($e);return jt.isInvalidate()?this:this.cal(jt,function(ei,Ce){return ei+Ce},function(ei){return ei})}},{key:"multi",value:function($e){var jt=new Oe($e);return this.isInvalidate()||jt.isInvalidate()?new Oe(NaN):this.cal(jt,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($e){return this.toString()===($e==null?void 0:$e.toString())}},{key:"lessEquals",value:function($e){return this.add($e.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return $e?this.isInvalidate()?"":ne("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),Oe}(),X=function(){function Oe(mt){if((0,w.Z)(this,Oe),(0,we.Z)(this,"origin",""),(0,we.Z)(this,"number",void 0),(0,we.Z)(this,"empty",void 0),f(mt)){this.empty=!0;return}this.origin=String(mt),this.number=Number(mt)}return(0,Le.Z)(Oe,[{key:"negate",value:function(){return new Oe(-this.toNumber())}},{key:"add",value:function($e){if(this.isInvalidate())return new Oe($e);var jt=Number($e);if(Number.isNaN(jt))return this;var ei=this.number+jt;if(ei>Number.MAX_SAFE_INTEGER)return new Oe(Number.MAX_SAFE_INTEGER);if(ei<Number.MIN_SAFE_INTEGER)return new Oe(Number.MIN_SAFE_INTEGER);var Ce=Math.max(k(this.number),k(jt));return new Oe(ei.toFixed(Ce))}},{key:"multi",value:function($e){var jt=Number($e);if(this.isInvalidate()||Number.isNaN(jt))return new Oe(NaN);var ei=this.number*jt;if(ei>Number.MAX_SAFE_INTEGER)return new Oe(Number.MAX_SAFE_INTEGER);if(ei<Number.MIN_SAFE_INTEGER)return new Oe(Number.MIN_SAFE_INTEGER);var Ce=Math.max(k(this.number),k(jt));return new Oe(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($e){return this.toNumber()===($e==null?void 0:$e.toNumber())}},{key:"lessEquals",value:function($e){return this.add($e.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return $e?this.isInvalidate()?"":T(this.number):this.origin}}]),Oe}();function G(Oe){return P()?new O(Oe):new X(Oe)}function j(Oe,mt,$e){var jt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(Oe==="")return"";var ei=ne(Oe),Ce=ei.negativeStr,Ne=ei.integerStr,pe=ei.decimalStr,Je="".concat(mt).concat(pe),ot="".concat(Ce).concat(Ne);if($e>=0){var Qe=Number(pe[$e]);if(Qe>=5&&!jt){var Z=G(Oe).add("".concat(Ce,"0.").concat("0".repeat($e)).concat(10-Qe));return j(Z.toString(),mt,$e,jt)}return $e===0?ot:"".concat(ot).concat(mt).concat(pe.padEnd($e,"0").slice(0,$e))}return Je===".0"?ot:"".concat(ot).concat(Je)}var $=G,N=re(92310),V=re.n(N),fe=re(36901),be=re(34280);function Ae(Oe,mt){return typeof Proxy!="undefined"&&Oe?new Proxy(Oe,{get:function(jt,ei){if(mt[ei])return mt[ei];var Ce=jt[ei];return typeof Ce=="function"?Ce.bind(jt):Ce}}):Oe}var se=re(8654),ke=re(59301),We=re(48736);function ze(Oe,mt){var $e=(0,ke.useRef)(null);function jt(){try{var Ce=Oe.selectionStart,Ne=Oe.selectionEnd,pe=Oe.value,Je=pe.substring(0,Ce),ot=pe.substring(Ne);$e.current={start:Ce,end:Ne,value:pe,beforeTxt:Je,afterTxt:ot}}catch(Qe){}}function ei(){if(Oe&&$e.current&&mt)try{var Ce=Oe.value,Ne=$e.current,pe=Ne.beforeTxt,Je=Ne.afterTxt,ot=Ne.start,Qe=Ce.length;if(Ce.startsWith(pe))Qe=pe.length;else if(Ce.endsWith(Je))Qe=Ce.length-$e.current.afterTxt.length;else{var Z=pe[ot-1],ve=Ce.indexOf(Z,ot-1);ve!==-1&&(Qe=ve+1)}Oe.setSelectionRange(Qe,Qe)}catch(Be){(0,We.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(Be.message))}}return[jt,ei]}var Rt=re(49658),te=function(){var mt=(0,ke.useState)(!1),$e=(0,me.Z)(mt,2),jt=$e[0],ei=$e[1];return(0,be.Z)(function(){ei((0,Rt.Z)())},[]),jt},z=te,q=re(16089),Q=200,de=600;function ie(Oe){var mt=Oe.prefixCls,$e=Oe.upNode,jt=Oe.downNode,ei=Oe.upDisabled,Ce=Oe.downDisabled,Ne=Oe.onStep,pe=ke.useRef(),Je=ke.useRef([]),ot=ke.useRef();ot.current=Ne;var Qe=function(){clearTimeout(pe.current)},Z=function(Se,kt){Se.preventDefault(),Qe(),ot.current(kt);function Nt(){ot.current(kt),pe.current=setTimeout(Nt,Q)}pe.current=setTimeout(Nt,de)};ke.useEffect(function(){return function(){Qe(),Je.current.forEach(function(gt){return q.Z.cancel(gt)})}},[]);var ve=z();if(ve)return null;var Be="".concat(mt,"-handler"),Ze=V()(Be,"".concat(Be,"-up"),(0,we.Z)({},"".concat(Be,"-up-disabled"),ei)),lt=V()(Be,"".concat(Be,"-down"),(0,we.Z)({},"".concat(Be,"-down-disabled"),Ce)),yt=function(){return Je.current.push((0,q.Z)(Qe))},Yt={unselectable:"on",role:"button",onMouseUp:yt,onMouseLeave:yt};return ke.createElement("div",{className:"".concat(Be,"-wrap")},ke.createElement("span",(0,ue.Z)({},Yt,{onMouseDown:function(Se){Z(Se,!0)},"aria-label":"Increase Value","aria-disabled":ei,className:Ze}),$e||ke.createElement("span",{unselectable:"on",className:"".concat(mt,"-handler-up-inner")})),ke.createElement("span",(0,ue.Z)({},Yt,{onMouseDown:function(Se){Z(Se,!1)},"aria-label":"Decrease Value","aria-disabled":Ce,className:lt}),jt||ke.createElement("span",{unselectable:"on",className:"".concat(mt,"-handler-down-inner")})))}function L(Oe){var mt=typeof Oe=="number"?T(Oe):ne(Oe).fullStr,$e=mt.includes(".");return $e?ne(mt.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:Oe+"0"}var A=re(30292),W=function(){var Oe=(0,ke.useRef)(0),mt=function(){q.Z.cancel(Oe.current)};return(0,ke.useEffect)(function(){return mt},[]),function($e){mt(),Oe.current=(0,q.Z)(function(){$e()})}},le=["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"],et=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],pt=function(mt,$e){return mt||$e.isEmpty()?$e.toString():$e.toNumber()},Kt=function(mt){var $e=$(mt);return $e.isInvalidate()?null:$e},Pe=ke.forwardRef(function(Oe,mt){var $e=Oe.prefixCls,jt=Oe.className,ei=Oe.style,Ce=Oe.min,Ne=Oe.max,pe=Oe.step,Je=pe===void 0?1:pe,ot=Oe.defaultValue,Qe=Oe.value,Z=Oe.disabled,ve=Oe.readOnly,Be=Oe.upHandler,Ze=Oe.downHandler,lt=Oe.keyboard,yt=Oe.changeOnWheel,Yt=yt===void 0?!1:yt,gt=Oe.controls,Se=gt===void 0?!0:gt,kt=Oe.classNames,Nt=Oe.stringMode,qt=Oe.parser,Te=Oe.formatter,Re=Oe.precision,st=Oe.decimalSeparator,vt=Oe.onChange,je=Oe.onInput,Dt=Oe.onPressEnter,Ct=Oe.onStep,Et=Oe.changeOnBlur,Ut=Et===void 0?!0:Et,Xt=Oe.domRef,Xe=(0,J.Z)(Oe,le),Vt="".concat($e,"-input"),De=ke.useRef(null),xe=ke.useState(!1),Ee=(0,me.Z)(xe,2),U=Ee[0],H=Ee[1],ae=ke.useRef(!1),ce=ke.useRef(!1),ye=ke.useRef(!1),ct=ke.useState(function(){return $(Qe!=null?Qe:ot)}),_t=(0,me.Z)(ct,2),ut=_t[0],Gt=_t[1];function ni(at){Qe===void 0&&Gt(at)}var di=ke.useCallback(function(at,ft){if(!ft)return Re>=0?Re:Math.max(k(at),k(Je))},[Re,Je]),ti=ke.useCallback(function(at){var ft=String(at);if(qt)return qt(ft);var Pt=ft;return st&&(Pt=Pt.replace(st,".")),Pt.replace(/[^\w.-]+/g,"")},[qt,st]),Tt=ke.useRef(""),ai=ke.useCallback(function(at,ft){if(Te)return Te(at,{userTyping:ft,input:String(Tt.current)});var Pt=typeof at=="number"?T(at):at;if(!ft){var Jt=di(Pt,ft);if(M(Pt)&&(st||Jt>=0)){var hi=st||".";Pt=j(Pt,hi,Jt)}}return Pt},[Te,di,st]),Di=ke.useState(function(){var at=ot!=null?ot:Qe;return ut.isInvalidate()&&["string","number"].includes((0,Ye.Z)(at))?Number.isNaN(at)?"":at:ai(ut.toString(),!1)}),Ti=(0,me.Z)(Di,2),Ii=Ti[0],mi=Ti[1];Tt.current=Ii;function ui(at,ft){mi(ai(at.isInvalidate()?at.toString(!1):at.toString(!ft),ft))}var Wi=ke.useMemo(function(){return Kt(Ne)},[Ne,Re]),Ui=ke.useMemo(function(){return Kt(Ce)},[Ce,Re]),on=ke.useMemo(function(){return!Wi||!ut||ut.isInvalidate()?!1:Wi.lessEquals(ut)},[Wi,ut]),qi=ke.useMemo(function(){return!Ui||!ut||ut.isInvalidate()?!1:ut.lessEquals(Ui)},[Ui,ut]),lr=ze(De.current,U),Li=(0,me.Z)(lr,2),Ni=Li[0],dn=Li[1],Fi=function(ft){return Wi&&!ft.lessEquals(Wi)?Wi:Ui&&!Ui.lessEquals(ft)?Ui:null},vn=function(ft){return!Fi(ft)},an=function(ft,Pt){var Jt=ft,hi=vn(Jt)||Jt.isEmpty();if(!Jt.isEmpty()&&!Pt&&(Jt=Fi(Jt)||Jt,hi=!0),!ve&&!Z&&hi){var Xi=Jt.toString(),li=di(Xi,Pt);return li>=0&&(Jt=$(j(Xi,".",li)),vn(Jt)||(Jt=$(j(Xi,".",li,!0)))),Jt.equals(ut)||(ni(Jt),vt==null||vt(Jt.isEmpty()?null:pt(Nt,Jt)),Qe===void 0&&ui(Jt,Pt)),Jt}return ut},Vi=W(),hn=function at(ft){if(Ni(),Tt.current=ft,mi(ft),!ce.current){var Pt=ti(ft),Jt=$(Pt);Jt.isNaN()||an(Jt,!0)}je==null||je(ft),Vi(function(){var hi=ft;qt||(hi=ft.replace(/。/g,".")),hi!==ft&&at(hi)})},kn=function(){ce.current=!0},Dr=function(){ce.current=!1,hn(De.current.value)},ki=function(ft){hn(ft.target.value)},oi=function(ft){var Pt;if(!(ft&&on||!ft&&qi)){ae.current=!1;var Jt=$(ye.current?L(Je):Je);ft||(Jt=Jt.negate());var hi=(ut||$(0)).add(Jt.toString()),Xi=an(hi,!1);Ct==null||Ct(pt(Nt,Xi),{offset:ye.current?L(Je):Je,type:ft?"up":"down"}),(Pt=De.current)===null||Pt===void 0||Pt.focus()}},Me=function(ft){var Pt=$(ti(Ii)),Jt;Pt.isNaN()?Jt=an(ut,ft):Jt=an(Pt,ft),Qe!==void 0?ui(ut,!1):Jt.isNaN()||ui(Jt,!1)},tt=function(){ae.current=!0},xt=function(ft){var Pt=ft.key,Jt=ft.shiftKey;ae.current=!0,ye.current=Jt,Pt==="Enter"&&(ce.current||(ae.current=!1),Me(!1),Dt==null||Dt(ft)),lt!==!1&&!ce.current&&["Up","ArrowUp","Down","ArrowDown"].includes(Pt)&&(oi(Pt==="Up"||Pt==="ArrowUp"),ft.preventDefault())},ht=function(){ae.current=!1,ye.current=!1};ke.useEffect(function(){if(Yt&&U){var at=function(Jt){oi(Jt.deltaY<0),Jt.preventDefault()},ft=De.current;if(ft)return ft.addEventListener("wheel",at,{passive:!1}),function(){return ft.removeEventListener("wheel",at)}}});var St=function(){Ut&&Me(!1),H(!1),ae.current=!1};return(0,be.o)(function(){ut.isInvalidate()||ui(ut,!1)},[Re,Te]),(0,be.o)(function(){var at=$(Qe);Gt(at);var ft=$(ti(Ii));(!at.equals(ft)||!ae.current||Te)&&ui(at,ae.current)},[Qe]),(0,be.o)(function(){Te&&dn()},[Ii]),ke.createElement("div",{ref:Xt,className:V()($e,jt,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat($e,"-focused"),U),"".concat($e,"-disabled"),Z),"".concat($e,"-readonly"),ve),"".concat($e,"-not-a-number"),ut.isNaN()),"".concat($e,"-out-of-range"),!ut.isInvalidate()&&!vn(ut))),style:ei,onFocus:function(){H(!0)},onBlur:St,onKeyDown:xt,onKeyUp:ht,onCompositionStart:kn,onCompositionEnd:Dr,onBeforeInput:tt},Se&&ke.createElement(ie,{prefixCls:$e,upNode:Be,downNode:Ze,upDisabled:on,downDisabled:qi,onStep:oi}),ke.createElement("div",{className:"".concat(Vt,"-wrap")},ke.createElement("input",(0,ue.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":Ne,"aria-valuenow":ut.isInvalidate()?null:ut.toString(),step:Je},Xe,{ref:(0,se.sQ)(De,mt),className:Vt,value:Ii,onChange:ki,disabled:Z,readOnly:ve}))))}),Zt=ke.forwardRef(function(Oe,mt){var $e=Oe.disabled,jt=Oe.style,ei=Oe.prefixCls,Ce=ei===void 0?"rc-input-number":ei,Ne=Oe.value,pe=Oe.prefix,Je=Oe.suffix,ot=Oe.addonBefore,Qe=Oe.addonAfter,Z=Oe.className,ve=Oe.classNames,Be=(0,J.Z)(Oe,et),Ze=ke.useRef(null),lt=ke.useRef(null),yt=ke.useRef(null),Yt=function(Se){yt.current&&(0,A.nH)(yt.current,Se)};return ke.useImperativeHandle(mt,function(){return Ae(yt.current,{focus:Yt,nativeElement:Ze.current.nativeElement||lt.current})}),ke.createElement(fe.BaseInput,{className:Z,triggerFocus:Yt,prefixCls:Ce,value:Ne,disabled:$e,style:jt,prefix:pe,suffix:Je,addonAfter:Qe,addonBefore:ot,classNames:ve,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:Ze},ke.createElement(Pe,(0,ue.Z)({prefixCls:Ce,disabled:$e,ref:yt,domRef:lt,className:ve==null?void 0:ve.input},Be)))}),It=Zt,bt=It},66003:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return Le}});var ue=re(62646),we=re(20439),Ye=re(93664),me=re(59301),J=["show"];function w(P,f){if(!f.max)return!0;var ne=f.strategy(P);return ne<=f.max}function Le(P,f){return me.useMemo(function(){var ne={};f&&(ne.show=(0,Ye.Z)(f)==="object"&&f.formatter?f.formatter:!!f),ne=(0,we.Z)((0,we.Z)({},ne),P);var I=ne,k=I.show,T=(0,ue.Z)(I,J);return(0,we.Z)((0,we.Z)({},T),{},{show:!!k,showFormatter:typeof k=="function"?k:void 0,strategy:T.strategy||function(M){return M.length}})},[P,f])}},36901:function(Ci,Ft,re){"use strict";re.r(Ft),re.d(Ft,{BaseInput:function(){return ne},default:function(){return N}});var ue=re(20439),we=re(14809),Ye=re(4635),me=re(93664),J=re(92310),w=re.n(J),Le=re(59301),P=re(30292),f=Le.forwardRef(function(V,fe){var be,Ae,se,ke=V.inputElement,We=V.children,ze=V.prefixCls,Rt=V.prefix,te=V.suffix,z=V.addonBefore,q=V.addonAfter,Q=V.className,de=V.style,ie=V.disabled,L=V.readOnly,A=V.focused,W=V.triggerFocus,le=V.allowClear,et=V.value,pt=V.handleReset,Kt=V.hidden,Pe=V.classes,Zt=V.classNames,It=V.dataAttrs,bt=V.styles,Oe=V.components,mt=V.onClear,$e=We!=null?We:ke,jt=(Oe==null?void 0:Oe.affixWrapper)||"span",ei=(Oe==null?void 0:Oe.groupWrapper)||"span",Ce=(Oe==null?void 0:Oe.wrapper)||"span",Ne=(Oe==null?void 0:Oe.groupAddon)||"span",pe=(0,Le.useRef)(null),Je=function(st){var vt;(vt=pe.current)!==null&&vt!==void 0&&vt.contains(st.target)&&(W==null||W())},ot=(0,P.X3)(V),Qe=(0,Le.cloneElement)($e,{value:et,className:w()((be=$e.props)===null||be===void 0?void 0:be.className,!ot&&(Zt==null?void 0:Zt.variant))||null}),Z=(0,Le.useRef)(null);if(Le.useImperativeHandle(fe,function(){return{nativeElement:Z.current||pe.current}}),ot){var ve=null;if(le){var Be=!ie&&!L&&et,Ze="".concat(ze,"-clear-icon"),lt=(0,me.Z)(le)==="object"&&le!==null&&le!==void 0&&le.clearIcon?le.clearIcon:"\u2716";ve=Le.createElement("button",{type:"button",tabIndex:-1,onClick:function(st){pt==null||pt(st),mt==null||mt()},onMouseDown:function(st){return st.preventDefault()},className:w()(Ze,(0,Ye.Z)((0,Ye.Z)({},"".concat(Ze,"-hidden"),!Be),"".concat(Ze,"-has-suffix"),!!te))},lt)}var yt="".concat(ze,"-affix-wrapper"),Yt=w()(yt,(0,Ye.Z)((0,Ye.Z)((0,Ye.Z)((0,Ye.Z)((0,Ye.Z)({},"".concat(ze,"-disabled"),ie),"".concat(yt,"-disabled"),ie),"".concat(yt,"-focused"),A),"".concat(yt,"-readonly"),L),"".concat(yt,"-input-with-clear-btn"),te&&le&&et),Pe==null?void 0:Pe.affixWrapper,Zt==null?void 0:Zt.affixWrapper,Zt==null?void 0:Zt.variant),gt=(te||le)&&Le.createElement("span",{className:w()("".concat(ze,"-suffix"),Zt==null?void 0:Zt.suffix),style:bt==null?void 0:bt.suffix},ve,te);Qe=Le.createElement(jt,(0,we.Z)({className:Yt,style:bt==null?void 0:bt.affixWrapper,onClick:Je},It==null?void 0:It.affixWrapper,{ref:pe}),Rt&&Le.createElement("span",{className:w()("".concat(ze,"-prefix"),Zt==null?void 0:Zt.prefix),style:bt==null?void 0:bt.prefix},Rt),Qe,gt)}if((0,P.He)(V)){var Se="".concat(ze,"-group"),kt="".concat(Se,"-addon"),Nt="".concat(Se,"-wrapper"),qt=w()("".concat(ze,"-wrapper"),Se,Pe==null?void 0:Pe.wrapper,Zt==null?void 0:Zt.wrapper),Te=w()(Nt,(0,Ye.Z)({},"".concat(Nt,"-disabled"),ie),Pe==null?void 0:Pe.group,Zt==null?void 0:Zt.groupWrapper);Qe=Le.createElement(ei,{className:Te,ref:Z},Le.createElement(Ce,{className:qt},z&&Le.createElement(Ne,{className:kt},z),Qe,q&&Le.createElement(Ne,{className:kt},q)))}return Le.cloneElement(Qe,{className:w()((Ae=Qe.props)===null||Ae===void 0?void 0:Ae.className,Q)||null,style:(0,ue.Z)((0,ue.Z)({},(se=Qe.props)===null||se===void 0?void 0:se.style),de),hidden:Kt})}),ne=f,I=re(95190),k=re(50298),T=re(62646),M=re(18929),O=re(2738),X=re(66003),G=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],j=(0,Le.forwardRef)(function(V,fe){var be=V.autoComplete,Ae=V.onChange,se=V.onFocus,ke=V.onBlur,We=V.onPressEnter,ze=V.onKeyDown,Rt=V.onKeyUp,te=V.prefixCls,z=te===void 0?"rc-input":te,q=V.disabled,Q=V.htmlSize,de=V.className,ie=V.maxLength,L=V.suffix,A=V.showCount,W=V.count,le=V.type,et=le===void 0?"text":le,pt=V.classes,Kt=V.classNames,Pe=V.styles,Zt=V.onCompositionStart,It=V.onCompositionEnd,bt=(0,T.Z)(V,G),Oe=(0,Le.useState)(!1),mt=(0,k.Z)(Oe,2),$e=mt[0],jt=mt[1],ei=(0,Le.useRef)(!1),Ce=(0,Le.useRef)(!1),Ne=(0,Le.useRef)(null),pe=(0,Le.useRef)(null),Je=function(Vt){Ne.current&&(0,P.nH)(Ne.current,Vt)},ot=(0,M.Z)(V.defaultValue,{value:V.value}),Qe=(0,k.Z)(ot,2),Z=Qe[0],ve=Qe[1],Be=Z==null?"":String(Z),Ze=(0,Le.useState)(null),lt=(0,k.Z)(Ze,2),yt=lt[0],Yt=lt[1],gt=(0,X.Z)(W,A),Se=gt.max||ie,kt=gt.strategy(Be),Nt=!!Se&&kt>Se;(0,Le.useImperativeHandle)(fe,function(){var Xe;return{focus:Je,blur:function(){var De;(De=Ne.current)===null||De===void 0||De.blur()},setSelectionRange:function(De,xe,Ee){var U;(U=Ne.current)===null||U===void 0||U.setSelectionRange(De,xe,Ee)},select:function(){var De;(De=Ne.current)===null||De===void 0||De.select()},input:Ne.current,nativeElement:((Xe=pe.current)===null||Xe===void 0?void 0:Xe.nativeElement)||Ne.current}}),(0,Le.useEffect)(function(){Ce.current&&(Ce.current=!1),jt(function(Xe){return Xe&&q?!1:Xe})},[q]);var qt=function(Vt,De,xe){var Ee=De;if(!ei.current&>.exceedFormatter&>.max&>.strategy(De)>gt.max){if(Ee=gt.exceedFormatter(De,{max:gt.max}),De!==Ee){var U,H;Yt([((U=Ne.current)===null||U===void 0?void 0:U.selectionStart)||0,((H=Ne.current)===null||H===void 0?void 0:H.selectionEnd)||0])}}else if(xe.source==="compositionEnd")return;ve(Ee),Ne.current&&(0,P.rJ)(Ne.current,Vt,Ae,Ee)};(0,Le.useEffect)(function(){if(yt){var Xe;(Xe=Ne.current)===null||Xe===void 0||Xe.setSelectionRange.apply(Xe,(0,I.Z)(yt))}},[yt]);var Te=function(Vt){qt(Vt,Vt.target.value,{source:"change"})},Re=function(Vt){ei.current=!1,qt(Vt,Vt.currentTarget.value,{source:"compositionEnd"}),It==null||It(Vt)},st=function(Vt){We&&Vt.key==="Enter"&&!Ce.current&&(Ce.current=!0,We(Vt)),ze==null||ze(Vt)},vt=function(Vt){Vt.key==="Enter"&&(Ce.current=!1),Rt==null||Rt(Vt)},je=function(Vt){jt(!0),se==null||se(Vt)},Dt=function(Vt){Ce.current&&(Ce.current=!1),jt(!1),ke==null||ke(Vt)},Ct=function(Vt){ve(""),Je(),Ne.current&&(0,P.rJ)(Ne.current,Vt,Ae)},Et=Nt&&"".concat(z,"-out-of-range"),Ut=function(){var Vt=(0,O.Z)(V,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return Le.createElement("input",(0,we.Z)({autoComplete:be},Vt,{onChange:Te,onFocus:je,onBlur:Dt,onKeyDown:st,onKeyUp:vt,className:w()(z,(0,Ye.Z)({},"".concat(z,"-disabled"),q),Kt==null?void 0:Kt.input),style:Pe==null?void 0:Pe.input,ref:Ne,size:Q,type:et,onCompositionStart:function(xe){ei.current=!0,Zt==null||Zt(xe)},onCompositionEnd:Re}))},Xt=function(){var Vt=Number(Se)>0;if(L||gt.show){var De=gt.showFormatter?gt.showFormatter({value:Be,count:kt,maxLength:Se}):"".concat(kt).concat(Vt?" / ".concat(Se):"");return Le.createElement(Le.Fragment,null,gt.show&&Le.createElement("span",{className:w()("".concat(z,"-show-count-suffix"),(0,Ye.Z)({},"".concat(z,"-show-count-has-suffix"),!!L),Kt==null?void 0:Kt.count),style:(0,ue.Z)({},Pe==null?void 0:Pe.count)},De),L)}return null};return Le.createElement(ne,(0,we.Z)({},bt,{prefixCls:z,className:w()(de,Et),handleReset:Ct,value:Be,focused:$e,triggerFocus:Je,suffix:Xt(),disabled:q,classes:pt,classNames:Kt,styles:Pe}),Ut())}),$=j,N=$},30292:function(Ci,Ft,re){"use strict";re.d(Ft,{He:function(){return ue},X3:function(){return we},nH:function(){return J},rJ:function(){return me}});function ue(w){return!!(w.addonBefore||w.addonAfter)}function we(w){return!!(w.prefix||w.suffix||w.allowClear)}function Ye(w,Le,P){var f=Le.cloneNode(!0),ne=Object.create(w,{target:{value:f},currentTarget:{value:f}});return f.value=P,typeof Le.selectionStart=="number"&&typeof Le.selectionEnd=="number"&&(f.selectionStart=Le.selectionStart,f.selectionEnd=Le.selectionEnd),f.setSelectionRange=function(){Le.setSelectionRange.apply(Le,arguments)},ne}function me(w,Le,P,f){if(P){var ne=Le;if(Le.type==="click"){ne=Ye(Le,w,""),P(ne);return}if(w.type!=="file"&&f!==void 0){ne=Ye(Le,w,f),P(ne);return}P(ne)}}function J(w,Le){if(w){w.focus(Le);var P=Le||{},f=P.cursor;if(f){var ne=w.value.length;switch(f){case"start":w.setSelectionRange(0,0);break;case"end":w.setSelectionRange(ne,ne);break;default:w.setSelectionRange(0,ne)}}}}},28321:function(Ci,Ft,re){"use strict";re.d(Ft,{iz:function(){return qi},ck:function(){return Ee},BW:function(){return dn},sN:function(){return Ee},Wd:function(){return Ui},ZP:function(){return oi},Xl:function(){return We}});var ue=re(14809),we=re(4635),Ye=re(20439),me=re(95190),J=re(50298),w=re(62646),Le=re(92310),P=re.n(Le),f=re(11780),ne=re(18929),I=re(13697),k=re(48736),T=re(59301),M=re(4676),O=T.createContext(null);function X(Me,tt){return Me===void 0?null:"".concat(Me,"-").concat(tt)}function G(Me){var tt=T.useContext(O);return X(tt,Me)}var j=re(80547),$=["children","locked"],N=T.createContext(null);function V(Me,tt){var xt=(0,Ye.Z)({},Me);return Object.keys(tt).forEach(function(ht){var St=tt[ht];St!==void 0&&(xt[ht]=St)}),xt}function fe(Me){var tt=Me.children,xt=Me.locked,ht=(0,w.Z)(Me,$),St=T.useContext(N),at=(0,j.Z)(function(){return V(St,ht)},[St,ht],function(ft,Pt){return!xt&&(ft[0]!==Pt[0]||!(0,I.Z)(ft[1],Pt[1],!0))});return T.createElement(N.Provider,{value:at},tt)}var be=[],Ae=T.createContext(null);function se(){return T.useContext(Ae)}var ke=T.createContext(be);function We(Me){var tt=T.useContext(ke);return T.useMemo(function(){return Me!==void 0?[].concat((0,me.Z)(tt),[Me]):tt},[tt,Me])}var ze=T.createContext(null),Rt=T.createContext({}),te=Rt,z=re(29194);function q(Me){var tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,z.Z)(Me)){var xt=Me.nodeName.toLowerCase(),ht=["input","select","textarea","button"].includes(xt)||Me.isContentEditable||xt==="a"&&!!Me.getAttribute("href"),St=Me.getAttribute("tabindex"),at=Number(St),ft=null;return St&&!Number.isNaN(at)?ft=at:ht&&ft===null&&(ft=0),ht&&Me.disabled&&(ft=null),ft!==null&&(ft>=0||tt&&ft<0)}return!1}function Q(Me){var tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,xt=(0,me.Z)(Me.querySelectorAll("*")).filter(function(ht){return q(ht,tt)});return q(Me,tt)&&xt.unshift(Me),xt}var de=null;function ie(){de=document.activeElement}function L(){de=null}function A(){if(de)try{de.focus()}catch(Me){}}function W(Me,tt){if(tt.keyCode===9){var xt=Q(Me),ht=xt[tt.shiftKey?0:xt.length-1],St=ht===document.activeElement||Me===document.activeElement;if(St){var at=xt[tt.shiftKey?xt.length-1:0];at.focus(),tt.preventDefault()}}}var le=re(10228),et=re(16089),pt=le.Z.LEFT,Kt=le.Z.RIGHT,Pe=le.Z.UP,Zt=le.Z.DOWN,It=le.Z.ENTER,bt=le.Z.ESC,Oe=le.Z.HOME,mt=le.Z.END,$e=[Pe,Zt,pt,Kt];function jt(Me,tt,xt,ht){var St,at="prev",ft="next",Pt="children",Jt="parent";if(Me==="inline"&&ht===It)return{inlineTrigger:!0};var hi=(0,we.Z)((0,we.Z)({},Pe,at),Zt,ft),Xi=(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},pt,xt?ft:at),Kt,xt?at:ft),Zt,Pt),It,Pt),li=(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},Pe,at),Zt,ft),It,Pt),bt,Jt),pt,xt?Pt:Jt),Kt,xt?Jt:Pt),$i={inline:hi,horizontal:Xi,vertical:li,inlineSub:hi,horizontalSub:li,verticalSub:li},Pi=(St=$i["".concat(Me).concat(tt?"":"Sub")])===null||St===void 0?void 0:St[ht];switch(Pi){case at: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(Me){for(var tt=Me;tt;){if(tt.getAttribute("data-menu-list"))return tt;tt=tt.parentElement}return null}function Ce(Me,tt){for(var xt=Me||document.activeElement;xt;){if(tt.has(xt))return xt;xt=xt.parentElement}return null}function Ne(Me,tt){var xt=Q(Me,!0);return xt.filter(function(ht){return tt.has(ht)})}function pe(Me,tt,xt){var ht=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Me)return null;var St=Ne(Me,tt),at=St.length,ft=St.findIndex(function(Pt){return xt===Pt});return ht<0?ft===-1?ft=at-1:ft-=1:ht>0&&(ft+=1),ft=(ft+at)%at,St[ft]}var Je=function(tt,xt){var ht=new Set,St=new Map,at=new Map;return tt.forEach(function(ft){var Pt=document.querySelector("[data-menu-id='".concat(X(xt,ft),"']"));Pt&&(ht.add(Pt),at.set(Pt,ft),St.set(ft,Pt))}),{elements:ht,key2element:St,element2key:at}};function ot(Me,tt,xt,ht,St,at,ft,Pt,Jt,hi){var Xi=T.useRef(),li=T.useRef();li.current=tt;var $i=function(){et.Z.cancel(Xi.current)};return T.useEffect(function(){return function(){$i()}},[]),function(Pi){var ji=Pi.which;if([].concat($e,[It,bt,Oe,mt]).includes(ji)){var Gi=at(),vi=Je(Gi,ht),Oi=vi,nn=Oi.elements,Ki=Oi.key2element,wi=Oi.element2key,rn=Ki.get(tt),Si=Ce(rn,nn),Hi=wi.get(Si),Bn=jt(Me,ft(Hi,!0).length===1,xt,ji);if(!Bn&&ji!==Oe&&ji!==mt)return;($e.includes(ji)||[Oe,mt].includes(ji))&&Pi.preventDefault();var Ji=function($n){if($n){var xr=$n,xn=$n.querySelector("a");xn!=null&&xn.getAttribute("href")&&(xr=xn);var An=wi.get($n);Pt(An),$i(),Xi.current=(0,et.Z)(function(){li.current===An&&xr.focus()})}};if([Oe,mt].includes(ji)||Bn.sibling||!Si){var Yi;!Si||Me==="inline"?Yi=St.current:Yi=ei(Si);var yn,bn=Ne(Yi,nn);ji===Oe?yn=bn[0]:ji===mt?yn=bn[bn.length-1]:yn=pe(Yi,nn,Si,Bn.offset),Ji(yn)}else if(Bn.inlineTrigger)Jt(Hi);else if(Bn.offset>0)Jt(Hi,!0),$i(),Xi.current=(0,et.Z)(function(){vi=Je(Gi,ht);var Ln=Si.getAttribute("aria-controls"),$n=document.getElementById(Ln),xr=pe($n,vi.elements);Ji(xr)},5);else if(Bn.offset<0){var Nn=ft(Hi,!0),Mn=Nn[Nn.length-2],Qi=Ki.get(Mn);Jt(Mn,!1),Ji(Qi)}}hi==null||hi(Pi)}}function Qe(Me){Promise.resolve().then(Me)}var Z="__RC_UTIL_PATH_SPLIT__",ve=function(tt){return tt.join(Z)},Be=function(tt){return tt.split(Z)},Ze="rc-menu-more";function lt(){var Me=T.useState({}),tt=(0,J.Z)(Me,2),xt=tt[1],ht=(0,T.useRef)(new Map),St=(0,T.useRef)(new Map),at=T.useState([]),ft=(0,J.Z)(at,2),Pt=ft[0],Jt=ft[1],hi=(0,T.useRef)(0),Xi=(0,T.useRef)(!1),li=function(){Xi.current||xt({})},$i=(0,T.useCallback)(function(Ki,wi){var rn=ve(wi);St.current.set(rn,Ki),ht.current.set(Ki,rn),hi.current+=1;var Si=hi.current;Qe(function(){Si===hi.current&&li()})},[]),Pi=(0,T.useCallback)(function(Ki,wi){var rn=ve(wi);St.current.delete(rn),ht.current.delete(Ki)},[]),ji=(0,T.useCallback)(function(Ki){Jt(Ki)},[]),Gi=(0,T.useCallback)(function(Ki,wi){var rn=ht.current.get(Ki)||"",Si=Be(rn);return wi&&Pt.includes(Si[0])&&Si.unshift(Ze),Si},[Pt]),vi=(0,T.useCallback)(function(Ki,wi){return Ki.filter(function(rn){return rn!==void 0}).some(function(rn){var Si=Gi(rn,!0);return Si.includes(wi)})},[Gi]),Oi=function(){var wi=(0,me.Z)(ht.current.keys());return Pt.length&&wi.push(Ze),wi},nn=(0,T.useCallback)(function(Ki){var wi="".concat(ht.current.get(Ki)).concat(Z),rn=new Set;return(0,me.Z)(St.current.keys()).forEach(function(Si){Si.startsWith(wi)&&rn.add(St.current.get(Si))}),rn},[]);return T.useEffect(function(){return function(){Xi.current=!0}},[]),{registerPath:$i,unregisterPath:Pi,refreshOverflowKeys:ji,isSubPathKey:vi,getKeyPath:Gi,getKeys:Oi,getSubPathKeys:nn}}function yt(Me){var tt=T.useRef(Me);tt.current=Me;var xt=T.useCallback(function(){for(var ht,St=arguments.length,at=new Array(St),ft=0;ft<St;ft++)at[ft]=arguments[ft];return(ht=tt.current)===null||ht===void 0?void 0:ht.call.apply(ht,[tt].concat(at))},[]);return Me?xt:void 0}var Yt=Math.random().toFixed(5).toString().slice(2),gt=0;function Se(Me){var tt=(0,ne.Z)(Me,{value:Me}),xt=(0,J.Z)(tt,2),ht=xt[0],St=xt[1];return T.useEffect(function(){gt+=1;var at="".concat(Yt,"-").concat(gt);St("rc-menu-uuid-".concat(at))},[]),ht}var kt=re(99153),Nt=re(84851),qt=re(19257),Te=re(93046),Re=re(2738),st=re(8654);function vt(Me,tt,xt,ht){var St=T.useContext(N),at=St.activeKey,ft=St.onActive,Pt=St.onInactive,Jt={active:at===Me};return tt||(Jt.onMouseEnter=function(hi){xt==null||xt({key:Me,domEvent:hi}),ft(Me)},Jt.onMouseLeave=function(hi){ht==null||ht({key:Me,domEvent:hi}),Pt(Me)}),Jt}function je(Me){var tt=T.useContext(N),xt=tt.mode,ht=tt.rtl,St=tt.inlineIndent;if(xt!=="inline")return null;var at=Me;return ht?{paddingRight:at*St}:{paddingLeft:at*St}}function Dt(Me){var tt=Me.icon,xt=Me.props,ht=Me.children,St;return tt===null||tt===!1?null:(typeof tt=="function"?St=T.createElement(tt,(0,Ye.Z)({},xt)):typeof tt!="boolean"&&(St=tt),St||ht||null)}var Ct=["item"];function Et(Me){var tt=Me.item,xt=(0,w.Z)(Me,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."),tt}}),xt}var Ut=["title","attribute","elementRef"],Xt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Xe=["active"],Vt=function(Me){(0,qt.Z)(xt,Me);var tt=(0,Te.Z)(xt);function xt(){return(0,kt.Z)(this,xt),tt.apply(this,arguments)}return(0,Nt.Z)(xt,[{key:"render",value:function(){var St=this.props,at=St.title,ft=St.attribute,Pt=St.elementRef,Jt=(0,w.Z)(St,Ut),hi=(0,Re.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,ue.Z)({},ft,{title:typeof at=="string"?at:void 0},hi,{ref:Pt}))}}]),xt}(T.Component),De=T.forwardRef(function(Me,tt){var xt=Me.style,ht=Me.className,St=Me.eventKey,at=Me.warnKey,ft=Me.disabled,Pt=Me.itemIcon,Jt=Me.children,hi=Me.role,Xi=Me.onMouseEnter,li=Me.onMouseLeave,$i=Me.onClick,Pi=Me.onKeyDown,ji=Me.onFocus,Gi=(0,w.Z)(Me,Xt),vi=G(St),Oi=T.useContext(N),nn=Oi.prefixCls,Ki=Oi.onItemClick,wi=Oi.disabled,rn=Oi.overflowDisabled,Si=Oi.itemIcon,Hi=Oi.selectedKeys,Bn=Oi.onActive,Ji=T.useContext(te),Yi=Ji._internalRenderMenuItem,yn="".concat(nn,"-item"),bn=T.useRef(),Nn=T.useRef(),Mn=wi||ft,Qi=(0,st.x1)(tt,Nn),Ln=We(St),$n=function(Rn){return{key:St,keyPath:(0,me.Z)(Ln).reverse(),item:bn.current,domEvent:Rn}},xr=Pt||Si,xn=vt(St,Mn,Xi,li),An=xn.active,fr=(0,w.Z)(xn,Xe),Er=Hi.includes(St),ur=je(Ln.length),Ir=function(Rn){if(!Mn){var Jn=$n(Rn);$i==null||$i(Et(Jn)),Ki(Jn)}},wn=function(Rn){if(Pi==null||Pi(Rn),Rn.which===le.Z.ENTER){var Jn=$n(Rn);$i==null||$i(Et(Jn)),Ki(Jn)}},Xn=function(Rn){Bn(St),ji==null||ji(Rn)},Cr={};Me.role==="option"&&(Cr["aria-selected"]=Er);var Gn=T.createElement(Vt,(0,ue.Z)({ref:bn,elementRef:Qi,role:hi===null?"none":hi||"menuitem",tabIndex:ft?null:-1,"data-menu-id":rn&&vi?null:vi},(0,Re.Z)(Gi,["extra"]),fr,Cr,{component:"li","aria-disabled":ft,style:(0,Ye.Z)((0,Ye.Z)({},ur),xt),className:P()(yn,(0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(yn,"-active"),An),"".concat(yn,"-selected"),Er),"".concat(yn,"-disabled"),Mn),ht),onClick:Ir,onKeyDown:wn,onFocus:Xn}),Jt,T.createElement(Dt,{props:(0,Ye.Z)((0,Ye.Z)({},Me),{},{isSelected:Er}),icon:xr}));return Yi&&(Gn=Yi(Gn,Me,{selected:Er})),Gn});function xe(Me,tt){var xt=Me.eventKey,ht=se(),St=We(xt);return T.useEffect(function(){if(ht)return ht.registerPath(xt,St),function(){ht.unregisterPath(xt,St)}},[St]),ht?null:T.createElement(De,(0,ue.Z)({},Me,{ref:tt}))}var Ee=T.forwardRef(xe),U=["className","children"],H=function(tt,xt){var ht=tt.className,St=tt.children,at=(0,w.Z)(tt,U),ft=T.useContext(N),Pt=ft.prefixCls,Jt=ft.mode,hi=ft.rtl;return T.createElement("ul",(0,ue.Z)({className:P()(Pt,hi&&"".concat(Pt,"-rtl"),"".concat(Pt,"-sub"),"".concat(Pt,"-").concat(Jt==="inline"?"inline":"vertical"),ht),role:"menu"},at,{"data-menu-list":!0,ref:xt}),St)},ae=T.forwardRef(H);ae.displayName="SubMenuList";var ce=ae,ye=re(11592);function ct(Me,tt){return(0,ye.Z)(Me).map(function(xt,ht){if(T.isValidElement(xt)){var St,at,ft=xt.key,Pt=(St=(at=xt.props)===null||at===void 0?void 0:at.eventKey)!==null&&St!==void 0?St:ft,Jt=Pt==null;Jt&&(Pt="tmp_key-".concat([].concat((0,me.Z)(tt),[ht]).join("-")));var hi={key:Pt,eventKey:Pt};return T.cloneElement(xt,hi)}return xt})}var _t=re(65966),ut={adjustX:1,adjustY:1},Gt={topLeft:{points:["bl","tl"],overflow:ut},topRight:{points:["br","tr"],overflow:ut},bottomLeft:{points:["tl","bl"],overflow:ut},bottomRight:{points:["tr","br"],overflow:ut},leftTop:{points:["tr","tl"],overflow:ut},leftBottom:{points:["br","bl"],overflow:ut},rightTop:{points:["tl","tr"],overflow:ut},rightBottom:{points:["bl","br"],overflow:ut}},ni={topLeft:{points:["bl","tl"],overflow:ut},topRight:{points:["br","tr"],overflow:ut},bottomLeft:{points:["tl","bl"],overflow:ut},bottomRight:{points:["tr","br"],overflow:ut},rightTop:{points:["tr","tl"],overflow:ut},rightBottom:{points:["br","bl"],overflow:ut},leftTop:{points:["tl","tr"],overflow:ut},leftBottom:{points:["bl","br"],overflow:ut}},di=null;function ti(Me,tt,xt){if(tt)return tt;if(xt)return xt[Me]||xt.other}var Tt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function ai(Me){var tt=Me.prefixCls,xt=Me.visible,ht=Me.children,St=Me.popup,at=Me.popupStyle,ft=Me.popupClassName,Pt=Me.popupOffset,Jt=Me.disabled,hi=Me.mode,Xi=Me.onVisibleChange,li=T.useContext(N),$i=li.getPopupContainer,Pi=li.rtl,ji=li.subMenuOpenDelay,Gi=li.subMenuCloseDelay,vi=li.builtinPlacements,Oi=li.triggerSubMenuAction,nn=li.forceSubMenuRender,Ki=li.rootClassName,wi=li.motion,rn=li.defaultMotions,Si=T.useState(!1),Hi=(0,J.Z)(Si,2),Bn=Hi[0],Ji=Hi[1],Yi=Pi?(0,Ye.Z)((0,Ye.Z)({},ni),vi):(0,Ye.Z)((0,Ye.Z)({},Gt),vi),yn=Tt[hi],bn=ti(hi,wi,rn),Nn=T.useRef(bn);hi!=="inline"&&(Nn.current=bn);var Mn=(0,Ye.Z)((0,Ye.Z)({},Nn.current),{},{leavedClassName:"".concat(tt,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Qi=T.useRef();return T.useEffect(function(){return Qi.current=(0,et.Z)(function(){Ji(xt)}),function(){et.Z.cancel(Qi.current)}},[xt]),T.createElement(_t.Z,{prefixCls:tt,popupClassName:P()("".concat(tt,"-popup"),(0,we.Z)({},"".concat(tt,"-rtl"),Pi),ft,Ki),stretch:hi==="horizontal"?"minWidth":null,getPopupContainer:$i,builtinPlacements:Yi,popupPlacement:yn,popupVisible:Bn,popup:St,popupStyle:at,popupAlign:Pt&&{offset:Pt},action:Jt?[]:[Oi],mouseEnterDelay:ji,mouseLeaveDelay:Gi,onPopupVisibleChange:Xi,forceRender:nn,popupMotion:Mn,fresh:!0},ht)}var Di=re(77900);function Ti(Me){var tt=Me.id,xt=Me.open,ht=Me.keyPath,St=Me.children,at="inline",ft=T.useContext(N),Pt=ft.prefixCls,Jt=ft.forceSubMenuRender,hi=ft.motion,Xi=ft.defaultMotions,li=ft.mode,$i=T.useRef(!1);$i.current=li===at;var Pi=T.useState(!$i.current),ji=(0,J.Z)(Pi,2),Gi=ji[0],vi=ji[1],Oi=$i.current?xt:!1;T.useEffect(function(){$i.current&&vi(!1)},[li]);var nn=(0,Ye.Z)({},ti(at,hi,Xi));ht.length>1&&(nn.motionAppear=!1);var Ki=nn.onVisibleChanged;return nn.onVisibleChanged=function(wi){return!$i.current&&!wi&&vi(!0),Ki==null?void 0:Ki(wi)},Gi?null:T.createElement(fe,{mode:at,locked:!$i.current},T.createElement(Di.default,(0,ue.Z)({visible:Oi},nn,{forceRender:Jt,removeOnLeave:!1,leavedClassName:"".concat(Pt,"-hidden")}),function(wi){var rn=wi.className,Si=wi.style;return T.createElement(ce,{id:tt,className:rn,style:Si},St)}))}var Ii=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],mi=["active"],ui=T.forwardRef(function(Me,tt){var xt=Me.style,ht=Me.className,St=Me.title,at=Me.eventKey,ft=Me.warnKey,Pt=Me.disabled,Jt=Me.internalPopupClose,hi=Me.children,Xi=Me.itemIcon,li=Me.expandIcon,$i=Me.popupClassName,Pi=Me.popupOffset,ji=Me.popupStyle,Gi=Me.onClick,vi=Me.onMouseEnter,Oi=Me.onMouseLeave,nn=Me.onTitleClick,Ki=Me.onTitleMouseEnter,wi=Me.onTitleMouseLeave,rn=(0,w.Z)(Me,Ii),Si=G(at),Hi=T.useContext(N),Bn=Hi.prefixCls,Ji=Hi.mode,Yi=Hi.openKeys,yn=Hi.disabled,bn=Hi.overflowDisabled,Nn=Hi.activeKey,Mn=Hi.selectedKeys,Qi=Hi.itemIcon,Ln=Hi.expandIcon,$n=Hi.onItemClick,xr=Hi.onOpenChange,xn=Hi.onActive,An=T.useContext(te),fr=An._internalRenderSubMenuItem,Er=T.useContext(ze),ur=Er.isSubPathKey,Ir=We(),wn="".concat(Bn,"-submenu"),Xn=yn||Pt,Cr=T.useRef(),Gn=T.useRef(),pr=Xi!=null?Xi:Qi,Rn=li!=null?li:Ln,Jn=Yi.includes(at),mr=!bn&&Jn,Ai=ur(Mn,at),Tn=vt(at,Xn,Ki,wi),cr=Tn.active,gr=(0,w.Z)(Tn,mi),hr=T.useState(!1),Jr=(0,J.Z)(hr,2),en=Jr[0],bi=Jr[1],xi=function(pn){Xn||bi(pn)},Sn=function(pn){xi(!0),vi==null||vi({key:at,domEvent:pn})},_r=function(pn){xi(!1),Oi==null||Oi({key:at,domEvent:pn})},Wn=T.useMemo(function(){return cr||(Ji!=="inline"?en||ur([Nn],at):!1)},[Ji,cr,Nn,en,at,ur]),tr=je(Ir.length),Kn=function(pn){Xn||(nn==null||nn({key:at,domEvent:pn}),Ji==="inline"&&xr(at,!Jn))},us=yt(function(Mi){Gi==null||Gi(Et(Mi)),$n(Mi)}),ir=function(pn){Ji!=="inline"&&xr(at,pn)},Qr=function(){xn(at)},Wr=Si&&"".concat(Si,"-popup"),Kr=T.useMemo(function(){return T.createElement(Dt,{icon:Ji!=="horizontal"?Rn:void 0,props:(0,Ye.Z)((0,Ye.Z)({},Me),{},{isOpen:mr,isSubMenu:!0})},T.createElement("i",{className:"".concat(wn,"-arrow")}))},[Ji,Rn,Me,mr,wn]),nr=T.createElement("div",(0,ue.Z)({role:"menuitem",style:tr,className:"".concat(wn,"-title"),tabIndex:Xn?null:-1,ref:Cr,title:typeof St=="string"?St:null,"data-menu-id":bn&&Si?null:Si,"aria-expanded":mr,"aria-haspopup":!0,"aria-controls":Wr,"aria-disabled":Xn,onClick:Kn,onFocus:Qr},gr),St,Kr),jr=T.useRef(Ji);if(Ji!=="inline"&&Ir.length>1?jr.current="vertical":jr.current=Ji,!bn){var ms=jr.current;nr=T.createElement(ai,{mode:ms,prefixCls:wn,visible:!Jt&&mr&&Ji!=="inline",popupClassName:$i,popupOffset:Pi,popupStyle:ji,popup:T.createElement(fe,{mode:ms==="horizontal"?"vertical":ms},T.createElement(ce,{id:Wr,ref:Gn},hi)),disabled:Xn,onVisibleChange:ir},nr)}var rr=T.createElement(f.Z.Item,(0,ue.Z)({ref:tt,role:"none"},rn,{component:"li",style:xt,className:P()(wn,"".concat(wn,"-").concat(Ji),ht,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(wn,"-open"),mr),"".concat(wn,"-active"),Wn),"".concat(wn,"-selected"),Ai),"".concat(wn,"-disabled"),Xn)),onMouseEnter:Sn,onMouseLeave:_r}),nr,!bn&&T.createElement(Ti,{id:Wr,open:mr,keyPath:Ir},hi));return fr&&(rr=fr(rr,Me,{selected:Ai,active:Wn,open:mr,disabled:Xn})),T.createElement(fe,{onItemClick:us,mode:Ji==="horizontal"?"vertical":Ji,itemIcon:pr,expandIcon:Rn},rr)}),Wi=T.forwardRef(function(Me,tt){var xt=Me.eventKey,ht=Me.children,St=We(xt),at=ct(ht,St),ft=se();T.useEffect(function(){if(ft)return ft.registerPath(xt,St),function(){ft.unregisterPath(xt,St)}},[St]);var Pt;return ft?Pt=at:Pt=T.createElement(ui,(0,ue.Z)({ref:tt},Me),at),T.createElement(ke.Provider,{value:St},Pt)}),Ui=Wi,on=re(93664);function qi(Me){var tt=Me.className,xt=Me.style,ht=T.useContext(N),St=ht.prefixCls,at=se();return at?null:T.createElement("li",{role:"separator",className:P()("".concat(St,"-item-divider"),tt),style:xt})}var lr=["className","title","eventKey","children"],Li=T.forwardRef(function(Me,tt){var xt=Me.className,ht=Me.title,St=Me.eventKey,at=Me.children,ft=(0,w.Z)(Me,lr),Pt=T.useContext(N),Jt=Pt.prefixCls,hi="".concat(Jt,"-item-group");return T.createElement("li",(0,ue.Z)({ref:tt,role:"presentation"},ft,{onClick:function(li){return li.stopPropagation()},className:P()(hi,xt)}),T.createElement("div",{role:"presentation",className:"".concat(hi,"-title"),title:typeof ht=="string"?ht:void 0},ht),T.createElement("ul",{role:"group",className:"".concat(hi,"-list")},at))}),Ni=T.forwardRef(function(Me,tt){var xt=Me.eventKey,ht=Me.children,St=We(xt),at=ct(ht,St),ft=se();return ft?at:T.createElement(Li,(0,ue.Z)({ref:tt},(0,Re.Z)(Me,["warnKey"])),at)}),dn=Ni,Fi=["label","children","key","type","extra"];function vn(Me,tt,xt){var ht=tt.item,St=tt.group,at=tt.submenu,ft=tt.divider;return(Me||[]).map(function(Pt,Jt){if(Pt&&(0,on.Z)(Pt)==="object"){var hi=Pt,Xi=hi.label,li=hi.children,$i=hi.key,Pi=hi.type,ji=hi.extra,Gi=(0,w.Z)(hi,Fi),vi=$i!=null?$i:"tmp-".concat(Jt);return li||Pi==="group"?Pi==="group"?T.createElement(St,(0,ue.Z)({key:vi},Gi,{title:Xi}),vn(li,tt,xt)):T.createElement(at,(0,ue.Z)({key:vi},Gi,{title:Xi}),vn(li,tt,xt)):Pi==="divider"?T.createElement(ft,(0,ue.Z)({key:vi},Gi)):T.createElement(ht,(0,ue.Z)({key:vi},Gi,{extra:ji}),Xi,(!!ji||ji===0)&&T.createElement("span",{className:"".concat(xt,"-item-extra")},ji))}return null}).filter(function(Pt){return Pt})}function an(Me,tt,xt,ht,St){var at=Me,ft=(0,Ye.Z)({divider:qi,item:Ee,group:dn,submenu:Ui},ht);return tt&&(at=vn(tt,ft,St)),ct(at,xt)}var Vi=["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"],hn=[],kn=T.forwardRef(function(Me,tt){var xt,ht=Me,St=ht.prefixCls,at=St===void 0?"rc-menu":St,ft=ht.rootClassName,Pt=ht.style,Jt=ht.className,hi=ht.tabIndex,Xi=hi===void 0?0:hi,li=ht.items,$i=ht.children,Pi=ht.direction,ji=ht.id,Gi=ht.mode,vi=Gi===void 0?"vertical":Gi,Oi=ht.inlineCollapsed,nn=ht.disabled,Ki=ht.disabledOverflow,wi=ht.subMenuOpenDelay,rn=wi===void 0?.1:wi,Si=ht.subMenuCloseDelay,Hi=Si===void 0?.1:Si,Bn=ht.forceSubMenuRender,Ji=ht.defaultOpenKeys,Yi=ht.openKeys,yn=ht.activeKey,bn=ht.defaultActiveFirst,Nn=ht.selectable,Mn=Nn===void 0?!0:Nn,Qi=ht.multiple,Ln=Qi===void 0?!1:Qi,$n=ht.defaultSelectedKeys,xr=ht.selectedKeys,xn=ht.onSelect,An=ht.onDeselect,fr=ht.inlineIndent,Er=fr===void 0?24:fr,ur=ht.motion,Ir=ht.defaultMotions,wn=ht.triggerSubMenuAction,Xn=wn===void 0?"hover":wn,Cr=ht.builtinPlacements,Gn=ht.itemIcon,pr=ht.expandIcon,Rn=ht.overflowedIndicator,Jn=Rn===void 0?"...":Rn,mr=ht.overflowedIndicatorPopupClassName,Ai=ht.getPopupContainer,Tn=ht.onClick,cr=ht.onOpenChange,gr=ht.onKeyDown,hr=ht.openAnimation,Jr=ht.openTransitionName,en=ht._internalRenderMenuItem,bi=ht._internalRenderSubMenuItem,xi=ht._internalComponents,Sn=(0,w.Z)(ht,Vi),_r=T.useMemo(function(){return[an($i,li,hn,xi,at),an($i,li,hn,{},at)]},[$i,li,xi]),Wn=(0,J.Z)(_r,2),tr=Wn[0],Kn=Wn[1],us=T.useState(!1),ir=(0,J.Z)(us,2),Qr=ir[0],Wr=ir[1],Kr=T.useRef(),nr=Se(ji),jr=Pi==="rtl",ms=(0,ne.Z)(Ji,{value:Yi,postState:function(rt){return rt||hn}}),rr=(0,J.Z)(ms,2),Mi=rr[0],pn=rr[1],sr=function(rt){var Pn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Ur(){pn(rt),cr==null||cr(rt)}Pn?(0,M.flushSync)(Ur):Ur()},es=T.useState(Mi),cs=(0,J.Z)(es,2),xs=cs[0],ws=cs[1],Ms=T.useRef(!1),fi=T.useMemo(function(){return(vi==="inline"||vi==="vertical")&&Oi?["vertical",Oi]:[vi,!1]},[vi,Oi]),Bi=(0,J.Z)(fi,2),Dn=Bi[0],Un=Bi[1],In=Dn==="inline",kr=T.useState(Dn),gs=(0,J.Z)(kr,2),ar=gs[0],ts=gs[1],na=T.useState(Un),Ks=(0,J.Z)(na,2),Xl=Ks[0],qr=Ks[1];T.useEffect(function(){ts(Dn),qr(Un),Ms.current&&(In?pn(xs):sr(hn))},[Dn,Un]);var Ss=T.useState(0),Wa=(0,J.Z)(Ss,2),Qn=Wa[0],ra=Wa[1],ka=Qn>=tr.length-1||ar!=="horizontal"||Ki;T.useEffect(function(){In&&ws(Mi)},[Mi]),T.useEffect(function(){return Ms.current=!0,function(){Ms.current=!1}},[]);var hs=lt(),Xo=hs.registerPath,ja=hs.unregisterPath,is=hs.refreshOverflowKeys,Eo=hs.isSubPathKey,Es=hs.getKeyPath,ko=hs.getKeys,Ao=hs.getSubPathKeys,Jo=T.useMemo(function(){return{registerPath:Xo,unregisterPath:ja}},[Xo,ja]),Qo=T.useMemo(function(){return{isSubPathKey:Eo}},[Eo]);T.useEffect(function(){is(ka?hn:tr.slice(Qn+1).map(function(jn){return jn.key}))},[Qn,ka]);var qa=(0,ne.Z)(yn||bn&&((xt=tr[0])===null||xt===void 0?void 0:xt.key),{value:yn}),el=(0,J.Z)(qa,2),Rs=el[0],Za=el[1],To=yt(function(jn){Za(jn)}),Ya=yt(function(){Za(void 0)});(0,T.useImperativeHandle)(tt,function(){return{list:Kr.current,focus:function(rt){var Pn,Ur=ko(),zr=Je(Ur,nr),Qa=zr.elements,Vs=zr.key2element,Aa=zr.element2key,sl=Ne(Kr.current,Qa),al=Rs!=null?Rs:sl[0]?Aa.get(sl[0]):(Pn=tr.find(function(aa){return!aa.props.disabled}))===null||Pn===void 0?void 0:Pn.key,Gs=Vs.get(al);if(al&&Gs){var Hs;Gs==null||(Hs=Gs.focus)===null||Hs===void 0||Hs.call(Gs,rt)}}}});var tl=(0,ne.Z)($n||[],{value:xr,postState:function(rt){return Array.isArray(rt)?rt:rt==null?hn:[rt]}}),Lo=(0,J.Z)(tl,2),sa=Lo[0],il=Lo[1],Us=function(rt){if(Mn){var Pn=rt.key,Ur=sa.includes(Pn),zr;Ln?Ur?zr=sa.filter(function(Vs){return Vs!==Pn}):zr=[].concat((0,me.Z)(sa),[Pn]):zr=[Pn],il(zr);var Qa=(0,Ye.Z)((0,Ye.Z)({},rt),{},{selectedKeys:zr});Ur?An==null||An(Qa):xn==null||xn(Qa)}!Ln&&Mi.length&&ar!=="inline"&&sr(hn)},zs=yt(function(jn){Tn==null||Tn(Et(jn)),Us(jn)}),nl=yt(function(jn,rt){var Pn=Mi.filter(function(zr){return zr!==jn});if(rt)Pn.push(jn);else if(ar!=="inline"){var Ur=Ao(jn);Pn=Pn.filter(function(zr){return!Ur.has(zr)})}(0,I.Z)(Mi,Pn,!0)||sr(Pn,!0)}),rl=function(rt,Pn){var Ur=Pn!=null?Pn:!Mi.includes(rt);nl(rt,Ur)},Is=ot(ar,Rs,jr,nr,Kr,ko,Es,Za,rl,gr);T.useEffect(function(){Wr(!0)},[]);var Do=T.useMemo(function(){return{_internalRenderMenuItem:en,_internalRenderSubMenuItem:bi}},[en,bi]),Xa=ar!=="horizontal"||Ki?tr:tr.map(function(jn,rt){return T.createElement(fe,{key:jn.key,overflowDisabled:rt>Qn},jn)}),Ja=T.createElement(f.Z,(0,ue.Z)({id:ji,ref:Kr,prefixCls:"".concat(at,"-overflow"),component:"ul",itemComponent:Ee,className:P()(at,"".concat(at,"-root"),"".concat(at,"-").concat(ar),Jt,(0,we.Z)((0,we.Z)({},"".concat(at,"-inline-collapsed"),Xl),"".concat(at,"-rtl"),jr),ft),dir:Pi,style:Pt,role:"menu",tabIndex:Xi,data:Xa,renderRawItem:function(rt){return rt},renderRawRest:function(rt){var Pn=rt.length,Ur=Pn?tr.slice(-Pn):null;return T.createElement(Ui,{eventKey:Ze,title:Jn,disabled:ka,internalPopupClose:Pn===0,popupClassName:mr},Ur)},maxCount:ar!=="horizontal"||Ki?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(rt){ra(rt)},onKeyDown:Is},Sn));return T.createElement(te.Provider,{value:Do},T.createElement(O.Provider,{value:nr},T.createElement(fe,{prefixCls:at,rootClassName:ft,mode:ar,openKeys:Mi,rtl:jr,disabled:nn,motion:Qr?ur:null,defaultMotions:Qr?Ir:null,activeKey:Rs,onActive:To,onInactive:Ya,selectedKeys:sa,inlineIndent:Er,subMenuOpenDelay:rn,subMenuCloseDelay:Hi,forceSubMenuRender:Bn,builtinPlacements:Cr,triggerSubMenuAction:Xn,getPopupContainer:Ai,itemIcon:Gn,expandIcon:pr,onItemClick:zs,onOpenChange:nl},T.createElement(ze.Provider,{value:Qo},Ja),T.createElement("div",{style:{display:"none"},"aria-hidden":!0},T.createElement(Ae.Provider,{value:Jo},Kn)))))}),Dr=kn,ki=Dr;ki.Item=Ee,ki.SubMenu=Ui,ki.ItemGroup=dn,ki.Divider=qi;var oi=ki},11780:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return ie}});var ue=re(14809),we=re(20439),Ye=re(50298),me=re(62646),J=re(59301),w=re(92310),Le=re.n(w),P=re(29301),f=re(34280),ne=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],I=void 0;function k(L,A){var W=L.prefixCls,le=L.invalidate,et=L.item,pt=L.renderItem,Kt=L.responsive,Pe=L.responsiveDisabled,Zt=L.registerSize,It=L.itemKey,bt=L.className,Oe=L.style,mt=L.children,$e=L.display,jt=L.order,ei=L.component,Ce=ei===void 0?"div":ei,Ne=(0,me.Z)(L,ne),pe=Kt&&!$e;function Je(Be){Zt(It,Be)}J.useEffect(function(){return function(){Je(null)}},[]);var ot=pt&&et!==I?pt(et,{index:jt}):mt,Qe;le||(Qe={opacity:pe?0:1,height:pe?0:I,overflowY:pe?"hidden":I,order:Kt?jt:I,pointerEvents:pe?"none":I,position:pe?"absolute":I});var Z={};pe&&(Z["aria-hidden"]=!0);var ve=J.createElement(Ce,(0,ue.Z)({className:Le()(!le&&W,bt),style:(0,we.Z)((0,we.Z)({},Qe),Oe)},Z,Ne,{ref:A}),ot);return Kt&&(ve=J.createElement(P.Z,{onResize:function(Ze){var lt=Ze.offsetWidth;Je(lt)},disabled:Pe},ve)),ve}var T=J.forwardRef(k);T.displayName="Item";var M=T,O=re(6089),X=re(4676),G=re(16089);function j(L){if(typeof MessageChannel=="undefined")(0,G.Z)(L);else{var A=new MessageChannel;A.port1.onmessage=function(){return L()},A.port2.postMessage(void 0)}}function $(){var L=J.useRef(null),A=function(le){L.current||(L.current=[],j(function(){(0,X.unstable_batchedUpdates)(function(){L.current.forEach(function(et){et()}),L.current=null})})),L.current.push(le)};return A}function N(L,A){var W=J.useState(A),le=(0,Ye.Z)(W,2),et=le[0],pt=le[1],Kt=(0,O.Z)(function(Pe){L(function(){pt(Pe)})});return[et,Kt]}var V=J.createContext(null),fe=["component"],be=["className"],Ae=["className"],se=function(A,W){var le=J.useContext(V);if(!le){var et=A.component,pt=et===void 0?"div":et,Kt=(0,me.Z)(A,fe);return J.createElement(pt,(0,ue.Z)({},Kt,{ref:W}))}var Pe=le.className,Zt=(0,me.Z)(le,be),It=A.className,bt=(0,me.Z)(A,Ae);return J.createElement(V.Provider,{value:null},J.createElement(M,(0,ue.Z)({ref:W,className:Le()(Pe,It)},Zt,bt)))},ke=J.forwardRef(se);ke.displayName="RawItem";var We=ke,ze=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Rt="responsive",te="invalidate";function z(L){return"+ ".concat(L.length," ...")}function q(L,A){var W=L.prefixCls,le=W===void 0?"rc-overflow":W,et=L.data,pt=et===void 0?[]:et,Kt=L.renderItem,Pe=L.renderRawItem,Zt=L.itemKey,It=L.itemWidth,bt=It===void 0?10:It,Oe=L.ssr,mt=L.style,$e=L.className,jt=L.maxCount,ei=L.renderRest,Ce=L.renderRawRest,Ne=L.suffix,pe=L.component,Je=pe===void 0?"div":pe,ot=L.itemComponent,Qe=L.onVisibleChange,Z=(0,me.Z)(L,ze),ve=Oe==="full",Be=$(),Ze=N(Be,null),lt=(0,Ye.Z)(Ze,2),yt=lt[0],Yt=lt[1],gt=yt||0,Se=N(Be,new Map),kt=(0,Ye.Z)(Se,2),Nt=kt[0],qt=kt[1],Te=N(Be,0),Re=(0,Ye.Z)(Te,2),st=Re[0],vt=Re[1],je=N(Be,0),Dt=(0,Ye.Z)(je,2),Ct=Dt[0],Et=Dt[1],Ut=N(Be,0),Xt=(0,Ye.Z)(Ut,2),Xe=Xt[0],Vt=Xt[1],De=(0,J.useState)(null),xe=(0,Ye.Z)(De,2),Ee=xe[0],U=xe[1],H=(0,J.useState)(null),ae=(0,Ye.Z)(H,2),ce=ae[0],ye=ae[1],ct=J.useMemo(function(){return ce===null&&ve?Number.MAX_SAFE_INTEGER:ce||0},[ce,yt]),_t=(0,J.useState)(!1),ut=(0,Ye.Z)(_t,2),Gt=ut[0],ni=ut[1],di="".concat(le,"-item"),ti=Math.max(st,Ct),Tt=jt===Rt,ai=pt.length&&Tt,Di=jt===te,Ti=ai||typeof jt=="number"&&pt.length>jt,Ii=(0,J.useMemo)(function(){var ki=pt;return ai?yt===null&&ve?ki=pt:ki=pt.slice(0,Math.min(pt.length,gt/bt)):typeof jt=="number"&&(ki=pt.slice(0,jt)),ki},[pt,bt,yt,jt,ai]),mi=(0,J.useMemo)(function(){return ai?pt.slice(ct+1):pt.slice(Ii.length)},[pt,Ii,ai,ct]),ui=(0,J.useCallback)(function(ki,oi){var Me;return typeof Zt=="function"?Zt(ki):(Me=Zt&&(ki==null?void 0:ki[Zt]))!==null&&Me!==void 0?Me:oi},[Zt]),Wi=(0,J.useCallback)(Kt||function(ki){return ki},[Kt]);function Ui(ki,oi,Me){ce===ki&&(oi===void 0||oi===Ee)||(ye(ki),Me||(ni(ki<pt.length-1),Qe==null||Qe(ki)),oi!==void 0&&U(oi))}function on(ki,oi){Yt(oi.clientWidth)}function qi(ki,oi){qt(function(Me){var tt=new Map(Me);return oi===null?tt.delete(ki):tt.set(ki,oi),tt})}function lr(ki,oi){Et(oi),vt(Ct)}function Li(ki,oi){Vt(oi)}function Ni(ki){return Nt.get(ui(Ii[ki],ki))}(0,f.Z)(function(){if(gt&&typeof ti=="number"&&Ii){var ki=Xe,oi=Ii.length,Me=oi-1;if(!oi){Ui(0,null);return}for(var tt=0;tt<oi;tt+=1){var xt=Ni(tt);if(ve&&(xt=xt||0),xt===void 0){Ui(tt-1,void 0,!0);break}if(ki+=xt,Me===0&&ki<=gt||tt===Me-1&&ki+Ni(Me)<=gt){Ui(Me,null);break}else if(ki+ti>gt){Ui(tt-1,ki-xt-Xe+Ct);break}}Ne&&Ni(0)+Xe>gt&&U(null)}},[gt,Nt,Ct,Xe,ui,Ii]);var dn=Gt&&!!mi.length,Fi={};Ee!==null&&ai&&(Fi={position:"absolute",left:Ee,top:0});var vn={prefixCls:di,responsive:ai,component:ot,invalidate:Di},an=Pe?function(ki,oi){var Me=ui(ki,oi);return J.createElement(V.Provider,{key:Me,value:(0,we.Z)((0,we.Z)({},vn),{},{order:oi,item:ki,itemKey:Me,registerSize:qi,display:oi<=ct})},Pe(ki,oi))}:function(ki,oi){var Me=ui(ki,oi);return J.createElement(M,(0,ue.Z)({},vn,{order:oi,key:Me,item:ki,renderItem:Wi,itemKey:Me,registerSize:qi,display:oi<=ct}))},Vi={order:dn?ct:Number.MAX_SAFE_INTEGER,className:"".concat(di,"-rest"),registerSize:lr,display:dn},hn=ei||z,kn=Ce?J.createElement(V.Provider,{value:(0,we.Z)((0,we.Z)({},vn),Vi)},Ce(mi)):J.createElement(M,(0,ue.Z)({},vn,Vi),typeof hn=="function"?hn(mi):hn),Dr=J.createElement(Je,(0,ue.Z)({className:Le()(!Di&&le,$e),style:mt,ref:A},Z),Ii.map(an),Ti?kn:null,Ne&&J.createElement(M,(0,ue.Z)({},vn,{responsive:Tt,responsiveDisabled:!ai,order:ct,className:"".concat(di,"-suffix"),registerSize:Li,display:!0,style:Fi}),Ne));return Tt?J.createElement(P.Z,{onResize:on,disabled:!ai},Dr):Dr}var Q=J.forwardRef(q);Q.displayName="Overflow",Q.Item=We,Q.RESPONSIVE=Rt,Q.INVALIDATE=te;var de=Q,ie=de},29301:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return te}});var ue=re(14809),we=re(59301),Ye=re(11592),me=re(48736),J=re(20439),w=re(93664),Le=re(76846),P=re(8654),f=we.createContext(null);function ne(z){var q=z.children,Q=z.onBatchResize,de=we.useRef(0),ie=we.useRef([]),L=we.useContext(f),A=we.useCallback(function(W,le,et){de.current+=1;var pt=de.current;ie.current.push({size:W,element:le,data:et}),Promise.resolve().then(function(){pt===de.current&&(Q==null||Q(ie.current),ie.current=[])}),L==null||L(W,le,et)},[Q,L]);return we.createElement(f.Provider,{value:A},q)}var I=re(76374),k=new Map;function T(z){z.forEach(function(q){var Q,de=q.target;(Q=k.get(de))===null||Q===void 0||Q.forEach(function(ie){return ie(de)})})}var M=new I.Z(T),O=null,X=null;function G(z,q){k.has(z)||(k.set(z,new Set),M.observe(z)),k.get(z).add(q)}function j(z,q){k.has(z)&&(k.get(z).delete(q),k.get(z).size||(M.unobserve(z),k.delete(z)))}var $=re(99153),N=re(84851),V=re(19257),fe=re(93046),be=function(z){(0,V.Z)(Q,z);var q=(0,fe.Z)(Q);function Q(){return(0,$.Z)(this,Q),q.apply(this,arguments)}return(0,N.Z)(Q,[{key:"render",value:function(){return this.props.children}}]),Q}(we.Component);function Ae(z,q){var Q=z.children,de=z.disabled,ie=we.useRef(null),L=we.useRef(null),A=we.useContext(f),W=typeof Q=="function",le=W?Q(ie):Q,et=we.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),pt=!W&&we.isValidElement(le)&&(0,P.Yr)(le),Kt=pt?(0,P.C4)(le):null,Pe=(0,P.x1)(Kt,ie),Zt=function(){var mt;return(0,Le.ZP)(ie.current)||(ie.current&&(0,w.Z)(ie.current)==="object"?(0,Le.ZP)((mt=ie.current)===null||mt===void 0?void 0:mt.nativeElement):null)||(0,Le.ZP)(L.current)};we.useImperativeHandle(q,function(){return Zt()});var It=we.useRef(z);It.current=z;var bt=we.useCallback(function(Oe){var mt=It.current,$e=mt.onResize,jt=mt.data,ei=Oe.getBoundingClientRect(),Ce=ei.width,Ne=ei.height,pe=Oe.offsetWidth,Je=Oe.offsetHeight,ot=Math.floor(Ce),Qe=Math.floor(Ne);if(et.current.width!==ot||et.current.height!==Qe||et.current.offsetWidth!==pe||et.current.offsetHeight!==Je){var Z={width:ot,height:Qe,offsetWidth:pe,offsetHeight:Je};et.current=Z;var ve=pe===Math.round(Ce)?Ce:pe,Be=Je===Math.round(Ne)?Ne:Je,Ze=(0,J.Z)((0,J.Z)({},Z),{},{offsetWidth:ve,offsetHeight:Be});A==null||A(Ze,Oe,jt),$e&&Promise.resolve().then(function(){$e(Ze,Oe)})}},[]);return we.useEffect(function(){var Oe=Zt();return Oe&&!de&&G(Oe,bt),function(){return j(Oe,bt)}},[ie.current,de]),we.createElement(be,{ref:L},pt?we.cloneElement(le,{ref:Pe}):le)}var se=we.forwardRef(Ae),ke=se,We="rc-observer-key";function ze(z,q){var Q=z.children,de=typeof Q=="function"?[Q]:(0,Ye.Z)(Q);return de.map(function(ie,L){var A=(ie==null?void 0:ie.key)||"".concat(We,"-").concat(L);return we.createElement(ke,(0,ue.Z)({},z,{key:A,ref:L===0?q:void 0}),ie)})}var Rt=we.forwardRef(ze);Rt.Collection=ne;var te=Rt},29443:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return qt}});var ue=re(14809),we=re(4635),Ye=re(20439),me=re(50298),J=re(93664),w=re(62646),Le=re(92310),P=re.n(Le),f=re(18929),ne=re(49658),I=re(59301),k=(0,I.createContext)(null),T=re(95190),M=re(29301),O=re(6089),X=re(8654),G=re(16089),j=function(Re){var st=Re.activeTabOffset,vt=Re.horizontal,je=Re.rtl,Dt=Re.indicator,Ct=Dt===void 0?{}:Dt,Et=Ct.size,Ut=Ct.align,Xt=Ut===void 0?"center":Ut,Xe=(0,I.useState)(),Vt=(0,me.Z)(Xe,2),De=Vt[0],xe=Vt[1],Ee=(0,I.useRef)(),U=I.useCallback(function(ae){return typeof Et=="function"?Et(ae):typeof Et=="number"?Et:ae},[Et]);function H(){G.Z.cancel(Ee.current)}return(0,I.useEffect)(function(){var ae={};if(st)if(vt){ae.width=U(st.width);var ce=je?"right":"left";Xt==="start"&&(ae[ce]=st[ce]),Xt==="center"&&(ae[ce]=st[ce]+st.width/2,ae.transform=je?"translateX(50%)":"translateX(-50%)"),Xt==="end"&&(ae[ce]=st[ce]+st.width,ae.transform="translateX(-100%)")}else ae.height=U(st.height),Xt==="start"&&(ae.top=st.top),Xt==="center"&&(ae.top=st.top+st.height/2,ae.transform="translateY(-50%)"),Xt==="end"&&(ae.top=st.top+st.height,ae.transform="translateY(-100%)");return H(),Ee.current=(0,G.Z)(function(){xe(ae)}),H},[st,vt,je,Xt,U]),{style:De}},$=j,N={width:0,height:0,left:0,top:0};function V(Te,Re,st){return(0,I.useMemo)(function(){for(var vt,je=new Map,Dt=Re.get((vt=Te[0])===null||vt===void 0?void 0:vt.key)||N,Ct=Dt.left+Dt.width,Et=0;Et<Te.length;Et+=1){var Ut=Te[Et].key,Xt=Re.get(Ut);if(!Xt){var Xe;Xt=Re.get((Xe=Te[Et-1])===null||Xe===void 0?void 0:Xe.key)||N}var Vt=je.get(Ut)||(0,Ye.Z)({},Xt);Vt.right=Ct-Vt.left-Vt.width,je.set(Ut,Vt)}return je},[Te.map(function(vt){return vt.key}).join("_"),Re,st])}function fe(Te,Re){var st=I.useRef(Te),vt=I.useState({}),je=(0,me.Z)(vt,2),Dt=je[1];function Ct(Et){var Ut=typeof Et=="function"?Et(st.current):Et;Ut!==st.current&&Re(Ut,st.current),st.current=Ut,Dt({})}return[st.current,Ct]}var be=.1,Ae=.01,se=20,ke=Math.pow(.995,se);function We(Te,Re){var st=(0,I.useState)(),vt=(0,me.Z)(st,2),je=vt[0],Dt=vt[1],Ct=(0,I.useState)(0),Et=(0,me.Z)(Ct,2),Ut=Et[0],Xt=Et[1],Xe=(0,I.useState)(0),Vt=(0,me.Z)(Xe,2),De=Vt[0],xe=Vt[1],Ee=(0,I.useState)(),U=(0,me.Z)(Ee,2),H=U[0],ae=U[1],ce=(0,I.useRef)();function ye(di){var ti=di.touches[0],Tt=ti.screenX,ai=ti.screenY;Dt({x:Tt,y:ai}),window.clearInterval(ce.current)}function ct(di){if(je){var ti=di.touches[0],Tt=ti.screenX,ai=ti.screenY;Dt({x:Tt,y:ai});var Di=Tt-je.x,Ti=ai-je.y;Re(Di,Ti);var Ii=Date.now();Xt(Ii),xe(Ii-Ut),ae({x:Di,y:Ti})}}function _t(){if(je&&(Dt(null),ae(null),H)){var di=H.x/De,ti=H.y/De,Tt=Math.abs(di),ai=Math.abs(ti);if(Math.max(Tt,ai)<be)return;var Di=di,Ti=ti;ce.current=window.setInterval(function(){if(Math.abs(Di)<Ae&&Math.abs(Ti)<Ae){window.clearInterval(ce.current);return}Di*=ke,Ti*=ke,Re(Di*se,Ti*se)},se)}}var ut=(0,I.useRef)();function Gt(di){var ti=di.deltaX,Tt=di.deltaY,ai=0,Di=Math.abs(ti),Ti=Math.abs(Tt);Di===Ti?ai=ut.current==="x"?ti:Tt:Di>Ti?(ai=ti,ut.current="x"):(ai=Tt,ut.current="y"),Re(-ai,-ai)&&di.preventDefault()}var ni=(0,I.useRef)(null);ni.current={onTouchStart:ye,onTouchMove:ct,onTouchEnd:_t,onWheel:Gt},I.useEffect(function(){function di(Di){ni.current.onTouchStart(Di)}function ti(Di){ni.current.onTouchMove(Di)}function Tt(Di){ni.current.onTouchEnd(Di)}function ai(Di){ni.current.onWheel(Di)}return document.addEventListener("touchmove",ti,{passive:!1}),document.addEventListener("touchend",Tt,{passive:!0}),Te.current.addEventListener("touchstart",di,{passive:!0}),Te.current.addEventListener("wheel",ai,{passive:!1}),function(){document.removeEventListener("touchmove",ti),document.removeEventListener("touchend",Tt)}},[])}var ze=re(34280);function Rt(Te){var Re=(0,I.useState)(0),st=(0,me.Z)(Re,2),vt=st[0],je=st[1],Dt=(0,I.useRef)(0),Ct=(0,I.useRef)();return Ct.current=Te,(0,ze.o)(function(){var Et;(Et=Ct.current)===null||Et===void 0||Et.call(Ct)},[vt]),function(){Dt.current===vt&&(Dt.current+=1,je(Dt.current))}}function te(Te){var Re=(0,I.useRef)([]),st=(0,I.useState)({}),vt=(0,me.Z)(st,2),je=vt[1],Dt=(0,I.useRef)(typeof Te=="function"?Te():Te),Ct=Rt(function(){var Ut=Dt.current;Re.current.forEach(function(Xt){Ut=Xt(Ut)}),Re.current=[],Dt.current=Ut,je({})});function Et(Ut){Re.current.push(Ut),Ct()}return[Dt.current,Et]}var z={width:0,height:0,left:0,top:0,right:0};function q(Te,Re,st,vt,je,Dt,Ct){var Et=Ct.tabs,Ut=Ct.tabPosition,Xt=Ct.rtl,Xe,Vt,De;return["top","bottom"].includes(Ut)?(Xe="width",Vt=Xt?"right":"left",De=Math.abs(st)):(Xe="height",Vt="top",De=-st),(0,I.useMemo)(function(){if(!Et.length)return[0,0];for(var xe=Et.length,Ee=xe,U=0;U<xe;U+=1){var H=Te.get(Et[U].key)||z;if(Math.floor(H[Vt]+H[Xe])>Math.floor(De+Re)){Ee=U-1;break}}for(var ae=0,ce=xe-1;ce>=0;ce-=1){var ye=Te.get(Et[ce].key)||z;if(ye[Vt]<De){ae=ce+1;break}}return ae>=Ee?[0,0]:[ae,Ee]},[Te,Re,vt,je,Dt,De,Ut,Et.map(function(xe){return xe.key}).join("_"),Xt])}function Q(Te){var Re;return Te instanceof Map?(Re={},Te.forEach(function(st,vt){Re[vt]=st})):Re=Te,JSON.stringify(Re)}var de="TABS_DQ";function ie(Te){return String(Te).replace(/"/g,de)}function L(Te,Re,st,vt){return!(!st||vt||Te===!1||Te===void 0&&(Re===!1||Re===null))}var A=I.forwardRef(function(Te,Re){var st=Te.prefixCls,vt=Te.editable,je=Te.locale,Dt=Te.style;return!vt||vt.showAdd===!1?null:I.createElement("button",{ref:Re,type:"button",className:"".concat(st,"-nav-add"),style:Dt,"aria-label":(je==null?void 0:je.addAriaLabel)||"Add tab",onClick:function(Et){vt.onEdit("add",{event:Et})}},vt.addIcon||"+")}),W=A,le=I.forwardRef(function(Te,Re){var st=Te.position,vt=Te.prefixCls,je=Te.extra;if(!je)return null;var Dt,Ct={};return(0,J.Z)(je)==="object"&&!I.isValidElement(je)?Ct=je:Ct.right=je,st==="right"&&(Dt=Ct.right),st==="left"&&(Dt=Ct.left),Dt?I.createElement("div",{className:"".concat(vt,"-extra-content"),ref:Re},Dt):null}),et=le,pt=re(96478),Kt=re(28321),Pe=re(10228),Zt=I.forwardRef(function(Te,Re){var st=Te.prefixCls,vt=Te.id,je=Te.tabs,Dt=Te.locale,Ct=Te.mobile,Et=Te.more,Ut=Et===void 0?{}:Et,Xt=Te.style,Xe=Te.className,Vt=Te.editable,De=Te.tabBarGutter,xe=Te.rtl,Ee=Te.removeAriaLabel,U=Te.onTabClick,H=Te.getPopupContainer,ae=Te.popupClassName,ce=(0,I.useState)(!1),ye=(0,me.Z)(ce,2),ct=ye[0],_t=ye[1],ut=(0,I.useState)(null),Gt=(0,me.Z)(ut,2),ni=Gt[0],di=Gt[1],ti=Ut.icon,Tt=ti===void 0?"More":ti,ai="".concat(vt,"-more-popup"),Di="".concat(st,"-dropdown"),Ti=ni!==null?"".concat(ai,"-").concat(ni):null,Ii=Dt==null?void 0:Dt.dropdownAriaLabel;function mi(Li,Ni){Li.preventDefault(),Li.stopPropagation(),Vt.onEdit("remove",{key:Ni,event:Li})}var ui=I.createElement(Kt.ZP,{onClick:function(Ni){var dn=Ni.key,Fi=Ni.domEvent;U(dn,Fi),_t(!1)},prefixCls:"".concat(Di,"-menu"),id:ai,tabIndex:-1,role:"listbox","aria-activedescendant":Ti,selectedKeys:[ni],"aria-label":Ii!==void 0?Ii:"expanded dropdown"},je.map(function(Li){var Ni=Li.closable,dn=Li.disabled,Fi=Li.closeIcon,vn=Li.key,an=Li.label,Vi=L(Ni,Fi,Vt,dn);return I.createElement(Kt.sN,{key:vn,id:"".concat(ai,"-").concat(vn),role:"option","aria-controls":vt&&"".concat(vt,"-panel-").concat(vn),disabled:dn},I.createElement("span",null,an),Vi&&I.createElement("button",{type:"button","aria-label":Ee||"remove",tabIndex:0,className:"".concat(Di,"-menu-item-remove"),onClick:function(kn){kn.stopPropagation(),mi(kn,vn)}},Fi||Vt.removeIcon||"\xD7"))}));function Wi(Li){for(var Ni=je.filter(function(Vi){return!Vi.disabled}),dn=Ni.findIndex(function(Vi){return Vi.key===ni})||0,Fi=Ni.length,vn=0;vn<Fi;vn+=1){dn=(dn+Li+Fi)%Fi;var an=Ni[dn];if(!an.disabled){di(an.key);return}}}function Ui(Li){var Ni=Li.which;if(!ct){[Pe.Z.DOWN,Pe.Z.SPACE,Pe.Z.ENTER].includes(Ni)&&(_t(!0),Li.preventDefault());return}switch(Ni){case Pe.Z.UP:Wi(-1),Li.preventDefault();break;case Pe.Z.DOWN:Wi(1),Li.preventDefault();break;case Pe.Z.ESC:_t(!1);break;case Pe.Z.SPACE:case Pe.Z.ENTER:ni!==null&&U(ni,Li);break}}(0,I.useEffect)(function(){var Li=document.getElementById(Ti);Li&&Li.scrollIntoView&&Li.scrollIntoView(!1)},[ni]),(0,I.useEffect)(function(){ct||di(null)},[ct]);var on=(0,we.Z)({},xe?"marginRight":"marginLeft",De);je.length||(on.visibility="hidden",on.order=1);var qi=P()((0,we.Z)({},"".concat(Di,"-rtl"),xe)),lr=Ct?null:I.createElement(pt.Z,(0,ue.Z)({prefixCls:Di,overlay:ui,visible:je.length?ct:!1,onVisibleChange:_t,overlayClassName:P()(qi,ae),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:H},Ut),I.createElement("button",{type:"button",className:"".concat(st,"-nav-more"),style:on,"aria-haspopup":"listbox","aria-controls":ai,id:"".concat(vt,"-more"),"aria-expanded":ct,onKeyDown:Ui},Tt));return I.createElement("div",{className:P()("".concat(st,"-nav-operations"),Xe),style:Xt,ref:Re},lr,I.createElement(W,{prefixCls:st,locale:Dt,editable:Vt}))}),It=I.memo(Zt,function(Te,Re){return Re.tabMoving}),bt=function(Re){var st=Re.prefixCls,vt=Re.id,je=Re.active,Dt=Re.focus,Ct=Re.tab,Et=Ct.key,Ut=Ct.label,Xt=Ct.disabled,Xe=Ct.closeIcon,Vt=Ct.icon,De=Re.closable,xe=Re.renderWrapper,Ee=Re.removeAriaLabel,U=Re.editable,H=Re.onClick,ae=Re.onFocus,ce=Re.onBlur,ye=Re.onKeyDown,ct=Re.onMouseDown,_t=Re.onMouseUp,ut=Re.style,Gt=Re.tabCount,ni=Re.currentPosition,di="".concat(st,"-tab"),ti=L(De,Xe,U,Xt);function Tt(mi){Xt||H(mi)}function ai(mi){mi.preventDefault(),mi.stopPropagation(),U.onEdit("remove",{key:Et,event:mi})}var Di=I.useMemo(function(){return Vt&&typeof Ut=="string"?I.createElement("span",null,Ut):Ut},[Ut,Vt]),Ti=I.useRef(null);I.useEffect(function(){Dt&&Ti.current&&Ti.current.focus()},[Dt]);var Ii=I.createElement("div",{key:Et,"data-node-key":ie(Et),className:P()(di,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(di,"-with-remove"),ti),"".concat(di,"-active"),je),"".concat(di,"-disabled"),Xt),"".concat(di,"-focus"),Dt)),style:ut,onClick:Tt},I.createElement("div",{ref:Ti,role:"tab","aria-selected":je,id:vt&&"".concat(vt,"-tab-").concat(Et),className:"".concat(di,"-btn"),"aria-controls":vt&&"".concat(vt,"-panel-").concat(Et),"aria-disabled":Xt,tabIndex:Xt?null:je?0:-1,onClick:function(ui){ui.stopPropagation(),Tt(ui)},onKeyDown:ye,onMouseDown:ct,onMouseUp:_t,onFocus:ae,onBlur:ce},Dt&&I.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"Tab ".concat(ni," of ").concat(Gt)),Vt&&I.createElement("span",{className:"".concat(di,"-icon")},Vt),Ut&&Di),ti&&I.createElement("button",{type:"button",role:"tab","aria-label":Ee||"remove",tabIndex:je?0:-1,className:"".concat(di,"-remove"),onClick:function(ui){ui.stopPropagation(),ai(ui)}},Xe||U.removeIcon||"\xD7"));return xe?xe(Ii):Ii},Oe=bt,mt=function(Re,st){var vt=Re.offsetWidth,je=Re.offsetHeight,Dt=Re.offsetTop,Ct=Re.offsetLeft,Et=Re.getBoundingClientRect(),Ut=Et.width,Xt=Et.height,Xe=Et.left,Vt=Et.top;return Math.abs(Ut-vt)<1?[Ut,Xt,Xe-st.left,Vt-st.top]:[vt,je,Ct,Dt]},$e=function(Re){var st=Re.current||{},vt=st.offsetWidth,je=vt===void 0?0:vt,Dt=st.offsetHeight,Ct=Dt===void 0?0:Dt;if(Re.current){var Et=Re.current.getBoundingClientRect(),Ut=Et.width,Xt=Et.height;if(Math.abs(Ut-je)<1)return[Ut,Xt]}return[je,Ct]},jt=function(Re,st){return Re[st?0:1]},ei=I.forwardRef(function(Te,Re){var st=Te.className,vt=Te.style,je=Te.id,Dt=Te.animated,Ct=Te.activeKey,Et=Te.rtl,Ut=Te.extra,Xt=Te.editable,Xe=Te.locale,Vt=Te.tabPosition,De=Te.tabBarGutter,xe=Te.children,Ee=Te.onTabClick,U=Te.onTabScroll,H=Te.indicator,ae=I.useContext(k),ce=ae.prefixCls,ye=ae.tabs,ct=(0,I.useRef)(null),_t=(0,I.useRef)(null),ut=(0,I.useRef)(null),Gt=(0,I.useRef)(null),ni=(0,I.useRef)(null),di=(0,I.useRef)(null),ti=(0,I.useRef)(null),Tt=Vt==="top"||Vt==="bottom",ai=fe(0,function(en,bi){Tt&&U&&U({direction:en>bi?"left":"right"})}),Di=(0,me.Z)(ai,2),Ti=Di[0],Ii=Di[1],mi=fe(0,function(en,bi){!Tt&&U&&U({direction:en>bi?"top":"bottom"})}),ui=(0,me.Z)(mi,2),Wi=ui[0],Ui=ui[1],on=(0,I.useState)([0,0]),qi=(0,me.Z)(on,2),lr=qi[0],Li=qi[1],Ni=(0,I.useState)([0,0]),dn=(0,me.Z)(Ni,2),Fi=dn[0],vn=dn[1],an=(0,I.useState)([0,0]),Vi=(0,me.Z)(an,2),hn=Vi[0],kn=Vi[1],Dr=(0,I.useState)([0,0]),ki=(0,me.Z)(Dr,2),oi=ki[0],Me=ki[1],tt=te(new Map),xt=(0,me.Z)(tt,2),ht=xt[0],St=xt[1],at=V(ye,ht,Fi[0]),ft=jt(lr,Tt),Pt=jt(Fi,Tt),Jt=jt(hn,Tt),hi=jt(oi,Tt),Xi=Math.floor(ft)<Math.floor(Pt+Jt),li=Xi?ft-hi:ft-Jt,$i="".concat(ce,"-nav-operations-hidden"),Pi=0,ji=0;Tt&&Et?(Pi=0,ji=Math.max(0,Pt-li)):(Pi=Math.min(0,li-Pt),ji=0);function Gi(en){return en<Pi?Pi:en>ji?ji:en}var vi=(0,I.useRef)(null),Oi=(0,I.useState)(),nn=(0,me.Z)(Oi,2),Ki=nn[0],wi=nn[1];function rn(){wi(Date.now())}function Si(){vi.current&&clearTimeout(vi.current)}We(Gt,function(en,bi){function xi(Sn,_r){Sn(function(Wn){var tr=Gi(Wn+_r);return tr})}return Xi?(Tt?xi(Ii,en):xi(Ui,bi),Si(),rn(),!0):!1}),(0,I.useEffect)(function(){return Si(),Ki&&(vi.current=setTimeout(function(){wi(0)},100)),Si},[Ki]);var Hi=q(at,li,Tt?Ti:Wi,Pt,Jt,hi,(0,Ye.Z)((0,Ye.Z)({},Te),{},{tabs:ye})),Bn=(0,me.Z)(Hi,2),Ji=Bn[0],Yi=Bn[1],yn=(0,O.Z)(function(){var en=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ct,bi=at.get(en)||{width:0,height:0,left:0,right:0,top:0};if(Tt){var xi=Ti;Et?bi.right<Ti?xi=bi.right:bi.right+bi.width>Ti+li&&(xi=bi.right+bi.width-li):bi.left<-Ti?xi=-bi.left:bi.left+bi.width>-Ti+li&&(xi=-(bi.left+bi.width-li)),Ui(0),Ii(Gi(xi))}else{var Sn=Wi;bi.top<-Wi?Sn=-bi.top:bi.top+bi.height>-Wi+li&&(Sn=-(bi.top+bi.height-li)),Ii(0),Ui(Gi(Sn))}}),bn=(0,I.useState)(),Nn=(0,me.Z)(bn,2),Mn=Nn[0],Qi=Nn[1],Ln=(0,I.useState)(!1),$n=(0,me.Z)(Ln,2),xr=$n[0],xn=$n[1],An=ye.filter(function(en){return!en.disabled}).map(function(en){return en.key}),fr=function(bi){var xi=An.indexOf(Mn||Ct),Sn=An.length,_r=(xi+bi+Sn)%Sn,Wn=An[_r];Qi(Wn)},Er=function(bi){var xi=bi.code,Sn=Et&&Tt,_r=An[0],Wn=An[An.length-1];switch(xi){case"ArrowLeft":{Tt&&fr(Sn?1:-1);break}case"ArrowRight":{Tt&&fr(Sn?-1:1);break}case"ArrowUp":{bi.preventDefault(),Tt||fr(-1);break}case"ArrowDown":{bi.preventDefault(),Tt||fr(1);break}case"Home":{bi.preventDefault(),Qi(_r);break}case"End":{bi.preventDefault(),Qi(Wn);break}case"Enter":case"Space":{bi.preventDefault(),Ee(Ct,bi);break}case"Backspace":case"Delete":{var tr=An.indexOf(Mn),Kn=ye.find(function(ir){return ir.key===Mn}),us=L(Kn==null?void 0:Kn.closable,Kn==null?void 0:Kn.closeIcon,Xt,Kn==null?void 0:Kn.disabled);us&&(bi.preventDefault(),bi.stopPropagation(),Xt.onEdit("remove",{key:Mn,event:bi}),tr===An.length-1?fr(-1):fr(1));break}}},ur={};Tt?ur[Et?"marginRight":"marginLeft"]=De:ur.marginTop=De;var Ir=ye.map(function(en,bi){var xi=en.key;return I.createElement(Oe,{id:je,prefixCls:ce,key:xi,tab:en,style:bi===0?void 0:ur,closable:en.closable,editable:Xt,active:xi===Ct,focus:xi===Mn,renderWrapper:xe,removeAriaLabel:Xe==null?void 0:Xe.removeAriaLabel,tabCount:An.length,currentPosition:bi+1,onClick:function(_r){Ee(xi,_r)},onKeyDown:Er,onFocus:function(){xr||Qi(xi),yn(xi),rn(),Gt.current&&(Et||(Gt.current.scrollLeft=0),Gt.current.scrollTop=0)},onBlur:function(){Qi(void 0)},onMouseDown:function(){xn(!0)},onMouseUp:function(){xn(!1)}})}),wn=function(){return St(function(){var bi,xi=new Map,Sn=(bi=ni.current)===null||bi===void 0?void 0:bi.getBoundingClientRect();return ye.forEach(function(_r){var Wn,tr=_r.key,Kn=(Wn=ni.current)===null||Wn===void 0?void 0:Wn.querySelector('[data-node-key="'.concat(ie(tr),'"]'));if(Kn){var us=mt(Kn,Sn),ir=(0,me.Z)(us,4),Qr=ir[0],Wr=ir[1],Kr=ir[2],nr=ir[3];xi.set(tr,{width:Qr,height:Wr,left:Kr,top:nr})}}),xi})};(0,I.useEffect)(function(){wn()},[ye.map(function(en){return en.key}).join("_")]);var Xn=Rt(function(){var en=$e(ct),bi=$e(_t),xi=$e(ut);Li([en[0]-bi[0]-xi[0],en[1]-bi[1]-xi[1]]);var Sn=$e(ti);kn(Sn);var _r=$e(di);Me(_r);var Wn=$e(ni);vn([Wn[0]-Sn[0],Wn[1]-Sn[1]]),wn()}),Cr=ye.slice(0,Ji),Gn=ye.slice(Yi+1),pr=[].concat((0,T.Z)(Cr),(0,T.Z)(Gn)),Rn=at.get(Ct),Jn=$({activeTabOffset:Rn,horizontal:Tt,indicator:H,rtl:Et}),mr=Jn.style;(0,I.useEffect)(function(){yn()},[Ct,Pi,ji,Q(Rn),Q(at),Tt]),(0,I.useEffect)(function(){Xn()},[Et]);var Ai=!!pr.length,Tn="".concat(ce,"-nav-wrap"),cr,gr,hr,Jr;return Tt?Et?(gr=Ti>0,cr=Ti!==ji):(cr=Ti<0,gr=Ti!==Pi):(hr=Wi<0,Jr=Wi!==Pi),I.createElement(M.Z,{onResize:Xn},I.createElement("div",{ref:(0,X.x1)(Re,ct),role:"tablist","aria-orientation":Tt?"horizontal":"vertical",className:P()("".concat(ce,"-nav"),st),style:vt,onKeyDown:function(){rn()}},I.createElement(et,{ref:_t,position:"left",extra:Ut,prefixCls:ce}),I.createElement(M.Z,{onResize:Xn},I.createElement("div",{className:P()(Tn,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(Tn,"-ping-left"),cr),"".concat(Tn,"-ping-right"),gr),"".concat(Tn,"-ping-top"),hr),"".concat(Tn,"-ping-bottom"),Jr)),ref:Gt},I.createElement(M.Z,{onResize:Xn},I.createElement("div",{ref:ni,className:"".concat(ce,"-nav-list"),style:{transform:"translate(".concat(Ti,"px, ").concat(Wi,"px)"),transition:Ki?"none":void 0}},Ir,I.createElement(W,{ref:ti,prefixCls:ce,locale:Xe,editable:Xt,style:(0,Ye.Z)((0,Ye.Z)({},Ir.length===0?void 0:ur),{},{visibility:Ai?"hidden":null})}),I.createElement("div",{className:P()("".concat(ce,"-ink-bar"),(0,we.Z)({},"".concat(ce,"-ink-bar-animated"),Dt.inkBar)),style:mr}))))),I.createElement(It,(0,ue.Z)({},Te,{removeAriaLabel:Xe==null?void 0:Xe.removeAriaLabel,ref:di,prefixCls:ce,tabs:pr,className:!Ai&&$i,tabMoving:!!Ki})),I.createElement(et,{ref:ut,position:"right",extra:Ut,prefixCls:ce})))}),Ce=ei,Ne=I.forwardRef(function(Te,Re){var st=Te.prefixCls,vt=Te.className,je=Te.style,Dt=Te.id,Ct=Te.active,Et=Te.tabKey,Ut=Te.children;return I.createElement("div",{id:Dt&&"".concat(Dt,"-panel-").concat(Et),role:"tabpanel",tabIndex:Ct?0:-1,"aria-labelledby":Dt&&"".concat(Dt,"-tab-").concat(Et),"aria-hidden":!Ct,style:je,className:P()(st,Ct&&"".concat(st,"-active"),vt),ref:Re},Ut)}),pe=Ne,Je=["renderTabBar"],ot=["label","key"],Qe=function(Re){var st=Re.renderTabBar,vt=(0,w.Z)(Re,Je),je=I.useContext(k),Dt=je.tabs;if(st){var Ct=(0,Ye.Z)((0,Ye.Z)({},vt),{},{panes:Dt.map(function(Et){var Ut=Et.label,Xt=Et.key,Xe=(0,w.Z)(Et,ot);return I.createElement(pe,(0,ue.Z)({tab:Ut,key:Xt,tabKey:Xt},Xe))})});return st(Ct,Ce)}return I.createElement(Ce,vt)},Z=Qe,ve=re(77900),Be=["key","forceRender","style","className","destroyInactiveTabPane"],Ze=function(Re){var st=Re.id,vt=Re.activeKey,je=Re.animated,Dt=Re.tabPosition,Ct=Re.destroyInactiveTabPane,Et=I.useContext(k),Ut=Et.prefixCls,Xt=Et.tabs,Xe=je.tabPane,Vt="".concat(Ut,"-tabpane");return I.createElement("div",{className:P()("".concat(Ut,"-content-holder"))},I.createElement("div",{className:P()("".concat(Ut,"-content"),"".concat(Ut,"-content-").concat(Dt),(0,we.Z)({},"".concat(Ut,"-content-animated"),Xe))},Xt.map(function(De){var xe=De.key,Ee=De.forceRender,U=De.style,H=De.className,ae=De.destroyInactiveTabPane,ce=(0,w.Z)(De,Be),ye=xe===vt;return I.createElement(ve.default,(0,ue.Z)({key:xe,visible:ye,forceRender:Ee,removeOnLeave:!!(Ct||ae),leavedClassName:"".concat(Vt,"-hidden")},je.tabPaneMotion),function(ct,_t){var ut=ct.style,Gt=ct.className;return I.createElement(pe,(0,ue.Z)({},ce,{prefixCls:Vt,id:st,tabKey:xe,animated:Xe,active:ye,style:(0,Ye.Z)((0,Ye.Z)({},U),ut),className:P()(H,Gt),ref:_t}))})})))},lt=Ze,yt=re(48736);function Yt(){var Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},Re;return Te===!1?Re={inkBar:!1,tabPane:!1}:Te===!0?Re={inkBar:!0,tabPane:!1}:Re=(0,Ye.Z)({inkBar:!0},(0,J.Z)(Te)==="object"?Te:{}),Re.tabPaneMotion&&Re.tabPane===void 0&&(Re.tabPane=!0),!Re.tabPaneMotion&&Re.tabPane&&(Re.tabPane=!1),Re}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,kt=I.forwardRef(function(Te,Re){var st=Te.id,vt=Te.prefixCls,je=vt===void 0?"rc-tabs":vt,Dt=Te.className,Ct=Te.items,Et=Te.direction,Ut=Te.activeKey,Xt=Te.defaultActiveKey,Xe=Te.editable,Vt=Te.animated,De=Te.tabPosition,xe=De===void 0?"top":De,Ee=Te.tabBarGutter,U=Te.tabBarStyle,H=Te.tabBarExtraContent,ae=Te.locale,ce=Te.more,ye=Te.destroyInactiveTabPane,ct=Te.renderTabBar,_t=Te.onChange,ut=Te.onTabClick,Gt=Te.onTabScroll,ni=Te.getPopupContainer,di=Te.popupClassName,ti=Te.indicator,Tt=(0,w.Z)(Te,gt),ai=I.useMemo(function(){return(Ct||[]).filter(function(oi){return oi&&(0,J.Z)(oi)==="object"&&"key"in oi})},[Ct]),Di=Et==="rtl",Ti=Yt(Vt),Ii=(0,I.useState)(!1),mi=(0,me.Z)(Ii,2),ui=mi[0],Wi=mi[1];(0,I.useEffect)(function(){Wi((0,ne.Z)())},[]);var Ui=(0,f.Z)(function(){var oi;return(oi=ai[0])===null||oi===void 0?void 0:oi.key},{value:Ut,defaultValue:Xt}),on=(0,me.Z)(Ui,2),qi=on[0],lr=on[1],Li=(0,I.useState)(function(){return ai.findIndex(function(oi){return oi.key===qi})}),Ni=(0,me.Z)(Li,2),dn=Ni[0],Fi=Ni[1];(0,I.useEffect)(function(){var oi=ai.findIndex(function(tt){return tt.key===qi});if(oi===-1){var Me;oi=Math.max(0,Math.min(dn,ai.length-1)),lr((Me=ai[oi])===null||Me===void 0?void 0:Me.key)}Fi(oi)},[ai.map(function(oi){return oi.key}).join("_"),qi,dn]);var vn=(0,f.Z)(null,{value:st}),an=(0,me.Z)(vn,2),Vi=an[0],hn=an[1];(0,I.useEffect)(function(){st||(hn("rc-tabs-".concat(Se)),Se+=1)},[]);function kn(oi,Me){ut==null||ut(oi,Me);var tt=oi!==qi;lr(oi),tt&&(_t==null||_t(oi))}var Dr={id:Vi,activeKey:qi,animated:Ti,tabPosition:xe,rtl:Di,mobile:ui},ki=(0,Ye.Z)((0,Ye.Z)({},Dr),{},{editable:Xe,locale:ae,more:ce,tabBarGutter:Ee,onTabClick:kn,onTabScroll:Gt,extra:H,style:U,panes:null,getPopupContainer:ni,popupClassName:di,indicator:ti});return I.createElement(k.Provider,{value:{tabs:ai,prefixCls:je}},I.createElement("div",(0,ue.Z)({ref:Re,id:st,className:P()(je,"".concat(je,"-").concat(xe),(0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(je,"-mobile"),ui),"".concat(je,"-editable"),Xe),"".concat(je,"-rtl"),Di),Dt)},Tt),I.createElement(Z,(0,ue.Z)({},ki,{renderTabBar:ct})),I.createElement(lt,(0,ue.Z)({destroyInactiveTabPane:ye},Dr,{animated:Ti}))))}),Nt=kt,qt=Nt},29125:function(Ci,Ft,re){"use strict";re.d(Ft,{G:function(){return me},Z:function(){return j}});var ue=re(92310),we=re.n(ue),Ye=re(59301);function me($){var N=$.children,V=$.prefixCls,fe=$.id,be=$.overlayInnerStyle,Ae=$.bodyClassName,se=$.className,ke=$.style;return Ye.createElement("div",{className:we()("".concat(V,"-content"),se),style:ke},Ye.createElement("div",{className:we()("".concat(V,"-inner"),Ae),id:fe,role:"tooltip",style:be},typeof N=="function"?N():N))}var J=re(14809),w=re(20439),Le=re(62646),P=re(65966),f={shiftX:64,adjustY:1},ne={adjustX:1,shiftY:!0},I=[0,0],k={left:{points:["cr","cl"],overflow:ne,offset:[-4,0],targetOffset:I},right:{points:["cl","cr"],overflow:ne,offset:[4,0],targetOffset:I},top:{points:["bc","tc"],overflow:f,offset:[0,-4],targetOffset:I},bottom:{points:["tc","bc"],overflow:f,offset:[0,4],targetOffset:I},topLeft:{points:["bl","tl"],overflow:f,offset:[0,-4],targetOffset:I},leftTop:{points:["tr","tl"],overflow:ne,offset:[-4,0],targetOffset:I},topRight:{points:["br","tr"],overflow:f,offset:[0,-4],targetOffset:I},rightTop:{points:["tl","tr"],overflow:ne,offset:[4,0],targetOffset:I},bottomRight:{points:["tr","br"],overflow:f,offset:[0,4],targetOffset:I},rightBottom:{points:["bl","br"],overflow:ne,offset:[4,0],targetOffset:I},bottomLeft:{points:["tl","bl"],overflow:f,offset:[0,4],targetOffset:I},leftBottom:{points:["br","bl"],overflow:ne,offset:[-4,0],targetOffset:I}},T=null,M=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"],X=function(N,V){var fe=N.overlayClassName,be=N.trigger,Ae=be===void 0?["hover"]:be,se=N.mouseEnterDelay,ke=se===void 0?0:se,We=N.mouseLeaveDelay,ze=We===void 0?.1:We,Rt=N.overlayStyle,te=N.prefixCls,z=te===void 0?"rc-tooltip":te,q=N.children,Q=N.onVisibleChange,de=N.afterVisibleChange,ie=N.transitionName,L=N.animation,A=N.motion,W=N.placement,le=W===void 0?"right":W,et=N.align,pt=et===void 0?{}:et,Kt=N.destroyTooltipOnHide,Pe=Kt===void 0?!1:Kt,Zt=N.defaultVisible,It=N.getTooltipContainer,bt=N.overlayInnerStyle,Oe=N.arrowContent,mt=N.overlay,$e=N.id,jt=N.showArrow,ei=jt===void 0?!0:jt,Ce=N.classNames,Ne=N.styles,pe=(0,Le.Z)(N,O),Je=(0,M.Z)($e),ot=(0,Ye.useRef)(null);(0,Ye.useImperativeHandle)(V,function(){return ot.current});var Qe=(0,w.Z)({},pe);"visible"in N&&(Qe.popupVisible=N.visible);var Z=function(){return Ye.createElement(me,{key:"content",prefixCls:z,id:Je,bodyClassName:Ce==null?void 0:Ce.body,overlayInnerStyle:(0,w.Z)((0,w.Z)({},bt),Ne==null?void 0:Ne.body)},mt)},ve=function(){var Ze=Ye.Children.only(q),lt=(Ze==null?void 0:Ze.props)||{},yt=(0,w.Z)((0,w.Z)({},lt),{},{"aria-describedby":mt?Je:null});return Ye.cloneElement(q,yt)};return Ye.createElement(P.Z,(0,J.Z)({popupClassName:we()(fe,Ce==null?void 0:Ce.root),prefixCls:z,popup:Z,action:Ae,builtinPlacements:k,popupPlacement:le,ref:ot,popupAlign:pt,getPopupContainer:It,onPopupVisibleChange:Q,afterPopupVisibleChange:de,popupTransitionName:ie,popupAnimation:L,popupMotion:A,defaultPopupVisible:Zt,autoDestroy:Pe,mouseLeaveDelay:ze,popupStyle:(0,w.Z)((0,w.Z)({},Rt),Ne==null?void 0:Ne.root),mouseEnterDelay:ke,arrow:ei},Qe),ve())},G=(0,Ye.forwardRef)(X),j=G},49658:function(Ci,Ft){"use strict";Ft.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,Ft,re){"use strict";Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.CopyToClipboard=void 0;var ue=Ye(re(59301)),we=Ye(re(25769));function Ye($){return $&&$.__esModule?$:{default:$}}function me($){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?me=function(V){return typeof V}:me=function(V){return V&&typeof Symbol=="function"&&V.constructor===Symbol&&V!==Symbol.prototype?"symbol":typeof V},me($)}function J($,N){var V=Object.keys($);if(Object.getOwnPropertySymbols){var fe=Object.getOwnPropertySymbols($);N&&(fe=fe.filter(function(be){return Object.getOwnPropertyDescriptor($,be).enumerable})),V.push.apply(V,fe)}return V}function w($){for(var N=1;N<arguments.length;N++){var V=arguments[N]!=null?arguments[N]:{};N%2?J(V,!0).forEach(function(fe){G($,fe,V[fe])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(V)):J(V).forEach(function(fe){Object.defineProperty($,fe,Object.getOwnPropertyDescriptor(V,fe))})}return $}function Le($,N){if($==null)return{};var V=P($,N),fe,be;if(Object.getOwnPropertySymbols){var Ae=Object.getOwnPropertySymbols($);for(be=0;be<Ae.length;be++)fe=Ae[be],!(N.indexOf(fe)>=0)&&Object.prototype.propertyIsEnumerable.call($,fe)&&(V[fe]=$[fe])}return V}function P($,N){if($==null)return{};var V={},fe=Object.keys($),be,Ae;for(Ae=0;Ae<fe.length;Ae++)be=fe[Ae],!(N.indexOf(be)>=0)&&(V[be]=$[be]);return V}function f($,N){if(!($ instanceof N))throw new TypeError("Cannot call a class as a function")}function ne($,N){for(var V=0;V<N.length;V++){var fe=N[V];fe.enumerable=fe.enumerable||!1,fe.configurable=!0,"value"in fe&&(fe.writable=!0),Object.defineProperty($,fe.key,fe)}}function I($,N,V){return N&&ne($.prototype,N),V&&ne($,V),$}function k($,N){return N&&(me(N)==="object"||typeof N=="function")?N:M($)}function T($){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(V){return V.__proto__||Object.getPrototypeOf(V)},T($)}function M($){if($===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return $}function O($,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function");$.prototype=Object.create(N&&N.prototype,{constructor:{value:$,writable:!0,configurable:!0}}),N&&X($,N)}function X($,N){return X=Object.setPrototypeOf||function(fe,be){return fe.__proto__=be,fe},X($,N)}function G($,N,V){return N in $?Object.defineProperty($,N,{value:V,enumerable:!0,configurable:!0,writable:!0}):$[N]=V,$}var j=function($){O(N,$);function N(){var V,fe;f(this,N);for(var be=arguments.length,Ae=new Array(be),se=0;se<be;se++)Ae[se]=arguments[se];return fe=k(this,(V=T(N)).call.apply(V,[this].concat(Ae))),G(M(fe),"onClick",function(ke){var We=fe.props,ze=We.text,Rt=We.onCopy,te=We.children,z=We.options,q=ue.default.Children.only(te),Q=(0,we.default)(ze,z);Rt&&Rt(ze,Q),q&&q.props&&typeof q.props.onClick=="function"&&q.props.onClick(ke)}),fe}return I(N,[{key:"render",value:function(){var fe=this.props,be=fe.text,Ae=fe.onCopy,se=fe.options,ke=fe.children,We=Le(fe,["text","onCopy","options","children"]),ze=ue.default.Children.only(ke);return ue.default.cloneElement(ze,w({},We,{onClick:this.onClick}))}}]),N}(ue.default.PureComponent);Ft.CopyToClipboard=j,G(j,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Ci,Ft,re){"use strict";var ue=re(83145),we=ue.CopyToClipboard;we.CopyToClipboard=we,Ci.exports=we},76374:function(Ci,Ft,re){"use strict";var ue=function(){if(typeof Map!="undefined")return Map;function te(z,q){var Q=-1;return z.some(function(de,ie){return de[0]===q?(Q=ie,!0):!1}),Q}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(q){var Q=te(this.__entries__,q),de=this.__entries__[Q];return de&&de[1]},z.prototype.set=function(q,Q){var de=te(this.__entries__,q);~de?this.__entries__[de][1]=Q:this.__entries__.push([q,Q])},z.prototype.delete=function(q){var Q=this.__entries__,de=te(Q,q);~de&&Q.splice(de,1)},z.prototype.has=function(q){return!!~te(this.__entries__,q)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(q,Q){Q===void 0&&(Q=null);for(var de=0,ie=this.__entries__;de<ie.length;de++){var L=ie[de];q.call(Q,L[1],L[0])}},z}()}(),we=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Ye=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")()}(),me=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Ye):function(te){return setTimeout(function(){return te(Date.now())},1e3/60)}}(),J=2;function w(te,z){var q=!1,Q=!1,de=0;function ie(){q&&(q=!1,te()),Q&&A()}function L(){me(ie)}function A(){var W=Date.now();if(q){if(W-de<J)return;Q=!0}else q=!0,Q=!1,setTimeout(L,z);de=W}return A}var Le=20,P=["top","right","bottom","left","width","height","size","weight"],f=typeof MutationObserver!="undefined",ne=function(){function te(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=w(this.refresh.bind(this),Le)}return te.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},te.prototype.removeObserver=function(z){var q=this.observers_,Q=q.indexOf(z);~Q&&q.splice(Q,1),!q.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(q){return q.gatherActive(),q.hasActive()});return z.forEach(function(q){return q.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 q=z.propertyName,Q=q===void 0?"":q,de=P.some(function(ie){return!!~Q.indexOf(ie)});de&&this.refresh()},te.getInstance=function(){return this.instance_||(this.instance_=new te),this.instance_},te.instance_=null,te}(),I=function(te,z){for(var q=0,Q=Object.keys(z);q<Q.length;q++){var de=Q[q];Object.defineProperty(te,de,{value:z[de],enumerable:!1,writable:!1,configurable:!0})}return te},k=function(te){var z=te&&te.ownerDocument&&te.ownerDocument.defaultView;return z||Ye},T=be(0,0,0,0);function M(te){return parseFloat(te)||0}function O(te){for(var z=[],q=1;q<arguments.length;q++)z[q-1]=arguments[q];return z.reduce(function(Q,de){var ie=te["border-"+de+"-width"];return Q+M(ie)},0)}function X(te){for(var z=["top","right","bottom","left"],q={},Q=0,de=z;Q<de.length;Q++){var ie=de[Q],L=te["padding-"+ie];q[ie]=M(L)}return q}function G(te){var z=te.getBBox();return be(0,0,z.width,z.height)}function j(te){var z=te.clientWidth,q=te.clientHeight;if(!z&&!q)return T;var Q=k(te).getComputedStyle(te),de=X(Q),ie=de.left+de.right,L=de.top+de.bottom,A=M(Q.width),W=M(Q.height);if(Q.boxSizing==="border-box"&&(Math.round(A+ie)!==z&&(A-=O(Q,"left","right")+ie),Math.round(W+L)!==q&&(W-=O(Q,"top","bottom")+L)),!N(te)){var le=Math.round(A+ie)-z,et=Math.round(W+L)-q;Math.abs(le)!==1&&(A-=le),Math.abs(et)!==1&&(W-=et)}return be(de.left,de.top,A,W)}var $=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 N(te){return te===k(te).document.documentElement}function V(te){return we?$(te)?G(te):j(te):T}function fe(te){var z=te.x,q=te.y,Q=te.width,de=te.height,ie=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,L=Object.create(ie.prototype);return I(L,{x:z,y:q,width:Q,height:de,top:q,right:z+Q,bottom:de+q,left:z}),L}function be(te,z,q,Q){return{x:te,y:z,width:q,height:Q}}var Ae=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,q){var Q=fe(q);I(this,{target:z,contentRect:Q})}return te}(),ke=function(){function te(z,q,Q){if(this.activeObservations_=[],this.observations_=new ue,typeof z!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=z,this.controller_=q,this.callbackCtx_=Q}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 q=this.observations_;q.has(z)||(q.set(z,new Ae(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 q=this.observations_;q.has(z)&&(q.delete(z),q.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(q){q.isActive()&&z.activeObservations_.push(q)})},te.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,q=this.activeObservations_.map(function(Q){return new se(Q.target,Q.broadcastRect())});this.callback_.call(z,q,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 ue,ze=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 q=ne.getInstance(),Q=new ke(z,q,this);We.set(this,Q)}return te}();["observe","unobserve","disconnect"].forEach(function(te){ze.prototype[te]=function(){var z;return(z=We.get(this))[te].apply(z,arguments)}});var Rt=function(){return typeof Ye.ResizeObserver!="undefined"?Ye.ResizeObserver:ze}();Ft.Z=Rt},98040:function(Ci){Ci.exports=function(){var Ft=document.getSelection();if(!Ft.rangeCount)return function(){};for(var re=document.activeElement,ue=[],we=0;we<Ft.rangeCount;we++)ue.push(Ft.getRangeAt(we));switch(re.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":re.blur();break;default:re=null;break}return Ft.removeAllRanges(),function(){Ft.type==="Caret"&&Ft.removeAllRanges(),Ft.rangeCount||ue.forEach(function(Ye){Ft.addRange(Ye)}),re&&re.focus()}}},15360:function(Ci,Ft,re){"use strict";re.d(Ft,{ZP:function(){return xa}});const ue=Number.isFinite||function(h){return typeof h=="number"&&isFinite(h)},we=Number.isSafeInteger||function(h){return typeof h=="number"&&Math.abs(h)<=Ye},Ye=Number.MAX_SAFE_INTEGER||9007199254740991;let me=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}({}),J=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}({}),w=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 Le={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 ne{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 I(h,t,n){return(t=X(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 M(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){I(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 X(h){var t=O(h,"string");return typeof t=="symbol"?t:t+""}class G{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=j,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 j=function(){},$={trace:j,debug:j,log:j,warn:j,info:j,error:j};function N(){return k({},$)}function V(h,t){const n=self.console[h];return n?n.bind(self.console,`${t?"["+t+"] ":""}[${h}] >`):j}function fe(h,t,n){return t[h]?t[h].bind(t):V(h,n)}const be=N();function Ae(h,t,n){const s=N();if(typeof console=="object"&&h===!0||typeof h=="object"){const o=["debug","log","info","warn","error"];o.forEach(l=>{s[l]=fe(l,h,n)});try{s.log(`Debug logs enabled for "${t}" in hls.js version 1.6.5`)}catch(l){return N()}o.forEach(l=>{be[l]=fe(l,h)})}else k(be,s);return s}const se=be;function ke(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 ze(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 m=new TextDecoder("utf-8").decode(h);if(t){const v=m.indexOf("\0");return v!==-1?m.substring(0,v):m}return m.replace(/\0/g,"")}const n=h.length;let s,o,l,c="",p=0;for(;p<n;){if(s=h[p++],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[p++],c+=String.fromCharCode((s&31)<<6|o&63);break;case 14:o=h[p++],l=h[p++],c+=String.fromCharCode((s&15)<<12|(o&63)<<6|(l&63)<<0);break}}return c}const te={hexDump:function(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 h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var q={exports:{}},Q;function de(){return Q||(Q=1,function(h,t){(function(n){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,o=/^(?=([^\/?#]*))\1([^]*)$/,l=/(?:\/|^)\.(?=\/)/g,c=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,p={buildAbsoluteURL:function(_,m,v){if(v=v||{},_=_.trim(),m=m.trim(),!m){if(!v.alwaysNormalize)return _;var y=p.parseURL(_);if(!y)throw new Error("Error trying to parse base URL.");return y.path=p.normalizePath(y.path),p.buildURLFromParts(y)}var S=p.parseURL(m);if(!S)throw new Error("Error trying to parse relative URL.");if(S.scheme)return v.alwaysNormalize?(S.path=p.normalizePath(S.path),p.buildURLFromParts(S)):m;var C=p.parseURL(_);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var D=o.exec(C.path);C.netLoc=D[1],C.path=D[2]}C.netLoc&&!C.path&&(C.path="/");var K={scheme:C.scheme,netLoc:S.netLoc,path:null,params:S.params,query:S.query,fragment:S.fragment};if(!S.netLoc&&(K.netLoc=C.netLoc,S.path[0]!=="/"))if(!S.path)K.path=C.path,S.params||(K.params=C.params,S.query||(K.query=C.query));else{var B=C.path,ee=B.substring(0,B.lastIndexOf("/")+1)+S.path;K.path=p.normalizePath(ee)}return K.path===null&&(K.path=v.alwaysNormalize?p.normalizePath(S.path):S.path),p.buildURLFromParts(K)},parseURL:function(_){var m=s.exec(_);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[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=p})()}(q)),q.exports}var ie=de();class L{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 A={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class W{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,Pe(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={[A.AUDIO]:null,[A.VIDEO]:null,[A.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 L),this._stats}set stats(t){this._stats=t}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ie.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[A.AUDIO]=null,t[A.VIDEO]=null,t[A.AUDIOVIDEO]=null}}function le(h){return h.sn!=="initSegment"}class et extends W{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){const t=this.byteRange[0],n=this.byteRange[1];if(ue(t)&&ue(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)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const t=ue(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){const n=Object.keys(this.levelkeys),s=n.length;if(s>1||s===1&&this.levelkeys[n[0]].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(!ue(t)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=t}get ref(){return le(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:p}=this,_=p[t];if(!_){p[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 pt extends W{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 Kt(h,t){const n=Object.getPrototypeOf(h);if(n){const s=Object.getOwnPropertyDescriptor(n,t);return s||Kt(n,t)}}function Pe(h,t){const n=Kt(h,t);n&&(n.enumerable=!0,Object.defineProperty(h,t,n))}const Zt=Math.pow(2,32)-1,It=[].push,bt={video:1,audio:2,id3:3,text:4};function Oe(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 $e(h,t){const n=ei(h,t);return n<0?4294967296+n:n}function jt(h,t){let n=$e(h,t);return n*=Math.pow(2,32),n+=$e(h,t+4),n}function ei(h,t){return h[t]<<24|h[t+1]<<16|h[t+2]<<8|h[t+3]}function Ce(h,t,n){h[t]=n>>24,h[t+1]=n>>16&255,h[t+2]=n>>8&255,h[t+3]=n&255}function Ne(h){const t=h.byteLength;for(let n=0;n<t;){const s=$e(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 pe(h,t){const n=[];if(!t.length)return n;const s=h.byteLength;for(let o=0;o<s;){const l=$e(h,o),c=Oe(h.subarray(o+4,o+8)),p=l>1?o+l:s;if(c===t[0])if(t.length===1)n.push(h.subarray(o+8,p));else{const _=pe(h.subarray(o+8,p),t.slice(1));_.length&&It.apply(n,_)}o=p}return n}function Je(h){const t=[],n=h[0];let s=8;const o=$e(h,s);s+=4;let l=0,c=0;n===0?(l=$e(h,s),c=$e(h,s+4),s+=8):(l=jt(h,s),c=jt(h,s+8),s+=16),s+=2;let p=h.length+c;const _=mt(h,s);s+=2;for(let m=0;m<_;m++){let v=s;const y=$e(h,v);v+=4;const S=y&2147483647;if((y&2147483648)>>>31===1)return se.warn("SIDX has hierarchical references (not supported)"),null;const D=$e(h,v);v+=4,t.push({referenceSize:S,subsegmentDuration:D,info:{duration:D/o,start:p,end:p+S-1}}),p+=S,v+=4,s=v}return{earliestPresentationTime:l,timescale:o,version:n,referencesCount:_,references:t}}function ot(h){const t=[],n=pe(h,["moov","trak"]);for(let o=0;o<n.length;o++){const l=n[o],c=pe(l,["tkhd"])[0];if(c){let p=c[0];const _=$e(c,p===0?12:20),m=pe(l,["mdia","mdhd"])[0];if(m){p=m[0];const v=$e(m,p===0?12:20),y=pe(l,["mdia","hdlr"])[0];if(y){const S=Oe(y.subarray(8,12)),C={soun:A.AUDIO,vide:A.VIDEO}[S],D=pe(l,["mdia","minf","stbl","stsd"])[0],K=Qe(D);C?(t[_]={timescale:v,type:C,stsd:K},t[C]=M({timescale:v,id:_},K)):t[_]={timescale:v,type:S,stsd:K}}}}}return pe(h,["moov","mvex","trex"]).forEach(o=>{const l=$e(o,4),c=t[l];c&&(c.default={duration:$e(o,12),flags:$e(o,20)})}),t}function Qe(h){const t=h.subarray(8),n=t.subarray(86),s=Oe(t.subarray(4,8));let o=s,l;const c=s==="enca"||s==="encv";if(c){const m=pe(t,[s])[0].subarray(s==="enca"?28:78);pe(m,["sinf"]).forEach(y=>{const S=pe(y,["schm"])[0];if(S){const C=Oe(S.subarray(4,8));if(C==="cbcs"||C==="cenc"){const D=pe(y,["frma"])[0];D&&(o=Oe(D))}}})}const p=o;switch(o){case"avc1":case"avc2":case"avc3":case"avc4":{const _=pe(n,["avcC"])[0];_&&_.length>3&&(o+="."+Ze(_[1])+Ze(_[2])+Ze(_[3]),l=Z(p==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const _=pe(t,[s])[0],m=pe(_.subarray(28),["esds"])[0];if(m&&m.length>7){let v=4;if(m[v++]!==3)break;v=Be(m,v),v+=2;const y=m[v++];if(y&128&&(v+=2),y&64&&(v+=m[v++]),m[v++]!==4)break;v=Be(m,v);const S=m[v++];if(S===64)o+="."+Ze(S);else break;if(v+=12,m[v++]!==5)break;v=Be(m,v);const C=m[v++];let D=(C&248)>>3;D===31&&(D+=1+((C&7)<<3)+((m[v]&224)>>5)),o+="."+D}break}case"hvc1":case"hev1":{const _=pe(n,["hvcC"])[0];if(_&&_.length>12){const m=_[1],v=["","A","B","C"][m>>6],y=m&31,S=$e(_,2),C=(m&32)>>5?"H":"L",D=_[12],K=_.subarray(6,12);o+="."+v+y,o+="."+ve(S).toString(16).toUpperCase(),o+="."+C+D;let B="";for(let ee=K.length;ee--;){const _e=K[ee];(_e||B)&&(B="."+_e.toString(16).toUpperCase()+B)}o+=B}l=Z(p=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{o=Z(o,n)||o;break}case"vp09":{const _=pe(n,["vpcC"])[0];if(_&&_.length>6){const m=_[4],v=_[5],y=_[6]>>4&15;o+="."+lt(m)+"."+lt(v)+"."+lt(y)}break}case"av01":{const _=pe(n,["av1C"])[0];if(_&&_.length>2){const m=_[1]>>>5,v=_[1]&31,y=_[2]>>>7?"H":"M",S=(_[2]&64)>>6,C=(_[2]&32)>>5,D=m===2&&S?C?12:10:S?10:8,K=(_[2]&16)>>4,B=(_[2]&8)>>3,ee=(_[2]&4)>>2,_e=_[2]&3;o+="."+m+"."+lt(v)+y+"."+lt(D)+"."+K+"."+B+ee+_e+"."+lt(1)+"."+lt(1)+"."+lt(1)+"."+0,l=Z("dav1",n)}break}}return{codec:o,encrypted:c,supplemental:l}}function Z(h,t){const n=pe(t,["dvvC"]),s=n.length?n[0]:pe(t,["dvcC"])[0];if(s){const o=s[2]>>1&127,l=s[2]<<5&32|s[3]>>3&31;return h+"."+lt(o)+"."+lt(l)}}function ve(h){let t=0;for(let n=0;n<32;n++)t|=(h>>n&1)<<31-n;return t>>>0}function Be(h,t){const n=t+5;for(;h[t++]&128&&t<n;);return t}function Ze(h){return("0"+h.toString(16).toUpperCase()).slice(-2)}function lt(h){return(h<10?"0":"")+h}function yt(h,t){if(!h||!t)return h;const n=t.keyId;return n&&t.isCommonEncryption&&pe(h,["moov","trak"]).forEach(o=>{const c=pe(o,["mdia","minf","stbl","stsd"])[0].subarray(8);let p=pe(c,["enca"]);const _=p.length>0;_||(p=pe(c,["encv"])),p.forEach(m=>{const v=_?m.subarray(28):m.subarray(78);pe(v,["sinf"]).forEach(S=>{const C=Yt(S);if(C){const D=C.subarray(8,24);D.some(K=>K!==0)||(se.log(`[eme] Patching keyId in 'enc${_?"a":"v"}>sinf>>tenc' box: ${te.hexDump(D)} -> ${te.hexDump(n)}`),C.set(n,8))}})})}),h}function Yt(h){const t=pe(h,["schm"])[0];if(t){const n=Oe(t.subarray(4,8));if(n==="cbcs"||n==="cenc")return pe(h,["schi","tenc"])[0]}return null}function gt(h,t,n){const s={},o=pe(h,["moof","traf"]);for(let l=0;l<o.length;l++){const c=o[l],p=pe(c,["tfhd"])[0],_=$e(p,4),m=t[_];if(!m)continue;const v=s[_]||(s[_]={start:NaN,duration:0,sampleCount:0,timescale:m.timescale,type:m.type}),y=pe(c,["tfdt"])[0];if(y){const he=y[0];let Ie=$e(y,4);he===1&&(Ie===Zt?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Ie*=Zt+1,Ie+=$e(y,8))),ue(Ie)&&(!ue(v.start)||Ie<v.start)&&(v.start=Ie)}const S=m.default,C=$e(p,0)|(S==null?void 0:S.flags);let D=(S==null?void 0:S.duration)||0;C&8&&(C&2?D=$e(p,12):D=$e(p,8));const K=pe(c,["trun"]);let B=v.start||0,ee=0,_e=D;for(let he=0;he<K.length;he++){const Ie=K[he],Fe=$e(Ie,4),it=v.sampleCount;v.sampleCount+=Fe;const Ke=Ie[3]&1,qe=Ie[3]&4,nt=Ie[2]&1,Ue=Ie[2]&2,Lt=Ie[2]&4,ii=Ie[2]&8;let Ri=8,pi=Fe;for(Ke&&(Ri+=4),qe&&Fe&&(!(Ie[Ri+1]&1)&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=it),Ri+=4,nt?(_e=$e(Ie,Ri),Ri+=4):_e=D,Ue&&(Ri+=4),ii&&(Ri+=4),B+=_e,ee+=_e,pi--);pi--;)nt?(_e=$e(Ie,Ri),Ri+=4):_e=D,Ue&&(Ri+=4),Lt&&(Ie[Ri+1]&1||v.keyFrameIndex===void 0&&(v.keyFrameIndex=v.sampleCount-(pi+1),v.keyFrameStart=B),Ri+=4),ii&&(Ri+=4),B+=_e,ee+=_e;!ee&&D&&(ee+=D*Fe)}v.duration+=ee}if(!Object.keys(s).some(l=>s[l].duration)){let l=1/0,c=0;const p=pe(h,["sidx"]);for(let _=0;_<p.length;_++){const m=Je(p[_]);if(m!=null&&m.references){l=Math.min(l,m.earliestPresentationTime/m.timescale);const v=m.references.reduce((y,S)=>y+S.info.duration||0,0);c=Math.max(c,v+m.earliestPresentationTime/m.timescale)}}c&&ue(c)&&Object.keys(s).forEach(_=>{s[_].duration||(s[_].duration=c*s[_].timescale-s[_].start)})}return s}function Se(h,t,n){pe(t,["moof","traf"]).forEach(s=>{pe(s,["tfhd"]).forEach(o=>{const l=$e(o,4),c=h[l];if(!c)return;const p=c.timescale||9e4;pe(s,["tfdt"]).forEach(_=>{const m=_[0],v=n*p;if(v){let y=$e(_,4);if(m===0)y-=v,y=Math.max(y,0),Ce(_,4,y);else{y*=Math.pow(2,32),y+=$e(_,8),y-=v,y=Math.max(y,0);const S=Math.floor(y/(Zt+1)),C=Math.floor(y%(Zt+1));Ce(_,4,S),Ce(_,8,C)}}})})})}function kt(h){const t={valid:null,remainder:null},n=pe(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 Nt(h,t){const n=new Uint8Array(h.length+t.length);return n.set(h),n.set(t,h.length),n}function qt(h,t){const n=[],s=t.samples,o=t.timescale,l=t.id;let c=!1;return pe(s,["moof"]).map(_=>{const m=_.byteOffset-8;pe(_,["traf"]).map(y=>{const S=pe(y,["tfdt"]).map(C=>{const D=C[0];let K=$e(C,4);return D===1&&(K*=Math.pow(2,32),K+=$e(C,8)),K/o})[0];return S!==void 0&&(h=S),pe(y,["tfhd"]).map(C=>{const D=$e(C,4),K=$e(C,0)&16777215,B=(K&1)!==0,ee=(K&2)!==0,_e=(K&8)!==0;let he=0;const Ie=(K&16)!==0;let Fe=0;const it=(K&32)!==0;let Ke=8;D===l&&(B&&(Ke+=8),ee&&(Ke+=4),_e&&(he=$e(C,Ke),Ke+=4),Ie&&(Fe=$e(C,Ke),Ke+=4),it&&(Ke+=4),t.type==="video"&&(c=Te(t.codec)),pe(y,["trun"]).map(qe=>{const nt=qe[0],Ue=$e(qe,0)&16777215,Lt=(Ue&1)!==0;let ii=0;const Ri=(Ue&4)!==0,pi=(Ue&256)!==0;let gi=0;const Qt=(Ue&512)!==0;let yi=0;const Ei=(Ue&1024)!==0,zt=(Ue&2048)!==0;let Ht=0;const Zi=$e(qe,4);let zi=8;Lt&&(ii=$e(qe,zi),zi+=4),Ri&&(zi+=4);let tn=ii+m;for(let mn=0;mn<Zi;mn++){if(pi?(gi=$e(qe,zi),zi+=4):gi=he,Qt?(yi=$e(qe,zi),zi+=4):yi=Fe,Ei&&(zi+=4),zt&&(nt===0?Ht=$e(qe,zi):Ht=ei(qe,zi),zi+=4),t.type===A.VIDEO){let un=0;for(;un<yi;){const Zn=$e(s,tn);if(tn+=4,Re(c,s[tn])){const Tr=s.subarray(tn,tn+Zn);st(Tr,c?2:1,h+Ht/o,n)}tn+=Zn,un+=Zn+4}}h+=gi/o}}))})})}),n}function Te(h){if(!h)return!1;const t=h.substring(0,4);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function Re(h,t){if(h){const n=t>>1&63;return n===39||n===40}else return(t&31)===6}function st(h,t,n,s){const o=vt(h);let l=0;l+=t;let c=0,p=0,_=0;for(;l<o.length;){c=0;do{if(l>=o.length)break;_=o[l++],c+=_}while(_===255);p=0;do{if(l>=o.length)break;_=o[l++],p+=_}while(_===255);const m=o.length-l;let v=l;if(p<m)l+=p;else if(p>m){se.error(`Malformed SEI payload. ${p} is too small, only ${m} bytes left to parse.`);break}if(c===4){if(o[v++]===181){const S=mt(o,v);if(v+=2,S===49){const C=$e(o,v);if(v+=4,C===1195456820){const D=o[v++];if(D===3){const K=o[v++],B=31&K,ee=64&K,_e=ee?2+B*3:0,he=new Uint8Array(_e);if(ee){he[0]=K;for(let Ie=1;Ie<_e;Ie++)he[Ie]=o[v++]}s.push({type:D,payloadType:c,pts:n,bytes:he})}}}}}else if(c===5&&p>16){const y=[];for(let D=0;D<16;D++){const K=o[v++].toString(16);y.push(K.length==1?"0"+K:K),(D===3||D===5||D===7||D===9)&&y.push("-")}const S=p-16,C=new Uint8Array(S);for(let D=0;D<S;D++)C[D]=o[v++];s.push({payloadType:c,pts:n,uuid:y.join(""),userData:Rt(C),userDataBytes:C})}}}function vt(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 je(h){const t=h[0];let n="",s="",o=0,l=0,c=0,p=0,_=0,m=0;if(t===0){for(;Oe(h.subarray(m,m+1))!=="\0";)n+=Oe(h.subarray(m,m+1)),m+=1;for(n+=Oe(h.subarray(m,m+1)),m+=1;Oe(h.subarray(m,m+1))!=="\0";)s+=Oe(h.subarray(m,m+1)),m+=1;s+=Oe(h.subarray(m,m+1)),m+=1,o=$e(h,12),l=$e(h,16),p=$e(h,20),_=$e(h,24),m=28}else if(t===1){m+=4,o=$e(h,m),m+=4;const y=$e(h,m);m+=4;const S=$e(h,m);for(m+=4,c=Ea(2,32)*y+S,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")),p=$e(h,m),m+=4,_=$e(h,m),m+=4;Oe(h.subarray(m,m+1))!=="\0";)n+=Oe(h.subarray(m,m+1)),m+=1;for(n+=Oe(h.subarray(m,m+1)),m+=1;Oe(h.subarray(m,m+1))!=="\0";)s+=Oe(h.subarray(m,m+1)),m+=1;s+=Oe(h.subarray(m,m+1)),m+=1}const v=h.subarray(m,h.byteLength);return{schemeIdUri:n,value:s,timeScale:o,presentationTime:c,presentationTimeDelta:l,eventDuration:p,id:_,payload:v}}function Dt(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 Ct(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&&n.byteLength>0&&new DataView(c.buffer).setUint32(0,n.byteLength,!1),Dt([112,115,115,104],new Uint8Array([s,0,0,0]),h,l,o,c,n||new Uint8Array)}function Et(h){const t=[];if(h instanceof ArrayBuffer){const n=h.byteLength;let s=0;for(;s+32<n;){const o=new DataView(h,s),l=Ut(o);t.push(l),s+=l.size}}return t}function Ut(h){const t=h.getUint32(0),n=h.byteOffset,s=h.byteLength;if(s<t)return{offset:n,size:s};if(h.getUint32(4)!==1886614376)return{offset:n,size:t};const l=h.getUint32(8)>>>24;if(l!==0&&l!==1)return{offset:n,size:t};const c=h.buffer,p=te.hexDump(new Uint8Array(c,n+12,16)),_=h.getUint32(28);let m=null,v=null;if(l===0){if(t-32<_||_<22)return{offset:n,size:t};v=new Uint8Array(c,n+32,_)}else if(l===1){if(!_||s<n+32+_*16+16)return{offset:n,size:t};m=[];for(let y=0;y<_;y++)m.push(new Uint8Array(c,n+32+y*16,16))}return{version:l,systemId:p,kids:m,data:v,offset:n,size:t}}const Xt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Xe={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Vt(h,t){const n=Xe[t];return!!n&&!!n[h.slice(0,4)]}function De(h,t,n=!0){return!h.split(",").some(s=>!xe(s,t,n))}function xe(h,t,n=!0){var s;const o=ke(n);return(s=o==null?void 0:o.isTypeSupported(Ee(h,t)))!=null?s:!1}function Ee(h,t){return`${t}/mp4;codecs=${h}`}function U(h){if(h){const t=h.substring(0,4);return Xe.video[t]}return 2}function H(h){const t=Xt();return h.split(",").reduce((n,s)=>{const l=t&&Te(s)?9:Xe.video[s];return l?(l*2+n)/(n?3:2):(Xe.audio[s]+n)/(n?2:1)},0)}const ae={};function ce(h,t=!0){if(ae[h])return ae[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(xe(n[o],"audio",t))return ae[h]=n[o],n[o];if(n[o]==="mp3"&&(s=ke(t))!=null&&s.isTypeSupported("audio/mpeg"))return""}return h}const ye=/flac|opus|mp4a\.40\.34/i;function ct(h,t=!0){return h.replace(ye,n=>ce(n.toLowerCase(),t))}function _t(h,t){const n=[];if(h){const s=h.split(",");for(let o=0;o<s.length;o++)Vt(s[o],"video")||n.push(s[o])}return t&&n.push(t),n.join(",")}function ut(h,t){if(h&&(h.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(h)!==-1))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 Gt(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 ni(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 di(h){const t=ke(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 ti(h){return h.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Tt={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function ai(h,t){return{supported:!1,configurations:t,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:h}}const Di={};function Ti(h,t,n,s,o,l){const c=h.audioCodec?h.audioGroups:null,p=l==null?void 0:l.audioCodec,_=l==null?void 0:l.channels,m=_?parseInt(_):p?1/0:2;let v=null;if(c!=null&&c.length)try{c.length===1&&c[0]?v=t.groups[c[0]].channels:v=c.reduce((y,S)=>{if(S){const C=t.groups[S];if(!C)throw new Error(`Audio track group ${S} not found`);Object.keys(C.channels).forEach(D=>{y[D]=(y[D]||0)+C.channels[D]})}return y},{2:0})}catch(y){return!0}return h.videoCodec!==void 0&&(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))||!!v&&ue(m)&&Object.keys(v).some(y=>parseInt(y)>m)}function Ii(h,t,n){const s=h.videoCodec,o=h.audioCodec;if(!s&&!o||!n)return Promise.resolve(Tt);const l=[];if(s){const c={width:h.width,height:h.height,bitrate:Math.ceil(Math.max(h.bitrate*.9,h.averageBitrate)),framerate:h.frameRate||30},p=h.videoRange;p!=="SDR"&&(c.transferFunction=p.toLowerCase());const _=s.split(","),m=navigator.userAgent;if(_.some(v=>Te(v))&&Xt())return Promise.resolve(ai(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${m})`),l));l.push.apply(l,_.map(v=>({type:"media-source",video:M(M({},c),{},{contentType:Ee(ni(v),"video")})})))}return o&&h.audioGroups&&h.audioGroups.forEach(c=>{var p;c&&((p=t.groups[c])==null||p.tracks.forEach(_=>{if(_.groupId===c){const m=_.channels||"",v=parseFloat(m);ue(v)&&v>2&&l.push.apply(l,o.split(",").map(y=>({type:"media-source",audio:{contentType:Ee(y,"audio"),channels:""+v}})))}}))}),Promise.all(l.map(c=>{const p=mi(c);return Di[p]||(Di[p]=n.decodingInfo(c))})).then(c=>({supported:!c.some(p=>!p.supported),configurations:l,decodingInfoResults:c})).catch(c=>({supported:!1,configurations:l,decodingInfoResults:[],error:c}))}function mi(h){const{audio:t,video:n}=h,s=n||t;if(s){const o=ti(s.contentType);if(n)return`r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${o}_${Math.ceil(n.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${o}`}return""}const ui=["NONE","TYPE-0","TYPE-1",null];function Wi(h){return ui.indexOf(h)>-1}const Ui=["SDR","PQ","HLG"];function on(h){return!!h&&Ui.indexOf(h)>-1}var qi={No:"",Yes:"YES",v2:"v2"};function lr(h){const{canSkipUntil:t,canSkipDateRanges:n,age:s}=h,o=s<t/2;return t&&o?n?qi.v2:qi.Yes:qi.No}class Li{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 Ni{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 dn(this._audioGroups,t)}hasSubtitleGroup(t){return dn(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 dn(h,t){return!t||!h?!1:h.indexOf(t)!==-1}function Fi(){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 vn(h,t){let n=!1,s=[];if(h&&(n=h!=="SDR",s=[h]),t){s=t.allowedVideoRanges||Ui.slice(0);const o=s.join("")!=="SDR"&&!t.videoCodec;n=t.preferHDR!==void 0?t.preferHDR:o&&Fi(),n||(s=["SDR"])}return{preferHDR:n,allowedVideoRanges:s}}const an=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}},Vi=(h,t)=>JSON.stringify(h,an(t));function hn(h,t,n,s,o){const l=Object.keys(h),c=s==null?void 0:s.channels,p=s==null?void 0:s.audioCodec,_=o==null?void 0:o.videoCodec,m=c&&parseInt(c)===2;let v=!1,y=!1,S=1/0,C=1/0,D=1/0,K=1/0,B=0,ee=[];const{preferHDR:_e,allowedVideoRanges:he}=vn(t,o);for(let qe=l.length;qe--;){const nt=h[l[qe]];v||(v=nt.channels[2]>0),S=Math.min(S,nt.minHeight),C=Math.min(C,nt.minFramerate),D=Math.min(D,nt.minBitrate),he.filter(Lt=>nt.videoRanges[Lt]>0).length>0&&(y=!0)}S=ue(S)?S:0,C=ue(C)?C:0;const Ie=Math.max(1080,S),Fe=Math.max(30,C);D=ue(D)?D:n,n=Math.max(D,n),y||(t=void 0);const it=l.length>1;return{codecSet:l.reduce((qe,nt)=>{const Ue=h[nt];if(nt===qe)return qe;if(ee=y?he.filter(Lt=>Ue.videoRanges[Lt]>0):[],it){if(Ue.minBitrate>n)return kn(nt,`min bitrate of ${Ue.minBitrate} > current estimate of ${n}`),qe;if(!Ue.hasDefaultAudio)return kn(nt,"no renditions with default or auto-select sound found"),qe;if(p&&nt.indexOf(p.substring(0,4))%5!==0)return kn(nt,`audio codec preference "${p}" not found`),qe;if(c&&!m){if(!Ue.channels[c])return kn(nt,`no renditions with ${c} channel sound found (channels options: ${Object.keys(Ue.channels)})`),qe}else if((!p||m)&&v&&Ue.channels[2]===0)return kn(nt,"no renditions with stereo sound found"),qe;if(Ue.minHeight>Ie)return kn(nt,`min resolution of ${Ue.minHeight} > maximum of ${Ie}`),qe;if(Ue.minFramerate>Fe)return kn(nt,`min framerate of ${Ue.minFramerate} > maximum of ${Fe}`),qe;if(!ee.some(Lt=>Ue.videoRanges[Lt]>0))return kn(nt,`no variants with VIDEO-RANGE of ${Vi(ee)} found`),qe;if(_&&nt.indexOf(_.substring(0,4))%5!==0)return kn(nt,`video codec preference "${_}" not found`),qe;if(Ue.maxScore<B)return kn(nt,`max score of ${Ue.maxScore} < selected max of ${B}`),qe}return qe&&(H(nt)>=H(qe)||Ue.fragmentError>h[qe].fragmentError)?qe:(K=Ue.minIndex,B=Ue.maxScore,nt)},void 0),videoRanges:ee,preferHDR:_e,minFramerate:C,minBitrate:D,minIndex:K}}function kn(h,t){se.log(`[abr] start candidates with "${h}" ignored because ${t}`)}function Dr(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 ki(h,t,n,s){return h.slice(n,s+1).reduce((o,l,c)=>{if(!l.codecSet)return o;const p=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:!p,fragmentError:0}),_.minBitrate=Math.min(_.minBitrate,l.bitrate);const m=Math.min(l.height,l.width);return _.minHeight=Math.min(_.minHeight,m),_.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,p&&p.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(S=>{_.channels[S]=(_.channels[S]||0)+y.channels[S]}))}),o},{})}function oi(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 Me(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(tt(h,o,n))return s}return-1}function tt(h,t,n){const{groupId:s,name:o,lang:l,assocLang:c,default:p}=h,_=h.forced;return(s===void 0||t.groupId===s)&&(o===void 0||t.name===o)&&(l===void 0||xt(l,t.lang))&&(l===void 0||t.assocLang===c)&&(p===void 0||t.default===p)&&(_===void 0||t.forced===_)&&(!("characteristics"in h)||ht(h.characteristics||"",t.characteristics))&&(n===void 0||n(h,t))}function xt(h,t="--"){return h.length===t.length?h===t:h.startsWith(t)||t.startsWith(h)}function ht(h,t=""){const n=h.split(","),s=t.split(",");return n.length===s.length&&!n.some(o=>s.indexOf(o)===-1)}function St(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 at(h,t,n,s,o){const l=t[s],p=t.reduce((S,C,D)=>{const K=C.uri;return(S[K]||(S[K]=[])).push(D),S},{})[l.uri];p.length>1&&(s=Math.max.apply(Math,p));const _=l.videoRange,m=l.frameRate,v=l.codecSet.substring(0,4),y=ft(t,s,S=>{if(S.videoRange!==_||S.frameRate!==m||S.codecSet.substring(0,4)!==v)return!1;const C=S.audioGroups,D=n.filter(K=>!C||C.indexOf(K.groupId)!==-1);return Me(h,D,o)>-1});return y>-1?y:ft(t,s,S=>{const C=S.audioGroups,D=n.filter(K=>!C||C.indexOf(K.groupId)!==-1);return Me(h,D,o)>-1})}function ft(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 Pt(h,t){var n;return!!h&&h!==((n=t.loadLevelObj)==null?void 0:n.uri)}class Jt extends G{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.bwEstimator=void 0,this._abandonRulesCheck=n=>{var s;const{fragCurrent:o,partCurrent:l,hls:c}=this,{autoLevelEnabled:p,media:_}=c;if(!o||!_)return;const m=performance.now(),v=l?l.stats:o.stats,y=l?l.duration:o.duration,S=m-v.loading.start,C=c.minAutoLevel,D=o.level,K=this._nextAutoLevel;if(v.aborted||v.loaded&&v.loaded===v.total||D<=C){this.clearTimer(),this._nextAutoLevel=-1;return}if(!p)return;const B=K>-1&&K!==D,ee=!!n||B;if(!ee&&(_.paused||!_.playbackRate||!_.readyState))return;const _e=c.mainForwardBufferInfo;if(!ee&&_e===null)return;const he=this.bwEstimator.getEstimateTTFB(),Ie=Math.abs(_.playbackRate);if(S<=Math.max(he,1e3*(y/(Ie*2))))return;const Fe=_e?_e.len/Ie:0,it=v.loading.first?v.loading.first-v.loading.start:-1,Ke=v.loaded&&it>-1,qe=this.getBwEstimate(),nt=c.levels,Ue=nt[D],Lt=Math.max(v.loaded,Math.round(y*(o.bitrate||Ue.averageBitrate)/8));let ii=Ke?S-it:S;ii<1&&Ke&&(ii=Math.min(S,v.loaded*8/qe));const Ri=Ke?v.loaded*1e3/ii:0,pi=he/1e3,gi=Ri?(Lt-v.loaded)/Ri:Lt*8/qe+pi;if(gi<=Fe)return;const Qt=Ri?Ri*8:qe,yi=((s=(n==null?void 0:n.details)||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,Ei=this.hls.config.abrBandWidthUpFactor;let zt=Number.POSITIVE_INFINITY,Ht;for(Ht=D-1;Ht>C;Ht--){const mn=nt[Ht].maxBitrate,un=!nt[Ht].details||yi;if(zt=this.getTimeToLoadFrag(pi,Qt,y*mn,un),zt<Math.min(Fe,y+pi))break}if(zt>=gi||zt>y*10)return;Ke?this.bwEstimator.sample(S-Math.min(he,it),v.loaded):this.bwEstimator.sampleTTFB(S);const Zi=nt[Ht].maxBitrate;this.getBwEstimate()*Ei>Zi&&this.resetEstimator(Zi);const zi=this.findBestLevel(Zi,C,Ht,0,Fe,1,1);zi>-1&&(Ht=zi),this.warn(`Fragment ${o.sn}${l?" part "+l.index:""} of level ${D} is loading too slowly;
|
|
|
Fragment duration: ${o.duration.toFixed(3)}
|
|
|
Time to underbuffer: ${Fe.toFixed(3)} s
|
|
|
Estimated load time for current fragment: ${gi.toFixed(3)} s
|
|
|
Estimated load time for down switch fragment: ${zt.toFixed(3)} s
|
|
|
TTFB estimate: ${it|0} ms
|
|
|
Current BW estimate: ${ue(qe)?qe|0:"Unknown"} bps
|
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
|
Switching to level ${Ht} @ ${Zi|0} bps`),c.nextLoadLevel=c.nextAutoLevel=Ht,this.clearTimer();const tn=()=>{if(this.clearTimer(),this.fragCurrent===o&&this.hls.loadLevel===Ht&&Ht>0){const mn=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Ht>0?"and switching down":""}
|
|
|
Fragment duration: ${o.duration.toFixed(3)} s
|
|
|
Time to underbuffer: ${mn.toFixed(3)} s`),o.abortRequests(),this.fragCurrent=this.partCurrent=null,Ht>C){let un=this.findBestLevel(this.hls.levels[C].bitrate,C,Ht,0,mn,1,1);un===-1&&(un=C),this.hls.nextLoadLevel=this.hls.nextAutoLevel=un,this.resetEstimator(this.hls.levels[un].bitrate)}}};B||gi>zt*2?tn():this.timer=self.setInterval(tn,zt*1e3),c.trigger(w.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 ne(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.FRAG_LOADING,this.onFragLoading,this),t.on(w.FRAG_LOADED,this.onFragLoaded,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(w.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.FRAG_LOADING,this.onFragLoading,this),t.off(w.FRAG_LOADED,this.onFragLoaded,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(w.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,n){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(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 J.BUFFER_ADD_CODEC_ERROR:case J.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case J.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(),p=l?l.stats:s.stats,_=c-p.loading.start,m=p.loading.first?p.loading.first-p.loading.start:-1;if(p.loaded&&m>-1){const y=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(_-Math.min(y,m),p.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;ue(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],p=(c.loaded?c.loaded.bytes:0)+o.loaded,_=(c.loaded?c.loaded.duration:0)+l;c.loaded={bytes:p,duration:_},c.realBitrate=Math.round(8*p/_)}if(n.bitrateTest){const l={stats:o,frag:n,part:s,id:n.type};this.onFragBuffered(w.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,p=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 ${p}`),p}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,p=n?n.duration:t?t.duration:0,_=this.getBwEstimate(),m=this.getStarvationDelay();let v=l.abrBandWidthFactor,y=l.abrBandWidthUpFactor;if(m){const B=this.findBestLevel(_,c,o,m,0,v,y);if(B>=0)return this.rebufferNotice=-1,B}let S=p?Math.min(p,l.maxStarvationDelay):l.maxStarvationDelay;if(!m){const B=this.bitrateTestDelay;B&&(S=(p?Math.min(p,l.maxLoadingDelay):l.maxLoadingDelay)-B,this.info(`bitrate test took ${Math.round(1e3*B)}ms, set first fragment max fetchDuration to ${Math.round(1e3*S)} ms`),v=y=1)}const C=this.findBestLevel(_,c,o,m,S,v,y);if(this.rebufferNotice!==C&&(this.rebufferNotice=C,this.info(`${m?"rebuffering expected":"buffer is empty"}, optimal quality level ${C}`)),C>-1)return C;const D=s.levels[c],K=s.loadLevelObj;return K&&(D==null?void 0:D.bitrate)<K.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,p){var _;const m=o+l,v=this.lastLoadedFragLevel,y=v===-1?this.hls.firstLevel:v,{fragCurrent:S,partCurrent:C}=this,{levels:D,allAudioTracks:K,loadLevel:B,config:ee}=this.hls;if(D.length===1)return 0;const _e=D[y],he=!!((_=this.hls.latestLevelDetails)!=null&&_.live),Ie=B===-1||v===-1;let Fe,it="SDR",Ke=(_e==null?void 0:_e.frameRate)||0;const{audioPreference:qe,videoPreference:nt}=ee,Ue=this.audioTracksByGroup||(this.audioTracksByGroup=Dr(K));let Lt=-1;if(Ie){if(this.firstSelection!==-1)return this.firstSelection;const Qt=this.codecTiers||(this.codecTiers=ki(D,Ue,n,s)),yi=hn(Qt,it,t,qe,nt),{codecSet:Ei,videoRanges:zt,minFramerate:Ht,minBitrate:Zi,minIndex:zi,preferHDR:tn}=yi;Lt=zi,Fe=Ei,it=tn?zt[zt.length-1]:zt[0],Ke=Ht,t=Math.max(t,Zi),this.log(`picked start tier ${Vi(yi)}`)}else Fe=_e==null?void 0:_e.codecSet,it=_e==null?void 0:_e.videoRange;const ii=C?C.duration:S?S.duration:0,Ri=this.bwEstimator.getEstimateTTFB()/1e3,pi=[];for(let Qt=s;Qt>=n;Qt--){var gi;const yi=D[Qt],Ei=Qt>y;if(!yi)continue;if(ee.useMediaCapabilities&&!yi.supportedResult&&!yi.supportedPromise){const un=navigator.mediaCapabilities;typeof(un==null?void 0:un.decodingInfo)=="function"&&(Ti(yi,Ue,it,Ke,t,qe)||Te(yi.videoCodec))?(yi.supportedPromise=Ii(yi,Ue,un),yi.supportedPromise.then(Zn=>{if(!this.hls)return;yi.supportedResult=Zn;const Tr=this.hls.levels,ls=Tr.indexOf(yi);Zn.error?this.warn(`MediaCapabilities decodingInfo error: "${Zn.error}" for level ${ls} ${Vi(Zn)}`):Zn.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${ls} ${Vi(Zn)}`),ls>-1&&Tr.length>1&&(this.log(`Removing unsupported level ${ls}`),this.hls.removeLevel(ls),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):yi.supportedResult=Tt}if((Fe&&yi.codecSet!==Fe||it&&yi.videoRange!==it||Ei&&Ke>yi.frameRate||!Ei&&Ke>0&&Ke<yi.frameRate||yi.supportedResult&&!((gi=yi.supportedResult.decodingInfoResults)!=null&&gi[0].smooth))&&(!Ie||Qt!==Lt)){pi.push(Qt);continue}const zt=yi.details,Ht=(C?zt==null?void 0:zt.partTarget:zt==null?void 0:zt.averagetargetduration)||ii;let Zi;Ei?Zi=p*t:Zi=c*t;const zi=ii&&o>=ii*2&&l===0?yi.averageBitrate:yi.maxBitrate,tn=this.getTimeToLoadFrag(Ri,Zi,zi*Ht,zt===void 0);if(Zi>=zi&&(Qt===v||yi.loadError===0&&yi.fragmentError===0)&&(tn<=Ri||!ue(tn)||he&&!this.bitrateTestDelay||tn<m)){const un=this.forcedAutoLevel;return Qt!==B&&(un===-1||un!==B)&&(pi.length&&this.trace(`Skipped level(s) ${pi.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${D[pi[0]].codecs}" ${D[pi[0]].videoRange}; not compatible with "${Fe}" ${it}`),this.info(`switch candidate:${y}->${Qt} adjustedbw(${Math.round(Zi)})-bitrate=${Math.round(Zi-zi)} ttfb:${Ri.toFixed(1)} avgDuration:${Ht.toFixed(1)} maxFetchDuration:${m.toFixed(1)} fetchDuration:${tn.toFixed(1)} firstSelection:${Ie} codecSet:${yi.codecSet} videoRange:${yi.videoRange} hls.loadLevel:${B}`)),Ie&&(this.firstSelection=Qt),Qt}}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 hi={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 Xi(h,t,n){if(t===null||!Array.isArray(h)||!h.length||!ue(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(ji(t,n,c))return c}return null}function li(h,t,n=0,s=0,o=.005){let l=null;if(h){l=t[1+h.sn-t[0].sn]||null;const p=h.endDTS-n;p>0&&p<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)&&Pi(n,s,l)===0||$i(l,h,Math.min(o,s))))return l;const c=hi.search(t,Pi.bind(null,n,s));return c&&(c!==h||!l)?c:l}function $i(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 Pi(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 ji(h,t,n){const s=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-s>h}function Gi(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 hi.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 vi(h){switch(h.details){case J.FRAG_LOAD_TIMEOUT:case J.KEY_LOAD_TIMEOUT:case J.LEVEL_LOAD_TIMEOUT:case J.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Oi(h,t){const n=vi(t);return h.default[`${n?"timeout":"error"}Retry`]}function nn(h,t){const n=h.backoff==="linear"?1:Math.pow(2,t);return Math.min(n*h.retryDelayMs,h.maxRetryDelayMs)}function Ki(h){return M(M({},h),{errorRetry:null,timeoutRetry:null})}function wi(h,t,n,s){if(!h)return!1;const o=s==null?void 0:s.code,l=t<h.maxNumRetry&&(rn(o)||!!n);return h.shouldRetry?h.shouldRetry(h,t,n,s,l):l}function rn(h){return h===0&&navigator.onLine===!1||!!h&&(h<400||h>499)}var Si={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Hi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Bn extends G{constructor(t){super("error-controller",t.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(w.ERROR,this.onError,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off(w.ERROR,this.onError,this),t.off(w.ERROR,this.onErrorOut,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(t==null?void 0:t.type)===P.MAIN?t.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(t,n){var s;if(n.fatal)return;const o=this.hls,l=n.context;switch(n.details){case J.FRAG_LOAD_ERROR:case J.FRAG_LOAD_TIMEOUT:case J.KEY_LOAD_ERROR:case J.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case J.FRAG_PARSING_ERROR:if((s=n.frag)!=null&&s.gap){n.errorAction=Ji();return}case J.FRAG_GAP:case J.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=Si.SendAlternateToPenaltyBox;return}case J.LEVEL_EMPTY_ERROR:case J.LEVEL_PARSING_ERROR:{var c,p;const m=n.parent===P.MAIN?n.level:o.loadLevel;n.details===J.LEVEL_EMPTY_ERROR&&((c=n.context)!=null&&(p=c.levelDetails)!=null&&p.live)?n.errorAction=this.getPlaylistRetryOrSwitchAction(n,m):(n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,m))}return;case J.LEVEL_LOAD_ERROR:case J.LEVEL_LOAD_TIMEOUT:typeof(l==null?void 0:l.level)=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,l.level));return;case J.AUDIO_TRACK_LOAD_ERROR:case J.AUDIO_TRACK_LOAD_TIMEOUT:case J.SUBTITLE_LOAD_ERROR:case J.SUBTITLE_TRACK_LOAD_TIMEOUT:if(l){const m=o.loadLevelObj;if(m&&(l.type===Le.AUDIO_TRACK&&m.hasAudioGroup(l.groupId)||l.type===Le.SUBTITLE_TRACK&&m.hasSubtitleGroup(l.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,o.loadLevel),n.errorAction.action=Si.SendAlternateToPenaltyBox,n.errorAction.flags=Hi.MoveAllAlternatesMatchingHost;return}}return;case J.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const m=o.loadLevelObj,v=m==null?void 0:m.attrs["HDCP-LEVEL"];v?n.errorAction={action:Si.SendAlternateToPenaltyBox,flags:Hi.MoveAllAlternatesMatchingHDCP,hdcpLevel:v}:this.keySystemError(n)}return;case J.BUFFER_ADD_CODEC_ERROR:case J.REMUX_ALLOC_ERROR:case J.BUFFER_APPEND_ERROR:if(!n.errorAction){var _;n.errorAction=this.getLevelSwitchAction(n,(_=n.level)!=null?_:o.loadLevel)}return;case J.INTERNAL_EXCEPTION:case J.BUFFER_APPENDING_ERROR:case J.BUFFER_FULL_ERROR:case J.LEVEL_SWITCH_ERROR:case J.BUFFER_STALLED_ERROR:case J.BUFFER_SEEK_OVER_HOLE:case J.BUFFER_NUDGE_ON_STALL:n.errorAction=Ji();return}n.type===me.KEY_SYSTEM_ERROR&&this.keySystemError(n)}keySystemError(t){const n=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,n)}getPlaylistRetryOrSwitchAction(t,n){const s=this.hls,o=Oi(s.config.playlistLoadPolicy,t),l=this.playlistError++;if(wi(o,l,vi(t),t.response))return{action:Si.RetryRequest,flags:Hi.None,retryConfig:o,retryCount:l};const p=this.getLevelSwitchAction(t,n);return o&&(p.retryConfig=o,p.retryCount=l),p}getFragRetryOrSwitchAction(t){const n=this.hls,s=this.getVariantLevelIndex(t.frag),o=n.levels[s],{fragLoadPolicy:l,keyLoadPolicy:c}=n.config,p=Oi(t.details.startsWith("key")?c:l,t),_=n.levels.reduce((v,y)=>v+y.fragmentError,0);if(o&&(t.details!==J.FRAG_GAP&&o.fragmentError++,wi(p,_,vi(t),t.response)))return{action:Si.RetryRequest,flags:Hi.None,retryConfig:p,retryCount:_};const m=this.getLevelSwitchAction(t,s);return p&&(m.retryConfig=p,m.retryCount=_),m}getLevelSwitchAction(t,n){const s=this.hls;n==null&&(n=s.loadLevel);const o=this.hls.levels[n];if(o){var l,c;const m=t.details;o.loadError++,m===J.BUFFER_APPEND_ERROR&&o.fragmentError++;let v=-1;const{levels:y,loadLevel:S,minAutoLevel:C,maxAutoLevel:D}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const K=(l=t.frag)==null?void 0:l.type,ee=(K===P.AUDIO&&m===J.FRAG_PARSING_ERROR||t.sourceBufferName==="audio"&&(m===J.BUFFER_ADD_CODEC_ERROR||m===J.BUFFER_APPEND_ERROR))&&y.some(({audioCodec:it})=>o.audioCodec!==it),he=t.sourceBufferName==="video"&&(m===J.BUFFER_ADD_CODEC_ERROR||m===J.BUFFER_APPEND_ERROR)&&y.some(({codecSet:it,audioCodec:Ke})=>o.codecSet!==it&&o.audioCodec===Ke),{type:Ie,groupId:Fe}=(c=t.context)!=null?c:{};for(let it=y.length;it--;){const Ke=(it+S)%y.length;if(Ke!==S&&Ke>=C&&Ke<=D&&y[Ke].loadError===0){var p,_;const qe=y[Ke];if(m===J.FRAG_GAP&&K===P.MAIN&&t.frag){const nt=y[Ke].details;if(nt){const Ue=li(t.frag,nt.fragments,t.frag.start);if(Ue!=null&&Ue.gap)continue}}else{if(Ie===Le.AUDIO_TRACK&&qe.hasAudioGroup(Fe)||Ie===Le.SUBTITLE_TRACK&&qe.hasSubtitleGroup(Fe))continue;if(K===P.AUDIO&&(p=o.audioGroups)!=null&&p.some(nt=>qe.hasAudioGroup(nt))||K===P.SUBTITLE&&(_=o.subtitleGroups)!=null&&_.some(nt=>qe.hasSubtitleGroup(nt))||ee&&o.audioCodec===qe.audioCodec||!ee&&o.audioCodec!==qe.audioCodec||he&&o.codecSet===qe.codecSet)continue}v=Ke;break}}if(v>-1&&s.loadLevel!==v)return t.levelRetry=!0,this.playlistError=0,{action:Si.SendAlternateToPenaltyBox,flags:Hi.None,nextAutoLevel:v}}return{action:Si.SendAlternateToPenaltyBox,flags:Hi.MoveAllAlternatesMatchingHost}}onErrorOut(t,n){var s;switch((s=n.errorAction)==null?void 0:s.action){case Si.DoNothing:break;case Si.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==J.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 Si.RetryRequest:break}if(n.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(t){const n=this.hls,s=t.errorAction;if(!s)return;const{flags:o,hdcpLevel:l,nextAutoLevel:c}=s;switch(o){case Hi.None:this.switchLevel(t,c);break;case Hi.MoveAllAlternatesMatchingHDCP:l&&(n.maxHdcpLevel=ui[ui.indexOf(l)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${n.maxHdcpLevel}" or lower`);break}s.resolved||this.switchLevel(t,c)}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===J.BUFFER_ADD_CODEC_ERROR&&t.mimeType&&t.sourceBufferName!=="audiovideo")){const s=ti(t.mimeType),o=this.hls.levels;for(let l=o.length;l--;)o[l][`${t.sourceBufferName}Codec`]===s&&this.hls.removeLevel(l)}}}function Ji(h){const t={action:Si.DoNothing,flags:Hi.None};return h&&(t.resolved=!0),t}var Yi={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class yn{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.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.BUFFER_APPENDED,this.onBufferAppended,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this),t.on(w.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:t}=this;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.BUFFER_APPENDED,this.onBufferAppended,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this),t.off(w.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),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;const c=l.end;if(l.start<=t&&c!==null&&t<=c)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 p=o[l[c]];if((p==null?void 0:p.body.type)===n&&(!s||p.buffered)){const _=p.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(p=>{const _=this.fragments[p];if(!_||c>=_.body.sn)return;if(!_.buffered&&(!_.loaded||l)){_.body.type===s&&this.removeFragment(_.body);return}const m=_.range[t];if(m){if(m.time.length===0){this.removeFragment(_.body);return}m.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=Nn(s),l=this.fragments[o];if(!l||l.buffered&&s.gap)return;const c=!s.relurl;Object.keys(n).forEach(p=>{const _=s.elementaryStreams[p];if(!_)return;const m=n[p],v=c||_.partial===!0;l.range[p]=this.getBufferedTimes(s,t.part,v,m)}),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),bn(l)||this.removeParts(s.sn-1,s.type)):this.removeFragment(l.body)}removeParts(t,n){const s=this.activePartLists[n];s&&(this.activePartLists[n]=Mn(s,o=>o.fragment.sn>=t))}fragBuffered(t,n){const s=Nn(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,p=t.end,_=t.minEndPTS||p,m=t.maxStartPTS||c;for(let v=0;v<o.length;v++){const y=o.start(v)-this.bufferPadding,S=o.end(v)+this.bufferPadding;if(m>=y&&_<=S){l.time.push({startPTS:Math.max(c,o.start(v)),endPTS:Math.min(p,o.end(v))});break}else if(c<S&&p>y){const C=Math.max(c,o.start(v)),D=Math.min(p,o.end(v));D>C&&(l.partial=!0,l.time.push({startPTS:C,endPTS:D}))}else if(p<=y)break}return l}getPartialFragment(t){let n=null,s,o,l,c=0;const{bufferPadding:p,fragments:_}=this;return Object.keys(_).forEach(m=>{const v=_[m];v&&bn(v)&&(o=v.body.start-p,l=v.body.end+p,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||bn(n))}getState(t){const n=Nn(t),s=this.fragments[n];return s?s.buffered?bn(s)?Yi.PARTIAL:Yi.OK:Yi.APPENDING:Yi.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=Nn(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 p=s.type;if(o){let m=this.activePartLists[p];m||(this.activePartLists[p]=m=[]),m.push(o)}this.timeRanges=l;const _=l[c];this.detectEvictedFragments(c,_,p,o)}onFragBuffered(t,n){this.detectPartialFragments(n)}hasFragment(t){const n=Nn(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 p=this.fragments[c];if(!p)return;const _=p.body;_.type!==s||o&&!_.gap||_.start<n&&_.end>t&&(p.buffered||l)&&this.removeFragment(_)})}removeFragment(t){const n=Nn(t);t.clearElementaryStreamInfo();const s=this.activePartLists[t.type];if(s){const o=t.sn;this.activePartLists[t.type]=Mn(s,l=>l.fragment.sn!==o)}delete this.fragments[n],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){var t,n;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const s=(t=this.hls)==null||(n=t.latestLevelDetails)==null?void 0:n.partList;s&&s.forEach(o=>o.clearElementaryStreamInfo())}}function bn(h){var t,n,s;return h.buffered&&(h.body.gap||((t=h.range.video)==null?void 0:t.partial)||((n=h.range.audio)==null?void 0:n.partial)||((s=h.range.audiovideo)==null?void 0:s.partial))}function Nn(h){return`${h.type}_${h.level}_${h.sn}`}function Mn(h,t){return h.filter(n=>{const s=t(n);return s||n.clearElementaryStreamInfo(),s})}var Qi={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 Qi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,t);case Qi.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 $n(h){const t=h.byteLength,n=t&&new DataView(h.buffer).getUint8(t-1);return n?h.slice(0,t-n):h}class xr{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],p=s[3],_=this.invSubMix,m=_[0],v=_[1],y=_[2],S=_[3],C=new Uint32Array(256);let D=0,K=0,B=0;for(B=0;B<256;B++)B<128?C[B]=B<<1:C[B]=B<<1^283;for(B=0;B<256;B++){let ee=K^K<<1^K<<2^K<<3^K<<4;ee=ee>>>8^ee&255^99,t[D]=ee,n[ee]=D;const _e=C[D],he=C[_e],Ie=C[he];let Fe=C[ee]*257^ee*16843008;o[D]=Fe<<24|Fe>>>8,l[D]=Fe<<16|Fe>>>16,c[D]=Fe<<8|Fe>>>24,p[D]=Fe,Fe=Ie*16843009^he*65537^_e*257^D*16843008,m[ee]=Fe<<24|Fe>>>8,v[ee]=Fe<<16|Fe>>>16,y[ee]=Fe<<8|Fe>>>24,S[ee]=Fe,D?(D=_e^C[C[C[Ie^_e]]],K^=C[C[K]]):D=K=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 p,_;const m=this.keySchedule=new Uint32Array(c),v=this.invKeySchedule=new Uint32Array(c),y=this.sBox,S=this.rcon,C=this.invSubMix,D=C[0],K=C[1],B=C[2],ee=C[3];let _e,he;for(p=0;p<c;p++){if(p<l){_e=m[p]=n[p];continue}he=_e,p%l===0?(he=he<<8|he>>>24,he=y[he>>>24]<<24|y[he>>>16&255]<<16|y[he>>>8&255]<<8|y[he&255],he^=S[p/l|0]<<24):l>6&&p%l===4&&(he=y[he>>>24]<<24|y[he>>>16&255]<<16|y[he>>>8&255]<<8|y[he&255]),m[p]=_e=(m[p-l]^he)>>>0}for(_=0;_<c;_++)p=c-_,_&3?he=m[p]:he=m[p-4],_<4||p<=4?v[_]=he:v[_]=D[y[he>>>24]]^K[y[he>>>16&255]]^B[y[he>>>8&255]]^ee[y[he&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,p=this.invSubMix,_=p[0],m=p[1],v=p[2],y=p[3],S=this.uint8ArrayToUint32Array_(s);let C=S[0],D=S[1],K=S[2],B=S[3];const ee=new Int32Array(t),_e=new Int32Array(ee.length);let he,Ie,Fe,it,Ke,qe,nt,Ue,Lt,ii,Ri,pi,gi,Qt;const yi=this.networkToHostOrderSwap;for(;n<ee.length;){for(Lt=yi(ee[n]),ii=yi(ee[n+1]),Ri=yi(ee[n+2]),pi=yi(ee[n+3]),Ke=Lt^l[0],qe=pi^l[1],nt=Ri^l[2],Ue=ii^l[3],gi=4,Qt=1;Qt<o;Qt++)he=_[Ke>>>24]^m[qe>>16&255]^v[nt>>8&255]^y[Ue&255]^l[gi],Ie=_[qe>>>24]^m[nt>>16&255]^v[Ue>>8&255]^y[Ke&255]^l[gi+1],Fe=_[nt>>>24]^m[Ue>>16&255]^v[Ke>>8&255]^y[qe&255]^l[gi+2],it=_[Ue>>>24]^m[Ke>>16&255]^v[qe>>8&255]^y[nt&255]^l[gi+3],Ke=he,qe=Ie,nt=Fe,Ue=it,gi=gi+4;he=c[Ke>>>24]<<24^c[qe>>16&255]<<16^c[nt>>8&255]<<8^c[Ue&255]^l[gi],Ie=c[qe>>>24]<<24^c[nt>>16&255]<<16^c[Ue>>8&255]<<8^c[Ke&255]^l[gi+1],Fe=c[nt>>>24]<<24^c[Ue>>16&255]<<16^c[Ke>>8&255]<<8^c[qe&255]^l[gi+2],it=c[Ue>>>24]<<24^c[Ke>>16&255]<<16^c[qe>>8&255]<<8^c[nt&255]^l[gi+3],_e[n]=yi(he^C),_e[n+1]=yi(it^D),_e[n+2]=yi(Fe^K),_e[n+3]=yi(Ie^B),C=Lt,D=ii,K=Ri,B=pi,n=n+4}return _e.buffer}}class xn{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=An(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}function An(h){switch(h){case Qi.cbc:return"AES-CBC";case Qi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${h}`)}}const fr=16;class Er{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?$n(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 p=ArrayBuffer.isView(t)?t:new Uint8Array(t);this.softwareDecrypt(p,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:p}=this;if(o!==Qi.cbc||n.byteLength!==16)return se.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),p&&(t=Nt(p,t),this.remainderData=null);const _=this.getValidChunk(t);if(!_.length)return null;l&&(s=l);let m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new xr),m.expandKey(n);const v=c;return this.currentResult=m.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 xn(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%fr;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 ur=Math.pow(2,17);class Ir{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 Gn({type:me.NETWORK_ERROR,details:J.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((p,_)=>{if(this.loader&&this.loader.destroy(),t.gap)if(t.tagList.some(D=>D[0]==="GAP")){_(Xn(t));return}else t.gap=!1;const m=this.loader=l?new l(o):new c(o),v=wn(t);t.loader=m;const y=Ki(o.fragLoadPolicy.default),S={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:t.sn==="initSegment"?1/0:ur};t.stats=m.stats;const C={onSuccess:(D,K,B,ee)=>{this.resetLoader(t,m);let _e=D.data;B.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(_e.slice(0,16)),_e=_e.slice(16)),p({frag:t,part:null,payload:_e,networkDetails:ee})},onError:(D,K,B,ee)=>{this.resetLoader(t,m),_(new Gn({type:me.NETWORK_ERROR,details:J.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:M({url:s,data:void 0},D),error:new Error(`HTTP Error ${D.code} ${D.text}`),networkDetails:B,stats:ee}))},onAbort:(D,K,B)=>{this.resetLoader(t,m),_(new Gn({type:me.NETWORK_ERROR,details:J.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:B,stats:D}))},onTimeout:(D,K,B)=>{this.resetLoader(t,m),_(new Gn({type:me.NETWORK_ERROR,details:J.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${S.timeout}ms`),networkDetails:B,stats:D}))}};n&&(C.onProgress=(D,K,B,ee)=>n({frag:t,part:null,payload:B,networkDetails:ee})),m.load(v,S,C)})}loadPart(t,n,s){this.abort();const o=this.config,l=o.fLoader,c=o.loader;return new Promise((p,_)=>{if(this.loader&&this.loader.destroy(),t.gap||n.gap){_(Xn(t,n));return}const m=this.loader=l?new l(o):new c(o),v=wn(t,n);t.loader=m;const y=Ki(o.fragLoadPolicy.default),S={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ur};n.stats=m.stats,m.load(v,S,{onSuccess:(C,D,K,B)=>{this.resetLoader(t,m),this.updateStatsFromPart(t,n);const ee={frag:t,part:n,payload:C.data,networkDetails:B};s(ee),p(ee)},onError:(C,D,K,B)=>{this.resetLoader(t,m),_(new Gn({type:me.NETWORK_ERROR,details:J.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:n,response:M({url:v.url,data:void 0},C),error:new Error(`HTTP Error ${C.code} ${C.text}`),networkDetails:K,stats:B}))},onAbort:(C,D,K)=>{t.stats.aborted=n.stats.aborted,this.resetLoader(t,m),_(new Gn({type:me.NETWORK_ERROR,details:J.INTERNAL_ABORTED,fatal:!1,frag:t,part:n,error:new Error("Aborted"),networkDetails:K,stats:C}))},onTimeout:(C,D,K)=>{this.resetLoader(t,m),_(new Gn({type:me.NETWORK_ERROR,details:J.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:n,error:new Error(`Timeout after ${S.timeout}ms`),networkDetails:K,stats:C}))}})})}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),m=Math.min(Math.round(s.loaded/l),_),y=(_-m)*Math.round(s.loaded/m);s.total=s.loaded+y}else s.total=Math.max(s.loaded,s.total);const c=s.loading,p=o.loading;c.start?c.first+=p.first-p.start:(c.start=p.start,c.first=p.first),c.end=p.end}resetLoader(t,n){t.loader=null,this.loader===n&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),n.destroy()}}function wn(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(ue(o)&&ue(l)){var c;let p=o,_=l;if(h.sn==="initSegment"&&Cr((c=h.decryptdata)==null?void 0:c.method)){const m=l-o;m%16&&(_=l+(16-m%16)),o!==0&&(s.resetIV=!0,p=o-16)}s.rangeStart=p,s.rangeEnd=_}return s}function Xn(h,t){const n=new Error(`GAP ${h.gap?"tag":"attribute"} found`),s={type:me.MEDIA_ERROR,details:J.FRAG_GAP,fatal:!1,frag:h,error:n,networkDetails:null};return t&&(s.part=t),(t||h).stats.aborted=!0,new Gn(s)}function Cr(h){return h==="AES-128"||h==="AES-256"}class Gn extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class pr extends G{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 Rn{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=Jn(),this.buffering={audio:Jn(),video:Jn(),audiovideo:Jn()},this.level=t,this.sn=n,this.id=s,this.size=o,this.part=l,this.partial=c}}function Jn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const mr={length:0,start:()=>0,end:()=>0};class Ai{static isBuffered(t,n){if(t){const s=Ai.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=Ai.getBuffered(t);return Ai.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=Ai.bufferedRanges(t);if(o.length)return Ai.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 S=l[y-1].end;t[v].start-S<s?t[v].end>S&&(l[y-1].end=t[v].end):l.push(t[v])}else l.push(t[v])}else l=t;let c=0,p,_=n,m=n;for(let v=0;v<l.length;v++){const y=l[v].start,S=l[v].end;if(o===-1&&n>=y&&n<=S&&(o=v),n+s>=y&&n<S)_=y,m=S,c=m-n;else if(n+s<y){p=y;break}}return{len:c,start:_||0,end:m||0,nextStart:p,buffered:t,bufferedIndex:o}}static getBuffered(t){try{return t.buffered||mr}catch(n){return se.log("failed to get media.buffered",n),mr}}}const Tn=/\{\$([a-zA-Z0-9-_]+)\}/g;function cr(h){return Tn.test(h)}function gr(h,t){if(h.variableList!==null||h.hasVariableRefs){const n=h.variableList;return t.replace(Tn,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 hr(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 Jr(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 en=/^(\d+)x(\d+)$/,bi=/(.+?)=(".*?"|.*?)(?:,|$)/g;class xi{constructor(t,n){typeof t=="string"&&(t=xi.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=en.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(bi.lastIndex=0;(s=bi.exec(t))!==null;){const c=s[1].trim();let p=s[2];const _=p.indexOf(l)===0&&p.lastIndexOf(l)===p.length-1;let m=!1;if(_)p=p.slice(1,-1);else switch(c){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":m=!0}if(n&&(_||m))p=gr(n,p);else if(!m&&!_)switch(c){case"CLOSED-CAPTIONS":if(p==="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]=p}return o}}const Sn="com.apple.hls.interstitial";function _r(h){return h!=="ID"&&h!=="CLASS"&&h!=="CUE"&&h!=="START-DATE"&&h!=="DURATION"&&h!=="END-DATE"&&h!=="END-ON-NEXT"}function Wn(h){return h==="SCTE35-OUT"||h==="SCTE35-IN"||h==="SCTE35-CMD"}class tr{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 xi({}),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"]);ue(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(ue(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===Sn}get isValid(){return!!this.id&&!this._badValueForSameId&&ue(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 Kn=10;class us{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}get hasProgramDateTime(){return this.fragments.length?ue(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Kn}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(){var t;return(t=this.fragments)!=null&&t.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var t;return(t=this.fragments)!=null&&t.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 ir(h){return h==="AES-128"||h==="AES-256"||h==="AES-256-CTR"}function Qr(h){switch(h){case"AES-128":case"AES-256":return Qi.cbc;case"AES-256-CTR":return Qi.ctr;default:throw new Error(`invalid full segment method ${h}`)}}function Wr(h){return Uint8Array.from(atob(h),t=>t.charCodeAt(0))}function Kr(h){return Uint8Array.from(unescape(encodeURIComponent(h)),t=>t.charCodeAt(0))}function nr(h){const t=Kr(h).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}function jr(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 ms(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=Wr(c)):n=nr(c)}}return n}const rr=typeof self!="undefined"?self:void 0;var Mi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},pn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function sr(h){switch(h){case pn.FAIRPLAY:return Mi.FAIRPLAY;case pn.PLAYREADY:return Mi.PLAYREADY;case pn.WIDEVINE:return Mi.WIDEVINE;case pn.CLEARKEY:return Mi.CLEARKEY}}var es={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function cs(h){if(h===es.WIDEVINE)return Mi.WIDEVINE;if(h===es.PLAYREADY)return Mi.PLAYREADY;if(h===es.CENC||h===es.CLEARKEY)return Mi.CLEARKEY}function xs(h){switch(h){case Mi.FAIRPLAY:return pn.FAIRPLAY;case Mi.PLAYREADY:return pn.PLAYREADY;case Mi.WIDEVINE:return pn.WIDEVINE;case Mi.CLEARKEY:return pn.CLEARKEY}}function ws(h){const{drmSystems:t,widevineLicenseUrl:n}=h,s=t?[Mi.FAIRPLAY,Mi.WIDEVINE,Mi.PLAYREADY,Mi.CLEARKEY].filter(o=>!!t[o]):[];return!s[Mi.WIDEVINE]&&n&&s.push(Mi.WIDEVINE),s}const Ms=function(h){return rr!=null&&(h=rr.navigator)!=null&&h.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function fi(h,t,n,s){let o;switch(h){case Mi.FAIRPLAY:o=["cenc","sinf"];break;case Mi.WIDEVINE:case Mi.PLAYREADY:o=["cenc"];break;case Mi.CLEARKEY:o=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${h}`)}return Bi(o,t,n,s)}function Bi(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 Dn(h){var t;return h.sessionType==="persistent-license"||!!((t=h.sessionTypes)!=null&&t.some(n=>n==="persistent-license"))}function Un(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 p=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(p){const _=Wr(p).subarray(0,16);return jr(_),_}}return null}let In={};class kr{static clearKeyUriToKeyIdMap(){In={}}constructor(t,n,s,o=[1],l=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=n,this.keyFormat=s,this.keyFormatVersions=o,this.iv=l,this.encrypted=t?t!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!ir(t)}isSupported(){if(this.method){if(ir(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case pn.FAIRPLAY:case pn.WIDEVINE:case pn.PLAYREADY:case pn.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(t){if(!this.encrypted||!this.uri)return null;if(ir(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=gs(t);return new kr(this.method,this.uri,"identity",this.keyFormatVersions,s)}const n=ms(this.uri);if(n)switch(this.keyFormat){case pn.WIDEVINE:this.pssh=n,n.length>=22&&(this.keyId=n.subarray(n.length-22,n.length-6));break;case pn.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Ct(s,null,n),this.keyId=Un(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=In[this.uri];if(!s){const o=Object.keys(In).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,o),In[this.uri]=s}this.keyId=s}return this}}function gs(h){const t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=h>>8*(15-n)&255;return t}const ar=/#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,ts=/#EXT-X-MEDIA:(.*)/g,na=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ks=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Xl=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 ie.buildAbsoluteURL(n,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return na.test(t)}static parseMasterPlaylist(t,n){const s=cr(t),o={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},l=[];ar.lastIndex=0;let c;for(;(c=ar.exec(t))!=null;)if(c[1]){var p;const m=new xi(c[1],o),v=gr(o,c[2]),y={attrs:m,bitrate:m.decimalInteger("BANDWIDTH")||m.decimalInteger("AVERAGE-BANDWIDTH"),name:m.NAME,url:qr.resolve(v,n)},S=m.decimalResolution("RESOLUTION");S&&(y.width=S.width,y.height=S.height),ka(m.CODECS,y);const C=m["SUPPLEMENTAL-CODECS"];C&&(y.supplemental={},ka(C,y.supplemental)),(p=y.unknownCodecs)!=null&&p.length||l.push(y),o.levels.push(y)}else if(c[3]){const m=c[3],v=c[4];switch(m){case"SESSION-DATA":{const y=new xi(v,o),S=y["DATA-ID"];S&&(o.sessionData===null&&(o.sessionData={}),o.sessionData[S]=y);break}case"SESSION-KEY":{const y=Qn(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 xi(v,o);hr(o,y,n)}break}case"CONTENT-STEERING":{const y=new xi(v,o);o.contentSteering={uri:qr.resolve(y["SERVER-URI"],n),pathwayId:y["PATHWAY-ID"]||"."};break}case"START":{o.startTimeOffset=ra(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,p={AUDIO:c.map(m=>({id:m.attrs.AUDIO,audioCodec:m.audioCodec})),SUBTITLES:c.map(m=>({id:m.attrs.SUBTITLES,textCodec:m.textCodec})),"CLOSED-CAPTIONS":[]};let _=0;for(ts.lastIndex=0;(o=ts.exec(t))!==null;){const m=new xi(o[1],s),v=m.TYPE;if(v){const y=p[v],S=l[v]||[];l[v]=S;const C=m.LANGUAGE,D=m["ASSOC-LANGUAGE"],K=m.CHANNELS,B=m.CHARACTERISTICS,ee=m["INSTREAM-ID"],_e={attrs:m,bitrate:0,id:_++,groupId:m["GROUP-ID"]||"",name:m.NAME||C||"",type:v,default:m.bool("DEFAULT"),autoselect:m.bool("AUTOSELECT"),forced:m.bool("FORCED"),lang:C,url:m.URI?qr.resolve(m.URI,n):""};if(D&&(_e.assocLang=D),K&&(_e.channels=K),B&&(_e.characteristics=B),ee&&(_e.instreamId=ee),y!=null&&y.length){const he=qr.findGroup(y,_e.groupId)||y[0];hs(_e,he,"audioCodec"),hs(_e,he,"textCodec")}S.push(_e)}}return l}static parseLevelPlaylist(t,n,s,o,l,c){var p;const _={url:n},m=new us(n),v=m.fragments,y=[];let S=null,C=0,D=0,K=0,B=0,ee=0,_e=null,he=new et(o,_),Ie,Fe,it,Ke=-1,qe=!1,nt=null,Ue;if(Ks.lastIndex=0,m.m3u8=t,m.hasVariableRefs=cr(t),((p=Ks.exec(t))==null?void 0:p[0])!=="#EXTM3U")return m.playlistParsingError=new Error("Missing format identifier #EXTM3U"),m;for(;(Ie=Ks.exec(t))!==null;){qe&&(qe=!1,he=new et(o,_),he.playlistOffset=K,he.start=K,he.sn=C,he.cc=B,ee&&(he.bitrate=ee),he.level=s,S&&(he.initSegment=S,S.rawProgramDateTime&&(he.rawProgramDateTime=S.rawProgramDateTime,S.rawProgramDateTime=null),nt&&(he.setByteRange(nt),nt=null)));const pi=Ie[1];if(pi){he.duration=parseFloat(pi);const gi=(" "+Ie[2]).slice(1);he.title=gi||null,he.tagList.push(gi?["INF",pi,gi]:["INF",pi])}else if(Ie[3]){if(ue(he.duration)){he.playlistOffset=K,he.start=K,it&&Eo(he,it,m),he.sn=C,he.level=s,he.cc=B,v.push(he);const gi=(" "+Ie[3]).slice(1);he.relurl=gr(m,gi),ja(he,_e,y),_e=he,K+=he.duration,C++,D=0,qe=!0}}else{if(Ie=Ie[0].match(Xl),!Ie){se.warn("No matches on slow regex match for level playlist!");continue}for(Fe=1;Fe<Ie.length&&Ie[Fe]===void 0;Fe++);const gi=(" "+Ie[Fe]).slice(1),Qt=(" "+Ie[Fe+1]).slice(1),yi=Ie[Fe+2]?(" "+Ie[Fe+2]).slice(1):null;switch(gi){case"BYTERANGE":_e?he.setByteRange(Qt,_e):he.setByteRange(Qt);break;case"PROGRAM-DATE-TIME":he.rawProgramDateTime=Qt,he.tagList.push(["PROGRAM-DATE-TIME",Qt]),Ke===-1&&(Ke=v.length);break;case"PLAYLIST-TYPE":m.type&&Es(m,gi,Ie),m.type=Qt.toUpperCase();break;case"MEDIA-SEQUENCE":m.startSN!==0?Es(m,gi,Ie):v.length>0&&ko(m,gi,Ie),C=m.startSN=parseInt(Qt);break;case"SKIP":{m.skippedSegments&&Es(m,gi,Ie);const Ei=new xi(Qt,m),zt=Ei.decimalInteger("SKIPPED-SEGMENTS");if(ue(zt)){m.skippedSegments+=zt;for(let Zi=zt;Zi--;)v.push(null);C+=zt}const Ht=Ei.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ht&&(m.recentlyRemovedDateranges=(m.recentlyRemovedDateranges||[]).concat(Ht.split(" ")));break}case"TARGETDURATION":m.targetduration!==0&&Es(m,gi,Ie),m.targetduration=Math.max(parseInt(Qt),1);break;case"VERSION":m.version!==null&&Es(m,gi,Ie),m.version=parseInt(Qt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":m.live||Es(m,gi,Ie),m.live=!1;break;case"#":(Qt||yi)&&he.tagList.push(yi?[Qt,yi]:[Qt]);break;case"DISCONTINUITY":B++,he.tagList.push(["DIS"]);break;case"GAP":he.gap=!0,he.tagList.push([gi]);break;case"BITRATE":he.tagList.push([gi,Qt]),ee=parseInt(Qt)*1e3,ue(ee)?he.bitrate=ee:ee=0;break;case"DATERANGE":{const Ei=new xi(Qt,m),zt=new tr(Ei,m.dateRanges[Ei.ID],m.dateRangeTagCount);m.dateRangeTagCount++,zt.isValid||m.skippedSegments?m.dateRanges[zt.id]=zt:se.warn(`Ignoring invalid DATERANGE tag: "${Qt}"`),he.tagList.push(["EXT-X-DATERANGE",Qt]);break}case"DEFINE":{{const Ei=new xi(Qt,m);"IMPORT"in Ei?Jr(m,Ei,c):hr(m,Ei,n)}break}case"DISCONTINUITY-SEQUENCE":m.startCC!==0?Es(m,gi,Ie):v.length>0&&ko(m,gi,Ie),m.startCC=B=parseInt(Qt);break;case"KEY":{const Ei=Qn(Qt,n,m);if(Ei.isSupported()){if(Ei.method==="NONE"){it=void 0;break}it||(it={}),it[Ei.keyFormat]&&(it=k({},it)),it[Ei.keyFormat]=Ei}else se.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${Qt}"`);break}case"START":m.startTimeOffset=ra(Qt);break;case"MAP":{const Ei=new xi(Qt,m);if(he.duration){const zt=new et(o,_);is(zt,Ei,s,it),S=zt,he.initSegment=S,S.rawProgramDateTime&&!he.rawProgramDateTime&&(he.rawProgramDateTime=S.rawProgramDateTime)}else{const zt=he.byteRangeEndOffset;if(zt){const Ht=he.byteRangeStartOffset;nt=`${zt-Ht}@${Ht}`}else nt=null;is(he,Ei,s,it),S=he,qe=!0}S.cc=B;break}case"SERVER-CONTROL":{Ue&&Es(m,gi,Ie),Ue=new xi(Qt),m.canBlockReload=Ue.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Ue.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Ue.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Ue.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Ue.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{m.partTarget&&Es(m,gi,Ie);const Ei=new xi(Qt);m.partTarget=Ei.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Ei=m.partList;Ei||(Ei=m.partList=[]);const zt=D>0?Ei[Ei.length-1]:void 0,Ht=D++,Zi=new xi(Qt,m),zi=new pt(Zi,he,_,Ht,zt);Ei.push(zi),he.duration+=zi.duration;break}case"PRELOAD-HINT":{const Ei=new xi(Qt,m);m.preloadHint=Ei;break}case"RENDITION-REPORT":{const Ei=new xi(Qt,m);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Ei);break}default:se.warn(`line parsed but not handled: ${Ie}`);break}}}_e&&!_e.relurl?(v.pop(),K-=_e.duration,m.partList&&(m.fragmentHint=_e)):m.partList&&(ja(he,_e,y),he.cc=B,m.fragmentHint=he,it&&Eo(he,it,m)),m.targetduration||(m.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Lt=v.length,ii=v[0],Ri=v[Lt-1];if(K+=m.skippedSegments*m.targetduration,K>0&&Lt&&Ri){m.averagetargetduration=K/Lt;const pi=Ri.sn;m.endSN=pi!=="initSegment"?pi:0,m.live||(Ri.endList=!0),ii&&m.startCC===void 0&&(m.startCC=ii.cc),Ke>0&&(Xo(v,Ke),ii&&y.unshift(ii))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(K+=m.fragmentHint.duration),m.totalduration=K,y.length&&m.dateRangeTagCount&&ii&&Ss(y,m),m.endCC=B,m}}function Ss(h,t){const n=h.length;if(!n)return;const s=h[n-1],o=t.live?1/0:t.totalduration,l=Object.keys(t.dateRanges);for(let c=l.length;c--;){const p=t.dateRanges[l[c]],_=p.startDate.getTime();p.tagAnchor=s.ref;for(let m=n;m--;){const v=Wa(t,_,h,m,o);if(v!==-1){p.tagAnchor=t.fragments[v].ref;break}}}}function Wa(h,t,n,s,o){const l=n[s];if(l){const p=l.programDateTime;if(t>=p||s===0){var c;const _=(((c=n[s+1])==null?void 0:c.start)||o)-l.start;if(t<=p+_*1e3){const m=n[s].sn-h.startSN,v=h.fragments;if(v.length>n.length){const S=(n[s+1]||v[v.length-1]).sn-h.startSN;for(let C=S;C>m;C--){const D=v[C].programDateTime;if(t>=D&&t<D+v[C].duration*1e3)return C}}return m}}}return-1}function Qn(h,t,n){var s,o;const l=new xi(h,n),c=(s=l.METHOD)!=null?s:"",p=l.URI,_=l.hexadecimalInteger("IV"),m=l.KEYFORMATVERSIONS,v=(o=l.KEYFORMAT)!=null?o:"identity";p&&l.IV&&!_&&se.error(`Invalid IV: ${l.IV}`);const y=p?qr.resolve(p,t):"",S=(m||"1").split("/").map(Number).filter(Number.isFinite);return new kr(c,y,v,S,_)}function ra(h){const n=new xi(h).decimalFloatingPoint("TIME-OFFSET");return ue(n)?n:null}function ka(h,t){let n=(h||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const o=n.filter(l=>Vt(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 hs(h,t,n){const s=t[n];s&&(h[n]=s)}function Xo(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 ja(h,t,n){h.rawProgramDateTime?n.push(h):t!=null&&t.programDateTime&&(h.programDateTime=t.endProgramDateTime)}function is(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 Eo(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 Es(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function ko(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function Ao(h,t){const n=t.startPTS;if(ue(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 Jo(h,t,n,s,o,l){s-n<=0&&(se.warn("Fragment should have a positive duration",t),s=n+t.duration,l=o+t.duration);let p=n,_=s;const m=t.startPTS,v=t.endPTS;if(ue(m)){const B=Math.abs(m-n);ue(t.deltaPTS)?t.deltaPTS=Math.max(B,t.deltaPTS):t.deltaPTS=B,p=Math.max(n,m),n=Math.min(n,m),o=Math.min(o,t.startDTS),_=Math.min(s,v),s=Math.max(s,v),l=Math.max(l,t.endDTS)}const y=n-t.start;t.start!==0&&t.setStart(n),t.setDuration(s-t.start),t.startPTS=n,t.maxStartPTS=p,t.startDTS=o,t.endPTS=s,t.minEndPTS=_,t.endDTS=l;const S=t.sn;if(!h||S<h.startSN||S>h.endSN)return 0;let C;const D=S-h.startSN,K=h.fragments;for(K[D]=t,C=D;C>0;C--)Ao(K[C],K[C-1]);for(C=D;C<K.length-1;C++)Ao(K[C],K[C+1]);return h.fragmentHint&&Ao(K[K.length-1],h.fragmentHint),h.PTSKnown=h.alignedSliding=!0,y}function Qo(h,t){if(h===t)return;let n=null;const s=h.fragments;for(let m=s.length-1;m>=0;m--){const v=s[m].initSegment;if(v){n=v;break}}h.fragmentHint&&delete h.fragmentHint.endPTS;let o;Rs(h,t,(m,v,y,S)=>{if((!t.startCC||t.skippedSegments)&&v.cc!==m.cc){const C=m.cc-v.cc;for(let D=y;D<S.length;D++)S[D].cc+=C;t.endCC=S[S.length-1].cc}ue(m.startPTS)&&ue(m.endPTS)&&(v.setStart(v.startPTS=m.startPTS),v.startDTS=m.startDTS,v.maxStartPTS=m.maxStartPTS,v.endPTS=m.endPTS,v.endDTS=m.endDTS,v.minEndPTS=m.minEndPTS,v.setDuration(m.endPTS-m.startPTS),v.duration&&(o=v),t.PTSKnown=t.alignedSliding=!0),m.hasStreams&&(v.elementaryStreams=m.elementaryStreams),v.loader=m.loader,m.hasStats&&(v.stats=m.stats),m.initSegment&&(v.initSegment=m.initSegment,n=m.initSegment)});const l=t.fragments,c=t.fragmentHint?l.concat(t.fragmentHint):l;if(n&&c.forEach(m=>{var v;m&&(!m.initSegment||m.initSegment.relurl===((v=n)==null?void 0:v.relurl))&&(m.initSegment=n)}),t.skippedSegments){if(t.deltaUpdateFailed=l.some(m=>!m),t.deltaUpdateFailed){se.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let m=t.skippedSegments;m--;)l.shift();t.startSN=l[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=qa(h.dateRanges,t));const m=h.fragments.filter(v=>v.rawProgramDateTime);if(h.hasProgramDateTime&&!t.hasProgramDateTime)for(let v=1;v<c.length;v++)c[v].programDateTime===null&&ja(c[v],c[v-1],m);Ss(m,t)}t.endCC=l[l.length-1].cc}if(!t.startCC){var p;const m=Lo(h,t.startSN-1);t.startCC=(p=m==null?void 0:m.cc)!=null?p:l[0].cc}el(h.partList,t.partList,(m,v)=>{v.elementaryStreams=m.elementaryStreams,v.stats=m.stats}),o?Jo(t,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):To(h,t),l.length&&(t.totalduration=t.edge-l[0].start),t.driftStartTime=h.driftStartTime,t.driftStart=h.driftStart;const _=t.advancedDateTime;if(t.advanced&&_){const m=t.edge;t.driftStart||(t.driftStartTime=_,t.driftStart=m),t.driftEndTime=_,t.driftEnd=m}else t.driftEndTime=h.driftEndTime,t.driftEnd=h.driftEnd,t.advancedDateTime=h.advancedDateTime;t.requestScheduled===-1&&(t.requestScheduled=h.requestScheduled)}function qa(h,t){const{dateRanges:n,recentlyRemovedDateranges:s}=t,o=k({},h);s&&s.forEach(p=>{delete o[p]});const c=Object.keys(o).length;return c&&Object.keys(n).forEach(p=>{const _=o[p],m=new tr(n[p].attr,_);m.isValid?(o[p]=m,_||(m.tagOrder+=c)):se.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Vi(n[p].attr)}"`)}),o}function el(h,t,n){if(h&&t){let s=0;for(let o=0,l=h.length;o<=l;o++){const c=h[o],p=t[o+s];c&&p&&c.index===p.index&&c.fragment.sn===p.fragment.sn?n(c,p):s--}}}function Rs(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,p=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,_=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;for(let m=o;m<=l;m++){const v=_[c+m];let y=p[m];if(s&&!y&&v&&(y=t.fragments[m]=v),v&&y){if(n(v,y,m,p),v.url&&v.url!==y.url){t.playlistParsingError=Za(`media sequence mismatch ${y.sn}:`,h,t,v,y);return}else if(v.cc!==y.cc){t.playlistParsingError=Za(`discontinuity sequence mismatch (${v.cc}!=${y.cc})`,h,t,v,y);return}}}}function Za(h,t,n,s,o){return new Error(`${h} ${o.url}
|
|
|
Playlist starting @${t.startSN}
|
|
|
${t.m3u8}
|
|
|
|
|
|
Playlist starting @${n.startSN}
|
|
|
${n.m3u8}`)}function To(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;Ya(t,c)}function Ya(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 tl(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 Lo(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 sa(h,t,n){return h?il(h.partList,t,n):null}function il(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 zs(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 nl(h,t){return!!(h&&t.startCC<h.endCC&&t.endCC>h.startCC)}function rl(h,t){if(h){const n=h.start+t;h.start=h.startPTS=n,h.endPTS=n+h.duration}}function Is(h,t){const n=t.fragments;for(let s=0,o=n.length;s<o;s++)rl(n[s],h);t.fragmentHint&&rl(t.fragmentHint,h),t.alignedSliding=!0}function Do(h,t){h&&(Xa(t,h),!t.alignedSliding&&h&&Ja(t,h),!t.alignedSliding&&h&&!t.skippedSegments&&To(h,t,!1))}function Xa(h,t){if(!nl(t,h))return;const n=Math.min(t.endCC,h.endCC),s=zs(t.fragments,n),o=zs(h.fragments,n);if(!s||!o)return;se.log(`Aligning playlist at start of dicontinuity sequence ${n}`);const l=s.start-o.start;Is(l,h)}function Ja(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=zs(s,c),l=zs(n,c)),(!o||!l)&&(o=s[Math.floor(s.length/2)],l=zs(n,o.cc)||n[Math.floor(n.length/2)]);const p=o.programDateTime,_=l.programDateTime;if(!p||!_)return;const m=(_-p)/1e3-(l.start-o.start);Is(m,h)}const jn={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}},rt={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 Pn extends pr{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=rt.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:p,media:_,mediaBuffer:m,state:v}=this,y=_?_.currentTime:0,S=Ai.bufferInfo(m||_,y,c.maxBufferHole);if(this.log(`media seeking to ${ue(y)?y.toFixed(3):y}, state: ${v}`),this.state===rt.ENDED)this.resetLoadingState();else if(p){const C=c.maxFragLookUpTolerance,D=p.start-C,K=p.start+p.duration+C;if(!S.len||K<S.start||D>S.end){const B=y>K;(y<D||B)&&(B&&p.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),p.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(_){this.fragmentTracker.removeFragmentsInRange(y,1/0,this.playlistType,!0);const C=this.lastCurrentTime;if(y>C&&(this.lastCurrentTime=y),!this.loadingParts){const D=Math.max(S.end,y),K=this.shouldLoadParts(this.getLevelDetails(),D);K&&(this.log(`LL-Part loading ON after seeking to ${y.toFixed(2)} with buffer @${D.toFixed(2)}`),this.loadingParts=K)}}!this.hls.hasEnoughToStart&&!S.len&&(this.log(`setting startPosition to ${y} because of seek before start`),this.nextLoadPosition=this.startPosition=y),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 Ir(t.config),this.keyLoader=s,this.fragmentTracker=n,this.config=t.config,this.decrypter=new Er(t.config)}registerListeners(){const{hls:t}=this;t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(w.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){if(this.state===rt.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=rt.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=Ai.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 Ai.isBuffered(this.media,v.start+v.duration/2)}const m=n.fragments[n.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(m)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var t;return(t=this.levelLastLoaded)==null?void 0:t.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;s.removeEventListener("seeking",this.onMediaSeeking),s.removeEventListener("ended",this.onMediaEnded),s.addEventListener("seeking",this.onMediaSeeking),s.addEventListener("ended",this.onMediaEnded);const o=this.config;this.levels&&o.autoStartLoad&&this.state===rt.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),o.removeEventListener("seeking",this.onMediaSeeking),o.removeEventListener("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=rt.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,p=l.frag;if(this.fragContextChanged(p)){(c===rt.FRAG_LOADING||!this.fragCurrent&&c===rt.PARSING)&&(this.fragmentTracker.removeFragment(p),this.state=rt.IDLE);return}"payload"in l&&(this.log(`Loaded ${p.type} sn: ${p.sn} of ${this.playlistLabel()} ${p.level}`),this.hls.trigger(w.FRAG_LOADED,l)),this._handleFragmentLoadComplete(l)}).catch(l=>{this.state===rt.STOPPED||this.state===rt.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)===Yi.APPENDING){const l=t.type,c=this.getFwdBufferInfo(this.mediaBuffer,l),p=Math.max(t.duration,c?c.len:this.config.maxBufferLength),_=this.backtrackFragment;((_?t.sn-_.sn:0)===1||this.reduceMaxBufferLength(p,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)===Yi.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(w.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,p=l.decryptdata;if(c&&c.byteLength>0&&p!=null&&p.key&&p.iv&&ir(p.method)){const _=self.performance.now();return this.decrypter.decrypt(new Uint8Array(c),p.key.buffer,p.iv.buffer,Qr(p.method)).catch(m=>{throw o.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.FRAG_DECRYPT_ERROR,fatal:!1,error:m,reason:m.message,frag:l}),m}).then(m=>{const v=self.performance.now();return o.trigger(w.FRAG_DECRYPTED,{frag:l,payload:m,stats:{tstart:_,tdecrypt:v}}),s.payload=m,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===rt.STOPPED||this.state===rt.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!==rt.STOPPED&&(this.state=rt.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()}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?jn.toString(Ai.getBuffered(s)):"(detached)"})`),le(t)){var o;if(t.type!==P.SUBTITLE){const c=t.elementaryStreams;if(!Object.keys(c).some(p=>!!c[p])){this.state=rt.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=rt.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(_=>!_),p=new Rn(s.level,s.sn,s.stats.chunkCount+1,0,o?o.index:-1,!c);n.flush(p)}_handleFragmentLoadProgress(t){}_doFragLoad(t,n,s=null,o){var l;this.fragCurrent=t;const c=n==null?void 0:n.details;if(!this.levels||!c)throw new Error(`frag load aborted, missing level${c?"":" detail"}s`);let p=null;t.encrypted&&!((l=t.decryptdata)!=null&&l.key)?(this.log(`Loading key for ${t.sn} of [${c.startSN}-${c.endSN}], ${this.playlistLabel()} ${t.level}`),this.state=rt.KEY_LOADING,this.fragCurrent=t,p=this.keyLoader.load(t).then(y=>{if(!this.fragContextChanged(y.frag))return this.hls.trigger(w.KEY_LOADED,y),this.state===rt.KEY_LOADING&&(this.state=rt.IDLE),y}),this.hls.trigger(w.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(p=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):t.encrypted||(p=this.keyLoader.loadClear(t,c.encryptedFragments),p&&this.log("[eme] blocking frag load until media-keys acquired"));const _=this.fragPrevious;if(le(t)&&(!_||t.sn!==_.sn)){const y=this.shouldLoadParts(n.details,t.end);y!==this.loadingParts&&(this.log(`LL-Part loading ${y?"ON":"OFF"} loading sn ${_==null?void 0:_.sn}->${t.sn}`),this.loadingParts=y)}if(s=Math.max(t.start,s||0),this.loadingParts&&le(t)){const y=c.partList;if(y&&o){s>t.end&&c.fragmentHint&&(t=c.fragmentHint);const S=this.getNextPart(y,t,s);if(S>-1){const C=y[S];t=this.fragCurrent=C.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${C.index} (${S}/${y.length-1}) of ${this.fragInfo(t,!1,C)}) cc: ${t.cc} [${c.startSN}-${c.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=C.start+C.duration,this.state=rt.FRAG_LOADING;let D;return p?D=p.then(K=>!K||this.fragContextChanged(K.frag)?null:this.doFragPartsLoad(t,C,n,o)).catch(K=>this.handleFragLoadError(K)):D=this.doFragPartsLoad(t,C,n,o).catch(K=>this.handleFragLoadError(K)),this.hls.trigger(w.FRAG_LOADING,{frag:t,part:C,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):D}else if(!t.url||this.loadedEndOfParts(y,s))return Promise.resolve(null)}}if(le(t)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)}`),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?"["+c.startSN+"-"+c.endSN+"]":""}, target: ${parseFloat(s.toFixed(3))}`),ue(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=rt.FRAG_LOADING;const m=this.config.progressive;let v;return m&&p?v=p.then(y=>!y||this.fragContextChanged(y==null?void 0:y.frag)?null:this.fragmentLoader.load(t,o)).catch(y=>this.handleFragLoadError(y)):v=Promise.all([this.fragmentLoader.load(t,m?o:void 0),p]).then(([y])=>(!m&&y&&o&&o(y),y)).catch(y=>this.handleFragLoadError(y)),this.hls.trigger(w.FRAG_LOADING,{frag:t,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):v}doFragPartsLoad(t,n,s,o){return new Promise((l,c)=>{var p;const _=[],m=(p=s.details)==null?void 0:p.partList,v=y=>{this.fragmentLoader.loadPart(t,y,o).then(S=>{_[y.index]=S;const C=S.part;this.hls.trigger(w.FRAG_LOADED,S);const D=sa(s.details,t.sn,y.index+1)||il(m,t.sn,y.index+1);if(D)v(D);else return l({frag:t,part:C,partsLoaded:_})}).catch(c)};v(n)})}handleFragLoadError(t){if("data"in t){const n=t.data;t.data&&n.details===J.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):this.hls.trigger(w.ERROR,n)}else this.hls.trigger(w.ERROR,{type:me.OTHER_ERROR,details:J.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const n=this.getCurrentContext(t);if(!n||this.state!==rt.PARSING){!this.fragCurrent&&this.state!==rt.STOPPED&&this.state!==rt.ERROR&&(this.state=rt.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 p=this.getLevelDetails(),m=p&&s.sn>p.endSN||this.shouldLoadParts(p,s.end);m!==this.loadingParts&&(this.log(`LL-Part loading ${m?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=m),this.updateLevelTiming(s,o,l,t.partial)}shouldLoadParts(t,n){if(this.config.lowLatencyMode){if(!t)return this.loadingParts;if(t!=null&&t.partList){var s;const l=t.partList[0],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 p=n[o],_=p.details,m=c>-1?sa(_,l,c):null,v=m?m.fragment:Lo(_,l,s);return v?(s&&s!==v&&(v.stats=s.stats),{frag:v,part:m,level:p}):null}bufferFragmentData(t,n,s,o,l){var c;if(!t||this.state!==rt.PARSING)return;const{data1:p,data2:_}=t;let m=p;if(p&&_&&(m=Nt(p,_)),!((c=m)!=null&&c.length))return;const v={type:t.type,frag:n,part:s,chunkMeta:o,parent:n.type,data:m};if(this.hls.trigger(w.BUFFER_APPENDING,v),t.dropped&&t.independent&&!s){if(l)return;this.flushBufferGap(n)}}flushBufferGap(t){const n=this.media;if(!n)return;if(!Ai.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,t.start);return}const s=n.currentTime,o=Ai.bufferInfo(n,s,0),l=t.duration,c=Math.min(this.config.maxFragLookUpTolerance*2,l*.25),p=Math.max(Math.min(t.start-c,o.end-c),s+c);t.start-p>c&&this.flushMainBuffer(p,t.start)}getFwdBufferInfo(t,n){var s;const o=this.getLoadPosition();if(!ue(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=Ai.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 p=Math.max(Math.min(l.nextStart,c.end)-n,o);return Ai.bufferInfo(t,n,p)}}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){var s;const o=(s=this.fragmentTracker)==null?void 0:s.getAppendedFrag(t,n);return o&&"fragment"in o?o.fragment:o}getNextFragment(t,n){const s=n.fragments,o=s.length;if(!o)return null;const{config:l}=this,c=s[0].start,p=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 m;p&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),_=this.getInitialLiveFragment(n);const S=this.hls.startPosition,C=this.hls.liveSyncPosition,D=_?(S!==-1&&S>=c?S:C)||_.start:t;this.log(`Setting startPosition to ${D} to match start frag at live edge. mainStart: ${S} liveSyncPosition: ${C} frag.start: ${(m=_)==null?void 0:m.start}`),this.startPosition=this.nextLoadPosition=D}}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===Yi.OK||s===Yi.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 p=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,o,0);if(p!==null&&s.len+p.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(Ur(this.hls.config)){var t,n;if((t=this.hls.interstitialsManager)==null||(n=t.playingItem)==null?void 0:n.event)return!0}return!1}filterReplacedPrimary(t,n){if(!t)return t;if(Ur(this.hls.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 p=l[c].interstitial;if(p.appendInPlace&&t.start>=p.startTime&&t.end<=p.resumeTime)return null}}return t}mapToInitFragWhenRequired(t){return t!=null&&t.initSegment&&!(t!=null&&t.initSegment.data)&&!this.bitrateTest?t.initSegment:t}getNextPart(t,n,s){let o=-1,l=!1,c=!0;for(let p=0,_=t.length;p<_;p++){const m=t[p];if(c=c&&!m.independent,o>-1&&s<m.start)break;const v=m.loaded;v?o=-1:(l||m.independent||c)&&m.fragment===n&&(o=p),l=v}return o}loadedEndOfParts(t,n){const s=t[t.length-1];return s&&n>s.start&&s.loaded}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=Xi(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=Gi(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:p}=s;const{fragmentHint:_}=s,{maxFragLookUpTolerance:m}=o,v=s.partList,y=!!(this.loadingParts&&v!=null&&v.length&&_);y&&_&&!this.bitrateTest&&v[v.length-1].fragment.sn===_.sn&&(c=c.concat(_),p=_.sn);let S;if(t<n){var C;const K=t<this.lastCurrentTime||t>n-m||(C=this.media)!=null&&C.paused||!this.startFragRequested?0:m;S=li(l,c,t,K)}else S=c[c.length-1];if(S){const D=S.sn-s.startSN,K=this.fragmentTracker.getState(S);if((K===Yi.OK||K===Yi.PARTIAL&&S.gap)&&(l=S),l&&S.sn===l.sn&&(!y||v[0].fragment.sn>S.sn||!s.live&&!y)&&l&&S.level===l.level){const ee=c[D+1];S.sn<p&&this.fragmentTracker.getState(ee)!==Yi.OK?S=ee:S=null}}return S}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,p=t.alignedSliding&&ue(l);if(c||!p&&!l){Do(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&&ue(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&&le(t)&&t.stats.aborted&&(this.warn(`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!==rt.FRAG_LOADING_WAITING_RETRY)&&(this.state=rt.IDLE)}onFragmentOrKeyLoadError(t,n){if(n.chunkMeta&&!n.frag){const D=this.getCurrentContext(n.chunkMeta);D&&(n.frag=D.frag)}const s=n.frag;if(!s||s.type!==t||!this.levels)return;if(this.fragContextChanged(s)){var o;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(o=this.fragCurrent)==null?void 0:o.url}`);return}const l=n.details===J.FRAG_GAP;l&&this.fragmentTracker.fragBuffered(s,!0);const c=n.errorAction,{action:p,flags:_,retryCount:m=0,retryConfig:v}=c||{},y=!!c&&!!v,S=y&&p===Si.RetryRequest,C=y&&!c.resolved&&_===Hi.MoveAllAlternatesMatchingHost;if(!S&&C&&le(s)&&!s.endList)this.resetFragmentErrors(t),this.treatAsGap(s),c.resolved=!0;else if((S||C)&&m<v.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const D=nn(v,m);this.warn(`Fragment ${s.sn} of ${t} ${s.level} errored with ${n.details}, retrying loading ${m+1}/${v.maxNumRetry} in ${D}ms`),c.resolved=!0,this.retryDate=self.performance.now()+D,this.state=rt.FRAG_LOADING_WAITING_RETRY}else if(v&&c)if(this.resetFragmentErrors(t),m<v.maxNumRetry)!l&&p!==Si.RemoveAlternatePermanently&&(c.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${m})`);return}else p===Si.SendAlternateToPenaltyBox?this.state=rt.WAITING_LEVEL:this.state=rt.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(t){if(this.state===rt.PARSING||this.state===rt.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 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!==rt.STOPPED&&(this.state=rt.IDLE)}afterBufferFlushed(t,n,s){if(!t)return;const o=Ai.getBuffered(t);this.fragmentTracker.detectEvictedFragments(n,o,s),this.state===rt.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==rt.STOPPED&&(this.state=rt.IDLE)}resetStartWhenNotLoaded(t){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const 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.warn(`The loading context changed while buffering fragment ${t.sn} of ${this.playlistLabel()} ${t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),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((_,m)=>{const v=t.elementaryStreams[m];if(v){const y=v.endPTS-v.startPTS;if(y<=0)return this.warn(`Could not parse fragment ${t.sn} ${m} duration reliably (${y})`),_||!1;const S=o?0:Jo(l,t,v.startPTS,v.endPTS,v.startDTS,v.endDTS);return this.hls.trigger(w.LEVEL_PTS_UPDATED,{details:l,level:s,drift:S,type:m,frag:t,start:v.startPTS,end:v.endPTS}),!0}return _},!1)){var p;if(s.fragmentError===0&&this.treatAsGap(t,s),((p=this.transmuxer)==null?void 0:p.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(w.ERROR,{type:me.MEDIA_ERROR,details:J.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=rt.PARSED,this.log(`Parsed ${t.type} sn: ${t.sn}${n?" part: "+n.index:""} of ${this.fragInfo(t,!1,n)})`),this.hls.trigger(w.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.levelLastLoaded),this.resetLoadingState())}set state(t){const n=this._state;n!==t&&(this._state=t,this.log(`${n}->${t}`))}get state(){return this._state}}function Ur(h){return!!h.interstitialsController&&h.enableInterstitialPlayback!==!1}class zr{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=Qa(t,n);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function Qa(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 Vs={exports:{}},Aa;function sl(){return Aa||(Aa=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(_,m,v){this.fn=_,this.context=m,this.once=v||!1}function l(_,m,v,y,S){if(typeof v!="function")throw new TypeError("The listener must be a function");var C=new o(v,y||_,S),D=n?n+m:m;return _._events[D]?_._events[D].fn?_._events[D]=[_._events[D],C]:_._events[D].push(C):(_._events[D]=C,_._eventsCount++),_}function c(_,m){--_._eventsCount===0?_._events=new s:delete _._events[m]}function p(){this._events=new s,this._eventsCount=0}p.prototype.eventNames=function(){var m=[],v,y;if(this._eventsCount===0)return m;for(y in v=this._events)t.call(v,y)&&m.push(n?y.slice(1):y);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(v)):m},p.prototype.listeners=function(m){var v=n?n+m:m,y=this._events[v];if(!y)return[];if(y.fn)return[y.fn];for(var S=0,C=y.length,D=new Array(C);S<C;S++)D[S]=y[S].fn;return D},p.prototype.listenerCount=function(m){var v=n?n+m:m,y=this._events[v];return y?y.fn?1:y.length:0},p.prototype.emit=function(m,v,y,S,C,D){var K=n?n+m:m;if(!this._events[K])return!1;var B=this._events[K],ee=arguments.length,_e,he;if(B.fn){switch(B.once&&this.removeListener(m,B.fn,void 0,!0),ee){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,v),!0;case 3:return B.fn.call(B.context,v,y),!0;case 4:return B.fn.call(B.context,v,y,S),!0;case 5:return B.fn.call(B.context,v,y,S,C),!0;case 6:return B.fn.call(B.context,v,y,S,C,D),!0}for(he=1,_e=new Array(ee-1);he<ee;he++)_e[he-1]=arguments[he];B.fn.apply(B.context,_e)}else{var Ie=B.length,Fe;for(he=0;he<Ie;he++)switch(B[he].once&&this.removeListener(m,B[he].fn,void 0,!0),ee){case 1:B[he].fn.call(B[he].context);break;case 2:B[he].fn.call(B[he].context,v);break;case 3:B[he].fn.call(B[he].context,v,y);break;case 4:B[he].fn.call(B[he].context,v,y,S);break;default:if(!_e)for(Fe=1,_e=new Array(ee-1);Fe<ee;Fe++)_e[Fe-1]=arguments[Fe];B[he].fn.apply(B[he].context,_e)}}return!0},p.prototype.on=function(m,v,y){return l(this,m,v,y,!1)},p.prototype.once=function(m,v,y){return l(this,m,v,y,!0)},p.prototype.removeListener=function(m,v,y,S){var C=n?n+m:m;if(!this._events[C])return this;if(!v)return c(this,C),this;var D=this._events[C];if(D.fn)D.fn===v&&(!S||D.once)&&(!y||D.context===y)&&c(this,C);else{for(var K=0,B=[],ee=D.length;K<ee;K++)(D[K].fn!==v||S&&!D[K].once||y&&D[K].context!==y)&&B.push(D[K]);B.length?this._events[C]=B.length===1?B[0]:B:c(this,C)}return this},p.prototype.removeAllListeners=function(m){var v;return m?(v=n?n+m:m,this._events[v]&&c(this,v)):(this._events=new s,this._eventsCount=0),this},p.prototype.off=p.prototype.removeListener,p.prototype.addListener=p.prototype.on,p.prefixed=n,p.EventEmitter=p,h.exports=p}(Vs)),Vs.exports}var al=sl(),Gs=z(al);const Hs="1.6.5",aa={};function ah(){return typeof __HLS_WORKER_BUNDLE__=="function"}function oh(){const h=aa[Hs];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 aa[Hs]=o,o}function ol(h){const t=aa[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 aa[h]=o,o}function lh(h){const t=aa[h||Hs];if(t&&t.clientCount--===1){const{worker:s,objectURL:o}=t;delete aa[h||Hs],o&&self.URL.revokeObjectURL(o),s.terminate()}}function Gu(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 Jl(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 ll(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 Co(h,t){const n=t;let s=0;for(;Jl(h,t);){s+=10;const o=ll(h,t+6);s+=o,Gu(h,t+10)&&(s+=10),t+=s}if(s>0)return h.subarray(n,n+s)}function Vr(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 C=new Error(`invalid ADTS sampling index:${c}`);h.emit(w.ERROR,w.ERROR,{type:me.MEDIA_ERROR,details:J.FRAG_PARSING_ERROR,fatal:!0,error:C,reason:C.message});return}const p=(l>>6&3)+1,_=t[n+3]>>6&3|(l&1)<<2,m="mp4a.40."+p,v=o[c];let y=c;(p===5||p===29)&&(y-=3);const S=[p<<3|(y&14)>>1,(y&1)<<7|_<<3];return se.log(`manifest codec:${s}, parsed codec:${m}, channels:${_}, rate:${v} (ADTS object type:${p} sampling index:${c})`),{config:S,samplerate:v,channelCount:_,codec:m,parsedCodec:m,manifestCodec:s}}function Ws(h,t){return h[t]===255&&(h[t+1]&246)===240}function oa(h,t){return h[t+1]&1?7:9}function Ql(h,t){return(h[t+3]&3)<<11|h[t+4]<<3|(h[t+5]&224)>>>5}function Hu(h,t){return t+5<h.length}function ul(h,t){return t+1<h.length&&Ws(h,t)}function uh(h,t){return Hu(h,t)&&Ws(h,t)&&Ql(h,t)<=h.length-t}function Wu(h,t){if(ul(h,t)){const n=oa(h,t);if(t+n>=h.length)return!1;const s=Ql(h,t);if(s<=n)return!1;const o=t+s;return o===h.length||ul(h,o)}return!1}function ju(h,t,n,s,o){if(!h.samplerate){const l=Vr(t,n,s,o);if(!l)return;k(h,l)}}function qu(h){return 1024*9e4/h}function ch(h,t){const n=oa(h,t);if(t+n<=h.length){const s=Ql(h,t)-n;if(s>0)return{headerLength:n,frameLength:s}}}function cl(h,t,n,s,o){const l=qu(h.samplerate),c=s+o*l,p=ch(t,n);let _;if(p){const{frameLength:y,headerLength:S}=p,C=S+y,D=Math.max(0,n+C-t.length);D?(_=new Uint8Array(C-S),_.set(t.subarray(n+S,t.length),0)):_=t.subarray(n+S,n+C);const K={unit:_,pts:c};return D||h.samples.push(K),{sample:K,length:C,missing:D}}const m=t.length-n;return _=new Uint8Array(m),_.set(t.subarray(n,t.length),0),{sample:{unit:_,pts:c},length:m,missing:-1}}function hh(h,t){return Jl(h,t)&&ll(h,t+6)+10<=h.length-t}function fh(h){return h instanceof ArrayBuffer?h:h.byteOffset==0&&h.byteLength==h.buffer.byteLength?h.buffer:new Uint8Array(h).buffer}function hl(h,t=0,n=1/0){return Zu(h,t,n,Uint8Array)}function Zu(h,t,n,s){const o=js(h);let l=1;"BYTES_PER_ELEMENT"in s&&(l=s.BYTES_PER_ELEMENT);const c=Yu(h)?h.byteOffset:0,p=(c+h.byteLength)/l,_=(c+t)/l,m=Math.floor(Math.max(0,Math.min(_,p))),v=Math.floor(Math.min(m+Math.max(n,0),p));return new s(o,m,v-m)}function js(h){return h instanceof ArrayBuffer?h:h.buffer}function Yu(h){return h&&h.buffer instanceof ArrayBuffer&&h.byteLength!==void 0&&h.byteOffset!==void 0}function Xu(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(hl(h.data,1,s)),l=h.data[2+s],c=h.data.subarray(3+s).indexOf(0);if(c===-1)return;const p=Rt(hl(h.data,3+s,c));let _;return o==="-->"?_=Rt(hl(h.data,4+s+c)):_=fh(h.data.subarray(4+s+c)),t.mimeType=o,t.pictureType=l,t.description=p,t.data=_,t}function dh(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 ph(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 mh(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 gh(h){return h.type==="PRIV"?dh(h):h.type[0]==="W"?mh(h):h.type==="APIC"?Xu(h):ph(h)}function Ju(h){const t=String.fromCharCode(h[0],h[1],h[2],h[3]),n=ll(h,4),s=10;return{type:t,size:n,data:h.subarray(s,s+n)}}const fl=10,_h=10;function Qu(h){let t=0;const n=[];for(;Jl(h,t);){const s=ll(h,t+6);h[t+5]>>6&1&&(t+=fl),t+=fl;const o=t+s;for(;t+_h<o;){const l=Ju(h.subarray(t)),c=gh(l);c&&n.push(c),t+=l.size+fl}Gu(h,t)&&(t+=fl)}return n}function ec(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"}function vh(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 eu(h){const t=Qu(h);for(let n=0;n<t.length;n++){const s=t[n];if(ec(s))return vh(s)}}let vr=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 ks(h="",t=9e4){return{type:h,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class Ps{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=Nt(this.cachedData,t),this.cachedData=null);let s=Co(t,0),o=s?s.length:0,l;const c=this._audioTrack,p=this._id3Track,_=s?eu(s):void 0,m=t.length;for((this.basePTS===null||this.frameIndex===0&&ue(_))&&(this.basePTS=yh(_,n,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&p.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:vr.audioId3,duration:Number.POSITIVE_INFINITY});o<m;){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=m}else hh(t,o)?(s=Co(t,o),p.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:vr.audioId3,duration:Number.POSITIVE_INFINITY}),o+=s.length,l=o):o++;if(o===m&&l!==m){const v=t.slice(l);this.cachedData?this.cachedData=Nt(this.cachedData,v):this.cachedData=v}}return{audioTrack:c,videoTrack:ks(),id3Track:p,textTrack:ks()}}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:ks(),id3Track:this._id3Track,textTrack:ks()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const yh=(h,t,n)=>{if(ue(h))return h*90;const s=n?n.baseTime*9e4/n.timescale:0;return t*9e4+s};let Mo=null;const tc=[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],bh=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],ic=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],xh=[0,1,1,4];function nc(h,t,n,s,o){if(n+24>t.length)return;const l=rc(t,n);if(l&&n+l.frameLength<=t.length){const c=l.samplesPerFrame*9e4/l.sampleRate,p=s+o*c,_={unit:t.subarray(n,n+l.frameLength),pts:p,dts:p};return h.config=[],h.channelCount=l.channelCount,h.samplerate=l.sampleRate,h.samples.push(_),{sample:_,length:l.frameLength,missing:0}}}function rc(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,p=h[t+3]>>6,_=n===3?3-s:s===3?3:4,m=tc[_*14+o-1]*1e3,y=bh[(n===3?0:n===2?1:2)*3+l],S=p===3?1:2,C=ic[n][s],D=xh[s],K=C*8*D,B=Math.floor(C*m/y+c)*D;if(Mo===null){const he=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Mo=he?parseInt(he[1]):0}return!!Mo&&Mo<=87&&s===2&&m>=224e3&&p===0&&(h[t+3]=h[t+3]|128),{sampleRate:y,channelCount:S,frameLength:B,samplesPerFrame:K}}}function tu(h,t){return h[t]===255&&(h[t+1]&224)===224&&(h[t+1]&6)!==0}function sc(h,t){return t+1<h.length&&tu(h,t)}function wh(h,t){return tu(h,t)&&4<=h.length-t}function ac(h,t){if(t+1<h.length&&tu(h,t)){const s=rc(h,t);let o=4;s!=null&&s.frameLength&&(o=s.frameLength);const l=t+o;return l===h.length||sc(h,l)}return!1}class Sh extends Ps{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=Co(t,0);let o=(s==null?void 0:s.length)||0;if(ac(t,o))return!1;for(let l=t.length;o<l;o++)if(Wu(t,o))return n.log("ADTS sync word found !"),!0;return!1}canParse(t,n){return uh(t,n)}appendFrame(t,n,s){ju(t,this.observer,n,s,t.manifestCodec);const o=cl(t,n,s,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o}}const oc=(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 p=Math.min(s,8),_=8-p;l[0]=4278190080>>>24+_<<_,o[0]=(c[0]&l[0])>>_,n=n?n<<p|o[0]:o[0],t+=1,s-=p}return n};class iu extends Ps{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=lc(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=Co(t,0);if(!n)return!1;const s=n.length;return t[s]===11&&t[s+1]===119&&eu(n)!==void 0&&oc(t,s)<16}}function lc(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 p=[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 S=0;y===2?S+=2:(y&1&&y!==1&&(S+=2),y&4&&(S+=2));const C=(t[n+6]<<8|t[n+7])>>12-S&1,K=[2,1,2,3,3,4,4,5][y]+C,B=t[n+5]>>3,ee=t[n+5]&7,_e=new Uint8Array([l<<6|B<<1|ee>>2,(ee&3)<<6|y<<3|C<<2|_>>4,_<<4&224]),he=1536/p*9e4,Ie=s+o*he,Fe=t.subarray(n,n+v);return h.config=_e,h.channelCount=K,h.samplerate=p,h.samples.push({unit:Fe,pts:Ie}),v}class Eh extends Ps{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=Co(t,0);let s=(n==null?void 0:n.length)||0;if(n&&t[s]===11&&t[s+1]===119&&eu(n)!==void 0&&oc(t,s)<=16)return!1;for(let o=t.length;s<o;s++)if(ac(t,s))return se.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,n){return wh(t,n)}appendFrame(t,n,s){if(this.basePTS!==null)return nc(t,n,s,this.basePTS,this.frameIndex)}}const kh=/\/emsg[-/]ID3/i;class Ah{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=ks("video",1),c=this.audioTrack=ks("audio",1),p=this.txtTrack=ks("text",1);if(this.id3Track=ks("id3",1),this.timeOffset=0,!(t!=null&&t.byteLength))return;const _=ot(t);if(_.video){const{id:m,timescale:v,codec:y,supplemental:S}=_.video;l.id=m,l.timescale=p.timescale=v,l.codec=y,l.supplemental=S}if(_.audio){const{id:m,timescale:v,codec:y}=_.audio;c.id=m,c.timescale=v,c.codec=y}p.id=bt.text,l.sampleDuration=0,l.duration=c.duration=o}resetContiguity(){this.remainderData=null}static probe(t){return Ne(t)}demux(t,n){this.timeOffset=n;let s=t;const o=this.videoTrack,l=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=Nt(this.remainderData,t));const p=kt(s);this.remainderData=p.remainder,o.samples=p.valid||new Uint8Array}else o.samples=s;const c=this.extractID3Track(o,n);return l.samples=qt(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=qt(t,n),{videoTrack:n,audioTrack:ks(),id3Track:o,textTrack:ks()}}extractID3Track(t,n){const s=this.id3Track;if(t.samples.length){const o=pe(t.samples,["emsg"]);o&&o.forEach(l=>{const c=je(l);if(kh.test(c.schemeIdUri)){const p=uc(c,n);let _=c.eventDuration===4294967295?Number.POSITIVE_INFINITY:c.eventDuration/c.timeScale;_<=.001&&(_=Number.POSITIVE_INFINITY);const m=c.payload;s.samples.push({data:m,len:m.byteLength,dts:p,pts:p,type:vr.emsg,duration:_})}else if(this.config.enableEmsgKLVMetadata&&c.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const p=uc(c,n);s.samples.push({data:c.payload,len:c.payload.byteLength,dts:p,pts:p,type:vr.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 uc(h,t){return ue(h.presentationTime)?h.presentationTime/h.timeScale:t+h.presentationTimeDelta/h.timeScale}class Ro{constructor(t,n,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new Er(n,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,Qi.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(p=>{const _=new Uint8Array(p);o.set(_,16),this.decrypter.isSync()||this.decryptAacSamples(t,n+1,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=vt(l.data),p=this.getAvcEncryptedData(c);this.decryptBuffer(p.buffer).then(_=>{l.data=this.getAvcDecryptedUnit(c,_),this.decrypter.isSync()||this.decryptAvcSamples(t,n,s+1,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 eo{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,p=[];let _=0,m,v,y,S=-1,C=0;for(l===-1&&(S=0,C=this.getNALuType(n,0),l=0,_=1);_<o;){if(m=n[_++],!l){l=m?0:1;continue}if(l===1){l=m?0:2;continue}if(!m)l=3;else if(m===1){if(v=_-l-1,S>=0){const D={data:n.subarray(S,v),type:C};p.push(D)}else{const D=this.getLastNalUnit(t.samples);D&&(c&&_<=4-c&&D.state&&(D.data=D.data.subarray(0,D.data.byteLength-c)),v>0&&(D.data=Nt(D.data,n.subarray(0,v)),D.state=0))}_<o?(y=this.getNALuType(n,_),S=_,C=y,l=0):l=-1}else l=0}if(S>=0&&l>=0){const D={data:n.subarray(S,o),type:C,state:l};p.push(D)}if(p.length===0){const D=this.getLastNalUnit(t.samples);D&&(D.data=Nt(D.data,n))}return t.naluState=l,p}}class to{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 cc extends eo{parsePES(t,n,s,o){const l=this.parseNALu(t,s.data,o);let c=this.VideoSample,p,_=!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(m=>{var v,y;switch(m.type){case 1:{let K=!1;p=!0;const B=m.data;if(_&&B.length>4){const ee=this.readSliceType(B);(ee===2||ee===4||ee===7||ee===9)&&(K=!0)}if(K){var S;(S=c)!=null&&S.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=K;break}case 5:p=!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:{p=!0,st(m.data,1,s.pts,n.samples);break}case 7:{var C,D;p=!0,_=!0;const K=m.data,B=this.readSPS(K);if(!t.sps||t.width!==B.width||t.height!==B.height||((C=t.pixelRatio)==null?void 0:C[0])!==B.pixelRatio[0]||((D=t.pixelRatio)==null?void 0:D[1])!==B.pixelRatio[1]){t.width=B.width,t.height=B.height,t.pixelRatio=B.pixelRatio,t.sps=[K];const ee=K.subarray(1,4);let _e="avc1.";for(let he=0;he<3;he++){let Ie=ee[he].toString(16);Ie.length<2&&(Ie="0"+Ie),_e+=Ie}t.codec=_e}break}case 8:p=!0,t.pps=[m.data];break;case 9:p=!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:p=!0;break;default:p=!1;break}c&&p&&c.units.push(m)}),o&&c&&(this.pushAccessUnit(c,t),this.VideoSample=null)}getNALuType(t,n){return t[n]&31}readSliceType(t){const n=new to(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 to(t);let s=0,o=0,l=0,c=0,p,_,m;const v=n.readUByte.bind(n),y=n.readBits.bind(n),S=n.readUEG.bind(n),C=n.readBoolean.bind(n),D=n.skipBits.bind(n),K=n.skipEG.bind(n),B=n.skipUEG.bind(n),ee=this.skipScalingList.bind(this);v();const _e=v();if(y(5),D(3),v(),B(),_e===100||_e===110||_e===122||_e===244||_e===44||_e===83||_e===86||_e===118||_e===128){const qe=S();if(qe===3&&D(1),B(),B(),D(1),C())for(_=qe!==3?8:12,m=0;m<_;m++)C()&&(m<6?ee(16,n):ee(64,n))}B();const he=S();if(he===0)S();else if(he===1)for(D(1),K(),K(),p=S(),m=0;m<p;m++)K();B(),D(1);const Ie=S(),Fe=S(),it=y(1);it===0&&D(1),D(1),C()&&(s=S(),o=S(),l=S(),c=S());let Ke=[1,1];if(C()&&C())switch(v()){case 1:Ke=[1,1];break;case 2:Ke=[12,11];break;case 3:Ke=[10,11];break;case 4:Ke=[16,11];break;case 5:Ke=[40,33];break;case 6:Ke=[24,11];break;case 7:Ke=[20,11];break;case 8:Ke=[32,11];break;case 9:Ke=[80,33];break;case 10:Ke=[18,11];break;case 11:Ke=[15,11];break;case 12:Ke=[64,33];break;case 13:Ke=[160,99];break;case 14:Ke=[4,3];break;case 15:Ke=[3,2];break;case 16:Ke=[2,1];break;case 255:{Ke=[v()<<8|v(),v()<<8|v()];break}}return{width:Math.ceil((Ie+1)*16-s*2-o*2),height:(2-it)*(Fe+1)*16-(it?2:4)*(l+c),pixelRatio:Ke}}}class hc extends eo{constructor(...t){super(...t),this.initVPS=null}parsePES(t,n,s,o){const l=this.parseNALu(t,s.data,o);let c=this.VideoSample,p,_=!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(m=>{var v,y;switch(m.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,p=!0;break;case 16:case 17:case 18:case 21:if(p=!0,_){var S;(S=c)!=null&&S.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:p=!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:p=!0,st(m.data,2,s.pts,n.samples);break;case 32:p=!0,t.vps||(typeof t.params!="object"&&(t.params={}),t.params=k(t.params,this.readVPS(m.data)),this.initVPS=m.data),t.vps=[m.data];break;case 33:if(p=!0,_=!0,t.vps!==void 0&&t.vps[0]!==this.initVPS&&t.sps!==void 0&&!this.matchSPS(t.sps[0],m.data)&&(this.initVPS=t.vps[0],t.sps=t.pps=void 0),!t.sps){const C=this.readSPS(m.data);t.width=C.width,t.height=C.height,t.pixelRatio=C.pixelRatio,t.codec=C.codecString,t.sps=[],typeof t.params!="object"&&(t.params={});for(const D in C.params)t.params[D]=C.params[D]}this.pushParameterSet(t.sps,m.data,t.vps),c||(c=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),c.key=!0;break;case 34:if(p=!0,typeof t.params=="object"){if(!t.pps){t.pps=[];const C=this.readPPS(m.data);for(const D in C)t.params[D]=C[D]}this.pushParameterSet(t.pps,m.data,t.vps)}break;case 35:p=!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:p=!1;break}c&&p&&c.units.push(m)}),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 to(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 to(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),p=n.readUByte(),_=n.readUByte(),m=n.readUByte(),v=n.readUByte(),y=n.readUByte(),S=n.readUByte(),C=n.readUByte(),D=n.readUByte(),K=n.readUByte(),B=n.readUByte(),ee=n.readUByte(),_e=[],he=[];for(let Cn=0;Cn<s;Cn++)_e.push(n.readBoolean()),he.push(n.readBoolean());if(s>0)for(let Cn=s;Cn<8;Cn++)n.readBits(2);for(let Cn=0;Cn<s;Cn++)_e[Cn]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),he[Cn]&&n.readUByte();n.readUEG();const Ie=n.readUEG();Ie==3&&n.skipBits(1);const Fe=n.readUEG(),it=n.readUEG(),Ke=n.readBoolean();let qe=0,nt=0,Ue=0,Lt=0;Ke&&(qe+=n.readUEG(),nt+=n.readUEG(),Ue+=n.readUEG(),Lt+=n.readUEG());const ii=n.readUEG(),Ri=n.readUEG(),pi=n.readUEG(),gi=n.readBoolean();for(let Cn=gi?0:s;Cn<=s;Cn++)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 Yr=0;Yr<4;Yr++)for(let Xr=0;Xr<(Yr===3?2:6);Xr++)if(!n.readBoolean())n.readUEG();else{const ds=Math.min(64,1<<4+(Yr<<1));Yr>1&&n.readEG();for(let Qs=0;Qs<ds;Qs++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const Ei=n.readUEG();let zt=0;for(let Cn=0;Cn<Ei;Cn++){let Yr=!1;if(Cn!==0&&(Yr=n.readBoolean()),Yr){Cn===Ei&&n.readUEG(),n.readBoolean(),n.readUEG();let Xr=0;for(let Pa=0;Pa<=zt;Pa++){const ds=n.readBoolean();let Qs=!1;ds||(Qs=n.readBoolean()),(ds||Qs)&&Xr++}zt=Xr}else{const Xr=n.readUEG(),Pa=n.readUEG();zt=Xr+Pa;for(let ds=0;ds<Xr;ds++)n.readUEG(),n.readBoolean();for(let ds=0;ds<Pa;ds++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const Cn=n.readUEG();for(let Yr=0;Yr<Cn;Yr++){for(let Xr=0;Xr<pi+4;Xr++)n.readBits(1);n.readBits(1)}}let Zi=0,zi=1,tn=1,mn=!0,un=1,Zn=0;n.readBoolean(),n.readBoolean();let Tr=!1;if(n.readBoolean()){if(n.readBoolean()){const Oa=n.readUByte(),_o=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],vo=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Oa>0&&Oa<16?(zi=_o[Oa-1],tn=vo[Oa-1]):Oa===255&&(zi=n.readBits(16),tn=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(),Tr=n.readBoolean(),Tr&&(qe+=n.readUEG(),nt+=n.readUEG(),Ue+=n.readUEG(),Lt+=n.readUEG()),n.readBoolean()&&(un=n.readBits(32),Zn=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const vo=n.readBoolean(),Du=n.readBoolean();let Bl=!1;(vo||Du)&&(Bl=n.readBoolean(),Bl&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),Bl&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let Ef=0;Ef<=s;Ef++){mn=n.readBoolean();const Gc=mn||n.readBoolean();let Nl=!1;Gc?n.readEG():Nl=n.readBoolean();const yo=Nl?1:n.readUEG()+1;if(vo)for(let $l=0;$l<yo;$l++)n.readUEG(),n.readUEG(),Bl&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(Du)for(let $l=0;$l<yo;$l++)n.readUEG(),n.readUEG(),Bl&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),Zi=n.readUEG())}let Ia=Fe,wf=it;if(Ke||Tr){let Cn=1,Yr=1;Ie===1?Cn=Yr=2:Ie==2&&(Cn=2),Ia=Fe-Cn*nt-Cn*qe,wf=it-Yr*Lt-Yr*Ue}const Sf=o?["A","B","C"][o]:"",Pd=p<<24|_<<16|m<<8|v;let Vc=0;for(let Cn=0;Cn<32;Cn++)Vc=(Vc|(Pd>>Cn&1)<<31-Cn)>>>0;let Fl=Vc.toString(16);return c===1&&Fl==="2"&&(Fl="6"),{codecString:`hvc1.${Sf}${c}.${Fl}.${l?"H":"L"}${ee}.B0`,params:{general_tier_flag:l,general_profile_idc:c,general_profile_space:o,general_profile_compatibility_flags:[p,_,m,v],general_constraint_indicator_flags:[y,S,C,D,K,B],general_level_idc:ee,bit_depth:ii+8,bit_depth_luma_minus8:ii,bit_depth_chroma_minus8:Ri,min_spatial_segmentation_idc:Zi,chroma_format_idc:Ie,frame_rate:{fixed:mn,fps:Zn/un}},width:Ia,height:wf,pixelRatio:[zi,tn]}}readPPS(t){const n=new to(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 Mr=188;class la{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=la.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(Mr*5,n-Mr)+1,o=0;for(;o<s;){let l=!1,c=-1,p=0;for(let _=o;_<n;_+=Mr)if(t[_]===71&&(n-_===Mr||t[_+Mr]===71)){if(p++,c===-1&&(c=_,c!==0&&(s=Math.min(c+Mr*99,t.length-Mr)+1)),l||(l=Io(t,_)===0),l&&p>1&&(c===0&&p>2||_+Mr>s))return c}else{if(p)return-1;break}o++}return-1}static createTrack(t,n){return{container:t==="video"||t==="audio"?"video/mp2t":void 0,type:t,id:bt[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=la.createTrack("video"),this._videoTrack.duration=o,this._audioTrack=la.createTrack("audio",o),this._id3Track=la.createTrack("id3"),this._txtTrack=la.createTrack("text"),this._audioTrack.segmentCodec="aac",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,p=this._audioTrack,_=this._id3Track,m=this._txtTrack;let v=c.pid,y=c.pesData,S=p.pid,C=_.pid,D=p.pesData,K=_.pesData,B=null,ee=this.pmtParsed,_e=this._pmtId,he=t.length;if(this.remainderData&&(t=Nt(this.remainderData,t),he=t.length,this.remainderData=null),he<Mr&&!o)return this.remainderData=t,{audioTrack:p,videoTrack:c,id3Track:_,textTrack:m};const Ie=Math.max(0,la.syncOffset(t));he-=(he-Ie)%Mr,he<t.byteLength&&!o&&(this.remainderData=new Uint8Array(t.buffer,he,t.buffer.byteLength-he));let Fe=0;for(let Ke=Ie;Ke<he;Ke+=Mr)if(t[Ke]===71){const qe=!!(t[Ke+1]&64),nt=Io(t,Ke),Ue=(t[Ke+3]&48)>>4;let Lt;if(Ue>1){if(Lt=Ke+5+t[Ke+4],Lt===Ke+Mr)continue}else Lt=Ke+4;switch(nt){case v:if(qe){if(y&&(l=ua(y,this.logger))){if(this.videoParser===null)switch(c.segmentCodec){case"avc":this.videoParser=new cc;break;case"hevc":this.videoParser=new hc;break}this.videoParser!==null&&this.videoParser.parsePES(c,m,l,!1)}y={data:[],size:0}}y&&(y.data.push(t.subarray(Lt,Ke+Mr)),y.size+=Ke+Mr-Lt);break;case S:if(qe){if(D&&(l=ua(D,this.logger)))switch(p.segmentCodec){case"aac":this.parseAACPES(p,l);break;case"mp3":this.parseMPEGPES(p,l);break;case"ac3":this.parseAC3PES(p,l);break}D={data:[],size:0}}D&&(D.data.push(t.subarray(Lt,Ke+Mr)),D.size+=Ke+Mr-Lt);break;case C:qe&&(K&&(l=ua(K,this.logger))&&this.parseID3PES(_,l),K={data:[],size:0}),K&&(K.data.push(t.subarray(Lt,Ke+Mr)),K.size+=Ke+Mr-Lt);break;case 0:qe&&(Lt+=t[Lt]+1),_e=this._pmtId=Th(t,Lt);break;case _e:{qe&&(Lt+=t[Lt]+1);const ii=Lh(t,Lt,this.typeSupported,s,this.observer,this.logger);v=ii.videoPid,v>0&&(c.pid=v,c.segmentCodec=ii.segmentVideoCodec),S=ii.audioPid,S>0&&(p.pid=S,p.segmentCodec=ii.segmentAudioCodec),C=ii.id3Pid,C>0&&(_.pid=C),B!==null&&!ee&&(this.logger.warn(`MPEG-TS PMT found at ${Ke} after unknown PID '${B}'. Backtracking to sync byte @${Ie} to parse all TS packets.`),B=null,Ke=Ie-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:B=nt;break}}else Fe++;Fe>0&&nu(this.observer,new Error(`Found ${Fe} TS packet/s that do not start with 0x47`),void 0,this.logger),c.pesData=y,p.pesData=D,_.pesData=K;const it={audioTrack:p,videoTrack:c,id3Track:_,textTrack:m};return o&&this.extractRemainingSamples(it),it}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,p=n.pesData,_=o.pesData;let m;if(c&&(m=ua(c,this.logger))){if(this.videoParser===null)switch(s.segmentCodec){case"avc":this.videoParser=new cc;break;case"hevc":this.videoParser=new hc;break}this.videoParser!==null&&(this.videoParser.parsePES(s,l,m,!0),s.pesData=null)}else s.pesData=c;if(p&&(m=ua(p,this.logger))){switch(n.segmentCodec){case"aac":this.parseAACPES(n,m);break;case"mp3":this.parseMPEGPES(n,m);break;case"ac3":this.parseAC3PES(n,m);break}n.pesData=null}else p!=null&&p.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=p;_&&(m=ua(_,this.logger))?(this.parseID3PES(o,m),o.pesData=null):o.pesData=_}demuxSampleAes(t,n,s){const o=this.demux(t,s,!0,!this.config.progressive),l=this.sampleAes=new Ro(this.observer,this.config,n);return this.decrypt(o,l)}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,S=o.sample.unit.byteLength;if(y===-1)l=Nt(o.sample.unit,l);else{const C=S-y;o.sample.unit.set(l.subarray(0,y),C),t.samples.push(o.sample),s=o.missing}}let c,p;for(c=s,p=l.length;c<p-1&&!ul(l,c);c++);if(c!==s){let y;const S=c<p-1;if(S?y=`AAC PES did not start with ADTS header,offset:${c}`:y="No ADTS header found in AAC PES",nu(this.observer,new Error(y),S,this.logger),!S)return}ju(t,this.observer,l,c,this.audioCodec);let _;if(n.pts!==void 0)_=n.pts;else if(o){const y=qu(t.samplerate);_=o.sample.pts+y}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let m=0,v;for(;c<p;)if(v=cl(t,l,c,_,m),c+=v.length,v.missing){this.aacOverFlow=v;break}else for(m++;c<p-1&&!ul(l,c);c++);}parseMPEGPES(t,n){const s=n.data,o=s.length;let l=0,c=0;const p=n.pts;if(p===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;c<o;)if(sc(s,c)){const _=nc(t,s,c,p,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,p=0,_;for(;p<l&&(_=lc(t,s,p,o,c++))>0;)p+=_}}parseID3PES(t,n){if(n.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=k({},n,{type:this._videoTrack?vr.emsg:vr.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(s)}}function Io(h,t){return((h[t+1]&31)<<8)+h[t+2]}function Th(h,t){return(h[t+10]&31)<<8|h[t+11]}function Lh(h,t,n,s,o,l){const c={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},p=(h[t+1]&15)<<8|h[t+2],_=t+3+p-4,m=(h[t+10]&15)<<8|h[t+11];for(t+=12+m;t<_;){const v=Io(h,t),y=(h[t+3]&15)<<8|h[t+4];switch(h[t]){case 207:if(!s){Ta("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){Ta("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){Ta("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 S=t+5,C=y;for(;C>2;){switch(h[S]){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 K=h[S+1]+2;S+=K,C-=K}}break;case 194:case 135:return nu(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 nu(h,t,n,s){s.warn(`parsing error: ${t.message}`),h.emit(w.ERROR,w.ERROR,{type:me.MEDIA_ERROR,details:J.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:t,reason:t.message})}function Ta(h,t){t.log(`${h} with AES-128-CBC encryption found in unencrypted stream`)}function ua(h,t){let n=0,s,o,l,c,p;const _=h.data;if(!h||h.size===0)return null;for(;_[0].length<19&&_.length>1;)_[0]=Nt(_[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?(p=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,c-p>60*9e4&&(t.warn(`${Math.round((c-p)/9e4)}s delta between PTS and DTS, align them`),c=p)):p=c),l=s[8];let y=l+9;if(h.size<=y)return null;h.size-=y;const S=new Uint8Array(h.size);for(let C=0,D=_.length;C<D;C++){s=_[C];let K=s.byteLength;if(y)if(y>K){y-=K;continue}else s=s.subarray(y),K-=y,y=0;S.set(s,n),n+=K}return o&&(o-=l+3),{data:S,pts:c,dts:p,len:o}}return null}class Dh{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 qs=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]),p=new Uint8Array([97,118,99,49]),_=new Uint8Array([0,0,0,1]);Ge.FTYP=Ge.box(Ge.types.ftyp,c,_,c,p),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/(qs+1)),o=Math.floor(n%(qs+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/(qs+1)),o=Math.floor(n%(qs+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 p=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,m=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,m>>8&255,m&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]),p,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/(qs+1)),p=Math.floor(s%(qs+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,p>>24,p>>16&255,p>>8&255,p&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/(qs+1)),c=Math.floor(n%(qs+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 p,_,m,v,y,S;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),p=0;p<o;p++)_=s[p],m=_.duration,v=_.size,y=_.flags,S=_.cts,c.set([m>>>24&255,m>>>16&255,m>>>8&255,m&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,S>>>24&255,S>>>16&255,S>>>8&255,S&255],12+16*p);return Ge.box(Ge.types.trun,c)}static initSegment(t){Ge.types||Ge.init();const n=Ge.moov(t);return Nt(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 D=0;D<s.length;D+=1){c+=3;for(let K=0;K<s[D].length;K+=1)c+=2+s[D][K].length}const p=new Uint8Array(c);p.set(l,0),c=l.length;const _=s.length-1;for(let D=0;D<s.length;D+=1){p.set(new Uint8Array([32+D|(D===_?128:0),0,s[D].length]),c),c+=3;for(let K=0;K<s[D].length;K+=1)p.set(new Uint8Array([s[D][K].length>>8,s[D][K].length&255]),c),c+=2,p.set(s[D][K],c),c+=s[D][K].length}const m=Ge.box(Ge.types.hvcC,p),v=t.width,y=t.height,S=t.pixelRatio[0],C=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]),m,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([S>>24,S>>16&255,S>>8&255,S&255,C>>24,C>>16&255,C>>8&255,C&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 fc=9e4;function ru(h,t,n=1,s=!1){const o=h*t*n;return s?Math.round(o):o}function su(h,t,n=1,s=!1){return ru(h,t,1/n,s)}function La(h,t=!1){return ru(h,1e3,1/fc,t)}function au(h,t=1){return ru(h,fc,1/t)}const Ch=10*1e3,Mh=1024,Rh=1152,ou=1536;let ca=null,Po=null;function dl(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 pl{constructor(t,n,s,o){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=n,this.typeSupported=s,this.logger=o,this.ISGenerated=!1,ca===null){const c=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ca=c?parseInt(c[1]):0}if(Po===null){const l=navigator.userAgent.match(/Safari\/(\d+)/i);Po=l?parseInt(l[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: 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 p=c.pts,_=p-l;return _<-4294967296&&(n=!0,p=fs(p,s),_=p-l),_>0?l:p},s);return n&&this.logger.debug("PTS rollover detected"),o}remux(t,n,s,o,l,c,p,_){let m,v,y,S,C,D,K=l,B=l;const ee=t.pid>-1,_e=n.pid>-1,he=n.samples.length,Ie=t.samples.length>0,Fe=p&&he>0||he>1;if((!ee||Ie)&&(!_e||Fe)||this.ISGenerated||p){if(this.ISGenerated){var Ke,qe,nt,Ue;const pi=this.videoTrackConfig;(pi&&(n.width!==pi.width||n.height!==pi.height||((Ke=n.pixelRatio)==null?void 0:Ke[0])!==((qe=pi.pixelRatio)==null?void 0:qe[0])||((nt=n.pixelRatio)==null?void 0:nt[1])!==((Ue=pi.pixelRatio)==null?void 0:Ue[1]))||!pi&&Fe||this.nextAudioPts===null&&Ie)&&this.resetInitSegment()}this.ISGenerated||(y=this.generateIS(t,n,l,c));const Lt=this.isVideoContiguous;let ii=-1,Ri;if(Fe&&(ii=lu(n.samples),!Lt&&this.config.forceKeyFrameOnDiscontinuity))if(D=!0,ii>0){this.logger.warn(`[mp4-remuxer]: Dropped ${ii} out of ${he} video samples due to a missing keyframe`);const pi=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(ii),n.dropped+=ii,B+=(n.samples[0].pts-pi)/n.inputTimeScale,Ri=B}else ii===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${he} video samples`),D=!1);if(this.ISGenerated){if(Ie&&Fe){const pi=this.getVideoStartPts(n.samples),Qt=(fs(t.samples[0].pts,pi)-pi)/n.inputTimeScale;K+=Math.max(0,Qt),B+=Math.max(0,-Qt)}if(Ie){if(t.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),y=this.generateIS(t,n,l,c)),v=this.remuxAudio(t,K,this.isAudioContiguous,c,_e||Fe||_===P.AUDIO?B:void 0),Fe){const pi=v?v.endPTS-v.startPTS:0;n.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),y=this.generateIS(t,n,l,c)),m=this.remuxVideo(n,B,Lt,pi)}}else Fe&&(m=this.remuxVideo(n,B,Lt,0));m&&(m.firstKeyFrame=ii,m.independent=ii!==-1,m.firstKeyFramePTS=Ri)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(C=dc(s,l,this._initPTS,this._initDTS)),o.samples.length&&(S=pc(o,l,this._initPTS))),{audio:v,video:m,initSegment:y,independent:D,text:S,id3:C}}generateIS(t,n,s,o){const l=t.samples,c=n.samples,p=this.typeSupported,_={},m=this._initPTS;let v=!m||o,y="audio/mp4",S,C,D,K;if(v&&(S=C=1/0),t.config&&l.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":p.mpeg?(y="audio/mpeg",t.codec=""):p.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3";break}_.audio={id:"audio",container:y,codec:t.codec,initSegment:t.segmentCodec==="mp3"&&p.mpeg?new Uint8Array(0):Ge.initSegment([t]),metadata:{channelCount:t.channelCount}},v&&(K=t.id,D=t.inputTimeScale,!m||D!==m.timescale?S=C=l[0].pts-Math.round(D*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(K=n.id,D=n.inputTimeScale,!m||D!==m.timescale){const B=this.getVideoStartPts(c),ee=Math.round(D*s);C=Math.min(C,fs(c[0].dts,B)-ee),S=Math.min(S,B-ee)}else v=!1;this.videoTrackConfig={width:n.width,height:n.height,pixelRatio:n.pixelRatio}}if(Object.keys(_).length)return this.ISGenerated=!0,v?(this._initPTS={baseTime:S,timescale:D},this._initDTS={baseTime:C,timescale:D}):S=D=void 0,{tracks:_,initPTS:S,timescale:D,trackId:K}}remuxVideo(t,n,s,o){const l=t.inputTimeScale,c=t.samples,p=[],_=c.length,m=this._initPTS;let v=this.nextAvcDts,y=8,S=this.videoSampleDuration,C,D,K=Number.POSITIVE_INFINITY,B=Number.NEGATIVE_INFINITY,ee=!1;if(!s||v===null){const zt=n*l,Ht=c[0].pts-fs(c[0].dts,c[0].pts);ca&&v!==null&&Math.abs(zt-Ht-v)<15e3?s=!0:v=zt-Ht}const _e=m.baseTime*l/m.timescale;for(let zt=0;zt<_;zt++){const Ht=c[zt];Ht.pts=fs(Ht.pts-_e,v),Ht.dts=fs(Ht.dts-_e,v),Ht.dts<c[zt>0?zt-1:zt].dts&&(ee=!0)}ee&&c.sort(function(zt,Ht){const Zi=zt.dts-Ht.dts,zi=zt.pts-Ht.pts;return Zi||zi}),C=c[0].dts,D=c[c.length-1].dts;const he=D-C,Ie=he?Math.round(he/(_-1)):S||t.inputTimeScale/30;if(s){const zt=C-v,Ht=zt>Ie,Zi=zt<-1;if((Ht||Zi)&&(Ht?this.logger.warn(`${(t.segmentCodec||"").toUpperCase()}: ${La(zt,!0)} ms (${zt}dts) hole between fragments detected at ${n.toFixed(3)}`):this.logger.warn(`${(t.segmentCodec||"").toUpperCase()}: ${La(-zt,!0)} ms (${zt}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!Zi||v>=c[0].pts||ca)){C=v;const zi=c[0].pts-zt;if(Ht)c[0].dts=C,c[0].pts=zi;else{let tn=!0;for(let mn=0;mn<c.length&&!(c[mn].dts>zi&&tn);mn++){const un=c[mn].pts;if(c[mn].dts-=zt,c[mn].pts-=zt,mn<c.length-1){const Zn=c[mn+1].pts,Tr=c[mn].pts,ls=Zn<=Tr,Ia=Zn<=un;tn=ls==Ia}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${La(zi,!0)}/${La(C,!0)}, delta: ${La(zt,!0)} ms`)}}C=Math.max(0,C);let Fe=0,it=0,Ke=C;for(let zt=0;zt<_;zt++){const Ht=c[zt],Zi=Ht.units,zi=Zi.length;let tn=0;for(let mn=0;mn<zi;mn++)tn+=Zi[mn].data.length;it+=tn,Fe+=zi,Ht.length=tn,Ht.dts<Ke?(Ht.dts=Ke,Ke+=Ie/4|0||1):Ke=Ht.dts,K=Math.min(Ht.pts,K),B=Math.max(Ht.pts,B)}D=c[_-1].dts;const qe=it+4*Fe+8;let nt;try{nt=new Uint8Array(qe)}catch(zt){this.observer.emit(w.ERROR,w.ERROR,{type:me.MUX_ERROR,details:J.REMUX_ALLOC_ERROR,fatal:!1,error:zt,bytes:qe,reason:`fail allocating video mdat ${qe}`});return}const Ue=new DataView(nt.buffer);Ue.setUint32(0,qe),nt.set(Ge.types.mdat,4);let Lt=!1,ii=Number.POSITIVE_INFINITY,Ri=Number.POSITIVE_INFINITY,pi=Number.NEGATIVE_INFINITY,gi=Number.NEGATIVE_INFINITY;for(let zt=0;zt<_;zt++){const Ht=c[zt],Zi=Ht.units;let zi=0;for(let un=0,Zn=Zi.length;un<Zn;un++){const Tr=Zi[un],ls=Tr.data,Ia=Tr.data.byteLength;Ue.setUint32(y,Ia),y+=4,nt.set(ls,y),y+=Ia,zi+=4+Ia}let tn;if(zt<_-1)S=c[zt+1].dts-Ht.dts,tn=c[zt+1].pts-Ht.pts;else{const un=this.config,Zn=zt>0?Ht.dts-c[zt-1].dts:Ie;if(tn=zt>0?Ht.pts-c[zt-1].pts:Ie,un.stretchShortVideoTrack&&this.nextAudioPts!==null){const Tr=Math.floor(un.maxBufferHole*l),ls=(o?K+o*l:this.nextAudioPts)-Ht.pts;ls>Tr?(S=ls-Zn,S<0?S=Zn:Lt=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${ls/90} ms to the next segment; using duration ${S/90} ms for the last video frame.`)):S=Zn}else S=Zn}const mn=Math.round(Ht.pts-Ht.dts);ii=Math.min(ii,S),pi=Math.max(pi,S),Ri=Math.min(Ri,tn),gi=Math.max(gi,tn),p.push(dl(Ht.key,S,zi,mn))}if(p.length){if(ca){if(ca<70){const zt=p[0].flags;zt.dependsOn=2,zt.isNonSync=0}}else if(Po&&gi-Ri<pi-ii&&Ie/pi<.025&&p[0].cts===0){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let zt=C;for(let Ht=0,Zi=p.length;Ht<Zi;Ht++){const zi=zt+p[Ht].duration,tn=zt+p[Ht].cts;if(Ht<Zi-1){const mn=zi+p[Ht+1].cts;p[Ht].duration=mn-tn}else p[Ht].duration=Ht?p[Ht-1].duration:Ie;p[Ht].cts=0,zt=zi}}}S=Lt||!S?Ie:S,this.nextAvcDts=v=D+S,this.videoSampleDuration=S,this.isVideoContiguous=!0;const Ei={data1:Ge.moof(t.sequenceNumber++,C,k(t,{samples:p})),data2:nt,startPTS:K/l,endPTS:(B+S)/l,startDTS:C/l,endDTS:v/l,type:"video",hasAudio:!1,hasVideo:!0,nb:p.length,dropped:t.dropped};return t.samples=[],t.dropped=0,Ei}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return Rh;case"ac3":return ou;default:return Mh}}remuxAudio(t,n,s,o,l){const c=t.inputTimeScale,p=t.samplerate?t.samplerate:c,_=c/p,m=this.getSamplesPerFrame(t),v=m*_,y=this._initPTS,S=t.segmentCodec==="mp3"&&this.typeSupported.mpeg,C=[],D=l!==void 0;let K=t.samples,B=S?0:8,ee=this.nextAudioPts||-1;const _e=n*c,he=y.baseTime*c/y.timescale;if(this.isAudioContiguous=s=s||K.length&&ee>0&&(o&&Math.abs(_e-ee)<9e3||Math.abs(fs(K[0].pts-he,_e)-ee)<20*v),K.forEach(function(Qt){Qt.pts=fs(Qt.pts-he,_e)}),!s||ee<0){if(K=K.filter(Qt=>Qt.pts>=0),!K.length)return;l===0?ee=0:o&&!D?ee=Math.max(0,_e):ee=K[0].pts}if(t.segmentCodec==="aac"){const Qt=this.config.maxAudioFramesDrift;for(let yi=0,Ei=ee;yi<K.length;yi++){const zt=K[yi],Ht=zt.pts,Zi=Ht-Ei,zi=Math.abs(1e3*Zi/c);if(Zi<=-Qt*v&&D)yi===0&&(this.logger.warn(`Audio frame @ ${(Ht/c).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Zi/c)} ms.`),this.nextAudioPts=ee=Ei=Ht);else if(Zi>=Qt*v&&zi<Ch&&D){let tn=Math.round(Zi/v);Ei=Ht-tn*v,Ei<0&&(tn--,Ei+=v),yi===0&&(this.nextAudioPts=ee=Ei),this.logger.warn(`[mp4-remuxer]: Injecting ${tn} audio frame @ ${(Ei/c).toFixed(3)}s due to ${Math.round(1e3*Zi/c)} ms gap.`);for(let mn=0;mn<tn;mn++){const un=Math.max(Ei,0);let Zn=Dh.getSilentFrame(t.parsedCodec||t.manifestCodec||t.codec,t.channelCount);Zn||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Zn=zt.unit.subarray()),K.splice(yi,0,{unit:Zn,pts:un}),Ei+=v,yi++}}zt.pts=Ei,Ei+=v}}let Ie=null,Fe=null,it,Ke=0,qe=K.length;for(;qe--;)Ke+=K[qe].unit.byteLength;for(let Qt=0,yi=K.length;Qt<yi;Qt++){const Ei=K[Qt],zt=Ei.unit;let Ht=Ei.pts;if(Fe!==null){const zi=C[Qt-1];zi.duration=Math.round((Ht-Fe)/_)}else if(s&&t.segmentCodec==="aac"&&(Ht=ee),Ie=Ht,Ke>0){Ke+=B;try{it=new Uint8Array(Ke)}catch(zi){this.observer.emit(w.ERROR,w.ERROR,{type:me.MUX_ERROR,details:J.REMUX_ALLOC_ERROR,fatal:!1,error:zi,bytes:Ke,reason:`fail allocating audio mdat ${Ke}`});return}S||(new DataView(it.buffer).setUint32(0,Ke),it.set(Ge.types.mdat,4))}else return;it.set(zt,B);const Zi=zt.byteLength;B+=Zi,C.push(dl(!0,m,Zi,0)),Fe=Ht}const nt=C.length;if(!nt)return;const Ue=C[C.length-1];this.nextAudioPts=ee=Fe+_*Ue.duration;const Lt=S?new Uint8Array(0):Ge.moof(t.sequenceNumber++,Ie/_,k({},t,{samples:C}));t.samples=[];const ii=Ie/c,Ri=ee/c,gi={data1:Lt,data2:it,startPTS:ii,endPTS:Ri,startDTS:ii,endDTS:Ri,type:"audio",hasAudio:!0,hasVideo:!1,nb:nt};return this.isAudioContiguous=!0,gi}}function fs(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 lu(h){for(let t=0;t<h.length;t++)if(h[t].key)return t;return-1}function dc(h,t,n,s){const o=h.samples.length;if(!o)return;const l=h.inputTimeScale;for(let p=0;p<o;p++){const _=h.samples[p];_.pts=fs(_.pts-n.baseTime*l/n.timescale,t*l)/l,_.dts=fs(_.dts-s.baseTime*l/s.timescale,t*l)/l}const c=h.samples;return h.samples=[],{samples:c}}function pc(h,t,n){const s=h.samples.length;if(!s)return;const o=h.inputTimeScale;for(let c=0;c<s;c++){const p=h.samples[c];p.pts=fs(p.pts-n.baseTime*o/n.timescale,t*o)/o}h.samples.sort((c,p)=>c.pts-p.pts);const l=h.samples;return h.samples=[],{samples:l}}class Ih{constructor(t,n,s,o){this.logger=void 0,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,this.logger=o}destroy(){}resetTimeStamp(t){this.initPTS=t,this.lastEndTime=null}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(t,n,s,o){this.audioCodec=n,this.videoCodec=s,this.generateInitSegment(yt(t,o)),this.emitInitSegment=!0}generateInitSegment(t){let{audioCodec:n,videoCodec:s}=this;if(!(t!=null&&t.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const o=this.initData=ot(t);o.audio&&(n=ri(o.audio,A.AUDIO,this.logger)),o.video&&(s=ri(o.video,A.VIDEO,this.logger));const l={};o.audio&&o.video?l.audiovideo={container:"video/mp4",codec:n+","+s,supplemental:o.video.supplemental,initSegment:t,id:"main"}:o.audio?l.audio={container:"audio/mp4",codec:n,initSegment:t,id:"audio"}:o.video?l.video={container:"video/mp4",codec:s,supplemental:o.video.supplemental,initSegment:t,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=l}remux(t,n,s,o,l,c){var p,_;let{initPTS:m,lastEndTime:v}=this;const y={audio:void 0,video:void 0,text:o,id3:s,initSegment:void 0};ue(v)||(v=this.lastEndTime=l||0);const S=n.samples;if(!(S!=null&&S.length))return y;const C={initPTS:void 0,timescale:void 0,trackId:void 0};let D=this.initData;if((p=D)!=null&&p.length||(this.generateInitSegment(S),D=this.initData),!((_=D)!=null&&_.length))return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),y;this.emitInitSegment&&(C.tracks=this.initTracks,this.emitInitSegment=!1);const K=gt(S,D,this.logger),B=D.audio?K[D.audio.id]:null,ee=D.video?K[D.video.id]:null,_e=ml(ee,1/0),he=ml(B,1/0),Ie=ml(ee,0,!0),Fe=ml(B,0,!0);let it,Ke=l,qe=0;if(B&&(!ee||!m&&he<_e||m&&m.trackId===D.audio.id)?(C.trackId=D.audio.id,it=B,qe=Fe-he):ee&&(C.trackId=D.video.id,it=ee,qe=Ie-_e),it){const Qt=it.timescale;Ke=it.start/Qt,C.timescale=Qt,m||(C.initPTS=it.start-l*Qt,this.initPTS=m={baseTime:C.initPTS,timescale:Qt,trackId:C.trackId})}(c||!m)&&(uu(m,Ke,l,qe)||C.timescale!==m.timescale)&&(C.initPTS=Ke-l,m&&m.timescale===1&&this.logger.warn(`Adjusting initPTS @${l} from ${m.baseTime/m.timescale} to ${C.initPTS}`),this.initPTS=m={baseTime:C.initPTS,timescale:1});const nt=t?Ke-m.baseTime/m.timescale:v;Se(D,S,m.baseTime/m.timescale);const Ue=nt+qe;qe>0?this.lastEndTime=Ue:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Lt=!!D.audio,ii=!!D.video;let Ri="";Lt&&(Ri+="audio"),ii&&(Ri+="video");const pi={data1:S,startPTS:nt,startDTS:nt,endPTS:Ue,endDTS:Ue,type:Ri,hasAudio:Lt,hasVideo:ii,nb:1,dropped:0};y.audio=Lt&&!ii?pi:void 0,y.video=ii?pi:void 0;const gi=ee==null?void 0:ee.sampleCount;if(gi){const Qt=ee.keyFrameIndex,yi=Qt!==-1;pi.nb=gi,pi.dropped=Qt===0||this.isVideoContiguous?0:yi?Qt:gi,pi.independent=yi,pi.firstKeyFrame=Qt,yi&&ee.keyFrameStart&&(pi.firstKeyFramePTS=ee.keyFrameStart-m.baseTime/m.timescale),this.isVideoContiguous||(y.independent=yi),this.isVideoContiguous||(this.isVideoContiguous=yi),pi.dropped&&this.logger.warn(`fmp4 does not start with IDR: firstIDR ${Qt}/${gi} dropped: ${pi.dropped} pts: ${pi.firstKeyFramePTS||"NA"}`)}return y.initSegment=C,y.id3=dc(s,l,m,m),o.samples.length&&(y.text=pc(o,l,m)),y}}function ml(h,t,n=!1){return(h==null?void 0:h.start)!==void 0?(h.start+(n?h.duration:0))/h.timescale:t}function uu(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 ri(h,t,n){const s=h==null?void 0:h.codec;return s&&s.length>4?s:t===A.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?ct(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 Rr;try{Rr=self.performance.now.bind(self.performance)}catch(h){Rr=Date.now}const gl=[{demux:Ah,remux:Ih},{demux:la,remux:pl},{demux:Sh,remux:pl},{demux:Eh,remux:pl}];gl.splice(2,0,{demux:iu,remux:pl});class mc{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=Rr();let c=new Uint8Array(t);const{currentTransmuxState:p,transmuxConfig:_}=this;o&&(this.currentTransmuxState=o);const{contiguous:m,discontinuity:v,trackSwitch:y,accurateTimeOffset:S,timeOffset:C,initSegmentChange:D}=o||p,{audioCodec:K,videoCodec:B,defaultInitPts:ee,duration:_e,initSegmentData:he}=_,Ie=ns(c,n);if(Ie&&ir(Ie.method)){const qe=this.getDecrypter(),nt=Qr(Ie.method);if(qe.isSync()){let Ue=qe.softwareDecrypt(c,Ie.key.buffer,Ie.iv.buffer,nt);if(s.part>-1){const ii=qe.flush();Ue=ii&&ii.buffer}if(!Ue)return l.executeEnd=Rr(),io(s);c=new Uint8Array(Ue)}else return this.asyncResult=!0,this.decryptionPromise=qe.webCryptoDecrypt(c,Ie.key.buffer,Ie.iv.buffer,nt).then(Ue=>{const Lt=this.push(Ue,null,s);return this.decryptionPromise=null,Lt}),this.decryptionPromise}const Fe=this.needsProbing(v,y);if(Fe){const qe=this.configureTransmuxer(c);if(qe)return this.logger.warn(`[transmuxer] ${qe.message}`),this.observer.emit(w.ERROR,w.ERROR,{type:me.MEDIA_ERROR,details:J.FRAG_PARSING_ERROR,fatal:!1,error:qe,reason:qe.message}),l.executeEnd=Rr(),io(s)}(v||y||D||Fe)&&this.resetInitSegment(he,K,B,_e,n),(v||D||Fe)&&this.resetInitialTimestamp(ee),m||this.resetContiguity();const it=this.transmux(c,Ie,C,S,s);this.asyncResult=Oo(it);const Ke=this.currentTransmuxState;return Ke.contiguous=!0,Ke.discontinuity=!1,Ke.trackSwitch=!1,l.executeEnd=Rr(),it}flush(t){const n=t.transmuxing;n.executeStart=Rr();const{decrypter:s,currentTransmuxState:o,decryptionPromise:l}=this;if(l)return this.asyncResult=!0,l.then(()=>this.flush(t));const c=[],{timeOffset:p}=o;if(s){const y=s.flush();y&&c.push(this.push(y.buffer,null,t))}const{demuxer:_,remuxer:m}=this;if(!_||!m){n.executeEnd=Rr();const y=[io(t)];return this.asyncResult?Promise.resolve(y):y}const v=_.flush(p);return Oo(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:p}=n,{accurateTimeOffset:_,timeOffset:m}=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,p,m,_,!0,this.id);t.push({remuxResult:v,chunkMeta:s}),s.transmuxing.executeEnd=Rr()}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:p}=this;!c||!p||(c.resetInitSegment(t,n,s,o),p.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:p,textTrack:_}=this.demuxer.demux(t,n,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(l,c,p,_,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,S=gl.length;y<S;y++){var c;if((c=gl[y].demux)!=null&&c.probe(t,this.logger)){l=gl[y];break}}if(!l)return new Error("Failed to find demuxer by probing fragment data");const p=this.demuxer,_=this.remuxer,m=l.remux,v=l.demux;(!_||!(_ instanceof m))&&(this.remuxer=new m(s,n,o,this.logger)),(!p||!(p 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 Er(this.config)),t}}function ns(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 io=h=>({remuxResult:{},chunkMeta:h});function Oo(h){return"then"in h&&h.then instanceof Function}class Jf{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 Qf{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 no=0;class As{constructor(t,n,s,o){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=no++,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 m=_.data,v=this.hls;if(!(!v||!(m!=null&&m.event)||m.instanceNo!==this.instanceNo))switch(m.event){case"init":{var y;const S=(y=this.workerContext)==null?void 0:y.objectURL;S&&self.URL.revokeObjectURL(S);break}case"transmuxComplete":{this.handleTransmuxComplete(m.data);break}case"flush":{this.onFlush(m.data);break}case"workerLog":{v.logger[m.data.logType]&&v.logger[m.data.logType](m.data.message);break}default:{m.data=m.data||{},m.data.frag=this.frag,m.data.part=this.part,m.data.id=this.id,v.trigger(m.event,m.data);break}}},this.onWorkerError=_=>{if(!this.hls)return;const m=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(w.ERROR,{type:me.OTHER_ERROR,details:J.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:m})};const l=t.config;this.hls=t,this.id=n,this.useWorker=!!l.enableWorker,this.onTransmuxComplete=s,this.onFlush=o;const c=(_,m)=>{m=m||{},m.frag=this.frag||void 0,_===w.ERROR&&(m=m,m.parent=this.id,m.part=this.part,this.error=m.error),this.hls.trigger(_,m)};this.observer=new Gs,this.observer.on(w.FRAG_DECRYPTED,c),this.observer.on(w.ERROR,c);const p=di(l.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const _=this.hls.logger;if(l.workerPath||ah()){try{l.workerPath?(_.log(`loading Web Worker ${l.workerPath} for "${n}"`),this.workerContext=ol(l.workerPath)):(_.log(`injecting Web Worker for "${n}"`),this.workerContext=oh());const{worker:v}=this.workerContext;v.addEventListener("message",this.onWorkerMessage),v.addEventListener("error",this.onWorkerError),v.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:p,id:n,config:Vi(l)})}catch(v){_.warn(`Error setting up "${n}" Web Worker, fallback to inline`,v),this.terminateWorker(),this.error=null,this.transmuxer=new mc(this.observer,p,l,"",n,t.logger)}return}}this.transmuxer=new mc(this.observer,p,l,"",n,t.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const t=this.instanceNo;this.instanceNo=no++;const n=this.hls.config,s=di(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:s,id:this.id,config:Vi(n)})}}terminateWorker(){if(this.workerContext){const{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),lh(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,p,_,m,v){var y,S;m.transmuxing.start=self.performance.now();const{instanceNo:C,transmuxer:D}=this,K=c?c.start:l.start,B=l.decryptdata,ee=this.frag,_e=!(ee&&l.cc===ee.cc),he=!(ee&&m.level===ee.level),Ie=ee?m.sn-ee.sn:-1,Fe=this.part?m.part-this.part.index:-1,it=Ie===0&&m.id>1&&m.id===(ee==null?void 0:ee.stats.chunkCount),Ke=!he&&(Ie===1||Ie===0&&(Fe===1||it&&Fe<=0)),qe=self.performance.now();(he||Ie||l.stats.parsing.start===0)&&(l.stats.parsing.start=qe),c&&(Fe||!Ke)&&(c.stats.parsing.start=qe);const nt=!(ee&&((y=l.initSegment)==null?void 0:y.url)===((S=ee.initSegment)==null?void 0:S.url)),Ue=new Qf(_e,Ke,_,he,K,nt);if(!Ke||_e||nt){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${l.type} sn: ${m.sn}${m.part>-1?" part: "+m.part:""} ${this.id===P.MAIN?"level":"track"}: ${m.level} id: ${m.id}
|
|
|
discontinuity: ${_e}
|
|
|
trackSwitch: ${he}
|
|
|
contiguous: ${Ke}
|
|
|
accurateTimeOffset: ${_}
|
|
|
timeOffset: ${K}
|
|
|
initSegmentChange: ${nt}`);const Lt=new Jf(s,o,n,p,v);this.configureTransmuxer(Lt)}if(this.frag=l,this.part=c,this.workerContext)this.workerContext.worker.postMessage({instanceNo:C,cmd:"demux",data:t,decryptdata:B,chunkMeta:m,state:Ue},t instanceof ArrayBuffer?[t]:[]);else if(D){const Lt=D.push(t,B,m,Ue);Oo(Lt)?Lt.then(ii=>{this.handleTransmuxComplete(ii)}).catch(ii=>{this.transmuxerError(ii,m,"transmuxer-interface push error")}):this.handleTransmuxComplete(Lt)}}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);Oo(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(w.ERROR,{type:me.MEDIA_ERROR,details:J.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 Ph=100;class Da extends Pn{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(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.BUFFER_RESET,this.onBufferReset,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(w.FRAG_LOADING,this.onFragLoading,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:t}=this;t&&(super.unregisterListeners(),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.BUFFER_RESET,this.onBufferReset,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(w.FRAG_LOADING,this.onFragLoading,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(t,{frag:n,id:s,initPTS:o,timescale:l}){if(s===P.MAIN){const c=n.cc,p=this.fragCurrent;if(this.initPTS[c]={baseTime:o,timescale:l},this.log(`InitPTS for cc: ${c} found from main: ${o}/${l}`),this.mainAnchor=n,this.state===rt.WAITING_INIT_PTS){const _=this.waitingData;(!_&&!this.loadingParts||_&&_.frag.cc!==c)&&this.syncWithAnchor(n,_==null?void 0:_.frag)}else!this.hls.hasEnoughToStart&&p&&p.cc!==c?(p.abortRequests(),this.syncWithAnchor(n,p)):this.state===rt.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(),p=this.getLoadPosition(),_=Gi(c,l,p);_&&(this.log(`Waiting fragment cc (${n==null?void 0:n.cc}) cancelled because video is at cc ${t.cc}`),this.startFragRequested=!1,this.nextLoadPosition=_.start,this.resetLoadingState(),this.state===rt.IDLE&&this.doTickIdle())}startLoad(t,n){if(!this.levels){this.startPosition=t,this.state=rt.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Ph),s>0&&t===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),t=s,this.state=rt.IDLE):this.state=rt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}doTick(){switch(this.state){case rt.IDLE:this.doTickIdle();break;case rt.WAITING_TRACK:{const{levels:n,trackId:s}=this,o=n==null?void 0:n[s],l=o==null?void 0:o.details;if(l&&!this.waitForLive(o)){if(this.waitForCdnTuneIn(l))break;this.state=rt.WAITING_INIT_PTS}break}case rt.FRAG_LOADING_WAITING_RETRY:{var t;const n=performance.now(),s=this.retryDate;if(!s||n>=s||(t=this.media)!=null&&t.seeking){const{levels:o,trackId:l}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((o==null?void 0:o[l])||null),this.state=rt.IDLE}break}case rt.WAITING_INIT_PTS:{const n=this.waitingData;if(n){const{frag:s,part:o,cache:l,complete:c}=n,p=this.mainAnchor;if(this.initPTS[s.cc]!==void 0){this.waitingData=null,this.state=rt.FRAG_LOADING;const _=l.flush().buffer,m={frag:s,part:o,payload:_,networkDetails:null};this._handleFragmentLoadProgress(m),c&&super._handleFragmentLoadComplete(m)}else p&&p.cc!==n.frag.cc&&this.syncWithAnchor(p,n.frag)}else this.state=rt.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 p=s[l],_=p.details;if(!_||this.waitForLive(p)||this.waitForCdnTuneIn(_)){this.state=rt.WAITING_TRACK,this.startFragRequested=!1;return}const m=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&m&&(this.bufferFlushed=!1,this.afterBufferFlushed(m,A.AUDIO,P.AUDIO));const v=this.getFwdBufferInfo(m,P.AUDIO);if(v===null)return;if(!this.switchingTrack&&this._streamEnded(v,_)){n.trigger(w.BUFFER_EOS,{type:"audio"}),this.state=rt.ENDED;return}const y=v.len,S=n.maxBufferLength,C=_.fragments,D=C[0].start,K=this.getLoadPosition(),B=this.flushing?K:v.end;if(this.switchingTrack&&o){const he=K;_.PTSKnown&&he<D&&(v.end>D||v.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),o.currentTime=D+.05)}if(y>=S&&!this.switchingTrack&&B<C[C.length-1].start)return;let ee=this.getNextFragment(B,_);if(ee&&this.isLoopLoading(ee,B)&&(ee=this.getNextFragmentLoopLoading(ee,_,v,P.MAIN,S)),!ee){this.bufferFlushed=!0;return}let _e=((t=this.mainFragLoading)==null?void 0:t.frag)||null;if(!this.audioOnly&&this.startFragRequested&&_e&&le(ee)&&!ee.endList&&(!_.live||!this.loadingParts&&B<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(_e)===Yi.OK&&(this.mainFragLoading=_e=null),_e&&le(_e))){if(ee.start>_e.end){const Ie=this.fragmentTracker.getFragAtPos(B,P.MAIN);Ie&&Ie.end>_e.end&&(_e=Ie,this.mainFragLoading={frag:Ie,targetBufferTime:null})}if(ee.start>_e.end)return}this.loadFragment(ee,p,B)}onMediaDetaching(t,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(t,n)}onAudioTracksUpdated(t,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(s=>new Ni(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!==rt.STOPPED&&(this.setInterval(Ph),this.state=rt.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(w.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(t,n){var s;const{levels:o}=this,{details:l,id:c,groupId:p,track:_}=n;if(!o){this.warn(`Audio tracks reset while loading track ${c} "${_.name}" of "${p}"`);return}const m=this.mainDetails;if(!m||l.endCC>m.endCC||m.expired){this.cachedTrackLoadedData=n,this.state!==rt.STOPPED&&(this.state=rt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${c} "${_.name}" of "${p}" 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 S;y=this.alignPlaylists(l,v.details,(S=this.levelLastLoaded)==null?void 0:S.details)}l.alignedSliding||(Xa(l,m),l.alignedSliding||Ja(l,m),y=l.fragmentStart)}v.details=l,this.levelLastLoaded=v,this.startFragRequested||this.setStartPosition(m,y),this.hls.trigger(w.AUDIO_TRACK_UPDATED,{details:l,id:c,groupId:n.groupId}),this.state===rt.WAITING_TRACK&&!this.waitForCdnTuneIn(l)&&(this.state=rt.IDLE),this.tick()}_handleFragmentLoadProgress(t){var n;const s=t.frag,{part:o,payload:l}=t,{config:c,trackId:p,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 m=_[p];if(!m){this.warn("Audio track is undefined on fragment load progress");return}const v=m.details;if(!v){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const y=c.defaultAudioCodec||m.audioCodec||"mp4a.40.2";let S=this.transmuxer;S||(S=this.transmuxer=new As(this.hls,P.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const C=this.initPTS[s.cc],D=(n=s.initSegment)==null?void 0:n.data;if(C!==void 0){const B=o?o.index:-1,ee=B!==-1,_e=new Rn(s.level,s.sn,s.stats.chunkCount,l.byteLength,B,ee);S.push(l,D,y,"",s,o,v.totalduration,!1,_e,C)}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 ${p}`);const{cache:K}=this.waitingData=this.waitingData||{frag:s,part:o,cache:new zr,complete:!1};K.push(new Uint8Array(l)),this.state!==rt.STOPPED&&(this.state=rt.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&&le(n.frag)&&(this.mainFragLoading=n,this.state===rt.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(le(s)){this.fragPrevious=s;const l=this.switchingTrack;l&&(this.bufferedTrack=l,this.switchingTrack=null,this.hls.trigger(w.AUDIO_TRACK_SWITCHED,M({},l)))}this.fragBufferedComplete(s,o),this.media&&this.tick()}onError(t,n){var s;if(n.fatal){this.state=rt.ERROR;return}switch(n.details){case J.FRAG_GAP:case J.FRAG_PARSING_ERROR:case J.FRAG_DECRYPT_ERROR:case J.FRAG_LOAD_ERROR:case J.FRAG_LOAD_TIMEOUT:case J.KEY_LOAD_ERROR:case J.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.AUDIO,n);break;case J.AUDIO_TRACK_LOAD_ERROR:case J.AUDIO_TRACK_LOAD_TIMEOUT:case J.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===rt.WAITING_TRACK&&((s=n.context)==null?void 0:s.type)===Le.AUDIO_TRACK&&(this.state=rt.IDLE);break;case J.BUFFER_ADD_CODEC_ERROR:case J.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.resetLoadingState();break;case J.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case J.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(t,{type:n}){n!==A.VIDEO&&(this.flushing=!0)}onBufferFlushed(t,{type:n}){if(n!==A.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===rt.ENDED&&(this.state=rt.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,p=this.getCurrentContext(c);if(!p){this.resetWhenMissingContext(c);return}const{frag:_,part:m,level:v}=p,{details:y}=v,{audio:S,text:C,id3:D,initSegment:K}=l;if(this.fragContextChanged(_)||!y){this.fragmentTracker.removeFragment(_);return}if(this.state=rt.PARSING,this.switchingTrack&&S&&this.completeAudioSwitch(this.switchingTrack),K!=null&&K.tracks){const B=_.initSegment||_;this._bufferInitSegment(v,K.tracks,B,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:s,tracks:K.tracks})}if(S){const{startPTS:B,endPTS:ee,startDTS:_e,endDTS:he}=S;m&&(m.elementaryStreams[A.AUDIO]={startPTS:B,endPTS:ee,startDTS:_e,endDTS:he}),_.setElementaryStreamInfo(A.AUDIO,B,ee,_e,he),this.bufferFragmentData(S,_,m,c)}if(D!=null&&(n=D.samples)!=null&&n.length){const B=k({id:s,frag:_,details:y},D);o.trigger(w.FRAG_PARSING_METADATA,B)}if(C){const B=k({id:s,frag:_,details:y},C);o.trigger(w.FRAG_PARSING_USERDATA,B)}}_bufferInitSegment(t,n,s,o){if(this.state!==rt.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(w.BUFFER_CODECS,n);const p=l.initSegment;if(p!=null&&p.byteLength){const _={type:"audio",frag:s,part:null,chunkMeta:o,parent:s.type,data:p};this.hls.trigger(w.BUFFER_APPENDING,_)}this.tickImmediate()}loadFragment(t,n,s){const o=this.fragmentTracker.getState(t);if(this.switchingTrack||o===Yi.NOT_LOADED||o===Yi.PARTIAL){var l;if(!le(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=rt.WAITING_INIT_PTS;const c=this.mainDetails;c&&c.fragmentStart!==n.details.fragmentStart&&Ja(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:p}=this.bufferedTrack;tt({name:n,lang:s,assocLang:o,characteristics:l,audioCodec:c,channels:p},t,St)||(Pt(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(w.AUDIO_TRACK_SWITCHED,M({},t))}}class cu extends G{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 p=o[c];let _;try{_=new self.URL(p.URI,n.url).href}catch(m){this.warn(`Could not construct new URL for Rendition Report: ${m}`),_=p.URI||""}if(_===t){l=c;break}else _===t.substring(0,_.length)&&(l=c)}if(l!==-1){const c=o[l],p=parseInt(c["LAST-MSN"])||(n==null?void 0:n.lastPartSn);let _=parseInt(c["LAST-PART"])||(n==null?void 0:n.lastPartIndex);if(this.hls.config.lowLatencyMode){const v=Math.min(n.age-n.partTarget,n.targetduration);_>=0&&v>n.partTarget&&(_+=1)}const m=s&&lr(s);return new Li(p,_>=0?_:void 0,m)}}}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(),p=l.loading.first?Math.max(0,c-l.loading.first):0;o.advancedDateTime=Date.now()-p;const _=this.hls.config.timelineOffset;if(_!==o.appliedTimelineOffset){const v=Math.max(_||0,0);o.appliedTimelineOffset=v,o.fragments.forEach(y=>{y.start=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){Qo(s,o);const _e=o.playlistParsingError;if(_e){this.warn(_e);const he=this.hls;if(!he.config.ignorePlaylistParsingErrors){var m;const{networkDetails:Ie}=n;he.trigger(w.ERROR,{type:me.NETWORK_ERROR,details:J.LEVEL_PARSING_ERROR,fatal:!1,url:o.url,error:_e,reason:_e.message,level:n.level||void 0,parent:(m=o.fragments[0])==null?void 0:m.type,networkDetails:Ie,stats:l});return}o.playlistParsingError=null}}o.requestScheduled===-1&&(o.requestScheduled=l.loading.start);const y=this.hls.mainForwardBufferInfo,S=y?y.end-y.len:0,C=(o.edge-S)*1e3,D=tl(o,C);if(o.requestScheduled+D<c?o.requestScheduled=c:o.requestScheduled+=D,this.log(`live playlist ${t} ${o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:o.updated?"UPDATED":"MISSED"}`),!this.canLoad||!o.live)return;let K,B,ee;if(o.canBlockReload&&o.endSN&&o.advanced){const _e=this.hls.config.lowLatencyMode,he=o.lastPartSn,Ie=o.endSN,Fe=o.lastPartIndex,it=Fe!==-1,Ke=he===Ie;it?Ke?(B=Ie+1,ee=_e?0:Fe):(B=he,ee=_e?Fe+1:o.maxPartIndex):B=Ie+1;const qe=o.age,nt=qe+o.ageHeader;let Ue=Math.min(nt-o.partTarget,o.targetduration*1.5);if(Ue>0){if(nt>o.targetduration*3)this.log(`Playlist last advanced ${qe.toFixed(2)}s ago. Omitting segment and part directives.`),B=void 0,ee=void 0;else if(s!=null&&s.tuneInGoal&&nt-o.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${Ue} with playlist age: ${o.age}`),Ue=0;else{const Lt=Math.floor(Ue/o.targetduration);if(B+=Lt,ee!==void 0){const ii=Math.round(Ue%o.targetduration/o.partTarget);ee+=ii}this.log(`CDN Tune-in age: ${o.ageHeader}s last advanced ${qe.toFixed(2)}s goal: ${Ue} skip sn ${Lt} to part ${ee}`)}o.tuneInGoal=Ue}if(K=this.getDeliveryDirectives(o,n.deliveryDirectives,B,ee),_e||!Ke){o.requestScheduled=c,this.loadingPlaylist(v,K);return}}else(o.canBlockReload||o.canSkipUntil)&&(K=this.getDeliveryDirectives(o,n.deliveryDirectives,B,ee));K&&B!==void 0&&o.canBlockReload&&(o.requestScheduled=l.loading.first+Math.max(D-p*2,D/2)),this.scheduleLoading(v,K,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 p=c-l;this.log(`reload live playlist ${t.name||t.bitrate+"bps"} in ${Math.round(p)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(t,n),p)}getDeliveryDirectives(t,n,s,o){let l=lr(t);return n!=null&&n.skip&&t.deltaUpdateFailed&&(s=n.msn,o=n.part,l=qi.No),new Li(s,o,l)}checkRetry(t){const n=t.details,s=vi(t),o=t.errorAction,{action:l,retryCount:c=0,retryConfig:p}=o||{},_=!!o&&!!p&&(l===Si.RetryRequest||!o.resolved&&l===Si.SendAlternateToPenaltyBox);if(_){var m;if(c>=p.maxNumRetry)return!1;if(s&&(m=t.context)!=null&&m.deliveryDirectives)this.warn(`Retrying playlist loading ${c+1}/${p.maxNumRetry} after "${n}" without delivery-directives`),this.loadPlaylist();else{const v=nn(p,c);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),v),this.warn(`Retrying playlist loading ${c+1}/${p.maxNumRetry} after "${n}" in ${v}ms`)}t.levelRetry=!0,o.resolved=!0}return _}}function hu(h,t){if(h.length!==t.length)return!1;for(let n=0;n<h.length;n++)if(!ro(h[n].attrs,t[n].attrs))return!1;return!0}function ro(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 fu(h,t){return t.label.toLowerCase()===h.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(h.lang||"").toLowerCase())}class Fo extends cu{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(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(w.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(w.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 p=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,p)}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(p=>(o==null?void 0:o.indexOf(p))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const p=this.tracks.filter(S=>!s||s.indexOf(S.groupId)!==-1);if(p.length)this.selectDefaultTrack&&!p.some(S=>S.default)&&(this.selectDefaultTrack=!1),p.forEach((S,C)=>{S.id=C});else if(!l&&!this.tracksInGroup.length)return;this.tracksInGroup=p;const _=this.hls.config.audioPreference;if(!l&&_){const S=Me(_,p,St);if(S>-1)l=p[S];else{const C=Me(_,this.tracks);l=this.tracks[C]}}let m=this.findTrackId(l);m===-1&&l&&(m=this.findTrackId(null));const v={audioTracks:p};this.log(`Updating audio tracks, ${p.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(w.AUDIO_TRACKS_UPDATED,v);const y=this.trackId;if(m!==-1&&y===-1)this.setAudioTrack(m);else if(p.length&&y===-1){var c;const S=new Error(`No audio track selected for current audio group-ID(s): ${(c=this.groupIds)==null?void 0:c.join(",")} track count: ${p.length}`);this.warn(S.message),this.hls.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:S})}}}onError(t,n){n.fatal||!n.context||n.context.type===Le.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&&tt(t,o,St))return o;const l=Me(t,this.tracksInGroup,St);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 p=at(t,n.levels,s,c,St);if(p===-1)return null;n.nextLoadLevel=p}if(t.channels||t.audioCodec){const c=Me(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(w.AUDIO_TRACK_SWITCHING,M({},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||tt(t,o,St)))return s}if(t){const{name:s,lang:o,assocLang:l,characteristics:c,audioCodec:p,channels:_}=t;for(let m=0;m<n.length;m++){const v=n[m];if(tt({name:s,lang:o,assocLang:l,characteristics:c,audioCodec:p,channels:_},v,St))return m}for(let m=0;m<n.length;m++){const v=n[m];if(ro(t.attrs,v.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return m}for(let m=0;m<n.length;m++){const v=n[m];if(ro(t.attrs,v.attrs,["LANGUAGE"]))return m}}return-1}loadPlaylist(t){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&Pt(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,p=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:""}${p&&c.live?" age "+p.toFixed(1)+(c.type?" "+c.type||0:""):""} ${l}`),this.hls.trigger(w.AUDIO_TRACK_LOADING,{url:l,id:s,groupId:o,deliveryDirectives:n||null,track:t})}}class gc{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 du=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,_c="HlsJsTrackRemovedError";class ed extends Error{constructor(t){super(t),this.name=_c}}class td extends G{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(w.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(ke(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(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.BUFFER_RESET,this.onBufferReset,this),t.on(w.BUFFER_APPENDING,this.onBufferAppending,this),t.on(w.BUFFER_CODECS,this.onBufferCodecs,this),t.on(w.BUFFER_EOS,this.onBufferEos,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(w.FRAG_PARSED,this.onFragParsed,this),t.on(w.FRAG_CHANGED,this.onFragChanged,this),t.on(w.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.BUFFER_RESET,this.onBufferReset,this),t.off(w.BUFFER_APPENDING,this.onBufferAppending,this),t.off(w.BUFFER_CODECS,this.onBufferCodecs,this),t.off(w.BUFFER_EOS,this.onBufferEos,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(w.FRAG_PARSED,this.onFragParsed,this),t.off(w.FRAG_CHANGED,this.onFragChanged,this),t.off(w.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,o=ke(this.appendSource);if(this.transferData=this.overrides=void 0,s&&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 p=this._objectUrl=self.URL.createObjectURL(c);if(this.appendSource)try{s.removeAttribute("src");const _=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||_&&c instanceof _,Oh(s),pu(s,p),s.load()}catch(_){s.src=p}else s.src=p}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,p=()=>{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: ${Vi(s,(_,m)=>_==="initSegment"?void 0:m)};
|
|
|
transfer tracks: ${Vi(o,(_,m)=>_==="initSegment"?void 0:m)}}`),!ze(o,s)){n.mediaSource=null,n.tracks=void 0;const _=t.currentTime,m=this.details,v=Math.max(_,(m==null?void 0:m.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(w.MEDIA_DETACHING,{}),this.onMediaAttaching(w.MEDIA_ATTACHING,n),t.currentTime=v;return}this.transferData=void 0,l.forEach(_=>{const m=_,v=o[m];if(v){const y=v.buffer;if(y){const S=this.fragmentTracker,C=v.id;if(S.hasFragments(C)||S.hasParts(C)){const B=Ai.getBuffered(y);S.detectEvictedFragments(m,B,C,null,!0)}const D=vc(m),K=[m,y];this.sourceBuffers[D]=K,y.updating&&this.operationQueue&&this.operationQueue.prependBlocker(m),this.trackSourceBuffer(m,v)}}}),p(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),p()}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(([p])=>{p&&this.removeBuffer(p)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const p=l.readyState==="open";try{const _=l.sourceBuffers;for(let m=_.length;m--;)p&&_[m].abort(),l.removeSourceBuffer(_[m]);p&&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&&Oh(o),o.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(w.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[vc(t)]=[null,null];const n=this.tracks[t];n&&(n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new gc(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(p=>!s[p]);if(l||c){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${o}" SourceBuffers`);return}o.forEach(p=>{var _,m,v;const y=n[p],{id:S,codec:C,levelCodec:D,container:K,metadata:B,supplemental:ee}=y;let _e=s[p];const he=(_=this.transferData)==null||(m=_.tracks)==null?void 0:m[p],Ie=he!=null&&he.buffer?he:_e,Fe=(Ie==null?void 0:Ie.pendingCodec)||(Ie==null?void 0:Ie.codec),it=Ie==null?void 0:Ie.levelCodec;_e||(_e=s[p]={buffer:void 0,listeners:[],codec:C,supplemental:ee,container:K,levelCodec:D,metadata:B,id:S});const Ke=ut(Fe,it),qe=Ke==null?void 0:Ke.replace(du,"$1");let nt=ut(C,D);const Ue=(v=nt)==null?void 0:v.replace(du,"$1");nt&&Ke&&qe!==Ue&&(p.slice(0,5)==="audio"&&(nt=ct(nt,this.appendSource)),this.log(`switching codec ${Fe} to ${nt}`),nt!==(_e.pendingCodec||_e.codec)&&(_e.pendingCodec=nt),_e.container=K,this.appendChangeType(p,K,nt))}),(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 p=c.buffer;p!=null&&p.changeType&&(this.log(`changing ${t} sourceBuffer type to ${o}`),p.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 p;const _=this.tracks.video;(this.lastVideoAppendEnd>o||_!=null&&_.buffer&&Ai.isBuffered(_.buffer,o)||((p=this.fragmentTracker.getAppendedFrag(o,P.MAIN))==null?void 0:p.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:p=>{this.warn("Error executing block-audio operation",p)}};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:p,part:_,chunkMeta:m}=n,v=m.buffering[l],y=p.sn,S=self.performance.now();v.start=S;const C=p.stats.buffering,D=_?_.stats.buffering:null;C.start===0&&(C.start=S),D&&D.start===0&&(D.start=S);const K=s.audio;let B=!1;l==="audio"&&(K==null?void 0:K.container)==="audio/mpeg"&&(B=!this.lastMpegAudioChunk||m.id===1||this.lastMpegAudioChunk.sn!==m.sn,this.lastMpegAudioChunk=m);const ee=this.tracks.video,_e=ee==null?void 0:ee.buffer;if(_e&&y!=="initSegment"){const Fe=_||p,it=this.blockedAudioAppend;if(l==="audio"&&c!=="main"&&!this.blockedAudioAppend){const qe=Fe.start+Fe.duration*.05,nt=_e.buffered,Ue=this.currentOp("video");!nt.length&&!Ue?this.blockAudio(Fe):!Ue&&!Ai.isBuffered(_e,qe)&&this.lastVideoAppendEnd<qe&&this.blockAudio(Fe)}else if(l==="video"){const Ke=Fe.end;if(it){const qe=it.frag.start;(Ke>qe||Ke<this.lastVideoAppendEnd||Ai.isBuffered(_e,qe))&&this.unblockAudio()}this.lastVideoAppendEnd=Ke}}const he=(_||p).start,Ie={label:`append-${l}`,execute:()=>{if(v.executeStart=self.performance.now(),B){const Fe=this.tracks[l];if(Fe){const it=Fe.buffer;if(it){const Ke=he-it.timestampOffset;Math.abs(Ke)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${he} (delta: ${Ke}) sn: ${y})`),it.timestampOffset=he)}}}this.appendExecutor(o,l)},onStart:()=>{},onComplete:()=>{const Fe=self.performance.now();v.executeEnd=v.end=Fe,C.first===0&&(C.first=Fe),D&&D.first===0&&(D.first=Fe);const it={};this.sourceBuffers.forEach(([Ke,qe])=>{Ke&&(it[Ke]=Ai.getBuffered(qe))}),this.appendErrors[l]=0,l==="audio"||l==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(w.BUFFER_APPENDED,{type:l,frag:p,part:_,chunkMeta:m,parent:p.type,timeRanges:it})},onError:Fe=>{var it;const Ke={type:me.MEDIA_ERROR,parent:p.type,details:J.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:p,part:_,chunkMeta:m,error:Fe,err:Fe,fatal:!1},qe=(it=this.media)==null?void 0:it.error;if(Fe.code===DOMException.QUOTA_EXCEEDED_ERR)Ke.details=J.BUFFER_FULL_ERROR;else if(Fe.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!qe)Ke.errorAction=Ji(!0);else if(Fe.name===_c&&this.sourceBufferCount===0)Ke.errorAction=Ji(!0);else{const nt=++this.appendErrors[l];this.warn(`Failed ${nt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${l}" sourceBuffer (${qe||"no media error"})`),(nt>=this.hls.config.appendErrorMaxRetry||qe)&&(Ke.fatal=!0)}this.hls.trigger(w.ERROR,Ke)}};this.append(Ie,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(w.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[A.AUDIOVIDEO]?l.push("audiovideo"):(c[A.AUDIO]&&l.push("audio"),c[A.VIDEO]&&l.push("video"));const p=()=>{const _=self.performance.now();s.stats.buffering.end=_,o&&(o.stats.buffering.end=_);const m=o?o.stats:s.stats;this.hls.trigger(w.FRAG_BUFFERED,{frag:s,part:o,stats:m,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(p,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])=>{var n,s;return t&&(!((n=this.tracks[t])!=null&&n.ended)||((s=this.tracks[t])==null?void 0:s.ending))})}onBufferEos(t,n){var s;this.sourceBuffers.forEach(([c])=>{if(c){const p=this.tracks[c];(!n.type||n.type===c)&&(p.ending=!0,p.ended||(p.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 p;return c&&!((p=this.tracks[c])!=null&&p.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(w.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(w.BUFFERED_TO_END,void 0)))}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(){const t=this.getDurationAndRange();t&&this.blockUntilOpen(()=>this.updateMediaSource(t))}onError(t,n){if(n.details===J.BUFFER_APPEND_ERROR&&n.frag){var s;const o=(s=n.errorAction)==null?void 0:s.nextAutoLevel;ue(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,p=n.live&&o.liveBackBufferLength!==null?o.liveBackBufferLength:o.backBufferLength;if(ue(p)&&p>=0){const _=Math.max(p,c),m=Math.floor(l/c)*c-_;this.flushBackBuffer(l,c,m)}if(ue(o.frontBufferFlushThreshold)&&o.frontBufferFlushThreshold>0){const _=Math.max(o.maxBufferLength,o.frontBufferFlushThreshold),m=Math.max(_,c),v=Math.floor(l/c)*c+m;this.flushFrontBuffer(l,c,v)}}flushBackBuffer(t,n,s){this.sourceBuffers.forEach(([o,l])=>{if(l){const p=Ai.getBuffered(l);if(p.length>0&&s>p.start(0)){var c;this.hls.trigger(w.BACK_BUFFER_REACHED,{bufferEnd:s});const _=this.tracks[o];if((c=this.details)!=null&&c.live)this.hls.trigger(w.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(w.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:o})}}})}flushFrontBuffer(t,n,s){this.sourceBuffers.forEach(([o,l])=>{if(l){const c=Ai.getBuffered(l),p=c.length;if(p<2)return;const _=c.start(p-1),m=c.end(p-1);if(s>_||t>=_&&t<=m)return;this.hls.trigger(w.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&&n.live&&s.setLiveSeekableRange){const m=Math.max(0,n.fragmentStart),v=Math.max(m,o);return{duration:1/0,start:m,end:v}}return{duration:1/0}}const l=(t=this.overrides)==null?void 0:t.duration;if(l)return ue(l)?{duration:l}:null;const c=this.media.duration,p=ue(s.duration)?s.duration:0;return o>p&&o>c||!ue(c)?{duration:o}:null}updateMediaSource({duration:t,start:n,end:s}){const o=this.mediaSource;!this.media||!o||o.readyState!=="open"||(o.duration!==t&&(ue(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}) ${Vi(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(w.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(w.ERROR,{type:me.MEDIA_ERROR,details:J.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,p=t[c];if(this.isPending(p)){const _=this.getTrackCodec(p,c),m=`${p.container};codecs=${_}`;p.codec=_,this.log(`creating sourceBuffer(${m})${this.currentOp(c)?" Queued":""} ${Vi(p)}`);try{const v=s.addSourceBuffer(m),y=vc(c),S=[c,v];n[y]=S,p.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(w.ERROR,{type:me.MEDIA_ERROR,details:J.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:v,sourceBufferName:c,mimeType:m,parent:p.id});return}this.trackSourceBuffer(c,p)}}this.bufferCreated()}getTrackCodec(t,n){const s=t.supplemental;let o=t.codec;s&&(n==="video"||n==="audiovideo")&&De(s,"video")&&(o=_t(o,s));const l=ut(o,t.levelCodec);return l?n.slice(0,5)==="audio"?ct(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 p=c.removedRanges;p!=null&&p.length&&this.hls.trigger(w.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(w.ERROR,{type:me.MEDIA_ERROR,details:J.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:o,fatal:!1});const l=this.currentOp(t);l&&l.onError(o)}removeExecutor(t,n,s){const{media:o,mediaSource:l}=this,c=this.tracks[t],p=c==null?void 0:c.buffer;if(!o||!l||!p){this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(t);return}const _=ue(o.duration)?o.duration:1/0,m=ue(l.duration)?l.duration:1/0,v=Math.max(0,n),y=Math.min(s,_,m);y>v&&(!c.ending||c.ended)?(c.ended=!1,this.log(`Removing [${v},${y}] from the ${t} SourceBuffer`),p.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 ed(`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 Oh(h){const t=h.querySelectorAll("source");[].slice.call(t).forEach(n=>{h.removeChild(n)})}function pu(h,t){const n=self.document.createElement("source");n.type="video/mp4",n.src=t,h.appendChild(n)}function vc(h){return h==="audio"?1:0}class Bo{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(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.BUFFER_CODECS,this.onBufferCodecs,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(w.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.BUFFER_CODECS,this.onBufferCodecs,this),t.off(w.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&&ue(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,Bo.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=(p,_)=>_?p.width!==_.width||p.height!==_.height:!0;let l=t.length-1;const c=Math.max(n,s);for(let p=0;p<t.length;p+=1){const _=t[p];if((_.width>=c||_.height>=c)&&o(_,t[p+1])){l=p;break}}return l}}const rs={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Fh={HLS:"h"},On={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},so={[On.OBJECT]:["br","d","ot","tb"],[On.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[On.SESSION]:["cid","pr","sf","sid","st","v"],[On.STATUS]:["bs","rtp"]};class ao{constructor(t,n){Array.isArray(t)&&(t=t.map(s=>s instanceof ao?s:new ao(s))),this.value=t,this.params=n}}const _s="Dict";function Bh(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 Ca(h,t,n,s){return new Error(`failed to ${h} "${Bh(t)}" as ${n}`,{cause:s})}function Os(h,t,n){return Ca("serialize",h,t,n)}class Nh{constructor(t){this.description=t}}const $h="Bare Item",bc="Boolean";function _l(h){if(typeof h!="boolean")throw Os(h,bc);return h?"?1":"?0"}function vl(h){return btoa(String.fromCharCode(...h))}const Bt="Byte Sequence";function xc(h){if(ArrayBuffer.isView(h)===!1)throw Os(h,Bt);return`:${vl(h)}:`}const mu="Integer";function gu(h){return h<-999999999999999||999999999999999<h}function yl(h){if(gu(h))throw Os(h,mu);return h.toString()}function nd(h){return`@${yl(h.getTime()/1e3)}`}function Kh(h,t){if(h<0)return-Kh(-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 rd="Decimal";function wr(h){const t=Kh(h,3);if(Math.floor(Math.abs(t)).toString().length>12)throw Os(h,rd);const n=t.toString();return n.includes(".")?n:`${n}.0`}const sd="String",wc=/[\x00-\x1f\x7f]+/;function _u(h){if(wc.test(h))throw Os(h,sd);return`"${h.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function vu(h){return h.description||h.toString().slice(7,-1)}const oo="Token";function lo(h){const t=vu(h);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw Os(t,oo);return t}function ss(h){switch(typeof h){case"number":if(!ue(h))throw Os(h,$h);return Number.isInteger(h)?yl(h):wr(h);case"string":return _u(h);case"symbol":return lo(h);case"boolean":return _l(h);case"object":if(h instanceof Date)return nd(h);if(h instanceof Uint8Array)return xc(h);if(h instanceof Nh)return lo(h);default:throw Os(h,$h)}}const uo="Key";function Pr(h){if(/^[a-z*][a-z0-9\-_.*]*$/.test(h)===!1)throw Os(h,uo);return h}function Zs(h){return h==null?"":Object.entries(h).map(([t,n])=>n===!0?`;${Pr(t)}`:`;${Pr(t)}=${ss(n)}`).join("")}function No(h){return h instanceof ao?`${ss(h.value)}${Zs(h.params)}`:ss(h)}function Ys(h){return`(${h.value.map(No).join(" ")})${Zs(h.params)}`}function Uh(h,t={whitespace:!0}){if(typeof h!="object")throw Os(h,_s);const n=h instanceof Map?h.entries():Object.entries(h),s=t!=null&&t.whitespace?" ":"";return Array.from(n).map(([o,l])=>{l instanceof ao||(l=new ao(l));let c=Pr(o);return l.value===!0?c+=Zs(l.params):(c+="=",Array.isArray(l.value)?c+=Ys(l):c+=No(l)),c}).join(`,${s}`)}function zh(h,t){return Uh(h,t)}function Sc(h){return h==="ot"||h==="sf"||h==="st"}function ad(h){return typeof h=="number"?ue(h):h!=null&&h!==""&&h!==!1}function Or(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("/")}const vs=h=>Math.round(h),od=(h,t)=>(t!=null&&t.baseUrl&&(h=Or(h,t.baseUrl)),encodeURIComponent(h)),bl=h=>vs(h/100)*100,Ec={br:vs,d:vs,bl,dl:bl,mtp:bl,nor:od,rtp:bl,tb:vs};function ln(h,t){const n={};if(h==null||typeof h!="object")return n;const s=Object.keys(h).sort(),o=k({},Ec,t==null?void 0:t.formatters),l=t==null?void 0:t.filter;return s.forEach(c=>{if(l!=null&&l(c))return;let p=h[c];const _=o[c];_&&(p=_(p,t)),!(c==="v"&&p===1)&&(c=="pr"&&p===1||ad(p)&&(Sc(c)&&typeof p=="string"&&(p=new Nh(p)),n[c]=p))}),n}function co(h,t={}){return h?zh(ln(h,t),k({whitespace:!1},t)):""}function ho(h,t={}){const n={};if(!h)return n;const s=Object.entries(h),o=Object.entries(so).concat(Object.entries((t==null?void 0:t.customHeaderMap)||{})),l=s.reduce((c,p)=>{var _,m;const[v,y]=p,S=((_=o.find(C=>C[1].includes(v)))===null||_===void 0?void 0:_[0])||On.REQUEST;return(m=c[S])!==null&&m!==void 0||(c[S]={}),c[S][v]=y,c},{});return Object.entries(l).reduce((c,[p,_])=>(c[p]=co(_,t),c),n)}function yu(h,t,n){return k(h,ho(t,n))}const dt="CMCD";function ld(h,t={}){if(!h)return"";const n=co(h,t);return`${dt}=${encodeURIComponent(n)}`}const Vh=/CMCD=[^&#]+/;function kc(h,t,n){const s=ld(t,n);if(!s)return h;if(Vh.test(h))return h.replace(Vh,s);const o=h.includes("?")?"&":"?";return`${h}${o}${s}`}class ud{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:rs.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,p=this.hls.levels[l.level],_=this.getObjectType(l),m={d:(c||l).duration*1e3,ot:_};(_===rs.VIDEO||_===rs.AUDIO||_==rs.MUXED)&&(m.br=p.bitrate/1e3,m.tb=this.getTopBandwidth(_)/1e3,m.bl=this.getBufferLength(_));const v=c?this.getNextPart(c):this.getNextFrag(l);v!=null&&v.url&&v.url!==l.url&&(m.nor=v.url),this.apply(o,m)}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(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHED,this.onMediaDetached,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHED,this.onMediaDetached,this),t.off(w.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:Fh.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===rs.INIT||n.ot===rs.VIDEO||n.ot===rs.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,p)=>(o.includes(p)&&(c[p]=n[p]),c),{}));const l={baseUrl:t.url};this.useHeaders?(t.headers||(t.headers={}),yu(t.headers,n,l)):t.url=kc(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,s;const{index:o,fragment:l}=t,c=(n=this.hls.levels[l.level])==null||(s=n.details)==null?void 0:s.partList;if(c){const{sn:p}=l;for(let _=c.length-1;_>=0;_--){const m=c[_];if(m.index===o&&m.fragment.sn===p)return c[_+1]}}}getObjectType(t){const{type:n}=t;if(n==="subtitle")return rs.TIMED_TEXT;if(t.sn==="initSegment")return rs.INIT;if(n==="audio")return rs.AUDIO;if(n==="main")return this.hls.audioTracks.length?rs.VIDEO:rs.MUXED}getTopBandwidth(t){let n=0,s;const o=this.hls;if(t===rs.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===rs.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!n?NaN:Ai.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,p){n(l),this.loader.load(l,c,p)}}}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,p){n(l),this.loader.load(l,c,p)}}}}const xl=3e5;class cd extends G{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(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.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)===Si.SendAlternateToPenaltyBox&&s.flags===Hi.MoveAllAlternatesMatchingHost){const o=this.levels;let l=this._pathwayPriority,c=this.pathwayId;if(n.context){const{groupId:p,pathwayId:_,type:m}=n.context;p&&o?c=this.getPathwayForGroupId(p,m,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),s.resolved||this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${c} levels: ${o&&o.length} priorities: ${Vi(l)} penalized: ${Vi(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]>xl&&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 p=this.hls.nextLoadLevel,_=this.hls.levels[p];if(n=this.getLevelsForPathway(c),n.length>0){this.log(`Setting Pathway to "${c}"`),this.pathwayId=c,Us(n),this.hls.trigger(w.LEVELS_UPDATED,{levels:n});const m=this.hls.levels[p];_&&m&&this.levels&&(m.attrs["STABLE-VARIANT-ID"]!==_.attrs["STABLE-VARIANT-ID"]&&m.bitrate!==_.bitrate&&this.log(`Unstable Pathways change from bitrate ${_.bitrate} to ${m.bitrate}`),this.hls.nextLoadLevel=p);break}}}getPathwayForGroupId(t,n,s){const o=this.getLevelsForPathway(s).concat(this.levels||[]);for(let l=0;l<o.length;l++)if(n===Le.AUDIO_TRACK&&o[l].hasAudioGroup(t)||n===Le.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":p,"URI-REPLACEMENT":_}=l;if(n.some(v=>v.pathwayId===c))return;const m=this.getLevelsForPathway(p).map(v=>{const y=new xi(v.attrs);y["PATHWAY-ID"]=c;const S=y.AUDIO&&`${y.AUDIO}_clone_${c}`,C=y.SUBTITLES&&`${y.SUBTITLES}_clone_${c}`;S&&(s[y.AUDIO]=S,y.AUDIO=S),C&&(o[y.SUBTITLES]=C,y.SUBTITLES=C);const D=Fr(v.uri,y["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",_),K=new Ni({attrs:y,audioCodec:v.audioCodec,bitrate:v.bitrate,height:v.height,name:v.name,url:D,videoCodec:v.videoCodec,width:v.width});if(v.audioGroups)for(let B=1;B<v.audioGroups.length;B++)K.addGroupId("audio",`${v.audioGroups[B]}_clone_${c}`);if(v.subtitleGroups)for(let B=1;B<v.subtitleGroups.length;B++)K.addGroupId("text",`${v.subtitleGroups[B]}_clone_${c}`);return K});n.push(...m),Gh(this.audioTracks,s,_,c),Gh(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,p=c.errorRetry||c.timeoutRetry||{},_={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:p.maxNumRetry||0,retryDelay:p.retryDelayMs||0,maxRetryDelay:p.maxRetryDelayMs||0},m={onSuccess:(v,y,S,C)=>{this.log(`Loaded steering manifest: "${o}"`);const D=v.data;if((D==null?void 0:D.VERSION)!==1){this.log(`Steering VERSION ${D.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=D.TTL;const{"RELOAD-URI":K,"PATHWAY-CLONES":B,"PATHWAY-PRIORITY":ee}=D;if(K)try{this.uri=new self.URL(K,o).href}catch(he){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${K}`);return}this.scheduleRefresh(this.uri||S.url),B&&this.clonePathways(B);const _e={steeringManifest:D,url:o.toString()};this.hls.trigger(w.STEERING_MANIFEST_LOADED,_e),ee&&this.updatePathwayPriority(ee)},onError:(v,y,S,C)=>{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 D=this.timeToLoad*1e3;if(v.code===429){const K=this.loader;if(typeof(K==null?void 0:K.getResponseHeader)=="function"){const B=K.getResponseHeader("Retry-After");B&&(D=parseFloat(B)*1e3)}this.log(`Steering manifest ${y.url} rate limited`);return}this.scheduleRefresh(this.uri||y.url,D)},onTimeout:(v,y,S)=>{this.log(`Timeout loading steering manifest (${y.url})`),this.scheduleRefresh(this.uri||y.url)}};this.log(`Requesting steering manifest: ${o}`),this.loader.load(l,_,m)}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 Gh(h,t,n,s){h&&Object.keys(t).forEach(o=>{const l=h.filter(c=>c.groupId===o).map(c=>{const p=k({},c);return p.details=void 0,p.attrs=new xi(p.attrs),p.url=p.attrs.URI=Fr(c.url,c.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),p.groupId=p.attrs["GROUP-ID"]=t[o],p.attrs["PATHWAY-ID"]=s,p});h.push(...l)})}function Fr(h,t,n,s){const{HOST:o,PARAMS:l,[n]:c}=s;let p;t&&(p=c==null?void 0:c[t],p&&(h=p));const _=new self.URL(h);return o&&!p&&(_.host=o),l&&Object.keys(l).sort().forEach(m=>{m&&_.searchParams.set(m,l[m])}),_.href}function Ar(h,t,n){as(h,t,n),h.addEventListener(t,n)}function as(h,t,n){h.removeEventListener(t,n)}class ha extends G{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=ha.CDMCleanupPromise?[ha.CDMCleanupPromise]:[],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=ws(this.config));const p=c.map(xs).filter(_=>!!_);this.keyFormatPromise=this.getKeyFormatPromise(p)}this.keyFormatPromise.then(c=>{const p=sr(c);let _,m;if(s==="sinf"){if(p!==Mi.FAIRPLAY){this.warn(`Ignoring unexpected "${n.type}" event with init data type: "${s}" for selected key-system ${p}`);return}const D=Oe(new Uint8Array(o));try{const K=Wr(JSON.parse(D).sinf),B=Yt(K);if(!B)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");_=new Uint8Array(B.subarray(8,24)),m=Mi.FAIRPLAY}catch(K){this.warn(`${l} Failed to parse sinf: ${K}`);return}}else{if(p!==Mi.WIDEVINE&&p!==Mi.PLAYREADY){this.warn(`Ignoring unexpected "${n.type}" event with init data type: "${s}" for selected key-system ${p}`);return}const D=Et(o),K=D.filter(ee=>!!ee.systemId&&cs(ee.systemId)===p);K.length>1&&this.warn(`${l} Using first of ${K.length} pssh found for selected key-system ${p}`);const B=K[0];if(!B){D.length===0||D.some(ee=>!ee.systemId)?this.warn(`${l} contains incomplete or invalid pssh data`):this.log(`ignoring ${l} for ${D.map(ee=>cs(ee.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(m=cs(B.systemId),B.version===0&&B.data)if(m===Mi.WIDEVINE){const ee=B.data.length-22;_=new Uint8Array(B.data.subarray(ee,ee+16))}else m===Mi.PLAYREADY&&(_=Un(B.data))}if(!m||!_)return;const v=te.hexDump(_),{keyIdToKeySessionPromise:y,mediaKeySessions:S}=this;let C=y[v];for(let D=0;D<S.length;D++){const K=S[D],B=K.decryptdata;if(!B.keyId)continue;const ee=te.hexDump(B.keyId);if(v===ee||B.uri.replace(/-/g,"").indexOf(v)!==-1){if(C=y[ee],B.pssh)break;delete y[ee],B.pssh=new Uint8Array(o),B.keyId=_,C=y[v]=C.then(()=>this.generateRequestWithPreferredKeySession(K,s,o,"encrypted-event-key-match")),C.catch(_e=>this.handleError(_e));break}}if(!C){if(m!==p){this.log(`Ignoring "${n.type}" event with ${m} init data for selected key-system ${p}`);return}C=y[v]=this.getKeySystemSelectionPromise([m]).then(({keySystem:D,mediaKeys:K})=>{var B;this.throwIfDestroyed();const ee=new kr("ISO-23001-7",v,(B=xs(D))!=null?B:"");return ee.pssh=new Uint8Array(o),ee.keyId=_,this.attemptSetMediaKeys(D,K).then(()=>{this.throwIfDestroyed();const _e=this.createMediaKeySessionContext({decryptdata:ee,keySystem:D,mediaKeys:K});return this.generateRequestWithPreferredKeySession(_e,s,o,"encrypted-event-no-match")})}),C.catch(D=>this.handleError(D))}})}},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(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(w.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(w.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(w.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(w.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(t){const{drmSystems:n,widevineLicenseUrl:s}=this.config,o=n[t];if(o)return o.licenseUrl;if(t===Mi.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[t];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const n=this.hls.levels,s=(c,p,_)=>!!c&&_.indexOf(c)===p,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,p)=>{const _=m=>{const v=m.shift();this.getMediaKeysPromise(v,o,l).then(y=>c({keySystem:v,mediaKeys:y})).catch(y=>{m.length?_(m):y instanceof Ts?p(y):p(new Ts({type:me.KEY_SYSTEM_ERROR,details:J.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 Ms===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){const o=fi(t,n,s,this.config.drmSystemOptions),l=this.keySystemAccessPromises[t];let c=l==null?void 0:l.keySystemAccess;if(!c){this.log(`Requesting encrypted media "${t}" key-system access with config: ${Vi(o)}`),c=this.requestMediaKeySystemAccess(t,o);const p=this.keySystemAccessPromises[t]={keySystemAccess:c};return c.catch(_=>{this.log(`Failed to obtain access to key-system "${t}": ${_}`)}),c.then(_=>{this.log(`Access for key-system "${_.keySystem}" obtained`);const m=this.fetchServerCertificate(t);return this.log(`Create media-keys for "${t}"`),p.mediaKeys=_.createMediaKeys().then(v=>(this.log(`Media-keys created for "${t}"`),p.hasMediaKeys=!0,m.then(y=>y?this.setMediaKeysServerCertificate(v,t,y):v))),p.mediaKeys.catch(v=>{this.error(`Failed to create media-keys for "${t}"}: ${v}`)}),p.mediaKeys})}return c.then(()=>l.mediaKeys)}createMediaKeySessionContext({decryptdata:t,keySystem:n,mediaKeys:s}){this.log(`Creating key-system session "${n}" keyId: ${te.hexDump(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.hexDump(t.keyId)}updateKeySession(t,n){var s;const o=t.mediaKeysSession;return this.log(`Updating key-session "${o.sessionId}" for keyID ${te.hexDump(((s=t.decryptdata)==null?void 0:s.keyId)||[])}
|
|
|
} (data length: ${n&&n.byteLength})`),o.update(n)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(t=>({keySystem:t,hasMediaKeys:this.keySystemAccessPromises[t].hasMediaKeys})).filter(({hasMediaKeys:t})=>!!t).map(({keySystem:t})=>xs(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=xs(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=ws(this.config),s=t.map(sr).filter(o=>!!o&&n.indexOf(o)!==-1);return this.selectKeySystem(s)}loadKey(t){const n=t.keyInfo.decryptdata,s=this.getKeyIdString(n),o=`(keyId: ${s} format: "${n.keyFormat}" method: ${n.method} uri: ${n.uri})`;this.log(`Starting session for key ${o}`);let l=this.keyIdToKeySessionPromise[s];return l||(l=this.getKeySystemForKeyPromise(n).then(({keySystem:p,mediaKeys:_})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${o}`),this.attemptSetMediaKeys(p,_).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:p,mediaKeys:_,decryptdata:n}))))),(this.keyIdToKeySessionPromise[s]=l.then(p=>{const _="cenc",m=n.pssh?n.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(p,_,m,"playlist-key")})).catch(p=>this.handleError(p))),l}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t){this.hls&&(this.error(t.message),t instanceof Ts?this.hls.trigger(w.ERROR,t.data):this.hls.trigger(w.ERROR,{type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))}getKeySystemForKeyPromise(t){const n=this.getKeyIdString(t),s=this.keyIdToKeySessionPromise[n];if(!s){const o=sr(t.keyFormat),l=o?[o]:ws(this.config);return this.attemptKeySystemAccess(l)}return s}getKeySystemSelectionPromise(t){if(t.length||(t=ws(this.config)),t.length===0)throw new Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Vi({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,c;const p=(l=this.config.drmSystems)==null||(c=l[t.keySystem])==null?void 0:c.generateRequest;if(p)try{const D=p.call(this.hls,n,s,t);if(!D)throw new Error("Invalid response from configured generateRequest filter");n=D.initDataType,s=D.initData?D.initData:null,t.decryptdata.pssh=s?new Uint8Array(s):null}catch(D){var _;if(this.warn(D.message),(_=this.hls)!=null&&_.config.debug)throw D}if(s===null)return this.log(`Skipping key-session request for "${o}" (no initData)`),Promise.resolve(t);const m=this.getKeyIdString(t.decryptdata);this.log(`Generating key-session request for "${o}": ${m} (init data type: ${n} length: ${s?s.byteLength:null})`);const v=new Gs,y=t._onmessage=D=>{const K=t.mediaKeysSession;if(!K){v.emit("error",new Error("invalid state"));return}const{messageType:B,message:ee}=D;this.log(`"${B}" message event for session "${K.sessionId}" message size: ${ee.byteLength}`),B==="license-request"||B==="license-renewal"?this.renewLicense(t,ee).catch(_e=>{v.eventNames().length?v.emit("error",_e):this.handleError(_e)}):B==="license-release"?t.keySystem===Mi.FAIRPLAY&&(this.updateKeySession(t,Kr("acknowledged")),this.removeSession(t)):this.warn(`unhandled media key message type "${B}"`)},S=t._onkeystatuseschange=D=>{if(!t.mediaKeysSession){v.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(t);const B=t.keyStatus;v.emit("keyStatus",B),B==="expired"&&(this.warn(`${t.keySystem} expired for key ${m}`),this.renewKeySession(t))};Ar(t.mediaKeysSession,"message",y),Ar(t.mediaKeysSession,"keystatuseschange",S);const C=new Promise((D,K)=>{v.on("error",K),v.on("keyStatus",B=>{B.startsWith("usable")?D():B==="output-restricted"?K(new Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):B==="internal-error"?K(new Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${B}"`)):B==="expired"?K(new Error("key expired while generating request")):this.warn(`unhandled key status change "${B}"`)})});return t.mediaKeysSession.generateRequest(n,s).then(()=>{var D;this.log(`Request generated for key-session "${(D=t.mediaKeysSession)==null?void 0:D.sessionId}" keyId: ${m}`)}).catch(D=>{throw new Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_NO_SESSION,error:D,fatal:!1},`Error generating key-session request: ${D}`)}).then(()=>C).catch(D=>{throw v.removeAllListeners(),this.removeSession(t),D}).then(()=>(v.removeAllListeners(),t))}onKeyStatusChange(t){t.mediaKeysSession.keyStatuses.forEach((n,s)=>{if(typeof s=="string"&&typeof n=="object"){const o=s;s=n,n=o}this.log(`key status change "${n}" for keyStatuses keyId: ${te.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${te.hexDump(new Uint8Array(t.decryptdata.keyId||[]))} uri: ${t.decryptdata.uri}`),t.keyStatus=n})}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,p)=>{const _={responseType:"arraybuffer",url:l},m=n.certLoadPolicy.default,v={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(S,C,D,K)=>{c(S.data)},onError:(S,C,D,K)=>{p(new Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:D,response:M({url:_.url,data:void 0},S)},`"${t}" certificate request failed (${l}). Status: ${S.code} (${S.text})`))},onTimeout:(S,C,D)=>{p(new Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:D,response:{url:_.url,data:void 0}},`"${t}" certificate request timed out (${l})`))},onAbort:(S,C,D)=>{p(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==null?void 0:s.byteLength}) on "${n}"`),o(t)}).catch(c=>{l(new Ts({type:me.KEY_SYSTEM_ERROR,details:J.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 Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:o,fatal:!0},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,S=l.length;y<S;y++){var c,p;v=l[y];const C=(c=v.querySelector("name"))==null?void 0:c.textContent,D=(p=v.querySelector("value"))==null?void 0:p.textContent;C&&D&&t.setRequestHeader(C,D)}}const _=o.querySelector("Challenge"),m=_==null?void 0:_.textContent;if(!m)throw new Error("Cannot find <Challenge> in key message");return Kr(atob(m))}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 p=new XMLHttpRequest;p.responseType="arraybuffer",p.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return l(new Error("invalid state"));if(p.readyState===4)if(p.status===200){this._requestLicenseFailureCount=0;let _=p.response;this.log(`License received ${_ instanceof ArrayBuffer?_.byteLength:_}`);const m=this.config.licenseResponseCallback;if(m)try{_=m.call(this.hls,p,c,t)}catch(v){this.error(v)}o(_)}else{const _=s.errorRetry,m=_?_.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>m||p.status>=400&&p.status<500)l(new Ts({type:me.KEY_SYSTEM_ERROR,details:J.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:c,data:void 0,code:p.status,text:p.statusText}},`License Request XHR failed (${c}). Status: ${p.status} (${p.statusText})`));else{const v=m-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=p,this.setupLicenseXHR(p,c,t,n).then(({xhr:_,licenseChallenge:m})=>{t.keySystem==Mi.PLAYREADY&&(m=this.unpackPlayReadyKeyMessage(_,m)),_.send(m)})})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(t,n){if(!this.config.emeEnabled)return;const s=n.media;this.media=s,Ar(s,"encrypted",this.onMediaEncrypted),Ar(s,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media;t&&(as(t,"encrypted",this.onMediaEncrypted),as(t,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const n=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,kr.clearKeyUriToKeyIdMap();const o=s.length;ha.CDMCleanupPromise=Promise.all(s.map(l=>this.removeSession(l)).concat(n==null||(t=n.setMediaKeys(null))==null?void 0:t.catch(l=>{var c;this.log(`Could not clear media keys: ${l}`),(c=this.hls)==null||c.trigger(w.ERROR,{type:me.OTHER_ERROR,details:J.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${l}`)})}))).catch(l=>{var c;this.log(`Could not close sessions and clear media keys: ${l}`),(c=this.hls)==null||c.trigger(w.ERROR,{type:me.OTHER_ERROR,details:J.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}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}=t;if(n){this.log(`Remove licenses and keys and close session ${n.sessionId}`),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 o=this.mediaKeySessions.indexOf(t);o>-1&&this.mediaKeySessions.splice(o,1);const{drmSystemOptions:l}=this.config;return(Dn(l)?new Promise((p,_)=>{self.setTimeout(()=>_(new Error("MediaKeySession.remove() timeout")),8e3),n.remove().then(p)}):Promise.resolve()).catch(p=>{var _;this.log(`Could not remove session: ${p}`),(_=this.hls)==null||_.trigger(w.ERROR,{type:me.OTHER_ERROR,details:J.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${p}`)})}).then(()=>n.close()).catch(p=>{var _;this.log(`Could not close session: ${p}`),(_=this.hls)==null||_.trigger(w.ERROR,{type:me.OTHER_ERROR,details:J.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${p}`)})})}}}ha.CDMCleanupPromise=void 0;class Ts 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}}class hd{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(w.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(w.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(w.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,p=n-this.lastDecodedFrames,_=1e3*c/l,m=this.hls;if(m.trigger(w.FPS_DROP,{currentDropped:c,currentDecoded:p,totalDroppedFrames:s}),_>0&&c>m.config.fpsDroppedMonitoringThreshold*p){let v=m.currentLevel;m.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+v),v>0&&(m.autoLevelCapping===-1||m.autoLevelCapping>=v)&&(v=v-1,m.trigger(w.FPS_DROP_LEVEL_CAPPING,{level:v,droppedLevel:m.currentLevel}),m.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 bu(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 Ac(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 fa(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 Gr(h,t,n,s){const o=h.mode;if(o==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0){const l=Hh(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 fo(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 Hh(h,t,n){const s=[],o=fo(h,t);if(o>-1)for(let l=o,c=h.length;l<c;l++){const p=h[l];if(p.startTime>=t&&p.endTime<=n)s.push(p);else if(p.startTime>n)return s}return s}function wl(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 Tc extends cu{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=wl(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(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.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;wl(s.textTracks).forEach(c=>{fa(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 p=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,p)}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 p=this.hls.config.subtitlePreference;if(!l&&p){this.selectDefaultTrack=!1;const v=Me(p,c);if(v>-1)l=c[v];else{const y=Me(p,this.tracks);l=this.tracks[y]}}let _=this.findTrackId(l);_===-1&&l&&(_=this.findTrackId(null));const m={subtitleTracks:c};this.log(`Updating subtitle tracks, ${c.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(w.SUBTITLE_TRACKS_UPDATED,m),_!==-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||tt(l,t)))return o}if(t){for(let o=0;o<n.length;o++){const l=n[o];if(ro(t.attrs,l.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return o}for(let o=0;o<n.length;o++){const l=n[o];if(ro(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(fu(o,t))return s}}return-1}onError(t,n){n.fatal||!n.context||n.context.type===Le.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&&tt(t,s))return s;const o=Me(t,this.tracksInGroup);if(o>-1){const l=this.tracksInGroup[o];return this.setSubtitleTrack(o),l}else{if(s)return null;{const l=Me(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,p=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:""}${p&&c.live?" age "+p.toFixed(1)+(c.type?" "+c.type||0:""):""} ${l}`),this.hls.trigger(w.SUBTITLE_TRACK_LOADING,{url:l,id:s,groupId:o,deliveryDirectives:n||null,track:t})}toggleTrackModes(){const{media:t}=this;if(!t)return;const n=wl(t.textTracks),s=this.currentTrack;let o;if(s&&(o=n.filter(l=>fu(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||!ue(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(w.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:p="",name:_,type:m,url:v}=o;this.hls.trigger(w.SUBTITLE_TRACK_SWITCH,{id:c,groupId:p,name:_,type:m,url:v});const y=this.switchParams(o.url,s==null?void 0:s.details,o.details);this.loadPlaylist(y)}}function fd(){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 Sl(h){let t=5381,n=h.length;for(;n;)t=t*33^h.charCodeAt(--n);return(t>>>0).toString()}const $o=.025;let xu=function(h){return h[h.Point=0]="Point",h[h.Range=1]="Range",h}({});function Wh(h,t,n){return`${h.identifier}-${n+1}-${Sl(t)}`}class Hn{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 Lc(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=Lc(n,t);return n-s<.1}return!1}get resumptionOffset(){const t=this.resumeOffset,n=ue(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 Lc(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)<$o))}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"?xu.Range:xu.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 dd(this)}}function Lc(h,t){return h-t.start<t.duration/2&&!(Math.abs(h-(t.start+t.duration))<$o)?t.start:t.start+t.duration}function jh(h,t,n){const s=new self.URL(h,n);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",t),s}function da(h,t){for(;(n=h.assetList[++t])!=null&&n.error;)var n;return t}function dd(h){return`["${h.identifier}" ${h.cue.pre?"<pre>":h.cue.post?"<post>":""}${h.timelineStart.toFixed(2)}-${h.resumeTime.toFixed(2)}]`}function Xs(h){const t=h.timelineStart,n=h.duration||0;return`["${h.identifier}" ${t.toFixed(2)}-${(t+n).toFixed(2)}]`}class pd{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.trigger(w.PLAYOUT_LIMIT_REACHED,{})};const l=this.hls=new t(n);this.interstitial=s,this.assetItem=o;let c=o.uri;try{c=jh(c,n.primarySessionId).href}catch(_){}l.loadSource(c);const p=()=>{this.hasDetails=!0};l.once(w.LEVEL_LOADED,p),l.once(w.AUDIO_TRACK_LOADED,p),l.once(w.SUBTITLE_TRACK_LOADED,p),l.on(w.MEDIA_ATTACHING,(_,{media:m})=>{this.removeMediaListeners(),this.mediaAttached=m,this.interstitial.playoutLimit&&(m.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&l.on(w.BUFFER_APPENDED,()=>{const y=this.bufferedEnd;this.reachedPlayout(y)&&(this._bufferedEosTime=y,l.trigger(w.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){var t;return((t=this.interstitial)==null?void 0:t.appendInPlace)||!1}bufferedInPlaceToEnd(t){var n;if(!this.appendInPlace)return!1;if((n=this.hls)!=null&&n.bufferedToEnd)return!0;if(!t||!this._bufferedEosTime)return!1;const s=this.timelineOffset,o=Ai.bufferInfo(t,s,0);return this.getAssetTime(o.end)>=this._bufferedEosTime-.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=Ai.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;return t||0}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){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.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(t){this.hls.attachMedia(t)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}resetDetails(){const t=this.hls;if(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){this.hls.on(t,n)}once(t,n,s){this.hls.once(t,n)}off(t,n,s){this.hls.off(t,n)}toString(){var t;return`HlsAssetPlayer: ${Xs(this.assetItem)} ${(t=this.hls)==null?void 0:t.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Dc=.033;class qh extends G{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 p=c.timelineStart;if(n===p||n>p&&n<p+(c.duration||0))return l}}return 0}get assetIdAtEnd(){var t,n;const s=(t=this.items)==null||(n=t[this.length-1])==null?void 0:n.event;if(s){const o=s.assetList,l=o[o.length-1];if(l)return l.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),p=Object.keys(o),_=l?l.filter(m=>!p.includes(m.identifier)):[];c.length&&c.sort((m,v)=>{const y=m.cue.pre,S=m.cue.post,C=v.cue.pre,D=v.cue.post;if(y&&!C)return-1;if(C&&!y||S&&!D)return 1;if(D&&!S)return-1;if(!y&&!C&&!S&&!D){const K=m.startTime,B=v.startTime;if(K!==B)return K-B}return m.dateRange.tagOrder-v.dateRange.tagOrder}),this.events=c,_.forEach(m=>{this.removeEvent(m)}),this.updateSchedule(t,_)}updateSchedule(t,n=[]){const s=this.events||[];if(s.length||n.length||this.length<2){const o=this.items,l=this.parseSchedule(s,t);(n.length||(o==null?void 0:o.length)!==l.length||l.some((p,_)=>Math.abs(p.playout.start-o[_].playout.start)>.005||Math.abs(p.playout.end-o[_].playout.end)>.005))&&(this.items=l,this.onScheduleUpdate(n,o))}}parseDateRanges(t,n,s){const o=[],l=Object.keys(t);for(let c=0;c<l.length;c++){const p=l[c],_=t[p];if(_.isInterstitial){let m=this.eventMap[p];m?m.setDateRange(_):(m=new Hn(_,n),this.eventMap[p]=m,s===!1&&(m.appendInPlace=s)),o.push(m)}}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,m=0;if(t.forEach((v,y)=>{const S=v.cue.pre,C=v.cue.post,D=t[y-1]||null,K=v.appendInPlace,B=C?l:v.startOffset,ee=v.duration,_e=v.timelineOccupancy===xu.Range?ee:0,he=v.resumptionOffset,Ie=(D==null?void 0:D.startTime)===B,Fe=B+v.cumulativeDuration;let it=K?Fe+ee:B+he;if(S||!C&&B<=0){const qe=m;m+=_e,v.timelineStart=Fe;const nt=c;c+=ee,s.push({event:v,start:Fe,end:it,playout:{start:nt,end:c},integrated:{start:qe,end:m}})}else if(B<=l){if(!Ie){const Ue=B-_;if(Ue>Dc){const Lt=_,ii=m;m+=Ue;const Ri=c;c+=Ue;const pi={previousEvent:t[y-1]||null,nextEvent:v,start:Lt,end:Lt+Ue,playout:{start:Ri,end:c},integrated:{start:ii,end:m}};s.push(pi)}else Ue>0&&D&&(D.cumulativeDuration+=Ue,s[s.length-1].end=B)}C&&(it=Fe),v.timelineStart=Fe;const qe=m;m+=_e;const nt=c;c+=ee,s.push({event:v,start:Fe,end:it,playout:{start:nt,end:c},integrated:{start:qe,end:m}})}else return;const Ke=v.resumeTime;C||Ke>l?_=l:_=Ke}),_<l){var p;const v=_,y=m,S=l-_;m+=S;const C=c;c+=S,s.push({previousEvent:((p=s[s.length-1])==null?void 0:p.event)||null,nextEvent:null,start:_,end:v+S,playout:{start:C,end:c},integrated:{start:y,end:m}})}this.setDurations(l,c,m)}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((p,_)=>{const m=p.cue.pre,v=p.cue.post,y=m?0:v?o:p.startTime;this.updateAssetDurations(p),c===y?p.cumulativeDuration=l:(l=0,c=y),!v&&p.snapOptions.in&&(p.resumeAnchor=li(null,s.fragments,p.startOffset+p.resumptionOffset,0,0)||void 0),p.appendInPlace&&!p.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(p,n)||(p.appendInPlace=!1)),!p.appendInPlace&&_+1<t.length&&t[_+1].startTime-t[_].resumeTime<Dc&&(t[_+1].appendInPlace=!1,t[_+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${p}`));const C=ue(p.resumeOffset)?p.resumeOffset:p.duration;l+=C})}primaryCanResumeInPlaceAt(t,n){const s=t.resumeTime,o=t.startTime+t.resumptionOffset;return Math.abs(s-o)>$o?(this.log(`"${t.identifier}" resumption ${s} not aligned with estimated timeline end ${o}`),!1):n?!Object.keys(n).some(c=>{const p=n[c].details,_=p.edge;if(s>=_)return this.log(`"${t.identifier}" resumption ${s} past ${c} playlist end ${_}`),!1;const m=li(null,p.fragments,s);if(!m)return this.log(`"${t.identifier}" resumption ${s} does not align with any fragments in ${c} playlist (${p.fragStart}-${p.fragmentEnd})`),!0;const v=c==="audio"?.175:0;return Math.abs(m.start-s)<$o+v||Math.abs(m.end-s)<$o+v?!1:(this.log(`"${t.identifier}" resumption ${s} not aligned with ${c} fragment bounds (${m.start}-${m.end} sn: ${m.sn} cc: ${m.cc})`),!0)}):(this.log(`"${t.identifier}" resumption ${s} can not be aligned with media (none selected)`),!1)}updateAssetDurations(t){if(!t.assetListLoaded)return;const n=t.timelineStart;let s=0,o=!1,l=!1;t.assetList.forEach((c,p)=>{const _=n+s;c.startOffset=s,c.timelineStart=_,o||(o=c.duration===null),l||(l=!!c.error);const m=c.error?0:c.duration||0;s+=m}),o&&!l?t.duration=Math.max(s,t.duration):t.duration=s}removeEvent(t){t.reset(),delete this.eventMap[t.identifier]}}function Ls(h){return`[${h.event?'"'+h.event.identifier+'"':"primary"}: ${h.start.toFixed(2)}-${h.end.toFixed(2)}]`}class md{constructor(t){this.hls=void 0,this.hls=t}destroy(){this.hls=null}loadAssetList(t,n){const s=t.assetListUrl;let o;try{o=jh(s,this.hls.sessionId,t.baseUrl)}catch(S){const C=this.assignAssetListError(t,J.ASSET_LIST_LOAD_ERROR,S,s);this.hls.trigger(w.ERROR,C);return}n&&o.protocol!=="data:"&&o.searchParams.set("_HLS_start_offset",""+n);const l=this.hls.config,c=l.loader,p=new c(l),_={responseType:"json",url:o.href},m=l.interstitialAssetListLoadPolicy.default,v={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(S,C,D,K)=>{const B=S.data,ee=B==null?void 0:B.ASSETS;if(!Array.isArray(ee)){const _e=this.assignAssetListError(t,J.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),D.url,C,K);this.hls.trigger(w.ERROR,_e);return}t.assetListResponse=B,this.hls.trigger(w.ASSET_LIST_LOADED,{event:t,assetListResponse:B,networkDetails:K})},onError:(S,C,D,K)=>{const B=this.assignAssetListError(t,J.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${S.code} ${S.text} (${C.url})`),C.url,K,D);this.hls.trigger(w.ERROR,B)},onTimeout:(S,C,D)=>{const K=this.assignAssetListError(t,J.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${C.url})`),C.url,S,D);this.hls.trigger(w.ERROR,K)}};return p.load(_,v,y),this.hls.trigger(w.ASSET_LIST_LOADING,{event:t}),p}assignAssetListError(t,n,s,o,l,c){return t.error=s,{type:me.NETWORK_ERROR,details:n,fatal:!1,interstitial:t,url:o,error:s,networkDetails:c,stats:l}}}function Cc(h){h==null||h.play().catch(()=>{})}class Mc extends G{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)return;const o=s-this.timelinePos;if(Math.abs(o)<1/7056e5)return;const c=o<=-.01;this.timelinePos=s,this.bufferedPos=s;const p=this.playingItem;if(!p){this.checkBuffer();return}if(c&&this.schedule.resetErrorsInRange(s,s-o)&&this.updateSchedule(),this.checkBuffer(),c&&s<p.start||s>=p.end){var _;const S=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(p)&&(_=this.media)!=null&&_.paused&&(this.shouldPlay=!1),!c){const C=this.findItemIndex(p);if(S>C){const D=this.schedule.findJumpRestrictedIndex(C+1,S);if(D>C){this.setSchedulePosition(D);return}}}this.setSchedulePosition(S);return}const m=this.playingAsset;if(!m){if(this.playingLastItem&&this.isInterstitial(p)){const S=p.event.assetList[0];S&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,S))}return}const v=m.timelineStart,y=m.duration||0;(c&&s<v||s>=v+y)&&this.setScheduleToAssetAtTime(s,m)},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 p=this.findItemIndex(o);this.setSchedulePosition(p+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,c=this.playingItem,p=l.events||[],_=l.items||[],m=l.durations,v=s.map(D=>D.identifier),y=!!(p.length||v.length);(y||o)&&this.log(`INTERSTITIALS_UPDATED (${p.length}): ${p}
|
|
|
Schedule: ${_.map(D=>Ls(D))} pos: ${this.timelinePos}`),v.length&&this.log(`Removed events ${v}`),this.playerQueue.forEach(D=>{if(D.interstitial.appendInPlace){const K=D.assetItem.timelineStart,B=D.timelineOffset-K;if(B)try{D.timelineOffset=K}catch(ee){Math.abs(B)>$o&&this.warn(`${ee} ("${D.assetId}" ${D.timelineOffset}->${K})`)}}});let S=null;if(c){const D=this.updateItem(c,this.timelinePos);this.itemsMatch(c,D)&&(this.playingItem=D,this.waitingItem=this.endedItem=null,S=()=>this.trimInPlace(D,c))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const C=this.bufferingItem;if(C){const D=this.updateItem(C,this.bufferedPos);this.itemsMatch(C,D)?(this.bufferingItem=D,S||(S=()=>this.trimInPlace(D,C))):C.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(C.event,null))}if(s.forEach(D=>{D.assetList.forEach(K=>{this.clearAssetPlayer(K.identifier,null)})}),y||o){if(this.hls.trigger(w.INTERSTITIALS_UPDATED,{events:p.slice(0),schedule:_.slice(0),durations:m,removedIds:v}),this.isInterstitial(c)&&v.includes(c.event.identifier)){this.warn(`Interstitial "${c.event.identifier}" removed while playing`),this.primaryFallback(c.event);return}S&&S(),this.checkBuffer()}},this.hls=t,this.HlsPlayerClass=n,this.assetListLoader=new md(t),this.schedule=new qh(this.onScheduleUpdate,t.logger),this.registerListeners()}registerListeners(){const t=this.hls;t.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.on(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(w.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.on(w.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.on(w.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.on(w.BUFFER_APPENDED,this.onBufferAppended,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.BUFFERED_TO_END,this.onBufferedToEnd,this),t.on(w.MEDIA_ENDED,this.onMediaEnded,this),t.on(w.ERROR,this.onError,this),t.on(w.DESTROYING,this.onDestroying,this)}unregisterListeners(){const t=this.hls;t&&(t.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.off(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(w.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.off(w.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.off(w.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.off(w.BUFFER_CODECS,this.onBufferCodecs,this),t.off(w.BUFFER_APPENDED,this.onBufferAppended,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.BUFFERED_TO_END,this.onBufferedToEnd,this),t.off(w.MEDIA_ENDED,this.onMediaEnded,this),t.off(w.ERROR,this.onError,this),t.off(w.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.manager=null,this.hls=this.HlsPlayerClass=this.schedule=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){as(t,"play",this.onPlay),as(t,"pause",this.onPause),as(t,"seeking",this.onSeeking),as(t,"timeupdate",this.onTimeupdate)}onMediaAttaching(t,n){const s=this.media=n.media;Ar(s,"seeking",this.onSeeking),Ar(s,"timeupdate",this.onTimeupdate),Ar(s,"play",this.onPlay),Ar(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.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.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,l.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const t=this,n=()=>t.bufferingItem||t.waitingItem,s=y=>y&&t.getAssetPlayer(y.identifier),o=(y,S,C,D,K)=>{if(y){let B=y[S].start;const ee=y.event;if(ee){if(S==="playout"||ee.timelineOccupancy!==xu.Point){const _e=s(C);(_e==null?void 0:_e.interstitial)===ee&&(B+=_e.assetItem.startOffset+_e[K])}}else{const _e=D==="bufferedPos"?c():t[D];B+=_e-y.start}return B}return 0},l=(y,S)=>{if(y!==0&&S!=="primary"&&t.schedule.length){var C;const D=t.schedule.findItemIndexAtTime(y),K=(C=t.schedule.items)==null?void 0:C[D];if(K){const B=K[S].start-K.start;return y+B}}return y},c=()=>{const y=t.bufferedPos;return y===Number.MAX_VALUE?p("primary"):Math.max(y,0)},p=y=>{var S;return(S=t.primaryDetails)!=null&&S.live?t.primaryDetails.edge:t.schedule.durations[y]},_=(y,S)=>{var C,D;const K=t.effectivePlayingItem;if(K!=null&&(C=K.event)!=null&&C.restrictions.skip)return;t.log(`seek to ${y} "${S}"`);const B=t.effectivePlayingItem,ee=t.schedule.findItemIndexAtTime(y,S),_e=(D=t.schedule.items)==null?void 0:D[ee],he=t.getBufferingPlayer(),Ie=he==null?void 0:he.interstitial,Fe=Ie==null?void 0:Ie.appendInPlace,it=B&&t.itemsMatch(B,_e);if(B&&(Fe||it)){const qe=s(t.playingAsset),nt=(qe==null?void 0:qe.media)||t.primaryMedia;if(nt){const Ue=S==="primary"?nt.currentTime:o(B,S,t.playingAsset,"timelinePos","currentTime"),Lt=y-Ue,ii=(Fe?Ue:nt.currentTime)+Lt;if(ii>=0&&(!qe||Fe||ii<=qe.duration)){nt.currentTime=ii;return}}}if(_e){let qe=y;if(S!=="primary"){const Ue=_e[S].start,Lt=y-Ue;qe=_e.start+Lt}const nt=!t.isInterstitial(_e);if((!t.isInterstitial(B)||B.event.appendInPlace)&&(nt||_e.event.appendInPlace)){const Ue=t.media||(Fe?he==null?void 0:he.media:null);Ue&&(Ue.currentTime=qe)}else if(B){const Ue=t.findItemIndex(B);if(ee>Ue){const ii=t.schedule.findJumpRestrictedIndex(Ue+1,ee);if(ii>Ue){t.setSchedulePosition(ii);return}}let Lt=0;if(nt)t.timelinePos=qe,t.checkBuffer();else{var Ke;const ii=_e==null||(Ke=_e.event)==null?void 0:Ke.assetList;if(ii){const Ri=y-(_e[S]||_e).start;for(let pi=ii.length;pi--;){const gi=ii[pi];if(gi.duration&&Ri>=gi.startOffset&&Ri<gi.startOffset+gi.duration){Lt=pi;break}}}}t.setSchedulePosition(ee,Lt)}}},m=()=>{const y=t.effectivePlayingItem;if(t.isInterstitial(y))return y;const S=n();return t.isInterstitial(S)?S:null},v={get currentTime(){const y=m(),S=t.effectivePlayingItem;return S&&S===y?o(S,"playout",t.effectivePlayingAsset,"timelinePos","currentTime")-S.playout.start:0},set currentTime(y){const S=m(),C=t.effectivePlayingItem;C&&C===S&&_(y+C.playout.start,"playout")},get duration(){const y=m();return y?y.playout.end-y.playout.start:0},get assetPlayers(){var y;const S=(y=m())==null?void 0:y.event.assetList;return S?S.map(C=>t.getAssetPlayer(C.identifier)):[]},get playingIndex(){var y;const S=(y=m())==null?void 0:y.event;return S&&t.effectivePlayingAsset?S.findAssetIndex(t.effectivePlayingAsset):-1},get scheduleItem(){return m()}};this.manager={get events(){var y,S;return((y=t.schedule)==null||(S=y.events)==null?void 0:S.slice(0))||[]},get schedule(){var y,S;return((y=t.schedule)==null||(S=y.items)==null?void 0:S.slice(0))||[]},get interstitialPlayer(){return m()?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 p("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 p("integrated")},get seekableStart(){var y;return l(((y=t.primaryDetails)==null?void 0:y.fragmentStart)||0,"integrated")}},skip:()=>{const y=t.effectivePlayingItem,S=y==null?void 0:y.event;if(S&&!S.restrictions.skip){const C=t.findItemIndex(y);if(S.appendInPlace){const D=y.playout.start+y.event.duration;_(D+.001,"playout")}else t.advanceAfterAssetEnded(S,C,1/0)}}}}return this.manager}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,s;if(this.mediaSelection===null)return;const o=this.waitingItem||this.playingItem;if(this.isInterstitial(o)&&!o.event.appendInPlace)return;let l=this.media;!l&&(t=this.bufferingItem)!=null&&(n=t.event)!=null&&n.appendInPlace&&(l=this.primaryMedia);const c=(s=l)==null?void 0:s.currentTime;if(!(c===void 0||!ue(c)))return c}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} ${Vi(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,p=t!==c,_=p&&t.interstitial.appendInPlace,m=(s=this.detachedData)==null?void 0:s.mediaSource;let v;if(c.media)_&&(l=c.transferMedia(),this.detachedData=l),v="Primary";else if(m){const C=this.getBufferingPlayer();C?(l=C.transferMedia(),v=`${C}`):v="detached MediaSource"}else v="detached media";if(!l){if(m)l=this.detachedData,this.log(`using detachedData: MediaSource ${Vi(l)}`);else if(!this.detachedData||c.media===n){const C=this.playerQueue;C.length>1&&C.forEach(D=>{if(p&&D.interstitial.appendInPlace!==_){const K=D.interstitial;this.clearInterstitial(D.interstitial,null),K.appendInPlace=!1,K.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${K}`)}}),this.hls.detachMedia(),this.detachedData={media:n}}}const y=l&&"mediaSource"in l&&((o=l.mediaSource)==null?void 0:o.readyState)!=="closed",S=y&&l?l:n;if(this.log(`${y?"transfering MediaSource":"attaching media"} to ${p?t:"Primary"} from ${v}`),S===l){const C=p&&t.assetId===this.schedule.assetIdAtEnd;S.overrides={duration:this.schedule.duration,endOfStream:!p||C,cueRemoval:!p}}t.attachMedia(S)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const t=this.schedule,n=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.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,p=t.findItemIndexAtTime(c);this.setSchedulePosition(p)}}else if(o&&!this.playingItem){const l=t.findItemIndex(o);this.setSchedulePosition(l)}}advanceAfterAssetEnded(t,n,s){const o=da(t,s);if(!t.isAssetPastPlayoutLimit(o))this.setSchedulePosition(n,o);else{const l=this.schedule.items;if(l){const c=n+1,p=l.length;if(c>=p){this.setSchedulePosition(-1);return}const _=t.resumeTime;this.timelinePos<_&&(this.timelinePos=_,this.checkBuffer()),this.setSchedulePosition(c)}}}setScheduleToAssetAtTime(t,n){const s=this.schedule,o=n.parentIdentifier,l=s.getEvent(o);if(l){const c=s.findEventIndex(o),p=s.findAssetIndex(l,t);this.advanceAfterAssetEnded(l,c,p-1)}}setSchedulePosition(t,n){const s=this.schedule.items;if(!s||this.playbackDisabled)return;this.log(`setSchedulePosition ${t}, ${n}`);const o=t>=0?s[t]:null,l=this.playingItem,c=this.playingLastItem;if(this.isInterstitial(l)){var p;const m=l.event,v=this.playingAsset,y=v==null?void 0:v.identifier,S=y?this.getAssetPlayer(y):null;if(S&&y&&(!this.eventItemsMatch(l,o)||n!==void 0&&y!==((p=m.assetList)==null?void 0:p[n].identifier))){var _;const C=m.findAssetIndex(v);this.log(`INTERSTITIAL_ASSET_ENDED ${C+1}/${m.assetList.length} ${Xs(v)}`),this.endedAsset=v,this.playingAsset=null,this.hls.trigger(w.INTERSTITIAL_ASSET_ENDED,{asset:v,assetListIndex:C,event:m,schedule:s.slice(0),scheduleIndex:t,player:S}),this.retreiveMediaSource(y,o),S.media&&!((_=this.detachedData)!=null&&_.mediaSource)&&S.detachMedia()}if(!this.eventItemsMatch(l,o)&&(this.endedItem=l,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${m} ${Ls(l)}`),m.hasPlayed=!0,this.hls.trigger(w.INTERSTITIAL_ENDED,{event:m,schedule:s.slice(0),scheduleIndex:t}),m.cue.once)){this.updateSchedule();const C=this.schedule.items;if(o&&C){const D=this.schedule.findItemIndex(o);this.advanceSchedule(D,C,n,l,c)}return}}this.advanceSchedule(t,s,n,l,c)}advanceSchedule(t,n,s,o,l){const c=t>=0?n[t]:null,p=this.primaryMedia,_=this.playerQueue;if(_.length&&_.forEach(m=>{const v=m.interstitial,y=this.schedule.findEventIndex(v.identifier);(y<t||y>t+1)&&this.clearInterstitial(v,c)}),this.isInterstitial(c)){this.timelinePos=Math.min(Math.max(this.timelinePos,c.start),c.end);const m=c.event;if(s===void 0){s=this.schedule.findAssetIndex(m,this.timelinePos);const C=da(m,s-1);if(m.isAssetPastPlayoutLimit(C)){this.advanceAfterAssetEnded(m,t,s);return}s=C}const v=this.waitingItem;this.assetsBuffered(c,p)||this.setBufferingItem(c);let y=this.preloadAssets(m,s);if(this.eventItemsMatch(c,v||o)||(this.waitingItem=c,this.log(`INTERSTITIAL_STARTED ${Ls(c)} ${m.appendInPlace?"append in place":""}`),this.hls.trigger(w.INTERSTITIAL_STARTED,{event:m,schedule:n.slice(0),scheduleIndex:t})),!m.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${m}`);return}if(m.assetListLoader&&(m.assetListLoader.destroy(),m.assetListLoader=void 0),!p){this.log(`Waiting for attachMedia to start Interstitial ${m}`);return}this.waitingItem=this.endedItem=null,this.playingItem=c;const S=m.assetList[s];if(!S){const C=n[t+1],D=this.media;C&&D&&!this.isInterstitial(C)&&D.currentTime<C.start&&(D.currentTime=this.timelinePos=C.start),this.advanceAfterAssetEnded(m,t,s||0);return}if(y||(y=this.getAssetPlayer(S.identifier)),y===null||y.destroyed){const C=m.assetList.length;this.warn(`asset ${s+1}/${C} player destroyed ${m}`),y=this.createAssetPlayer(m,S,s)}if(!this.eventItemsMatch(c,this.bufferingItem)&&m.appendInPlace&&this.isAssetBuffered(S))return;this.startAssetPlayer(y,s,n,t,p),this.shouldPlay&&Cc(y.media)}else c!==null?(this.resumePrimary(c,t,o),this.shouldPlay&&Cc(this.hls.media)):l&&this.isInterstitial(o)&&(this.endedItem=null,this.playingItem=o,o.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var t,n;return(t=this.mediaSelection)==null||(n=t.main)==null?void 0:n.details}get primaryLive(){var t;return!!((t=this.primaryDetails)!=null&&t.live)}resumePrimary(t,n,s){var o;if(this.playingItem=t,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(t),this.log(`resuming ${Ls(t)}`),!((o=this.detachedData)!=null&&o.mediaSource)){let c=this.timelinePos;(c<t.start||c>=t.end)&&(c=this.getPrimaryResumption(t,n),this.timelinePos=c),this.attachPrimary(c,t)}if(!s)return;const l=this.schedule.items;l&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Ls(t)}`),this.hls.trigger(w.INTERSTITIALS_PRIMARY_RESUMED,{schedule:l.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:Ai.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.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(){this.stopLoad(),this.schedule.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(w.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(w.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(t,n){if(n.level===-1)return;const s=this.hls.levels[n.level],o=M(M({},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=M(M({},this.altSelection),{},{audio:s});return}const l=M(M({},o),{},{audio:s});this.mediaSelection=l}onSubtitleTrackUpdated(t,n){const s=this.hls.subtitleTracks[n.id],o=this.mediaSelection;if(!o){this.altSelection=M(M({},this.altSelection),{},{subtitles:s});return}const l=M(M({},o),{},{subtitles:s});this.mediaSelection=l}onAudioTrackSwitching(t,n){const s=oi(n);this.playerQueue.forEach(o=>o.hls.setAudioOption(n)||o.hls.setAudioOption(s))}onSubtitleTrackSwitch(t,n){const s=oi(n);this.playerQueue.forEach(o=>o.hls.setSubtitleOption(n)||n.id!==-1&&o.hls.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){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),p=(s=this.schedule.items)==null?void 0:s[c];this.isInterstitial(p)&&this.eventItemsMatch(p,this.bufferingItem)&&this.bufferedToItem(p,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){const s=this.schedule.items;if(t&&s){const o=this.findItemIndex(t,n);return s[o]||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=Ai.bufferInfo(this.primaryMedia,s,0);(o.end>s||(o.nextStart||0)>s)&&(this.attachPrimary(s,null),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.findItemIndex(t,n):-1}updateSchedule(){const t=this.mediaSelection;t&&this.schedule.updateSchedule(t,[])}checkBuffer(t){const n=this.schedule.items;if(!n)return;const s=Ai.bufferInfo(this.primaryMedia,this.timelinePos,0);t&&(this.bufferedPos=this.timelinePos),t||(t=s.len<1),this.updateBufferedPos(s.end,n,t)}updateBufferedPos(t,n,s){const o=this.schedule,l=this.bufferingItem;if(this.bufferedPos>t)return;if(n.length===1&&this.itemsMatch(n[0],l)){this.bufferedPos=t;return}const c=this.playingItem,p=this.findItemIndex(c);let _=o.findItemIndexAtTime(t);if(this.bufferedPos<t){var m,v;const y=this.findItemIndex(l),S=Math.min(y+1,n.length-1),C=n[S];if((_===-1&&l&&t>=l.end||(m=C.event)!=null&&m.appendInPlace&&t+.01>=C.start)&&(_=S),S-p>1&&(l==null||(v=l.event)==null?void 0:v.appendInPlace)===!1)return;if(this.bufferedPos=t,_>y&&_>p)this.bufferedToItem(C);else{const D=this.primaryDetails;this.primaryLive&&D&&t>D.edge-D.targetduration&&C.start<D.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(C)&&this.preloadAssets(C.event,0)}}else s&&c&&!this.itemsMatch(c,l)&&(_===p?this.bufferedToItem(c):_===p+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))this.bufferingItem!==t&&(this.bufferingItem=t);else{const{items:o,events:l}=s;if(!o||!l)return n;const c=this.isInterstitial(t),p=this.getBufferingPlayer();this.bufferingItem=t,this.bufferedPos=Math.max(t.start,Math.min(t.end,this.timelinePos));const _=p?p.remaining:n?n.end-this.timelinePos:0;this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Ls(t)}`+(n?` (${_.toFixed(2)} remaining)`:"")),this.playbackDisabled||(c?t.event.assetList.forEach(m=>{const v=this.getAssetPlayer(m.identifier);v&&v.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(m=>m.pauseBuffering()))),this.hls.trigger(w.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:l.slice(0),schedule:o.slice(0),bufferingIndex:this.findItemIndex(t),playingIndex:this.findItemIndex(this.playingItem)})}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 p=s.assetList[n],_=this.primaryMedia;p&&_&&this.bufferAssetPlayer(c,_)}}}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 p;const S=this.playingItem;!this.isInterstitial(S)&&(S==null||(p=S.nextEvent)==null?void 0:p.identifier)===t.identifier&&this.flushFrontBuffer(_+.25)}let m,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 S=v-_;S>0&&(m=Math.round(S*1e3)/1e3)}if(this.log(`Load interstitial asset ${n+1}/${s?1:o} ${t}${m?` live-start: ${v} start-offset: ${m}`:""}`),s)return this.createAsset(t,0,0,_,t.duration,s);const y=this.assetListLoader.loadAssetList(t,m);y&&(t.assetListLoader=y)}else if(!c&&o){for(let _=n;_<o;_++){const m=t.assetList[_],v=this.getAssetPlayerQueueIndex(m.identifier);(v===-1||this.playerQueue[v].destroyed)&&!m.error&&this.createAssetPlayer(t,m,_)}return this.getAssetPlayer(t.assetList[n].identifier)}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(w.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 p={parentIdentifier:t.identifier,identifier:Wh(t,c,n),duration:l,startOffset:s,timelineStart:o,uri:c};return this.createAssetPlayer(t,p,n)}createAssetPlayer(t,n,s){const o=this.hls,l=o.userConfig;let c=l.videoPreference;const p=o.loadLevelObj||o.levels[o.currentLevel];(c||p)&&(c=k({},c),p.videoCodec&&(c.videoCodec=p.videoCodec),p.videoRange&&(c.allowedVideoRanges=[p.videoRange]));const _=o.audioTracks[o.audioTrack],m=o.subtitleTracks[o.subtitleTrack];let v=0;if(this.primaryLive||t.appendInPlace){const he=this.timelinePos-n.timelineStart;if(he>1){const Ie=n.duration;Ie&&he<Ie&&(v=he)}}const y=n.identifier,S=M(M({},l),{},{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:m||l.subtitlePreference});t.appendInPlace&&(t.appendInPlaceStarted=!0,n.timelineStart&&(S.timelineOffset=n.timelineStart));const C=S.cmcd;C!=null&&C.sessionId&&C.contentId&&(S.cmcd=k({},C,{contentId:Sl(n.uri)})),this.getAssetPlayer(y)&&this.warn(`Duplicate date range identifier ${t} and asset ${y}`);const D=new pd(this.HlsPlayerClass,S,t,n);this.playerQueue.push(D),t.assetList[s]=n;const K=he=>{if(he.live){const it=new Error(`Interstitials MUST be VOD assets ${t}`),Ke={fatal:!0,type:me.OTHER_ERROR,details:J.INTERSTITIAL_ASSET_ITEM_ERROR,error:it};this.handleAssetItemError(Ke,t,this.schedule.findEventIndex(t.identifier),s,it.message);return}const Ie=he.edge-he.fragmentStart,Fe=n.duration;(Fe===null||Ie>Fe)&&(this.log(`Interstitial asset "${y}" duration change ${Fe} > ${Ie}`),n.duration=Ie,this.updateSchedule())};D.on(w.LEVEL_UPDATED,(he,{details:Ie})=>K(Ie)),D.on(w.LEVEL_PTS_UPDATED,(he,{details:Ie})=>K(Ie));const B=(he,Ie)=>{const Fe=this.getAssetPlayer(y);if(Fe&&Ie.tracks){Fe.off(w.BUFFER_CODECS,B),Fe.tracks=Ie.tracks;const it=this.primaryMedia;this.bufferingAsset===Fe.assetItem&&it&&!Fe.media&&this.bufferAssetPlayer(Fe,it)}};D.on(w.BUFFER_CODECS,B);const ee=()=>{var he;const Ie=this.getAssetPlayer(y);if(this.log(`buffered to end of asset ${Ie}`),!Ie)return;const Fe=this.schedule.findEventIndex(t.identifier),it=(he=this.schedule.items)==null?void 0:he[Fe];if(this.isInterstitial(it)){const qe=t.findAssetIndex(n),nt=da(t,qe);if(!t.isAssetPastPlayoutLimit(nt))this.bufferedToItem(it,nt);else{var Ke;const Ue=(Ke=this.schedule.items)==null?void 0:Ke[Fe+1];Ue&&this.bufferedToItem(Ue)}}};D.on(w.BUFFERED_TO_END,ee);const _e=he=>()=>{if(!this.getAssetPlayer(y))return;this.shouldPlay=!0;const Fe=this.schedule.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,Fe,he)};return D.once(w.MEDIA_ENDED,_e(s)),D.once(w.PLAYOUT_LIMIT_REACHED,_e(1/0)),D.on(w.ERROR,(he,Ie)=>{const Fe=this.getAssetPlayer(y);if(Ie.details===J.BUFFER_STALLED_ERROR){if(Fe!=null&&Fe.media){const it=Fe.currentTime,Ke=Fe.duration-it;it&&t.appendInPlace&&Ke/Fe.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${y} ${t} at ${Fe.media.currentTime}`),ee()):(this.warn(`Stalled at ${it} of ${it+Ke} in asset ${y} ${t}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(Ie,t,this.schedule.findEventIndex(t.identifier),s,`Asset player error ${Ie.error} ${t}`)}),D.on(w.DESTROYING,()=>{if(!this.getAssetPlayer(y))return;const Ie=new Error(`Asset player destroyed unexpectedly ${y}`),Fe={fatal:!0,type:me.OTHER_ERROR,details:J.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ie};this.handleAssetItemError(Fe,t,this.schedule.findEventIndex(t.identifier),s,Ie.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Xs(n)}`),this.hls.trigger(w.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:s,event:t,player:D}),D}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){this.log(`clear asset player "${t}" toSegment: ${n&&Ls(n)}`);const o=this.playerQueue[s];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:p,assetId:_}=t,m=c.assetList.length,v=this.playingAsset;this.endedAsset=null,this.playingAsset=p,(!v||v.identifier!==_)&&(v&&(this.clearAssetPlayer(v.identifier,s[o]),delete v.error),this.log(`INTERSTITIAL_ASSET_STARTED ${n+1}/${m} ${Xs(p)}`),this.hls.trigger(w.INTERSTITIAL_ASSET_STARTED,{asset:p,assetListIndex:n,event:c,schedule:s.slice(0),scheduleIndex:o,player:t})),this.bufferAssetPlayer(t,l)}bufferAssetPlayer(t,n){var s,o;const{interstitial:l,assetItem:c}=t,p=this.schedule.findEventIndex(l.identifier),_=(s=this.schedule.items)==null?void 0:s[p];if(!_)return;this.setBufferingItem(_),this.bufferingAsset=c;const m=this.getBufferingPlayer();if(m===t)return;const v=l.appendInPlace;if(v&&(m==null?void 0:m.interstitial.appendInPlace)===!1)return;const y=(m==null?void 0:m.tracks)||((o=this.detachedData)==null?void 0:o.tracks)||this.requiredTracks;if(v&&c!==this.playingAsset){if(!t.tracks)return;if(y&&!ze(y,t.tracks)){const S=new Error(`Asset ${Xs(c)} SourceBuffer tracks ('${Object.keys(t.tracks)}') are not compatible with primary content tracks ('${Object.keys(y)}')`),C={fatal:!0,type:me.OTHER_ERROR,details:J.INTERSTITIAL_ASSET_ITEM_ERROR,error:S},D=l.findAssetIndex(c);this.handleAssetItemError(C,l,p,D,S.message);return}}this.transferMediaTo(t,n)}handleAssetItemError(t,n,s,o,l){if(t.details===J.BUFFER_STALLED_ERROR)return;const c=n.assetList[o];this.warn(`INTERSTITIAL_ASSET_ERROR ${c&&Xs(c)} ${t.error}`);const p=c==null?void 0:c.identifier,_=this.getAssetPlayerQueueIndex(p),m=this.playerQueue[_]||null,v=this.schedule.items,y=k({},t,{fatal:!1,errorAction:Ji(!0),asset:c,assetListIndex:o,event:n,schedule:v,scheduleIndex:s,player:m});if(this.hls.trigger(w.INTERSTITIAL_ASSET_ERROR,y),!t.fatal)return;const S=this.playingAsset,C=new Error(l);if(c&&(this.clearAssetPlayer(p,null),c.error=C),!n.assetList.some(D=>!D.error))n.error=C;else if(n.appendInPlace){for(let D=o;D<n.assetList.length;D++)this.resetAssetPlayer(n.assetList[D].identifier);this.updateSchedule()}n.error?this.primaryFallback(n):S&&S.identifier===p&&this.advanceAfterAssetEnded(n,s,o)}primaryFallback(t){const n=t.timelineStart,s=this.effectivePlayingItem;if(this.updateSchedule(),s){this.log(`Fallback to primary from event "${t.identifier}" start: ${n} pos: ${this.timelinePos} playing: ${s?Ls(s):"<none>"} error: ${t.error}`);let o=this.timelinePos;o===-1&&(o=this.hls.startPosition);const l=this.updateItem(s,o);this.itemsMatch(s,l)&&this.clearInterstitial(t,null),t.appendInPlace&&(this.attachPrimary(n,null),this.flushFrontBuffer(n));const c=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(c)}else this.checkStart()}onAssetListLoaded(t,n){var s;const o=n.event,l=o.identifier,c=n.assetListResponse.ASSETS;if(!this.schedule.hasEvent(l))return;const p=o.timelineStart,_=o.duration;let m=0;c.forEach((D,K)=>{const B=parseFloat(D.DURATION);this.createAsset(o,K,m,p+m,B,D.URI),m+=B}),o.duration=m,this.log(`Loaded asset-list with duration: ${m} (was: ${_}) ${o}`);const v=this.waitingItem,y=(v==null?void 0:v.event.identifier)===l;this.updateSchedule();const S=(s=this.bufferingItem)==null?void 0:s.event;if(y){var C;const D=this.schedule.findEventIndex(l),K=(C=this.schedule.items)==null?void 0:C[D];if(K){if(!this.playingItem&&this.timelinePos>K.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==D){o.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${o}`),this.primaryFallback(o);return}this.setBufferingItem(K)}this.setSchedulePosition(D)}else if((S==null?void 0:S.identifier)===l&&S.appendInPlace){const D=o.assetList[0],K=this.getAssetPlayer(D.identifier),B=this.primaryMedia;D&&K&&B&&this.bufferAssetPlayer(K,B)}}onError(t,n){switch(n.details){case J.ASSET_LIST_PARSING_ERROR:case J.ASSET_LIST_LOAD_ERROR:case J.ASSET_LIST_LOAD_TIMEOUT:{const s=n.interstitial;s&&this.primaryFallback(s);break}case J.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Rc=500;class gd extends Pn{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(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(w.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(w.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(w.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(t,n){this.stopLoad(),this.state=rt.IDLE,this.setInterval(Rc),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(le(s)&&(this.fragPrevious=s),this.state=rt.IDLE,!o)return;const l=this.tracksBuffered[this.currentTrackId];if(!l)return;let c;const p=s.start;for(let m=0;m<l.length;m++)if(p>=l[m].start&&p<=l[m].end){c=l[m];break}const _=s.start+s.duration;c?c.end=_:(c={start:p,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 p=0;p<c.length;){if(c[p].end<=l){c.shift();continue}else if(c[p].start<l)c[p].start=l;else break;p++}}),this.fragmentTracker.removeFragmentsInRange(s,l,P.SUBTITLE)}}onError(t,n){const s=n.frag;(s==null?void 0:s.type)===P.SUBTITLE&&(n.details===J.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==rt.STOPPED&&(this.state=rt.IDLE))}onSubtitleTracksUpdated(t,{subtitleTracks:n}){if(this.levels&&hu(this.levels,n)){this.levels=n.map(s=>new Ni(s));return}this.tracksBuffered=[],this.levels=n.map(s=>{const o=new Ni(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!==rt.STOPPED&&this.setInterval(Rc)}onSubtitleTrackLoaded(t,n){var s;const{currentTrackId:o,levels:l}=this,{details:c,id:p}=n;if(!l){this.warn(`Subtitle tracks were reset while loading level ${p}`);return}const _=l[p];if(p>=l.length||!_)return;this.log(`Subtitle track ${p} loaded [${c.startSN},${c.endSN}]${c.lastPartSn?`[part-${c.lastPartSn}-${c.lastPartIndex}]`:""},duration:${c.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let m=0;if(c.live||(s=_.details)!=null&&s.live){const y=this.mainDetails;if(c.deltaUpdateFailed||!y)return;const S=y.fragments[0];if(!_.details)c.hasProgramDateTime&&y.hasProgramDateTime?(Ja(c,y),m=c.fragmentStart):S&&(m=S.start,Ya(c,m));else{var v;m=this.alignPlaylists(c,_.details,(v=this.levelLastLoaded)==null?void 0:v.details),m===0&&S&&(m=S.start,Ya(c,m))}}_.details=c,this.levelLastLoaded=_,p===o&&(this.hls.trigger(w.SUBTITLE_TRACK_UPDATED,{details:c,id:p,groupId:n.groupId}),this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===rt.IDLE&&(li(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&&ir(o.method)){const c=performance.now();this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer,Qr(o.method)).catch(p=>{throw l.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.FRAG_DECRYPT_ERROR,fatal:!1,error:p,reason:p.message,frag:n}),p}).then(p=>{const _=performance.now();l.trigger(w.FRAG_DECRYPTED,{frag:n,payload:p,stats:{tstart:c,tdecrypt:_}})}).catch(p=>{this.warn(`${p.name}: ${p.message}`),this.state=rt.IDLE})}}doTick(){if(!this.media){this.state=rt.IDLE;return}if(this.state===rt.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=Ai.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],l,o.maxBufferHole),{end:p,len:_}=c,m=s.details,v=this.hls.maxBufferLength+m.levelTargetDuration;if(_>v)return;const y=m.fragments,S=y.length,C=m.edge;let D=null;const K=this.fragPrevious;if(p<C){const _e=o.maxFragLookUpTolerance,he=p>C-_e?0:_e;D=li(K,y,Math.max(y[0].start,p),he),!D&&K&&K.start<y[0].start&&(D=y[0])}else D=y[S-1];if(D=this.filterReplacedPrimary(D,s.details),!D)return;const B=D.sn-m.startSN,ee=y[B-1];if(ee&&ee.cc===D.cc&&this.fragmentTracker.getState(ee)===Yi.NOT_LOADED&&(D=ee),this.fragmentTracker.getState(D)===Yi.NOT_LOADED){const _e=this.mapToInitFragWhenRequired(D);_e&&this.loadFragment(_e,s,p)}}}loadFragment(t,n,s){le(t)?super.loadFragment(t,n,s):this._loadInitSegment(t,n)}get mediaBufferTimeRanges(){return new _d(this.tracksBuffered[this.currentTrackId]||[])}}class _d{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 vd={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},Zh=h=>String.fromCharCode(vd[h]||h),Fs=15,pa=100,yd={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},bd={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Ma={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},po={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Ko=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ma{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 os=function(t){const n=[];for(let s=0;s<t.length;s++)n.push(t[s].toString(16));return n};class ga{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 wu{constructor(){this.uchar=" ",this.penState=new ga}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 Su{constructor(t){this.chars=[],this.pos=0,this.currPenState=new ga,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<pa;n++)this.chars.push(new wu);this.logger=t}equals(t){for(let n=0;n<pa;n++)if(!this.chars[n].equals(t.chars[n]))return!1;return!0}copy(t){for(let n=0;n<pa;n++)this.chars[n].copy(t.chars[n])}isEmpty(){let t=!0;for(let n=0;n<pa;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>pa&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=pa)}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=Zh(t);if(this.pos>=pa){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<pa;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<pa;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 Uo{constructor(t){this.rows=[],this.currRow=Fs-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let n=0;n<Fs;n++)this.rows.push(new Su(t));this.logger=t}reset(){for(let t=0;t<Fs;t++)this.rows[t].clear();this.currRow=Fs-1}equals(t){let n=!0;for(let s=0;s<Fs;s++)if(!this.rows[s].equals(t.rows[s])){n=!1;break}return n}copy(t){for(let n=0;n<Fs;n++)this.rows[n].copy(t.rows[n])}isEmpty(){let t=!0;for(let n=0;n<Fs;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 = "+Vi(t));let n=t.row-1;if(this.nrRollUpRows&&n<this.nrRollUpRows-1&&(n=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==n){for(let p=0;p<Fs;p++)this.rows[p].clear();const l=this.currRow+1-this.nrRollUpRows,c=this.lastOutputScreen;if(c){const p=c.rows[l].cueStartTime,_=this.logger.time;if(p!==null&&_!==null&&p<_)for(let m=0;m<this.nrRollUpRows;m++)this.rows[n-this.nrRollUpRows+m+1].copy(c.rows[l+m])}}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 = "+Vi(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<Fs;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 El{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 Uo(s),this.nonDisplayedMemory=new Uo(s),this.lastOutputScreen=new Uo(s),this.currRollUpRow=this.displayedMemory.rows[Fs-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[Fs-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: "+Vi(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 Yh{constructor(t,n,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Jh(),this.logger=void 0;const o=this.logger=new ma;this.channels=[null,new El(t,n,o),new El(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,p=null;if(o===0&&l===0)continue;this.logger.log(3,()=>"["+os([n[s],n[s+1]])+"] -> ("+os([o,l])+")");const _=this.cmdHistory;if(o>=16&&o<=31){if(Xh(o,l,_)){kl(null,null,_),this.logger.log(3,()=>"Repeated command ("+os([o,l])+") is dropped");continue}kl(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 kl(null,null,_);if(!c&&(p=this.parseChars(o,l),p)){const v=this.currentChannel;v&&v>0?this.channels[v].insertChars(p):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!c&&!p&&this.logger.log(2,()=>"Couldn't parse cleaned data "+os([o,l])+" orig: "+os([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 ("+os([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?yd[t]:Ma[t]:s=c===1?bd[t]:po[t];const p=this.channels[c];return p?(p.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 '"+Zh(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 = "+os(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=Ko[l],n%2===1&&(c.background=c.background+"_semi")):n===45?c.background="transparent":(c.foreground="black",n===47&&(c.underline=!0));const p=t<=23?1:2;return this.channels[p].setBkgData(c),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const n=this.channels[t];n&&n.reset()}kl(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 kl(h,t,n){n.a=h,n.b=t}function Xh(h,t,n){return n.a===h&&n.b===t}function Jh(){return{a:null,b:null}}var Ic=function(){if(rr!=null&&rr.VTTCue)return self.VTTCue;const h=["","lr","rl"],t=["start","middle","end","left","right"];function n(p,_){if(typeof _!="string"||!Array.isArray(p))return!1;const m=_.toLowerCase();return~p.indexOf(m)?m:!1}function s(p){return n(h,p)}function o(p){return n(t,p)}function l(p,..._){let m=1;for(;m<arguments.length;m++){const v=arguments[m];for(const y in v)p[y]=v[y]}return p}function c(p,_,m){const v=this,y={enumerable:!0};v.hasBeenReset=!1;let S="",C=!1,D=p,K=_,B=m,ee=null,_e="",he=!0,Ie="auto",Fe="start",it=50,Ke="middle",qe=50,nt="middle";Object.defineProperty(v,"id",l({},y,{get:function(){return S},set:function(Ue){S=""+Ue}})),Object.defineProperty(v,"pauseOnExit",l({},y,{get:function(){return C},set:function(Ue){C=!!Ue}})),Object.defineProperty(v,"startTime",l({},y,{get:function(){return D},set:function(Ue){if(typeof Ue!="number")throw new TypeError("Start time must be set to a number.");D=Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"endTime",l({},y,{get:function(){return K},set:function(Ue){if(typeof Ue!="number")throw new TypeError("End time must be set to a number.");K=Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"text",l({},y,{get:function(){return B},set:function(Ue){B=""+Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"region",l({},y,{get:function(){return ee},set:function(Ue){ee=Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"vertical",l({},y,{get:function(){return _e},set:function(Ue){const Lt=s(Ue);if(Lt===!1)throw new SyntaxError("An invalid or illegal string was specified.");_e=Lt,this.hasBeenReset=!0}})),Object.defineProperty(v,"snapToLines",l({},y,{get:function(){return he},set:function(Ue){he=!!Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"line",l({},y,{get:function(){return Ie},set:function(Ue){if(typeof Ue!="number"&&Ue!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Ie=Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"lineAlign",l({},y,{get:function(){return Fe},set:function(Ue){const Lt=o(Ue);if(!Lt)throw new SyntaxError("An invalid or illegal string was specified.");Fe=Lt,this.hasBeenReset=!0}})),Object.defineProperty(v,"position",l({},y,{get:function(){return it},set:function(Ue){if(Ue<0||Ue>100)throw new Error("Position must be between 0 and 100.");it=Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"positionAlign",l({},y,{get:function(){return Ke},set:function(Ue){const Lt=o(Ue);if(!Lt)throw new SyntaxError("An invalid or illegal string was specified.");Ke=Lt,this.hasBeenReset=!0}})),Object.defineProperty(v,"size",l({},y,{get:function(){return qe},set:function(Ue){if(Ue<0||Ue>100)throw new Error("Size must be between 0 and 100.");qe=Ue,this.hasBeenReset=!0}})),Object.defineProperty(v,"align",l({},y,{get:function(){return nt},set:function(Ue){const Lt=o(Ue);if(!Lt)throw new SyntaxError("An invalid or illegal string was specified.");nt=Lt,this.hasBeenReset=!0}})),v.displayState=void 0}return c.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},c}();class Qh{decode(t,n){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function ef(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 xd{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 tf(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 p=c[0],_=c[1];t(p,_)}}const Pc=new Ic(0,0,""),Eu=Pc.align==="middle"?"middle":"center";function wd(h,t,n){const s=h;function o(){const p=ef(h);if(p===null)throw new Error("Malformed timestamp: "+s);return h=h.replace(/^[^\sa-zA-Z-]+/,""),p}function l(p,_){const m=new xd;tf(p,function(S,C){let D;switch(S){case"region":for(let K=n.length-1;K>=0;K--)if(n[K].id===C){m.set(S,n[K].region);break}break;case"vertical":m.alt(S,C,["rl","lr"]);break;case"line":D=C.split(","),m.integer(S,D[0]),m.percent(S,D[0])&&m.set("snapToLines",!1),m.alt(S,D[0],["auto"]),D.length===2&&m.alt("lineAlign",D[1],["start",Eu,"end"]);break;case"position":D=C.split(","),m.percent(S,D[0]),D.length===2&&m.alt("positionAlign",D[1],["start",Eu,"end","line-left","line-right","auto"]);break;case"size":m.percent(S,C);break;case"align":m.alt(S,C,["start",Eu,"end","left","right"]);break}},/:/,/\s/),_.region=m.get("region",null),_.vertical=m.get("vertical","");let v=m.get("line","auto");v==="auto"&&Pc.line===-1&&(v=-1),_.line=v,_.lineAlign=m.get("lineAlign","start"),_.snapToLines=m.get("snapToLines",!0),_.size=m.get("size",100),_.align=m.get("align",Eu);let y=m.get("position","auto");y==="auto"&&Pc.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 nf(h){return h.replace(/<br(?: \/)?>/gi,`
|
|
|
`)}class ku{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Qh,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=nf(l);c<l.length&&l[c]!=="\r"&&l[c]!==`
|
|
|
`;)++c;const p=l.slice(0,c);return l[c]==="\r"&&++c,l[c]===`
|
|
|
`&&++c,n.buffer=l.slice(c),p}function o(l){tf(l,function(c,p){},/:/)}try{let l="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;l=s();const p=l.match(/^()?WEBVTT([ \t].*)?$/);if(!(p!=null&&p[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 Ic(0,0,""),n.state="CUE",l.indexOf("-->")===-1){n.cue.id=l;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{wd(l,n.cue,n.regionList)}catch(p){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{const p=l.indexOf("-->")!==-1;if(!l||p&&(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 Al=/\r\n|\n\r|\n|\r/g,_a=function(t,n,s=0){return t.slice(s,s+n.length)===n},va=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(!ue(n)||!ue(s)||!ue(o)||!ue(l))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return n+=1e3*s,n+=60*1e3*o,n+=60*60*1e3*l,n};function Au(h,t,n){return Sl(h.toString())+Sl(t.toString())+Sl(n)}const rf=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 sf(h,t,n,s,o,l,c){const p=new ku,_=Rt(new Uint8Array(h)).trim().replace(Al,`
|
|
|
`).split(`
|
|
|
`),m=[],v=t?au(t.baseTime,t.timescale):0;let y="00:00.000",S=0,C=0,D,K=!0;p.oncue=function(B){const ee=n[s];let _e=n.ccOffset;const he=(S-v)/9e4;if(ee!=null&&ee.new&&(C!==void 0?_e=n.ccOffset=ee.start:rf(n,s,he)),he){if(!t){D=new Error("Missing initPTS for VTT MPEGTS");return}_e=he-n.presentationOffset}const Ie=B.endTime-B.startTime,Fe=fs((B.startTime+_e-C)*9e4,o*9e4)/9e4;B.startTime=Math.max(Fe,0),B.endTime=Math.max(Fe+Ie,0);const it=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(it)),B.id||(B.id=Au(B.startTime,B.endTime,it)),B.endTime>0&&m.push(B)},p.onparsingerror=function(B){D=B},p.onflush=function(){if(D){c(D);return}l(m)},_.forEach(B=>{if(K)if(_a(B,"X-TIMESTAMP-MAP=")){K=!1,B.slice(16).split(",").forEach(ee=>{_a(ee,"LOCAL:")?y=ee.slice(6):_a(ee,"MPEGTS:")&&(S=parseInt(ee.slice(7)))});try{C=va(y)/1e3}catch(ee){D=ee}return}else B===""&&(K=!1);p.parse(B+`
|
|
|
`)}),p.flush()}const Oc="stpp.ttml.im1t",af=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Fc=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Sd={left:"start",center:"center",right:"end",start:"start",end:"end"};function of(h,t,n,s){const o=pe(new Uint8Array(h),["mdat"]);if(o.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const l=o.map(p=>Rt(p)),c=su(t.baseTime,1,t.timescale);try{l.forEach(p=>n(Ed(p,c)))}catch(p){s(p)}}function Ed(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,S)=>(y[S]=o.getAttribute(`ttp:${S}`)||l[S],y),{}),p=o.getAttribute("xml:space")!=="preserve",_=Tl(_n(o,"styling","style")),m=Tl(_n(o,"layout","region")),v=_n(o,"body","[begin]");return[].map.call(v,y=>{const S=Ll(y,p);if(!S||!y.hasAttribute("begin"))return null;const C=ya(y.getAttribute("begin"),c),D=ya(y.getAttribute("dur"),c);let K=ya(y.getAttribute("end"),c);if(C===null)throw Bc(y);if(K===null){if(D===null)throw Bc(y);K=C+D}const B=new Ic(C-t,K-t,S);B.id=Au(B.startTime,B.endTime,B.text);const ee=m[y.getAttribute("region")],_e=_[y.getAttribute("style")],he=kd(ee,_e,_),{textAlign:Ie}=he;if(Ie){const Fe=Sd[Ie];Fe&&(B.lineAlign=Fe),B.align=Ie}return k(B,he),B}).filter(y=>y!==null)}function _n(h,t,n){const s=h.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(n)):[]}function Tl(h){return h.reduce((t,n)=>{const s=n.getAttribute("xml:id");return s&&(t[s]=n),t},{})}function Ll(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?Ll(s,t):t?n+s.textContent.trim().replace(/\s+/g," "):n+s.textContent},"")}function kd(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((p,_)=>{const m=Js(t,s,_)||Js(h,s,_)||Js(o,s,_);return m&&(p[_]=m),p},{})}function Js(h,t,n){return h&&h.hasAttributeNS(t,n)?h.getAttributeNS(t,n):null}function Bc(h){return new Error(`Could not parse ttml timestamp ${h}`)}function ya(h,t){if(!h)return null;let n=ef(h);return n===null&&(af.test(h)?n=lf(h,t):Fc.test(h)&&(n=or(h,t))),n}function lf(h,t){const n=af.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 or(h,t){const n=Fc.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 Dl{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 uf{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=mo(),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(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(w.FRAG_LOADING,this.onFragLoading,this),t.on(w.FRAG_LOADED,this.onFragLoaded,this),t.on(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(w.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(w.FRAG_LOADING,this.onFragLoading,this),t.off(w.FRAG_LOADED,this.onFragLoaded,this),t.off(w.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(w.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(w.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(w.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const t=new Dl(this,"textTrack1"),n=new Dl(this,"textTrack2"),s=new Dl(this,"textTrack3"),o=new Dl(this,"textTrack4");this.cea608Parser1=new Yh(1,t,n),this.cea608Parser2=new Yh(3,s,o)}addCues(t,n,s,o,l){let c=!1;for(let p=l.length;p--;){const _=l[p],m=Tu(_[0],_[1],n,s);if(m>=0&&(_[0]=Math.min(_[0],n),_[1]=Math.max(_[1],s),c=!0,m/(s-n)>.5))return}if(c||l.push([n,s]),this.config.renderTextTracksNatively){const p=this.captionsTracks[t];this.Cues.newCue(p,n,s,o)}else{const p=this.Cues.newCue(null,n,s,o);this.hls.trigger(w.CUES_PARSED,{type:"captions",cues:p,track:t})}}onInitPtsFound(t,{frag:n,id:s,initPTS:o,timescale:l}){const{unparsedVttFrags:c}=this;s===P.MAIN&&(this.initPTS[n.cc]={baseTime:o,timescale:l}),c.length&&(this.unparsedVttFrags=[],c.forEach(p=>{this.onFragLoaded(w.FRAG_LOADED,p)}))}getExistingTrack(t,n){const{media:s}=this;if(s)for(let o=0;o<s.textTracks.length;o++){const l=s.textTracks[o];if(Nc(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],p=this.getExistingTrack(l,c);if(p)s[t]=p,fa(s[t]),bu(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(w.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=>{fa(o[l]),delete o[l]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=mo(),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++)fa(n[s])}onSubtitleTracksUpdated(t,n){const s=n.subtitleTracks||[],o=s.some(l=>l.textCodec===Oc);if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(hu(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const c=this.media,p=c?wl(c.textTracks):null;if(this.tracks.forEach((_,m)=>{let v;if(p){let y=null;for(let S=0;S<p.length;S++)if(p[S]&&Nc(p[S],_)){y=p[S],p[S]=null;break}y&&(v=y)}if(v)fa(v);else{const y=cf(_);v=this.createTextTrack(y,_.name,_.lang),v&&(v.mode="disabled")}v&&this.textTracks.push(v)}),p!=null&&p.length){const _=p.filter(m=>m!==null).map(m=>m.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(p=>({label:p.name,kind:p.type.toLowerCase(),default:p.default,subtitleTrack:p}));this.hls.trigger(w.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:p}=this,{cc:_,sn:m}=n.frag,v=(s=(o=n.part)==null?void 0:o.index)!=null?s:-1;l&&c&&(m!==p+1||m===p&&v!==this.lastPartIndex+1||_!==this.lastCc)&&(l.reset(),c.reset()),this.lastCc=_,this.lastSn=m,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 p=this.tracks[s.level],_=this.vttCCs;_[s.cc]||(_[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),p&&p.textCodec===Oc?this._parseIMSC1(s,o):this._parseVTTs(n)}}else this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,n){const s=this.hls;of(n,this.initPTS[t.cc],o=>{this._appendCues(o,t.level),s.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},o=>{s.logger.log(`Failed to parse IMSC1: ${o}`),s.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:o})})}_parseVTTs(t){var n;const{frag:s,payload:o}=t,{initPTS:l,unparsedVttFrags:c}=this,p=l.length-1;if(!l[s.cc]&&p===-1){c.push(t);return}const _=this.hls,m=(n=s.initSegment)!=null&&n.data?Nt(s.initSegment.data,new Uint8Array(o)).buffer:o;sf(m,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,v=>{this._appendCues(v,s.level),_.trigger(w.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&&p>s.cc)&&_.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:v})})}_fallbackToIMSC1(t,n){const s=this.tracks[t.level];s.textCodec||of(n,this.initPTS[t.cc],()=>{s.textCodec=Oc,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=>Ac(o,l))}else{const o=this.tracks[n];if(!o)return;const l=o.default?"default":"subtitles"+n;s.trigger(w.CUES_PARSED,{type:"subtitles",cues:t,track:l})}}onFragDecrypted(t,n){const{frag:s}=n;s.type===P.SUBTITLE&&this.onFragLoaded(w.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 p=this.extractCea608Data(c);this.cea608Parser1.addData(o[l].pts,p[0]),this.cea608Parser2.addData(o[l].pts,p[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:p}=this;Object.keys(p).forEach(_=>Gr(p[_],n,s))}if(this.config.renderTextTracksNatively&&n===0&&o!==void 0){const{textTracks:p}=this;Object.keys(p).forEach(_=>Gr(p[_],n,o))}}}extractCea608Data(t){const n=[[],[]],s=t[0]&31;let o=2;for(let l=0;l<s;l++){const c=t[o++],p=127&t[o++],_=127&t[o++];if(p===0&&_===0)continue;if((4&c)!==0){const v=3&c;(v===0||v===1)&&(n[v].push(p),n[v].push(_))}}return n}}function cf(h){return h.characteristics&&/transcribes-spoken-dialog/gi.test(h.characteristics)&&/describes-music-and-sound/gi.test(h.characteristics)?"captions":"subtitles"}function Nc(h,t){return!!h&&h.kind===cf(t)&&fu(t,h)}function Tu(h,t,n,s){return Math.min(t,s)-Math.max(h,n)}function mo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const hf=/\s/,Zr={newCue(h,t,n,s){const o=[];let l,c,p,_,m;const v=self.VTTCue||self.TextTrackCue;for(let S=0;S<s.rows.length;S++)if(l=s.rows[S],p=!0,_=0,m="",!l.isEmpty()){var y;for(let K=0;K<l.chars.length;K++)hf.test(l.chars[K].uchar)&&p?_++:(m+=l.chars[K].uchar,p=!1);l.cueStartTime=t,t===n&&(n+=1e-4),_>=16?_--:_++;const C=nf(m.trim()),D=Au(t,n,C);h!=null&&(y=h.cues)!=null&&y.getCueById(D)||(c=new v(t,n,C),c.id=D,c.line=S+1,c.align="left",c.position=10+Math.min(80,Math.floor(_*8/32)*10),o.push(c))}return h&&o.length&&(o.sort((S,C)=>S.line==="auto"||C.line==="auto"?0:S.line>8&&C.line>8?C.line-S.line:S.line-C.line),o.forEach(S=>Ac(h,S))),o}};function ff(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}const df=/(\d+)-(\d+)\/(\d+)/;class Mt{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||pf,this.controller=new self.AbortController,this.stats=new L}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=qn(t,this.controller.signal),c=t.responseType==="arraybuffer",p=c?"byteLength":"length",{maxTimeToFirstByteMs:_,maxLoadTimeMs:m}=n.loadPolicy;this.context=t,this.config=n,this.callbacks=s,this.request=this.fetchSetup(t,l),self.clearTimeout(this.requestTimeout),n.timeout=_&&ue(_)?_:m,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(o,t,this.response))},n.timeout),(Oo(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(y=>{var S;this.response=this.loader=y;const C=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(this.requestTimeout),n.timeout=m,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(o,t,this.response))},m-(C-o.loading.start)),!y.ok){const{status:K,statusText:B}=y;throw new mf(B||"fetch, bad network response",K,y)}o.loading.first=C,o.total=y0(y.headers)||o.total;const D=(S=this.callbacks)==null?void 0:S.onProgress;return D&&ue(n.highWaterMark)?this.loadProgressively(y,o,t,n.highWaterMark,D):c?y.arrayBuffer():t.responseType==="json"?y.json():y.text()}).then(y=>{var S,C;const D=this.response;if(!D)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);const K=y[p];K&&(o.loaded=o.total=K);const B={url:D.url,data:y,code:D.status},ee=(S=this.callbacks)==null?void 0:S.onProgress;ee&&!ue(n.highWaterMark)&&ee(o,t,y,D),(C=this.callbacks)==null||C.onSuccess(B,o,t,D)}).catch(y=>{var S;if(self.clearTimeout(this.requestTimeout),o.aborted)return;const C=y&&y.code||0,D=y?y.message:null;(S=this.callbacks)==null||S.onError({code:C,text:D},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 zr,p=t.body.getReader(),_=()=>p.read().then(m=>{if(m.done)return c.dataLength&&l(n,s,c.flush().buffer,t),Promise.resolve(new ArrayBuffer(0));const v=m.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 qn(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 v0(h){const t=df.exec(h);if(t)return parseInt(t[2])-parseInt(t[1])+1}function y0(h){const t=h.get("Content-Range");if(t){const s=v0(t);if(ue(s))return s}const n=h.get("Content-Length");if(n)return parseInt(n)}function pf(h,t){return new self.Request(h.url,t)}class mf extends Error{constructor(t,n,s){super(t),this.code=void 0,this.details=void 0,this.code=n,this.details=s}}const Cl=/^age:\s*[\d.]+\s*$/im;class Ml{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 L,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 p;(p=this.callbacks)==null||p.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 p in o)t.setRequestHeader(p,o[p]);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&&ue(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 m=n.status,v=n.responseType==="text"?n.responseText:null;if(m>=200&&m<300){const D=v!=null?v:n.response;if(D!=null){var c,p;s.loading.end=Math.max(self.performance.now(),s.loading.first);const K=n.responseType==="arraybuffer"?D.byteLength:D.length;s.loaded=s.total=K,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const B=(c=this.callbacks)==null?void 0:c.onProgress;B&&B(s,t,D,n);const ee={url:n.responseURL,data:D,code:m};(p=this.callbacks)==null||p.onSuccess(ee,s,t,n);return}}const y=l.loadPolicy.errorRetry,S=s.retry,C={url:t.url,data:void 0,code:m};if(wi(y,S,!1,C))this.retry(y);else{var _;se.error(`${m} while loading ${t.url}`),(_=this.callbacks)==null||_.onError({code:m,text:n.statusText},t,n,s)}}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry,n=this.stats.retry;if(wi(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=nn(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&&Cl.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 Ad={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Td=M(M({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:Ml,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Jt,bufferController:td,capLevelController:Bo,errorController:Bn,fpsController:hd,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:Ms,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:Ad},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},gf()),{},{subtitleStreamController:gd,subtitleTrackController:Tc,timelineController:uf,audioStreamController:Da,audioTrackController:Fo,emeController:ha,cmcdController:ud,contentSteeringController:cd,interstitialsController:Mc});function gf(){return{cueHandler:Zr,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 zo(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=Sr(h),o=["manifest","level","frag"],l=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return o.forEach(c=>{const p=`${c==="level"?"playlist":c}LoadPolicy`,_=t[p]===void 0,m=[];l.forEach(v=>{const y=`${c}Loading${v}`,S=t[y];if(S!==void 0&&_){m.push(y);const C=s[p].default;switch(t[p]={default:C},v){case"TimeOut":C.maxLoadTimeMs=S,C.maxTimeToFirstByteMs=S;break;case"MaxRetry":C.errorRetry.maxNumRetry=S,C.timeoutRetry.maxNumRetry=S;break;case"RetryDelay":C.errorRetry.retryDelayMs=S,C.timeoutRetry.retryDelayMs=S;break;case"MaxRetryTimeout":C.errorRetry.maxRetryDelayMs=S,C.timeoutRetry.maxRetryDelayMs=S;break}}}),m.length&&n.warn(`hls.js config: "${m.join('", "')}" setting(s) are deprecated, use "${p}": ${Vi(t[p])}`)}),M(M({},s),t)}function Sr(h){return h&&typeof h=="object"?Array.isArray(h)?h.map(Sr):Object.keys(h).reduce((t,n)=>(t[n]=Sr(h[n]),t),{}):h}function Rl(h,t){const n=h.loader;n!==Mt&&n!==Ml?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1):ff()&&(h.loader=Mt,h.progressive=!0,h.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Vo=2,go=.1,Ds=.05,Ld=100;class Il extends pr{constructor(t,n){super("gap-controller",t.logger),this.hls=null,this.fragmentTracker=null,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(w.MEDIA_ENDED,{stalled:!1})}},this.hls=t,this.fragmentTracker=n,this.registerListeners()}registerListeners(){const{hls:t}=this;t&&(t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.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(Ld),this.mediaSource=n.mediaSource;const s=this.media=n.media;Ar(s,"playing",this.onMediaPlaying),Ar(s,"waiting",this.onMediaWaiting),Ar(s,"ended",this.onMediaEnded)}onMediaDetaching(t,n){this.clearInterval();const{media:s}=this;s&&(as(s,"playing",this.onMediaPlaying),as(s,"waiting",this.onMediaWaiting),as(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:p}=c,_=this.seeking&&!p,m=!this.seeking&&p,v=c.paused&&!p||c.ended||c.playbackRate===0;if(this.seeking=p,t!==n){n&&(this.ended=0),this.moved=!0,p||(this.nudgeRetry=0,l.nudgeOnVideoHole&&!v&&t>n&&this.nudgeOnVideoHole(t,n)),this.waiting===0&&this.stallResolved(t);return}if(m||_){_&&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(w.MEDIA_ENDED,{stalled:!1}));return}if(!Ai.getBuffered(c).length){this.nudgeRetry=0;return}const y=Ai.bufferInfo(c,t,0),S=y.nextStart||0,C=this.fragmentTracker;if(p&&C&&this.hls){const it=Go(this.hls.inFlightFragments,t),Ke=y.len>Vo,qe=!S||it||S-t>Vo&&!C.getPartialFragment(t);if(Ke||qe)return;this.moved=!1}const D=(o=this.hls)==null?void 0:o.latestLevelDetails;if(!this.moved&&this.stalled!==null&&C){if(!(y.len>0)&&!S)return;const Ke=Math.max(S,y.start||0)-t,nt=!!(D!=null&&D.live)?D.targetduration*2:Vo,Ue=C.getPartialFragment(t);if(Ke>0&&(Ke<=nt||Ue)){c.paused||this._trySkipBufferHole(Ue);return}}const K=l.detectStallWithCurrentTimeMs,B=self.performance.now(),ee=this.waiting;let _e=this.stalled;if(_e===null)if(ee>0&&B-ee<K)_e=this.stalled=ee;else{this.stalled=B;return}const he=B-_e;if(!p&&(he>=K||ee)&&this.hls){var Ie;if(((Ie=this.mediaSource)==null?void 0:Ie.readyState)==="ended"&&!(D!=null&&D.live)&&Math.abs(t-((D==null?void 0:D.edge)||0))<1){if(this.ended)return;this.ended=t||1,this.hls.trigger(w.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(y),!this.media||!this.hls)return}const Fe=Ai.bufferInfo(c,t,l.maxBufferHole);this._tryFixBufferStall(Fe,he,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(w.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=Ai.bufferedInfo(Ai.timeRangesToArray(this.buffered.audio),t,0);if(l.len>1&&n>=l.start){const c=Ai.timeRangesToArray(o),p=Ai.bufferedInfo(c,n,0).bufferedIndex;if(p>-1&&p<c.length-1){const _=Ai.bufferedInfo(c,t,0).bufferedIndex,m=c[p].end,v=c[p+1].start;if((_===-1||_>p)&&v-m<1&&t-m<2){const y=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${t} hole: ${m} -> ${v} buffered index: ${_}`);this.warn(y.message),this.media.currentTime+=1e-6;const S=this.fragmentTracker.getPartialFragment(t)||void 0,C=Ai.bufferInfo(this.media,t,0);this.hls.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:S,buffer:C.len,bufferInfo:C})}}}}}_tryFixBufferStall(t,n,s){var o,l;const{fragmentTracker:c,media:p}=this,_=(o=this.hls)==null?void 0:o.config;if(!p||!c||!_)return;const m=(l=this.hls)==null?void 0:l.latestLevelDetails,v=c.getPartialFragment(s);if((v||m!=null&&m.live&&s<m.fragmentStart)&&(this._trySkipBufferHole(v)||!this.media))return;const y=t.buffered,S=this.adjacentTraversal(t,s);(y&&y.length>1&&t.len>_.maxBufferHole||t.nextStart&&(t.nextStart-s<_.maxBufferHole||S))&&(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 (${Vi(t)})`);this.warn(c.message),n.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.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,p=Ai.bufferInfo(o,c,0),_=c<p.start?p.start:p.nextStart;if(_&&this.hls){const v=p.len<=l.maxBufferHole,y=p.len>0&&p.len<1&&o.readyState<3,S=_-c;if(S>0&&(v||y)){if(S>l.maxBufferHole){let D=!1;if(c===0){const K=s.getAppendedFrag(0,P.MAIN);K&&_<K.end&&(D=!0)}if(!D){const K=t||s.getAppendedFrag(c,P.MAIN);if(K){var m;if(!((m=this.hls.loadLevelObj)!=null&&m.details)||Go(this.hls.inFlightFragments,_))return 0;let ee=!1,_e=K.end;for(;_e<_;){const he=s.getPartialFragment(_e);if(he)_e+=he.duration;else{ee=!0;break}}if(ee)return 0}}}const C=Math.max(_+Ds,c+go);if(this.warn(`skipping hole, adjusting currentTime from ${c} to ${C}`),this.moved=!0,o.currentTime=C,!(t!=null&&t.gap)){const D=new Error(`fragment loaded with buffer holes, seeking from ${c} to ${C}`);this.hls.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:D,reason:D.message,frag:t||void 0,buffer:p.len,bufferInfo:p})}return C}}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 p=c+(o+1)*l.nudgeOffset,_=new Error(`Nudging 'currentTime' from ${c} to ${p}`);this.warn(_.message),s.currentTime=p,n.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.BUFFER_NUDGE_ON_STALL,error:_,fatal:!1,buffer:t.len,bufferInfo:t})}else{const p=new Error(`Playhead still not moving while enough data buffered @${c} after ${l.nudgeMaxRetry} nudges`);this.error(p.message),n.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.BUFFER_STALLED_ERROR,error:p,fatal:!0,buffer:t.len,bufferInfo:t})}}}function Go(h,t){const n=$c(h.main);if(n&&n.start<=t)return n;const s=$c(h.audio);return s&&s.start<=t?s:null}function $c(h){if(!h)return null;switch(h.state){case rt.IDLE:case rt.STOPPED:case rt.ENDED:case rt.ERROR:return null}return h.frag}const Dd=.25;function Ho(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function _f(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,Vi(o?M({type:o},s):s))}return l}const Lu=(()=>{const h=Ho();try{h&&new h(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Cd(h){return Uint8Array.from(h.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Pl{constructor(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(w.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.on(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(w.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}_unregisterListeners(){const{hls:t}=this;t.off(w.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(w.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(w.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(){const t=this.hls.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(t,n){this.media=null,!n.transferMedia&&(this.id3Track&&(this.removeCues&&fa(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 bu(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,n){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:o}}}=this;if(!s&&!o)return;const{samples:l}=n;this.id3Track||(this.id3Track=this.createTrack(this.media));const c=Ho();if(c)for(let p=0;p<l.length;p++){const _=l[p].type;if(_===vr.emsg&&!s||!o)continue;const m=Qu(l[p].data);if(m){const v=l[p].pts;let y=v+l[p].duration;y>Lu&&(y=Lu),y-v<=0&&(y=v+Dd);for(let C=0;C<m.length;C++){const D=m[C];if(!ec(D)){this.updateId3CueEnds(v,_);const K=_f(c,v,y,D,_);K&&this.id3Track.addCue(K)}}}}}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===Lu&&(c.endTime=t)}}onBufferFlushing(t,{startOffset:n,endOffset:s,type:o}){const{id3Track:l,hls:c}=this;if(!c)return;const{config:{enableEmsgMetadataCues:p,enableID3MetadataCues:_}}=c;if(l&&(p||_)){let m;o==="audio"?m=v=>v.type===vr.audioId3&&_:o==="video"?m=v=>v.type===vr.emsg&&p:m=v=>v.type===vr.audioId3&&_||v.type===vr.emsg&&p,Gr(l,n,s,m)}}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.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:s}=this,{dateRanges:o}=t,l=Object.keys(o);let c=this.dateRangeCuesAppended;if(s&&n){var p;if((p=s.cues)!=null&&p.length){const v=Object.keys(c).filter(y=>!l.includes(y));for(let y=v.length;y--;){const S=v[y],C=c[S].cues;delete c[S],Object.keys(C).forEach(D=>{try{const K=C[D];K.removeEventListener("enter",this.onEventCueEnter),s.removeCue(K)}catch(K){}})}}else c=this.dateRangeCuesAppended={}}const _=t.fragments[t.fragments.length-1];if(l.length===0||!ue(_==null?void 0:_.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const m=Ho();for(let v=0;v<l.length;v++){const y=l[v],S=o[y],C=S.startTime,D=c[y],K=(D==null?void 0:D.cues)||{};let B=(D==null?void 0:D.durationKnown)||!1,ee=Lu;const{duration:_e,endDate:he}=S;if(he&&_e!==null)ee=C+_e,B=!0;else if(S.endOnNext&&!B){const Fe=l.reduce((it,Ke)=>{if(Ke!==S.id){const qe=o[Ke];if(qe.class===S.class&&qe.startDate>S.startDate&&(!it||S.startDate<it.startDate))return qe}return it},null);Fe&&(ee=Fe.startTime,B=!0)}const Ie=Object.keys(S.attr);for(let Fe=0;Fe<Ie.length;Fe++){const it=Ie[Fe];if(!_r(it))continue;const Ke=K[it];if(Ke)B&&!D.durationKnown?Ke.endTime=ee:Math.abs(Ke.startTime-C)>.01&&(Ke.startTime=C,Ke.endTime=ee);else if(m){let qe=S.attr[it];Wn(it)&&(qe=Cd(qe));const Ue=_f(m,C,ee,{key:it,data:qe},vr.dateRange);Ue&&(Ue.id=y,this.id3Track.addCue(Ue),K[it]=Ue,this.hls.config.interstitialsController&&(it==="X-ASSET-LIST"||it==="X-ASSET-URL")&&Ue.addEventListener("enter",this.onEventCueEnter))}}c[y]={cues:K,dateRange:S,durationKnown:B}}}}class Ol{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 p=this.targetLatency;if(p===null)return;const _=o-p,m=Math.min(this.maxLatency,p+s.targetduration);if(_<m&&_>.05&&this.forwardBufferLength>1){const y=Math.min(2,Math.max(1,c)),S=Math.round(2/(1+Math.exp(-.75*_-this.edgeStalled))*20)/20,C=Math.min(y,Math.max(1,S));this.changeMediaPlaybackRate(n,C)}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:p}=this.config,_=this.hls.userConfig;let m=p&&s||n;(this._targetLatencyUpdated||_.liveSyncDuration||_.liveSyncDurationCount||m===0)&&(m=l!==void 0?l:c*o);const v=o;return m+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,p=o-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(c,l),p)}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(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(w.ERROR,this.onError,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(w.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(w.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(w.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===J.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 Kc extends cu{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(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this),t.on(w.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.FRAG_BUFFERED,this.onFragBuffered,this),t.off(w.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 p=!1,_=!1,m=!1;n.levels.forEach(v=>{const y=v.attrs;let{audioCodec:S,videoCodec:C}=v;S&&(v.audioCodec=S=ct(S,s)||void 0),C&&(C=v.videoCodec=Gt(C));const{width:D,height:K,unknownCodecs:B}=v;let ee=B?B.length:0;if(B)for(let Ue=ee;Ue--;){const Lt=B[Ue];this.isAudioSupported(Lt)?(v.audioCodec=S=S?`${S},${Lt}`:Lt,ee--,Xe.audio[S.substring(0,4)]=2):this.isVideoSupported(Lt)&&(v.videoCodec=C=C?`${C},${Lt}`:Lt,ee--,Xe.video[C.substring(0,4)]=2)}if(p||(p=!!(D&&K)),_||(_=!!C),m||(m=!!S),ee||S&&!this.isAudioSupported(S)||C&&!this.isVideoSupported(C)){this.log(`Some or all CODECS not supported "${y.CODECS}"`);return}const{CODECS:_e,"FRAME-RATE":he,"HDCP-LEVEL":Ie,"PATHWAY-ID":Fe,RESOLUTION:it,"VIDEO-RANGE":Ke}=y,nt=`${`${Fe||"."}-`}${v.bitrate}-${it}-${he}-${_e}-${Ke}-${Ie}`;if(l[nt])if(l[nt].uri!==v.url&&!v.attrs["PATHWAY-ID"]){const Ue=c[nt]+=1;v.attrs["PATHWAY-ID"]=new Array(Ue+1).join(".");const Lt=this.createLevel(v);l[nt]=Lt,o.push(Lt)}else l[nt].addGroupId("audio",y.AUDIO),l[nt].addGroupId("text",y.SUBTITLES);else{const Ue=this.createLevel(v);l[nt]=Ue,c[nt]=1,o.push(Ue)}}),this.filterAndSortMediaOptions(o,n,p,_,m)}createLevel(t){const n=new Ni(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=ai(o,[])}return n}isAudioSupported(t){return De(t,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(t){return De(t,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(t,n,s,o,l){let c=[],p=[],_=t;if((s||o)&&l&&(_=_.filter(({videoCodec:B,videoRange:ee,width:_e,height:he})=>(!!B||!!(_e&&he))&&on(ee))),_.length===0){Promise.resolve().then(()=>{if(this.hls){let B="no level with compatible codecs found in manifest",ee=B;n.levels.length&&(ee=`one or more CODECS in variant not supported: ${Vi(n.levels.map(he=>he.attrs.CODECS).filter((he,Ie,Fe)=>Fe.indexOf(he)===Ie))}`,this.warn(ee),B+=` (${ee})`);const _e=new Error(B);this.hls.trigger(w.ERROR,{type:me.MEDIA_ERROR,details:J.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:_e,reason:ee})}});return}n.audioTracks&&(c=n.audioTracks.filter(B=>!B.audioCodec||this.isAudioSupported(B.audioCodec)),Ra(c)),n.subtitles&&(p=n.subtitles,Ra(p));const m=_.slice(0);_.sort((B,ee)=>{if(B.attrs["HDCP-LEVEL"]!==ee.attrs["HDCP-LEVEL"])return(B.attrs["HDCP-LEVEL"]||"")>(ee.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&B.height!==ee.height)return B.height-ee.height;if(B.frameRate!==ee.frameRate)return B.frameRate-ee.frameRate;if(B.videoRange!==ee.videoRange)return Ui.indexOf(B.videoRange)-Ui.indexOf(ee.videoRange);if(B.videoCodec!==ee.videoCodec){const _e=U(B.videoCodec),he=U(ee.videoCodec);if(_e!==he)return he-_e}if(B.uri===ee.uri&&B.codecSet!==ee.codecSet){const _e=H(B.codecSet),he=H(ee.codecSet);if(_e!==he)return he-_e}return B.averageBitrate!==ee.averageBitrate?B.averageBitrate-ee.averageBitrate:0});let v=m[0];if(this.steering&&(_=this.steering.filterParsedLevels(_),_.length!==m.length)){for(let B=0;B<m.length;B++)if(m[B].pathwayId===_[0].pathwayId){v=m[B];break}}this._levels=_;for(let B=0;B<_.length;B++)if(_[B]===v){var y;this._firstLevel=B;const ee=v.bitrate,_e=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${_.length} level(s) found, first bitrate: ${ee}`),((y=this.hls.userConfig)==null?void 0:y.abrEwmaDefaultEstimate)===void 0){const he=Math.min(ee,this.hls.config.abrEwmaDefaultEstimateMax);he>_e&&_e===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=he)}break}const S=l&&!o,C=this.hls.config,D=!!(C.audioStreamController&&C.audioTrackController),K={levels:_,audioTracks:c,subtitleTracks:p,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:l,video:o,altAudio:D&&!S&&c.some(B=>!!B.url)};this.hls.trigger(w.MANIFEST_PARSED,K)}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(w.ERROR,{type:me.OTHER_ERROR,details:J.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],p=c.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=c,s===t&&o&&l===p)return;this.log(`Switching to level ${t} (${c.height?c.height+"p ":""}${c.videoRange?c.videoRange+" ":""}${c.codecSet?c.codecSet+" ":""}@${c.bitrate})${p?" with Pathway "+p:""} 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(w.LEVEL_SWITCHING,_);const m=c.details;if(!m||m.live){const v=this.switchParams(c.uri,o==null?void 0:o.details,m);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===Le.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 p;this.warn(`Invalid level index ${o}`),(p=n.deliveryDirectives)!=null&&p.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,p=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:""}${p&&c.live?" age "+p.toFixed(1)+(c.type?" "+c.type||0:""):""} ${s}`),this.hls.trigger(w.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(p=>p.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(w.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(w.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:n,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Ra(h){const t={};h.forEach(n=>{const s=n.groupId||"";n.id=t[s]=t[s]||0,t[s]++})}function ba(){return self.SourceBuffer||self.WebKitSourceBuffer}function vf(){if(!ke())return!1;const t=ba();return!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function"}function yf(){if(!vf())return!1;const h=ke();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(Ee(t,"video")))||["mp4a.40.2","fLaC"].some(t=>h.isTypeSupported(Ee(t,"audio"))))}function Uc(){var h;const t=ba();return typeof(t==null||(h=t.prototype)==null?void 0:h.changeType)=="function"}const bf=100;class Md extends Pn{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||!ue(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(w.MANIFEST_PARSED,this.onManifestParsed,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.LEVEL_LOADED,this.onLevelLoaded,this),t.on(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(w.BUFFER_CREATED,this.onBufferCreated,this),t.on(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(w.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(w.MANIFEST_PARSED,this.onManifestParsed,this),t.off(w.LEVEL_LOADED,this.onLevelLoaded,this),t.off(w.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(w.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(w.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(w.BUFFER_CREATED,this.onBufferCreated,this),t.off(w.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(w.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(w.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(bf),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=rt.IDLE,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}else this._forceStartLoad=!0,this.state=rt.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case rt.WAITING_LEVEL:{const{levels:n,level:s}=this,o=n==null?void 0:n[s],l=o==null?void 0:o.details;if(l&&(!l.live||this.levelLastLoaded===o&&!this.waitForLive(o))){if(this.waitForCdnTuneIn(l))break;this.state=rt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=rt.IDLE;break}break}case rt.FRAG_LOADING_WAITING_RETRY:{var t;const n=self.performance.now(),s=this.retryDate;if(!s||n>=s||(t=this.media)!=null&&t.seeking){const{levels:o,level:l}=this,c=o==null?void 0:o[l];this.resetStartWhenNotLoaded(c||null),this.state=rt.IDLE}}break}this.state===rt.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],p=this.getMainFwdBufferInfo();if(p===null)return;const _=this.getLevelDetails();if(_&&this._streamEnded(p,_)){const K={};this.altAudio===2&&(K.type="video"),this.hls.trigger(w.BUFFER_EOS,K),this.state=rt.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 m=c.details;if(!m||this.state===rt.WAITING_LEVEL||this.waitForLive(c)){this.level=l,this.state=rt.WAITING_LEVEL,this.startFragRequested=!1;return}const v=p.len,y=this.getMaxBufferLength(c.maxBitrate);if(v>=y)return;this.backtrackFragment&&this.backtrackFragment.start>p.end&&(this.backtrackFragment=null);const S=this.backtrackFragment?this.backtrackFragment.start:p.end;let C=this.getNextFragment(S,m);if(this.couldBacktrack&&!this.fragPrevious&&C&&le(C)&&this.fragmentTracker.getState(C)!==Yi.OK){var D;const B=((D=this.backtrackFragment)!=null?D:C).sn-m.startSN,ee=m.fragments[B-1];ee&&C.cc===ee.cc&&(C=ee,this.fragmentTracker.removeFragment(ee))}else this.backtrackFragment&&p.len&&(this.backtrackFragment=null);if(C&&this.isLoopLoading(C,S)){if(!C.gap){const B=this.audioOnly&&!this.altAudio?A.AUDIO:A.VIDEO,ee=(B===A.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;ee&&this.afterBufferFlushed(ee,B,P.MAIN)}C=this.getNextFragmentLoopLoading(C,m,p,P.MAIN,y)}C&&(C.initSegment&&!C.initSegment.data&&!this.bitrateTest&&(C=C.initSegment),this.loadFragment(C,c,S))}loadFragment(t,n,s){const o=this.fragmentTracker.getState(t);o===Yi.NOT_LOADED||o===Yi.PARTIAL?le(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 p=this.getMainFwdBufferInfo();if(!p||p.len<l.targetduration*2)return}if(!n.paused&&t){const p=this.hls.nextLoadLevel,_=t[p],m=this.fragLastKbps;m&&this.fragCurrent?s=this.fragCurrent.duration*_.maxBitrate/(1e3*m)+1:s=0}else s=0;const c=this.getBufferedFrag(n.currentTime+s);if(c){const p=this.followingBufferedFrag(c);if(p){this.abortCurrentFrag();const _=p.maxStartPTS?p.maxStartPTS:p.start,m=p.duration,v=Math.max(c.end,_+Math.min(Math.max(m-this.config.maxFragLookUpTolerance,m*(this.couldBacktrack?.5:.125)),m*(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 rt.KEY_LOADING:case rt.FRAG_LOADING:case rt.FRAG_LOADING_WAITING_RETRY:case rt.PARSING:case rt.PARSED:this.state=rt.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;Ar(s,"playing",this.onMediaPlaying),Ar(s,"seeked",this.onMediaSeeked)}onMediaDetaching(t,n){const{media:s}=this;s&&(as(s,"playing",this.onMediaPlaying),as(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(w.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;n.levels.forEach(l=>{const c=l.audioCodec;c&&(s=s||c.indexOf("mp4a.40.2")!==-1,o=o||c.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&o&&!Uc(),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!==rt.IDLE)return;const o=n.levelInfo;(!o.details||o.details.live&&(this.levelLastLoaded!==o||o.details.expired)||this.waitForCdnTuneIn(o.details))&&(this.state=rt.WAITING_LEVEL)}onLevelLoaded(t,n){var s;const{levels:o,startFragRequested:l}=this,c=n.level,p=n.details,_=p.totalduration;if(!o){this.warn(`Levels were reset while loading level ${c}`);return}this.log(`Level ${c} loaded [${p.startSN},${p.endSN}]${p.lastPartSn?`[part-${p.lastPartSn}-${p.lastPartIndex}]`:""}, cc [${p.startCC}, ${p.endCC}] duration:${_}`);const m=n.levelInfo,v=this.fragCurrent;v&&(this.state===rt.FRAG_LOADING||this.state===rt.FRAG_LOADING_WAITING_RETRY)&&v.level!==n.level&&v.loader&&this.abortCurrentFrag();let y=0;if(p.live||(s=m.details)!=null&&s.live){var S;if(this.checkLiveUpdate(p),p.deltaUpdateFailed)return;y=this.alignPlaylists(p,m.details,(S=this.levelLastLoaded)==null?void 0:S.details)}if(m.details=p,this.levelLastLoaded=m,l||this.setStartPosition(p,y),this.hls.trigger(w.LEVEL_UPDATED,{details:p,level:c}),this.state===rt.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=rt.IDLE}l&&p.live&&this.synchronizeToLiveEdge(p),this.tick()}synchronizeToLiveEdge(t){const{config:n,media:s}=this;if(!s)return;const o=this.hls.liveSyncPosition,l=this.getLoadPosition(),c=t.fragmentStart,p=t.edge,_=l>=c-n.maxFragLookUpTolerance&&l<=p;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<p-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: ${p}, reset currentTime to : ${o.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var m;const y=Ai.bufferInfo(s,o,0);if(!(y!=null&&(m=y.buffered)!=null&&m.length)){s.currentTime=o;return}if(y.start<=l){s.currentTime=o;return}const{nextStart:C}=Ai.bufferedInfo(y.buffered,l,0);C&&(s.currentTime=C)}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 p=c[s.level];if(!p){this.warn(`Level ${s.level} not found on progress`);return}const _=p.details;if(!_){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const m=p.videoCodec,v=_.PTSKnown||!_.live,y=(n=s.initSegment)==null?void 0:n.data,S=this._getAudioCodec(p),C=this.transmuxer=this.transmuxer||new As(this.hls,P.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),D=o?o.index:-1,K=D!==-1,B=new Rn(s.level,s.sn,s.stats.chunkCount,l.byteLength,D,K),ee=this.initPTS[s.cc];C.push(l,y,S,m,s,o,_.totalduration,v,B,ee)}onAudioTrackSwitching(t,n){const s=this.hls,o=this.altAudio===2;if(Pt(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(w.BUFFER_FLUSHED,()=>{var c;(c=this.hls)==null||c.trigger(w.AUDIO_TRACK_SWITCHED,n)}),s.trigger(w.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(w.AUDIO_TRACK_SWITCHED,n)}}onAudioTrackSwitched(t,n){const s=Pt(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 p in s){const _=s[p];if(_.id==="main"){if(l=p,o=_,p==="video"){const m=s[p];m&&(this.videoBuffer=m.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===rt.PARSED&&(this.state=rt.IDLE);return}const p=o?o.stats:s.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),le(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,o)}const c=this.media;c&&(!this._hasEnoughToStart&&Ai.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=rt.ERROR;return}switch(n.details){case J.FRAG_GAP:case J.FRAG_PARSING_ERROR:case J.FRAG_DECRYPT_ERROR:case J.FRAG_LOAD_ERROR:case J.FRAG_LOAD_TIMEOUT:case J.KEY_LOAD_ERROR:case J.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.MAIN,n);break;case J.LEVEL_LOAD_ERROR:case J.LEVEL_LOAD_TIMEOUT:case J.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===rt.WAITING_LEVEL&&((s=n.context)==null?void 0:s.type)===Le.LEVEL&&(this.state=rt.IDLE);break;case J.BUFFER_ADD_CODEC_ERROR:case J.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.resetLoadingState();break;case J.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case J.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=rt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(t,{type:n}){if(n!==A.AUDIO||!this.altAudio){const s=(n===A.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=Ai.getBuffered(t),p=c.length?c.start(0):0,_=p-s,m=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||_>0&&(_<m||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 ${p}`),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=rt.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(w.FRAG_LOADED,s),l.bitrateTest=!1})}_handleTransmuxComplete(t){var n;const s=this.playlistType,{hls:o}=this,{remuxResult:l,chunkMeta:c}=t,p=this.getCurrentContext(c);if(!p){this.resetWhenMissingContext(c);return}const{frag:_,part:m,level:v}=p,{video:y,text:S,id3:C,initSegment:D}=l,{details:K}=v,B=this.altAudio?void 0:l.audio;if(this.fragContextChanged(_)){this.fragmentTracker.removeFragment(_);return}if(this.state=rt.PARSING,D){if(D!=null&&D.tracks){const he=_.initSegment||_;this._bufferInitSegment(v,D.tracks,he,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:he,id:s,tracks:D.tracks})}const ee=D.initPTS,_e=D.timescale;ue(ee)&&(this.initPTS[_.cc]={baseTime:ee,timescale:_e},o.trigger(w.INIT_PTS_FOUND,{frag:_,id:s,initPTS:ee,timescale:_e}))}if(y&&K){B&&y.type==="audiovideo"&&this.logMuxedErr(_);const ee=K.fragments[_.sn-1-K.startSN],_e=_.sn===K.startSN,he=!ee||_.cc>ee.cc;if(l.independent!==!1){const{startPTS:Ie,endPTS:Fe,startDTS:it,endDTS:Ke}=y;if(m)m.elementaryStreams[y.type]={startPTS:Ie,endPTS:Fe,startDTS:it,endDTS:Ke};else if(y.firstKeyFrame&&y.independent&&c.id===1&&!he&&(this.couldBacktrack=!0),y.dropped&&y.independent){const qe=this.getMainFwdBufferInfo(),nt=(qe?qe.end:this.getLoadPosition())+this.config.maxBufferHole,Ue=y.firstKeyFramePTS?y.firstKeyFramePTS:Ie;if(!_e&&nt<Ue-this.config.maxBufferHole&&!he){this.backtrack(_);return}else he&&(_.gap=!0);_.setElementaryStreamInfo(y.type,_.start,Fe,_.start,Ke,!0)}else _e&&Ie-(K.appliedTimelineOffset||0)>Vo&&(_.gap=!0);_.setElementaryStreamInfo(y.type,Ie,Fe,it,Ke),this.backtrackFragment&&(this.backtrackFragment=_),this.bufferFragmentData(y,_,m,c,_e||he)}else if(_e||he)_.gap=!0;else{this.backtrack(_);return}}if(B){const{startPTS:ee,endPTS:_e,startDTS:he,endDTS:Ie}=B;m&&(m.elementaryStreams[A.AUDIO]={startPTS:ee,endPTS:_e,startDTS:he,endDTS:Ie}),_.setElementaryStreamInfo(A.AUDIO,ee,_e,he,Ie),this.bufferFragmentData(B,_,m,c)}if(K&&C!=null&&(n=C.samples)!=null&&n.length){const ee={id:s,frag:_,details:K,samples:C.samples};o.trigger(w.FRAG_PARSING_METADATA,ee)}if(K&&S){const ee={id:s,frag:_,details:K,samples:S.samples};o.trigger(w.FRAG_PARSING_USERDATA,ee)}}logMuxedErr(t){this.warn(`${le(t)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${t.url}`)}_bufferInitSegment(t,n,s,o){if(this.state!==rt.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:p}=n;if(l){let m=ut(l.codec,t.audioCodec);m==="mp4a"&&(m="mp4a.40.5");const v=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){m&&(m.indexOf("mp4a.40.5")!==-1?m="mp4a.40.2":m="mp4a.40.5");const y=l.metadata;y&&"channelCount"in y&&(y.channelCount||1)!==1&&v.indexOf("firefox")===-1&&(m="mp4a.40.5")}m&&m.indexOf("mp4a.40.5")!==-1&&v.indexOf("android")!==-1&&l.container!=="audio/mpeg"&&(m="mp4a.40.2",this.log(`Android: force audio codec to ${m}`)),t.audioCodec&&t.audioCodec!==m&&this.log(`Swapping manifest audio codec "${t.audioCodec}" for "${m}"`),l.levelCodec=m,l.id=P.MAIN,this.log(`Init audio buffer, container:${l.container}, codecs[selected/level/parsed]=[${m||""}/${t.audioCodec||""}/${l.codec}]`),delete n.audiovideo}if(c){c.levelCodec=t.videoCodec,c.id=P.MAIN;const m=c.codec;if((m==null?void 0:m.length)===4)switch(m){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||""}/${m}]${c.codec!==m?" parsed-corrected="+c.codec:""}${c.supplemental?" supplemental="+c.supplemental:""}`),delete n.audiovideo}p&&(this.log(`Init audiovideo buffer, container:${p.container}, codecs[level/parsed]=[${t.codecs}/${p.codec}]`),delete n.video,delete n.audio);const _=Object.keys(n);if(_.length){if(this.hls.trigger(w.BUFFER_CODECS,n),!this.hls)return;_.forEach(m=>{const y=n[m].initSegment;y!=null&&y.byteLength&&this.hls.trigger(w.BUFFER_APPENDING,{type:m,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=rt.IDLE}checkFragmentChanged(){const t=this.media;let n=null;if(t&&t.readyState>1&&t.seeking===!1){const s=t.currentTime;if(Ai.isBuffered(t,s)?n=this.getAppendedFrag(s):Ai.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(w.FRAG_CHANGED,{frag:n}),(!o||o.level!==l)&&this.hls.trigger(w.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 ue(n)?this.getAppendedFrag(n):null}get currentProgramDateTime(){var t;const n=((t=this.media)==null?void 0:t.currentTime)||this.lastCurrentTime;if(ue(n)){const s=this.getLevelDetails(),o=this.currentFrag||(s?li(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 Rd{constructor(t){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const s in this.keyUriToKeyInfo){const o=this.keyUriToKeyInfo[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.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[t];(n.mediaKeySessionContext||n.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[t].loader;n&&n.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(t,n=J.KEY_LOAD_ERROR,s,o,l){return new Gn({type:me.NETWORK_ERROR,details:n,fatal:!1,frag:t,response:l,error:s,networkDetails:o})}loadClear(t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(n.length){const{sn:s,cc:o}=t;for(let l=0;l<n.length;l++){const c=n[l];if(o<=c.cc&&(s==="initSegment"||c.sn==="initSegment"||s<c.sn))return this.emeController.selectKeySystemFormat(c).then(p=>{if(c.setKeyFormat(p),this.emeController&&this.config.requireKeySystemAccessOnStart){const _=sr(p);if(_)return this.emeController.getKeySystemAccess([_])}})}}else if(this.config.requireKeySystemAccessOnStart){const s=ws(this.config);if(s.length)return this.emeController.getKeySystemAccess(s)}}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 m=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,J.KEY_LOAD_ERROR,m))}const c=l.uri;if(!c)return Promise.reject(this.createKeyLoadError(t,J.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${c}"`)));let p=this.keyUriToKeyInfo[c];if((s=p)!=null&&s.decryptdata.key)return l.key=p.decryptdata.key,Promise.resolve({frag:t,keyInfo:p});if((o=p)!=null&&o.keyLoadPromise){var _;switch((_=p.mediaKeySessionContext)==null?void 0:_.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return p.keyLoadPromise.then(m=>(l.key=m.keyInfo.decryptdata.key,{frag:t,keyInfo:p}))}}switch(p=this.keyUriToKeyInfo[c]={decryptdata:l,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},l.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return l.keyFormat==="identity"?this.loadKeyHTTP(p,t):this.loadKeyEME(p,t);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(p,t);default:return Promise.reject(this.createKeyLoadError(t,J.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);if(o)return(t.keyLoadPromise=o.then(l=>(t.mediaKeySessionContext=l,s))).catch(l=>{throw t.keyLoadPromise=null,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,p)=>{const _={keyInfo:t,frag:n,responseType:"arraybuffer",url:t.decryptdata.uri},m=s.keyLoadPolicy.default,v={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(S,C,D,K)=>{const{frag:B,keyInfo:ee,url:_e}=D;if(!B.decryptdata||ee!==this.keyUriToKeyInfo[_e])return p(this.createKeyLoadError(B,J.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),K));ee.decryptdata.key=B.decryptdata.key=new Uint8Array(S.data),B.keyLoader=null,ee.loader=null,c({frag:B,keyInfo:ee})},onError:(S,C,D,K)=>{this.resetLoader(C),p(this.createKeyLoadError(n,J.KEY_LOAD_ERROR,new Error(`HTTP Error ${S.code} loading key ${S.text}`),D,M({url:_.url,data:void 0},S)))},onTimeout:(S,C,D)=>{this.resetLoader(C),p(this.createKeyLoadError(n,J.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),D))},onAbort:(S,C,D)=>{this.resetLoader(C),p(this.createKeyLoadError(n,J.INTERNAL_ABORTED,new Error("key loading aborted"),D))}};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),delete this.keyUriToKeyInfo[o],l&&l.destroy()}}function xf(h){const{type:t}=h;switch(t){case Le.AUDIO_TRACK:return P.AUDIO;case Le.SUBTITLE_TRACK:return P.SUBTITLE;default:return P.MAIN}}function zc(h,t){let n=h.url;return(n===void 0||n.indexOf("data:")===0)&&(n=t.url),n}class Id{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(w.MANIFEST_LOADING,this.onManifestLoading,this),t.on(w.LEVEL_LOADING,this.onLevelLoading,this),t.on(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.on(w.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:t}=this;t.off(w.MANIFEST_LOADING,this.onManifestLoading,this),t.off(w.LEVEL_LOADING,this.onLevelLoading,this),t.off(w.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(w.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.off(w.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:Le.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(t,n){const{id:s,level:o,pathwayId:l,url:c,deliveryDirectives:p,levelInfo:_}=n;this.load({id:s,level:o,pathwayId:l,responseType:"text",type:Le.LEVEL,url:c,deliveryDirectives:p,levelOrTrack:_})}onAudioTrackLoading(t,n){const{id:s,groupId:o,url:l,deliveryDirectives:c,track:p}=n;this.load({id:s,groupId:o,level:null,responseType:"text",type:Le.AUDIO_TRACK,url:l,deliveryDirectives:c,levelOrTrack:p})}onSubtitleTrackLoading(t,n){const{id:s,groupId:o,url:l,deliveryDirectives:c,track:p}=n;this.load({id:s,groupId:o,level:null,responseType:"text",type:Le.SUBTITLE_TRACK,url:l,deliveryDirectives:c,levelOrTrack:p})}onLevelsUpdated(t,n){const s=this.loaders[Le.LEVEL];if(s){const o=s.context;o&&!n.levels.some(l=>l===o.levelOrTrack)&&(s.abort(),delete this.loaders[Le.LEVEL])}}load(t){var n;const s=this.hls.config;let o=this.getInternalLoader(t);if(o){const m=this.hls.logger,v=o.context;if(v&&v.levelOrTrack===t.levelOrTrack&&(v.url===t.url||v.deliveryDirectives&&!t.deliveryDirectives)){v.url===t.url?m.log(`[playlist-loader]: ignore ${t.url} ongoing request`):m.log(`[playlist-loader]: ignore ${t.url} in favor of ${v.url}`);return}m.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),o.abort()}let l;if(t.type===Le.MANIFEST?l=s.manifestLoadPolicy.default:l=k({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),o=this.createInternalLoader(t),ue((n=t.deliveryDirectives)==null?void 0:n.part)){let m;if(t.type===Le.LEVEL&&t.level!==null?m=this.hls.levels[t.level].details:t.type===Le.AUDIO_TRACK&&t.id!==null?m=this.hls.audioTracks[t.id].details:t.type===Le.SUBTITLE_TRACK&&t.id!==null&&(m=this.hls.subtitleTracks[t.id].details),m){const v=m.partTarget,y=m.targetduration;if(v&&y){const S=Math.max(v*3,y*.8)*1e3;l=k({},l,{maxTimeToFirstByteMs:Math.min(S,l.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(S,l.maxTimeToFirstByteMs)})}}}const c=l.errorRetry||l.timeoutRetry||{},p={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:c.maxNumRetry||0,retryDelay:c.retryDelayMs||0,maxRetryDelay:c.maxRetryDelayMs||0},_={onSuccess:(m,v,y,S)=>{const C=this.getInternalLoader(y);this.resetInternalLoader(y.type);const D=m.data;if(D.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(m,y,new Error("no EXTM3U delimiter"),S||null,v);return}v.parsing.start=performance.now(),qr.isMediaPlaylist(D)||y.type!==Le.MANIFEST?this.handleTrackOrLevelPlaylist(m,v,y,S||null,C):this.handleMasterPlaylist(m,v,y,S)},onError:(m,v,y,S)=>{this.handleNetworkError(v,y,!1,m,S)},onTimeout:(m,v,y)=>{this.handleNetworkError(v,y,!0,void 0,m)}};o.load(t,p,_)}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,p=zc(t,s),_=qr.parseMasterPlaylist(c,p);if(_.playlistParsingError){this.handleManifestParsingError(t,s,_.playlistParsingError,o,n);return}const{contentSteering:m,levels:v,sessionData:y,sessionKeys:S,startTimeOffset:C,variableList:D}=_;this.variableList=D;const{AUDIO:K=[],SUBTITLES:B,"CLOSED-CAPTIONS":ee}=qr.parseMasterPlaylistMedia(c,p,_);K.length&&!K.some(he=>!he.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"),K.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new xi({}),bitrate:0,url:""})),l.trigger(w.MANIFEST_LOADED,{levels:v,audioTracks:K,subtitles:B,captions:ee,contentSteering:m,url:p,stats:n,networkDetails:o,sessionData:y,sessionKeys:S,startTimeOffset:C,variableList:D})}handleTrackOrLevelPlaylist(t,n,s,o,l){const c=this.hls,{id:p,level:_,type:m}=s,v=zc(t,s),y=ue(_)?_:ue(p)?p:0,S=xf(s),C=qr.parseLevelPlaylist(t.data,v,y,S,0,this.variableList);if(m===Le.MANIFEST){const D={attrs:new xi({}),bitrate:0,details:C,name:"",url:v};C.requestScheduled=n.loading.start+tl(C,0),c.trigger(w.MANIFEST_LOADED,{levels:[D],audioTracks:[],url:v,stats:n,networkDetails:o,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),s.levelDetails=C,this.handlePlaylistLoaded(C,t,n,s,o,l)}handleManifestParsingError(t,n,s,o,l){this.hls.trigger(w.ERROR,{type:me.NETWORK_ERROR,details:J.MANIFEST_PARSING_ERROR,fatal:n.type===Le.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===Le.LEVEL?c+=`: ${t.level} id: ${t.id}`:(t.type===Le.AUDIO_TRACK||t.type===Le.SUBTITLE_TRACK)&&(c+=` id: ${t.id} group-id: "${t.groupId}"`);const p=new Error(c);this.hls.logger.warn(`[playlist-loader]: ${c}`);let _=J.UNKNOWN,m=!1;const v=this.getInternalLoader(t);switch(t.type){case Le.MANIFEST:_=s?J.MANIFEST_LOAD_TIMEOUT:J.MANIFEST_LOAD_ERROR,m=!0;break;case Le.LEVEL:_=s?J.LEVEL_LOAD_TIMEOUT:J.LEVEL_LOAD_ERROR,m=!1;break;case Le.AUDIO_TRACK:_=s?J.AUDIO_TRACK_LOAD_TIMEOUT:J.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case Le.SUBTITLE_TRACK:_=s?J.SUBTITLE_TRACK_LOAD_TIMEOUT:J.SUBTITLE_LOAD_ERROR,m=!1;break}v&&this.resetInternalLoader(t.type);const y={type:me.NETWORK_ERROR,details:_,fatal:m,url:t.url,loader:v,context:t,error:p,networkDetails:n,stats:l};if(o){const S=(n==null?void 0:n.url)||t.url;y.response=M({url:S,data:void 0},o)}this.hls.trigger(w.ERROR,y)}handlePlaylistLoaded(t,n,s,o,l,c){const p=this.hls,{type:_,level:m,id:v,groupId:y,deliveryDirectives:S}=o,C=zc(n,o),D=xf(o),K=typeof o.level=="number"&&D===P.MAIN?m:void 0;if(!t.fragments.length){const ee=t.playlistParsingError=new Error("No Segments found in Playlist");p.trigger(w.ERROR,{type:me.NETWORK_ERROR,details:J.LEVEL_EMPTY_ERROR,fatal:!1,url:C,error:ee,reason:ee.message,response:n,context:o,level:K,parent:D,networkDetails:l,stats:s});return}t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));const B=t.playlistParsingError;if(B){if(this.hls.logger.warn(B),!p.config.ignorePlaylistParsingErrors){p.trigger(w.ERROR,{type:me.NETWORK_ERROR,details:J.LEVEL_PARSING_ERROR,fatal:!1,url:C,error:B,reason:B.message,response:n,context:o,level:K,parent:D,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 Le.MANIFEST:case Le.LEVEL:p.trigger(w.LEVEL_LOADED,{details:t,levelInfo:o.levelOrTrack||p.levels[0],level:K||0,id:v||0,stats:s,networkDetails:l,deliveryDirectives:S,withoutMultiVariant:_===Le.MANIFEST});break;case Le.AUDIO_TRACK:p.trigger(w.AUDIO_TRACK_LOADED,{details:t,track:o.levelOrTrack,id:v||0,groupId:y||"",stats:s,networkDetails:l,deliveryDirectives:S});break;case Le.SUBTITLE_TRACK:p.trigger(w.SUBTITLE_TRACK_LOADED,{details:t,track:o.levelOrTrack,id:v||0,groupId:y||"",stats:s,networkDetails:l,deliveryDirectives:S});break}}}class xa{static get version(){return Hs}static isMSESupported(){return vf()}static isSupported(){return yf()}static getMediaSource(){return ke()}static get Events(){return w}static get MetadataSchema(){return vr}static get ErrorTypes(){return me}static get ErrorDetails(){return J}static get DefaultConfig(){return xa.defaultConfig?xa.defaultConfig:Td}static set DefaultConfig(t){xa.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 Gs,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=Ae(t.debug||!1,"Hls instance",t.assetPlayerId),s=this.config=zo(xa.DefaultConfig,t,n);this.userConfig=t,s.progressive&&Rl(s,n);const{abrController:o,bufferController:l,capLevelController:c,errorController:p,fpsController:_}=s,m=new p(this),v=this.abrController=new o(this),y=new yn(this),S=s.interstitialsController,C=S?this.interstitialsController=new S(this,xa):null,D=this.bufferController=new l(this,y),K=this.capLevelController=new c(this),B=new _(this),ee=new Id(this),_e=s.contentSteeringController,he=_e?new _e(this):null,Ie=this.levelController=new Kc(this,he),Fe=new Pl(this),it=new Rd(this.config),Ke=this.streamController=new Md(this,y,it),qe=this.gapController=new Il(this,y);K.setStreamController(Ke),B.setStreamController(Ke);const nt=[ee,Ie,Ke];C&&nt.splice(1,0,C),he&&nt.splice(1,0,he),this.networkControllers=nt;const Ue=[v,D,qe,K,B,Fe,y];this.audioTrackController=this.createController(s.audioTrackController,nt);const Lt=s.audioStreamController;Lt&&nt.push(this.audioStreamController=new Lt(this,y,it)),this.subtitleTrackController=this.createController(s.subtitleTrackController,nt);const ii=s.subtitleStreamController;ii&&nt.push(this.subtititleStreamController=new ii(this,y,it)),this.createController(s.timelineController,Ue),it.emeController=this.emeController=this.createController(s.emeController,Ue),this.cmcdController=this.createController(s.cmcdController,Ue),this.latencyController=this.createController(Ol,Ue),this.coreComponents=Ue,nt.push(m);const Ri=m.onErrorOut;typeof Ri=="function"&&this.on(w.ERROR,Ri,m),this.on(w.MANIFEST_LOADED,ee.onManifestLoaded,ee)}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===w.ERROR;this.trigger(w.ERROR,{type:me.OTHER_ERROR,details:J.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(w.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(w.ERROR,{type:me.OTHER_ERROR,details:J.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(w.MEDIA_ATTACHING,o)}detachMedia(){this.logger.log("detachMedia"),this.trigger(w.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const t=this.bufferController.transferMedia();return this.trigger(w.MEDIA_DETACHING,{transferMedia:t}),t}loadSource(t){this.stopLoad();const n=this.media,s=this._url,o=this._url=ie.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(w.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=fd()),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){Wi(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=Dr(n);return Ii(t,s,navigator.mediaCapabilities)}}xa.defaultConfig=void 0},48136:function(Ci,Ft,re){"use strict";var ue=Object.defineProperty,we=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,me=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,Le=(e,i,r)=>i in e?ue(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,P=(e,i)=>{for(var r in i||(i={}))J.call(i,r)&&Le(e,r,i[r]);if(me)for(var r of me(i))w.call(i,r)&&Le(e,r,i[r]);return e},f=(e,i)=>we(e,Ye(i)),ne=e=>typeof e=="symbol"?e:e+"",I=(e,i)=>{var r={};for(var a in e)J.call(e,a)&&i.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&me)for(var a of me(e))i.indexOf(a)<0&&w.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 M(){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 X(){return typeof navigator.vibrate=="function"}function G(){var e,i;if(!M())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 j(){if(!M())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 $(){return HTMLElement.prototype.hasOwnProperty("popover")}var N={strings:T,_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return N._locale||(N._locale=M()?navigator.language.slice(0,5):"en-US"),N._locale},set locale(e){N._locale=e,N._numberFormatter=void 0,N.dirty=!0},get numberFormatter(){return N._numberFormatter||(N._numberFormatter=new Intl.NumberFormat(N.locale)),N._numberFormatter},merge(e,i){if(typeof e=="string"&&i)N.strings[e]=P(P({},N.strings[e]),i),N.dirty=!0;else for(const r of Object.keys(e))N.merge(r,e[r])},get dirty(){return N._dirty},set dirty(e){N._dirty||N._dirty===e||(N._dirty=!0,setTimeout(()=>{N._dirty=!1,this._subscribers.forEach(i=>i==null?void 0:i())},0))},subscribe(e){return N._subscribers.push(e),N._subscribers.length-1},unsubscribe(e){e<0||e>=N._subscribers.length||(N._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=N.locale;N.strings[a]&&(r=N.strings[a][e]);const u=a.slice(0,2);if(!r&&N.strings[u]&&(r=N.strings[u][e]),r||(r=N.strings.en[e]),!r)return;const d=/(%@|%([0-9]+)\$@)/g;let g=d.exec(r),b=0;for(;g;){if(i[b++]){const E=g[2]?parseInt(g[2],10)-1:b-1;let R=i[E];typeof R=="number"&&(R=N.numberFormatter.format(R)),r=r.replace(g[1],R)}g=d.exec(r)}return r=r.replace(/%%/g,"%"),r}var fe={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"},Ae={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"},ke={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 ze(e){var i,r,a,u,d,g;const b=e.split("!");let x,E,R,F=255,Y=255,oe=255,ge=-1;const He=b.length>0&&b[0].startsWith("-");He&&(b[0]=b[0].slice(1));for(let Ot=0;Ot<b.length;Ot++){x=F,E=Y,R=oe;const Ve=(i=b[Ot].trim().match(/^([A-Za-z\d-]+)/))==null?void 0:i[1],wt=Ve==null?void 0:Ve.toLowerCase(),$t=Ve&&(g=(d=(u=(a=(r=se[wt])!=null?r:se[ke[Ve]])!=null?a:be[Ve])!=null?u:We[Ve])!=null?d:fe[Ve])!=null?g:b[Ot].trim();let At=$t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(At!=null&&At[1]&&At[2]&&At[3])F=Math.max(0,Math.min(255,Number.parseInt(At[1],16))),Y=Math.max(0,Math.min(255,Number.parseInt(At[2],16))),oe=Math.max(0,Math.min(255,Number.parseInt(At[3],16)));else if(At=$t.match(/^#([\da-f]{3})$/i),At!=null&&At[1]){const si=Number.parseInt(At[1][0],16),_i=Number.parseInt(At[1][1],16),ci=Number.parseInt(At[1][2],16);F=Math.max(0,Math.min(255,si*16+si)),Y=Math.max(0,Math.min(255,_i*16+_i)),oe=Math.max(0,Math.min(255,ci*16+ci))}else if(At=$t.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),At!=null&&At[1]&&At[2]&&At[3])F=Math.max(0,Math.min(255,Number.parseInt(At[1]))),Y=Math.max(0,Math.min(255,Number.parseInt(At[2]))),oe=Math.max(0,Math.min(255,Number.parseInt(At[3])));else return;ge>=0&&(F=(1-ge)*F+ge*x,Y=(1-ge)*Y+ge*E,oe=(1-ge)*oe+ge*R,ge=-1),Ot+1<b.length&&(ge=Math.max(0,Math.min(100,Number.parseInt(b[++Ot])))/100)}return ge>=0&&(F=ge*F+(1-ge)*x,Y=ge*Y+(1-ge)*E,oe=ge*oe+(1-ge)*R),He&&(F=255-F,Y=255-Y,oe=255-oe),"#"+("00"+Math.round(F).toString(16)).slice(-2)+("00"+Math.round(Y).toString(16)).slice(-2)+("00"+Math.round(oe).toString(16)).slice(-2)}function Rt(e){var i,r;return e=e.trim(),(r=(i=Ae[e.toLowerCase()])!=null?i:Ae[ke[e]])!=null?r:ze(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 q(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,d=a*2-u;return{r:Math.round(255*z(d,u,i+2)),g:Math.round(255*z(d,u,i)),b:Math.round(255*z(d,u,i-2))}}function Q(e){return e<0?0:e>255?255:Math.round(e)}function de(e){const{r:i,g:r,b:a}=e;let u=((1<<24)+(Q(i)<<16)+(Q(r)<<8)+Q(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 ie(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),d=Math.max(i,r,a),g=d-u;let b,x;d===u?b=0:i===d?b=(r-a)/g:r===d?b=2+(a-i)/g:a===d&&(b=4+(i-r)/g),b=Math.min(b*60,360),b<0&&(b+=360);const E=(u+d)/2;return d===u?x=0:E<=.5?x=g/(d+u):x=g/(2-d-u),{h:b,s:x,l:E}}function L(e){let i=te(e);if(!i)return e;let{h:r,s:a,l:u}=ie(i);return a+=.1,u-=.1,de(q({h:r,s:a,l:u}))}var A={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"},W={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},le=[{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 et(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 le)if((!i||u.variant===i)&&(!r||u.style===r)&&a>=u.offset&&a<u.offset+u.len){const d=u.start+a-u.offset;return String.fromCodePoint(W[d]||d)}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 W)if(W[r]===e){e=(i=r.codePointAt(0))!=null?i:0;break}for(const r of le)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 Kt(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 d=A[u];if(d)d.startsWith("\\")?r+=d+" ":r+=d;else{const{char:g,variant:b,style:x}=pt(u);switch(d=g,b){case"double-struck":d=`\\mathbb{${d}}`;break;case"fraktur":d=`\\mathfrak{${d}}`;break;case"script":d=`\\mathscr{${d}}`;break;case"sans-serif":d=`\\mathsf{${d}}`;break;case"monospace":d=`\\mathtt{${d}}`;break;case"calligraphic":d=`\\mathcal{${d}}`;break}switch(x){case"bold":d=`\\mathbf{${d}}`;break;case"italic":d=`\\mathit{${d}}`;break;case"bolditalic":d=`\\mathbfit{${d}}`;break}r+=d}}return r}function Pe(e){return e?Array.isArray(e)?e:typeof e=="object"&&"group"in e?e.group:[]:[]}var Zt={},It=P({},A),bt={},Oe={},mt={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}"},$e={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}},jt={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:jt},"amsmath.sty":{package:$e,primitive:!0},"texvc.sty":{package:mt,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},Ne=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/,pe,Je;j()?(pe=new RegExp("\\p{Letter}","u"),Je=new RegExp("[0-9\\p{Letter}]","u")):(pe=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,Je=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/);function ot(e,i,r="mord",a){i!==void 0&&(Zt[e]={definitionType:"symbol",type:r,variant:a,codepoint:i},It[i]||(It[i]=e))}function Qe(e,i,r){if(typeof e=="string"){for(let a=0;a<e.length;a++){const u=e.charAt(a);ot(u,u.codePointAt(0))}return}for(const[a,u,d,g]of e)ot(a,u,d!=null?d:i,g!=null?g:r)}function Z(e,i){for(let r=e;r<=i;r++)ot(String.fromCodePoint(r),r)}function ve(e){var i;return(i=Oe[e])!=null?i:null}function Be(e,i){var r,a;if(i.length===0||i==="\\"||!i.startsWith("\\"))return[];const u=[];for(const g in bt)g.startsWith(i)&&!bt[g].infix&&u.push({match:g,frequency:(r=bt[g].frequency)!=null?r:0});for(const g in Zt)g.startsWith(i)&&u.push({match:g,frequency:(a=Zt[g].frequency)!=null?a:0});const d=i.substring(1);for(const g of Object.keys(e.options.macros))g.startsWith(d)&&u.push({match:"\\"+g,frequency:0});return u.sort((g,b)=>{var x,E;return g.frequency===b.frequency?g.match.length===b.match.length?g.match<b.match?-1:1:g.match.length-b.match.length:((x=b.frequency)!=null?x:0)-((E=g.frequency)!=null?E:0)}),u.map(g=>g.match)}function Ze(e){let i="auto";const r=e.match(/:([^=]+)/);return r&&(i=r[1].trim()),i}function lt(e){if(!e)return[];const i=[];let r=e.split("]");if(r[0].startsWith("[")){i.push({isOptional:!0,type:Ze(r[0].slice(1))});for(let a=1;a<=r.length;a++)i.push(...lt(r[a]))}else if(r=e.split("}"),r[0].startsWith("{")){i.push({isOptional:!1,type:Ze(r[0].slice(1))});for(let a=1;a<=r.length;a++)i.push(...lt(r[a]))}return i}function yt(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 Yt(e,i){typeof e=="string"&&(e=[e]);const r={tabular:!1,params:[],createAtom:i};for(const a of e)Oe[a]=r}function gt(e,i,r){typeof e=="string"&&(e=[e]);const u={tabular:!0,params:lt(i),createAtom:r};for(const d of e)Oe[d]=u}function Se(e,i,r){var a,u;r||(r={});const d={definitionType:"function",params:lt(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")bt["\\"+e]=d;else for(const g of e)bt["\\"+g]=d}var kt;function Nt(e){return kt||(kt=Te(ei)),e?Te(P(P({},kt),e)):kt}function qt(e,i){var r,a,u,d;if(typeof e=="string"){let g=0;const b=e;return/(^|[^\\])#1/.test(b)&&(g=1),/(^|[^\\])#2/.test(b)&&(g=2),/(^|[^\\])#3/.test(b)&&(g=3),/(^|[^\\])#4/.test(b)&&(g=4),/(^|[^\\])#5/.test(b)&&(g=5),/(^|[^\\])#6/.test(b)&&(g=6),/(^|[^\\])#7/.test(b)&&(g=7),/(^|[^\\])#8/.test(b)&&(g=8),/(^|[^\\])#9/.test(b)&&(g=9),{expand:(r=i==null?void 0:i.expand)!=null?r:!0,captureSelection:(a=i==null?void 0:i.captureSelection)!=null?a:!0,args:g,def:b}}return P({expand:(u=i==null?void 0:i.expand)!=null?u:!0,captureSelection:(d=i==null?void 0:i.captureSelection)!=null?d:!0,args:0},e)}function Te(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]=qt(a.package[u],{expand:!a.primitive,captureSelection:a.captureSelection});else i[r]=qt(a)}return i}function Re(e,i="math"){if(!e||e.length===0)return null;let r=null;if(e.startsWith("\\")){if(r=bt[e],r)return!r.ifMode||r.ifMode===i?r:null;i==="math"?r=Zt[e]:Ce[e]&&(r={definitionType:"symbol",type:"mord",codepoint:Ce[e]})}else if(i==="math"){if(r=Zt[e],!r&&e.length===1){const a=vt("math",e.codePointAt(0));return a.startsWith("\\")?f(P({},Re(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 st(e,i){if(!e.startsWith("\\"))return null;const r=e.slice(1);return i[r]}function vt(e,i){if(i===void 0)return"";if(e==="math"&&It[i])return It[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],Dt=[0,.68889,0,0,.66667],Ct=[0,.68889,0,0,.77778],Et=[0,.68889,0,0,.61111],Ut=[.16667,.68889,0,0,.77778],Xt=[0,.68889,0,0,.55556],Xe=[0,0,0,0,.25],Vt=[0,.825,0,0,2.33334],De=[0,.9,0,0,2.33334],xe=[0,.68889,0,0,.54028],Ee=[-.03598,.46402,0,0,.5],U=[-.13313,.36687,0,0,1],H=[.01354,.52239,0,0,1],ae=[.01354,.52239,0,0,1.11111],ce=[0,.54986,0,0,1],ye=[0,.69224,0,0,.5],ct=[0,.43056,0,0,1],_t=[.08198,.58198,0,0,.77778],ut=[.19444,.69224,0,0,.41667],Gt=[.1808,.675,0,0,1],ni=[.19444,.69224,0,0,.83334],di=[.13667,.63667,0,0,1],ti=[-.064,.437,0,0,1.334],Tt=[.08167,.58167,0,0,.77778],ai=[0,.69224,0,0,.72222],Di=[0,.69224,0,0,.66667],Ti=[-.13313,.36687,0,0,.77778],Ii=[.06062,.54986,0,0,.77778],mi=[0,.69224,0,0,.77778],ui=[.25583,.75583,0,0,.77778],Wi=[.25142,.75726,0,0,.77778],Ui=[.20576,.70576,0,0,.77778],on=[.30274,.79383,0,0,.77778],qi=[.22958,.72958,0,0,.77778],lr=[.1808,.675,0,0,.77778],Li=[.13667,.63667,0,0,.77778],Ni=[.13597,.63597,0,0,.77778],dn=[.03517,.54986,0,0,.77778],Fi=[0,.675,0,0,.77778],vn=[.19444,.69224,0,0,.61111],an=[0,.54986,0,0,.76042],Vi=[0,.54986,0,0,.66667],hn=[.0391,.5391,0,0,.77778],kn=[.03517,.54986,0,0,1.33334],Dr=[.38569,.88569,0,0,.77778],ki=[.23222,.74111,0,0,.77778],oi=[.19444,.69224,0,0,.77778],Me=[0,.37788,0,0,.5],tt=[0,.54986,0,0,.72222],xt=[0,.69224,0,0,.83334],ht=[.11111,.69224,0,0,.66667],St=[.26167,.75726,0,0,.77778],at=[.48256,.98256,0,0,.77778],ft=[.28481,.79383,0,0,.77778],Pt=[.08167,.58167,0,0,.22222],Jt=[.08167,.58167,0,0,.38889],hi=[0,.43056,.04028,0,.66667],Xi=[.41951,.91951,0,0,.77778],li=[.24982,.74947,0,0,.38865],$i=[.08319,.58283,0,0,.75623],Pi=[0,.10803,0,0,.27764],ji=[0,.47534,0,0,.50181],Gi=[.18906,.47534,0,0,.50181],vi=[0,.69141,0,0,.50181],Oi=[.24982,.74947,0,0,.27764],nn=[0,.69141,0,0,.21471],Ki=[.25,.75,0,0,.44722],wi=[0,.64444,0,0,.575],rn=[.08556,.58556,0,0,.89444],Si=[0,.69444,0,0,.89444],Hi=[0,.68611,0,0,.9],Bn=[0,.68611,0,0,.86944],Ji=[.25,.75,0,0,.575],Yi=[.25,.75,0,0,.31944],yn=[0,.69444,0,0,.63889],bn=[0,.69444,0,0,.31944],Nn=[0,.44444,0,0,.63889],Mn=[0,.44444,0,0,.51111],Qi=[0,.69444,0,0,.575],Ln=[.13333,.63333,0,0,.89444],$n=[0,.44444,0,0,.31944],xr=[0,.69444,0,0,.86944],xn=[0,.68611,0,0,.69166],An=[0,.68611,0,0,.83055],fr=[0,.68611,0,0,.89444],Er=[0,.69444,0,0,.60278],ur=[.19444,.69444,0,0,.51111],Ir=[0,.69444,0,0,.83055],wn=[-.10889,.39111,0,0,1.14999],Xn=[.19444,.69444,0,0,.575],Cr=[.19444,.69444,0,0,1.14999],Gn=[.19444,.69444,0,0,.70277],pr=[.05556,.75,0,0,.575],Rn=[0,.68611,0,0,.95833],Jn=[.08556,.58556,0,0,.76666],mr=[-.02639,.47361,0,0,.575],Ai=[0,.44444,0,0,.89444],Tn=[0,.55556,0,0,.76666],cr=[-.10889,.39111,0,0,.89444],gr=[.00222,.50222,0,0,.89444],hr=[.19667,.69667,0,0,.89444],Jr=[.08556,.58556,0,0,1.14999],en=[0,.69444,0,0,.70277],bi=[-.02778,.47222,0,0,.575],xi=[.25,.75,0,0,.51111],Sn=[-.13889,.36111,0,0,1.14999],_r=[.19444,.69444,0,0,1.02222],Wn=[.12963,.69444,0,0,.89444],tr=[.19444,.69444,0,0,.44722],Kn=[0,.64444,.13167,0,.59111],us=[.19444,.64444,.13167,0,.59111],ir=[0,.68611,.17208,0,.8961],Qr=[.19444,.44444,.105,0,.53222],Wr=[0,.44444,.085,0,.82666],Kr=[0,.69444,.06709,0,.59111],nr=[0,.69444,.12945,0,.35555],jr=[0,.69444,0,0,.94888],ms=[0,.69444,.11472,0,.59111],rr=[0,.68611,.10778,0,.88555],Mi=[0,.69444,.07939,0,.62055],pn=[0,.69444,.12417,0,.30667],sr=[0,.64444,.13556,0,.51111],es=[.19444,.64444,.13556,0,.51111],cs=[0,.68333,.16389,0,.74333],xs=[.19444,.43056,.08847,0,.46],ws=[0,.43056,.07514,0,.71555],Ms=[0,.69444,.06646,0,.51111],fi=[0,.69444,0,0,.83129],Bi=[0,.69444,.1225,0,.51111],Dn=[0,.68333,.09403,0,.76666],Un=[0,.68333,.11111,0,.76666],In=[0,.69444,.06961,0,.51444],kr=[0,.69444,0,0,.27778],gs=[.25,.75,0,0,.38889],ar=[0,.64444,0,0,.5],ts=[0,.69444,0,0,.77778],na=[0,.68333,0,0,.75],Ks=[0,.68333,0,0,.77778],Xl=[0,.68333,0,0,.68056],qr=[0,.68333,0,0,.72222],Ss=[.25,.75,0,0,.5],Wa=[.25,.75,0,0,.27778],Qn=[0,.69444,0,0,.5],ra=[0,.69444,0,0,.55556],ka=[0,.43056,0,0,.44445],hs=[0,.43056,0,0,.5],Xo=[.19444,.43056,0,0,.55556],ja=[0,.43056,0,0,.55556],is=[.08333,.58333,0,0,.77778],Eo=[0,.43056,0,0,.27778],Es=[0,.66786,0,0,.27778],ko=[0,.69444,0,0,.75],Ao=[0,.66786,0,0,.5],Jo=[0,.68333,0,0,.625],Qo=[.19444,.69444,0,0,.44445],qa=[0,.69444,0,0,.72222],el=[.19444,.69444,0,0,.5],Rs=[.19444,.69444,0,0,1],Za=[.011,.511,0,0,1.126],To=[.19444,.69444,0,0,.61111],Ya=[.05556,.75,0,0,.5],tl=[0,.68333,0,0,.83334],Lo=[.0391,.5391,0,0,.66667],sa=[-.05555,.44445,0,0,.5],il=[0,.43056,0,0,.77778],Us=[0,.55556,0,0,.66667],zs=[-.03625,.46375,0,0,.77778],nl=[-.01688,.48312,0,0,.77778],rl=[.0391,.5391,0,0,1],Is=[0,.69444,0,0,.61111],Do=[-.03472,.46528,0,0,.5],Xa=[.25,.75,0,0,.44445],Ja=[-.14236,.35764,0,0,1],jn=[.244,.744,0,0,.412],rt=[.19444,.69444,0,0,.88889],Pn=[.12963,.69444,0,0,.77778],Ur=[.19444,.69444,0,0,.38889],zr=[.011,.511,0,0,1.638],Qa=[.19444,.69444,0,0,0],Vs=[0,.44444,0,0,.575],Aa=[.19444,.44444,0,0,.575],sl=[0,.68611,0,0,.75555],al=[0,.69444,0,0,.66759],Gs=[0,.68611,0,0,.80555],Hs=[0,.68611,.08229,0,.98229],aa=[0,.68611,0,0,.76666],ah=[0,.44444,0,0,.58472],oh=[.19444,.44444,0,0,.6118],ol=[.19444,.43056,0,0,.5],lh=[0,.68333,.02778,.08334,.76278],Gu=[0,.68333,.08125,.05556,.83125],Jl=[0,.43056,0,.05556,.48472],ll=[.19444,.43056,0,.08334,.51702],Co=[.25,.75,0,0,.42778],Vr=[0,.69444,0,0,.55],Ws=[0,.69444,0,0,.73334],oa=[0,.69444,0,0,.79445],Ql=[0,.69444,0,0,.51945],Hu=[0,.69444,0,0,.70278],ul=[0,.69444,0,0,.76389],uh=[.25,.75,0,0,.34306],Wu=[0,.69444,0,0,.56111],ju=[0,.69444,0,0,.25556],qu=[.19444,.45833,0,0,.56111],ch=[0,.45833,0,0,.56111],cl=[0,.69444,0,0,.30556],hh=[0,.69444,0,0,.58056],fh=[0,.69444,0,0,.67223],hl=[0,.69444,0,0,.85556],Zu=[0,.69444,0,0,.55834],js=[0,.65556,.11156,0,.5],Yu=[0,.69444,.08094,0,.70834],Xu=[.17014,0,0,0,.44445],dh=[0,.69444,.0799,0,.5],ph=[0,.69444,0,0,.73752],mh=[0,.69444,.09205,0,.5],gh=[0,.69444,.09031,0,.77778],Ju=[0,.69444,.07816,0,.27778],fl=[0,.69444,.00316,0,.5],_h=[.19444,.69444,0,0,.83334],Qu=[.05556,.75,0,0,.83334],ec=[0,.75,0,0,.5],vh=[.125,.08333,0,0,.27778],eu=[0,.08333,0,0,.27778],vr=[0,.65556,0,0,.5],ks=[0,.69444,0,0,.47222],Ps=[0,.69444,0,0,.66667],yh=[0,.69444,0,0,.59722],Mo=[0,.69444,0,0,.54167],tc=[0,.69444,0,0,.70834],bh=[.25,.75,0,0,.28889],ic=[0,.69444,0,0,.51667],xh=[0,.44444,0,0,.44445],nc=[.19444,.44444,0,0,.51667],rc=[0,.44444,0,0,.38333],tu=[0,.44444,0,0,.51667],sc=[0,.69444,0,0,.83334],wh=[.35001,.85,0,0,.45834],ac=[.35001,.85,0,0,.57778],Sh=[.35001,.85,0,0,.41667],oc=[.35001,.85,0,0,.58334],iu=[0,.72222,0,0,.55556],lc=[1e-5,.6,0,0,.66667],Eh=[1e-5,.6,0,0,.77778],kh=[.25001,.75,0,0,.94445],Ah=[.306,.805,.19445,0,.47222],uc=[.30612,.805,.19445,0,.47222],Ro=[.25001,.75,0,0,.83334],eo=[.35001,.85,0,0,.47222],to=[.25001,.75,0,0,1.11111],cc=[.65002,1.15,0,0,.59722],hc=[.65002,1.15,0,0,.81111],Mr=[.65002,1.15,0,0,.47222],la=[.65002,1.15,0,0,.66667],Io=[0,.75,0,0,1],Th=[.55001,1.05,0,0,1.27778],Lh=[.862,1.36,.44445,0,.55556],nu=[.86225,1.36,.44445,0,.55556],Ta=[.55001,1.05,0,0,1.11111],ua=[.65002,1.15,0,0,.52778],Dh=[.65002,1.15,0,0,.61111],qs=[.55001,1.05,0,0,1.51112],Ge=[.95003,1.45,0,0,.73611],fc=[.95003,1.45,0,0,1.04445],ru=[.95003,1.45,0,0,.52778],su=[.95003,1.45,0,0,.75],La=[0,.75,0,0,1.44445],au=[.95003,1.45,0,0,.58334],Ch=[1.25003,1.75,0,0,.79167],Mh=[1.25003,1.75,0,0,1.27778],Rh=[1.25003,1.75,0,0,.58334],ou=[1.25003,1.75,0,0,.80556],ca=[0,.825,0,0,1.8889],Po=[1.25003,1.75,0,0,.63889],dl=[.64502,1.155,0,0,.875],pl=[1e-5,.6,0,0,.875],fs=[-99e-5,.601,0,0,.66667],lu=[.64502,1.155,0,0,.66667],dc=[1e-5,.9,0,0,.88889],pc=[.65002,1.15,0,0,.88889],Ih=[.90001,0,0,0,.88889],ml=[-.00499,.605,0,0,1.05556],uu=[0,.12,0,0,.45],ri=[0,.61111,0,0,.525],Rr=[.08333,.69444,0,0,.525],gl=[-.08056,.53055,0,0,.525],mc=[-.05556,.55556,0,0,.525],ns=[0,.43056,0,0,.525],io=[.22222,.43056,0,0,.525],Oo=[0,0,0,0,.525],Jf={"AMS-Regular":{32:Xe,65:je,66:Dt,67:je,68:je,69:Dt,70:Et,71:Ct,72:Ct,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:Ct,76:Dt,77:[0,.68889,0,0,.94445],78:je,79:Ut,80:Et,81:Ut,82:je,83:Xt,84:Dt,85:je,86:je,87:[0,.68889,0,0,1],88:je,89:je,90:Dt,107:Xt,160:Xe,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:Xt,295:xe,710:Vt,732:De,770:Vt,771:De,989:Tt,1008:hi,8245:[0,.54986,0,0,.275],8463:xe,8487:je,8498:Xt,8502:Dt,8503:[0,.68889,0,0,.44445],8504:Dt,8513:[0,.68889,0,0,.63889],8592:Ee,8594:Ee,8602:U,8603:U,8606:H,8608:H,8610:ae,8611:ae,8619:ce,8620:ce,8621:[-.13313,.37788,0,0,1.38889],8622:U,8624:ye,8625:ye,8630:ct,8631:ct,8634:_t,8635:_t,8638:ut,8639:ut,8642:ut,8643:ut,8644:Gt,8646:Gt,8647:Gt,8648:ni,8649:Gt,8650:ni,8651:H,8652:H,8653:U,8654:U,8655:U,8666:di,8667:di,8669:[-.13313,.37788,0,0,1],8672:ti,8674:ti,8705:[0,.825,0,0,.5],8708:Xt,8709:Tt,8717:[0,.43056,0,0,.42917],8722:Ee,8724:[.08198,.69224,0,0,.77778],8726:Tt,8733:mi,8736:ai,8737:ai,8738:[.03517,.52239,0,0,.72222],8739:Pt,8740:[.25142,.74111,0,0,.27778],8741:Jt,8742:[.25142,.74111,0,0,.5],8756:Di,8757:Di,8764:Ti,8765:[-.13313,.37788,0,0,.77778],8769:Ti,8770:zs,8774:on,8776:nl,8778:Tt,8782:Ii,8783:Ii,8785:_t,8786:_t,8787:_t,8790:mi,8791:qi,8796:[.08198,.91667,0,0,.77778],8806:ui,8807:ui,8808:Wi,8809:Wi,8812:[.25583,.75583,0,0,.5],8814:Ui,8815:Ui,8816:on,8817:on,8818:qi,8819:qi,8822:lr,8823:lr,8828:Li,8829:Li,8830:qi,8831:qi,8832:Ui,8833:Ui,8840:on,8841:on,8842:Ni,8843:Ni,8847:dn,8848:dn,8858:_t,8859:_t,8861:_t,8862:Fi,8863:Fi,8864:Fi,8865:Fi,8872:[0,.69224,0,0,.61111],8873:ai,8874:[0,.69224,0,0,.88889],8876:Et,8877:Et,8878:je,8879:je,8882:dn,8883:dn,8884:Li,8885:Li,8888:[0,.54986,0,0,1.11111],8890:Xo,8891:vn,8892:vn,8901:[0,.54986,0,0,.27778],8903:Tt,8905:Tt,8906:Tt,8907:mi,8908:mi,8909:[-.03598,.46402,0,0,.77778],8910:an,8911:an,8912:dn,8913:dn,8914:Vi,8915:Vi,8916:Di,8918:hn,8919:hn,8920:kn,8921:kn,8922:Dr,8923:Dr,8926:Li,8927:Li,8928:on,8929:on,8934:ki,8935:ki,8936:ki,8937:ki,8938:Ui,8939:Ui,8940:on,8941:on,8994:oi,8995:oi,9416:[.15559,.69224,0,0,.90222],9484:ye,9488:ye,9492:Me,9496:Me,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:Fi,9633:Fi,9650:tt,9651:tt,9654:dn,9660:tt,9661:tt,9664:dn,9674:ht,9733:[.19444,.69224,0,0,.94445],10003:xt,10016:xt,10731:ht,10846:[.19444,.75583,0,0,.61111],10877:Li,10878:Li,10885:ui,10886:ui,10887:Ni,10888:Ni,10889:St,10890:St,10891:at,10892:at,10901:Li,10902:Li,10933:Wi,10934:Wi,10935:St,10936:St,10937:St,10938:St,10949:ui,10950:ui,10955:ft,10956:ft,57350:Pt,57351:Jt,57352:Tt,57353:hi,57356:Wi,57357:Wi,57358:Xi,57359:on,57360:on,57361:Xi,57366:Wi,57367:Wi,57368:Wi,57369:Wi,57370:Ni,57371:Ni},"Caligraphic-Regular":{32:Xe,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:Xe},"Fraktur-Regular":{32:Xe,33:[0,.69141,0,0,.29574],34:nn,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:li,41:li,42:[0,.62119,0,0,.27764],43:$i,44:Pi,45:$i,46:Pi,47:[.24982,.74947,0,0,.50181],48:ji,49:ji,50:ji,51:Gi,52:Gi,53:Gi,54:vi,55:Gi,56:vi,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:Oi,93:Oi,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:Xe,8216:nn,8217:nn,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:Xe,33:[0,.69444,0,0,.35],34:Er,35:[.19444,.69444,0,0,.95833],36:pr,37:[.05556,.75,0,0,.95833],38:Si,39:bn,40:Ki,41:Ki,42:[0,.75,0,0,.575],43:Ln,44:[.19444,.15556,0,0,.31944],45:rc,46:[0,.15556,0,0,.31944],47:Ji,48:wi,49:wi,50:wi,51:wi,52:wi,53:wi,54:wi,55:wi,56:wi,57:wi,58:$n,59:[.19444,.44444,0,0,.31944],60:rn,61:cr,62:rn,63:[0,.69444,0,0,.54305],64:Si,65:Bn,66:[0,.68611,0,0,.81805],67:An,68:[0,.68611,0,0,.88194],69:sl,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:Hi,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:xn,77:[0,.68611,0,0,1.09166],78:Hi,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:Bn,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:Yi,92:Ji,93:Yi,94:Qi,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:yn,99:Mn,100:yn,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:yn,105:bn,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:bn,109:[0,.44444,0,0,.95833],110:Nn,111:Vs,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:Nn,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:Mn,123:Ji,124:Yi,125:Ji,126:[.35,.34444,0,0,.575],160:Xe,163:[0,.69444,0,0,.86853],168:Qi,172:[0,.44444,0,0,.76666],176:xr,177:Ln,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:Ln,216:[.04861,.73472,0,0,.89444],223:yh,230:[0,.44444,0,0,.83055],247:Ln,248:[.09722,.54167,0,0,.575],305:$n,338:[0,.68611,0,0,1.16944],339:Ai,567:[.19444,.44444,0,0,.35139],710:Qi,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:Qi,715:Qi,728:Qi,729:bn,730:xr,732:Qi,733:Qi,915:xn,916:Rn,920:fr,923:Gs,926:aa,928:Hi,931:An,933:fr,934:An,936:fr,937:An,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:bn,8217:bn,8220:Er,8221:Er,8224:ur,8225:ur,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:al,8465:Ir,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:Ir,8501:en,8592:wn,8593:Xn,8594:wn,8595:Xn,8596:wn,8597:Ji,8598:Cr,8599:Cr,8600:Cr,8601:Cr,8636:wn,8637:wn,8640:wn,8641:wn,8656:wn,8657:Gn,8658:wn,8659:Gn,8660:wn,8661:[.25,.75,0,0,.70277],8704:yn,8706:[0,.69444,.06389,0,.62847],8707:yn,8709:pr,8711:Rn,8712:Jn,8715:Jn,8722:Ln,8723:Ln,8725:Ji,8726:Ji,8727:bi,8728:mr,8729:mr,8730:[.18,.82,0,0,.95833],8733:Ai,8734:[0,.44444,0,0,1.14999],8736:ai,8739:Yi,8741:Ji,8743:Tn,8744:Tn,8745:Tn,8746:Tn,8747:[.19444,.69444,.12778,0,.56875],8764:cr,8768:[.19444,.69444,0,0,.31944],8771:gr,8776:[.02444,.52444,0,0,.89444],8781:gr,8801:gr,8804:hr,8805:hr,8810:Jr,8811:Jr,8826:rn,8827:rn,8834:rn,8835:rn,8838:hr,8839:hr,8846:Tn,8849:hr,8850:hr,8851:Tn,8852:Tn,8853:Ln,8854:Ln,8855:Ln,8856:Ln,8857:Ln,8866:en,8867:en,8868:Si,8869:Si,8900:mr,8901:[-.02639,.47361,0,0,.31944],8902:bi,8968:xi,8969:xi,8970:xi,8971:xi,8994:Sn,8995:Sn,9651:_r,9657:bi,9661:_r,9667:bi,9711:Cr,9824:Wn,9825:Wn,9826:Wn,9827:Wn,9837:[0,.75,0,0,.44722],9838:tr,9839:tr,10216:Ki,10217:Ki,10815:Hi,10927:hr,10928:hr,57376:Qa},"Main-BoldItalic":{32:Xe,33:[0,.69444,.11417,0,.38611],34:Mi,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:nr,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:Kn,49:Kn,50:Kn,51:Kn,52:us,53:Kn,54:Kn,55:us,56:Kn,57:Kn,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:ms,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:ir,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:ir,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:Kr,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:Qr,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:Qr,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:Xe,168:[0,.69444,.11473,0,.59111],176:jr,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:Wr,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:Wr,567:[.19444,.44444,.04611,0,.385],710:Kr,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:nr,730:jr,732:ms,733:ms,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:ir,931:[0,.68611,.11431,0,.82666],933:rr,934:[0,.68611,.05632,0,.82666],936:rr,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:nr,8217:nr,8220:[0,.69444,.16772,0,.62055],8221:Mi},"Main-Italic":{32:Xe,33:pn,34:In,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:pn,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:sr,49:sr,50:sr,51:sr,52:es,53:sr,54:sr,55:es,56:sr,57:sr,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:Bi,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:cs,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:cs,79:Dn,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:cs,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:Ms,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:xs,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:xs,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:Xe,168:[0,.66786,.10474,0,.51111],176:fi,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:ws,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:ws,710:Ms,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:fi,732:[0,.66786,.11585,0,.51111],733:Bi,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:Dn,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:cs,931:[0,.68333,.12028,0,.71555],933:Un,934:[0,.68333,.05986,0,.71555],936:Un,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:pn,8217:pn,8220:[0,.69444,.1685,0,.51444],8221:In,8463:xe},"Main-Regular":{32:Xe,33:kr,34:Qn,35:_h,36:Ya,37:Qu,38:ts,39:kr,40:gs,41:gs,42:ec,43:is,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:Ss,48:ar,49:ar,50:ar,51:ar,52:ar,53:ar,54:ar,55:ar,56:ar,57:ar,58:Eo,59:[.19444,.43056,0,0,.27778],60:hn,61:Ti,62:hn,63:ks,64:ts,65:na,66:[0,.68333,0,0,.70834],67:qr,68:[0,.68333,0,0,.76389],69:Xl,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:na,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:Ks,76:Jo,77:[0,.68333,0,0,.91667],78:na,79:Ks,80:Xl,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:qr,85:na,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:na,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:Wa,92:Ss,93:Wa,94:Qn,95:[.31,.12056,.02778,0,.5],97:hs,98:ra,99:ka,100:ra,101:ka,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:ra,105:Es,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:kr,109:[0,.43056,0,0,.83334],110:ja,111:hs,112:Xo,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:ja,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:Ss,124:Wa,125:Ss,126:[.35,.31786,0,0,.5],160:Xe,163:[0,.69444,0,0,.76909],167:Qo,168:Ao,172:[0,.43056,0,0,.66667],176:ko,177:is,182:To,184:Xu,198:[0,.68333,0,0,.90278],215:is,216:[.04861,.73194,0,0,.77778],223:Qn,230:[0,.43056,0,0,.72222],247:is,248:[.09722,.52778,0,0,.5],305:Eo,338:[0,.68333,0,0,1.01389],339:il,567:[.19444,.43056,0,0,.30556],710:Qn,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:Qn,715:Qn,728:Qn,729:Es,730:ko,732:Ao,733:Qn,915:Jo,916:tl,920:Ks,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:na,931:qr,933:Ks,934:qr,936:Ks,937:qr,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:kr,8217:kr,8220:Qn,8221:Qn,8224:Qo,8225:Qo,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:xe,8465:qa,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:qa,8501:Is,8592:U,8593:el,8594:U,8595:el,8596:U,8597:Ss,8598:Rs,8599:Rs,8600:Rs,8601:Rs,8614:[.011,.511,0,0,1],8617:Za,8618:Za,8636:U,8637:U,8640:U,8641:U,8652:[.011,.671,0,0,1],8656:U,8657:To,8658:U,8659:To,8660:U,8661:[.25,.75,0,0,.61111],8704:ra,8706:[0,.69444,.05556,.08334,.5309],8707:ra,8709:Ya,8711:tl,8712:Lo,8715:Lo,8722:is,8723:is,8725:Ss,8726:Ss,8727:Do,8728:sa,8729:sa,8730:[.2,.8,0,0,.83334],8733:il,8734:ct,8736:ai,8739:Wa,8741:Ss,8743:Us,8744:Us,8745:Us,8746:Us,8747:[.19444,.69444,.11111,0,.41667],8764:Ti,8768:[.19444,.69444,0,0,.27778],8771:zs,8773:[-.022,.589,0,0,1],8776:nl,8781:zs,8784:[-.133,.67,0,0,.778],8801:zs,8804:Ni,8805:Ni,8810:rl,8811:rl,8826:hn,8827:hn,8834:hn,8835:hn,8838:Ni,8839:Ni,8846:Us,8849:Ni,8850:Ni,8851:Us,8852:Us,8853:is,8854:is,8855:is,8856:is,8857:is,8866:Is,8867:Is,8868:ts,8869:ts,8872:[.249,.75,0,0,.867],8900:sa,8901:[-.05555,.44445,0,0,.27778],8902:Do,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:Ja,8995:Ja,9136:jn,9137:jn,9651:rt,9657:Do,9661:rt,9667:Do,9711:Rs,9824:Pn,9825:Pn,9826:Pn,9827:Pn,9837:[0,.75,0,0,.38889],9838:Ur,9839:Ur,10216:gs,10217:gs,10222:jn,10223:jn,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:na,10927:Ni,10928:Ni,57376:Qa},"Math-BoldItalic":{32:Xe,48:Vs,49:Vs,50:Vs,51:Aa,52:Aa,53:Aa,54:wi,55:Aa,56:wi,57:Aa,65:Bn,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:Hs,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:sl,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:al,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:ah,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:Xe,915:[0,.68611,.15972,0,.65694],916:Rn,920:[0,.68611,.03194,0,.86722],923:Gs,926:[0,.68611,.07458,0,.84125],928:Hs,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:aa,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:ah,960:[0,.44444,.03704,0,.68241],961:oh,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:oh,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:Xe,48:hs,49:hs,50:hs,51:ol,52:ol,53:ol,54:ar,55:ol,56:ar,57:ol,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:Gu,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:lh,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:Jl,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:Xe,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:lh,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:Gu,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:Jl,960:[0,.43056,.03588,0,.57003],961:ll,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:ll,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:Xe,33:[0,.69444,0,0,.36667],34:Zu,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:cl,40:Co,41:Co,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:Vr,49:Vr,50:Vr,51:Vr,52:Vr,53:Vr,54:Vr,55:Vr,56:Vr,57:Vr,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:Ql,64:Ws,65:Ws,66:Ws,67:Hu,68:oa,69:[0,.69444,0,0,.64167],70:Is,71:Ws,72:oa,73:[0,.69444,0,0,.33056],74:Ql,75:ul,76:hh,77:[0,.69444,0,0,.97778],78:oa,79:oa,80:Hu,81:[.10556,.69444,0,0,.79445],82:Hu,83:Is,84:Ws,85:ul,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:Ws,89:[0,.69444,.0275,0,.73334],90:fh,91:uh,93:uh,94:Vr,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:Wu,99:[0,.45833,0,0,.48889],100:Wu,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:Wu,105:ju,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:ju,109:[0,.45833,0,0,.86667],110:ch,111:[0,.45833,0,0,.55],112:qu,113:qu,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:ch,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:Xe,168:Vr,176:Ws,180:Vr,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:Vr,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:Vr,729:cl,730:Ws,732:Vr,733:Vr,915:hh,916:[0,.69444,0,0,.91667],920:hl,923:fh,926:Ws,928:oa,931:oa,933:hl,934:oa,936:hl,937:oa,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:cl,8217:cl,8220:Zu,8221:Zu},"SansSerif-Italic":{32:Xe,33:[0,.69444,.05733,0,.31945],34:fl,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:Ju,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:vh,45:[0,.44444,.01946,0,.33333],46:eu,47:[.25,.75,.13164,0,.5],48:js,49:js,50:js,51:js,52:js,53:js,54:js,55:js,56:js,57:js,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:Ps,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:Yu,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:Mo,77:[0,.69444,.08094,0,.875],78:Yu,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:dh,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:Xe,168:[0,.67937,.06385,0,.5],176:ph,184:Xu,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:dh,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:mh,715:Qn,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:ph,732:[0,.67659,.08826,0,.5],733:mh,915:[0,.69444,.13372,0,.54167],916:sc,920:[0,.69444,.07555,0,.77778],923:Is,926:[0,.69444,.12816,0,.66667],928:Yu,931:[0,.69444,.11983,0,.72222],933:gh,934:[0,.69444,.04603,0,.72222],936:gh,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:Ju,8217:Ju,8220:[0,.69444,.14205,0,.5],8221:fl},"SansSerif-Regular":{32:Xe,33:[0,.69444,0,0,.31945],34:Qn,35:_h,36:Ya,37:Qu,38:[0,.69444,0,0,.75834],39:kr,40:gs,41:gs,42:ec,43:is,44:vh,45:[0,.44444,0,0,.33333],46:eu,47:Ss,48:vr,49:vr,50:vr,51:vr,52:vr,53:vr,54:vr,55:vr,56:vr,57:vr,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:ks,64:Ps,65:Ps,66:Ps,67:yn,68:[0,.69444,0,0,.72223],69:yh,70:[0,.69444,0,0,.56945],71:Ps,72:tc,73:kr,74:ks,75:[0,.69444,0,0,.69445],76:Mo,77:[0,.69444,0,0,.875],78:tc,79:[0,.69444,0,0,.73611],80:yn,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:ra,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:Ps,89:[0,.69444,.025,0,.66667],90:Is,91:bh,93:bh,94:Qn,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:ic,99:xh,100:ic,101:xh,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:ic,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:tu,111:[0,.44444,0,0,.5],112:nc,113:nc,114:[0,.44444,.01389,0,.34167],115:rc,116:[0,.57143,0,0,.36111],117:tu,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:Xe,168:[0,.67937,0,0,.5],176:Ps,184:Xu,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:Qn,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:Qn,715:Qn,728:Qn,729:[0,.67937,0,0,.27778],730:Ps,732:[0,.67659,0,0,.5],733:Qn,915:Mo,916:sc,920:ts,923:Is,926:Ps,928:tc,931:qa,933:ts,934:qa,936:ts,937:qa,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:kr,8217:kr,8220:Qn,8221:Qn},"Script-Regular":{32:Xe,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:Xe},"Size1-Regular":{32:Xe,40:wh,41:wh,47:ac,91:Sh,92:ac,93:Sh,123:oc,125:oc,160:Xe,710:iu,732:iu,770:iu,771:iu,8214:[-99e-5,.601,0,0,.77778],8593:lc,8595:lc,8657:Eh,8659:Eh,8719:kh,8720:kh,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:uc,8748:Ah,8749:Ah,8750:uc,8896:Ro,8897:Ro,8898:Ro,8899:Ro,8968:eo,8969:eo,8970:eo,8971:eo,9168:fs,10216:eo,10217:eo,10752:to,10753:to,10754:to,10756:Ro,10758:Ro},"Size2-Regular":{32:Xe,40:cc,41:cc,47:hc,91:Mr,92:hc,93:Mr,123:la,125:la,160:Xe,710:Io,732:Io,770:Io,771:Io,8719:Th,8720:Th,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:nu,8748:Lh,8749:Lh,8750:nu,8896:Ta,8897:Ta,8898:Ta,8899:Ta,8968:ua,8969:ua,8970:ua,8971:ua,10216:Dh,10217:Dh,10752:qs,10753:qs,10754:qs,10756:Ta,10758:Ta},"Size3-Regular":{32:Xe,40:Ge,41:Ge,47:fc,91:ru,92:fc,93:ru,123:su,125:su,160:Xe,710:La,732:La,770:La,771:La,8730:[.95003,1.45,0,0,1],8968:au,8969:au,8970:au,8971:au,10216:su,10217:su},"Size4-Regular":{32:Xe,40:Ch,41:Ch,47:Mh,91:Rh,92:Mh,93:Rh,123:ou,125:ou,160:Xe,710:ca,732:ca,770:ca,771:ca,8730:[1.25003,1.75,0,0,1],8968:Po,8969:Po,8970:Po,8971:Po,9115:dl,9116:pl,9117:dl,9118:dl,9119:pl,9120:dl,9121:lu,9122:fs,9123:lu,9124:lu,9125:fs,9126:lu,9127:dc,9128:pc,9129:Ih,9130:[0,.3,0,0,.88889],9131:dc,9132:pc,9133:Ih,9143:[.88502,.915,0,0,1.05556],10216:ou,10217:ou,57344:ml,57345:ml,57680:uu,57681:uu,57682:uu,57683:uu},"Typewriter-Regular":{32:Oo,33:ri,34:ri,35:ri,36:Rr,37:Rr,38:ri,39:ri,40:Rr,41:Rr,42:[0,.52083,0,0,.525],43:gl,44:[.13889,.125,0,0,.525],45:gl,46:[0,.125,0,0,.525],47:Rr,48:ri,49:ri,50:ri,51:ri,52:ri,53:ri,54:ri,55:ri,56:ri,57:ri,58:ns,59:[.13889,.43056,0,0,.525],60:mc,61:[-.19549,.41562,0,0,.525],62:mc,63:ri,64:ri,65:ri,66:ri,67:ri,68:ri,69:ri,70:ri,71:ri,72:ri,73:ri,74:ri,75:ri,76:ri,77:ri,78:ri,79:ri,80:ri,81:[.13889,.61111,0,0,.525],82:ri,83:ri,84:ri,85:ri,86:ri,87:ri,88:ri,89:ri,90:ri,91:Rr,92:Rr,93:Rr,94:ri,95:[.09514,0,0,0,.525],96:ri,97:ns,98:ri,99:ns,100:ri,101:ns,102:ri,103:io,104:ri,105:ri,106:[.22222,.61111,0,0,.525],107:ri,108:ri,109:ns,110:ns,111:ns,112:io,113:io,114:ns,115:ns,116:[0,.55358,0,0,.525],117:ns,118:ns,119:ns,120:ns,121:io,122:ns,123:Rr,124:Rr,125:Rr,126:ri,127:ri,160:Oo,176:ri,184:[.19445,0,0,0,.525],305:ns,567:io,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:ri,715:ri,728:ri,730:ri,770:ri,771:ri,776:ri,915:ri,916:ri,920:ri,923:ri,926:ri,928:ri,931:ri,933:ri,934:ri,936:ri,937:ri,8216:ri,8217:ri,8242:ri,9251:[.11111,.21944,0,0,.525]}},Qf=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,no=10,As=.25,Ph=1.2,Da=.431,cu={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[Da,Da,Da],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:[As,As,As],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]},hu=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],ro=5,fu={"\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 Fo(e,i){e===void 0&&(e=77);const r=Jf[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 fu)e=fu[a].codePointAt(0);else if(Qf.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 gc={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]},du={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]},_c={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 ed(e){if(du[e]){const[E,R,F]=du[e],Y=`<span class="stretchy" style="height:${F}em"><svg width="100%" height="${F}em" viewBox="0 0 ${E} ${R}" preserveAspectRatio="none" ><path fill="currentcolor" d="${_c[e]}"></path></svg></span>`;return`<span style="display:inline-block;height:${Math.floor(100*F/2)/100}em;min-width:0">${Y}</span>`}const[i,r,a,u]=gc[e];let d,g;const b=a/1e3;i.length===3?(d=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],g=["xMinYMin","xMidYMin","xMaxYMin"]):i.length===2?(d=["slice-1-of-2","slice-2-of-2"],g=["xMinYMin","xMaxYMin"]):(d=["slice-1-of-1"],g=[u]);const x=i.map((E,R)=>`<span class="${d[R]}" style=height:${b}em><svg width=400em height=${b}em viewBox="0 0 400000 ${a}" preserveAspectRatio="${g[R]} slice"><path fill="currentcolor" d="${_c[E]}"></path></svg></span>`).join("");return`<span style="display:inline-block;height:${b}em;min-width:${r}em;">${x}</span>`}function td(e){return gc[e]?gc[e][2]/1e3:du[e][2]}function Oh(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 d=a-55296,g=u-56320;a=Ea(2,16)+d*Ea(2,10)+g,r++}}i.push(a)}return i}var pu=8205,vc=[[pu,1],[65038,2],[127995,5],[129456,4],[917536,96]],Bo,id=[127462,127487];function rs(e){var i;if(Bo===void 0){Bo={};for(const r of vc)for(let a=r[0];a<=r[0]+r[1]-1;a++)Bo[a]=!0}return(i=Bo[e])!=null?i:!1}function m0(e){return e>=id[0]&&e<=id[1]}function Fh(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;const i=[],r=Oh(e);let a=0;for(;a<r.length;){const u=r[a++],d=r[a];if(d===pu){const g=a-1;for(a+=2;r[a]===pu;)a+=2;i.push(String.fromCodePoint(...r.slice(g,a-g+1)))}else if(rs(d)){const g=a-1;for(;rs(r[a]);)a+=r[a]===pu?2:1;i.push(String.fromCodePoint(...r.slice(g,2*a-g-1)))}else m0(u)?(a+=1,i.push(String.fromCodePoint(...r.slice(a-2,2)))):i.push(String.fromCodePoint(u))}return i}var g0=class{constructor(e){this.obeyspaces=!1,this.pos=0,this.s=Fh(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 _0(e,i){var r,a,u,d;const g=[];let b=e.next();if(b&&b!=="\\relax"){if(b==="\\noexpand")b=e.next(),b&&g.push(b);else if(b==="\\obeyspaces")e.obeyspaces=!0;else if(b==="\\bgroup")g.push("<{>");else if(b==="\\egroup")g.push("<}>");else if(b==="\\string"){if(b=e.next(),b)if(b.startsWith("\\"))for(const x of b)g.push(x==="\\"?"\\backslash":x);else b==="<{>"?g.push("\\{"):b==="<space>"?g.push("~"):b==="<}>"&&g.push("\\}")}else if(b==="\\csname"){for(;e.peek()==="<space>";)e.next();let x="",E=!1,R=[];do{if(R.length===0)if(/^#[\d?@]$/.test(e.peek())){const F=e.get().slice(1);R=yc((a=(r=i==null?void 0:i(F))!=null?r:i==null?void 0:i("?"))!=null?a:"\\placeholder{}",i),b=R[0]}else b=e.next(),R=b?[b]:[];E=R.length===0,!E&&b==="\\endcsname"&&(E=!0,R.shift()),E||(E=b==="<$>"||b==="<$$>"||b==="<{>"||b==="<}>"||typeof b=="string"&&b.length>1&&b.startsWith("\\")),E||(x+=R.shift())}while(!E);x&&g.push("\\"+x),g.push(...R)}else if(b!=="\\endcsname")if(b.length>1&&b.startsWith("#")){const x=b.slice(1);g.push(...yc((d=(u=i==null?void 0:i(x))!=null?u:i==null?void 0:i("?"))!=null?d:"\\placeholder{}",i))}else g.push(b)}return g}function yc(e,i=null){const r=[];let a="";for(const g of e.toString().split(/\r?\n/)){a&&r.push(a),a=" ";const b=g.match(/((?:\\%)|[^%])*/);b!==null&&r.push(b[0])}const u=new g0(Kt(r.join(""))),d=[];do d.push(..._0(u,i));while(!u.end());return d}function fn(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 On(e,...i){return console.assert(e.startsWith("\\")),i.length===0?e:fn([e,...i.map(r=>`{${r}}`)])}function so(e){return fn(e.map(i=>{var r;return(r={"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"}[i])!=null?r:i}))}var ao=class sh{constructor(i){sh._registry[i]=this}static createAtom(i,r,a){return sh._registry[i].createAtom(r,Re(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 d of Bh(i)){const g=sh._registry[d[0].mode];u.push(...g.serialize(d,r))}return fn(u)}return fn($h(i,r))}static getFont(i,r,a){return sh._registry[i].getFont(r,a)}};ao._registry={};var _s=ao;function Bh(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 Ca(e,i){const r=[];let a=[],u;for(const d of e)if(d.type!=="first"&&d.style){let g;i==="variant"?(g=d.style.variant,d.style.variantStyle&&d.style.variantStyle!=="up"&&(g+="-"+d.style.variantStyle)):g=d.style[i],g===u?a.push(d):(a.length>0&&r.push(a),a=[d],u=g)}return a.length>0&&r.push(a),r}function Os(e,i){var r;const{parent:a}=e[0],u=a==null?void 0:a.computedStyle.color,d=[];for(const g of Bh(e)){const b=i.defaultMode;for(const x of Ca(g,"color")){const E=x[0].computedStyle,R=_s._registry[x[0].mode].serialize(x,f(P({},i),{defaultMode:b==="text"?"text":"math"}));!i.skipStyles&&E.color&&E.color!=="none"&&(!a||u!==E.color)?d.push(On("\\textcolor",(r=E.verbatimColor)!=null?r:E.color,fn(R))):d.push(fn(R))}}return d}function Nh(e,i){const{parent:r}=e[0],a=r==null?void 0:r.computedStyle.backgroundColor;return Ca(e,"backgroundColor").map(u=>{var d;if(u.length>0||u[0].type!=="box"){const g=u[0].computedStyle;if(g.backgroundColor&&g.backgroundColor!=="none"&&(!r||a!==g.backgroundColor))return On("\\colorbox",(d=g.verbatimBackgroundColor)!=null?d:g.backgroundColor,fn(Os(u,f(P({},i),{defaultMode:"text"}))))}return fn(Os(u,i))})}function $h(e,i){if(e.length===0)return[];const{parent:r}=e[0],a=r==null?void 0:r.computedStyle.fontSize,u=[];for(const d of Ca(e,"fontSize")){const g=d[0].computedStyle.fontSize,b=Nh(d,i);b&&(g&&g!=="auto"&&(!r||a!==g)?u.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][g],...b):u.push(...b))}return u}function bc(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 _l(e){if(e.length===0)return"ord";const i=bc(e[0].type),r=bc(e[e.length-1].type);return i&&i===r?i:"ord"}function vl(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 Bt=class Lp{constructor(i,r){var a,u,d,g,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 Lp&&(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=(d=r==null?void 0:r.isTight)!=null?d:!1,r!=null&&r.attributes&&(this.attributes=r.attributes);let x=r==null?void 0:r.fontFamily;r!=null&&r.style&&this.value&&(x=(b=_s.getFont((g=r.mode)!=null?g:"math",this,f(P({variant:"normal"},r.style),{letterShapeStyle:r.letterShapeStyle})))!=null?b:void 0),x||(x="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),nd(this,x)}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=vl(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=vl(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"]=vl(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"]=vl(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"]=vl(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=L(u)),u&&u!==r.backgroundColor&&(this.setStyle("background-color",u),this.setStyle("display","inline-block"));const d=i.scalingFactor;return this.scale=d,this.skew*=d,this.italic*=d,this}toMarkup(){var i,r,a,u;let d=(i=this.value)!=null?i:"";if(this.children)for(const oe of this.children)d+=oe.toMarkup();let g="";if(this.svgBody)g=ed(this.svgBody);else if(this.svgOverlay){g='<span style="',g+="display: inline-block;",g+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`,g+=`vertical-align:${Math.floor(100*this.depth)/100}em;`,g+='">',g+=d,g+="</span>",g+='<svg style="position:absolute;overflow:visible;',g+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`;const oe=(r=this.cssProperties)==null?void 0:r.padding;oe?(g+=`top:${oe};`,g+=`left:${oe};`,g+=`width:calc(100% - 2 * ${oe} );`):g+="top:0;left:0;width:100%;",g+="z-index:2;",g+='"',this.svgStyle&&(g+=this.svgStyle),g+=` viewBox="0 0 ${Math.floor(100*this.width)/100} ${Math.floor(100*(this.height+this.depth))/100}"`,g+=`>${this.svgOverlay}</svg>`}let b="";const x=this.classes.split(" ");x.push((a={latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"}[this.type])!=null?a:""),this.caret==="latex"&&x.push("ML__latex-caret"),this.isSelected&&x.push("ML__selected");const E=x.length===1?x[0]:x.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 Ot=He[1].trim().replace(/ /g,"-");Ot&&(b+=` data-${Ot}="${He[2]}" `)}else{const Ot=ge.trim().replace(/ /g,"-");Ot&&(b+=` data-${Ot} `)}}}const R=(u=this.cssProperties)!=null?u:{};this.hasExplicitWidth&&R.width===void 0&&(R.width=`${Math.ceil(this._width*100)/100}em`);const F=Object.keys(R).map(oe=>`${oe}:${R[oe]}`);if(this.scale!==void 0&&this.scale!==1&&(d.length>0||g.length>0)&&F.push(`font-size: ${Math.ceil(this.scale*1e4)/100}%`),this.htmlStyle){const oe=this.htmlStyle.split(";");let ge="";for(const He of oe){const Ot=He.match(/([^=]+):(.+$)/);if(Ot){const Ve=Ot[1].trim().replace(/ /g,"-");Ve&&(ge+=`${Ve}:${Ot[2]};`)}}ge&&(b+=` style="${ge}"`)}F.length>0&&(b+=` style="${F.join(";")}"`);let Y="";return b.length>0||g.length>0?Y=`<span${b}>${d}${g}</span>`:Y=d,this.caret==="text"?Y+='<span class="ML__text-caret"></span>':this.caret==="math"&&(Y+='<span class="ML__caret"></span>'),Y}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 x of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"])if(i.cssProperties&&x in i.cssProperties||this.cssProperties&&x in this.cssProperties)return!1}const u=this.cssProperties?Object.keys(this.cssProperties).length:0,d=i.cssProperties?Object.keys(i.cssProperties).length:0;if(u!==d)return!1;if(u>0){for(const x of Object.keys(this.cssProperties))if(this.cssProperties[x]!==i.cssProperties[x])return!1}const g=this.classes.trim().replace(/\s+/g," ").split(" "),b=i.classes.trim().replace(/\s+/g," ").split(" ");if(g.length!==b.length)return!1;g.sort(),b.sort();for(const[x,E]of g.entries())if(E==="vertical-separator"||E!==b[x])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 xc(e){if(!e||e.length===0)return[];e[0].children=xc(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=xc(e[r].children),i.push(e[r]));return i}function mu(e){return e.children&&(e.children=xc(e.children)),e}function gu(e,i){if(!e)return new Bt(null,i);const r=new Bt(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 Bt(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 Bt(a,f(P({},i),{type:"lift"}))}function yl(e){const i=td(e)/2,r=new Bt(null,{maxFontSize:0});return r.height=i+.166,r.depth=i-.166,r.svgBody=e,r}function nd(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=Fo(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,d=0;for(const g of e.children)g.height>a&&(a=g.height),g.depth>u&&(u=g.depth),d=Math.max(d,(r=g.maxFontSize)!=null?r:0);e.height=a,e.depth=u,e._width=e.children.reduce((g,b)=>g+b.width,0),e.maxFontSize=d}}function Kh(e){if("individualShift"in e){const i=e.individualShift;let r=i[0];const a=[r],u=-r.shift-r.box.depth;let d=u;for(let g=1;g<i.length;g++){const b=i[g],x=-b.shift-d-b.box.depth,E=x-(r.box.height+r.box.depth);d=d+x,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 rd(e){var i;const[r,a]=Kh(e);if(!r)return[[],0,0];const u=new Bt(null,{classes:"pstrut"});let d=0;for(const ge of r)if(typeof ge!="number"){const He=ge.box;d=Math.max(d,He.maxFontSize,He.height)}d+=2,u.height=d,u.setStyle("height",d,"em");const g=[];let b=a,x=a,E=a,R=0;for(const ge of r){if(typeof ge=="number")E+=ge;else{const He=ge.box,Ot=(i=ge.classes)!=null?i:[],Ve=new Bt([u,He],{classes:Ot.join(" "),style:ge.style});He.setStyle("height",He.height+He.depth,"em"),He.setStyle("display","inline-block"),Ve.setStyle("top",-d-E-He.depth,"em"),ge.marginLeft&&Ve.setStyle("margin-left",ge.marginLeft,"em"),ge.marginRight&&Ve.setStyle("margin-right",ge.marginRight,"em"),g.push(Ve),E+=He.height+He.depth,R=Math.max(R,Ve.width)}b=Math.min(b,E),x=Math.max(x,E)}g.forEach(ge=>{ge.softWidth=R});const F=new Bt(g,{classes:"vlist"});if(F.softWidth=R,F.height=x,F.setStyle("height",x,"em"),b>=0)return[[new Bt(F,{classes:"vlist-r"})],x,-b];const Y=new Bt(new Bt(null),{classes:"vlist"});Y.height=-b,Y.setStyle("height",-b,"em");const oe=new Bt(8203,{classes:"vlist-s",maxFontSize:0});return oe.softWidth=0,oe.height=0,oe.depth=0,[[new Bt([F,oe],{classes:"vlist-r"}),new Bt(Y,{classes:"vlist-r"})],x,-b]}var wr=class extends Bt{constructor(e,i){var r;const[a,u,d]=rd(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=d,this.softWidth=a.reduce((g,b)=>Math.max(g,b.width),0)}};function sd(e,i){var r,a,u,d,g;const b=e.metrics,x=new Bt(i.base),E=(r=i.baseShift)!=null?r:0,R=(a=i.slant)!=null?a:0;let F=0,Y=0;i.above&&(F=(u=i.aboveShift)!=null?u:Math.max(b.bigOpSpacing1,b.bigOpSpacing3-i.above.depth)),i.below&&(Y=(d=i.belowShift)!=null?d: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+Y+x.depth+E;oe=new wr({bottom:ge,children:[b.bigOpSpacing5,{box:i.below,marginLeft:-R,classes:["ML__center"]},Y,{box:x,classes:["ML__center"]},F,{box:i.above,marginLeft:R,classes:["ML__center"]},b.bigOpSpacing5]}).wrap(e)}else if(i.below&&!i.above)oe=new wr({top:x.height-E,children:[b.bigOpSpacing5,{box:i.below,marginLeft:-R,classes:["ML__center"]},Y,{box:x,classes:["ML__center"]}]}).wrap(e);else if(!i.below&&i.above){const ge=x.depth+E;oe=new wr({bottom:ge,children:[{box:x,classes:["ML__center"]},F,{box:i.above,marginLeft:R,classes:["ML__center"]},b.bigOpSpacing5]}).wrap(e)}else{const ge=x.depth+E;oe=new wr({bottom:ge,children:[{box:x},b.bigOpSpacing5]}).wrap(e)}return new Bt(oe,{type:(g=i.type)!=null?g:"op"})}var wc=7,_u=6,vu=5,oo=4,lo=3,ss=2,uo=1,Pr=0,Zs=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(cu).reduce((u,d)=>f(P({},u),{[d]:cu[d][a]}),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return Ys[[Pr,uo,Pr,uo,ss,lo,ss,lo][this.id]]}get sub(){return Ys[[Pr,Pr,Pr,Pr,ss,ss,ss,ss][this.id]]}get fracNum(){return Ys[[Pr,uo,Pr,uo,ss,lo,oo,vu][this.id]]}get fracDen(){return Ys[[Pr,Pr,Pr,Pr,ss,ss,oo,oo][this.id]]}get cramp(){return Ys[[Pr,Pr,ss,ss,oo,oo,_u,_u][this.id]]}get isTight(){return this.sizeDelta<0}},No={7:new Zs(wc,0,!1),6:new Zs(_u,0,!0),5:new Zs(vu,0,!1),4:new Zs(oo,0,!0),3:new Zs(lo,-3,!1),2:new Zs(ss,-3,!0),1:new Zs(uo,-4,!1),0:new Zs(Pr,-4,!0)},Ys=f(P({},No),{displaystyle:No[wc],textstyle:No[vu],scriptstyle:No[lo],scriptscriptstyle:No[uo]});function Uh(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:no,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=Ea(10,i);return Math.round(e.dimension/no*a*u)/u}return e.dimension*a}function zh(e,i){if(e===null)return 0;const r=Uh(e)/no;if(Number.isFinite(i)){const a=Ea(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 ad(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 Or(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=ad(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 vs(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:vs(e.glue,i),shrink:vs(e.shrink,i),grow:vs(e.grow,i)}:e.shrink?{glue:vs(e.glue,i),shrink:vs(e.shrink,i)}:e.grow?{glue:vs(e.glue,i),grow:vs(e.grow,i)}:{glue:vs(e.glue,i)}:null}var od={"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 bl(){return P({},od)}function Ec(){return{registers:bl(),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"\u25A2",letterShapeStyle:N.locale.startsWith("fr")?"french":"tex",minFontScale:0,colorMap:ze,backgroundColorMap:Rt,getMacro:e=>st(e,Nt())}}var ln=class Dp{constructor(i,r){var a,u,d,g,b,x,E,R,F,Y,oe,ge,He,Ot,Ve;let wt;i!=null&&i.parent?(this.parent=i.parent,wt=i.parent,this.registers={}):(wt=P(P({},Ec()),(a=i==null?void 0:i.from)!=null?a:{}),this.registers=wt.registers),wt.atomIdsSettings&&(this.atomIdsSettings=P({},wt.atomIdsSettings)),this.renderPlaceholder=wt.renderPlaceholder,this.isPhantom=(g=(d=i==null?void 0:i.isPhantom)!=null?d:(u=this.parent)==null?void 0:u.isPhantom)!=null?g:!1,this.letterShapeStyle=wt.letterShapeStyle,this.minFontScale=wt.minFontScale,r!=null&&r.color&&r.color!=="none"?this.color=r.color:this.color=(x=(b=this.parent)==null?void 0:b.color)!=null?x:"",r!=null&&r.backgroundColor&&r.backgroundColor!=="none"?this.backgroundColor=r.backgroundColor:this.backgroundColor=(R=(E=this.parent)==null?void 0:E.backgroundColor)!=null?R:"",r!=null&&r.fontSize&&r.fontSize!=="auto"&&r.fontSize!==((F=this.parent)==null?void 0:F.size)?this.size=r.fontSize:this.size=(oe=(Y=this.parent)==null?void 0:Y.size)!=null?oe:ro;let $t=(He=(ge=this.parent)==null?void 0:ge.mathstyle)!=null?He:Ys.displaystyle;if(typeof(i==null?void 0:i.mathstyle)=="string"){if(wt instanceof Dp)switch(i.mathstyle){case"cramp":$t=$t.cramp;break;case"superscript":$t=$t.sup;break;case"subscript":$t=$t.sub;break;case"numerator":$t=$t.fracNum;break;case"denominator":$t=$t.fracDen;break}switch(i.mathstyle){case"textstyle":$t=Ys.textstyle;break;case"displaystyle":$t=Ys.displaystyle;break;case"scriptstyle":$t=Ys.scriptstyle;break;case"scriptscriptstyle":$t=Ys.scriptscriptstyle;break;case"":case"auto":break}}this.mathstyle=$t,this.smartFence=wt.smartFence,this.placeholderSymbol=wt.placeholderSymbol,this.colorMap=(Ot=wt.colorMap)!=null?Ot:At=>At,this.backgroundColorMap=(Ve=wt.backgroundColorMap)!=null?Ve:At=>At,this.getMacro=wt.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===wc||this.mathstyle.id===_u}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(hu[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 zh(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 d=r.evaluate(u);if(d!==void 0)return"string"in d?{string:Number(u).toString()+d.string}:"number"in d?{number:a*d.number}:"dimension"in d?f(P({},d),{dimension:a*d.dimension}):"glue"in d?f(P({},d),{glue:f(P({},d.glue),{dimension:a*d.glue.dimension}),shrink:d.shrink?f(P({},d.shrink),{dimension:a*d.shrink.dimension}):void 0,grow:d.grow?f(P({},d.grow),{dimension:a*d.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:Uh(a,r)/no}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}},co=["body","above","below","superscript","subscript"];function ho(e){return typeof e=="string"&&co.includes(e)}function yu(e){return e!==void 0&&Array.isArray(e)&&e.length===2}var dt=class wo{constructor(i){var r,a,u,d,g,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=(d=i.displayContainsHighlight)!=null?d:!1,this.captureSelection=(g=i.captureSelection)!=null?g:!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 d=ld(r),g=[];for(const x of d){const E=x[0].style,R=Vh(i,x,{style:{color:E.color,backgroundColor:E.backgroundColor,fontSize:E.fontSize}});R&&g.push(R)}if(g.length===0)return null;const b=((u=a==null?void 0:a.classes)!=null?u:"").trim();return g.length===1&&!b&&!(a!=null&&a.type)?g[0].wrap(i):new Bt(g,{classes:b,type:a==null?void 0:a.type}).wrap(i)}static serialize(i,r){return _s.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=ud(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=Re(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):this.body&&this.command?fn([On(this.command,this.bodyToLatex(i)),this.supsubToLatex(i)]):this.body?fn([this.bodyToLatex(i),this.supsubToLatex(i)]):!this.value||this.value==="\u200B"?"":this.command}bodyToLatex(i){var r;return _s.serialize(this.body,f(P({},i),{defaultMode:(r=i.defaultMode)!=null?r:this.latexMode}))}aboveToLatex(i){return _s.serialize(this.above,i)}belowToLatex(i){return _s.serialize(this.below,i)}supsubToLatex(i){let r="";if(i=f(P({},i),{defaultMode:"math"}),this.branch("subscript")!==void 0){const a=_s.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=_s.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(ho(i)&&this._branches)return this._branches[i]}get branches(){if(!this._branches)return[];const i=[];for(const r of co)this._branches[r]&&i.push(r);return i}createBranch(i){return console.assert(ho(i)),ho(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 yu(this.parentBranch)?this.parentBranch[0]:-1}get col(){return yu(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",d=P(P({},(r=(i=this.parent)==null?void 0:i.computedStyle)!=null?r:{}),this.style);return delete d.variant,delete d.variantStyle,u||delete d.verbatimBackgroundColor,a||delete d.verbatimColor,d}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(ho(r)),!ho(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 d of i)d.parent=this,d.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(ho(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 co)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=Re(this.command,this.mode);if(r!=null&&r.render)return r.render(this,i);const a=new ln({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,d=this.superscript,g=this.subscript;if(!d&&!g)return u;let b=null,x=null;const E=(a=r.isCharacterBox)!=null?a:this.isCharacterBox();let R=0;if(d){const He=new ln({parent:i,mathstyle:"superscript"});b=wo.createBox(He,d),E||(R=u.height-i.metrics.supDrop*He.scalingFactor)}let F=0;if(g){const He=new ln({parent:i,mathstyle:"subscript"});x=wo.createBox(He,g),E||(F=u.depth+i.metrics.subDrop*He.scalingFactor)}let Y;i.isDisplayStyle?Y=i.metrics.sup1:i.isCramped?Y=i.metrics.sup3:Y=i.metrics.sup2;const oe=.5/no/i.scalingFactor;let ge=null;if(x&&b){R=Math.max(R,Y,b.depth+.25*i.metrics.xHeight),F=Math.max(F,i.metrics.sub2);const He=i.metrics.defaultRuleThickness;if(R-b.depth-(x.height-F)<4*He){F=4*He-(R-b.depth)+x.height;const Ve=.8*i.metrics.xHeight-(R-b.depth);Ve>0&&(R+=Ve,F-=Ve)}const Ot=this.isExtensibleSymbol&&u.italic?-u.italic:0;ge=new wr({individualShift:[{box:x,shift:F,marginLeft:Ot},{box:b,shift:-R}]}).wrap(i)}else x&&!b?(F=Math.max(F,i.metrics.sub1,x.height-.8*Da),ge=new wr({shift:F,children:[{box:x,marginRight:oe,marginLeft:this.isCharacterBox()?-u.italic:0}]})):!x&&b&&(R=Math.max(R,Y,b.depth+.25*Da),ge=new wr({shift:-R,children:[{box:b,marginRight:oe}]}));return new Bt([u,new Bt(ge,{caret:this.caret,isSelected:this.isSelected,classes:"msubsup"})],{type:r.type})}attachLimits(i,r){const a=this.superscript?wo.createBox(new ln({parent:i,mathstyle:"superscript"},this.style),this.superscript):null,u=this.subscript?wo.createBox(new ln({parent:i,mathstyle:"subscript"},this.style),this.subscript):null;return!a&&!u?r.base.wrap(i):sd(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,d,g;const b=(a=this.value)!=null?a:this.body,x=(u=r==null?void 0:r.boxType)!=null?u:bc(this.type);let E=(d=r==null?void 0:r.classes)!=null?d:"";this.mode==="text"&&(E+=" ML__text");const R=typeof b=="string"||b===void 0?new Bt(b!=null?b:null,{type:x,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}):(g=wo.createBox(i,b,{type:x,classes:E}))!=null?g:new Bt(null);return i.isTight&&(R.isTight=!0),(this.mode!=="math"||this.style.variant==="main")&&(R.italic=0),R.right=R.italic,this.bind(i,R),this.caret&&!this.superscript&&!this.subscript&&(R.caret=this.caret),R}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 ld(e){let i;const r=[];let a=[];for(const u of e)if(!i&&!u.style)a.push(u);else{const d=u.computedStyle;i&&d.color===i.color&&d.backgroundColor===i.backgroundColor&&d.fontSize===i.fontSize?a.push(u):(a.length>0&&r.push(a),a=[u],i=d)}return a.length>0&&r.push(a),r}function Vh(e,i,r){var a,u,d,g,b;if(!i||i.length===0)return null;const x=new ln({parent:e},r.style),E=!((a=x.atomIdsSettings)!=null&&a.groupNumbers);let R=[];if(i.length===1){const Y=i[0],oe=Y.render(x);oe&&(E&&Y.isSelected&&oe.selected(!0),R=[oe])}else{let Y="",oe=!0;for(const ge of i){(u=x.atomIdsSettings)!=null&&u.groupNumbers&&Y&&(oe&&ge.isDigit()||!oe&&kc(ge))&&(x.atomIdsSettings.overrideID=Y);const He=ge.render(x);x.atomIdsSettings&&(x.atomIdsSettings.overrideID=void 0),He&&((d=x.atomIdsSettings)!=null&&d.groupNumbers&&((ge.isDigit()||kc(ge))&&(!Y||oe!==ge.isDigit())&&(oe=ge.isDigit(),Y=(g=ge.id)!=null?g:""),Y&&(!(ge.isDigit()||kc(ge))||!ge.hasEmptyBranch("superscript")||!ge.hasEmptyBranch("subscript"))&&(Y="")),E&&ge.isSelected&&He.selected(!0),R.push(He))}}if(R.length===0)return null;const F=new Bt(R,f(P({isTight:x.isTight},r),{type:(b=r.type)!=null?b:"lift"}));return F.isSelected=R.every(Y=>Y.isSelected),F.wrap(x)}function kc(e){return e.mode==="text"}function ud(e){return e.map(i=>i===null?"<null>":Array.isArray(i)&&i[0]instanceof dt?{atoms:i.map(r=>r.toJson())}:typeof i=="object"&&"group"in i?{group:i.group.map(r=>r.toJson())}:i)}var xl=class Cp extends dt{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 Cp(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:vt("text",this.value.codePointAt(0))}};function cd(e,i){if(e.direction===i.direction){const r=e.ranges.length;if(i.ranges.length===r){let a=0;for(;a<r&&Gh(e.ranges[a],i.ranges[a])==="equal";)a++;return a===r?"equal":"different"}}return"different"}function Gh(e,i){return e[0]===i[0]&&e[1]===i[1]?"equal":"different"}function Fr(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 Ar(e){return typeof e=="number"&&!Number.isNaN(e)}function as(e){return Array.isArray(e)&&e.length===2}function ha(e){return e!=null&&typeof e=="object"&&"ranges"in e&&Array.isArray(e.ranges)}function Ts(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 hd(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,d=!1,g=!1,b=!1,x=!1,E=!1,R=!1,F=!1,Y=!1,oe=!1,ge=!1,He=!1,Ot=!1,Ve=e[0],wt=0;for(;Ve!=null&&Ve.type&&/^(subsup|placeholder)$/.test(Ve.type);)wt+=1,Ve=e[wt];return r=!Ve||Ve.type==="first",Ve&&(He=Ve.mode==="text",a=!He&&Ve.type==="mord"&&pe.test(Ve.value),u=!He&&Ve.type==="mord"&&/\d+$/.test(Ve.value),d=!He&&Ve.isFunction,g=Ve.type==="genfrac",b=Ve.type==="surd",x=Ve.type==="mbin",E=Ve.type==="mrel",R=Ve.type==="mop"||Ve.type==="operator"||Ve.type==="extensible-symbol",F=Ve.type==="mpunct"||Ve.type==="minner",Y=Ve.type==="array",oe=Ve.type==="mopen",ge=Ve.type==="mclose"||Ve.type==="leftright",Ot=Ve.type==="space"),i.after.includes("nothing")&&r||i.after.includes("letter")&&a||i.after.includes("digit")&&u||i.after.includes("function")&&d||i.after.includes("frac")&&g||i.after.includes("surd")&&b||i.after.includes("binop")&&x||i.after.includes("relop")&&E||i.after.includes("operator")&&R||i.after.includes("punct")&&F||i.after.includes("array")&&Y||i.after.includes("openfence")&&oe||i.after.includes("closefence")&&ge||i.after.includes("text")&&He||i.after.includes("space")&&Ot?i.value:""}function bu(e,i,r){return r?hd(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 fa(e,i){var r;let a=(r=i==null?void 0:i.format)!=null?r:"auto";return a==="auto"&&([a,e]=fd(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",Gr(e,{inlineShortcuts:i==null?void 0:i.inlineShortcuts})]):["latex",e]}function Gr(e,i){var r,a,u;if(!e)return"";let d=!1,g;const b=(r=i.inlineShortcuts)!=null?r:Ac;if(!d&&(e.startsWith("^")||e.startsWith("_"))&&(g=fo(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[0]+"{"+g.match+"}",e+=Gr(g.rest,i),d=!0),d||(g=e.match(/^(sqrt|\u221A)(.*)/),g&&(g=fo(g[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt{"+((a=g.match)!=null?a:"\\placeholder{}")+"}",e+=Gr(g.rest,i),d=!0)),d||(g=e.match(/^(\\cbrt|\u221B)(.*)/),g&&(g=fo(g[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt[3]{"+((u=g.match)!=null?u:"\\placeholder{}")+"}",e+=Gr(g.rest,i),d=!0)),d||(g=e.match(/^abs(.*)/),g&&(g=fo(g[1],{inlineShortcuts:b,noWrap:!0}),e="\\left|"+g.match+"\\right|",e+=Gr(g.rest,i),d=!0)),d||(g=e.match(/^["”“](.*?)["”“](.*)/),g&&(e="\\text{"+g[1]+"}",e+=Gr(g[2],i),d=!0)),d||(g=e.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/),g&&(e=Hh(g[1],b),e+=Gr(g[2],i),d=!0)),!d&&/^([fgh])[^a-zA-Z]/.test(e)&&(g=fo(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[1]==="("?e[0]+"\\left("+g.match+"\\right)":e[0]+g.match,e+=Gr(g.rest,i),d=!0),d||(g=e.match(/^([a-zA-Z]+)(.*)/),g&&(e=Hh(g[1],b),e+=Gr(g[2],i),d=!0)),!d)if(g=fo(e,{inlineShortcuts:b,noWrap:!0}),g.match&&g.rest[0]==="/"){const x=fo(g.rest.slice(1),{inlineShortcuts:b,noWrap:!0});x.match&&(e="\\frac{"+g.match+"}{"+x.match+"}"+Gr(x.rest,i)),d=!0}else g.match&&(e=e.startsWith("(")?"\\left("+g.match+"\\right)"+Gr(g.rest,i):g.match+Gr(g.rest,i),d=!0);return d||(g=e.match(/^(\s+)(.*)$/),g&&(e=" "+Gr(g[2],i),d=!0)),e}function fo(e,i){let r="";e=e.trim();let a=e,u=e.charAt(0),d={"(":")","{":"}","[":"]"}[u];if(d){let g=1,b=1;for(;b<e.length&&g>0;)e[b]===u&&g++,e[b]===d&&g--,b++;g===0?(i.noWrap&&u==="("?r=Gr(e.substring(1,b-1),i):(u==="{"&&d==="}"&&(u="\\{",d="\\}"),r="\\left"+u+Gr(e.substring(1,b-1),i)+"\\right"+d),a=e.slice(Math.max(0,b))):(r=e.substring(1,b),a="")}else{let g=e.match(/^([a-zA-Z]+)/);if(g){let b=bu(null,e,i.inlineShortcuts);if(b)return b=b.replace("_{#?}",""),b=b.replace("^{#?}",""),{match:b,rest:e.slice(b.length)}}if(g=e.match(/^([a-zA-Z])/),g)return{match:g[1],rest:e.slice(1)};if(g=e.match(/^(-)?\d+(\.\d*)?/),g)return{match:g[0],rest:e.slice(g[0].length)};/^\\(left|right)/.test(e)||(g=e.match(/^(\\[a-zA-Z]+)/),g&&(a=e.slice(g[1].length),r=g[1]))}return{match:r,rest:a}}function Hh(e,i){let r=bu(null,e,i);return r?(r=r.replace("_{#?}",""),r=r.replace("^{#?}",""),r+=" "):r=e,r}var wl=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function Tc(e){const i=e.trim();for(const r of wl)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 fd(e){if(e=e.trim(),e.length<=1)return["latex",e];let i;return[i,e]=Tc(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 Sl="$$",$o="$$",xu=(e,i,r)=>(wl.some(a=>i.startsWith(a[0])&&i.endsWith(a[1]))||(i=`${Sl} ${i} ${$o}`),i),Wh=class Xf{constructor(i){Xf._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 g=new DataTransfer;g.setData("text/plain",a),a=g}const d=new ClipboardEvent("paste",{clipboardData:a,cancelable:!0});return(u=r.host)!=null&&u.dispatchEvent(d)?Xf._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]:Fr(a.selection),d=a.getValue(u,r);navigator.clipboard.writeText(d).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,d=u.selectionIsCollapsed?[0,u.lastOffset]:Fr(u.selection);let g=u.getAtoms(d);if(g.every(b=>b.mode==="text"||!b.mode))r.clipboardData.setData("text/plain",g.filter(b=>b instanceof xl).map(b=>b.value).join(""));else if(g.every(b=>b.mode==="latex"))r.clipboardData.setData("text/plain",u.getAtoms(d,{includeChildren:!0}).map(b=>{var x;return(x=b.value)!=null?x:""}).join(""));else{let b;g.length===1&&g[0].verbatimLatex!==void 0?b=g[0].verbatimLatex:b=u.getValue(d,"latex-expanded"),r.clipboardData.setData("application/x-latex",b);try{r.clipboardData.setData("text/plain",i.options.onExport(i,b,d))}catch(x){}if(g.length===1){const x=g[0];(x.type==="root"||x.type==="group")&&(g=x.body.filter(E=>E.type!=="first"))}try{r.clipboardData.setData("application/json+mathlive",JSON.stringify(g.map(x=>x.toJson())))}catch(x){}if((a=window[Symbol.for("io.cortexjs.compute-engine")])!=null&&a.ComputeEngine){const x=window.MathfieldElement.computeEngine;if(x)try{const E=x.jsonSerializationOptions;x.jsonSerializationOptions={metadata:["latex"]};const R=x.parse(u.getValue(d,"latex-unstyled"));x.jsonSerializationOptions=E;const F=JSON.stringify(R.json);F&&r.clipboardData.setData("application/json",F)}catch(E){}}}r.preventDefault()}static insert(i,r,a={}){var u;const d=a.mode==="auto"?i.mode:(u=a.mode)!=null?u:i.mode;return Xf._modes[d].insert(i,r,a)}onPaste(i,r){return!1}insert(i,r,a){return!1}};Wh._modes={};var Hn=Wh,Lc=[{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","^"]}],jh={"\\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 da(e){var i;return((i=e.element)==null?void 0:i.mathfield)===e}function dd(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 Xs(e){const i=dd(e);if(!i)return null;const r=i.getBoundingClientRect();return{x:r.right,y:r.bottom,height:r.height}}function pd(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,d=i.bottom-i.top,g=Math.ceil(i.left-a.left+e.field.scrollLeft*r),b=Math.ceil(i.top-a.top);return{left:g,right:g+u,top:b,bottom:b+d}}function qh(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 d=qh(u);a.left=Math.min(a.left,d.left),a.right=Math.max(a.right,d.right),a.top=Math.min(a.top,d.top),a.bottom=Math.max(a.bottom,d.bottom)}return a}function Ls(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 d=e.field.querySelector(`[data-atom-id="${i.id}"]`);return u=d?qh(d):null,e.atomBoundsCache&&(u?e.atomBoundsCache.set(i.id,u):e.atomBoundsCache.delete(i.id)),u!=null?u:null}function md(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 d=e.field,g=d.offsetWidth;let x=Math.floor(d.getBoundingClientRect().width)/g;x=isNaN(x)?1:x;const E=Dc(e,Ls(e,u),x);if(E){const R=pd(u);if(a.has(R)){const F=a.get(R);a.set(R,{left:Math.min(F.left,E.left),right:Math.max(F.right,E.right),top:Math.min(F.top,E.top),bottom:Math.max(F.bottom,E.bottom)})}else a.set(R,E)}}return[...a.values()]}function Cc(e,i){return e.model.selection.ranges.reduce((r,a)=>r.concat(...md(e,a,i)),[])}function Mc(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 gd=`@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;
|
|
|
}
|
|
|
`,_d=`.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);
|
|
|
}
|
|
|
`,vd=`#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);
|
|
|
}
|
|
|
`,Zh=`/* 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;
|
|
|
}
|
|
|
`,Fs=`/* 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);*/
|
|
|
}
|
|
|
`,pa=`.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));
|
|
|
}
|
|
|
`,yd=`: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;
|
|
|
}
|
|
|
`,bd=`.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;
|
|
|
}
|
|
|
`,Ma;function po(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=_d;break;case"mathfield":i=gd;break;case"environment-popover":i=vd;break;case"suggestion-popover":i=Zh;break;case"keystroke-caption":i=Fs;break;case"virtual-keyboard":i=pa;break;case"ui":i=yd;break;case"menu":i=bd;break;default:debugger}return i}function Ko(e){return Ma||(Ma={}),Ma[e]||(Ma[e]=new CSSStyleSheet,Ma[e].replaceSync(po(e))),Ma[e]}var ma;function os(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(po(e))),window.document.head.appendChild(r);return}if(ma||(ma={}),((i=ma[e])!=null?i:0)!==0)ma[e]+=1;else{const r=Ko(e);document.adoptedStyleSheets=[...document.adoptedStyleSheets,r],ma[e]=1}}function ga(e){if("adoptedStyleSheets"in document&&ma!=null&&ma[e]&&(ma[e]-=1,ma[e]<=0)){const i=Ma[e];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r!==i)}}var wu=class Mp extends dt{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 Mp(i)}toJson(){return f(P({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(i){var r;const a=new ln({parent:i,mathstyle:"cramp"},this.style),u=(r=dt.createBox(a,this.body))!=null?r:new Bt("\u25A2",{style:this.style});let d=0;!this.hasEmptyBranch("body")&&this.body.length===2&&this.body[1].isCharacterBox()&&(d=u.skew);let g=Math.min(u.height,Da),b;if(this.svgAccent)b=yl(this.svgAccent),g=a.metrics.bigOpSpacing1-g;else if(this.accent){const E=new Bt(this.accent,{fontFamily:"Main-Regular"});E.italic=0;const R=this.accent===8407?" ML__accent-vec":"";b=new Bt(new Bt(E),{classes:"ML__accent-body"+R})}b=new wr({shift:0,children:[{box:new Bt(u)},-g,{box:b,marginLeft:u.left+2*d,classes:["ML__center"]}]});const x=new Bt(b,{type:"lift"});return this.caret&&(x.caret=this.caret),this.bind(a,x.wrap(a)),this.attachSupsub(a,{base:x})}},Su={"(":")","{":"}","[":"]","|":"|","\\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"},Uo=Object.fromEntries(Object.entries(Su).map(([e,i])=>[i,e]));function El(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 Yh(e,i,r,a){var u;const g=new Bt(El(e),{fontFamily:"Main-Regular",isSelected:a.isSelected,classes:"ML__small-delim "+((u=a.classes)!=null?u:"")}).wrap(i);return r&&g.setTop((1-i.scalingFactor)*As),g}function kl(e,i,r,a,u){var d,g;const b=new ln({parent:a,mathstyle:"textstyle"},u==null?void 0:u.style),x=new Bt(El(e),{fontFamily:`Size${i}-Regular`,isSelected:u.isSelected,classes:((d=u.classes)!=null?d:"")+` ML__delim-size${i}`,type:(g=u.type)!=null?g:"ignore"}).wrap(b);return r&&x.setTop((1-b.scalingFactor)*As),x}function Xh(e,i,r,a,u){var d;let g,b,x,E;g=x=E=El(e),b=null;let R="Size1-Regular";e==="\\vert"||e==="\\lvert"||e==="\\rvert"||e==="\\mvert"||e==="\\mid"?x=g=E=8739:e==="\\Vert"||e==="\\lVert"||e==="\\rVert"||e==="\\mVert"||e==="\\|"?x=g=E=8741:e==="\\uparrow"?x=E=9168:e==="\\Uparrow"?x=E=8214:e==="\\downarrow"?g=x=9168:e==="\\Downarrow"?g=x=8214:e==="\\updownarrow"?(g=8593,x=9168,E=8595):e==="\\Updownarrow"?(g=8657,x=8214,E=8659):e==="["||e==="\\lbrack"?(g=9121,x=9122,E=9123,R="Size4-Regular"):e==="]"||e==="\\rbrack"?(g=9124,x=9125,E=9126,R="Size4-Regular"):e==="\\lfloor"||e==="\u230A"?(x=g=9122,E=9123,R="Size4-Regular"):e==="\\lceil"||e==="\u2308"?(g=9121,x=E=9122,R="Size4-Regular"):e==="\\rfloor"||e==="\u230B"?(x=g=9125,E=9126,R="Size4-Regular"):e==="\\rceil"||e==="\u2309"?(g=9124,x=E=9125,R="Size4-Regular"):e==="("||e==="\\lparen"?(g=9115,x=9116,E=9117,R="Size4-Regular"):e===")"||e==="\\rparen"?(g=9118,x=9119,E=9120,R="Size4-Regular"):e==="\\{"||e==="\\lbrace"?(g=9127,b=9128,E=9129,x=9130,R="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(g=9131,b=9132,E=9133,x=9130,R="Size4-Regular"):e==="\\lgroup"||e==="\u27EE"?(g=9127,E=9129,x=9130,R="Size4-Regular"):e==="\\rgroup"||e==="\u27EF"?(g=9131,E=9133,x=9130,R="Size4-Regular"):e==="\\lmoustache"||e==="\u23B0"?(g=9127,E=9133,x=9130,R="Size4-Regular"):e==="\\rmoustache"||e==="\u23B1"?(g=9131,E=9129,x=9130,R="Size4-Regular"):e==="\\surd"?(g=57345,E=9143,x=57344,R="Size4-Regular"):e==="\\ulcorner"?(g=9484,x=E=32):e==="\\urcorner"?(g=9488,x=E=32):e==="\\llcorner"?(E=9492,x=g=32):e==="\\lrcorner"&&(g=9496,x=g=32);const F=Fo(g,R),Y=F.height+F.depth,oe=Fo(x,R),ge=oe.height+oe.depth,He=Fo(E,R),Ot=He.height+He.depth;let Ve=0,wt=1;if(b!==null){const Nr=Fo(b,R);Ve=Nr.height+Nr.depth,wt=2}const $t=Y+Ot+Ve,At=Math.max(0,Math.ceil((i-$t)/(wt*ge))),si=$t+At*wt*ge;let _i=As;r&&(_i=_i*a.scalingFactor);const ci=si/2-_i,cn=.008,Fn=[];Fn.push({box:new Bt(E,{fontFamily:R})}),Fn.push(-cn);const Wt=new Bt(x,{fontFamily:R});if(b===null)for(let Nr=0;Nr<At;Nr++)Fn.push({box:Wt});else{for(let Nr=0;Nr<At;Nr++)Fn.push({box:Wt});Fn.push(-cn),Fn.push({box:new Bt(b,{fontFamily:R})}),Fn.push(-cn);for(let Nr=0;Nr<At;Nr++)Fn.push({box:Wt})}Fn.push(-cn),Fn.push({box:new Bt(g,{fontFamily:R})});let Ns="";R==="Size1-Regular"?Ns=" delim-size1":R==="Size4-Regular"&&(Ns=" delim-size4");const Ua=new wr({bottom:ci,children:Fn},{classes:Ns});return new Bt(Ua,f(P({},u!=null?u:{}),{classes:((d=u==null?void 0:u.classes)!=null?d:"")+" ML__delim-mult"}))}var Jh=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","\u230A","\u230B","\u2308","\u2309"]),Ic=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","\u27EE","\u27EF","\u23B0","\u23B1"]),Qh=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),ef=[0,1.2,1.8,2.4,3];function xd(e,i,r,a){return e===void 0||e==="."?_a(r,a.classes):(e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle"),Jh.has(e)||Qh.has(e)?kl(e,i,!1,r,a):Ic.has(e)?Xh(e,ef[i],!1,r,a):(console.assert(!1,"Unknown delimiter '"+e+"'"),null))}var tf=[{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}],Pc=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],Eu=[{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 wd(e){return e.type==="small"?"Main-Regular":e.type==="large"?"Size"+e.size+"-Regular":(console.assert(e.type==="stack"),"Size4-Regular")}function nf(e,i,r,a){const u={"-4":0,"-3":1,0:2}[a.mathstyle.sizeDelta];for(let d=u;d<r.length&&r[d].type!=="stack";d++){const g=Fo(e,wd(r[d]));if(g.defaultMetrics)return{type:"small",mathstyle:"scriptstyle"};let b=g.height+g.depth;if(r[d].type==="small"&&(r[d].mathstyle==="scriptscriptstyle"?b*=Math.max(hu[Math.max(1,a.size-2)],a.minFontScale):r[d].mathstyle==="scriptstyle"&&(b*=Math.max(hu[Math.max(1,a.size-1)],a.minFontScale))),b>i)return r[d]}return r[r.length-1]}function ku(e,i,r,a,u,d){if(!i||i.length===0||i===".")return _a(u);i==="<"||i==="\\lt"?i="\\langle":(i===">"||i==="\\gt")&&(i="\\rangle");let g;Qh.has(i)?g=tf:Jh.has(i)?g=Eu:g=Pc;const b=nf(El(i),r,g,u),x=new ln({parent:u,mathstyle:b.mathstyle},d==null?void 0:d.style);return b.type==="small"?Yh(i,x,a,f(P({},d),{type:e})):b.type==="large"?kl(i,b.size,a,x,f(P({},d),{type:e})):(console.assert(b.type==="stack"),Xh(i,r,a,x,f(P({},d),{type:e})))}function Al(e,i,r,a,u,d){if(i===".")return _a(u,d==null?void 0:d.classes);const g=As*u.scalingFactor,b=901,x=5/no,E=Math.max(r-g,a+g),R=Math.max(E/500*b,2*E-x);return ku(e,i,R,!0,u,d)}function _a(e,i){const r=new Bt(null,{classes:" nulldelimiter "+(i!=null?i:""),type:"ignore"});return r.width=e.getRegisterAsEm("nulldelimiterspace"),r.wrap(new ln({parent:e,mathstyle:"textstyle"}))}var va=class Rp extends dt{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 Rp(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{}"}},Au=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],rf=["cases","dcases","rcases"],sf=["align","align*","aligned","gather","gathered","split"],Oc=["array","subequations","eqnarray"];function af(e){return Oc.concat(sf).concat(rf).concat(Au).includes(e)}function Fc(e){return Au.includes(e)}function Sd(e){return rf.includes(e)}function of(e){return sf.includes(e)}function Ed(e,i,r){let a=0;for(const E of r)"align"in E&&(a+=1);let u=0;const d=[];for(const E of i){let R=0;for(u=Math.max(u,Math.min(E.length,a));R<E.length;){const F=[],Y=Math.min(E.length,R+a);for(;R<Y;){const oe=E[R];oe.length===0?F.push([new dt({type:"first",mode:e.mode})]):oe[0].type!=="first"?F.push([new dt({type:"first",mode:e.mode}),...oe]):(console.assert(!oe.slice(1).some(ge=>ge.type==="first")),F.push(oe)),R+=1}d.push(F)}}d.length>0&&d[d.length-1].length===1&&d[d.length-1][0].length===1&&d[d.length-1][0][0].type==="first"&&d.pop();const g=[];for(const E of d){if(E.length!==u)for(let R=E.length;R<u;R++)E.push([new dt({type:"first",mode:e.mode}),new va]);g.push(E)}let b=0,x=0;for(const E of g){x=0;for(const R of E){for(const F of R)F.parent=e,F.parentBranch=[b,x];x+=1}b+=1}return e.isDirty=!0,g}var _n=class Ip extends dt{constructor(i,r,a,u={}){var d;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=Ed(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=(d=u.minColumns)!=null?d:1}static fromJson(i){return new Ip(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(yu(i))return(r=this.array[i[0]][i[1]])!=null?r:void 0}createBranch(i){var r;return yu(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(ho(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,d,g,b;const x=new ln({parent:i,mathstyle:this.mathstyleName},this.style),E=x.getRegisterAsEm("arrayrulewidth"),R=x.getRegisterAsEm("arraycolsep"),F=x.getRegisterAsEm("doublerulesep"),Y=(a=(r=this.arraystretch)!=null?r:x.getRegisterAsNumber("arraystretch"))!=null?a:1;let oe=typeof this.arraycolsep=="number"?this.arraycolsep:R;this.colSeparationType==="small"&&(oe=.2778*(new ln({parent:i,mathstyle:"scriptstyle"}).scalingFactor/i.scalingFactor));const ge=Y*Ph,He=.7*ge,Ot=.3*ge;let Ve=0;const wt=[];let $t=0;const At=this.array.length;for(let Vn=0;Vn<At;++Vn){const br=this.array[Vn];$t=Math.max($t,br.length);const $r=new ln({parent:x,mathstyle:this.mathstyleName},this.style);let za=He/$r.scalingFactor,Va=Ot/$r.scalingFactor;const Ga={cells:[],height:0,depth:0,pos:0};for(const Sa of br){const p0=(u=dt.createBox($r,Sa,{type:"ignore"}))!=null?u:new Bt(null,{type:"ignore"});Va=Math.max(Va,p0.depth),za=Math.max(za,p0.height),Ga.cells.push(p0)}let Ha=(d=zh(this.rowGaps[Vn]))!=null?d:0;Ha>0&&(Ha+=Ot,Va=Math.max(Va,Ha),Ha=0),Vn<At-1&&!Fc(this.environmentName)&&this.environmentName!=="cases"&&this.environmentName!=="array"&&(Va+=x.getRegisterAsEm("jot")),Ga.height=za,Ga.depth=Va,Ve+=za,Ga.pos=Ve,Ve+=Va+Ha,wt.push(Ga)}const si=Ve/2+As,_i=[];for(let Vn=0;Vn<$t;Vn++){const br=[];for(const $r of wt){const za=$r.cells[Vn];za.depth=$r.depth,za.height=$r.height,br.push({box:za,shift:$r.pos-si})}br.length>0&&_i.push(new wr({individualShift:br}))}const ci=[];let cn=!1,Fn=!1,Wt=0,Ns=!this.leftDelim;const{colFormat:Ua}=this;for(const Vn of Ua){if("align"in Vn&&Wt>=_i.length)break;if("align"in Vn)cn?ci.push(Ll(2*oe)):(Fn||Ns)&&ci.push(Ll(oe)),ci.push(new Bt(_i[Wt],{classes:"col-align-"+Vn.align})),Wt++,cn=!0,Fn=!1,Ns=!1;else if("gap"in Vn){if(typeof Vn.gap=="number")ci.push(Ll(Vn.gap));else{const br=kd(i,wt,si,Vn.gap);br&&ci.push(br)}cn=!1,Fn=!1,Ns=!1}else if("separator"in Vn){const br=new Bt(null,{classes:"vertical-separator"});br.height=Ve,br.setStyle("height",Ve,"em"),br.setStyle("border-right",`${E}em ${Vn.separator} currentColor`),br.setStyle("vertical-align",-(Ve-si),"em");let $r=0;Fn?$r=F-E:cn&&($r=oe-E),br.left=$r,ci.push(br),cn=!1,Fn=!0,Ns=!1}}cn&&!this.rightDelim&&ci.push(Ll(oe));const ta=new Bt(ci,{classes:"mtable"});if((!this.leftDelim||this.leftDelim===".")&&(!this.rightDelim||this.rightDelim==="."))return this.caret&&(ta.caret=this.caret),this.bind(i,ta);const Nr=ta.height,$s=ta.depth,bs=this.bind(i,new Bt([this.bind(i,Al("open",(g=this.leftDelim)!=null?g:".",Nr,$s,x,{isSelected:this.isSelected})),ta,this.bind(i,Al("close",(b=this.rightDelim)!=null?b:".",Nr,$s,x,{isSelected:this.isSelected}))],{type:"ord"}));return bs?(bs.setStyle("display","inline-block"),this.caret&&(bs.caret=this.caret),this.bind(i,this.attachSupsub(i,{base:bs}))):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 d=0;d<this.array[u].length;d++)d>0&&a.push(" & "),a.push(dt.serialize(this.array[u][d],i));if(u<this.array.length-1){const d=this.rowGaps[u];d!=null&&d.dimension?a.push(`\\\\[${d.dimension} ${(r=d.unit)!=null?r:"pt"}] `):a.push("\\\\ ")}}return this.environmentName==="lines"?a.push("}"):a.push(`\\end{${this.environmentName}}`),fn(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 d of this.array[i][r])d.parent=void 0,d.parentBranch=void 0;let u=a;(a.length===0||a[0].type!=="first")&&(u=[new dt({type:"first",mode:this.mode}),...a]),this.array[i][r]=u;for(const d of u)d.parent=this,d.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(Tl(this));this.array.splice(i,0,r);for(let a=i;a<this.rowCount;a++)for(let u=0;u<this.colCount;u++){const d=this.array[a][u];if(d)for(const g of d)g.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(Tl(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 d=this.array[a][u];if(d)for(const g of d)g.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 d of u)d.parent=void 0,d.parentBranch=void 0;for(let a=i;a<this.rowCount;a++)for(let u=0;u<this.colCount;u++){const d=this.array[a][u];if(d)for(const g of d)g.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,Tl(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 d of u)d.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,Tl(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 d of u)d.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 d of u)d.parent=void 0,d.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 d of u)d.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 Tl(e){const i=new dt({type:"first",mode:e.mode});i.parent=e;const r=new va;return r.parent=e,[i,r]}function Ll(e){const i=new Bt(null,{classes:"arraycolsep"});return i.width=e,i}function kd(e,i,r,a){if(!a)return null;const u=[];for(const d of i){const g=dt.createBox(e,a,{type:"ignore"});g&&(g.depth=d.depth,g.height=d.height,u.push({box:g,shift:d.pos-r}))}return new wr({individualShift:u}).wrap(e)}var Js=class Pp extends dt{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 Pp(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,d;const g=dt.createBox(i,this.body,{type:"lift"});if(!g)return null;const b=i.toEm((r=this.offset)!=null?r:{dimension:0});g.depth+=b,g.setStyle("display","inline-block"),g.setStyle("position","relative"),g.setStyle("height",Math.floor(100*g.height+g.depth)/100,"em"),g.setStyle("vertical-align",-Math.floor(100*g.height)/100,"em");const x=new ln({parent:i},this.style),E=x.toEm((a=this.padding)!=null?a:{register:"fboxsep"}),R=new Bt(null,{classes:"ML__box"});R.height=g.height+E,R.depth=g.depth+E,R.setStyle("box-sizing","border-box"),R.setStyle("position","absolute"),R.setStyle("top",-E+.3,"em"),R.setStyle("left",0),R.setStyle("height",R.height+R.depth,"em"),R.setStyle("width","100%"),this.backgroundcolor&&R.setStyle("background-color",(u=x.toColor(this.backgroundcolor))!=null?u:"transparent"),this.framecolor&&R.setStyle("border",`${x.getRegisterAsEm("fboxrule",2)}em solid ${(d=x.toColor(this.framecolor))!=null?d:"black"}`),this.border&&R.setStyle("border",this.border);const F=new Bt([R,g],{type:"lift"});return F.setStyle("display","inline-block"),F.setStyle("position","relative"),F.setStyle("line-height",0),F.height=g.height+E+(b>0?b:0),F.depth=g.depth+E+(b<0?-b:0),F.setStyle("padding-left",E,"em"),F.setStyle("padding-right",E,"em"),F.setStyle("height",Math.floor(100*(g.height+g.depth+2*E+Math.abs(b)))/100,"em"),F.setStyle("margin-top",-E,"em"),F.setStyle("top",Math.floor(100*(g.depth-g.height+2*E-b))/100,"em"),F.setStyle("vertical-align",Math.floor(100*(g.depth+2*E))/100,"em"),this.caret&&(F.caret=this.caret),this.attachSupsub(i,{base:F})}_serialize(i){return i.skipStyles?fn([this.bodyToLatex(i),this.supsubToLatex(i)]):super._serialize(i)}},Bc=class Op extends dt{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 Op(i.value,i)}toJson(){return super.toJson()}get computedStyle(){return{}}render(i){const r=new Bt(this.value,{classes:"ML__composition",type:"composition"});return this.bind(i,r),this.caret&&(r.caret=this.caret),r}_serialize(i){return""}},ya=class Fp extends dt{constructor(i){super({type:"error",value:i,command:i,mode:"math"}),this.verbatimLatex=i}static fromJson(i){return new Fp(i.command)}toJson(){return super.toJson()}render(i){const r=this.createBox(i,{classes:"ML__error"});return this.caret&&(r.caret=this.caret),r}},lf=class Bp extends dt{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 Bp(i.body,i.mode,i.style)}render(i){const r=dt.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=Re(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):`{${this.bodyToLatex(i)}}`}},or=class Np extends dt{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 Np((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"?fn(["\\left",(r=this.leftDelim)!=null?r:".",this.bodyToLatex(i),"\\right",u]):this.variant==="mleft...mright"?fn(["\\mleft",(a=this.leftDelim)!=null?a:".",this.bodyToLatex(i),"\\mright",u]):fn([!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=Su[a])!=null?r:a}render(i){var r,a;const u=new ln({parent:i},this.style);console.assert(this.body!==void 0);const d=new ln({parent:i,mathstyle:"textstyle"},this.style),g=(r=dt.createBox(u,this.body,{type:"inner"}))!=null?r:new Bt(null,{type:"inner"}),b=g.height/d.scalingFactor,x=g.depth/d.scalingFactor,E=[];if(this.leftDelim&&E.push(this.bind(d,Al("open",this.leftDelim,b,x,d,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),g&&(Dl(g.children,this,u,b,x),E.push(g)),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(d,Al("close",ge,b,x,d,{isSelected:this.isSelected,classes:oe+" ML__close",mode:this.mode,style:this.style})))}let R=this.variant==="mleft...mright";const F=this.leftSibling;F&&(!R&&F.isFunction&&(R=!0),!R&&F.type==="subsup"&&((a=F.leftSibling)!=null&&a.isFunction)&&(R=!0));const Y=new Bt(E,{type:R?"close":"inner",classes:"left-right"});return Y.setStyle("margin-top",`${-g.depth}em`),Y.setStyle("height",`${g.height+g.depth}em`),this.caret&&(Y.caret=this.caret),this.bind(u,Y.wrap(u))}};function Dl(e,i,r,a,u){if(e)for(let d=0;d<e.length;d++){const g=e[d];g.type==="middle"?(e[d]=i.bind(r,Al("inner",g.value,a,u,r,{isSelected:i.isSelected})),e[d].caret=g.caret,e[d].isSelected=g.isSelected,e[d].cssId=g.cssId,e[d].htmlData=g.htmlData,e[d].htmlStyle=g.htmlStyle,e[d].attributes=g.attributes,e[d].cssProperties=g.cssProperties):g.children&&Dl(g.children,i,r,a,u)}}var uf=class $p extends dt{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 $p(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=dt.createBox(i,this.body);return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}},cf=class Kp extends dt{constructor(){super({type:"macro-argument"})}static fromJson(i){return new Kp}toJson(){return super.toJson()}_serialize(i){return""}render(i){return null}},Nc=class Up extends dt{constructor(i,r,a=!1,u,d){var g;super({type:"prompt",mode:(g=d==null?void 0:d.mode)!=null?g:"math",style:d==null?void 0:d.style,command:"\\placeholder"}),this.body=u,this.correctness=r,this.placeholderId=i,this.locked=a,this.captureSelection=this.locked}static fromJson(i){return new Up(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 ln({parent:i}),a=r.getRegisterAsEm("fboxsep"),u=a,d=a,g=dt.createBox(i,this.body);if(!g)return null;g.height||(g.height=r.metrics.xHeight),g.setStyle("vertical-align",-g.height,"em"),this.correctness==="correct"?g.setStyle("color","var(--correct-color, var(--ML__correct-color))"):this.correctness==="incorrect"&&g.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");const b=new Bt(g,{type:"ord"});b.setStyle("display","inline-block"),b.setStyle("height",g.height+g.depth,"em"),b.setStyle("vertical-align",-d,"em");let x="ML__prompt ";this.locked?x+=" ML__lockedPromptBox ":x+=" ML__editablePromptBox ",this.correctness==="correct"?x+=" ML__correctPromptBox ":this.correctness==="incorrect"&&(x+=" ML__incorrectPromptBox "),this.containsCaret&&(x+=" ML__focusedPromptBox ");const E=new Bt(null,{classes:x,attributes:{part:"prompt"}});E.height=b.height+d,E.depth=b.depth+d,E.width=b.width+2*u,E.setStyle("box-sizing","border-box"),E.setStyle("position","absolute"),E.setStyle("height",b.height+b.depth+2*d,"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 R="";this.correctness==="incorrect"&&(R+='<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'),R&&(E.svgOverlay=R);const F=new Bt([E,b],{classes:"ML__prompt-atom"});return F.setStyle("position","relative"),F.setStyle("display","inline-block"),F.setStyle("line-height",0),F.height=b.height+d+.2,F.depth=b.depth+d,F.left=u,F.right=u,F.setStyle("height",b.height+d,"em"),F.setStyle("top",b.depth-b.height,"em"),F.setStyle("vertical-align",b.depth+d,"em"),F.setStyle("margin-left",.5,"em"),F.setStyle("margin-right",.5,"em"),this.caret&&(F.caret=this.caret),this.bind(r,this.attachSupsub(i,{base:F}))}_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]"),On(u,a)}},Tu=class zp extends dt{constructor(i){super({type:"subsup",style:i==null?void 0:i.style}),this.subsupPlacement="auto"}static fromJson(i){const r=new zp(i);for(const a of co)i[a]&&r.setChildren(i[a],a);return r}render(i){var r;const a=new ln({parent:i,isPhantom:!0}),u=this.leftSibling,d=(r=u.render(a))!=null?r:new Bt(null),g=new Bt(null);return g.height=d.height,g.depth=d.depth,this.attachSupsub(i,{base:g,isCharacterBox:u.isCharacterBox(),type:"ignore"})}_serialize(i){return this.supsubToLatex(i)}};function mo(e){return e?!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(e):!1}var hf=class{constructor(e,i,r){this.errors=[],this.index=0,this.endCount=0;var a,u,d,g;r!=null||(r={}),this.tokens=e,this.context=i instanceof ln&&!(r!=null&&r.parseMode)&&!r.mathstyle?i:new ln({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:(d=r.parseMode)!=null?d:"math",mathstyle:(g=r.mathstyle)!=null?g:"displaystyle",tabular:!1}}beginContext(e){var i,r,a;const u=this.parsingContext,d={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=d}endContext(){this.parsingContext=this.parsingContext.parent}onError(e){this.errors.push(P({before:so(this.tokens.slice(this.index,this.index+10)),after:so(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 Tu({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=Re(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?Zr(i,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new va({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 d=this.get();mo(d)?(a+=d,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(mo(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 d=10,g=/\d/;if(this.match("'"))d=8,g=/[0-7]/,e=!0;else if(this.match('"'))d=16,g=/[\dA-F]/,e=!0;else if(this.match("x"))d=16,g=/[\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(g);)b+=this.get();if(!e&&(this.match(".")||this.match(",")))for(b+=".";this.hasPattern(g);)b+=this.get();const x=e?Number.parseInt(b,d):Number.parseFloat(b);return Number.isNaN(x)?null:{number:a?-x:x,base:d===16?"hexadecimal":d===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 d=this.peek();if(d==="-")a=!a;else if(d!=="+")break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();const d=this.get();return d.startsWith("\\")?r?{register:d,global:!0,factor:(a?-1:1)*r.number}:a?{register:d,global:!0,factor:-1}:{register:d,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()||!mo(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=ve(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 x=this.scanArgument(b.type);x||this.onError({code:"missing-argument",arg:e}),r.push(x)}this.beginContext({tabular:i.tabular});const a=[],u=[];let d=[],g=!1;do if(this.end()&&(this.onError({code:"unbalanced-environment",arg:e}),g=!0),!g&&this.match("\\end")&&(this.scanArgument("string")!==e&&this.onError({code:"unbalanced-environment",arg:e}),g=!0),!g)if(this.matchColumnSeparator())d.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){d.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(d),d=[]}else this.mathlist.push(...this.scan(b=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(b)));while(!g);return d.push(this.mathlist),d.length>0&&a.push(d),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=g=>g==="<}>");let i="",r=null,a=[],u=null;for(;!this.end()&&!e(this.peek());)this.hasInfixCommand()&&!i?(i=this.get(),r=Re(i,"math"),r&&(a=this.scanArguments(r)[1]),u=this.mathlist,this.mathlist=[]):this.parseExpression();let d;return i?(console.assert(!!r),a.unshift(this.mathlist),u&&a.unshift(u),d=[r.createAtom({command:i,args:a,style:this.style,mode:this.parseMode})]):d=this.mathlist,this.endContext(),d}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 lf(i,this.parseMode,this.style);return r.verbatimLatex=so(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 or("",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(!mo(e)&&!e.startsWith("\\"))return null;this.next();const i=Re(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 ya("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new ya("\\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 ya(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 or(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 dt({type:"mord",command:"\\doubleprime",mode:"math",value:"\u2032\u2032"}),"superscript"):i.addChild(new dt({type:"mord",command:"\\prime",mode:"math",value:"\u2032"}),"superscript"):(this.match("^")||this.match("_"))&&i.addChildren(Pe(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(d=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(d))):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(mo(e)){const r=_s.createAtom(this.parseMode,e,P({},this.style));return r?[r]:null}if(i=this.scanMacro(e),i)return[i];if(e.startsWith("\\")){const r=Re(e,this.parseMode);if(!r)return this.onError({code:"unknown-command",arg:e}),[new ya(e)];if(r.definitionType==="symbol"){const a=P({},this.style);r.variant&&(a.variant=r.variant),i=new dt({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 ya(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 d=u.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(d)r.padding={dimension:parseInt(d[1]),unit:d[2]};else{const g=u.match(/^\s*border\s*:\s*(.*)/);g?r.border=g[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"),x=this.scanOptionalArgument("math"),E=dt.serialize(x,{defaultMode:"math"});let R=[],F;!F&&E==="correct"?F="correct":!F&&E==="incorrect"?F="incorrect":E!==""&&(R=x);const Y=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=R,b?[new Nc(b,F,Y,ge!=null?ge:R,{mode:this.parseMode,style:this.style})]:[new va({mode:this.parseMode,style:this.style})]}if(e==="\\renewcommand"||e==="\\newcommand"||e==="\\providecommand"||e==="\\def"){const b=this.index,x=this.scanLiteralGroup()||this.next();if(!x)return null;if(this.context.registers[x.substring(1)]){const E=this.scanArgument("string");E!==null&&(this.context.registers[x.substring(1)]=E);const R=fn([e,so(this.tokens.slice(b,this.index))]);return[new dt({type:"text",value:"",verbatimLatex:R})]}}let u=this.scanMacro(e);if(u)return[u];const d=Re(e,this.parseMode);if(!d)return this.parseMode==="text"?(/[a-zA-Z]/.test((i=this.peek())!=null?i:"")&&(e+=" "),[...e].map(b=>new dt({type:"text",value:b,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:e}),[new ya(e)]);const g=this.index;if(d.definitionType==="symbol"){const b=P({},this.style);d.variant&&(b.variant=d.variant),u=new dt({type:d.type,command:e,style:b,value:String.fromCodePoint(d.codepoint),mode:this.parseMode})}else{if(d.ifMode&&!d.ifMode.includes(this.parseMode))return[];const b=this.parseMode;d.applyMode&&(this.parseMode=d.applyMode);let x,E=[];if(d.parse?E=d.parse(this):[x,E]=this.scanArguments(d),this.parseMode=b,d.applyMode&&!d.applyStyle&&!d.createAtom)return Pe(E[0]);if(d.infix)return this.onError({code:"too-many-infix-commands",arg:e}),null;if(typeof d.createAtom=="function")u=d.createAtom({command:e,args:E,style:this.style,mode:this.parseMode}),x&&(u.body=Pe(this.scanArgument(x)));else if(typeof d.applyStyle=="function"){const R=P(P({},this.style),d.applyStyle(e,E,this.context)),F=this.parseMode;if(d.applyMode&&(this.parseMode=d.applyMode),x){const Y=this.style;this.style=R;const oe=this.scanArgument(x);return this.style=Y,this.parseMode=F,Pe(oe)}this.style=R}else u=new dt({type:"mord",command:(r=d.command)!=null?r:e,style:P({},this.style),value:e,mode:(a=d.applyMode)!=null?a:this.parseMode})}if(!u)return null;if(u instanceof dt&&u.verbatimLatex===void 0&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){const b=fn([e,so(this.tokens.slice(g,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(mo(e)){const i=_s.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 xl(" "," ",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,d={"?":(i=this.args)==null?void 0:i.call(this,"?")};for(let g=1;g<=u;g++){let b=this.scanLiteralGroup();if(!b){const x=this.index;this.scanExpression(),b=so(this.tokens.slice(x,this.index))}d[g]=b}return new uf(e,{expand:r.expand,captureSelection:r.captureSelection,args:a===this.index?null:so(this.tokens.slice(a,this.index)),style:this.parsingContext.style,body:Zr(r.def,{context:this.context,parseMode:this.parseMode,args:g=>d[g],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 Zr(e,i){var r,a,u,d;const g=(r=i==null?void 0:i.args)!=null?r:void 0,b=new hf(yc(e,g),i==null?void 0:i.context,{args:g,mathstyle:(a=i==null?void 0:i.mathstyle)!=null?a:"displaystyle",parseMode:(u=i==null?void 0:i.parseMode)!=null?u:"math",style:(d=i==null?void 0:i.style)!=null?d:{}}),x=[];for(;!b.end();)x.push(...b.scan(()=>!1));return x}function ff(e,i){var r;const a=new hf(yc(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 df=class Vp extends dt{constructor(i,r){super({type:"chem"},{command:i,mode:"math"});const a=qn.go(Mt.go(r,i==="\\pu"?"pu":"ce"),!1);this.body=Zr(a),this._verbatimLatex=i+"{"+r+"}",this.arg=r,this.captureSelection=!0}static fromJson(i){return new Vp(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=dt.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 df(e.command,(i=e.args[0])!=null?i:"")}});var Mt={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,d=10,g=[];;){u!==e?(d=10,u=e):d--;var b=Mt.stateMachines[i],x=b.transitions[r]||b.transitions["*"];e:for(var E=0;E<x.length;E++){var R=Mt.patterns.match_(x[E].pattern,e);if(R){for(var F=x[E].task,Y=0;Y<F.action_.length;Y++){var oe;if(b.actions[F.action_[Y].type_])oe=b.actions[F.action_[Y].type_](a,R.match_,F.action_[Y].option);else if(Mt.actions[F.action_[Y].type_])oe=Mt.actions[F.action_[Y].type_](a,R.match_,F.action_[Y].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+F.action_[Y].type_+")"];Mt.concatArray(g,oe)}if(r=F.nextState||r,e.length>0){if(F.revisit||(e=R.remainder),!F.toContinue)break e}else return g}}if(d<=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=Mt.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 Mt.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return Mt.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return Mt.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return Mt.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return Mt.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return Mt.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return Mt.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return Mt.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return Mt.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return Mt.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return Mt.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return Mt.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return Mt.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 Mt.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return Mt.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return Mt.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return Mt.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 Mt.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return Mt.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return Mt.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return Mt.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return Mt.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return Mt.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return Mt.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return Mt.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=Mt.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,d,g,b,x,E){var R=function(Ve,wt){if(typeof wt=="string")return Ve.indexOf(wt)!==0?null:wt;var $t=Ve.match(wt);return $t?$t[0]:null},F=function(Ve,wt,$t){for(var At=0;wt<Ve.length;){var si=Ve.charAt(wt),_i=R(Ve.substr(wt),$t);if(_i!==null&&At===0)return{endMatchBegin:wt,endMatchEnd:wt+_i.length};if(si==="{")At++;else if(si==="}"){if(At===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];At--}wt++}return At>0,null},Y=R(e,i);if(Y===null||(e=e.substr(Y.length),Y=R(e,r),Y===null))return null;var oe=F(e,Y.length,a||u);if(oe===null)return null;var ge=e.substring(0,a?oe.endMatchEnd:oe.endMatchBegin);if(d||g){var He=this.findObserveGroups(e.substr(oe.endMatchEnd),d,g,b,x);if(He===null)return null;var Ot=[ge,He.match_];return{match_:E?Ot.join(""):Ot,remainder:He.remainder}}else return{match_:ge,remainder:e.substr(oe.endMatchEnd)}},match_:function(e,i){var r=Mt.patterns.patterns[e];if(r===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if(typeof r=="function")return Mt.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 Mt.go(i,"text")},"{text}":function(e,i){var r=["{"];return Mt.concatArray(r,Mt.go(i,"text")),r.push("}"),r},"tex-math":function(e,i){return Mt.go(i,"tex-math")},"tex-math tight":function(e,i){return Mt.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 Mt.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 Mt.go(i,"9,9")}},createTransitions:function(e){var i,r,a,u,d={};for(i in e)for(r in e[i])for(a=r.split("|"),e[i][r].stateArray=a,u=0;u<a.length;u++)d[a[u]]=[];for(i in e)for(r in e[i])for(a=e[i][r].stateArray||[],u=0;u<a.length;u++){var g=e[i][r];if(g.action_){g.action_=[].concat(g.action_);for(var b=0;b<g.action_.length;b++)typeof g.action_[b]=="string"&&(g.action_[b]={type_:g.action_[b]})}else g.action_=[];for(var x=i.split("|"),E=0;E<x.length;E++)if(a[u]==="*")for(var R in d)d[R].push({pattern:x[E],task:g});else d[a[u]].push({pattern:x[E],task:g})}return d},stateMachines:{}};Mt.stateMachines={ce:{transitions:Mt.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 Mt.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 Mt.concatArray(r,this.output(e)),Mt.concatArray(r,Mt.actions.bond(e,i,"-")),r}else e.d=i},"- after o/d":function(e,i,r){var a=Mt.patterns.match_("orbital",e.o||""),u=Mt.patterns.match_("one lowercase greek letter $",e.o||""),d=Mt.patterns.match_("one lowercase latin letter $",e.o||""),g=Mt.patterns.match_("$one lowercase latin letter$ $",e.o||""),b=i==="-"&&(a&&a.remainder===""||u||d||g);b&&!e.a&&!e.b&&!e.p&&!e.d&&!e.q&&!a&&d&&(e.o="$"+e.o+"$");var x=[];return b?(Mt.concatArray(x,this.output(e)),x.push({type_:"hyphen"})):(a=Mt.patterns.match_("digits",e.d||""),r&&a&&a.remainder===""?(Mt.concatArray(x,Mt.actions["d="](e,i)),Mt.concatArray(x,this.output(e))):(Mt.concatArray(x,this.output(e)),Mt.concatArray(x,Mt.actions.bond(e,i,"-")))),x},"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:Mt.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"&&Mt.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:Mt.go(e.a,"a"),b:Mt.go(e.b,"bd"),p:Mt.go(e.p,"pq"),o:Mt.go(e.o,"o"),q:Mt.go(e.q,"pq"),d:Mt.go(e.d,e.dType==="oxidation"?"oxidation":"bd"),dType:e.dType}));else{var u;e.rdt==="M"?u=Mt.go(e.rd,"tex-math"):e.rdt==="T"?u=[{type_:"text",p1:e.rd||""}]:u=Mt.go(e.rd);var d;e.rqt==="M"?d=Mt.go(e.rq,"tex-math"):e.rqt==="T"?d=[{type_:"text",p1:e.rq||""}]:d=Mt.go(e.rq),a={type_:"arrow",r:e.r,rd:u,rq:d}}for(var g in e)g!=="parenthesisLevel"&&g!=="beginsWithBond"&&delete e[g];return a},"oxidation-output":function(e,i){var r=["{"];return Mt.concatArray(r,Mt.go(i,"oxidation")),r.push("}"),r},"frac-output":function(e,i){return{type_:"frac-ce",p1:Mt.go(i[0]),p2:Mt.go(i[1])}},"overset-output":function(e,i){return{type_:"overset",p1:Mt.go(i[0]),p2:Mt.go(i[1])}},"underset-output":function(e,i){return{type_:"underset",p1:Mt.go(i[0]),p2:Mt.go(i[1])}},"underbrace-output":function(e,i){return{type_:"underbrace",p1:Mt.go(i[0]),p2:Mt.go(i[1])}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:Mt.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:Mt.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:Mt.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:Mt.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:Mt.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:Mt.go(i,"o")}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:Mt.go(i[1],"pq")}}}},bd:{transitions:Mt.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:Mt.go(i[1],"bd")}}}},oxidation:{transitions:Mt.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:Mt.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:Mt.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:Mt.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:Mt.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]&&(Mt.concatArray(r,Mt.go(i[1],"pu-9,9")),i[2]&&(i[2].match(/[,.]/)?Mt.concatArray(r,Mt.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]),Mt.concatArray(r,Mt.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=Mt.patterns.match_("{(...)}",e.d||"");r&&r.remainder===""&&(e.d=r.match_);var a=Mt.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:Mt.go(e.d,"pu"),q:Mt.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_:"/"}),Mt.concatArray(i,u.q))}else i=Mt.go(e.d,"pu-2");for(var d in e)delete e[d];return i}}},"pu-2":{transitions:Mt.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=Mt.patterns.match_("{(...)}",e.rm||"");r&&r.remainder===""?i=Mt.go(r.match_,"pu"):i={type_:"rm",p1:e.rm}}for(var a in e)delete e[a];return i}}},"pu-9,9":{transitions:Mt.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 qn={go:function(e,i){if(!e)return"";for(var r="",a=!1,u=0;u<e.length;u++){var d=e[u];typeof d=="string"?r+=d:(r+=qn._go2(d),d.type_==="1st-level escape"&&(a=!0))}return!i&&!a&&r&&(r="{"+r+"}"),r},_goInner:function(e){return e&&qn.go(e,!0)},_go2:function(e){var i;switch(e.type_){case"chemfive":i="";var r={a:qn._goInner(e.a),b:qn._goInner(e.b),p:qn._goInner(e.p),o:qn._goInner(e.o),q:qn._goInner(e.q),d:qn._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 "+qn._goInner(e.p1);break;case"state of aggregation subscript":i="\\mskip1mu "+qn._goInner(e.p1);break;case"bond":if(i=qn._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{"+qn._goInner(e.p1)+"}{"+qn._goInner(e.p2)+"}";i="\\mathchoice{\\textstyle"+u+"}{"+u+"}{"+u+"}{"+u+"}";break;case"tex-math":i=e.p1+" ";break;case"frac-ce":i="\\frac{"+qn._goInner(e.p1)+"}{"+qn._goInner(e.p2)+"}";break;case"overset":i="\\overset{"+qn._goInner(e.p1)+"}{"+qn._goInner(e.p2)+"}";break;case"underset":i="\\underset{"+qn._goInner(e.p1)+"}{"+qn._goInner(e.p2)+"}";break;case"underbrace":i="\\underbrace{"+qn._goInner(e.p1)+"}_{"+qn._goInner(e.p2)+"}";break;case"color":i="{\\color{"+e.color1+"}{"+qn._goInner(e.color2)+"}}";break;case"color0":i="\\color{"+e.color+"}";break;case"arrow":var d={rd:qn._goInner(e.rd),rq:qn._goInner(e.rq)},g=qn._getArrow(e.r);d.rd||d.rq?e.r==="<=>"||e.r==="<=>>"||e.r==="<<=>"||e.r==="<-->"?(g="\\long"+g,d.rd&&(g="\\overset{"+d.rd+"}{"+g+"}"),d.rq&&(e.r==="<-->"?g="\\underset{\\lower2mu{"+d.rq+"}}{"+g+"}":g="\\underset{\\lower6mu{"+d.rq+"}}{"+g+"}"),g=" {}\\mathrel{"+g+"}{} "):(d.rq&&(g+="[{"+d.rq+"}]"),g+="{"+d.rd+"}",g=" {}\\mathrel{\\x"+g+"}{} "):g=" {}\\mathrel{\\long"+g+"}{} ",i=g;break;case"operator":i=qn._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 v0(e){}function y0(e){}var pf=class Gp extends dt{constructor(i){super(f(P({},i),{type:"delim"})),this.value=i.delim,this.size=i.size}static fromJson(i){return new Gp(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size})}render(i){return new Bt(this.value,{type:"middle"})}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Re(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):On(this.command,this.value)}},mf=class Hp extends dt{constructor(i){super(f(P({},i),{type:"sizeddelim",value:i.delim})),this.delimType=i.delimType,this.size=i.size}static fromJson(i){return new Hp(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(i){let r=xd(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=Re(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):On(this.command,this.value)}},Cl=class Wp extends dt{constructor(i,r,a,u){var d,g;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=(d=u.shadow)!=null?d:"none",this.strokeWidth=(g=u.strokeWidth)!=null?g:"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 Wp(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=Re(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 d="",g="";this.backgroundcolor&&this.backgroundcolor!=="transparent"&&(d+=g+'mathbackground="'+this.backgroundcolor+'"',g=","),this.shadow&&this.shadow!=="auto"&&(d+=g+'shadow="'+this.shadow+'"',g=","),this.strokeWidth||this.strokeStyle!=="solid"?(d+=g+this.borderStyle,g=","):this.strokeColor&&this.strokeColor!=="currentColor"&&(d+=g+'mathcolor="'+this.strokeColor+'"',g=","),d&&(u+=`[${d}]`)}return On(u,this.bodyToLatex(i))}render(i){const r=new ln({parent:i},this.style),a=dt.createBox(r,this.body);if(!a)return null;const u=Ad(this.borderStyle),d=r.toEm(!this.padding||this.padding==="auto"?{register:"fboxsep"}:{string:this.padding});a.setStyle("position","relative"),a.setStyle("display","inline-block"),a.setStyle("top",d,"em"),a.setStyle("height",a.height+a.depth,"em"),a.setStyle("width",a.width,"em");const g=new Bt(null,{classes:"ML__notation"});let b=a.height+a.depth+2*d;const x=a.width+2*d;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(d.toString(),(d+a.depth+a.height).toString(),(d+a.width).toString(),d.toString());const ge=.03*Math.sqrt(x*x+b*b)*1,He=a.width*ge,Ot=(a.depth+a.height)*ge,Ve=d+a.width;let wt=d;wt+Ot-.4*He<0&&(wt=.4*He-Ot),E+='<polygon points="',E+=`${Ve},${wt} ${Ve-He-.4*Ot},${wt+Ot-.4*He} `,E+=`${Ve-.7*He},${wt+.7*Ot} ${Ve-He+.4*Ot},${wt+Ot+.4*He} `,E+=`${Ve},${wt}`,E+=`" stroke='none' fill="${this.strokeColor}"`,E+="/>"}let R=0;if(this.notation.phasorangle){const Y=gf(r),oe=(a.height+a.depth+2*Y+d).toString(),ge=(a.height+a.depth)/2;E+=this.line(d.toString(),oe,(d+ge+a.width).toString(),oe),E+=this.line(d.toString(),oe,(d+ge).toString(),(d-Y).toString()),b+=Y,R=ge,a.left+=b/2-d}if(this.notation.longdiv){const Y=gf(r);b+=Y,E+=this.line(d.toString(),d.toString(),(d+a.width).toString(),d.toString());const oe=.3;R=oe+Y,a.left+=oe+Y,a.setTop(d+Y),E+='<path d="',E+=`M ${d} ${d} a${oe} ${(a.depth+a.height+2*Y)/2}, 0, 1, 1, 0 ${a.depth+a.height+2*Y} "`,E+=` stroke-width="${Td(r)}" stroke="${this.strokeColor}" fill="none"`,E+="/>"}if(g.width=a.width+2*d+R,g.height=a.height+d,g.depth=a.depth+d,g.setStyle("box-sizing","border-box"),g.setStyle("left",`calc(-${u} / 2 )`),g.setStyle("height",`${Math.floor(100*b)/100}em`),g.setStyle("top",`calc(${u} / 2 )`),this.backgroundcolor&&g.setStyle("background-color",this.backgroundcolor),this.notation.box&&g.setStyle("border","1px solid red"),this.notation.actuarial&&(g.setStyle("border-top",this.borderStyle),g.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(g.setStyle("border-bottom",this.borderStyle),g.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(g.setStyle("border-radius","8px"),g.setStyle("border",this.borderStyle)),this.notation.circle&&(g.setStyle("border-radius","50%"),g.setStyle("border",this.borderStyle)),this.notation.top&&g.setStyle("border-top",this.borderStyle),this.notation.left&&g.setStyle("border-left",this.borderStyle),this.notation.right&&g.setStyle("border-right",this.borderStyle),this.notation.bottom&&g.setStyle("border-bottom",this.borderStyle),E){let Y="";this.shadow==="auto"&&(Y+="filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"),this.shadow!=="none"&&(Y+=`filter: drop-shadow(${this.shadow})`),Y+=` stroke-width="${this.strokeWidth}" stroke="${this.strokeColor}"`,Y+=' stroke-linecap="round"',this.svgStrokeStyle&&(Y+=` stroke-dasharray="${this.svgStrokeStyle}"`),g.svgStyle=Y,g.svgOverlay=E}const F=new Bt([g,a]);return F.setStyle("position","relative"),F.setStyle("vertical-align",d,"em"),F.setStyle("height",`${Math.floor(100*(a.height+a.depth+2*d))/100}em`),F.setStyle("display","inline-block"),F.height=g.height,F.depth=g.depth,F.width=g.width-2*d,F.left=d,F.right=d,this.caret&&(F.caret=this.caret),F.wrap(r)}line(i,r,a,u){return`<line x1="${Ml(i)}" y1="${Ml(r)}" x2="${Ml(a)}" y2="${Ml(u)}" vector-effect="non-scaling-stroke"></line>`}};function Ml(e){return typeof e=="number"?`${Math.floor(100*e)/100}%`:e}function Ad(e){if(!e)return"1px";const i=e.match(/([0-9][a-zA-Z\%]+)/);return i===null?"1px":i[1]}function Td(e){return(Math.floor(100*e.metrics.sqrtRuleThickness/e.scalingFactor)/100/10).toString()+"em"}function gf(e){const i=e.isDisplayStyle?Da:e.metrics.defaultRuleThickness;return e.metrics.defaultRuleThickness+e.scalingFactor*i/4}var zo=class jp extends dt{constructor(i,r,a){var u,d;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=(d=a==null?void 0:a.continuousFraction)!=null?d:!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 jp(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 ln({parent:i,mathstyle:this.mathstyleName},this.style),d=u.metrics,g=new ln({parent:u,mathstyle:this.continuousFraction?"":"numerator"},this.style),b=this.numerPrefix?new Bt([new Bt(this.numerPrefix),dt.createBox(g,this.above)],{isTight:g.isTight,type:"ignore"}):(r=dt.createBox(g,this.above,{type:"ignore"}))!=null?r:new Bt(null,{type:"ignore"}),x=new ln({parent:u,mathstyle:this.continuousFraction?"":"denominator"},this.style),E=this.denomPrefix?new Bt([new Bt(this.denomPrefix),dt.createBox(x,this.below,{type:"ignore"})]):(a=dt.createBox(x,this.below,{type:"ignore"}))!=null?a:new Bt(null,{type:"ignore"}),R=this.hasBarLine?d.defaultRuleThickness:0;let F,Y=0,oe;u.isDisplayStyle?(F=g.metrics.num1,Y=R>0?3*R:7*R,oe=x.metrics.denom1):(R>0?(F=g.metrics.num2,Y=R):(F=g.metrics.num3,Y=3*d.defaultRuleThickness),oe=x.metrics.denom2);const ge=[];this.isSelected&&ge.push("ML__selected");const He=b.depth,Ot=E.height;let Ve;if(R<=0){const ci=F-He-(Ot-oe);ci<Y&&(F+=(Y-ci)/2,oe+=(Y-ci)/2),Ve=new wr({individualShift:[{box:b,shift:-F,classes:[...ge,"ML__center"]},{box:E,shift:oe,classes:[...ge,"ML__center"]}]}).wrap(u)}else{const ci=new Bt(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});ci.softWidth=Math.max(b.width,E.width),ci.height=R/2,ci.depth=R/2;const cn=As+R/2;F<Y+He+cn&&(F=Y+He+cn);const Fn=As-R/2;oe<Y+Ot-Fn&&(oe=Y+Ot-Fn),Ve=new wr({individualShift:[{box:E,shift:oe,classes:[...ge,"ML__center"]},{box:ci,shift:-Fn,classes:ge},{box:b,shift:-F,classes:[...ge,"ML__center"]}]}).wrap(u)}const wt=u.isDisplayStyle?d.delim1:d.delim2,$t=this.leftDelim?this.bind(i,ku("open",this.leftDelim,wt,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):_a(u,"open");let At=null;this.continuousFraction?At=new Bt(null,{type:"close"}):this.rightDelim?At=this.bind(i,ku("close",this.rightDelim,wt,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):At=_a(u,"close");const si=new Bt([$t,Ve,At],{isTight:u.isTight,type:"inner",classes:"mfrac"}),_i=this.bind(i,si);return this.caret&&(_i.caret=this.caret),this.attachSupsub(i,{base:_i})}},Sr=class qp extends dt{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 qp(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 Bt(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}},Rl=class Zp extends dt{constructor(i){super({type:"latexgroup",mode:"latex"}),this.body=[...i].map(r=>new Sr(r)),this.skipBoundary=!1}static fromJson(i){return new Zp("")}toJson(){return super.toJson()}render(i){const r=dt.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:""}},Vo=class Yp extends dt{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 Yp(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 Bt(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 d=(u.height-u.depth)/2-As*i.scalingFactor,g=u.italic;u.setTop(d);let b=u;if(this.superscript||this.subscript){const x=(r=this.subsupPlacement)!=null?r:"auto";b=x==="over-under"||x==="auto"&&i.isDisplayStyle?this.attachLimits(i,{base:u,baseShift:d,slant:g}):this.attachSupsub(i,{base:u})}return new Bt(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=Re(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)),fn(a)}},go=class Xp extends dt{constructor(i){const r=i.body;super(f(P({},i),{type:"overlap",body:typeof r=="string"?[new dt({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 Xp(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=dt.createBox(i,this.body,{classes:"inner"});return r?(this.caret&&(r.caret=this.caret),this.bind(i,new Bt([r,new Bt(null,{classes:"fix"})],{classes:this.align==="right"?"rlap":"llap",type:this.boxType}))):null}},Ds=class Jp extends dt{constructor(i){var r,a,u,d;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=(d=i.paddedLabels)!=null?d:!1}static fromJson(i){return new Jp(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?yl(this.svgBody):dt.createBox(i,this.body,{type:"ignore"});const a=new ln({parent:i,mathstyle:"scriptstyle"},this.style);let u=null;this.svgAbove?u=yl(this.svgAbove):this.above&&(u=dt.createBox(a,this.above,{type:"ignore"}));let d=null;this.svgBelow?d=yl(this.svgBelow):this.below&&(d=dt.createBox(a,this.below,{type:"ignore"})),this.paddedBody&&(r=new Bt([_a(i,"open"),r,_a(i,"close")],{type:"ignore"}));let g=Ld(i,{base:r,above:u,below:d,type:this.boxType==="bin"||this.boxType==="rel"?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return g?(this.subsupPlacement==="over-under"?g=this.attachLimits(i,{base:g,type:g.type}):g=this.attachSupsub(i,{base:g}),this.caret&&(g.caret=this.caret),this.bind(i,g)):null}};function Ld(e,i){if(!i.base)return null;if(!i.above&&!i.below){const b=new Bt(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,d=0,g=["ML__center"];if(i.paddedAboveBelow&&g.push("ML__label_padding"),i.below&&i.above){const b=e.metrics.bigOpSpacing5+i.below.height+i.below.depth+u.depth+d;a=new wr({bottom:b,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:g},{box:u,classes:["ML__center"]},r,{box:i.above,classes:g},e.metrics.bigOpSpacing5]})}else i.below?a=new wr({top:u.height-d,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:g},{box:u,classes:["ML__center"]}]}):i.above&&(a=new wr({bottom:u.depth+d,children:[{box:u,classes:["ML__center"]},r,{box:i.above,classes:g},e.metrics.bigOpSpacing5]}));return new Bt(a,{type:i.type})}var Il=class Qp extends dt{constructor(i){var r,a,u,d;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=(d=i.smashWidth)!=null?d:!1}static fromJson(i){return new Qp(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 ln({parent:i,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return console.assert(this.isInvisible),dt.createBox(r,this.body,{classes:"inner"});const a=dt.createBox(this.isInvisible?r:i,this.body);if(!a)return null;if(this.smashWidth){const u=new Bt(null,{classes:"fix"});return new Bt([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)}},Go=class em extends dt{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 em(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 Bt(this.mode==="math"?null:" ");let a;if(this.width!==void 0)a=new Bt(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 Bt(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=Re(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}{${Or(this.width)}}`:`${u}${Or(this.width)}`}},$c=class tm extends dt{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 tm(f(P({},i),{index:i.above}))}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Re(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")?On(`${a}[${this.aboveToLatex(i)}]`,u):/^[0-9]$/.test(u)?`${a}${u}`:On(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 ln({parent:i,mathstyle:"cramp"},this.style),u=(r=dt.createBox(a,this.body,{type:"inner"}))!=null?r:new Bt(null),d=a.scalingFactor,g=a.metrics.defaultRuleThickness/d,b=i.isDisplayStyle?Da:g,x=new Bt(null,{classes:"ML__sqrt-line",style:this.style});x.height=g,x.softWidth=u.width;let E=d*(g+b/4);const F=Math.max(d*2*b,u.height+u.depth)+E+g,Y=new ln({parent:i},this.style),oe=this.bind(Y,new Bt(ku("inner","\\surd",F,!1,Y,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!oe)return null;const ge=oe.height+oe.depth-g;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 Bt(u)},E-2*g,{box:x},g]})),Ot=dt.createBox(new ln({parent:i,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!Ot){const $t=new Bt([oe,He],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return $t.setStyle("display","inline-block"),$t.setStyle("height",$t.height+$t.depth,"em"),this.caret&&($t.caret=this.caret),this.bind(i,$t)}const Ve=new wr({shift:-.6*(Math.max(oe.height,He.height)-Math.max(oe.depth,He.depth)),children:[{box:Ot}]}),wt=new Bt([new Bt(Ve,{classes:"ML__sqrt-index",type:"ignore"}),oe,He],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return wt.height=oe.height,wt.depth=oe.depth,this.caret&&(wt.caret=this.caret),this.bind(i,wt)}},Dd=class extends Bt{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 Ho(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"){Ho(e.parent,i);return}a>0&&r[a-1].type==="skip"?r[a-1].width+=i:r.splice(a,0,new Dd(i))}var _f={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}},Lu={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function Cd(e){Ol(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 Pl(e,i){if(!e.children)return e;const r=e.children;Cd(r);const a=i.getRegisterAsEm("thinmuskip"),u=i.getRegisterAsEm("medmuskip"),d=i.getRegisterAsEm("thickmuskip");return Ol(r,(g,b)=>{var x,E,R;if(!g)return;const F=g.type,Y=b.isTight?(x=Lu[F])!=null?x:null:(E=_f[F])!=null?E:null,oe=(R=Y==null?void 0:Y[b.type])!=null?R:null;oe===3&&Ho(b,a),oe===4&&Ho(b,u),oe===5&&Ho(b,d)}),e}function Ol(e,i,r=void 0){if(!e)return r;e=[...e];for(const a of e)a.type==="lift"?r=Ol(a.children,i,r):a.type==="ignore"?Ol(a.children,i):(i(r,a),Ol(a.children,i),r=a);return r}var Kc=class im extends dt{constructor(i){super({type:"tooltip",command:i.command,mode:i.mode,style:i.style,body:i.body,displayContainsHighlight:!0}),this.tooltip=new dt({type:"root",mode:i.content,body:i.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(i){return new im(f(P({},i),{tooltip:ba(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=dt.createBox(new ln,this.body);if(!r)return null;const a=new ln({parent:i,mathstyle:"displaystyle"},{fontSize:ro}),u=mu(Pl(new Bt(this.tooltip.render(a),{classes:"ML__tooltip-content"}),a)),d=new Bt([u,r],{classes:"ML__tooltip-container"});return this.caret&&(d.caret=this.caret),this.bind(i,d)}},Ra=class nm extends dt{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 nm(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 Bt(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 d=(r=this.subsupPlacement)!=null?r:"auto";u=d==="over-under"||d==="auto"&&i.isDisplayStyle?this.attachLimits(i,{base:a}):this.attachSupsub(i,{base:a})}return new Bt(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=Re(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)),fn(a)}};function ba(e){if(k(e))return e.map(a=>ba(a));if(typeof e=="string")return dt.fromJson(e);e=P({},e);for(const a of co)e[a]&&(e[a]=ba(e[a]));e.args&&(e.args=vf(e.args)),e.array&&(e.array=ba(e.array));const i=e.type;let r;i==="accent"&&(r=wu.fromJson(e)),i==="array"&&(r=_n.fromJson(e)),i==="box"&&(r=Js.fromJson(e)),i==="chem"&&(r=df.fromJson(e)),i==="composition"&&(r=Bc.fromJson(e)),i==="delim"&&(r=pf.fromJson(e)),i==="enclose"&&(r=Cl.fromJson(e)),i==="error"&&(r=ya.fromJson(e)),i==="extensible-symbol"&&(r=Vo.fromJson(e)),i==="genfrac"&&(r=zo.fromJson(e)),i==="group"&&(r=lf.fromJson(e)),i==="latex"&&(r=Sr.fromJson(e)),i==="latexgroup"&&(r=Rl.fromJson(e)),i==="leftright"&&(r=or.fromJson(e)),i==="macro"&&(r=uf.fromJson(e)),i==="macro-argument"&&(r=cf.fromJson(e)),i==="operator"&&(r=Ra.fromJson(e)),i==="overlap"&&(r=go.fromJson(e)),i==="overunder"&&(r=Ds.fromJson(e)),i==="placeholder"&&(r=va.fromJson(e)),i==="prompt"&&(r=Nc.fromJson(e)),i==="phantom"&&(r=Il.fromJson(e)),i==="sizeddelim"&&(r=mf.fromJson(e)),i==="spacing"&&(r=Go.fromJson(e)),i==="subsup"&&(r=Tu.fromJson(e)),i==="surd"&&(r=$c.fromJson(e)),i==="text"&&(r=xl.fromJson(e)),i==="tooltip"&&(r=Kc.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=dt.fromJson(e));for(const a of co)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 vf(e){if(e&&Array.isArray(e))return e.map(i=>i==="<null>"?null:typeof i=="object"&&"group"in i?{group:i.group.map(r=>ba(r))}:typeof i=="object"&&"atoms"in i?i.atoms.map(r=>ba(r)):i)}var yf={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"]},Uc={"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]$/},bf=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,Md=/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/,Rd=[/^[a-z]$/,/^[A-Z]$/,bf,Md],xf={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]},zc=class extends _s{constructor(){super("math")}createAtom(e,i,r){var a,u,d,g;if(i===null)return new dt({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 dt({type:(u=i.type)!=null?u:"mord",mode:"math",command:(d=i.command)!=null?d:e,value:String.fromCodePoint(i.codepoint),style:r});return b&&(E.isFunction=!0),e.startsWith("\\")&&(E.verbatimLatex=e),E}const x=new dt({type:"mord",mode:"math",command:(g=i.command)!=null?g:e,value:e,style:r});return b&&(x.isFunction=!0),e.startsWith("\\")&&(x.verbatimLatex=e),x}serialize(e,i){const r=Id(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&&Rd.forEach((b,x)=>{var E;b.test(e.value)&&xf[(E=i.letterShapeStyle)!=null?E:"tex"][x]==="it"&&(a="italic")}),a==="up"&&(a=void 0);const u=a?r+"-"+a:r;console.assert(yf[u]!==void 0);const[d,g]=yf[u];return Uc[r]&&!Uc[r].test(e.value)?(e.value=et(e.value,r,a),null):(bf.test(e.value)&&(e.classes+=" lcGreek"),g&&(e.classes+=" "+g),d)}};function Id(e,i){const{parent:r}=e[0],a=xa(r);return Ca(e,"variant").map(u=>{const d=xa(u[0]);let g="";d&&d!==a&&(g={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"}[d],console.assert(g!==void 0));const b=fn(u.map(x=>x._serialize(i)));return g?On(g,b):b})}function xa(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 zc;function h(e,i){return e.map(r=>r._serialize(i))}function t(e,i){return Ca(e,"fontShape").map(r=>{const a=h(r,i),{fontShape:u}=r[0].style;let d="";return u==="it"&&(d="\\textit"),u==="sl"&&(d="\\textsl"),u==="sc"&&(d="\\textsc"),u==="n"&&(d="\\textup"),!d&&u?`{${On("\\fontshape",u)}${fn(a)}}`:d?On(d,fn(a)):fn(a)})}function n(e,i){return Ca(e,"fontSeries").map(r=>{const a=t(r,i),{fontSeries:u}=r[0].style;let d="";return u==="b"&&(d="\\textbf"),u==="l"&&(d="\\textlf"),u==="m"&&(d="\\textmd"),u&&!d?`{${On("\\fontseries",u)}${fn(a)}}`:d?On(d,fn(a)):fn(a)})}function s(e,i){return Ca(e,"fontSize").map(r=>{var a,u;const d=n(r,i),g=(u=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][(a=r[0].style.fontSize)!=null?a:""])!=null?u:"";return g?`${g} ${fn(d)}`:fn(d)})}function o(e,i,r){return Ca(e,"fontFamily").map(a=>{var u,d;const g=s(a,i),b=(d={roman:"textrm",monospace:"texttt","sans-serif":"textsf"}[(u=a[0].style.fontFamily)!=null?u:""])!=null?d:"";return b?`\\${b}{${fn(g)}}`:a[0].style.fontFamily?`{\\fontfamily{${a[0].style.fontFamily}} ${fn(g)}}`:r?`\\text{${fn(g)}}`:fn(g)})}var l={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"},c=class extends _s{constructor(){super("text")}createAtom(e,i,r){return i&&i.definitionType==="symbol"?new xl(e,String.fromCodePoint(i.codepoint),r!=null?r:{}):null}serialize(e,i){return o(e,f(P({},i),{defaultMode:"text"}),i.defaultMode!=="text")}getFont(e,i){var r,a,u,d,g;const{fontFamily:b}=i;if(l[b]?e.classes+=" "+l[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 x=i.fontSeries.match(/(.?[lbm])?(.?[cx])?/);x&&(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=x[1])!=null?a:""])!=null?u:"",e.classes+=" ",e.classes+=(g={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"}[(d=x[2])!=null?d:""])!=null?g:"")}return"Main-Regular"}};new c;var p=class extends _s{constructor(){super("latex")}createAtom(e){return new Sr(e)}serialize(e,i){return e.filter(r=>r instanceof Sr&&!r.isSuggestion).map(r=>r.value)}getFont(){return null}};new p;var _={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:["","=","","="]}},m={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:["","=","","="]}},v={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:["\\","|","",""]}},y={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:[")",")",")",")"]}},S={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:["=","=","=","="]}},C={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:["<",">","",""]}},D={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"]}},K={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:["=","=","=","="]}},B={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:["<",">","|",""]}},ee={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:[".",".",".","."]}},_e={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"]}},he={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:["<",">","",""]}},Ie={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 Fe(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 it(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 Ke={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]"},qe=[],nt;function Ue(){switch(G()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function Lt(e){(!e.platform||e.platform===Ue())&&qe.push(e)}function ii(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,d]of Object.entries(i.mapping)){if(d[0]===e)return a.key=`[${u}]`,a;if(d[1]===e)return a.shift=!0,a.key=`[${u}]`,a;if(d[2]===e)return a.alt=!0,a.key=`[${u}]`,a;if(d[3]===e)return a.shift=!0,a.alt=!0,a.key=`[${u}]`,a}return a.key=(r=Ke[e])!=null?r:"",a}function Ri(e){if(e.code)return e;const i=Object.entries(Qt().mapping);let r=!1,a=!1,u="";for(let d=0;d<4;d++){for(const[g,b]of i)if(b[d]===e.key){u=g,d===3?(r=!0,a=!0):d===2?r=!0:d===1&&(a=!0);break}if(u)break}return new KeyboardEvent(e.type,f(P({},e),{altKey:r,shiftKey:a,code:u}))}function pi(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 qe)((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);qe.sort((u,d)=>d.score-u.score)}function gi(e){nt=qe.find(i=>e.startsWith(i.locale))}function Qt(){return nt!=null?nt:qe[0]}function yi(){switch(Ue()){case"apple":return m;case"windows":return v;case"linux":return y}return m}switch(Ue()){case"apple":Lt(m),Lt(S),Lt(_e),Lt(K);break;case"windows":Lt(v),Lt(C),Lt(he),Lt(B);break;case"linux":Lt(y),Lt(D),Lt(Ie),Lt(ee);break}Lt(_);function Ei(e){var i;const r=/macos|ios/.test(G()),a=e.split("+");let u="";for(const d of a)u&&(u+=r?"\u2009":'<span class="ML__shortcut-join">+</span>'),d.startsWith("[Key")?u+=d.slice(4,5):d.startsWith("Key")?u+=d.slice(3,4):d.startsWith("[Digit")?u+=d.slice(6,7):d.startsWith("Digit")?u+=d.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:"* 🔢",numpaddivide:"/ 🔢",numpadsubtract:"- 🔢",numpadadd:"+ 🔢",numpaddecimal:". 🔢",numpadcomma:", 🔢",help:"help",left:"\u21E0",up:"\u21E1",right:"\u21E2",down:"\u21E3","[arrowleft]":"\u21E0","[arrowup]":"\u21E1","[arrowright]":"\u21E2","[arrowdown]":"\u21E3"}[d.toLowerCase()])!=null?i:d.toUpperCase();return u}function zt(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 Ht(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 Zi(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 zi=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 tn(e){return e.ctrlKey||e.metaKey||["Dead","Process"].includes(e.key)?!1:e.code===""?!0:zi.has(e.code)}function mn(){var e;let i=document.activeElement;for(;(e=i==null?void 0:i.shadowRoot)!=null&&e.activeElement;)i=i.shadowRoot.activeElement;return i}var un=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=mn();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 d=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${d+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:d}=this;d.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),d.remove(),document.body.style.overflow=(i=this.savedOverflow)!=null?i:"",document.body.style.marginRight=(r=this.savedMarginRight)!=null?r:"",mn()!==this.savedActiveElement&&((u=(a=this.savedActiveElement)==null?void 0:a.focus)==null||u.call(a)),d.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 Zn(e,i,r){let a=null,u=null,d=!1,g=!1,b=!1;const x=new AbortController,E=x.signal;return e.addEventListener("keydown",R=>{if(d||R.key==="Process"||R.code==="CapsLock"||/(Control|Meta|Alt|Shift)(Left|Right)/.test(R.code)){a=null;return}a=R,u=null,r.onKeystroke(R)?e.textContent="":a=null},{capture:!0,signal:E}),e.addEventListener("keypress",R=>{d||(a&&u&&r.onKeystroke(a),u=R)},{capture:!0,signal:E}),e.addEventListener("compositionstart",R=>{e.textContent="",d=!0,r.onCompositionStart(R.data)},{capture:!0,signal:E}),e.addEventListener("compositionupdate",R=>{d&&r.onCompositionUpdate(R.data)},{capture:!0,signal:E}),e.addEventListener("compositionend",R=>{e.textContent="",d&&(d=!1,r.onCompositionEnd(R.data))},{capture:!0,signal:E}),e.addEventListener("beforeinput",R=>R.stopImmediatePropagation(),{signal:E}),e.addEventListener("input",R=>{var F;if(!d&&(e.textContent="",R.inputType!=="insertCompositionText")){if(R.inputType==="insertFromPaste"){R.preventDefault(),R.stopPropagation();return}r.onInput((F=R.data)!=null?F:""),R.preventDefault(),R.stopPropagation()}},{signal:E}),e.addEventListener("paste",R=>{e.focus({preventScroll:!0}),e.textContent="",r.onPaste(R)||R.preventDefault(),R.stopImmediatePropagation()},{signal:E}),e.addEventListener("cut",R=>r.onCut(R),{capture:!0,signal:E}),e.addEventListener("copy",R=>r.onCopy(R),{capture:!0,signal:E}),e.addEventListener("blur",R=>{var F,Y;if(((Y=(F=R.relatedTarget)==null?void 0:F._mathfield)==null?void 0:Y.element)===i){e.focus({preventScroll:!0}),R.preventDefault(),R.stopPropagation();return}const oe=un.state;if(oe==="open"||oe==="opening"){R.preventDefault(),R.stopPropagation();return}if(R.relatedTarget===R.target.getRootNode().host){R.preventDefault(),R.stopPropagation();return}b||g||(b=!0,a=null,u=null,r.onBlur(),b=!1)},{capture:!0,signal:E}),e.addEventListener("focus",R=>{b||g||(g=!0,r.onFocus(),g=!1)},{capture:!0,signal:E}),{dispose:()=>x.abort(),cancelComposition:()=>{d&&(e.blur(),requestAnimationFrame(()=>e.focus({preventScroll:!0})))},blur:()=>{typeof e.blur=="function"&&e.blur()},focus:()=>{!g&&typeof e.focus=="function"&&e.focus({preventScroll:!0})},hasFocus:()=>mn()===e,setAriaLabel:R=>e.setAttribute("aria-label",R),setValue:R=>{var F;e.textContent=R,e.style.left="-1000px",(F=window.getSelection())==null||F.selectAllChildren(e)},moveTo:(R,F)=>{e.style.top=`${F}px`,e.style.left=`${R}px`}}}function Tr(e){var i;if(!e||!tn(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 ls(e){e=Ri(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 Ia(e){if(M()){const i=G(),r=e.startsWith("!"),a=e.endsWith(i);if(r&&!a||!r&&a)return!0}return e==="!other"?!1:e==="other"}function wf(e,i,r){if(e.length===0)return"";const a=it(Fe(ls(r))),u=it({key:r.key,shift:r.shiftKey,alt:r.altKey,ctrl:r.ctrlKey,meta:r.metaKey||r.ctrlKey&&/macos|ios/.test(G()),cmd:!1,win:!1});for(let d=e.length-1;d>=0;d--)if((e[d].key===a||e[d].key===u)&&(!e[d].ifMode||e[d].ifMode===i))return e[d].command;return""}function Sf(e){let i=e;return k(i)&&(i=i.length>0?i[0]+"("+i.slice(1).join("")+")":""),i}function Pd(e,i){let r=[];if(typeof i=="string"){const d=jh[i];k(d)?r=d.slice():d&&r.push(d)}const a=Sf(i),u=new RegExp("^"+a.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(const d of e)u.test(Sf(d.command))&&r.push(d.key);return r.map(Ei)}function Vc(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=Fe(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=G()==="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&&!Ia(a))return;if(/^\[.+\]$/.test(r.key))return f(P({},e),{key:it(r)});const u=ii(r.key,i);if(!u)return f(P({},e),{key:it(r)});if(u.shift&&r.shift||u.alt&&r.alt)throw new Error(`The keybinding ${e.key} (${Fl(e.command)}) is conflicting with the key combination ${it(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:it(u)})}function Fl(e){if(Array.isArray(e)){const i=[...e];return i.shift()+"("+i.map(r=>typeof r=="string"?`"${r}"`:r.toString()).join(", ")+")"}return e}function b0(e,i){const r=[],a=[];for(const u of e)try{const d=Vc(u,i);if(!d)continue;const g=a.find(b=>b.key===d.key&&b.ifMode===d.ifMode);if(g)throw new Error(`Ambiguous key binding ${u.key} (${Fl(u.command)}) matches ${g.key} (${Fl(g.command)}) with the ${i.displayName} keyboard layout`);a.push(d)}catch(d){d instanceof Error&&r.push(d.message)}return[a,r]}var Cn=class extends Hn{constructor(){super("latex")}createAtom(e){return new Sr(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"}),dr(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(Fr(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 d=[];for(const x of i)Ne.test(x)&&d.push(new Sr(x));let g=e.at(e.position);if(g instanceof Rl&&(g=g.lastChild),!(g.parent instanceof Rl)){const x=new Rl("");g.parent.addChildAfter(x,g),g=x.firstChild}const b=g.parent.addChildrenAfter(d,g);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 Yr(e){return e.atoms.find(i=>i.type==="latexgroup")}function Xr(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 Pa(e,i){var r;let a=0,u=!1;const d=Number.isFinite(i==null?void 0:i.before)?(r=i==null?void 0:i.before)!=null?r:0:e.lastOffset;for(;a<=d&&!u;){const x=e.at(a);u=x instanceof Sr&&x.isSuggestion,u||a++}if(!u)return[void 0,void 0];let g=a,b=!1;for(;g<=d&&!b;){const x=e.at(g);b=!(x instanceof Sr&&x.isSuggestion),b||g++}return[a-1,g-1]}new Cn;function ds(e){const i=Xr(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 Qs(e,i){var r;const{model:a}=e;ds(e);for(const R of Xr(a))R.isError=!1;if(!a.selectionIsCollapsed||e.options.popoverPolicy==="off"){yo(e);return}const u=[];let d=a.at(a.position);for(;d&&d instanceof Sr&&/^[a-zA-Z\*]$/.test(d.value);)d=d.leftSibling;if(d&&d instanceof Sr&&d.value==="\\")for(u.push(d),d=d.rightSibling;d&&d instanceof Sr&&/^[a-zA-Z\*]$/.test(d.value);)u.push(d),d=d.rightSibling;const g=u.map(R=>R.value).join(""),b=Be(e,g);if(b.length===0){if(/^\\[a-zA-Z\*]+$/.test(g))for(const R of u)R.isError=!0;yo(e);return}const x=(r=i==null?void 0:i.atIndex)!=null?r:0;e.suggestionIndex=x<0?b.length-1:x%b.length;const E=b[e.suggestionIndex];if(E!==g){const R=u[u.length-1];R.parent.addChildrenAfter([...E.slice(g.length-E.length)].map(F=>new Sr(F,{isSuggestion:!0})),R),Kl(e,{interactive:!0})}Ef(e,b)}function Oa(e){const[i,r]=Pa(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 _o(e,i="accept",r){var a,u;yo(e);const d=Yr(e.model);if(!d)return!1;if(i==="accept-suggestion"||i==="accept-all"){const E=Xr(e.model).filter(R=>R.isSuggestion);if(E.length!==0){for(const R of E)R.isSuggestion=!1;e.model.position=e.model.offsetOf(E[E.length-1])}if(i==="accept-suggestion")return E.length!==0}const b=Xr(e.model).filter(E=>!E.isSuggestion).map(E=>E.value).join(""),x=d.leftSibling;return d.parent.removeChild(d),e.model.position=e.model.offsetOf(x),e.switchMode((a=r==null?void 0:r.mode)!=null?a:"math"),i==="reject"||(Hn.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 vo(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 Du(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 Bl(e,i){const r=new ln({from:e.context}),a=new dt({mode:"math",type:"root",body:Zr(i,{context:r})}),u=mu(Pl(new Bt(a.render(r),{classes:"ML__base"}),r));return gu(u,{classes:"ML__latex"}).toMarkup()}function Ef(e,i){var r;if(i.length===0){yo(e);return}let a="";for(const[d,g]of i.entries()){const b=g,x=Bl(e,g),E=Pd(e.keybindings,b).join("<br>");a+=`<li role="button" data-command="${b}" ${d===e.suggestionIndex?"class=ML__popover__current":""}><span class="ML__popover__latex">${b}</span><span class="ML__popover__command">${x}</span>`,E&&(a+=`<span class="ML__popover__keybinding">${E}</span>`),a+="</li>"}const u=$l(e,`<ul>${a}</ul>`);Gc()&&((r=u.querySelector(".ML__popover__current"))==null||r.scrollIntoView({block:"nearest",inline:"nearest"})),setTimeout(()=>{var d;u&&!Gc()&&(u.classList.add("is-visible"),Nl(e),(d=u.querySelector(".ML__popover__current"))==null||d.scrollIntoView({block:"nearest",inline:"nearest"}))},32)}function Gc(){const e=document.getElementById("mathlive-suggestion-popover");return e?e.classList.contains("is-visible"):!1}function Nl(e,i){var r;if(!e.element||e.element.mathfield!==e||!Gc())return;if(((r=e.model.at(e.model.position))==null?void 0:r.type)!=="latex"){yo(e);return}if(i!=null&&i.deferred){setTimeout(()=>Nl(e),32);return}const a=Xs(e.field);if(!a)return;const u=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,d=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,g=window.innerWidth-document.documentElement.clientWidth,b=window.innerHeight-document.documentElement.clientHeight,x=window.mathVirtualKeyboard.boundingRect.height,E=document.getElementById("mathlive-suggestion-popover");a.x+E.offsetWidth/2>d-g?E.style.left=`${d-E.offsetWidth-g}px`:a.x-E.offsetWidth/2<0?E.style.left="0":E.style.left=`${a.x-E.offsetWidth/2}px`;const R=a.y-a.height;u-b-x-a.y<R?(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 yo(e){e.suggestionIndex=0;const i=document.getElementById("mathlive-suggestion-popover");i&&(i.classList.remove("is-visible"),i.innerHTML="")}function $l(e,i){let r=document.getElementById("mathlive-suggestion-popover");return r||(r=vo("mathlive-suggestion-popover"),os("suggestion-popover"),os("core"),r.addEventListener("pointerdown",a=>a.preventDefault()),r.addEventListener("click",a=>{let u=a.target;for(;u&&!u.dataset.command;)u=u.parentElement;u&&(_o(e,"reject"),Hn.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 lm(){document.getElementById("mathlive-suggestion-popover")&&(Du("mathlive-suggestion-popover"),ga("suggestion-popover"),ga("core"))}function um(){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 kf=null,x0,w0,Od=((w0=(x0=globalThis==null?void 0:globalThis.document)==null?void 0:x0.currentScript)==null?void 0:w0.src)||um();function S0(e){return Yo(this,null,function*(){if(/^(?:[a-z+]+:)?\/\//i.test(e))return new URL(e).href;if(kf===null)try{const i=yield fetch(Od,{method:"HEAD"});i.status===200&&(kf=i.url)}catch(i){console.error(`Invalid URL "${e}" (relative to "${Od}")`)}return new URL(e,kf!=null?kf:Od).href})}function cm(e,i,r={}){return new FontFace(e,`url(${i}.woff2) format('woff2')`,r)}var Bs="not-loaded";function hm(){return Yo(this,null,function*(){return Bs="not-loaded",Af()})}function Af(){return Yo(this,null,function*(){var e;if(Bs!=="not-loaded")return;if(Bs="loading",(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))!=null?e:!1){Bs="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(g=>g.family);if(r.every(g=>a.includes(g))){Bs="ready";return}if(!window.MathfieldElement.fontsDirectory){Bs="not-loaded";return}const u=yield S0(window.MathfieldElement.fontsDirectory);if(!u){document.body.classList.add("ML__fonts-did-not-load"),Bs="error";return}const d=[["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(g=>cm(g[0].replace(/-[a-zA-Z]+$/,""),`${u}/${g[0]}`,g[1]));try{(yield Promise.all(d.map(b=>{try{return b.load()}catch(x){}}))).forEach(b=>document.fonts.add(b)),Bs="ready";return}catch(g){console.error(`MathLive 0.98.5: The math fonts could not be loaded from "${u}"`,{cause:g}),document.body.classList.add("ML__fonts-did-not-load")}Bs="error"}})}function fm(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 dr(e,i){e&&(e.dirty||(e.dirty=!0,requestAnimationFrame(()=>{da(e)&&e.dirty&&(e.atomBoundsCache=new Map,Kl(e,i),e.atomBoundsCache=void 0)})))}function dm(e,i){var r;i=i!=null?i:{};const a=new ln({from:f(P({},e.context),{atomIdsSettings:{seed:i.forHighlighting?fm(dt.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 gu(Pl(u,a),{classes:e.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})}function E0(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 d=u.parent;for(;d;)d.containsCaret=!0,d=d.parent}else{const u=r.getAtoms(r.selection,{includeChildren:!0});for(const d of u)d.isSelected=!0}return dm(e,i).toMarkup()}function Kl(e,i){if(!da(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(),d=a.classList.contains("ML__focused");d&&!u?a.classList.remove("ML__focused"):!d&&u&&a.classList.add("ML__focused");let g=E0(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 x=e.options.contentPlaceholder;x&&(g+=`<span part=placeholder class="ML__content-placeholder">${Br(x)}</span>`)}a.innerHTML=window.MathfieldElement.createHTML(g),Tf(e,i.interactive),e.dirty=!1}function Tf(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)&&Bs!=="error"&&Bs!=="ready"&&setTimeout(()=>{Bs==="ready"?Tf(e):setTimeout(()=>Tf(e),128)},32);const a=e.model,u=r.offsetWidth,d=r.getBoundingClientRect().width;let g=Math.floor(d)/u;if(g=isNaN(g)?1:g,a.selectionIsCollapsed){Nl(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 x=Dc(e,Ls(e,b),g);if(x){x.left/=g,x.right/=g,x.top/=g,x.bottom/=g;const E=document.createElement("div");E.classList.add("ML__contains-highlight"),E.style.position="absolute",E.style.left=`${x.left+1}px`,E.style.top=`${Math.ceil(x.top)}px`,E.style.width=`${Math.ceil(x.right-x.left)}px`,E.style.height=`${Math.ceil(x.bottom-x.top)}px`,r.insertBefore(E,r.childNodes[0])}}return}for(const b of pm(Cc(e,{excludeAtomsWithBackground:!0}))){b.left/=g,b.right/=g,b.top/=g,b.bottom/=g;const x=document.createElement("div");x.classList.add("ML__selection"),x.style.position="absolute",x.style.left=`${b.left}px`,x.style.top=`${b.top}px`,x.style.width=`${Math.ceil(b.right-b.left)}px`,x.style.height=`${Math.ceil(b.bottom-b.top-1)}px`,r.insertBefore(x,r.childNodes[0])}}function pm(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 k0=3,Fa;function Cs(e,i){i=P({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},i!=null?i:{}),Fa||(Fa={});for(const r of Object.keys(e))console.assert(!Fa[r],"Selector already defined: ",r),Fa[r]=f(P({},i),{fn:e[r]})}function Fd(e){let i;if(Array.isArray(e)){if(e[0]==="performWithFeedback")return Fd(e[1]);i=e[0]}else i=e;return i=i.replace(/-\w/g,r=>r[1].toUpperCase()),Fa[i]}function Cu(e){var i;return(i=Fd(e))==null?void 0:i.target}function mm(e,i){var r;if(!i)return!1;let a,u=[],d=!1,g=!1;k(i)?(a=i[0],u=i.slice(1)):a=i,a=a.replace(/-\w/g,E=>E[1].toUpperCase());const b=Fa[a],x=b==null?void 0:b.target;if(x==="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)||ds(e),Fa[a].fn(e.model,...u),Qs(e),g=!0,d=!0}else if(x==="virtual-keyboard")g=(r=window.mathVirtualKeyboard.executeCommand(i))!=null?r:!1,d=!0;else if(Fa[a]){if(!e.isSelectionEditable&&(b!=null&&b.changeContent))return e.model.announce("plonk"),!1;/^(undo|redo)/.test(a)&&e.flushInlineShortcutBuffer(),g=Fa[a].fn(e,...u),d=!0}else throw new Error(`Unknown command "${a}"`);return x!=="virtual-keyboard"&&(!e.model.selectionIsCollapsed||b!=null&&b.changeSelection&&i!=="deleteBackward")&&(e.flushInlineShortcutBuffer(),b!=null&&b.changeContent||e.stopCoalescingUndo(),e.defaultStyle={}),g&&dr(e),d}function gm(e,i){var r;if(!e)return!1;e.focus(),bp.keypressVibration&&X()&&navigator.vibrate(k0);const a=Fd(i);window.MathfieldElement.playSound((r=a==null?void 0:a.audioFeedback)!=null?r:"keypress");const u=e.executeCommand(i);return e.scrollIntoView(),u}Cs({performWithFeedback:(e,i)=>gm(e,i)});function _m(e){return Qs(e,{atIndex:e.suggestionIndex+1}),!1}function vm(e){return Qs(e,{atIndex:e.suggestionIndex-1}),!1}Cs({complete:_o},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),Cs({nextSuggestion:_m,previousSuggestion:vm},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var Lf="mathlive#virtual-keyboard-message";function Bd(e){var i;return e.type!=="message"?!1:((i=e.data)==null?void 0:i.type)===Lf}var ym=class rm{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 rm),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(Bd(i)){if(!Mc(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;Cu(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:Lf,action:i},r),this.targetOrigin)}},A0={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:"αβγ",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"<i>φ</i>",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"<i>ς</i>",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"<i>ϵ</i>",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"espilon",shift:'\\char"0190'},{label:"<i>ρ</i>",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"<i>τ</i>",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"<i>υ</i>",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"<i>θ</i>",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"<i>ι</i>",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"<i>ο</i>",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"<i>π</i>",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"<i>α</i>",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"<i>σ</i>",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"<i>δ</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>γ</i>",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"<i>η</i>",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"<i>ξ</i>",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"<i>κ</i>",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"<i>λ</i>",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"<i>ζ</i>",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"<i>χ</i>",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"<i>ψ</i>",class:"MLK__tex hide-shift",insert:"\\psi",aside:"zeta",shift:"\\Psi"},{label:"<i>ω</i>",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"<i>β</i>",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"<i>ν</i>",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"<i>μ</i>",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"<i>ε</i>",class:"MLK__tex",insert:"\\varepsilon",aside:"espilon var."},{label:"<i>ϑ</i>",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"<i>ϰ</i>",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"<i>ϖ</i>",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"<i>ϱ</i>",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[action]"]]},symbols:{label:"∞\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]"]]}},Df={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"}]},Hc;function T0(e,i){var r,a,u;const d=Wo.singleton;if(!d)return;const g=Mu(e),b=(a=(r=d.getKeycap(g==null?void 0:g.id))==null?void 0:r.variants)!=null?a:"";if(typeof b=="string"&&!L0(b)||Array.isArray(b)&&b.length===0){i==null||i();return}const x={};let E="";for(const He of xm(b)){const Ot=C0(He),Ve=Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);x[Ve]=Ot;const[wt,$t]=Cf(Ot);E+=`<div id=${Ve} class="item ${$t}">${wt}</div>`}const R=document.createElement("div");R.setAttribute("aria-hidden","true"),R.className="MLK__variant-panel",R.style.height="auto";const F=Object.keys(x).length;let Y=5;F===1?Y=1:F===2||F===4?Y=2:F===3||F===5||F===6?Y=3:F>=7&&F<14&&(Y=4),R.style.width=`calc(var(--variant-keycap-length) * ${Y} + 12px)`,R.innerHTML=bp.createHTML(E),un.open({root:(u=d==null?void 0:d.container)==null?void 0:u.querySelector(".ML__keyboard"),child:R}),Hc=new AbortController;const{signal:oe}=Hc,ge=e==null?void 0:e.getBoundingClientRect();if(ge){ge.top-R.clientHeight<0&&(R.style.width="auto",F<=6?R.style.height="56px":F<=12?R.style.height="108px":F<=18?R.style.height="205px":R.classList.add("compact"));const He=Math.max(0,Math.min(window.innerWidth-R.offsetWidth,(ge.left+ge.right-R.offsetWidth)/2)),Ot=ge.top-R.clientHeight+5;R.style.transform=`translate(${He}px, ${Ot}px)`,R.classList.add("is-visible"),requestAnimationFrame(()=>{R.addEventListener("pointerup",Ve=>{const wt=Mu(Ve.target);!(wt!=null&&wt.id)||!x[wt.id]||(Nd(x[wt.id]),Wc(),i==null||i(),Ve.preventDefault())},{capture:!0,passive:!1,signal:oe}),R.addEventListener("pointerenter",Ve=>{const wt=Mu(Ve.target);!(wt!=null&&wt.id)||!x[wt.id]||wt.classList.add("is-active")},{capture:!0,signal:oe}),R.addEventListener("pointerleave",Ve=>{const wt=Mu(Ve.target);!(wt!=null&&wt.id)||!x[wt.id]||wt.classList.remove("is-active")},{capture:!0,signal:oe}),window.addEventListener("pointercancel",()=>{Wc(),i==null||i()},{signal:oe}),window.addEventListener("pointerup",()=>{Wc(),i==null||i()},{signal:oe})})}}function Wc(){Hc==null||Hc.abort(),Hc=null,un.state==="open"&&un.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(Ae))i.push({class:"swatch-button",label:'<span style="background:'+Ae[r]+'"></span>',command:["applyStyle",{backgroundColor:r}]});return i}}function L0(e){return Df[e]!==void 0}function xm(e){var i;return typeof e!="string"?e:(Df[e]||(Df[e]=(i=bm(e))!=null?i:[]),Df[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 jc(e){if(!e)return"";const i=new ln,r=new dt({mode:"math",type:"root",body:Zr(e,{context:i,args:u=>u==="@"?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}),a=mu(Pl(new Bt(r.render(i),{classes:"ML__base"}),i));return gu(a,{classes:"ML__latex"}).toMarkup()}function qc(e){var i;if(Array.isArray(e))return e.map(a=>qc(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=>C0(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=Qt();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"}[N.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~"]},d=(i=u[a])!=null?i:u.qwerty,g=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 d){const x=[];for(const E of b)/[a-z]/.test(E)?x.push({label:E,class:"hide-shift",shift:{label:E.toUpperCase()},variants:L0(E)?E:void 0}):E==="~"?a!=="dvorak"?x.push("[backspace]"):x.push({label:"[backspace]",width:1}):E==="^"?x.push("[shift]"):E===" "&&x.push("[separator-5]");g.push(x)}return g.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:qc({rows:g})}}function D0(e){if(e==="alphabetic")return Em();if(typeof e=="string")return console.assert(A0[e]!==void 0,`MathLive 0.98.5: unknown keyboard layout "${e}"`),D0(A0[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:d}=u,g=I(u,["rows"]);i=f(P({},g),{layers:qc({rows:e.rows})})}else if("markup"in e&&typeof e.markup=="string"){const u=e,{markup:d}=u,g=I(u,["markup"]);i=f(P({},g),{layers:qc(e.markup)})}else i=P({},e),"layers"in e?i.layers=qc(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 d of u.rows.flat()){Ru(d)&&(r=!0);const g=d.command;typeof g=="string"&&["undo","redo","cut","copy","paste"].includes(g)&&(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[d,g]of e.normalizedLayouts.entries()){const b=g,x=[d===i?"selected":"layer-switch"];b.tooltip&&x.push("MLK__tooltip"),b.labelClass&&x.push(...b.labelClass.split(" ")),u+=`<div class="${x.join(" ")}"`,b.tooltip&&(u+=" data-tooltip='"+((r=V(b.tooltip))!=null?r:b.tooltip)+"' "),d!==i&&(u+=`data-layer="${b.layers[0].id}"`),u+=`>${(a=b.label)!=null?a:"untitled"}</div>`}return u+="</div>",u}function Am(e,i){let r="";if(e.editToolbar==="none")return"";const u=[];i.selectionIsCollapsed?u.push("undo","redo","pasteFromClipboard"):u.push("cutToClipboard","copyToClipboard","pasteFromClipboard");const d={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(g=>d[g]).join(""),r}function Tm(e){for(const i of e)Lm(i)}function Lm(e){const i=Wo.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]=Cf(r);e.innerHTML=window.MathfieldElement.createHTML(a)}}function Dm(){os("virtual-keyboard"),os("core"),Af()}function Cm(){ga("core"),ga("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 Rm(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((g,b)=>Im(e,g,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 g of u)g.addEventListener("click",b=>{var x,E;let R=b.target,F="";for(;R&&!F;)F=(x=R==null?void 0:R.getAttribute("data-command"))!=null?x:"",R=(E=R==null?void 0:R.parentElement)!=null?E:null;F&&e.executeCommand(JSON.parse(F))});Tm(i.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"));const d=i.querySelectorAll(".MLK__layer");console.assert(d.length>0,"No virtual keyboards available");for(const g of d)g.addEventListener("pointerdown",b=>b.preventDefault());return e.currentLayer=e.latentLayer,i}function Im(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 d=e.registerKeycap(u),[g,b]=Cf(u);/(^|\s)separator/.test(b)?r+=`<div class="${b}"`:r+=`<div tabindex="-1" id="${d}" class="${b}"`,u.tooltip&&(r+=` data-tooltip="${u.tooltip}"`),r+=`>${g}</div>`}r+="</div>"}r+="</div>"}else i.markup&&(r+=i.markup);return i.container&&(r+="</div>"),i.backdrop&&(r+="</div>"),r}function Cf(e,i={shifted:!1}){var r,a,u,d,g,b,x;let E="",R=(r=e.class)!=null?r:"";if(i.shifted&&Ru(e)&&(R+=" is-active"),i.shifted&&"shift"in e)typeof e.shift=="string"?E=jc(e.shift):typeof e.shift=="object"&&(E=e.shift.label?e.shift.label:(a=jc(e.shift.latex||e.shift.insert||"")||e.shift.key)!=null?a:""),typeof e.shift=="object"&&(R=(d=(u=e.shift.class)!=null?u:e.class)!=null?d:"");else{if(E=e.label?e.label:(g=jc(e.latex||e.insert||"")||e.key)!=null?g:"",e.shift){let F;typeof e.shift=="string"?F=jc(e.shift):e.shift.label?F=e.shift.label:F=(b=jc(e.shift.latex||e.shift.insert||"")||e.shift.key)!=null?b:"",E+=`<span class="MLK__shift">${F}</span>`}e.aside&&(E+=`<aside>${e.aside}</aside>`)}return e.layer&&!/layer-switch/.test(R)&&(R+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(R)||(R+=" MLK__keycap"),!/\bw[0-9]+\b/.test(R)&&e.width&&(R+=(x={0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"}[e.width])!=null?x:""),[E,R||"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:"−",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"÷"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"×",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 C0(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 Zc;function Om(e){var i;if(e.button!==0)return;const r=Wo.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=Mu(e.target);if(!(u!=null&&u.id))return;const d=r.getKeycap(u.id);if(!d)return;console.assert(e.type==="pointerdown");const g=new AbortController,b=g.signal;u.classList.add("is-pressed"),u.addEventListener("pointerenter",Mf(g),{capture:!0,signal:b}),u.addEventListener("pointerleave",Mf(g),{capture:!0,signal:b}),u.addEventListener("pointercancel",Mf(g),{signal:b}),u.addEventListener("pointerup",Mf(g),{signal:b}),Ru(d)&&(u.classList.add("is-active"),r.shiftPressCount++),d.variants&&(Zc&&clearTimeout(Zc),Zc=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),T0(u,()=>{g.abort(),u==null||u.classList.remove("is-active")}))},300)),e.preventDefault()}function Mf(e){return i=>{const r=Mu(i.target);if(!(r!=null&&r.id))return;const a=Wo.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"),Ru(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"),Ru(u)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted));return}if(i.type==="pointerup"){Zc&&clearTimeout(Zc),Ru(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"}]):Nd(u.shift):Nd(u),a.shiftPressCount===1&&!i.shiftKey&&(a.shiftPressCount=0)),e.abort(),i.preventDefault();return}}}}function Nd(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=Wo.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 Mu(e){if(!e)return;let i=e;for(;i&&!Fm(i);)i=i.parentElement;return i!=null?i:void 0}function Ru(e){return!!e.class&&/(^|\s)shift($|\s)/.test(e.class)}var Wo=class sm{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 d=u.target;d!=null&&d.isConnected&&setTimeout(()=>{const g=M0();g&&!g.readOnly&&g.mathVirtualKeyboardPolicy==="auto"&&O()&&this.show({animate:!0})},300)}),document.addEventListener("focusout",u=>{u.target.mathVirtualKeyboardPolicy!=="manual"&&setTimeout(()=>{M0()||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=>D0(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 sm}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[d,g]=Cf(u,{shifted:this.isShifted});a.innerHTML=window.MathfieldElement.createHTML(d),a.className=g}}}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 d=a.style.paddingBottom;this.originalContainerBottomPadding=d;const g=u.offsetHeight-1;a.style.paddingBottom=d?`calc(${d} + ${g}px)`:`${g}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}),Wc(),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=Rm(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",r=>{r.shiftKey||((r.ctrlKey||r.button===2)&&T0(r.target),r.preventDefault(),r.stopPropagation())},{capture:!0}),(i=this.container)==null||i.appendChild(this.element)}handleEvent(i){if(Bd(i)){if(!Mc(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,d=Cu(u);if(window.top!==void 0&&d!=="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:Lf,action:i},r)}));return}if(a)a.postMessage(P({type:Lf,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 d of u)this.dispatchEvent(new KeyboardEvent("keydown",{key:d,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:d,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=Am(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=Cu(i);return k(i)?(r=i[0],r==="performWithFeedback"&&(i=i.slice(1),u=Cu(i)),a=i.slice(1)):r=i,r=r.replace(/-\w/g,d=>d[1].toUpperCase()),u==="virtual-keyboard"?Fa[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 M0(){var e,i;let r=mn(),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(M()&&!("mathVirtualKeyboard"in window))if(window===window.top){const e=Wo.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e})}else Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>ym.singleton,configurable:!0});function Rf(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[d,g]=a.split(",").map(b=>parseInt(b.trim()));i.scriptDepth=[d,g]}else throw new TypeError("Unexpected value for scriptDepth");break;case"mathVirtualKeyboardPolicy":let u=e.mathVirtualKeyboardPolicy.toLowerCase();if(u==="sandboxed"){if(window!==window.top){const d=Wo.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>d})}u="manual"}i.mathVirtualKeyboardPolicy=u;break;case"letterShapeStyle":e.letterShapeStyle==="auto"?N.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=Te(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 If(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:ze,backgroundColorMap:Rt,letterShapeStyle:N.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:Lc,inlineShortcuts:Ac,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",virtualKeyboardTargetOrigin:window==null?void 0:window.origin,originValidator:"none",onInlineShortcut:()=>"",onScrollIntoView:null,onExport:xu,value:""}}function R0(e){return e.defaultMode==="inline-math"?"math":e.defaultMode}function jo(e,i){!e||!i||(k(e)?e.forEach(r=>jo(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),jo(e.body,i),jo(e.above,i),jo(e.below,i),jo(e.subscript,i),jo(e.superscript,i)))}function $d(e,i,r,a){function u(g,b){for(const x of d)if(x.style[g]!==b)return!1;return!0}if(i=e.normalizeRange(i),i[0]===i[1])return!1;const d=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=ro),r.variant&&u("variant",r.variant)&&(r.variant="normal"),r.variantStyle&&u("variantStyle",r.variantStyle)&&(r.variantStyle=""));for(const g of d)g.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 Bc(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)}Yt(["math","displaymath"],ea),Yt("center",ea),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 _n("lines",e.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}]})}),gt("array","{columns:colspec}",(e,i,r,a)=>new _n(e,Kd(i),r,{columns:a[0],mathstyleName:"textstyle"})),gt(["equation","equation*","subequations"],"",(e,i,r)=>new _n(e,Kd(i),r,{columns:[{align:"c"}]})),gt(["multline","multline*"],"",ea),gt(["align","align*","aligned","eqnarray"],"",ea),gt("split","",ea),gt(["gather","gathered"],"",ea),gt(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",ea),gt(["smallmatrix","smallmatrix*"],"[columns:colspec]",ea),gt(["cases","dcases","rcases"],"",ea);function $m(e){for(const i of e)for(const r of i)if(r.length>0)return!1;return!0}function Kd(e,i=1){return $m(e)?Array(i).fill([[new dt({type:"first"}),new va]]):e.map(r=>r.length===0?[[new dt({type:"first"})]]:r.map(a=>a.length===0?[new dt({type:"first"})]:(a[0].type!=="first"&&a.unshift(new dt({type:"first"})),a)))}function ea(e,i=[[[]]],r=[],a=[]){switch(i=Kd(i,["split","align","align*","aligned","eqnarray"].includes(e)?2:1),e){case"math":return new _n(e,i,r,{mathstyleName:"textstyle"});case"displaymath":return new _n(e,i,r,{mathstyleName:"textstyle"});case"center":return new _n(e,i,r,{columns:[{align:"c"}]});case"multline":case"multline*":return new _n(e,i,r,{columns:[{align:"m"}],leftDelim:".",rightDelim:"."});case"split":return new _n(e,i,r,{columns:[{align:"r"},{align:"l"}],minColumns:2});case"gather":case"gathered":return new _n(e,i,r,{columns:[{gap:.25},{align:"c"},{gap:0}]});case"pmatrix":case"pmatrix*":return new _n(e,i,r,{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:Vl(a[0])});case"bmatrix":case"bmatrix*":return new _n(e,i,r,{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:Vl(a[0])});case"Bmatrix":case"Bmatrix*":return new _n(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:Vl(a[0])});case"vmatrix":case"vmatrix*":return new _n(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:Vl(a[0])});case"Vmatrix":case"Vmatrix*":return new _n(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:Vl(a[0])});case"matrix":case"matrix*":return new _n(e,i,r,{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:Vl(a==null?void 0:a[0])});case"smallmatrix":case"smallmatrix*":return new _n(e,i,r,{mathstyleName:"scriptstyle",columns:Vl(a==null?void 0:a[0]),colSeparationType:"small",arraystretch:.5});case"cases":case"dcases":return new _n(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 _n(e,i,r,{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:[{align:"l"},{gap:1},{align:"l"}]});case"lines":return new _n(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 d=[{gap:0},{align:"r"},{gap:.25},{align:"l"}];let g=2;for(;g<u;)d.push({gap:1},{align:"r"},{gap:.25},{align:"l"}),g+=2;return d.push({gap:0}),new _n(e,i,r,{arraycolsep:0,columns:d,minColumns:2})}}return new _n(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 _n);)r=r.parent;if(r&&r.type==="array"&&r.environmentName,!r||!(r.parent instanceof _n)){const a=e.at(e.position);if(r=a,!r.parent.parent){let u=e.extractAtoms([e.position,e.lastOffset]),d=e.extractAtoms([0,e.position]);d.length===0&&(d=Ff()),u.length===0&&(u=Ff());let g;return i.endsWith("column")?(g=ea("split",[[d,u]]),e.root=g,Gl(g,0,0)?Hl(e,g,0,0):Gl(g,0,1)?Hl(e,g,0,1):e.position=e.offsetOf(a)):(g=ea("lines",[[d],[u]]),e.root=g,Gl(g,0,0)?Hl(e,g,0,0):Gl(g,1,0)?Hl(e,g,1,0):e.position=e.offsetOf(a)),[void 0,[0,0]]}if(r.parent instanceof or){const u=r.parent;let d=e.extractAtoms([e.position,e.offsetOf(u.lastChild)]),g=e.extractAtoms([e.offsetOf(u.firstChild),e.position]);g.length===0&&(g=Ff()),d.length===0&&(d=Ff());let b="pmatrix";const x=u.leftDelim,E=u.rightDelim;x==="("&&(E===")"||E==="?")?b="pmatrix":(x==="["||x==="\\lbrack")&&(E==="]"||E==="\\rbrack"||E==="?")?b="bmatrix":x==="\\vert"&&E==="\\vert"?b="vmatrix":x==="\\Vert"&&E==="\\Vert"?b="Vmatrix":(x==="{"||x==="\\lbrace")&&(E==="."||E==="?")&&(b="cases");const R=ea(b,i.endsWith("column")?[[g,d]]:[[g],[d]]);return u.parent.addChildBefore(R,u),u.parent.removeChild(u),Gl(R,0,0)?Hl(e,R,0,0):i.endsWith("column")?Gl(R,0,1)?Hl(e,R,0,1):e.position=e.offsetOf(r):Gl(R,1,0)?Hl(e,R,1,0):e.position=e.offsetOf(r),[void 0,[0,0]]}}return r&&r.parent instanceof _n?[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 Pf(e,i,r,a,u){const d=i.getCell(r,a);d&&e.setPositionHandlingPlaceholder(e.offsetOf(d[u==="start"?0:d.length-1]))}function Of(e,i){const[r,[a,u]]=Km(e,i);if(r)switch(i){case"after row":r.addRowAfter(a),Pf(e,r,a+1,0,"end");break;case"after column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnAfter(u),Pf(e,r,a,u+1,"end");break;case"before row":r.addRowBefore(a),Pf(e,r,a,0,"start");break;case"before column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnBefore(u),Pf(e,r,a,u,"start");break}}function I0(e){return e.contentWillChange({inputType:"insertText"})?(Of(e,"after row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function zm(e){return e.contentWillChange({inputType:"insertText"})?(Of(e,"before row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function P0(e){return e.contentWillChange({inputType:"insertText"})?(Of(e,"after column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function Vm(e){return e.contentWillChange({inputType:"insertText"})?(Of(e,"before column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function O0(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),d=u.type==="array"?u:e.parentEnvironment;return d.environmentName=i,d.leftDelim=r,d.rightDelim=a,e.contentDidChange({}),!0}function F0(e,i){let r=e.at(e.position);for(;r&&!(Array.isArray(r.parentBranch)&&r.parent instanceof _n);)r=r.parent;if(Array.isArray(r==null?void 0:r.parentBranch)&&(r==null?void 0:r.parent)instanceof _n){const a=r.parent,u=r.parentBranch;let d;switch(i){case"row":if(a.rowCount>1){a.removeRow(u[0]);const g=a.getCell(Math.max(0,u[0]-1),u[1]);d=e.offsetOf(g[g.length-1])}break;case"column":if(a.colCount>a.minColumns){a.removeColumn(u[1]);const g=a.getCell(u[0],Math.max(0,u[1]-1));d=e.offsetOf(g[g.length-1])}break}d&&e.setPositionHandlingPlaceholder(d)}}function Gm(e){return e.contentWillChange({inputType:"deleteContent"})?(F0(e,"row"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}function Hm(e){return e.contentWillChange({inputType:"deleteContent"})?(F0(e,"column"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}Cs({addRowAfter:I0,addColumnAfter:P0,addRowBefore:zm,addColumnBefore:Vm,removeRow:Gm,removeColumn:Hm,setEnvironment:O0},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});function Ff(){return[new va]}var B0=class am{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>am.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=i!=null?i:"",!0):!1}};B0.maximumDepth=1e3;var Wm=B0;function Ud(e,i,r){if(e.at(i).mode!=="text")return i;const a=r==="backward"?-1:1;let u;if(Je.test(e.at(i).value)){let d=i,g;do g=e.at(d).mode==="text"&&Je.test(e.at(d).value),d+=a;while(e.at(d)&&g);u=e.at(d)?d-2*a:d-a}else if(/\s/.test(e.at(i).value)){let d=i;for(;e.at(d)&&e.at(d).mode==="text"&&/\s/.test(e.at(d).value);)d+=a;if(!e.at(d))u=d-a;else{let g=!0;do g=e.at(d).mode==="text"&&!/\s/.test(e.at(d).value),d+=a;while(e.at(d)&&g);u=e.at(d)?d-2*a:d-a}}else{let d=i;for(;e.at(d)&&e.at(d).mode==="text"&&!/\s/.test(e.at(d).value);)d+=a;u=e.at(d)?d:d-a;let g=!0;for(;e.at(d)&&g;)g=e.at(d).mode==="text"&&/\s/.test(e.at(d).value),g&&(u=d),d+=a;u=e.at(d)?d-2*a:d-a}return u-(a>0?0:1)}function Iu(e,i,r){var a,u,d,g,b,x,E;const R=e.position;(a=r==null?void 0:r.extend)!=null&&a||e.collapseSelection(i);let F=e.at(e.position);if(i==="forward"&&(F.type==="subsup"?(F=F.rightSibling,F||(F=e.at(e.position+1))):F=e.at(e.position+1)),!F)return e.announce("plonk"),!1;let Y=e.offsetOf(F);if(F instanceof xl)Y=Ud(e,Y,i);else if(F instanceof Sr)if(F.isSuggestion)for(console.assert(i==="forward");F&&F instanceof Sr;)F.isSuggestion=!1,Y=e.offsetOf(F),F=F.rightSibling;else if(i==="forward"){if(F=F.rightSibling,!F||!(F instanceof Sr))return e.announce("plonk"),!1;for(;F&&F instanceof Sr&&/[a-zA-Z\*]/.test(F.value);)Y=e.offsetOf(F),F=F.rightSibling}else{if(F=F.leftSibling,!F||!(F instanceof Sr))return e.announce("plonk"),!1;for(;F&&F instanceof Sr&&/[a-zA-Z\*]/.test(F.value);)Y=e.offsetOf(F),F=F.leftSibling}else if(i==="forward"&&F.type==="mopen"){let oe=0;do F.type==="mopen"?oe+=1:F.type==="mclose"&&(oe-=1),F=F.rightSibling;while(!F.isLastSibling&&oe!==0);Y=e.offsetOf(F.leftSibling)}else if(i==="backward"&&F.type==="mclose"){let oe=0;do F.type==="mopen"?oe+=1:F.type==="mclose"&&(oe-=1),F=F.leftSibling;while(!F.isFirstSibling&&oe!==0);Y=e.offsetOf(F)}else if(i==="backward")if(F.type==="first")for(;Y>0&&F.type==="first";)Y-=1,F=e.at(Y);else{const oe=F.type;F.type==="subsup"&&(Y=e.offsetOf(e.at(Y).leftSibling)),Y-=1;let ge=(u=e.at(Y))==null?void 0:u.type;for(;Y>=0&&ge===oe;)((d=e.at(Y))==null?void 0:d.type)==="subsup"?Y=e.offsetOf(e.at(Y).leftSibling):Y-=1,ge=e.at(Y).type}else{const{type:oe}=F;let ge=(g=e.at(Y))==null?void 0:g.type;const{lastOffset:He}=e;for(;Y<=He&&(ge===oe||ge==="subsup");){for(;((b=e.at(Y).rightSibling)==null?void 0:b.type)==="subsup";)Y=e.offsetOf(e.at(Y).rightSibling);Y+=1,ge=(x=e.at(Y))==null?void 0:x.type}Y-=1}if((E=r==null?void 0:r.extend)!=null&&E){if(!e.setSelection(e.anchor,Y))return e.announce("plonk"),!1}else{if(Y===e.position)return e.announce("plonk"),!1;e.position=Y}return e.announce("move",R),e.mathfield.stopCoalescingUndo(),!0}function Ba(e,i,r){var a,u;if(r=r!=null?r:{extend:!1},e.mathfield.adoptStyle=i==="backward"?"right":"left",i!=="forward"){const[b,x]=Pa(e);b!==void 0&&x!==void 0&&e.deleteAtoms([b,x])}if(i==="upward")return qm(e,r);if(i==="downward")return Zm(e,r);if(r.extend){let b=Bf(e,e.position,i);b<0&&(b=0),b>e.lastOffset&&(b=e.lastOffset);const x=e.setSelection(e.anchor,b);return e.mathfield.stopCoalescingUndo(),x}if(e.selectionIsPlaceholder){e.collapseSelection(i);const b=Ba(e,i);return e.mathfield.stopCoalescingUndo(),b}let d=e.position;const g=d;if(e.collapseSelection(i)?(d=e.position,N0(e,d)||(d=Bf(e,d,i))):d=Bf(e,d,i),d<0||d>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(d),e.mathfield.stopCoalescingUndo(),e.announce("move",g),!0}function Bf(e,i,r){return i=i+(r==="forward"?1:-1),i<0||i>e.lastOffset||N0(e,i)?i:Bf(e,i,r)}function N0(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 d=Rc(e.getHTMLElement(i[u])).right,g=Math.abs(r-d);if(g<=a)a=g;else break}return i[u-1]}function Nf(e,i,r,a,u){const d=e.mathfield.hasEditablePrompts,g=d?r.filter(E=>E.type==="prompt"&&!E.captureSelection):r,b=Rc(e.mathfield.getHTMLElement(i)).right,x=e.offsetOf(jm(e.mathfield,g,b))-(d?1:0);if(a){const[E,R]=e.selection.ranges[0];let F;x<(u==="up"?E:R)?F={ranges:[[x,R]],direction:"backward"}:F={ranges:[[E,x]],direction:"forward"},e.setSelection(F)}else e.setPositionHandlingPlaceholder(x);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 d=()=>{var x,E;let R=!0;return e.silenceNotifications||(R=(E=(x=e.mathfield.host)==null?void 0:x.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?E:!0),e.announce(R?"plonk":"line"),R},g=e.at(e.position);let b=g;for(;b&&b.parentBranch!=="below"&&!(Array.isArray(b.parentBranch)&&b.parent instanceof _n);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof _n){const x=b.parent;if(b.parentBranch[0]<1)return d();const E=b.parentBranch[0]-1,R=x.array[E][b.parentBranch[1]];if(!R.some(Y=>Y.type==="prompt"&&!Y.captureSelection)&&e.mathfield.hasEditablePrompts)return d();Nf(e,g,R,u,"up")}else if(b){const x=(a=b.parent.branch("above"))!=null?a:b.parent.createBranch("above");if(!x.some(R=>R.type==="prompt"&&R.placeholderId)&&e.mathfield.hasEditablePrompts)return d();Nf(e,g,x,u,"up")}else return d();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 d=()=>{var x,E;let R=!0;return e.silenceNotifications||(R=(E=(x=e.mathfield.host)==null?void 0:x.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?E:!0),e.announce(R?"plonk":"line"),R},g=e.at(e.position);let b=g;for(;b&&b.parentBranch!=="above"&&!(Array.isArray(b.parentBranch)&&b.parent instanceof _n);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof _n){const x=b.parent;if(b.parentBranch[0]+1>x.array.length-1)return d();const E=b.parentBranch[0]+1,R=x.array[E][b.parentBranch[1]];if(!R.some(Y=>Y.type==="prompt"&&!Y.captureSelection)&&e.mathfield.hasEditablePrompts)return d();Nf(e,g,R,u,"down")}else if(b){const x=(a=b.parent.branch("below"))!=null?a:b.parent.createBranch("below");if(!x.some(R=>R.type==="prompt")&&e.mathfield.hasEditablePrompts)return d();Nf(e,g,x,u,"down")}else return d();return!0}function $0(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 K0(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 Tu({style:r.computedStyle}),r),r=r.rightSibling),r.createBranch("superscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(r.superscript[0]))),!0}function U0(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 Tu({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(x){const E=[],R=[];return[...x.querySelectorAll(`input, select, textarea, a[href], button,
|
|
|
[tabindex], audio[controls], video[controls],
|
|
|
[contenteditable]:not([contenteditable="false"]), details>summary`)].filter(i).forEach((Y,oe)=>{const ge=a(Y);ge===0?E.push(Y):R.push({documentOrder:oe,tabIndex:ge,node:Y})}),R.sort((Y,oe)=>Y.tabIndex===oe.tabIndex?Y.documentOrder-oe.documentOrder:Y.tabIndex-oe.tabIndex).map(Y=>Y.node).concat(E)}function i(x){return!(!r(x)||u(x)||a(x)<0)}function r(x){return!(x.disabled||x.type==="hidden"&&x.tagName.toUpperCase()==="INPUT"||b(x))}function a(x){var E;const R=Number.parseInt((E=x.getAttribute("tabindex"))!=null?E:"NaN",10);return Number.isNaN(R)?x.contentEditable==="true"||(x.nodeName==="AUDIO"||x.nodeName==="VIDEO")&&x.getAttribute("tabindex")===null?0:x.tabIndex:R}function u(x){return x.tagName.toUpperCase()==="INPUT"&&x.type==="radio"&&!g(x)}function d(x,E){for(const R of x)if(R.checked&&R.form===E)return R;return null}function g(x){var E;if(!x.name)return!0;const F=((E=x.form)!=null?E:x.ownerDocument).querySelectorAll('input[type="radio"][name="'+x.name+'"]'),Y=d(F,x.form);return!Y||Y===x}function b(x){if(!M()||x===document.activeElement||x.contains(document.activeElement))return!1;if(getComputedStyle(x).visibility==="hidden")return!0;const E=x.getBoundingClientRect();if(E.width===0||E.height===0)return!0;for(;x;){if(getComputedStyle(x).display==="none")return!0;x=x.parentElement}return!1}return M()?e(document.body):[]}function ps(e,i,r="forward"){const a=e.position;if(Array.isArray(i)){const u=e.offsetOf(i[0]),d=e.offsetOf(i[i.length-1]);return r==="forward"?e.setSelection(u,d):e.setSelection(d,u),e.announce("move",a),e.mathfield.stopCoalescingUndo(),!0}return r==="forward"?ps(e,[i.leftSibling,i]):ps(e,[i,i.leftSibling])}function wa(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 $f(e,i,r=!0){var a,u;const d=i==="forward"?1:-1;e.at(e.anchor).type==="placeholder"&&Ba(e,i);let g;const b=e.at(e.anchor).parentPrompt;b?i==="forward"?g=e.offsetOf(b)+1:g=e.offsetOf(b.leftSibling):g=Math.max(e.position+d,0);const x=zd(e,g,i);if(!x||i==="forward"&&e.offsetOf(x)<g||i==="backward"&&e.offsetOf(x)>g){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 R=Jm();if(!document.activeElement||R.length<=1)return e.announce("plonk"),!1;let F=R.indexOf(document.activeElement)+d;return F<0&&(F=R.length-1),F>=R.length&&(F=0),R[F].focus(),e.mathfield.stopCoalescingUndo(),!0}return wa(e,x),!0}function zd(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)}Cs({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 d;if(typeof u=="string"&&(d=i[u]),!d){const b=r.subsupPlacement?U0(e):K0(e);return e.mathfield.stopCoalescingUndo(),b}a.branch(d)||a.createBranch(d);const g=e.setSelection(e.getBranchRange(e.offsetOf(a),d));return e.mathfield.stopCoalescingUndo(),g},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=>$0(e),moveToNextChar:e=>Ba(e,"forward"),moveToPreviousChar:e=>Ba(e,"backward"),moveUp:e=>Ba(e,"upward"),moveDown:e=>Ba(e,"downward"),moveToNextWord:e=>Iu(e,"forward"),moveToPreviousWord:e=>Iu(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 $f(e,"forward");const d=e.at(e.position);if(d.mode==="text"){if(e.selectionIsCollapsed){let Y=d;for(;Y&&Y.mode==="text";)Y=Y.leftSibling;let oe=d;for(;((i=oe.rightSibling)==null?void 0:i.mode)==="text";)oe=oe.rightSibling;if(Y&&oe)return ps(e,[Y,oe])}if(d.rightSibling.mode==="text"){let Y=d;for(;Y&&Y.mode==="text";)Y=Y.rightSibling;return Y?(wa(e,(r=Y.leftSibling)!=null?r:Y),e.mathfield.switchMode("math"),!0):wa(e,e.lastOffset)}}const b=e.at(e.anchor).parentPrompt,x=b?e.offsetOf(b)+1:Math.max(e.position+1,0),E=zd(e,x,"forward");if(E)return wa(e,E);const R=z0(e,d,Y=>Y.type==="leftright"||Y.type==="text","forward");if(R){if(R.mode==="text"){let Y=R;for(;Y&&Y.mode==="text";)Y=Y.rightSibling;return ps(e,[(a=R.leftSibling)!=null?a:R,(u=Y.leftSibling)!=null?u:Y])}return ps(e,R)}const F=d.parent;if(F){if(F.type==="leftright"||F.type==="surd")return ps(e,F);if(d.parentBranch==="superscript"&&F.subscript)return ps(e,F.subscript);if(d.parentBranch==="above"&&F.below)return ps(e,F.below);if(d.parentBranch==="superscript"||d.parentBranch==="subscript")return wa(e,F);if(d.parentBranch==="above"||d.parentBranch==="below")return ps(e,F)}return wa(e,e.lastOffset)},moveToPreviousGroup:e=>{var i;if(e.position===0&&e.anchor===0)return $f(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 x=r;for(;((i=x.rightSibling)==null?void 0:i.mode)==="text";)x=x.rightSibling;if(b&&x)return ps(e,[b,x])}for(;r&&r.mode==="text";)r=r.leftSibling;return r?wa(e,r):wa(e,0)}const u=e.at(e.anchor).parentPrompt,d=u?e.offsetOf(u.leftSibling):Math.max(e.position-1,0),g=zd(e,d,"backward");if(g)return wa(e,g);if(a==="math"){const b=z0(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 ps(e,[b,E])}return ps(e,b)}const x=r.parent;if(x){if(x.type==="leftright"||x.type==="surd")return ps(e,x);if(r.parentBranch==="subscript"&&x.superscript)return ps(e,x.superscript);if(r.parentBranch==="below"&&x.above)return ps(e,x.above);if(r.parentBranch==="superscript"||r.parentBranch==="subscript")return wa(e,x);if(r.parentBranch==="above"||r.parentBranch==="below")return ps(e,x)}return wa(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:K0,moveToSubscript:U0},{target:"model",changeSelection:!0}),Cs({moveToNextPlaceholder:e=>$f(e,"forward"),moveToPreviousPlaceholder:e=>$f(e,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"});function z0(e,i,r,a){if(a==="forward"){let d=i.rightSibling;for(;d&&!r(d);)d=d.rightSibling;return d}let u=i.leftSibling;for(;u&&!r(u);)u=u.leftSibling;return u}function Kf(e,i,r){typeof i=="function"&&(r=i,i=1/0),i===void 0&&(i=1/0);let a=e.position,u=!1,d="";for(;!u;){const g=e.at(a);u=i===0||g===void 0||g.type==="first"||g.mode!=="math"||!(g.type&&/mord|mpunct|operator/.test(g.type)||g.type==="mop"&&/[a-zA-Z ]+/.test(g.value))||!g.hasEmptyBranch("superscript")||!g.hasEmptyBranch("subscript")||typeof r=="function"&&!r(g),u||(g.mode="text",g.command=g.value,g.verbatimLatex=void 0,d+=g.value),a-=1,i-=1}e.contentDidChange({data:d,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 d=[];for(;!u;){const g=e.at(a);u=i===0||!g||g.type==="first"||g.isFirstSibling||g.mode!=="text"||g.value===" "||typeof r=="function"&&!r(g),u||(d.push(dt.serialize([g],{defaultMode:"math"})),g.mode="math"),a-=1,i-=1}Vd(e),e.contentDidChange({data:fn(d),inputType:"insertText"})}function Vd(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||!tn(r))return!1;const u=Tr(r);if(!a.selectionIsCollapsed)return!!(e.model.mode==="text"&&/[/_^]/.test(u));const d=Qm(a)+u;if(e.model.mode==="text"){if(i==="Esc"||/[/\\]/.test(u))return!0;if(/[\^_]/.test(u))return/(^|\s)[a-zA-Z][^_]$/.test(d)&&Wl(a,1),!0;const g={")":"(","}":"{","]":"["}[u],{parent:b}=a.at(a.position);if(g&&b instanceof or&&b.leftDelim===g)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(d))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(u))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z] $/.test(d))return Wl(a,1),!1;if(/\D\.[^\d\s]$/.test(d)){Wl(a,1);const x=a.at(a.position);return x.value="\u22C5",x.style.variant="normal",x.command="\\cdot",x.verbatimLatex=void 0,a.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(d)||/\.\d$/.test(d)||/\([\d+\-.]$/.test(d))return Wl(a,1),!0;if(/\([a-z][,;]$/.test(d))return Wl(a,2),!0;if(/[\d+\-=><*|]$/.test(u))return Vd(a),!0}else{if(i==="[Space]")return Kf(a,void 0,g=>/[a-z][:,;.]$/.test(g.value)),!0;if(/[a-zA-Z]{3,}$/.test(d)&&!/(dxd|abc|xyz|uvw)$/.test(d))return Kf(a,void 0,g=>/[a-zA-Z]/.test(g.value)),!0;if(/(^|\W)(if)$/i.test(d))return Kf(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(d)&&!/(αβγ)$/.test(d))return Kf(a,void 0,g=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(g.value)),!0;if(u==="?"||u==="."&&!/[\d-+]\.$/.test(d))return!0}return!1}function tg(e,i){if(!e.isSelectionEditable||!e.keystrokeCaptionVisible)return;const r=V0(),a=e.element.getBoundingClientRect();r.style.left=`${a.left}px`,r.style.top=`${a.top-64}px`,r.innerHTML=window.MathfieldElement.createHTML("<span>"+(Ei(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=V0();i.innerHTML=""}else{const i=vo("mathlive-keystroke-caption-panel");i.style.visibility="hidden"}return!1}function V0(){const e=document.getElementById("mathlive-keystroke-caption-panel");return e||(os("keystroke-caption"),os("core"),vo("mathlive-keystroke-caption-panel"))}function ng(){document.getElementById("mathlive-keystroke-caption-panel")&&(Du("mathlive-keystroke-caption-panel"),ga("core"),ga("keystroke-caption"))}function G0(e,i){var r,a,u;const{model:d}=e,g=ls(i);if(i.isTrusted){pi(i);const oe=Qt();e.keyboardLayout!==oe.id&&(e.keyboardLayout=oe.id,e._keybindings=void 0)}if(clearTimeout(e.inlineShortcutBufferFlushTimer),e.inlineShortcutBufferFlushTimer=0,tg(e,g),i.isTrusted&&i.defaultPrevented)return e.flushInlineShortcutBuffer(),!1;let b,x="",E;const R=e.inlineShortcutBuffer;if(e.isSelectionEditable){if(d.mode==="math")if(g==="[Backspace]")R.pop();else if(!tn(i))e.flushInlineShortcutBuffer();else{const oe=Tr(i),ge=[...(a=(r=R[R.length-1])==null?void 0:r.keystrokes)!=null?a:[],oe];R.push({state:d.getState(),keystrokes:ge,leftSiblings:rg(e)});let He=0,Ot="";for(;!b&&He<ge.length;)E=R.length-(ge.length-He),Ot=ge.slice(He).join(""),b=bu(R[E].leftSiblings,Ot,e.options.inlineShortcuts),!b&&/^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(Ot)&&(b=e.options.onInlineShortcut(e,Ot)),He+=1;e.flushInlineShortcutBuffer({defer:!0})}e.options.smartMode&&(b?e.switchMode("math"):eg(e,g,i)&&(e.switchMode({math:"text",text:"math"}[d.mode]),x=""))}if(!b){if(x||(x=wf(e.keybindings,d.mode,i)),!x&&(g==="[Enter]"||g==="[Return]")){let oe=!1;return d.contentWillChange({inputType:"insertLineBreak"})&&(e.host&&(oe=!e.host.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),oe||i.preventDefault&&(i.preventDefault(),i.stopPropagation()),d.contentDidChange({inputType:"insertLineBreak"})),oe}if((!x||g==="[Space]")&&d.mode==="math"){if(g==="[Space]"){if(e.adoptStyle="none",e.flushInlineShortcutBuffer(),e.options.mathModeSpace)return Hn.insert(d,e.options.mathModeSpace,{format:"latex",mode:"math"}),e.snapshot("insert-space"),x="",e.dirty=!0,e.scrollIntoView(),i.preventDefault&&(i.preventDefault(),i.stopPropagation()),!1;const oe=d.at(d.position+1),ge=d.at(d.position-1);if((oe==null?void 0:oe.mode)==="text"||(ge==null?void 0:ge.mode)==="text")return Hn.insert(d," ",{mode:"text"}),e.snapshot("insert-space"),e.dirty=!0,e.scrollIntoView(),!1}(u=d.at(d.position))!=null&&u.isDigit()&&window.MathfieldElement.decimalSeparator===","&&Tr(i)===","&&(x="insertDecimalSeparator")}}if(!b&&!x){if(d.mathfield.smartFence){if(Hd(d,Tr(i),e.effectiveStyle))return e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}else{const{parent:oe}=d.at(d.position);if(oe instanceof or&&oe.rightDelim==="?"&&d.at(d.position).isLastSibling&&/^[)}\]|]$/.test(g))return e.snapshot(),oe.isDirty=!0,oe.rightDelim=g,d.position+=1,d.selectionDidChange(),d.contentDidChange({data:Tr(i),inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1;if(!d.selectionIsCollapsed){const ge=Tr(i);if(ge==="("||ge==="{"||ge==="["){const He={"(":"(","{":"\\lbrace","[":"\\lbrack"}[ge],Ot={"(":")","{":"\\rbrace","[":"\\rbrack"}[ge],[Ve,wt]=Fr(d.selection);return e.snapshot(),d.position=wt,Hn.insert(d,Ot,{format:"latex"}),d.position=Ve,Hn.insert(d,He,{format:"latex"}),d.setSelection(Ve+1,wt+1),d.contentDidChange({data:ge,inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}}}return!0}const F=d.at(Math.max(d.position,d.anchor)),{parent:Y}=F;if(x==="moveAfterParent"&&(Y==null?void 0:Y.type)==="leftright"&&F.isLastSibling&&e.options.smartFence&&Hd(d,".",e.defaultStyle)&&(x="",dr(e)),e.keyboardDelegate.cancelComposition(),x)e.executeCommand(x);else if(b){const oe=e.effectiveStyle;d.setState(R[E].state);const ge=R[R.length-1].keystrokes;for(const He of ge)Hn.insert(d,He,{silenceNotifications:!0,style:oe});e.snapshot("insert-shortcut"),d.setState(R[E].state),d.deferNotifications({content:!0,selection:!0,data:b,type:"insertText"},()=>(Hn.insert(d,b,{format:"latex",style:oe}),Vd(e.model),b.endsWith(" ")&&(e.switchMode("text"),Hn.insert(d," ",{style:oe,mode:"text"})),e.snapshot(),d.selectionIsCollapsed||e.flushInlineShortcutBuffer(),!0)),e.dirty=!0,d.announce("replacement")}return e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}function Gd(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=Fh(i);const d=window.mathVirtualKeyboard;if(d!=null&&d.isShifted&&(u=typeof u=="string"?u.toUpperCase():u.map(x=>x.toUpperCase())),r.simulateKeystroke){let x=!0;for(const E of u)G0(e,new KeyboardEvent("keypress",{key:E}))&&(x=!1);if(x)return}const g=a.at(a.position),b=P(P({},g.computedStyle),e.defaultStyle);if(a.selectionIsCollapsed||(a.deleteAtoms(Fr(a.selection)),e.snapshot("delete")),a.mode==="latex")a.deferNotifications({content:!0,selection:!0,data:i,type:"insertText"},()=>{ds(e);for(const x of u)Hn.insert(a,x);e.snapshot("insert-latex"),Qs(e)});else if(a.mode==="text"){for(const x of u)Hn.insert(a,x,{style:b});e.snapshot("insert-text")}else if(a.mode==="math")for(const x of u)sg(e,x,b,g);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 d={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[i];if(i===" "&&e.options.mathModeSpace&&(d=["insert",e.options.mathModeSpace]),d){e.executeCommand(d);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),Hn.insert(u,i,{style:r}),e.snapshot(),$0(u),e.snapshot();return}if(/[a-zA-Z0-9]/.test(i)&&e.adoptStyle!=="none"){const g=e.adoptStyle==="left"?a:a.parent?a.rightSibling:null;(g==null?void 0:g.type)==="mord"&&/[a-zA-Z0-9]/.test(g.value)&&(r=P({},r),g.style.variant&&(r.variant=g.style.variant),g.style.variantStyle&&(r.variantStyle=g.style.variantStyle))}Hn.insert(u,i,{style:r}),e.snapshot(`insert-${u.at(u.position).type}`)}function ag(e){e.selectionIsCollapsed||(e.deleteAtoms(Fr(e.selection)),e.mathfield.snapshot("delete"))}function Hd(e,i,r){if(!i||e.mode!=="math")return!1;const a=e.at(e.position),{parent:u}=a,d={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[i];if(!d)return!1;const g=Uo[d],b=Su[d];if(!e.selectionIsCollapsed){e.mathfield.snapshot();const[x,E]=Fr(e.selection),R=e.extractAtoms([x,E]),F=u.addChildrenAfter([new or("left...right",R,{leftDelim:d,rightDelim:b})],e.at(x));return e.setSelection(e.offsetOf(F.firstChild),e.offsetOf(F.lastChild)),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:d,inputType:"insertText"}),!0}if(d==="|"){const x=u instanceof or?u.leftDelim+u.rightDelim:"";if(x==="\\lbrace\\rbrace"||x==="\\{\\}"||x==="\\lbrace?")return e.mathfield.snapshot(),Hn.insert(e,"\\,\\middle\\vert\\,",{format:"latex",style:r}),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:d,inputType:"insertText"}),!0}if(b){if(u instanceof or&&u.firstChild===a&&(u.leftDelim==="?"||u.leftDelim==="."))return u.leftDelim=d,u.isDirty=!0,e.mathfield.snapshot(),e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(!(u instanceof or)){let F=a;for(;F&&!(F.type==="mclose"&&F.value===b);)F=F.rightSibling;if(F){e.mathfield.snapshot();const Y=e.extractAtoms([e.offsetOf(a),e.offsetOf(F)]);return Y.pop(),u.addChildrenAfter([new or("left...right",Y,{leftDelim:d,rightDelim:b})],a),e.position=e.offsetOf(u.firstChild)+1,e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}}const x=e.offsetOf(a.lastSibling);let E;for(E=e.position;E<=x;E++){const F=e.at(E);if(F instanceof or&&(F.leftDelim==="?"||F.leftDelim===".")&&H0(d,F.rightDelim))break}const R=e.at(E);if(E<=x&&R instanceof or){R.leftDelim=d,e.mathfield.snapshot();let F=e.extractAtoms([e.position,E-1]);return F=F.filter(Y=>Y.type!=="first"),R.addChildren(F,R.parentBranch),e.position+=1,e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(u instanceof or&&(u.leftDelim==="?"||u.leftDelim===".")&&H0(d,u.rightDelim)){u.isDirty=!0,u.leftDelim=d,e.mathfield.snapshot();const F=e.extractAtoms([e.offsetOf(a.firstSibling),e.position]);for(const Y of F)u.parent.addChildBefore(Y,u);return e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(!(u instanceof or&&u.leftDelim==="|")){if(e.mathfield.snapshot(),Hn.insert(e,`\\left${d}\\right?`,{format:"latex",style:r}),a.lastSibling.type!=="first"){const F=e.offsetOf(a.lastSibling),Y=e.extractAtoms([e.position,F]);e.at(e.position).body=Y,e.position-=1}return e.mathfield.snapshot("insert-fence"),!0}}if(g){let x=a;for(;x;){if(x.type==="mopen"&&x.value===g){e.mathfield.snapshot();const oe=x.leftSibling,ge=e.extractAtoms([e.offsetOf(x.leftSibling),e.offsetOf(a)]);ge.shift();const He=new or("left...right",ge,{leftDelim:g,rightDelim:d});return u.addChildrenAfter([He],oe),e.position=e.offsetOf(He),e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}x=x.leftSibling}if(u instanceof or&&a.isLastSibling&&Wd(u.leftDelim,d))return e.mathfield.snapshot(),u.isDirty=!0,u.rightDelim=d,e.position+=1,e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const E=e.offsetOf(a.firstSibling);let R;for(R=e.position;R>=E;R--){const oe=e.at(R);if(oe instanceof or&&(oe.rightDelim==="?"||oe.rightDelim===".")&&Wd(oe.leftDelim,d))break}const F=e.at(R);if(R>=E&&F instanceof or)return e.mathfield.snapshot(),F.rightDelim=d,F.addChildren(e.extractAtoms([R,e.position]),F.parentBranch),e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(u instanceof or&&(u.rightDelim==="?"||u.rightDelim===".")&&Wd(u.leftDelim,d))return e.mathfield.snapshot(),u.isDirty=!0,u.rightDelim=d,u.parent.addChildren(e.extractAtoms([e.position,e.offsetOf(a.lastSibling)]),u.parentBranch),e.position=e.offsetOf(u),e.contentDidChange({data:d,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const Y=u.parent;return Y instanceof or&&(Y.rightDelim==="?"||Y.rightDelim===".")&&e.at(e.position).isLastSibling?(e.position=e.offsetOf(Y),Hd(e,d,r)):!1}return!1}function Wd(e,i){return e?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i):Su[e]===i:!0}function H0(e,i){return i?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e):Uo[i]===e:!0}Cs({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)=>(Gd(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),d=0;for(;a.includes(u)&&d<100;){if(d===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),d++}return e.insert(`\\placeholder[${i!=null?i:u}]{}`,r),!0}}),Cs({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"}),Cs({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})&&(Qs(e),e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),dr(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=jd(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=>$d(a,u,r,{operation:"toggle"})),e.snapshot("style-change")}),!0}Cs({applyStyle:og},{target:"mathfield",canUndo:!0,changeContent:!0});function jd(e,i){var r,a,u,d,g,b,x,E,R,F;const Y={};if(typeof i.color=="string"){const ge=(a=e.colorMap((r=i.color)!=null?r:i.verbatimColor))!=null?a:"none";ge!==i.color&&(Y.verbatimColor=(u=i.verbatimColor)!=null?u:i.color),Y.color=ge}if(typeof i.backgroundColor=="string"){const ge=(g=e.backgroundColorMap((d=i.backgroundColor)!=null?d:i.verbatimBackgroundColor))!=null?g:"none";ge!==i.backgroundColor&&(Y.verbatimBackgroundColor=(b=i.verbatimBackgroundColor)!=null?b:i.backgroundColor),Y.backgroundColor=ge}typeof i.fontFamily=="string"&&(Y.fontFamily=i.fontFamily),typeof i.series=="string"&&(Y.fontSeries=i.series),typeof i.fontSeries=="string"&&(Y.fontSeries=i.fontSeries.toLowerCase()),Y.fontSeries&&(Y.fontSeries=(x={bold:"b",medium:"m",normal:"m"}[Y.fontSeries])!=null?x:Y.fontSeries),typeof i.shape=="string"&&(Y.fontShape=i.shape),typeof i.fontShape=="string"&&(Y.fontShape=i.fontShape.toLowerCase()),Y.fontShape&&(Y.fontShape=(E={italic:"it",up:"n",upright:"n",normal:"n"}[Y.fontShape])!=null?E:Y.fontShape),i.variant&&(Y.variant=i.variant.toLowerCase()),i.variantStyle&&(Y.variantStyle=i.variantStyle.toLowerCase());const oe=(R=i.size)!=null?R:i.fontSize;return typeof oe=="number"?Y.fontSize=Math.max(1,Math.min(10,oe)):typeof oe=="string"&&(Y.fontSize=(F={size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10}[oe.toLowerCase()])!=null?F:{tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10}[oe]),Y}function qd(e){let[i,r]=Fr(e.selection);if(i=W0(e,i,"backward"),r=W0(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 W0(e,i,r){var a,u,d;let g=e.at(i);if(!g)return i;const b=r==="forward"?1:-1;if(g.mode==="text"){for(;g&&!(g.mode!=="text"||!Je.test(g.value));)i+=b,g=e.at(i);return r==="backward"?i-1:i}if(g.mode==="latex"){if(/[a-zA-Z\*]/.test(g.value))if(r==="backward")for(;g&&g.mode==="latex"&&g.value!=="\\"&&/[a-zA-Z]/.test(g.value);)i+=b,g=e.at(i);else for(;g&&g.mode==="latex"&&/[a-zA-Z\*]/.test(g.value);)i+=b,g=e.at(i);else if(g.value==="{"){if(r==="forward"){for(;g&&g.mode==="latex"&&g.value!=="}";)i+=b,g=e.at(i);return i}return i-1}else if(g.value==="}"){if(r==="backward"){for(;g&&g.mode==="latex"&&g.value!=="{";)i+=b,g=e.at(i);return i-1}return i}return i-1}if(g.mode==="math"){if(g.isDigit()){for(;(a=e.at(i+b))!=null&&a.isDigit();)i+=b;return r==="backward"?i-1:i}if(g.style.variant||g.style.variantStyle){let x=(u=e.at(i))==null?void 0:u.style;for(;x&&x.variant===g.style.variant&&x.variantStyle===g.style.variantStyle;)x=(d=e.at(i+b))==null?void 0:d.style,i+=b;return r==="backward"?i-1:i}return i}return i}Cs({selectGroup:e=>{const i=qd(e);return i||e.announce("plonk"),i},selectAll:e=>e.setSelection(0,e.lastOffset),extendSelectionForward:e=>Ba(e,"forward",{extend:!0}),extendSelectionBackward:e=>Ba(e,"backward",{extend:!0}),extendToNextWord:e=>Iu(e,"forward",{extend:!0}),extendToPreviousWord:e=>Iu(e,"backward",{extend:!0}),extendSelectionUpward:e=>Ba(e,"upward",{extend:!0}),extendSelectionDownward:e=>Ba(e,"downward",{extend:!0}),extendToNextBoundary:e=>Iu(e,"forward",{extend:!0}),extendToPreviousBoundary:e=>Iu(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,Yc=0,Uf=class ia{static start(i,r,a,u){var d;ia.element=i,(d=ia.controller)==null||d.abort(),ia.controller=new AbortController;const g={signal:ia.controller.signal};"PointerEvent"in window?(i.addEventListener("pointermove",a,g),i.addEventListener("pointerup",u,g),i.addEventListener("pointercancel",u,g),Zd(r)&&(ia.pointerId=r.pointerId,i.setPointerCapture(r.pointerId))):(window.addEventListener("mousemove",a,g),window.addEventListener("blur",u,g),window.addEventListener("mouseup",u,g))}static stop(){var i;(i=ia.controller)==null||i.abort(),ia.controller=void 0,typeof ia.pointerId=="number"&&(ia.element.releasePointerCapture(ia.pointerId),ia.pointerId=void 0)}};function Zd(e){return e!==null&&globalThis.PointerEvent!==void 0&&e instanceof PointerEvent}function j0(e,i){var r;if(i.buttons>1)return;e.atomBoundsCache=new Map;const a=e;let u,d=!1,g=!1,b="none",x=!1,E=!1;const R=i.clientX,F=i.clientY,Y=Date.now(),oe=a.field,ge=setInterval(()=>{x?oe.scroll({top:0,left:oe.scrollLeft-16}):E&&oe.scroll({top:0,left:oe.scrollLeft+16})},32);function He(){Uf.stop(),d=!1,clearInterval(ge),e.element.classList.remove("tracking"),i&&i.preventDefault()}function Ot(wt){if(!a.hasFocus()){He();return}const $t=wt.clientX,At=wt.clientY,si=Zd(wt)&&wt.pointerType==="touch"?20:5;if(Date.now()<Y+500&&Math.abs(R-$t)<si&&Math.abs(F-At)<si){wt.preventDefault(),wt.stopPropagation();return}const _i=oe.getBoundingClientRect();E=$t>_i.right,x=$t<_i.left;let ci=u;Zd(wt)&&(wt.isPrimary||(ci=Xc(a,wt.clientX,wt.clientY,{bias:0})));const cn=Xc(a,$t,At,{bias:$t<=R?$t===R?0:-1:1});ci>=0&&cn>=0&&(a.model.extendSelectionTo(ci,cn),dr(e)),g&&qd(a.model)}jl&&Math.abs(jl.x-R)<5&&Math.abs(jl.y-F)<5&&Date.now()<jl.time+500?(Yc+=1,jl.time=Y):(jl={x:R,y:F,time:Y},Yc=1);const Ve=oe.getBoundingClientRect();if(R>=Ve.left&&R<=Ve.right&&F>=Ve.top&&F<=Ve.bottom){if(e.flushInlineShortcutBuffer(),e.adoptStyle="left",u=Xc(e,R,F,{bias:0}),u>=0){if(e.element.classList.add("tracking"),i.shiftKey){const wt=e.model.selectionIsCollapsed;e.model.extendSelectionTo(e.model.anchor,u),Oa(e.model)||wt?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,Oa(e.model)?b="all":b="selection");e.defaultStyle={},i.detail===3||Yc>2?(He(),(i.detail===3||Yc===3)&&(e.model.selection={ranges:[[0,e.model.lastOffset]]},b="all")):d||(d=!0,Uf.start(oe,i,Ot,He),(i.detail===2||Yc===2)&&(g=!0,qd(e.model),b="all"))}e.hasFocus()||(b="none",e.focus({preventScroll:!0}))}else jl=null;e.stopCoalescingUndo(),b!=="none"&&(e.model.selectionIsCollapsed&&(b="all"),dr(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 q0(e,i,r,a,u){if(!r.id)return[1/0,null];if(i.has(r.id))return i.get(r.id);const d=Ls(e,r);if(!d)return[1/0,null];let g=[1/0,null];if(r.hasChildren&&!r.captureSelection&&a>=d.left&&a<=d.right)for(const b of r.children){const x=q0(e,i,b,a,u);x[0]<=g[0]&&(g=x)}return g[1]||(g=[lg(a,u,d),r]),i.set(r.id,g),g}function ug(e,i,r){const[,a]=q0(e,new Map,e.model.root,i,r);return a}function Xc(e,i,r,a){var u;const d=e.field.querySelector(".ML__latex").getBoundingClientRect();if(!d)return 0;if(i>d.right||r>d.bottom+8)return e.model.lastOffset;if(i<d.left||r<d.top-8)return 0;a=a!=null?a:{},a.bias=(u=a.bias)!=null?u:0;let g=ug(e,i,r);const b=[];let x=g;for(;x;)b.unshift(x),x=x.parent;for(const R of b)if(R.captureSelection){g=R;break}let E=e.model.offsetOf(g);if(E<0)return-1;if(g.leftSibling)if(a.bias===0&&g.type!=="placeholder"){const R=Ls(e,g);R&&i<(R.left+R.right)/2&&(E=e.model.offsetOf(g.leftSibling))}else a.bias<0&&(E=e.model.offsetOf(g.leftSibling));return E}var cg=class extends Hn{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 d=JSON.parse(u);if(d&&Array.isArray(d)){e.snapshot();const g=ba(d),{model:b}=e;b.selectionIsCollapsed||b.deleteAtoms(Fr(b.selection));const x=b.at(b.position);if(x.parent instanceof _n){console.assert(x.parentBranch!==void 0);const E=[];let R=[];g[0].type==="first"&&g.shift(),g[g.length-1].type==="first"&&g.pop();for(const ge of g)ge.type==="first"&&R.length>0?(E.push(R),R=[ge]):R.push(ge);R.length>0&&E.push(R);let F=Number(x.parentBranch[0]),Y=Number(x.parentBranch[1]);const oe=x.parent.maxColumns;for(;x.parent.colCount-Y<E.length&&x.parent.colCount<oe;)x.parent.addColumn();x.parent.addChildrenAfter(E[0],x);for(let ge=1;ge<E.length;ge++)Y++,Y>=oe&&(Y=0,x.parent.addRowAfter(F),F++),x.parent.setCell(F,Y,E[ge])}else x.parent.addChildrenAfter(g.filter(E=>E.type!=="first"),x);return b.position=b.offsetOf(g[g.length-1]),b.contentDidChange({inputType:"insertFromPaste"}),dr(e),!0}}catch(d){}if(u=typeof i!="string"?i.getData("application/json"):"",u&&window.MathfieldElement.computeEngine)try{const d=JSON.parse(u);if(typeof d=="object"&&"latex"in d&&d.latex&&(r=d.latex),!r){const g=window.MathfieldElement.computeEngine.box(d);g&&!g.has("Error")&&(r=g.latex)}r||(a="latex")}catch(d){}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 d;return[d,r]=Tc(r),a==="auto"&&d&&(a="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r,{format:a})&&(e.startRecording(),e.snapshot("paste"),dr(e)),e.startRecording(),!0}return!1}insert(e,i,r){var a,u;const d=typeof i=="string"?i:(u=(a=window.MathfieldElement.computeEngine)==null?void 0:a.box(i).latex)!=null?u:"";if(!r.silenceNotifications&&!e.contentWillChange({data:d,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");const{silenceNotifications:g}=e;r.silenceNotifications&&(e.silenceNotifications=!0);const b=e.silenceNotifications;e.silenceNotifications=!0;const x={"?":"\\placeholder{}","@":"\\placeholder{}"};x[0]=r.insertionMode==="replaceAll"?"":e.getValue(e.selection,"latex-unstyled"),r.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(Fr(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;x[0]?x["@"]=x[0]:typeof i=="string"&&/(^|[^\\])#@/.test(i)&&(E=fg(e),E>=0&&(x["@"]=e.getValue(E,e.position,"latex"))),x[0]||(x[0]=x["?"]);let R=!1;const F=$t=>(R=!0,x[$t]);let[Y,oe]=Z0(e,i,F,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)?(x["@"]=x["?"],R=!1,[Y,oe]=Z0(e,i,F,r)):E>=0&&e.deleteAtoms([E,e.position]);const{parent:He}=e.at(e.position),Ot=He.hasEmptyBranch("body");if(ge&&Y!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&He instanceof or&&He.leftDelim==="("&&Ot){const $t=He.parent,At=He.parentBranch;$t.removeChild(He),$t.setChildren(oe,At)}const Ve=e.at(e.position);Ve.parent.addChildrenAfter(oe,Ve),Y==="latex"&&typeof i=="string"&&(He==null?void 0:He.type)==="root"&&Ot&&!R&&(He.verbatimLatex=i),e.silenceNotifications=b;const wt=oe[oe.length-1];if(r.selectionMode==="placeholder"){const $t=oe.flatMap(At=>[At,...At.children]).find(At=>At.type==="placeholder");if($t){const At=e.offsetOf($t);e.setSelection(At-1,At),e.announce("move")}else wt&&(e.position=e.offsetOf(wt))}else r.selectionMode==="before"||(r.selectionMode==="after"?wt&&(e.position=e.offsetOf(wt)):r.selectionMode==="item"&&e.setSelection(e.anchor,e.offsetOf(wt)));return e.contentDidChange({data:d,inputType:"insertText"}),e.silenceNotifications=g,!0}};function Z0(e,i,r,a){var u;let d,g=[];if(typeof i!="string"||a.format==="math-json"){const b=window.MathfieldElement.computeEngine;if(!b)return["math-json",[]];[d,i]=["latex",b.box(i).latex],g=Zr(i,{context:e.mathfield.context})}else typeof i=="string"&&a.format==="ascii-math"?([d,i]=fa(i,{format:"ascii-math",inlineShortcuts:e.mathfield.options.inlineShortcuts}),g=Zr(i,{context:e.mathfield.context}),d!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&zf(g)):(a.format==="auto"||(u=a.format)!=null&&u.startsWith("latex"))&&(a.format==="auto"&&([d,i]=fa(i,{format:"auto",inlineShortcuts:e.mathfield.options.inlineShortcuts})),a.format==="latex"&&([,i]=Tc(i)),g=Zr(i,{context:e.mathfield.context,args:r}),a.format!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&zf(g));return jo(g,a.style),[d!=null?d:"latex",g]}function hg(e){if(!e||(console.assert(e[0].type==="first"),e.length>1))return null;const i=e[0];return i instanceof or&&i.leftDelim==="("&&i.rightDelim===")"?i.removeBranch("body"):null}function zf(e){if(e){for(let i=0;e[i];i++){const r=e[i];if(r instanceof or&&r.leftDelim==="("){let a=0,u=0,d=0;for(let g=0;r.body[g];g++)r.body[g].type==="genfrac"&&(a++,u=g),d++;d===0&&a===1&&(e[i]=r.body[u])}}for(const i of e){for(const r of i.branches)if(!i.hasEmptyBranch(r)){zf(i.branch(r));const a=hg(i.branch(r));a&&i.setChildren(a,r)}if(i instanceof _n)for(const r of i.cells)zf(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=Uo[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||Y0(i));)i=i.leftSibling;else{const u=[];for(;!i.isFirstSibling&&(Y0(i)||u.length>0);)i.type==="mclose"&&u.unshift(i.value),i.type==="mopen"&&u.length>0&&i.value===Uo[u[0]]&&u.shift(),i=i.leftSibling}return r===i?-1:e.offsetOf(i)}function Y0(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 Hn{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"),dr(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(Fr(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 d=pg(i,e.mathfield.context);if(jo(d,r.style),!d)return!1;const g=e.at(e.position),b=g.parent.addChildrenAfter(d,g);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 "),Zr(e,{context:i,parseMode:"text"})}new dg;function Na(e){return{value:e.model.getValue(),selectionIsCollapsed:e.model.selectionIsCollapsed,canUndo:e.canUndo(),canRedo:e.canRedo(),style:e.selectionStyle,mode:e.model.mode}}var Yn=4,ys=20,Lr=2*(ys+Yn),Vf=(e,i)=>`
|
|
|
<line x1="${e+ys}" y1="${i+ys}"
|
|
|
x2="${e>i?e+ys:7*ys+10*Yn}"
|
|
|
y2="${e<i?i+ys:7*ys+10*Yn}"/>
|
|
|
<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>`,X0=(e,i)=>`
|
|
|
<line x1="${e+ys}" y1="${i+ys}"
|
|
|
x2="${e>i?e+ys:7*ys+10*Yn}"
|
|
|
y2="${e<i?i+ys:7*ys+10*Yn}"/>
|
|
|
<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>`,Gf=(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*ys+10*Yn+5} ${8*ys+10*Yn+5}">
|
|
|
<rect
|
|
|
class="MLEP__array-insert-background rows"
|
|
|
x="0"
|
|
|
y="${Lr+Yn}"
|
|
|
height="${3*Lr}"
|
|
|
width="${Lr}"
|
|
|
rx="${Lr/2}"/>
|
|
|
<rect
|
|
|
class="MLEP__array-insert-background columns"
|
|
|
x="${Lr+Yn}"
|
|
|
y="0"
|
|
|
height="${Lr}"
|
|
|
width="${3*Lr}"
|
|
|
rx="${Lr/2}"/>
|
|
|
<g data-command='"moveDown"'>
|
|
|
${Gf(2*(Yn+Lr),2*Yn+3*Lr,0)}
|
|
|
</g>
|
|
|
<g data-command='"moveUp"'>
|
|
|
${Gf(2*(Yn+Lr),2*Yn+Lr,180)}
|
|
|
</g>
|
|
|
<g data-command='"moveToNextWord"'>
|
|
|
${Gf(2*Yn+3*Lr,2*(Yn+Lr),-90)}
|
|
|
</g>
|
|
|
<g data-command='"moveToPreviousWord"'>
|
|
|
${Gf(2*Yn+Lr,2*(Yn+Lr),90)}
|
|
|
</g>
|
|
|
<g>
|
|
|
|
|
|
<g data-command='"addColumnBefore"'>
|
|
|
${Vf(2*Yn+Lr,Yn)}
|
|
|
</g>
|
|
|
<g data-command='"removeColumn"'>
|
|
|
${X0(2*Yn+2*Lr,Yn)}
|
|
|
</g>
|
|
|
<g data-command='"addColumnAfter"'>
|
|
|
${Vf(2*Yn+3*Lr,Yn)}
|
|
|
</g>
|
|
|
<g data-command='"addRowBefore"'>
|
|
|
${Vf(Yn,2*Yn+Lr)}
|
|
|
</g>
|
|
|
<g data-command='"removeRow"'>
|
|
|
${X0(Yn,2*Yn+2*Lr)}
|
|
|
</g>
|
|
|
<g data-command='"addRowAfter"'>
|
|
|
${Vf(Yn,2*Yn+3*Lr)}
|
|
|
</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>`,J0=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>`,Yd={matrix:gg,pmatrix:_g,bmatrix:vg,Bmatrix:J0,vmatrix:yg,Vmatrix:bg},Xd={cases:xg,rcases:wg,Bmatrix:J0};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 d=document.getElementById("mathlive-environment-popover");d||(d=vo("mathlive-environment-popover"),os("environment-popover"),os("core"),d.setAttribute("aria-hidden","true"));let g;const b=d.querySelector(".MLEP__environment-controls");b?g=b:(g=document.createElement("div"),d.innerHTML="",d.appendChild(g)),g.className="MLEP__environment-controls",g.style.display="flex",g.style.width="100%",g.style.height="100%",g.style.boxSizing="border-box",g.innerHTML=mg;let x=[],E="";const R=e.model.parentEnvironment.environmentName;if(Fc(R)){const ge=kg(R);E=Yd[ge]("active");const He=Yd,{[ge]:Ot}=He,Ve=I(He,[ne(ge)]);x=Object.values(Ve).map(wt=>wt("inactive"))}else if(Sd(R)){const ge=Ag(R);E=Xd[ge]("active");const He=Xd,{[ge]:Ot}=He,Ve=I(He,[ne(ge)]);x=Object.values(Ve).map(wt=>wt("inactive"))}else of(R)&&(E=Yd.matrix("active"),x=Object.values(Xd).map(ge=>ge("inactive")));const F=document.createElement("div");F.className="MLEP__environment-delimiter-controls",F.style.display="flex",F.style.flexDirection="column",F.innerHTML=`
|
|
|
<div class='MLEP__array-delimiter-options'>
|
|
|
${E}
|
|
|
${x.join("")}
|
|
|
</div>`,E&&g.appendChild(F),g.querySelectorAll("[data-command]").forEach(ge=>{const He=ge.dataset.command;let Ot=He;try{Ot=JSON.parse(He)}catch(Ve){}ge.addEventListener("mousedown",Ve=>Ve.preventDefault()),Ot&&ge.addEventListener("click",()=>e.executeCommand(Ot))});const oe=(r=e.field)==null?void 0:r.getBoundingClientRect();oe&&(d.style.top=`${window.scrollY+(oe.top-d.clientHeight-15)}px`,d.style.left=`${oe.left+20}px`,d.classList.add("is-visible"))}function Jd(){const e=document.getElementById("mathlive-environment-popover");e==null||e.classList.remove("is-visible")}function Eg(){document.getElementById("mathlive-environment-popover")&&(Du("mathlive-environment-popover"),ga("environment-popover"),ga("core"))}function Hf(e){if(!e.hasFocus())return;let i=!1;if(e.model.mode==="math"){const r=e.model.parentEnvironment;if(r!=null&&r.array&&af(r.environmentName)){const a=e.options.environmentPopoverPolicy;i=a==="auto"||a==="on"}}i?Sg(e):Jd()}function kg(e){return e.replace("*","")}function Ag(e){return e==="dcases"?"cases":e}function Q0(e){const i=getComputedStyle(e).direction;return i==="ltr"||i==="rtl"?i:"ltr"}function ep(e,i,r){return i==="left"||i==="leading"&&r==="ltr"||i==="trailing"&&r==="rtl"?e.left:e.right}function Qd(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 Tg(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 d=(r=Q0(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 g=e.getBoundingClientRect(),b=Number.isFinite(i.maxHeight)?Math.min(i.maxHeight,window.innerHeight):window.innerHeight;let x=Math.min(b,(a=i.height)!=null?a:g.height),E=Qd(i.location.y,x,i.verticalPos,d);E+x>window.innerHeight-8&&(i.alternateLocation?(E=Qd(i.alternateLocation.y,x,i.verticalPos,d),E+x>window.innerHeight-8&&(E=void 0)):E=void 0),Number.isFinite(E)||(E=Math.max(8,window.innerHeight-8-x),8+x>window.innerHeight-8&&(e.style.bottom="8px")),x=Math.min(E+x,window.innerHeight-8)-E;const R=Number.isFinite(i.maxWidth)?Math.min(i.maxWidth,window.innerWidth):window.innerWidth;let F=Math.min(R,(u=i.width)!=null?u:g.width),Y=Qd(i.location.x,F,i.horizontalPos,d);Y+F>window.innerWidth-8&&(i.alternateLocation?(Y=Tg(i.alternateLocation.x,F,i.verticalPos,d),Y+F>window.innerWidth-8&&(Y=void 0)):Y=void 0),Number.isFinite(Y)||(Y=Math.max(8,window.innerWidth-8-F),8+F>window.innerWidth-8&&(e.style.right="8px")),F=Math.min(Y+F,window.innerWidth-8)-Y,d==="rtl"?e.style.right=`${Math.ceil(window.innerWidth-Y-F).toString()}px`:e.style.left=`${Math.ceil(Y).toString()}px`,e.style.top=`${Math.ceil(E).toString()}px`,x!==g.height&&(e.style.height=`${Math.ceil(x).toString()}px`),F!==g.width&&(e.style.width=`${Math.ceil(F).toString()}px`)}function Dg(e,i){return Math.hypot(i.x-e.x,i.y-e.y)}function Pu(e){return"submenu"in e}function $a(e){return"type"in e&&e.type==="command"||"onMenuSelect"in e||"id"in e}function e0(e){return"type"in e&&e.type==="divider"}function t0(e){return"type"in e&&e.type==="heading"}var tp={};function i0(e){let i=tp[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,tp[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 ip=80,np=class{constructor(e,i){this._element=null;var r;this.parentMenu=i,this._declaration=e,Pu(e)?(this.type="submenu",this.submenu=new rp(e.submenu,{parentMenu:i,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=(r=e.type)!=null?r:"command",this.hasCheck=$a(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(e0(u)){this.enabled=!1,this.checked=!1;return}t0(u)&&(this.enabled=!1,this.checked=!1,this.visible=!0),$a(u)&&(this.checked=$a(u)&&((i=Ou(u.checked,e))!=null?i:!1)),($a(u)||Pu(u))&&(this.enabled=(r=Ou(u.enabled,e))!=null?r:!0,this.visible=(a=Ou(u.visible,e))!=null?a:!0,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),($a(u)||t0(u)||Pu(u))&&(this.label=Ou(u.label,e),this.tooltip=Ou(u.tooltip,e),this.ariaLabel=Ou(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(i0("checkmark"))):this.checked==="mixed"?(e.setAttribute("aria-checked","mixed"),e.append(i0("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),$a(this._declaration)&&this._declaration.keyboardShortcut){const r=document.createElement("kbd");r.innerHTML=Ei(this._declaration.keyboardShortcut),e.append(r)}this.type==="submenu"&&e.append(i0("trailing-chevron"))}get element(){if(this._element)return this._element;if(e0(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,($a(this._declaration)||t0(this._declaration)||Pu(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(!$a(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()},ip)},ip)}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=Q0(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:ep(r,"trailing",a),y:r.top-4},alternateLocation:{x:ep(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 d="right";if(this.submenu.element){const g=this.submenu.element.getBoundingClientRect(),b=this.element.getBoundingClientRect();g.left<b.left+b.width/2&&(d="left")}return d==="right"?a>0:a<0}};function Cg(e,i,r){return Math.hypot(e,i)/r}function Ou(e,i){return e===void 0||typeof e!="function"?e:(i!=null||(i={alt:!1,control:!1,shift:!1,meta:!1}),e(i))}var rp=class Vu{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 np(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 d=this.hasCheck;this.hasCheck=this._menuItems.some(E=>E.visible&&E.hasCheck),this.hasCheck!==d&&this._menuItems.forEach(E=>E.updateState(i));let g,b=0;for(const E of this._menuItems)E.type==="heading"?(g&&b===0&&(g.visible=!1),g=E,b=0):E.type==="divider"&&g?(g.visible=b>0,g=void 0,b=0):g&&E.visible&&(b+=1);g&&(g.visible=b>0);let x=!0;for(const E of this._menuItems)E.type==="divider"?(E.visible=!x,x=!0):E.visible&&(x=!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,d;if(this.rootMenu.cancelDelayedOperation(),i!==this._activeMenuItem){if(this.activeMenuItem){const g=this.activeMenuItem;g.active=!1,(r=g.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}):(d=this._element)==null||d.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),d=1;for(;u>=r&&u<=a;){u+=i>0?1:-1;const g=this._menuItems[u];if(!g)break;if(g.visible&&g.enabled){if(d===Math.abs(i))return this._menuItems[u];d+=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 Vu._collator||(Vu._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Vu._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 d=null,g=0;for(;g<u&&!d;)d=(r=a.find(b=>Vu.collator.compare(i,b.label.substring(g,i.length))===0))!=null?r:null,g++;return d}show(i){return!this.visible||!i.container?!1:(this.updateElement(),i.container.appendChild(this.element),$()&&(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,d;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),$()&&((i=this._element)!=null&&i.popover)&&this.element.hidePopover(),(a=(r=this.parentMenu)==null?void 0:r.element)==null||a.focus(),(d=(u=this._element)==null?void 0:u.parentNode)==null||d.removeChild(this._element)}set openSubmenu(i){var r,a,u,d;const g=i!==null;((r=this.activeMenuItem)==null?void 0:r.type)==="submenu"&&((a=this.activeMenuItem.element)==null||a.setAttribute("aria-expanded",g.toString())),(d=(u=this.activeMenuItem)==null?void 0:u.element)==null||d.classList.toggle("is-submenu-open",g),this.isSubmenuOpen=g}},sp=class om extends rp{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(ap),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(i){Zi(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=Ht(i)),i.stopImmediatePropagation()}handleKeydownEvent(i){var r,a,u;if(i.key==="Tab"||i.key==="Escape"){this.hide();return}this.isDynamic&&(this.modifiers=Ht(i));let d=!0;const g=this.activeSubmenu,b=g.activeMenuItem;switch(i.key){case" ":case"Space":case"Return":case"Enter":b==null||b.select(Ht(i));break;case"ArrowRight":if((b==null?void 0:b.type)==="submenu")b.select(Ht(i)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(!b)g.activeMenuItem=g.firstMenuItem;else{const x=(r=g.getMenuItemColumn(b))!=null?r:-1;if(x>=0&&x<((a=g.columnCount)!=null?a:1)-1){const E=g.nextMenuItem(1);E&&(g.activeMenuItem=E)}}break;case"ArrowLeft":if(g===this.rootMenu)b||(g.activeMenuItem=g.firstMenuItem);else if((b&&(u=g.getMenuItemColumn(b))!=null?u:-1)<=0||!b){g.hide();const E=g.parentMenu.activeMenuItem;if(E){const{element:R}=E;R==null||R.focus(),R==null||R.classList.remove("is-submenu-open")}}else{const E=g.nextMenuItem(-1);E&&(g.activeMenuItem=E)}break;case"ArrowDown":g.activeMenuItem=g.nextMenuItem(g.columnCount);break;case"ArrowUp":g.activeMenuItem=g.nextMenuItem(-g.columnCount);break;case"Home":case"PageUp":g.activeMenuItem=g.firstMenuItem;break;case"End":case"PageDown":g.activeMenuItem=g.lastMenuItem;break;case"Backspace":if(this.typingBuffer&&(this.typingBuffer=this.typingBuffer.slice(0,-1),this.typingBuffer)){clearTimeout(this.typingBufferResetTimer);const x=g.findMenuItem(this.typingBuffer);x&&(g.activeMenuItem=x),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}break;default:if(tn(i)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=i.key;const x=g.findMenuItem(this.typingBuffer);x&&(g.activeMenuItem=x),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}else d=!1}d&&(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 un.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),un.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),un.state==="open"&&un.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,un.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(i){this.cancelDelayedOperation();const r=om.SUBMENU_DELAY;if(r<=0){i();return}this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,i()},r)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};sp.SUBMENU_DELAY=120;var Mg=sp;function ap(e){return e0(e)?!1:typeof e.label=="function"||typeof e.ariaLabel=="function"||typeof e.tooltip=="function"||($a(e)||Pu(e))&&(typeof e.enabled=="function"||typeof e.visible=="function")||$a(e)&&typeof e.checked=="function"?!0:Pu(e)?e.submenu.some(ap):!1}var Wf=class{};Wf.DELAY=300,Wf.MAX_DISTANCE=10;function Rg(e){return new Promise((i,r)=>{const a=zt(e);a||i(!1);let u=a;const d=setTimeout(()=>{g.abort(),i(Dg(u,a)<Wf.MAX_DISTANCE)},Wf.DELAY),g=new AbortController,b=g.signal;for(const x of["pointermove","pointerup","pointercancel"])window.addEventListener(x,E=>{if(E.type==="pointerup"||E.type==="pointercancel")clearTimeout(d),g.abort(),i(!1);else if(E.type==="pointermove"){const R=zt(E);R&&(u=R)}},{passive:!0,signal:b})})}function op(e,i,r){return Yo(this,null,function*(){if(e.type==="contextmenu"){const a=e;if(r.show({target:i,location:zt(a),modifiers:Ht(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:Ht(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=zt(e);if(yield Rg(e))return r.state!=="closed"?!1:(r.show({target:i,location:u}),!0)}return!1})}var lp={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(lp),"{body:auto}",{createAtom:e=>new wu(f(P({},e),{body:Pe(e.args[0]),accentChar:lp[e.command.slice(1)]}))}),Se(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:e=>{const i=yt(Pe(e.args[0]));return new wu(f(P({},e),{body:Pe(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 wu(f(P({},e),{body:Pe(e.args[0]),svgAccent:"overarc"}))}),Se(["underarc","underparen"],"{body:auto}",{createAtom:e=>new Ds(f(P({},e),{body:Pe(e.args[0]),svgBelow:"underarc"}))}),Se("utilde","{body:auto}",{createAtom:e=>{const i=Pe(e.args[0]),r=yt(i),a="widetilde"+(r.length>5?"4":["1","1","2","2","3","3"][r.length]);return new Ds(f(P({},e),{body:i,svgBelow:a,boxType:_l(i)}))}}),Se("^","{:string}",{createAtom:e=>{var i;return new dt(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 dt(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 dt(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 dt(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 dt(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 dt(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 dt(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 dt(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 g=a[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const b of g){const x=b.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(x)u.strokeWidth=x[1],u.strokeStyle=x[2],u.strokeColor=x[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 d={};return((r=a[0])!=null?r:"").split(/[, ]/).filter(g=>g.length>0).forEach(g=>{d[g.toLowerCase()]=!0}),new Cl(e.command,Pe(a[2]),d,u)}}),Se("cancel","{body:auto}",{createAtom:e=>{var i;return new Cl(e.command,Pe(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 Cl(e.command,Pe(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 Cl(e.command,Pe(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 Ds(f(P({},e),{body:Pe((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 Ds(f(P({},e),{body:Pe(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 Ds(f(P({},e),{body:Pe(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:e.command.slice(1)}))}),Se(["underbrace"],"{:auto}",{createAtom:e=>new Ds(f(P({},e),{body:Pe(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,d;return new Ds(f(P({},e),{svgBody:e.command.slice(1),above:((r=Pe((i=e.args)==null?void 0:i[1]))==null?void 0:r.length)===0?void 0:Pe((a=e.args)==null?void 0:a[1]),below:(d=Pe((u=e.args)==null?void 0:u[0]))!=null?d: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 Ra(e.command.slice(1),f(P({},e),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),Se(["liminf","limsup"],"",{ifMode:"math",createAtom:e=>new Ra({"\\liminf":"lim inf","\\limsup":"lim sup"}[e.command],f(P({},e),{limits:"over-under",variant:"main"}))}),Se(["lim","mod"],"",{ifMode:"math",createAtom:e=>new Ra(e.command.slice(1),f(P({},e),{limits:"over-under",variant:"main"}))}),Se(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:e=>new Ra(e.command.slice(1),f(P({},e),{limits:"over-under",isFunction:!0,variant:"main"}))}),Se(["ang"],"{:math}",{ifMode:"math",createAtom:e=>new dt(f(P({},e),{body:Pe(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 Bt("\xB0",{style:f(P({},e.style),{variant:"normal",variantStyle:"up"})});return new Bt([r,u],{type:"inner",isSelected:e.isSelected,caret:a})}}),Se("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:e=>new $c(f(P({},e),{body:Pe(e.args[1]),index:e.args[0]?Pe(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 zo(a[0]?Pe(a[0]):[new va],a[1]?Pe(a[1]):[new va],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}`:On(e.command,r,a)}}),Se(["brace","brack"],"",{infix:!0,createAtom:e=>new zo(Pe(e.args[0]),Pe(e.args[1]),f(P({},e),{hasBarLine:!1,leftDelim:e.command==="\\brace"?"\\lbrace":"\\lbrack",rightDelim:e.command==="\\brace"?"\\rbrace":"\\rbrack"})),serialize:(e,i)=>fn([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 zo(Pe(a[0]),Pe(a[1]),f(P({},e),{hasBarLine:e.command==="\\over",leftDelim:i,rightDelim:r}))},serialize:(e,i)=>fn([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 zo(Pe(a[0]),Pe(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 zo(Pe(e.args[0]),Pe(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 Vo({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 Ra("\u222B",f(P({},e),{limits:"adjacent",variant:"main"}))});var up={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(up),"",{ifMode:"math",createAtom:e=>{const i=e.command,r=up[i.slice(1)];return new Vo(r,f(P({},e),{limits:"adjacent",variant:{"\u22D2":"ams","\u22D3":"ams"}[r]}))}}),Se(["Re","Im"],"",{ifMode:"math",createAtom:e=>new Ra({"\\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 pf(f(P({},e),{delim:(i=e.args[0])!=null?i:"|",size:1}))}}),Se("the","{:value}",{createAtom:e=>new dt(f(P({},e),{captureSelection:!0,verbatimLatex:null})),render:(e,i)=>{var r;const a=new ln({parent:i},e.style);let u="";e.isSelected&&(u+=" ML__selected");const d=a.evaluate(e.args[0]);return new Bt(((r=Or(d))!=null?r:"").split("").map(g=>new Bt(g,{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=Or(e.args[0]))!=null?i:"\\relax"}`}}),Se("mathtip","{:auto}{:math}",{createAtom:e=>new Kc(f(P({},e),{body:Pe(e.args[0]),tooltip:Pe(e.args[1]),content:"math"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${dt.serialize([e.tooltip],f(P({},i),{defaultMode:"math"}))}}`}),Se("texttip","{:auto}{:text}",{createAtom:e=>new Kc(f(P({},e),{body:Pe(e.args[0]),tooltip:Pe(e.args[1]),content:"text"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${dt.serialize([e.tooltip],f(P({},i),{defaultMode:"text"}))}}`}),Se("error","{:math}",{createAtom:e=>new dt(f(P({},e),{body:Pe(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 dt(f(P({},e),{body:Pe(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=Or(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=Or(i[0]))!=null?a:void 0,color:r.toColor((u=i[0])!=null?u:{string:"red"})}}}),Se("boxed","{content:math}",{createAtom:e=>new Js(f(P({},e),{body:Pe(e.args[0]),framecolor:{string:"black"}}))}),Se("colorbox","{:value}{:text*}",{applyStyle:(e,i,r)=>{var a,u;return{verbatimBackgroundColor:(a=Or(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 Js(f(P({},e),{body:Pe(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"})):On(e.command,(r=Or(e.framecolor))!=null?r:"",(a=Or(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=Pe(e.args[1]);return r?new Js(f(P({},e),{body:a,padding:r.padding,border:r.border,backgroundcolor:(i=r.backgroundcolor)!=null?i:void 0})):new Js(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 d=[];e.padding&&d.push((r=Or(e.padding))!=null?r:""),e.border&&d.push(`border: ${e.border}`),e.backgroundcolor&&d.push((a=Or(e.backgroundcolor))!=null?a:""),u+=`[${d.join(",")}]`}return On(u,e.bodyToLatex(i))}}),Se(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:e=>new dt(f(P({},e),{body:Pe(e.args[0])})),render:(e,i)=>{const r=new ln({parent:i,mathstyle:e.command.slice(1)},e.style),a=dt.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):`{${fn([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 dt(f(P({},e),{body:Pe(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 dt(f(P({},e),{type:"mord",body:Pe(e.args[0]),mode:"math"})),serialize:(e,i)=>On("\\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 dt(f(P({},e),{body:Pe(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 dt(f(P({},e),{body:Pe(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 dt(f(P({},e),{body:Pe(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 dt(f(P({},e),{body:Pe(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 dt(f(P({},e),{body:Pe(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 dt(f(P({},e),{body:Pe(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 cp={"\\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 mf(f(P({},e),{delim:(i=e.args[0])!=null?i:".",size:cp[e.command].size,delimType:cp[e.command].mclass}))}}),Se(["hspace","hspace*"],"{width:value}",{createAtom:e=>{var i;return new Go(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 Go(f(P({},e),{width:(i=e.args[0])!=null?i:{dimension:0}}))}}),Se("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:e=>new dt(e),render:(e,i)=>{let r=0;const a=i.mathstyle.id;(a===vu||a===oo)&&(r=1),(a===lo||a===ss)&&(r=2),(a===uo||a===Pr)&&(r=3);const u=Pe(e.args[r]);return dt.createBox(i,u)},serialize:(e,i)=>`\\mathchoice{${dt.serialize(e.args[0],i)}}{${dt.serialize(e.args[1],i)}}{${dt.serialize(e.args[2],i)}}{${dt.serialize(e.args[3],i)}}`}),Se("mathop","{:auto}",{createAtom:e=>new dt(f(P({},e),{type:"mop",body:Pe(e.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(e,i)=>{var r;let a=dt.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 Bt(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[On(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)),fn(r)}}),Se(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:e=>new dt(f(P({},e),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[e.command],body:Pe(e.args[0])}))}),Se(["operatorname","operatorname*"],"{operator:math}",{createAtom:e=>{const i=Pe(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 dt(f(P({},e),{type:"mop",body:i,isFunction:!0,limits:e.command==="\\operatorname"?"adjacent":"over-under"}))},render:(e,i)=>{var r;let a=dt.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 Bt(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[On(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)),fn(r)}}),Se(["char","unicode"],"{charcode:value}",{createAtom:e=>new dt(f(P({},e),{type:e.mode==="text"?"text":"mord"})),serialize:e=>{var i;return`${e.command}${Or((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 dt(e),render:(e,i)=>{var r,a,u;const d=new ln({parent:i,mathstyle:"textstyle"},e.style),g=d.toEm((r=e.args[0])!=null?r:{dimension:0}),b=d.toEm((a=e.args[1])!=null?a:{dimension:10}),x=d.toEm((u=e.args[2])!=null?u:{dimension:10}),E=new Bt(null,{classes:"rule",type:"ord"});return E.width=b,E.height=x+g,E.depth=-g,E.setStyle("border-right-width",b,"em"),E.setStyle("border-top-width",x,"em"),E.setStyle("border-color",e.style.color),E.setStyle("vertical-align",g,"em"),e.isSelected&&E.setStyle("opacity","50%"),e.bind(d,E),e.caret&&(E.caret=e.caret),E.wrap(i)},serialize:e=>`\\rule${e.args[0]?`[${Or(e.args[0])}]`:""}{${Or(e.args[1])}}{${Or(e.args[2])}}`}),Se(["overline","underline"],"{:auto}",{createAtom:e=>new dt(f(P({},e),{body:Pe(e.args[0])})),render:(e,i)=>{const r=e.command.substring(1),a=new ln({parent:i,mathstyle:"cramp"},e.style),u=dt.createBox(a,e.body);if(!u)return null;const d=a.metrics.defaultRuleThickness/a.scalingFactor,g=new Bt(null,{classes:r+"-line"});g.height=d,g.maxFontSize=d*1.125*a.scalingFactor;let b;return r==="overline"?b=new wr({shift:0,children:[{box:u},3*d,{box:g},d]}):b=new wr({top:u.height,children:[d,{box:g},3*d,{box:u}]}),e.caret&&(b.caret=e.caret),new Bt(b,{classes:r,type:"ignore"})}}),Se("overset","{:auto}{base:auto}",{createAtom:e=>{const i=Pe(e.args[1]);return new Ds(f(P({},e),{above:Pe(e.args[0]),body:i,skipBoundary:!1,boxType:_l(i)}))},serialize:(e,i)=>On(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),Se("underset","{:auto}{base:auto}",{createAtom:e=>{const i=Pe(e.args[1]);return new Ds(f(P({},e),{below:Pe(e.args[0]),body:i,skipBoundary:!1,boxType:_l(i)}))},serialize:(e,i)=>On(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),Se("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:e=>{const i=Pe(e.args[2]);return new Ds(f(P({},e),{above:Pe(e.args[0]),below:Pe(e.args[1]),body:i,skipBoundary:!1,boxType:_l(i)}))},serialize:(e,i)=>On(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),Se(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:e=>new Ds(f(P({},e),{body:Pe(e.args[2]),above:Pe(e.args[1]),below:Pe(e.args[0]),skipBoundary:!1,boxType:e.command==="\\stackrel"?"rel":"bin"})),serialize:(e,i)=>On(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),Se("smash","[:string]{:auto}",{createAtom:e=>{var i,r,a,u;return new Il(f(P({},e),{body:Pe(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 Il(f(P({},e),{body:Pe(e.args[0]),isInvisible:!0,smashWidth:!0}))}),Se(["hphantom"],"{:auto}",{createAtom:e=>new Il(f(P({},e),{body:Pe(e.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),Se(["phantom"],"{:auto}",{createAtom:e=>new Il(f(P({},e),{body:Pe(e.args[0]),isInvisible:!0}))}),Se("not","{:math}",{createAtom:e=>{const i=Pe(e.args[0]);return i.length===0?new dt(f(P({},e),{type:"mrel",value:"\uE020"})):new dt(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{${dt.serialize(r.group,i)}}`:`\\not${dt.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":_l(Pe(e.args[0])),u=dt.createBox(i,e.body,{type:a});return e.caret&&(u.caret=e.caret),e.bind(i,u)}}),Se(["ne","neq"],"",{createAtom:e=>new dt(f(P({},e),{type:"mrel",body:[new go(f(P({},e),{body:"\uE020",align:"right",boxType:"rel"})),new dt(f(P({},e),{value:"="}))],captureSelection:!0})),serialize:e=>e.command}),Se("rlap","{:auto}",{createAtom:e=>new go(f(P({},e),{body:Pe(e.args[0]),align:"right"}))}),Se("llap","{:auto}",{createAtom:e=>new go(f(P({},e),{body:Pe(e.args[0]),align:"left"}))}),Se("mathrlap","{:math}",{createAtom:e=>new go(f(P({},e),{body:Pe(e.args[0]),align:"left"}))}),Se("mathllap","{:math}",{createAtom:e=>new go(f(P({},e),{body:Pe(e.args[0]),align:"left"}))}),Se("raisebox","{:value}{:text}",{createAtom:e=>{var i;return new Js(f(P({},e),{body:Pe(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return On("\\raisebox",(r=Or(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),Se("raise","{:value}{:auto}",{createAtom:e=>{var i;return new Js(f(P({},e),{body:Pe(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return On("\\raise",(r=Or(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),Se("lower","{:value}{:auto}",{createAtom:e=>{var i;return new Js(f(P({},e),{body:Pe(e.args[1]),padding:{dimension:0},offset:(i=vs(e.args[0],-1))!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r,a;return On("\\lower",(a=Or(vs((r=e.offset)!=null?r:{dimension:0},-1)))!=null?a:"0pt",e.bodyToLatex(i))}}),Qe("0123456789/@.?!"),Z(65,90),Z(97,122),Qe([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),Qe([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),Qe([["\\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]]),Qe([["\\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"),Qe([["\\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"]]),Qe([["\\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"]]),Qe([["\\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"),Qe([["+",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"),Qe([["\\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"),Qe([["\\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]]),Qe([["=",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"),Qe([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),Qe([["\\wp",8472],["\\aleph",8501]]),Qe([["\\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"),Qe([["\\ ",160],["~",160]],"space"),Se(["!",",",":",";",">","enskip","enspace","quad","qquad"],"",{createAtom:e=>new Go(e)}),Se("space","",{createAtom:e=>new Go(e)}),Qe([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),Qe([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\mathellipsis",8230]],"minner"),Qe([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var hp="<mo>⁡</mo>",jf="<mo>⁢</mo>";function qf(e){return e.replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function zn(e,i){return!e||!i.generateID?"":` extid="${e}"`}function Ig(e,i,r){var a,u,d,g,b,x,E,R,F,Y,oe;let ge=!1;i=i!=null?i:e.atoms.length;let He="",Ot="",Ve=e.atoms[e.index];const wt=(u=(a=Ve.style)==null?void 0:a.variant)!=null?u:"",$t=(g=(d=Ve.style)==null?void 0:d.variantStyle)!=null?g:"";let At="";if(wt||$t){const _i=et(Ve.value,(b=Ve.style)==null?void 0:b.variant,(x=Ve.style)==null?void 0:x.variantStyle);if(_i!==Ve.value)return e.index+=1,He=`<mi${zn(Ve.id,r)}>${_i}</mi>`,bo(He,e,r)||(e.mathML+=He,e.lastType="mi"),!0;At=(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"}[$t+wt])!=null?E:"",At=` mathvariant="${At}"`}const si={"\\exponentialE":"ⅇ","\\imaginaryI":"ⅈ","\\differentialD":"ⅆ","\\capitalDifferentialD":"ⅅ","\\alpha":"α","\\pi":"π","\\infty":"∞","\\forall":"∀","\\nexists":"∄","\\exists":"∃","\\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(si[Ve.command]){e.index+=1;let _i=`<mi${zn(Ve.id,r)}${At}>${si[Ve.command]}</mi>`;return(e.lastType==="mi"||e.lastType==="mn"||e.lastType==="mtext"||e.lastType==="fence")&&(_i=jf+_i),bo(_i,e,r)||(e.mathML+=_i,e.lastType="mi"),!0}if(Ve.command==="\\operatorname")Ot=Fu(Ve.body),e.index+=1;else if(wt||$t)for(;e.index<i&&(Ve.type==="mord"||Ve.type==="macro")&&!Ve.isDigit()&&wt===((F=(R=Ve.style)==null?void 0:R.variant)!=null?F:"")&&$t===((oe=(Y=Ve.style)==null?void 0:Y.variantStyle)!=null?oe:"");)Ot+=Fu([Ve]),e.index+=1,Ve=e.atoms[e.index];else(Ve.type==="mord"||Ve.type==="macro")&&!Ve.isDigit()&&(Ot+=Fu([Ve]),e.index+=1);if(Ot.length>0){ge=!0,He=`<mi${At}>${Ot}</mi>`;const _i=e.lastType;He.endsWith(">f</mi>")||He.endsWith(">g</mi>")?(He+=hp,e.lastType="applyfunction"):e.lastType=/^<mo>(.*)<\/mo>$/.test(He)?"mo":"mi",bo(He,e,r)||((_i==="mi"||_i==="mn"||_i==="mtext"||_i==="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 d=e.atoms[r];a=!d.isDigit(),u=!a&&d.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 d=i.lastType;i.lastType="";const g=En(u.superscript,r);i.lastType="";const b=En(u.subscript,r);if(i.lastType=d,!g&&!b)return!1;let x="";return g&&b?x=`<msubsup>${e}${b}${g}</msubsup>`:g?x=`<msup>${e}${g}</msup>`:b&&(x=`<msub>${e}${b}</msub>`),i.mathML+=x,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 ${zn(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="",d=Og(e);for(d>=0&&d<i&&(i=d);e.index<i&&e.atoms[e.index].isDigit();)u+=e.atoms[e.index].asDigit(),e.index+=1;return u.length<=0?!1:(u="<mn"+zn(e.atoms[a].id,r)+">"+u+"</mn>",d<0&&Pg(e)&&(d=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="",d="";if(e.index<i&&e.atoms[e.index].type==="mopen"){let g=!1,b=0;const x=e.index;let E=-1,R=x+1;for(;R<i&&!g;)e.atoms[R].type==="mopen"?b+=1:e.atoms[R].type==="mclose"&&(b-=1),b===-1&&(g=!0,E=R),R+=1;g&&(u="<mrow>",u+=ql(e.atoms[x],r),u+=En(e.atoms,r,x+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=""),d="fence")}return u.length>0&&(a=!0,e.mathML+=u,e.lastType=d),a}function $g(e,i,r){let a=!1;i=i!=null?i:e.atoms.length;let u="",d="";const g=e.atoms[e.index];if(!g)return!1;const b={"\\ne":"≠","\\neq":"&neq;","\\pm":"±","\\times":"×","\\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[g.command]){e.index+=1;const x=`<mo${zn(g.id,r)}>${b[g.command]}</mo>`;return bo(x,e,r)||(e.mathML+=x,e.lastType="mo"),!0}if(e.index<i&&(g.type==="mbin"||g.type==="mrel"))u+=n0(e.atoms[e.index],r),e.index+=1,d="mo";else if(e.index<i&&(g.type==="mop"||g.type==="operator"||g.type==="extensible-symbol")){if(g.subsupPlacement==="over-under"&&(g.superscript||g.subscript)){const x=ql(g,r);return g.superscript&&g.subscript?(u+="<munderover>"+x,u+=En(g.subscript,r),u+=En(g.superscript,r),u+="</munderover>"):g.superscript?(u+="<mover>"+x,u+=En(g.superscript,r),u+="</mover>"):g.subscript&&(u+="<munder>"+x,u+=En(g.subscript,r),u+="</munder>"),e.mathML+=u,e.lastType="mo",e.index+=1,!0}{const x=e.atoms[e.index],E=x.value==="\\operatorname",R=E?'<mi class="MathML-Unit"'+zn(x.id,r)+">"+Fu(x.value)+"</mi>":ql(x,r);u+=R,!E&&!/^<mo>(.*)<\/mo>$/.test(R)?(u+=hp,d="applyfunction"):d=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=d)),a}function En(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 dt)u.mathML=n0(e,i);else if(Array.isArray(e)){u.atoms=e;let d=0;for(a=a||(e?e.length:0);u.index<a;)if(Fg(u,a,i)||Bg(u,a,i)||Ig(u,a,i)||$g(u,a,i)||Ng(u,a,i))d+=1;else if(u.index<a){let g=n0(u.atoms[u.index],i);u.lastType==="mn"&&g.length>0&&u.atoms[u.index].type==="genfrac"&&(g="<mo>⁤</mo>"+g),u.atoms[u.index].type==="genfrac"?u.lastType="mfrac":u.lastType="",u.index+=1,bo(g,u,i)?d+=1:g.length>0&&(u.mathML+=g,d+=1)}d>1&&(u.mathML="<mrow>"+u.mathML+"</mrow>")}return u.mathML}function ql(e,i){let r="";const a=Fu(e.value);return a&&(r="<mo"+zn(e.id,i)+">"+a+"</mo>"),r}function Fu(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 n0(e,i){var r,a,u,d,g,b,x,E,R,F,Y,oe,ge,He,Ot,Ve,wt,$t,At,si,_i,ci;if(e.mode==="text")return`<mi${zn(e.id,i)}>${e.value}</mi>`;const cn={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"},Fn={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let Wt="",Ns="",Ua,ta,Nr,$s,bs,Vn;const{command:br}=e;if(e.command==="\\error")return`<merror${zn(e.id,i)}>${En(e.body,i)}</merror>`;const $r={"\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"},za={"\\vec":"⃗","\\acute":"´","\\grave":"`","\\dot":"˙","\\ddot":"¨","\\tilde":"~","\\bar":"¯","\\breve":"˘","\\check":"ˇ","\\hat":"^"};switch(e.type){case"first":break;case"group":case"root":Wt=En(e.body,i);break;case"array":if((e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&(Wt+="<mrow>",e.leftDelim&&e.leftDelim!=="."&&(Wt+="<mo>"+($r[e.leftDelim]||e.leftDelim)+"</mo>")),Wt+="<mtable",e.colFormat){for(Wt+=' columnalign="',Nr=0;Nr<e.colFormat.length;Nr++)e.colFormat[Nr].align&&(Wt+={l:"left",c:"center",r:"right"}[e.colFormat[Nr].align]+" ");Wt+='"'}for(Wt+=">",ta=0;ta<e.array.length;ta++){for(Wt+="<mtr>",Ua=0;Ua<e.array[ta].length;Ua++)Wt+="<mtd>"+En(e.array[ta][Ua],i)+"</mtd>";Wt+="</mtr>"}Wt+="</mtable>",(e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&(e.rightDelim&&e.rightDelim!=="."&&(Wt+="<mo>"+($r[e.leftDelim]||e.rightDelim)+"</mo>"),Wt+="</mrow>");break;case"genfrac":(e.leftDelim||e.rightDelim)&&(Wt+="<mrow>"),e.leftDelim&&e.leftDelim!=="."&&(Wt+="<mo"+zn(e.id,i)+">"+($r[e.leftDelim]||e.leftDelim)+"</mo>"),e.hasBarLine?(Wt+="<mfrac>",Wt+=En(e.above,i)||"<mi> </mi>",Wt+=En(e.below,i)||"<mi> </mi>",Wt+="</mfrac>"):(Wt+="<mtable"+zn(e.id,i)+">",Wt+="<mtr>"+En(e.above,i)+"</mtr>",Wt+="<mtr>"+En(e.below,i)+"</mtr>",Wt+="</mtable>"),e.rightDelim&&e.rightDelim!=="."&&(Wt+="<mo"+zn(e.id,i)+">"+($r[e.rightDelim]||e.rightDelim)+"</mo>"),(e.leftDelim||e.rightDelim)&&(Wt+="</mrow>");break;case"surd":e.hasEmptyBranch("above")?(Wt+="<msqrt"+zn(e.id,i)+">",Wt+=En(e.body,i),Wt+="</msqrt>"):(Wt+="<mroot"+zn(e.id,i)+">",Wt+=En(e.body,i),Wt+=En(e.above,i),Wt+="</mroot>");break;case"leftright":const Va=e,Ga=Va.leftDelim;Wt="<mrow>",Ga&&Ga!=="."&&(Wt+=`<mo${zn(e.id,i)}>${(r=$r[Ga])!=null?r:Ga}</mo>`),e.body&&(Wt+=En(e.body,i));const Ha=Va.matchingRightDelim();Ha&&Ha!=="."&&(Wt+=`<mo${zn(e.id,i)}>${(a=$r[Ha])!=null?a:Ha}</mo>`),Wt+="</mrow>";break;case"sizeddelim":case"delim":Wt+=`<mo${zn(e.id,i)}>${$r[e.value]||e.value}</mo>`;break;case"accent":Wt+='<mover accent="true"'+zn(e.id,i)+">",Wt+=En(e.body,i),Wt+="<mo>"+(za[br]||e.accent)+"</mo>",Wt+="</mover>";break;case"line":case"overlap":break;case"overunder":bs=e.above,$s=e.below,(e.svgAbove||bs)&&(e.svgBelow||$s)?Vn=e.body:bs&&bs.length>0?(Vn=e.body,(d=(u=e.body)==null?void 0:u[0])!=null&&d.below?($s=e.body[0].below,Vn=e.body[0].body):((b=(g=e.body)==null?void 0:g[0])==null?void 0:b.type)==="first"&&((E=(x=e.body)==null?void 0:x[1])!=null&&E.below)&&($s=e.body[1].below,Vn=e.body[1].body)):$s&&$s.length>0&&(Vn=e.body,(F=(R=e.body)==null?void 0:R[0])!=null&&F.above?(bs=e.body[0].above,Vn=e.body[0].body):((oe=(Y=e.body)==null?void 0:Y[0])==null?void 0:oe.type)==="first"&&((He=(ge=e.body)==null?void 0:ge[1])!=null&&He.above)&&(bs=e.body[1].overscript,Vn=e.body[1].body)),(e.svgAbove||bs)&&(e.svgBelow||$s)?(Wt+=`<munderover ${zn(e.id,i)}>`,Wt+=(Ot=cn[e.svgBody])!=null?Ot:En(Vn,i),Wt+=(Ve=cn[e.svgBelow])!=null?Ve:En($s,i),Wt+=(wt=cn[e.svgAbove])!=null?wt:En(bs,i),Wt+="</munderover>"):e.svgAbove||bs?(Wt+=`<mover ${zn(e.id,i)}>`+(($t=cn[e.svgBody])!=null?$t:En(Vn,i)),Wt+=(At=cn[e.svgAbove])!=null?At:En(bs,i),Wt+="</mover>"):(e.svgBelow||$s)&&(Wt+=`<munder ${zn(e.id,i)}>`+((si=cn[e.svgBody])!=null?si:En(Vn,i)),Wt+=(_i=cn[e.svgBelow])!=null?_i:En($s,i),Wt+="</munder>");break;case"placeholder":Wt+="?";break;case"mord":{Wt=typeof e.value=="string"?e.value:br,br==="\\char"?Wt="&#x"+("000000"+e.args[0].number.toString(16)).slice(-4)+";":Wt.length>0&&Wt.startsWith("\\")&&(typeof e.value=="string"&&e.value.charCodeAt(0)>255?Wt="&#x"+("000000"+e.value.charCodeAt(0).toString(16)).slice(-4)+";":typeof e.value=="string"?Wt=e.value.charAt(0):(console.error("Did not expect this"),Wt=""));const Sa=/\d/.test(Wt)?"mn":"mi";Wt=`<${Sa}${zn(e.id,i)}>${qf(Wt)}</${Sa}>`;break}case"mbin":case"mrel":case"minner":Wt=ql(e,i);break;case"mpunct":Wt='<mo separator="true"'+zn(e.id,i)+">"+br+"</mo>";break;case"mop":case"operator":case"extensible-symbol":e.body!=="\u200B"&&(Wt="<mo"+zn(e.id,i)+">",Wt+=br==="\\operatorname"?e.body:br||e.body,Wt+="</mo>");break;case"box":Wt='<menclose notation="box"',e.backgroundcolor&&(Wt+=' mathbackground="'+e.backgroundcolor+'"'),Wt+=zn(e.id,i)+">"+En(e.body,i)+"</menclose>";break;case"spacing":Wt+='<mspace width="'+((ci=Fn[br])!=null?ci:0)+'em"/>';break;case"enclose":Wt='<menclose notation="';for(const Sa in e.notation)Object.prototype.hasOwnProperty.call(e.notation,Sa)&&e.notation[Sa]&&(Wt+=Ns+Sa,Ns=" ");Wt+=zn(e.id,i)+'">'+En(e.body,i)+"</menclose>";break;case"prompt":Wt='<menclose notation="roundexbox""">'+En(e.body,i)+"</menclose>";break;case"space":Wt+=" ";break;case"subsup":break;case"phantom":break;case"composition":break;case"rule":break;case"chem":break;case"mopen":Wt+=ql(e,i);break;case"mclose":Wt+=ql(e,i);break;case"macro":{const Sa=e.command+Fu(e.macroArgs);Sa&&(Wt+=`<mo ${zn(e.id,i)}>${Sa}</mo>`)}break;case"latexgroup":Wt+=En(e.body,i);break;case"latex":Wt+="<mtext"+zn(e.id,i)+">"+e.value+"</mtext>";break;case"tooltip":Wt+=En(e.body,i);break;case"text":Wt+=`<mtext ${zn(e.id,i)}x>${e.value}</mtext>`;break;default:if(e.command==="\\displaystyle")return`<mrow ${zn(e.id,i)} displaystyle="true">${En(e.body,i)}</mrow>`;if(e.command==="\\textstyle")return`<mrow ${zn(e.id,i)} displaystyle="false">${En(e.body,i)}</mrow>`;console.info("Unexpected element in conversion to MathML:",e)}return Wt}var Bu={"\\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"},r0={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 Jc(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 fp(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 sn(e,i){var r,a,u,d,g;function b(R){return window.MathfieldElement.textToSpeechMarkup?/[a-z]/.test(R)?` <say-as interpret-as="character">${R}</say-as>`:/[A-Z]/.test(R)?`capital <say-as interpret-as="character">${R.toLowerCase()}</say-as>`:R:/[a-z]/.test(R)?" '"+R.toUpperCase()+"'":/[A-Z]/.test(R)?" 'capital "+R.toUpperCase()+"'":R}function x(R){return"<emphasis>"+R+"</emphasis>"}if(!i)return"";let E="";if(k(i)){let R=!1,F=!1;for(let Y=0;Y<i.length;Y++)i[Y].type!=="first"&&(i[Y].mode!=="text"&&(F=!1),Y<i.length-2&&i[Y].type==="mopen"&&i[Y+2].type==="mclose"&&i[Y+1].type==="mord"?(E+=" of ",E+=x(sn(e,i[Y+1])),Y+=2):i[Y].mode==="text"?F?E+=(r=i[Y].value)!=null?r:" ":(F=!0,E+=sn("text",i[Y])):i[Y].isDigit()?R?E+=i[Y].asDigit():(R=!0,E+=sn(e,i[Y])):(R=!1,E+=sn(e,i[Y])))}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 R="",F="",Y="",oe=!1;const{command:ge}=i;switch(ge){case"\\vec":return"vector "+sn(e,i.body);case"\\acute":return sn(e,i.body)+" acute";case"\\grave":return sn(e,i.body)+" grave";case"\\dot":return"dot over"+sn(e,i.body);case"\\ddot":return"double dot over"+sn(e,i.body);case"\\mathring":return"ring over"+sn(e,i.body);case"\\tilde":case"\\widetilde":return"tilde over"+sn(e,i.body);case"\\bar":return sn(e,i.body)+" bar";case"\\breve":return sn(e,i.body)+" breve";case"\\check":case"\\widecheck":return"check over "+sn(e,i.body);case"\\hat":case"\\widehat":return"hat over"+sn(e,i.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+sn(e,i.body);case"\\underarc":case"\\underparen":return"arc under "+sn(e,i.body)}switch(i.type){case"prompt":const He=i.body.length>1?'start input . <break time="500ms"/> '+sn(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 Ot=i.array,Ve=i.environmentName;if(Object.keys(r0).includes(Ve)){E+=` begin ${r0[Ve]} `;for(let At=0;At<Ot.length;At++){At>0&&(E+=","),E+=` row ${At+1} `;for(let si=0;si<Ot[At].length;si++)si>0&&(E+=","),E+=` column ${si+1}: `,E+=sn("math",Ot[At][si])}E+=` end ${r0[Ve]} `}break;case"group":ge==="\\ne"?E+=" not equal ":(ge==="\\not"&&(E+=" not "),E+=sn("math",i.body));break;case"root":E+=sn("math",i.body);break;case"genfrac":if(R=sn("math",i.above),F=sn("math",i.below),Jc(i.above)&&Jc(i.below)){const si={"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 "}[fp(i.above)+"/"+fp(i.below)];si?E=si:E+=R+" over "+F}else E+=' the fraction <break time="150ms"/>'+R+' over <break time="150ms"/>'+F+'.<break time="150ms"/> End fraction.<break time="150ms"/>';break;case"surd":if(Y=sn("math",i.body),i.hasEmptyBranch("above"))E+=Jc(i.body)?" the square root of "+Y+" , ":' the square root of <break time="200ms"/>'+Y+'. <break time="200ms"/> End square root';else{let At=sn("math",i.above);At=At.trim();const si=At.replace(/<mark([^/]*)\/>/g,"");si==="3"?E+=' the cube root of <break time="200ms"/>'+Y+'. <break time="200ms"/> End cube root':si==="n"?E+=' the nth root of <break time="200ms"/>'+Y+'. <break time="200ms"/> End root':E+=' the root with index: <break time="200ms"/>'+At+', of <break time="200ms"/>'+Y+'. <break time="200ms"/> End root'}break;case"leftright":{const At=i;E+=(u=At.leftDelim?Bu[At.leftDelim]:void 0)!=null?u:At.leftDelim,E+=sn("math",i.body),E+=(d=At.rightDelim?Bu[At.rightDelim]:void 0)!=null?d:At.rightDelim}break;case"rule":break;case"overunder":break;case"overlap":break;case"macro":const wt=ge.replace(/^\\/g,""),$t=Nt()[wt];$t&&($t!=null&&$t.expand?E+=sn("math",i.body):E+=`${wt} `);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=sn(e,i.body);break}let At=i.isDigit()?i.asDigit():i.value,si=i.command;if((i.type==="delim"||i.type==="sizeddelim")&&(si=i.value,At=si),e==="text")E+=At;else{if(i.type==="mbin"&&(E+='<break time="150ms"/>'),At){const _i=Bu[At]||(si?Bu[si.trim()]:"");if(_i)E+=" "+_i;else{const ci=si?Kg(si.trim()):"";E+=ci||b(At)}}else E+=sn("math",i.body);i.type==="mbin"&&(E+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if(i.value!=="\u200B"){const At=i.command;if(At==="\\sum")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let si=sn("math",i.superscript);si=si.trim();let _i=sn("math",i.subscript);_i=_i.trim(),E+=' the summation from <break time="200ms"/>'+_i+'<break time="200ms"/> to <break time="200ms"/>'+si+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(i.hasEmptyBranch("subscript"))E+=" the summation of";else{let si=sn("math",i.subscript);si=si.trim(),E+=' the summation from <break time="200ms"/>'+si+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(At==="\\prod")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let si=sn("math",i.superscript);si=si.trim();let _i=sn("math",i.subscript);_i=_i.trim(),E+=' the product from <break time="200ms"/>'+_i+'<break time="200ms"/> to <break time="200ms"/>'+si+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(i.hasEmptyBranch("subscript"))E+=" the product of ";else{let si=sn("math",i.subscript);si=si.trim(),E+=' the product from <break time="200ms"/>'+si+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(At==="\\int")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let si=sn("math",i.superscript);si=si.trim();let _i=sn("math",i.subscript);_i=_i.trim(),E+=' the integral from <break time="200ms"/>'+x(_i)+'<break time="200ms"/> to <break time="200ms"/>'+x(si)+' <break time="200ms"/> of ',oe=!0}else E+=' the integral of <break time="200ms"/> ';else if(typeof i.value=="string"){const si=(g=Bu[i.value])!=null?g:i.command?Bu[i.command]:void 0;E+=si||" "+i.value}else i.command&&(i.command==="\\mathop"?E+=sn("math",i.body):i.command==="\\operatorname"?E+=zg(i.body):E+=i.command.startsWith("\\")?" "+i.command.slice(1):" "+i.command)}break;case"enclose":Y=sn("math",i.body),E+=" crossed out "+Y+". End crossed out.";break;case"space":case"spacing":break}if(!oe&&!i.hasEmptyBranch("superscript")){let He=sn(e,i.superscript);He=He.trim();const Ot=He.replace(/<[^>]*>/g,"");if(Jc(i.superscript)){if(e==="math"){const Ve=Ug(i.superscript);Ve&&(E+='<mark name="'+Ve+'"/>')}Ot==="\u2032"?E+=" prime ":Ot==="2"?E+=" squared ":Ot==="3"?E+=" cubed ":Number.isNaN(Number.parseInt(Ot))?E+=" to the "+He+"; ":E+=' to the <say-as interpret-as="ordinal">'+Ot+"</say-as> power; "}else Number.isNaN(Number.parseInt(Ot))?E+=" raised to the "+He+"; ":E+=' raised to the <say-as interpret-as="ordinal">'+Ot+"</say-as> power; "}if(!oe&&!i.hasEmptyBranch("subscript")){let He=sn("math",i.subscript);He=He.trim(),E+=Jc(i.subscript)?" sub "+He:" subscript "+He+". End subscript. "}}return E}function Nu(e){var i,r;if(window.MathfieldElement.textToSpeechRules==="sre"&&("sre"in window||"SRE"in window)){const u=En(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 d=(r=window.SRE)!=null?r:window.sre.System.getInstance();window.MathfieldElement.textToSpeechRulesOptions&&d.setupEngine(window.MathfieldElement.textToSpeechRulesOptions);let g="";try{g=d.toSpeech(u)}catch(b){console.error("MathLive 0.98.5: `SRE.toSpeech()` runtime error",b)}return g}return""}let a=sn("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"&&G()==="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 Qc={"\\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"},eh={"\\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 yr(e){var i,r,a,u,d,g,b,x,E,R,F,Y,oe;if(!e)return"";if(k(e)){if(e.length===0)return"";if(e[0].mode==="latex")return e.map(yr).join("");if(e[0].mode==="text"){let $t=0,At="";for(;((i=e[$t])==null?void 0:i.mode)==="text";)At+=e[$t].body?yr(e[$t].body):e[$t].value,$t++;return`"${At}" ${yr(e.slice($t))}`}let Ve=0;const wt=[];for(;e[Ve]&&e[Ve].mode==="math";){let $t="";for(;e[Ve]&&e[Ve].type==="mord"&&/\d/.test(e[Ve].value);)$t+=e[Ve++].value;$t?wt.push($t):wt.push(yr(e[Ve++]))}return wt.push(yr(e.slice(Ve))),Vg(wt)}if(e.mode==="text")return`"${e.value}"`;let ge="";const{command:He}=e;let Ot;if(He==="\\placeholder")return`(${yr(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:""} ${yr(e.body)} `;break;case"first":return"";case"latexgroup":return e.body.map(ci=>ci.value).join("");case"group":case"root":ge=(r=Qc[He])!=null?r:yr(e.body);break;case"genfrac":{const ci=e;(ci.leftDelim||ci.rightDelim)&&(ge=ci.leftDelim==="."||!ci.leftDelim?"{:":ci.leftDelim),ci.hasBarLine?(ge+="(",ge+=yr(ci.above),ge+=")/(",ge+=yr(ci.below),ge+=")"):(ge+="("+yr(ci.above)+"),",ge+="("+yr(ci.below)+")"),(ci.leftDelim||ci.rightDelim)&&(ge+=ci.rightDelim==="."||!ci.rightDelim?"{:":ci.rightDelim)}break;case"surd":ge+=e.hasEmptyBranch("above")?"sqrt("+yr(e.body)+")":"root("+yr(e.above)+")("+yr(e.body)+")";break;case"latex":ge=e.value;break;case"leftright":{const ci=e,cn=ci.leftDelim;ge+=cn==="."||!cn?"{:":cn,ge+=yr(ci.body);const Fn=ci.matchingRightDelim();ge+=Fn==="."||!Fn?":}":Fn}break;case"sizeddelim":case"delim":ge=e.value;break;case"overlap":break;case"overunder":break;case"mord":ge=(u=(a=Qc[He])!=null?a:He)!=null?u:typeof e.value=="string"?e.value:"",ge.startsWith("\\")&&(ge+=" "),Ot=He?He.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null,Ot?ge=String.fromCodePoint(Number.parseInt("0x"+Ot[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=(g=(d=Qc[He])!=null?d:eh[He])!=null?g:e.value;break;case"mopen":case"mclose":ge=e.value;break;case"mpunct":ge=(b=eh[He])!=null?b:He;break;case"mop":case"operator":case"extensible-symbol":e.value!=="\u200B"&&(eh[He]?ge=eh[He]:ge=He==="\\operatorname"?yr(e.body):(x=e.value)!=null?x:He,ge+=" ");break;case"array":const wt=e.array,$t=e.environmentName,At=(E={bmatrix:["[","]"],"bmatrix*":["[","]"]}[$t])!=null?E:["(",")"],si=[];for(const ci of wt){const cn=[];for(const Fn of ci)cn.push(At[0]+yr(Fn)+At[1]);si.push(cn.join(","))}const _i=(R={bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]}[$t])!=null?R:["(",")"];ge=_i[0]+si.join(",")+_i[1];break;case"box":break;case"spacing":ge=(F=Qc[He])!=null?F:" ";break;case"enclose":ge="("+yr(e.body)+")";break;case"space":ge=" ";break;case"subsup":ge="";break;case"macro":ge=(oe=(Y=Qc[He])!=null?Y:eh[He])!=null?oe:yr(e.body);break}if(!e.hasEmptyBranch("subscript")){ge+="_";const Ve=yr(e.subscript);ge+=Ve.length!==1?`(${Ve})`:Ve}if(!e.hasEmptyBranch("superscript")){ge+="^";const Ve=yr(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 Br(e,i){var r,a;i!=null||(i={}),i.mathstyle=(r=i.mathstyle)!=null?r:"displaystyle";const u=new ln({from:f(P({},Ec()),{renderPlaceholder:()=>new Bt(160,{maxFontSize:1}),letterShapeStyle:(a=i==null?void 0:i.letterShapeStyle)!=null?a:"tex"}),mathstyle:i.mathstyle}),g=new dt({mode:"math",type:"root",body:Zr(e,{context:u,parseMode:"math",mathstyle:i.mathstyle})}).render(u);return g?(mu(Pl(g,u)),gu(g,{classes:"ML__latex"}).toMarkup()):""}function P1(e){return ff(e,{context:Ec()})}function Hg(e,i={}){return En(Zr(e,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),i)}function Wg(e){const i=Zr(e,{parseMode:"math",mathstyle:"displaystyle"});return Nu(i)}var Zf;function jg(e){var i,r;if(!Zf){const a=(i=globalThis[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:i.ComputeEngine;a?Zf=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=Zf==null?void 0:Zf.box(e).latex)!=null?r:""}function O1(e,i="math"){return yr(new dt({type:"root",body:Zr(e,{parseMode:i})}))}function F1(e){return fa(e,{format:"ascii-math"})[1]}function s0(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?dp(e):e}function $u(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 a0(e){const[i,r,a]=[e.L,e.C,e.H],u=a*Math.PI/180,d={L:i,a:r*Math.cos(u),b:r*Math.sin(u)};return e.alpha!==void 0&&(d.alpha=e.alpha),d}function Zg(e){const[i,r,a]=[e.L,e.a,e.b],u=Math.sqrt(r*r+a*a),g=Math.atan2(a,r)*180/Math.PI,b={L:i,C:u,H:g};return e.alpha!==void 0&&(b.alpha=e.alpha),b}function o0(e){const[i,r,a]=[e.L,e.a,e.b],u=Math.pow(.9999999984505198*i+.39633779217376786*r+.2158037580607588*a,3),d=Math.pow(1.00000000888176*i-.10556134232365635*r-.0638541747717059*a,3),g=Math.pow(i*1.000000054672411-.0894841820949657*r-1.2914855378640917*a,3),b=4.076741661347994*u-3.307711590408193*d+.230969928729428*g,x=-1.2684380040921763*u+2.6097574006633715*d-.3413193963102197*g,E=-.004196086541837188*u-.7034186144594493*d+1.7076147009309444*g,R=F=>{const Y=Math.abs(F);return Y<=.0031308?F*12.92:(Math.sign(F)||1)*(1.055*Math.pow(Y,1/2.4)-.055)};return[R(b),R(x),R(E)]}function l0(e){const[i,r,a]=e;return i>=0&&i<=1&&r>=0&&r<=1&&a>=0&&a<=1}function u0(e,i){let[r,a,u]=e;return r=$u(r*255),a=$u(a*255),u=$u(u*255),i!==void 0?{r,g:a,b:u,alpha:i}:{r,g:a,b:u}}function dp(e){let[i,r,a]=o0(e);if(l0([i,r,a]))return u0([i,r,a],e.alpha);const u=Zg(e);if(u.C=0,[i,r,a]=o0(a0(u)),!l0([i,r,a]))return u0([i,r,a],e.alpha);let d=0,g=e.L,b=(d+g)/2;u.C=b;const x=.36/Math.pow(2,12);for(;g-d>x;)b=(d+g)/2,u.C=b,[i,r,a]=o0(a0(u)),l0([i,r,a])?d=b:g=b;return u0([i,r,a],e.alpha)}function Yg(e){return dp(a0(e))}function pp(e,i){const r=s0(e),a=s0(i),u=.56,d=.57,g=.62,b=.65,x=.022,E=1.414,R=.1,F=5e-4,Y=1.14,oe=.027,ge=1.14,He=.027;function Ot(ci){return ci>=x?ci:ci+Ea(x-ci,E)}function Ve(ci){return(ci<0?-1:1)*Math.pow(Math.abs(ci),2.4)}const wt=Ot(Ve(a.r/255)*.2126729+Ve(a.g/255)*.7151522+Ve(a.b/255)*.072175),$t=Ot(Ve(r.r/255)*.2126729+Ve(r.g/255)*.7151522+Ve(r.b/255)*.072175);let At,si,_i;return Math.abs($t-wt)<F?si=0:$t>wt?(At=Ea($t,u)-Ea(wt,d),si=At*Y):(At=Ea($t,b)-Ea(wt,g),si=At*ge),Math.abs(si)<R?_i=0:si>0?_i=si-He:_i=si+oe,_i*100}function mp(e,i,r){r!=null||(r="#fff"),i!=null||(i="#000");const a=pp(e,r),u=pp(e,i);return Math.abs(a)>Math.abs(u)?r:i}function Xg(e){const i=s0(e);let r=((1<<24)+($u(i.r)<<16)+($u(i.g)<<8)+$u(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 er(e){const i=gp(e);let r="";for(const a of i){if(typeof a.value!="string")return"";r+=a.value}return r}function gp(e){const r=e.model.selection.ranges;return r.length!==1?[]:e.model.getAtoms(r[0])}function Jg(e,i){const r=gp(e);if(r.length!==1)return!1;const a=Uc[i];return a?!!a.test(r[0].value):!1}function Qg(e,i){return er(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"),h0(e,"up","mathrm","tooltip.roman-upright"),h0(e,"bold","mathbf","tooltip.bold"),h0(e,"italic","mathit","tooltip.italic")]}function t1(e){return[{label:()=>Br(`\\vec{${er(e)}}`),visible:()=>er(e).length===1,onMenuSelect:()=>e.insert("\\vec{#@}",{selectionMode:"item"})},{label:()=>Br(`\\overrightarrow{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{label:()=>Br(`\\overleftarrow{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{label:()=>Br(`\\dot{${er(e)}}`),visible:()=>er(e).length===1,onMenuSelect:()=>e.insert("\\dot{#@}",{selectionMode:"item"})},{label:()=>Br(`\\ddot{${er(e)}}`),visible:()=>er(e).length===1,onMenuSelect:()=>e.insert("\\ddot{#@}",{selectionMode:"item"})},{label:()=>Br(`\\bar{${er(e)}}`),visible:()=>er(e).length===1,onMenuSelect:()=>e.insert("\\bar{#@}",{selectionMode:"item"})},{label:()=>Br(`\\overline{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\overline{#@}",{selectionMode:"item"})},{label:()=>Br(`\\overgroup{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\overgroup{#@}",{selectionMode:"item"})},{label:()=>Br(`\\overbrace{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\overbrace{#@}",{selectionMode:"item"})},{label:()=>Br(`\\underline{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\underline{#@}",{selectionMode:"item"})},{label:()=>Br(`\\undergroup{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\undergroup{#@}",{selectionMode:"item"})},{label:()=>Br(`\\underbrace{${er(e)}}`),visible:()=>er(e).length>0,onMenuSelect:()=>e.insert("\\underbrace{#@}",{selectionMode:"item"})}]}function i1(e){return[{label:()=>Br(`\\boxed{${e.getValue(e.model.selection)}}}`),onMenuSelect:()=>e.insert("\\boxed{#@}",{selectionMode:"item"})},{label:()=>Br(`\\bbox[5px, border: 2px solid red]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{label:()=>Br(`\\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(Ae))i.push({class:(Xg(mp(Ae[r]))==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${Ae[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:(mp(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 np{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,d)=>new s1(u,d,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:()=>th(e,"matrix")},{label:"(\u22F1)",id:"environment-parentheses",onMenuSelect:()=>th(e,"pmatrix")},{label:"[\u22F1]",id:"environment-brackets",onMenuSelect:()=>th(e,"bmatrix")},{label:"|\u22F1|",id:"environment-bar",onMenuSelect:()=>th(e,"vmatrix")},{label:"{\u22F1}",id:"environment-braces",onMenuSelect:()=>th(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:()=>{_o(e,"accept-all"),e.executeCommand(["switchMode","math"])},checked:()=>e.model.mode==="math"},{label:()=>V("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{_o(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&&er(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",Br(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(d=>{var g;return(g=d.simplify().latex)!=null?g:""});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:()=>Hn.copyToClipboard(e,"latex"),keyboardShortcut:"meta+C"},{label:()=>V("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>Hn.copyToClipboard(e,"ascii-math")},{label:()=>V("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>Hn.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 th(e,i){ds(e),e.flushInlineShortcutBuffer(),O0(e.model,i),dr(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:()=>Br(`\\${r}{${er(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 h0(e,i,r,a){return{label:()=>Br(`\\${r}{${er(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 Ku(e,i){return e+Nu(i)}Cs({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:d}=e;function g(R){let F=null;switch(R){case"all":F=d.root;break;case"selection":F=d.getAtoms(d.selection);break;case"left":{F=d.getAtoms(d.offsetOf(d.at(d.position).leftSibling),d.position);break}case"right":{F=d.getAtoms(d.position,d.offsetOf(d.at(d.position).rightSibling));break}case"group":F=d.getAtoms(d.getSiblingsRange(d.position));break;case"parent":{const{parent:Y}=d.at(d.position);Y!=null&&Y.parent?F=Y:F=d.root;break}default:F=d.root}return F}function b(R){let F="";switch(R){case"all":console.log("Internal failure: speak all failed");break;case"selection":F="no selection";break;case"left":F="at start";break;case"right":F="at end";break;case"group":console.log("Internal failure: speak group failed");break;case"parent":F="no parent";break;default:console.log('unknown speak_ param value: "'+R+'"');break}return F}const x=g(i);if(x===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=Nu(x);return M()&&r.withHighlighting?(Zo().readAloudMathfield=e,Kl(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(!M()){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,(d,g)=>{if(d)console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${d}`);else if(g!=null&&g.AudioStream){const b=new Uint8Array(g.AudioStream),x=new Blob([b.buffer],{type:"audio/mpeg"}),E=URL.createObjectURL(x);new Audio(E).play().catch(F=>console.log(F))}else console.log("polly.synthesizeSpeech():",g)})}else window.MathfieldElement.speechEngine==="google"&&console.error("MathLive 0.98.5: The Google speech engine is not supported yet. Please come again.")}function _p(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=Ku("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=Ku("",e.model.at(e.model.position));else if(i==="line"){const d=Ku("",e.model.root);e.keyboardDelegate.setAriaLabel(d)}else u=a?Ku(i+" ",a):i;if(u){const d=e.ariaLiveText.textContent.includes("\xA0")?" \u202F ":" \xA0 ";e.ariaLiveText.textContent=u+d}}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 d=e.at(e.position).parent;for(;u!==e.root&&u!==d;)a+=`out of ${_p(u)};`,u=u.parent;return a}function m1(e){if(!e.selectionIsCollapsed)return Ku("",e.getAtoms(e.selection));let i="";const r=e.at(e.position),a=_p(r);return r.isFirstSibling&&(i=(a?"start of "+a:"unknown")+": "),r.isLastSibling?r.isFirstSibling||(i+=a?"end of "+a:"unknown"):i+=Ku("",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 d=this.silenceNotifications;this.silenceNotifications=!0,this.mode=e.mode,this.root=ba(e.content),this.selection=e.selection,this.silenceNotifications=d,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 d=this.normalizeSelection(e,i);if(d===void 0)throw new TypeError("Invalid selection");if(d.ranges.length===1&&d.ranges[0][0]===d.ranges[0][1]){const R=d.ranges[0][0];if(!this.mathfield.dirty&&!((r=this.at(R))!=null&&r.parentPrompt)&&this.mathfield.hasEditablePrompts){if((a=this.at(R-1))!=null&&a.parentPrompt){this._anchor=this.normalizeOffset(R-1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}if((u=this.at(R+1))!=null&&u.parentPrompt){this._anchor=this.normalizeOffset(R+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=R,this._position=R,this._selection=d;return}const g=Fr(d);d.direction==="backward"?[this._position,this._anchor]=g:[this._anchor,this._position]=g;const b=this.at(g[0]+1),x=this.at(g[1]),E=dt.commonAncestor(b,x);(E==null?void 0:E.type)==="array"&&b.parent===E&&x.parent===E?this._selection={ranges:[g],direction:d.direction}:this._selection={ranges:[g],direction:d.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 Sr&&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(ha(e)){if(a=i!=null?i:{},e.ranges.length>1)return e.ranges.reduce((E,R)=>[...E,...this.getAtoms(R,a)],[]);e=e.ranges[0]}let u,d;if(Ar(e)){if(u=e,!Ar(i))return[];d=i}else[u,d]=e,a=i!=null?i:{};if(!Number.isFinite(u))return[];a.includeChildren===void 0&&(a.includeChildren=!1),u<0&&(u=this.lastOffset-u+1),d<0&&(d=this.lastOffset-d+1);const g=Math.min(u,d)+1,b=Math.max(u,d);if(!a.includeChildren&&g===1&&b===this.lastOffset)return[this.root];let x=[];for(let E=g;E<=b;E++){const R=this.atoms[E];vp(this,R,g,b)&&x.push(R)}return a.includeChildren||(x=x.filter(E=>{let R=!1,{parent:F}=E;for(;F&&!R;)R=vp(this,F,g,b),F=F.parent;return!R})),x}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 d=i;d<=u;d++)if(a=this.atoms[d],e(a))return a;for(let d=0;d<i;d++)if(a=this.atoms[d],e(a))return a;return}for(let d=i;d>=0;d--)if(a=this.atoms[d],e(a))return a;for(let d=u;d>i;d--)if(a=this.atoms[d],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 dt({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 dt.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 En(e);if(r==="spoken")return Nu(e);if(r==="spoken-text"){const a=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="";const u=Nu(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=Nu(e);return window.MathfieldElement.textToSpeechMarkup=a,u}return r==="ascii-math"?yr(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(Ar(e)&&Ar(i)?(a=[this.normalizeRange([e,i])],u=r):as(e)?(a=[this.normalizeRange(e)],u=i):ha(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 d=this.getValue({ranges:a},"latex-unstyled");try{const g=window.MathfieldElement.computeEngine.parse(d);return JSON.stringify(g.json)}catch(g){return JSON.stringify(["Error",`'${g.toString()}'`])}}if(u.startsWith("latex")){const d={expandMacro:u==="latex-expanded",skipStyles:u==="latex-unstyled",skipPlaceholders:u==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode};return fn(a.map(g=>dt.serialize(this.getAtoms(g),d)))}return a.map(d=>this.getAtoms(d).map(g=>this.atomToString(g,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:d}=this.at(u);if(d&&(d.type==="genfrac"||d.type==="subsup"))for(;d!==this.root&&f0(this,d,[a,u]);)u=this.offsetOf(d),d=d.parent;for(d=this.at(a).parent;d!==this.root&&f0(this,d,[a,u]);)a=this.offsetOf(d.leftSibling),d=d.parent;if(d=this.at(u).parent,(d==null?void 0:d.type)==="genfrac")for(;d!==this.root&&f0(this,d,[a,u]);)u=this.offsetOf(d),console.assert(u>=0),d=d.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,d=this.silenceNotifications;this.silenceNotifications=!0;const g=this.root.changeCounter;i();const b=this.root.changeCounter!==g,x=a!==this._anchor||u!==this._position||cd(this._selection,r)==="different";return this.silenceNotifications=d,e.content&&b&&this.contentDidChange({inputType:e.type}),e.selection&&x&&this.selectionDidChange(),b||x}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(Ar(e)){const u=this.normalizeOffset(e);if(Ar(i)){const d=this.normalizeOffset(i);a=u<=d?{ranges:[[u,d]],direction:"none"}:{ranges:[[d,u]],direction:"backward"}}else a={ranges:[[u,u]],direction:"none"}}else if(as(e)){const u=this.normalizeOffset(e[0]),d=this.normalizeOffset(e[1]);a=u<=d?{ranges:[[u,d]],direction:"none"}:{ranges:[[d,u]],direction:"backward"}}else ha(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(Na(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(Na(this.mathfield)),this.silenceNotifications))return;const e=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.onSelectionDidChange(),this.silenceNotifications=e}};function vp(e,i,r,a){const u=e.offsetOf(i);if(u<r||u>a)return!1;if(!i.hasChildren)return!0;const d=e.offsetOf(i.firstChild);if(d>=r&&d<=a){const g=e.offsetOf(i.lastChild);if(g>=r&&g<=a)return!0}return!1}function f0(e,i,r){if(!(i!=null&&i.hasChildren))return!1;const[a,u]=r,d=e.offsetOf(i.firstChild),g=e.offsetOf(i.lastChild);return d>=a&&d<=u&&g>=d&&g<=u}function ih(e,i,r,a){var u,d,g,b,x,E;const R=r.parent;if(R&&r instanceof or){const F=!a&&i==="forward"||a==="body"&&i==="backward";let Y=F?e.offsetOf(r.firstChild):e.offsetOf(r.lastChild);return F?r.rightDelim!=="?"&&r.rightDelim!=="."?(r.leftDelim=".",r.isDirty=!0):(R.addChildrenAfter(r.removeBranch("body"),r),R.removeChild(r),Y--):r.leftDelim!=="?"&&r.leftDelim!=="."?(r.rightDelim=".",r.isDirty=!0):(R.addChildrenAfter(r.removeBranch("body"),r),R.removeChild(r),Y--),e.position=Y,!0}if(R&&r.type==="surd"){if(i==="forward"&&!a||i==="backward"&&a==="body"){const F=r.leftSibling;r.hasChildren&&R.addChildrenAfter(r.removeBranch("body"),r),R.removeChild(r),e.position=e.offsetOf(F)}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),R.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(R&&(r.type==="box"||r.type==="enclose")){const F=a&&i==="backward"||!a&&i==="forward"?r.leftSibling:r.lastChild;return R.addChildrenAfter(r.removeBranch("body"),r),R.removeChild(r),e.position=e.offsetOf(F),!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 F=nh.fractionNavigationOrder==="numerator-denominator"?"above":"below",Y=F==="above"?"below":"above";if(R&&(i==="forward"&&a===F||i==="backward"&&a===Y)){const oe=r.removeBranch(F),ge=r.removeBranch(Y);return R.addChildrenAfter([...oe,...ge],r),R.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 F=i==="forward"?(g=(u=r.superscript)==null?void 0:u[0])!=null?g:(d=r.subscript)==null?void 0:d[0]:(E=(b=r.subscript)==null?void 0:b[0].lastSibling)!=null?E:(x=r.superscript)==null?void 0:x[0].lastSibling;return F&&(e.position=e.offsetOf(F)),!0}return!1}if(!r.hasChildren&&r.type==="subsup"){const F=i==="forward"?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);return r.parent.removeChild(r),e.position=F,!0}if(a==="superscript")if(i==="backward"){const F=e.offsetOf(r.firstChild)-1;console.assert(F>=0),e.position=F}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 F=i==="forward"?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);r.parent.removeChild(r),e.position=F}return!0}if((R==null?void 0:R.type)==="genfrac"&&!a&&r.type!=="first"){let F=e.offsetOf(r.leftSibling);return R.removeChild(r),R.hasEmptyBranch("above")&&R.hasEmptyBranch("below")?(F=e.offsetOf(R.leftSibling),R.parent.removeChild(R),e.announce("delete",void 0,[R]),e.position=F,!0):(e.announce("delete",void 0,[r]),e.position=F,!0)}if(i==="backward"&&((R==null?void 0:R.command)==="\\ln"||(R==null?void 0:R.command)==="\\log")&&r.parentBranch!=="body"){const F=e.offsetOf(R.leftSibling);return R.parent.removeChild(R),e.announce("delete",void 0,[R]),e.position=F,!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&&ih(e,"backward",i))){if(i!=null&&i.isFirstSibling){if(ih(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])}}):Ka(e,Fr(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&&ih(e,"forward",a))return;if(a){if(e.at(e.position).isLastSibling&&ih(e,"forward",a.parent,a.parentBranch))return}else{if(a=e.at(e.position),a.isLastSibling&&ih(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])}):Ka(e,Fr(e.selection),"deleteContentForward")}function Ka(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 d=a[a.length-1].parent.lastChild;let g=a[0];g.type==="first"&&(g=g.rightSibling);const b=a[a.length-1];if(g===u&&b===d){const x=a[0].parent;x.parent&&x.type!=="prompt"&&(i=[e.offsetOf(x.leftSibling),e.offsetOf(x)])}if(a.length===1&&a[0].type==="placeholder"&&a[0].parent.type==="genfrac"){const x=a[0].parent,E=a[0].parentBranch==="below"?"above":"below",R=e.offsetOf(x.leftSibling);return e.deferNotifications({content:!0,selection:!0,type:r},()=>{var F,Y;const oe=x.removeBranch(E);if(oe.length===1&&oe[0].type==="placeholder")(Y=x.parent)==null||Y.removeChild(x),e.position=Math.max(0,R);else{const ge=x.parent.addChildrenAfter(oe,x);(F=x.parent)==null||F.removeChild(x),e.position=e.offsetOf(ge)}})}}return e.deferNotifications({content:!0,selection:!0,type:r},()=>e.deleteAtoms(i))}Cs({deleteAll:e=>e.contentWillChange({inputType:"deleteContent"})&&Ka(e,[0,-1],"deleteContent"),deleteForward:e=>v1(e),deleteBackward:e=>_1(e),deleteNextWord:e=>e.contentWillChange({inputType:"deleteWordForward"})&&Ka(e,[e.anchor,Ud(e,e.position,"forward")],"deleteWordForward"),deletePreviousWord:e=>e.contentWillChange({inputType:"deleteWordBackward"})&&Ka(e,[e.anchor,Ud(e,e.position,"backward")],"deleteWordBackward"),deleteToGroupStart:e=>e.contentWillChange({inputType:"deleteSoftLineBackward"})&&Ka(e,[e.anchor,e.offsetOf(e.at(e.position).firstSibling)],"deleteSoftLineBackward"),deleteToGroupEnd:e=>e.contentWillChange({inputType:"deleteSoftLineForward"})&&Ka(e,[e.anchor,e.offsetOf(e.at(e.position).lastSibling)],"deleteSoftLineForward"),deleteToMathFieldStart:e=>e.contentWillChange({inputType:"deleteHardLineBackward"})&&Ka(e,[e.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:e=>e.contentWillChange({inputType:"deleteHardLineForward"})&&Ka(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({},If()),{macros:Nt(),registers:bl()}),Rf(i)),this.eventController=new AbortController;const d=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 g=(a=(r=i.value)!=null?r:this.element.textContent)!=null?a:"";g=g.trim();const b=R0(this.options),x=new dt({type:"root",mode:b,body:Zr(g,{context:this.context})});this.model=new g1(this,b,x),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(E0(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=N.subscribe(()=>N.update(this.element)),N.update(this.element),this.field=this.element.querySelector("[part=content]"),this.field.addEventListener("click",F=>F.stopImmediatePropagation(),{capture:!1,signal:d}),this.field.addEventListener("wheel",this,{passive:!1,signal:d}),"PointerEvent"in window?this.field.addEventListener("pointerdown",this,{signal:d}):this.field.addEventListener("mousedown",this,{signal:d}),(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(Na(this)))},{signal:d}),this._menu=new Mg(o1(this),{host:this.host}),this.field.addEventListener("contextmenu",this,{signal:d});const R=this.element.querySelector("[part=menu-toggle]");R==null||R.addEventListener("pointerdown",F=>{if(F.currentTarget!==R||this._menu.state!=="closed")return;this.element.classList.add("tracking");const Y=R.getBoundingClientRect();this._menu.modifiers=Ht(F),this._menu.show({target:R,location:{x:Y.left,y:Y.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),F.preventDefault(),F.stopPropagation()},{signal:d}),(this.model.atoms.length<=1||this.disabled||this.readOnly&&!this.hasEditableContent||this.userSelect==="none")&&(R.style.display="none"),this.ariaLiveText=this.element.querySelector("[role=status]"),this.keyboardDelegate=Zn(this.element.querySelector(".ML__keyboard-sink"),this.element,this),window.addEventListener("resize",this,{signal:d}),document.addEventListener("scroll",this,{signal:d}),this.resizeObserver=new ResizeObserver(()=>dr(this)),this.resizeObserver.observe(this.field),window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle",this,{signal:d}),nt&&!N.locale.startsWith(nt.locale)&&gi(N.locale),Bs!=="ready"&&document.fonts.ready.then(()=>Tf(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(Na(this)),Hf(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,Jd())}showMenu(e){var i,r;const a=(r=(i=e==null?void 0:e.location)!=null?i:Xs(this.field))!=null?r:void 0,u=e==null?void 0:e.modifiers,d=this.element.querySelector("[part=container]");return this._menu.show({target:d,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:ze(e)}}get backgroundColorMap(){return e=>{var i,r,a,u,d,g;return(g=(d=(r=(i=this.options).backgroundColorMap)==null?void 0:r.call(i,e))!=null?d:(u=(a=this.options).colorMap)==null?void 0:u.call(a,e))!=null?g: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=dt.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=jd(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 x of Object.keys(i)){const E=this.queryStyle({[x]:i[x]});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 d=this.model.getAtoms(this.model.selection,{includeChildren:!0});let g=d.length;if(g===0)return"none";let b=0;for(const x of d){if(x.type==="first"){g-=1;continue}x.style[a]===u&&(b+=1)}return b===0?"none":b===g?"all":"some"}get keybindings(){var e,i;if(this._keybindings)return this._keybindings;const[r,a]=b0(this.options.keybindings,(e=Qt())!=null?e:yi());return((i=Qt())==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),Rf(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=dt.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==a)&&Hn.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)&&dr(this)}getOptions(e){return zl(this.options,e)}getOption(e){return zl(this.options,e)}handleEvent(e){return Yo(this,null,function*(){var i;if(da(this)){if(Bd(e)){if(!Mc(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(Cu(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"&&j0(this,e);break;case"pointerdown":this.userSelect!=="none"&&(j0(this,e),e.shiftKey===!1&&(yield op(e,this.element.querySelector("[part=container]"),this._menu))&&Uf.stop());break;case"contextmenu":this.userSelect!=="none"&&e.shiftKey===!1&&(yield op(e,this.element.querySelector("[part=container]"),this._menu))&&Uf.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&Hf(this);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>da(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>da(this)&&this.onGeometryChange());break;case"wheel":this.onWheel(e);break;default:console.warn("Unexpected event type",e.type)}}})}dispose(){if(!da(this))return;N.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(),lm(),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 Cu(e)==="virtual-keyboard"?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame(()=>window.mathVirtualKeyboard.update(Na(this))),!1):mm(this,e)}get errors(){return ff(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=Ts(this.model,this.model.position))!=null?r:"math");const a=this.undoManager.canUndo();Hn.insert(this.model,e,i)&&(dr(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&&Kl(this,{interactive:!0});const i=this.field.getBoundingClientRect();let r=null;if(this.model.selectionIsCollapsed)r=Xs(this.field);else{const a=Cc(this);if(a.length>0){let u=-1/0,d=-1/0;for(const g of a)g.right>u&&(u=g.right),g.top<d&&(d=g.top);r={x:u+i.left-this.field.scrollLeft,y:d+i.top-this.field.scrollTop,height:0}}}if(this.host&&r){const a=this.host.getBoundingClientRect(),u=r.y;let d=this.host.scrollTop;u<a.top?d=u-a.top+this.host.scrollTop:u>a.bottom&&(d=u-a.bottom+this.host.scrollTop+r.height),this.host.scroll({top:d,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&&X()&&navigator.vibrate(k0),window.MathfieldElement.playSound("keypress")),e==="\\\\"?I0(this.model):e==="&"?P0(this.model):this.model.selectionIsCollapsed?Hn.insert(this.model,e,P({style:this.model.at(this.model.position).computedStyle},i)):Hn.insert(this.model,e,i),this.snapshot(`insert-${this.model.at(this.model.position).type}`),dr(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 d=this.model.mode,{model:g}=this;g.deferNotifications({content:!!r||!!i,selection:!0,type:"insertText"},()=>{let b=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),i&&e!=="latex"){const x=Zr(i,{context:this.context,parseMode:e});g.collapseSelection("forward");const E=g.at(g.position);g.position=g.offsetOf(E.parent.addChildrenAfter(x,E)),b=!0}if(this.model.mode=e,e==="latex"){let x=g.selectionIsCollapsed;_o(this,"accept");let E,R=g.at(g.position);if(x)E="\\";else{const Y=Fr(g.selection);E=this.model.getValue(Y,"latex");const oe=this.model.extractAtoms(Y);oe.length===1&&oe[0].type==="placeholder"&&(E=i,x=!0),R=g.at(Y[0])}const F=new Rl(E);R.parent.addChildAfter(F,R),x?g.position=g.offsetOf(F.lastChild):g.setSelection(g.offsetOf(F.firstChild),g.offsetOf(F.lastChild))}else Xr(g).forEach(x=>{x.isError=!1});if(r){const x=Zr(r,{context:this.context,parseMode:d});g.collapseSelection("forward");const E=g.at(g.position);g.position=g.offsetOf(E.parent.addChildrenAfter(x,E)),b=!0}return dr(this),this.undoManager.snapshot(e==="latex"?"insert-latex":"insert"),b}),this.model.mode=e,window.mathVirtualKeyboard.update(Na(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};as(i)?u.range=i:(i.operation==="toggle"&&(u.operation="toggle"),u.range=i.range,u.silenceNotifications=(r=i.silenceNotifications)!=null?r:!1);const d=jd(this,e),g=(a=u.operation)!=null?a:"set";if(u.range===void 0&&this.model.selectionIsCollapsed){if(g==="set"){this.defaultStyle=P(P({},this.defaultStyle),d);return}const b=P({},this.defaultStyle);for(const x of Object.keys(d))b[x]===d[x]?(x==="color"&&delete b.verbatimColor,x==="backgroundColor"&&delete b.verbatimBackgroundColor,delete b[x]):b[x]=d[x];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)$d(this.model,b,d,{operation:g});else $d(this.model,u.range,d,{operation:g})}),dr(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=Xs(this.field);return e?{x:e.x,y:e.y}:null}setCaretPoint(e,i){const r=Xc(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),dr(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()),dr(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),dr(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(Na(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(Na(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(Na(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:R0(this.options);this.model.mode!==u&&(this.model.mode==="latex"?(_o(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(Na(this)),Hf(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(),Kl(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="",yo(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})),dr(this),this.focusBlurInProgress=!1,Jd();const a=new AbortController,u=a.signal;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&document.addEventListener("visibilitychange",()=>{da(this)&&document.visibilityState==="visible"&&this.focus({preventScroll:!0})},{once:!0,signal:u})},{once:!0,signal:u}),setTimeout(()=>a.abort(),100)}onInput(e){Gd(this,e)}onKeystroke(e){return G0(this,e)}onCompositionStart(e){this.model.deleteAtoms(Fr(this.model.selection));const i=Xs(this.field);i&&requestAnimationFrame(()=>{Kl(this),this.keyboardDelegate.moveTo(i.x,i.y-i.height)})}onCompositionUpdate(e){Bm(this.model,e),dr(this)}onCompositionEnd(e){Nm(this.model),Gd(this,e,{simulateKeystroke:!0})}onCut(e){if(!this.isSelectionEditable){this.model.announce("plonk");return}this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),Hn.onCopy(this,e),Ka(this.model,Fr(this.model.selection),"deleteByCut"),this.snapshot("cut"),dr(this))}onCopy(e){Hn.onCopy(this,e)}onPaste(e){let i=this.isSelectionEditable;return i&&(i=Hn.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(),Nl(this),Hf(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=>st(r,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};function yp(e){if(e&&(e.classList.remove("ML__highlight"),e.children))for(const i of e.children)yp(i)}function d0(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&&d0(a)})):(e.classList.remove("ML__highlight"),e.children&&e.children.length>0&&[...e.children].forEach(a=>{a instanceof HTMLElement&&d0(a,i)})))}function w1(e,i){var r;if(!M())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"]};Zo().readAloudElement=e,a.synthesizeSpeech(u,(d,g)=>{if(d){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${d}`);return}if(!(g!=null&&g.AudioStream)){console.log("polly.synthesizeSpeech():",g);return}const b=new TextDecoder("utf-8").decode(new Uint8Array(g.AudioStream));Zo().readAloudMarks=b.split(`
|
|
|
`).map(x=>x?JSON.parse(x):{}),Zo().readAloudTokens=[];for(const x of Zo().readAloudMarks)x.value&&Zo().readAloudTokens.push(x.value);Zo().readAloudCurrentMark="",u.OutputFormat="mp3",u.SpeechMarkTypes=[],a.synthesizeSpeech(u,(x,E)=>{if(x){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech("${i}") error:${x}`);return}if(!(E!=null&&E.AudioStream))return;const R=new Uint8Array(E.AudioStream),F=new Blob([R.buffer],{type:"audio/mpeg"}),Y=URL.createObjectURL(F),oe=Zo();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?(Kl(ge),oe.readAloudElement=null,oe.readAloudMathfield=null,oe.readAloudTokens=[],oe.readAloudMarks=[],oe.readAloudCurrentMark=""):yp(oe.readAloudElement)}),oe.readAloudAudio.addEventListener("timeupdate",()=>{let ge="";const He=oe.readAloudAudio.currentTime*1e3+100;for(const Ot of oe.readAloudMarks)Ot.time<He&&(ge=Ot.value);oe.readAloudCurrentMark!==ge&&(oe.readAloudCurrentToken=ge,ge&&ge===oe.readAloudFinalToken?oe.readAloudAudio.pause():(oe.readAloudCurrentMark=ge,d0(oe.readAloudElement,oe.readAloudCurrentMark)))})),oe.readAloudAudio.src=Y,oe.readAloudStatus="playing",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),oe.readAloudAudio.play()})})}M()||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 gn=new WeakMap,S1=.5,qo={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 = ..."},Hr=class Yl extends HTMLElement{static get formAssociated(){return Uu()}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,hm())}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 N.locale}static set locale(i){i==="auto"&&(i=navigator.language.slice(0,5)),N.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 N.strings}static set strings(i){N.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 Yo(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 d=yield(yield fetch(yield S0(`${a}/${r}`))).arrayBuffer(),g=yield this.audioContext.decodeAudioData(d);this.audioBuffers[i]=g}catch(u){}})}static playSound(i){return Yo(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(qo[a])if(qo[a].startsWith("mf."))if(qo[a].startsWith(`mf.${a}`))r.push(`Option \`${a}\` cannot be used as a constructor option. Use ${qo[a]}`);else{const u=qo[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 ${qo[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(Uu()&&(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=[Ko("core"),Ko("mathfield"),Ko("mathfield-element"),Ko("ui"),Ko("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>"+po("core")+po("mathfield")+po("mathfield-element")+po("ui")+po("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):gn.has(this)?P({},zl(P(P({},If()),Rf(gn.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):gn.has(this)?zl(P(P({},If()),Rf(gn.get(this).options)),i):null}reflectAttributes(){const i=If(),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(gn.has(this)){const r=P(P({},gn.get(this).options),i);gn.set(this,f(P({},gn.get(this)),{selection:{ranges:r.readOnly?[[0,0]]:[[0,-1]]},options:r}))}else gn.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))qo[r]&&console.warn(`\`mf.setOptions({${r}:...})\` -> ${qo[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,d;if(this._mathfield)return this._mathfield.model.getValue(i,r,a);if(gn.has(this)){let g,b,x;if(ha(i)?([g,b]=i.ranges[0],x=r):as(i)?([g,b]=i,x=r):Ar(i)&&Ar(r)?(g=i,b=r,x=a):(g=0,b=-1,x=i),(x===void 0||x==="latex")&&g===0&&b===-1)return(d=(u=gn.get(this).value)!=null?u:this.textContent)!=null?d:""}return""}setValue(i,r){if(this._mathfield&&i!==void 0){r!=null||(r={silenceNotifications:!0,mode:"math"}),this._mathfield.setValue(i,r);return}if(gn.has(this)){const u=gn.get(this).options;gn.set(this,{value:i,selection:{ranges:[[-1,-1]],direction:"forward"},options:u,menuItems:void 0});return}const a=rh(this);gn.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?Xc(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=Ls(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,d;un.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"&&((d=this._mathfield)==null||d.blur()))}connectedCallback(){var i,r,a,u;const d=window.getComputedStyle(this),g=this.shadowRoot,b=d.userSelect!=="none";if(b)g.host.addEventListener("pointerdown",this,!0);else{const R=g.querySelector("span");R.style.pointerEvents="none"}g.host.addEventListener("focus",this,!0),g.host.addEventListener("blur",this,!0),Uu()||(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 x=g.querySelector("slot:not([name])");if(x)try{this._style=x.assignedElements().filter(R=>R.tagName.toLowerCase()==="style").map(R=>R.textContent).join("")}catch(R){console.error(R)}if(this._style){const R=document.createElement("style");R.textContent=this._style,g.appendChild(R)}let E="";if(this.hasAttribute("value")?E=this.getAttribute("value"):E=(i=x==null?void 0:x.assignedNodes().map(R=>R.nodeType===3?R.textContent:"").join("").trim())!=null?i:"",this._mathfield=new x1(g.querySelector(":host > span"),f(P({},(a=(r=gn.get(this))==null?void 0:r.options)!=null?a:rh(this)),{eventSink:this,value:E})),!gn.has(this)){this.upgradeProperty("disabled"),this.upgradeProperty("readonly");for(const R of Object.keys(Yl.optionsAttributes))this.upgradeProperty(xo(R))}if(!((u=this._mathfield)!=null&&u.model)){this._mathfield=null;return}if(gn.has(this)){const R=this._mathfield,F=gn.get(this),Y=F.menuItems;R.model.deferNotifications({content:!1,selection:!1},()=>{const oe=F.value;oe!==void 0&&R.setValue(oe),R.model.selection=F.selection,gn.delete(this)}),Y&&(this.menuItems=Y)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),Af()}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)));gn.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":dr(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",""),Uu()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(Uu()?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"),Uu()?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=gn.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}gn.has(this)?gn.set(this,f(P({},gn.get(this)),{menuItems:i})):gn.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:rh(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:gn.has(this)?gn.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,dr(this._mathfield);return}if(gn.has(this)){gn.set(this,f(P({},gn.get(this)),{selection:i}));return}gn.set(this,{value:void 0,selection:i,options:rh(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:gn.has(this)?gn.get(this).selection.ranges[0][0]:0}set position(i){if(this._mathfield&&(this._mathfield.model.position=i,dr(this._mathfield)),gn.has(this)){gn.set(this,f(P({},gn.get(this)),{selection:{ranges:[[i,i]]}}));return}gn.set(this,{value:void 0,selection:{ranges:[[i,i]]},options:rh(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}};Hr.version="0.98.5",Hr._fontsDirectory="./fonts",Hr._soundsDirectory="./sounds",Hr.keypressVibration=!0,Hr._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},Hr._plonkSound="plonk.wav",Hr.audioBuffers={},Hr.createHTML=e=>e,Hr._speechEngineRate="100%",Hr._speechEngineVoice="Joanna",Hr._textToSpeechMarkup="",Hr._textToSpeechRules="mathlive",Hr._textToSpeechRulesOptions={},Hr.speakHook=f1,Hr.readAloudHook=w1,Hr._decimalSeparator=".",Hr.fractionNavigationOrder="numerator-denominator",Hr._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 nh=Hr;function xo(e){return e.replace(/[^a-zA-Z\d]+(.)/g,(i,r)=>r.toUpperCase())}function rh(e){const i={readOnly:!1},r=nh.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 Uu(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var bp=nh,xp,wp,Sp,Ep;if(M()&&!((xp=window.customElements)!=null&&xp.get("math-field"))){(Sp=window[wp=Symbol.for("io.cortexjs.mathlive")])!=null||(window[wp]={});const e=window[Symbol.for("io.cortexjs.mathlive")];e.version="0.98.5",window.MathfieldElement=nh,(Ep=window.customElements)==null||Ep.define("math-field",nh)}function E1(e,i,r){let a=r,u=0;const d=e.length;for(;a<i.length;){const g=i[a];if(u<=0&&i.slice(a,a+d)===e)return a;g==="\\"?a++:g==="{"?u++:g==="}"&&u--,a++}return-1}function Yf(e,i,r,a,u="latex"){const d=[];for(const g of e)if(g.type==="text"){const b=g.data;let x=!0,E=0,R;R=b.indexOf(i),R!==-1&&(E=R,E>0&&d.push({type:"text",data:b.slice(0,E)}),x=!1);let F=!1;for(;!F;){if(x){if(R=b.indexOf(i,E),R===-1){F=!0;break}E!==R&&d.push({type:"text",data:b.slice(E,R)}),E=R}else{if(R=E1(r,b,E+i.length),R===-1){F=!0;break}let Y=b.slice(E+i.length,R);u==="ascii-math"&&([,Y]=fa(Y,{format:"ascii-math"})),d.push({type:"math",data:Y,rawData:b.slice(E,R+r.length),mathstyle:a}),E=R+r.length}x=!x}E<b.length&&d.push({type:"text",data:b.slice(E)})}else d.push(g);return d}function kp(e,i,r){let a=[{type:"text",data:e}];return i!=null&&i.inline&&i.inline.forEach(([u,d])=>{a=Yf(a,u,d,"textstyle")}),i!=null&&i.display&&i.display.forEach(([u,d])=>{a=Yf(a,u,d,"displaystyle")}),r!=null&&r.inline&&r.inline.forEach(([u,d])=>{a=Yf(a,u,d,"textstyle","ascii-math")}),r!=null&&r.display&&r.display.forEach(([u,d])=>{a=Yf(a,u,d,"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 A1(e,i,r,a){try{const u=i.renderToMarkup(e,{mathstyle:r,format:"html"}),d=document.createElement("span");return d.dataset.latex=e,d.style.display=r==="displaystyle"?"flex":"inline-flex",d.setAttribute("aria-hidden","true"),d.setAttribute("translate","no"),d.innerHTML=window.MathfieldElement.createHTML(u),d}catch(u){if(console.error("Could not parse'"+e+"' with ",u),a)return document.createTextNode(e)}return null}function zu(e,i,r,a){var u;const d=A1(e,r,i||"textstyle",a),g=(u=r.renderAccessibleContent)!=null?u:"";if(d&&/\b(mathml|speakable-text)\b/i.test(g)){const b=document.createElement("span");if(/\bmathml\b/i.test(g)&&r.renderToMathML&&b.append(k1(e,r)),/\bspeakable-text\b/i.test(g)&&r.renderToSpeakableText){const x=document.createElement("span");x.setAttribute("translate","no");const E=r.renderToSpeakableText(e);x.innerHTML=window.MathfieldElement.createHTML(E),x.className="ML__sr-only",b.append(x)}return b.append(d),b}return d}function T1(e,i){var r,a,u;let d=null;if((r=i.TeX)!=null&&r.processEnvironments&&/^\s*\\begin/.test(e)){d=document.createDocumentFragment();const g=zu(e,"",i,!0);g&&d.appendChild(g)}else{if(!e.trim())return null;const g=kp(e,(a=i.TeX)==null?void 0:a.delimiters,(u=i.asciiMath)==null?void 0:u.delimiters);if(g.length===1&&g[0].type==="text")return null;d=document.createDocumentFragment();for(const b of g)if(b.type==="text")d.appendChild(document.createTextNode(b.data));else{const x=zu(b.data,b.mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);x&&d.appendChild(x)}}return d}function Ap(e,i){var r,a,u,d,g,b,x,E,R,F,Y,oe,ge,He,Ot,Ve;if(e.childNodes.length===1&&e.childNodes[0].nodeType===3){const wt=(r=e.childNodes[0].textContent)!=null?r:"";if((a=i.TeX)!=null&&a.processEnvironments&&/^\s*\\begin/.test(wt)){e.textContent="";const At=zu(wt,"",i,!0);At&&e.append(At);return}const $t=kp(wt,(u=i.TeX)==null?void 0:u.delimiters,(d=i.asciiMath)==null?void 0:d.delimiters);if($t.length===1&&$t[0].type==="math"){e.textContent="";const At=zu($t[0].data,$t[0].mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);At&&e.append(At);return}if($t.length===1&&$t[0].type==="text")return}for(let wt=e.childNodes.length-1;wt>=0;wt--){const $t=e.childNodes[wt];if($t.nodeType===3){const At=T1((g=$t.textContent)!=null?g:"",i);At&&(wt+=At.childNodes.length-1,$t.replaceWith(At))}else if($t.nodeType===1){const At=$t,si=$t.nodeName.toLowerCase();if(si==="script"){const _i=$t;let ci;if((b=i.processScriptTypePattern)!=null&&b.test(_i.type))ci=(x=_i.textContent)!=null?x:"";else if((E=i.processMathJSONScriptTypePattern)!=null&&E.test(_i.type))try{ci=(F=i.serializeToLatex)==null?void 0:F.call(i,JSON.parse((R=_i.textContent)!=null?R:""))}catch(cn){console.error(cn)}if(ci){let cn="textstyle";for(const Wt of _i.type.split(";")){const[Ns,Ua]=Wt.toLowerCase().split("=");Ns.trim()==="mode"&&(cn=Ua.trim()==="display"?"displaystyle":"textstyle")}const Fn=zu(ci,cn,i,!0);Fn&&_i.parentNode.replaceChild(Fn,_i)}}else if(((oe=(Y=i.processClassPattern)==null?void 0:Y.test(At.className))!=null?oe:!1)||!((He=(ge=i.skipTags)==null?void 0:ge.includes(si))!=null&&He||(Ve=(Ot=i.ignoreClassPattern)==null?void 0:Ot.test(At.className))!=null&&Ve))if(e.childNodes.length===1&&e.childNodes[0].nodeType===3){const ci=e.textContent;e.textContent="";const cn=zu(ci!=null?ci:"","displaystyle",i,!0);cn&&e.append(cn)}else Ap(At,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,d;try{const g=P(P({},L1),i);g.ignoreClassPattern=new RegExp((r=g.ignoreClass)!=null?r:""),g.processClassPattern=new RegExp((a=g.processClass)!=null?a:""),g.processScriptTypePattern=new RegExp((u=g.processScriptType)!=null?u:""),g.processMathJSONScriptTypePattern=new RegExp((d=g.processMathJSONScriptType)!=null?d:""),Af(),os("core"),Ap(e,g)}catch(g){g instanceof Error?console.error("renderMathInElement(): "+g.message):console.error("renderMathInElement(): Could not render math for element",e)}}function C1(e,i){const r=Wo.singleton;return r?(r.show(),Wc(),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}Cs({switchKeyboardLayer:C1,toggleVirtualKeyboard:M1,hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});function Zo(){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){I1(document.body,e)}function R1(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 I1(e,i){var r,a,u,d;const g=R1(e);if(!g)return;const b=i!=null?i:{};(r=b.renderToMarkup)!=null||(b.renderToMarkup=Br),(a=b.renderToMathML)!=null||(b.renderToMathML=Hg),(u=b.renderToSpeakableText)!=null||(b.renderToSpeakableText=Wg),(d=b.serializeToLatex)!=null||(b.serializeToLatex=jg),D1(g,b)}var $1={mathlive:"0.98.5"}}}]);
|
|
|
}()); |