|
|
!(function(){var ba=Math.pow;var Xo=(Ci,Ft,re)=>new Promise((ue,we)=>{var Ye=w=>{try{X(re.next(w))}catch(Ae){we(Ae)}},pe=w=>{try{X(re.throw(w))}catch(Ae){we(Ae)}},X=w=>w.done?ue(w.value):Promise.resolve(w.value).then(Ye,pe);X((re=re.apply(Ci,Ft)).next())});(self.webpackChunk=self.webpackChunk||[]).push([[1220],{65030:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return ti}});var ue=re(98506),we=re(16886),Ye=re(33346),pe=re(43403),X=re(92310),w=re.n(X),Ae=re(29301),P=re(76846),f=re(96452),ie=re(6089),I=re(80402),k=re(34280),T=re(49658),C=re(59301),O=re(67711),J=re(77900),H=re(8654);function j(Ce){var Be=Ce.prefixCls,me=Ce.align,Xe=Ce.arrow,at=Ce.arrowPos,Je=Xe||{},q=Je.className,ye=Je.content,Fe=at.x,Ze=Fe===void 0?0:Fe,ot=at.y,bt=ot===void 0?0:ot,qt=C.useRef();if(!me||!me.points)return null;var vt={position:"absolute"};if(me.autoArrow!==!1){var Se=me.points[0],xt=me.points[1],Wt=Se[0],Gt=Se[1],Le=xt[0],Me=xt[1];Wt===Le||!["t","b"].includes(Wt)?vt.top=bt:Wt==="t"?vt.top=0:vt.bottom=0,Gt===Me||!["l","r"].includes(Gt)?vt.left=Ze:Gt==="l"?vt.left=0:vt.right=0}return C.createElement("div",{ref:qt,className:w()("".concat(Be,"-arrow"),q),style:vt},ye)}function $(Ce){var Be=Ce.prefixCls,me=Ce.open,Xe=Ce.zIndex,at=Ce.mask,Je=Ce.motion;return at?C.createElement(J.default,(0,O.Z)({},Je,{motionAppear:!0,visible:me,removeOnLeave:!0}),function(q){var ye=q.className;return C.createElement("div",{style:{zIndex:Xe},className:w()("".concat(Be,"-mask"),ye)})}):null}var B=C.memo(function(Ce){var Be=Ce.children;return Be},function(Ce,Be){return Be.cache}),V=B,he=C.forwardRef(function(Ce,Be){var me=Ce.popup,Xe=Ce.className,at=Ce.prefixCls,Je=Ce.style,q=Ce.target,ye=Ce.onVisibleChanged,Fe=Ce.open,Ze=Ce.keepDom,ot=Ce.fresh,bt=Ce.onClick,qt=Ce.mask,vt=Ce.arrow,Se=Ce.arrowPos,xt=Ce.align,Wt=Ce.motion,Gt=Ce.maskMotion,Le=Ce.forceRender,Me=Ce.getPopupContainer,rt=Ce.autoDestroy,wt=Ce.portal,qe=Ce.zIndex,Ct=Ce.onMouseEnter,Lt=Ce.onMouseLeave,kt=Ce.onPointerEnter,Nt=Ce.onPointerDownCapture,Xt=Ce.ready,Qe=Ce.offsetX,zt=Ce.offsetY,De=Ce.offsetR,xe=Ce.offsetB,ke=Ce.onAlign,K=Ce.onPrepare,W=Ce.stretch,ae=Ce.targetWidth,ce=Ce.targetHeight,ve=typeof me=="function"?me():me,ft=Fe||Ze,yt=(Me==null?void 0:Me.length)>0,ut=C.useState(!Me||!yt),Vt=(0,we.Z)(ut,2),ii=Vt[0],mi=Vt[1];if((0,k.Z)(function(){!ii&&yt&&q&&mi(!0)},[ii,yt,q]),!ii)return null;var ni="auto",Dt={left:"-1000vw",top:"-1000vh",right:ni,bottom:ni};if(Xt||!Fe){var oi,Mi=xt.points,ki=xt.dynamicInset||((oi=xt._experimental)===null||oi===void 0?void 0:oi.dynamicInset),Bi=ki&&Mi[0][1]==="r",gi=ki&&Mi[0][0]==="b";Bi?(Dt.right=De,Dt.left=ni):(Dt.left=Qe,Dt.right=ni),gi?(Dt.bottom=xe,Dt.top=ni):(Dt.top=zt,Dt.bottom=ni)}var fi={};return W&&(W.includes("height")&&ce?fi.height=ce:W.includes("minHeight")&&ce&&(fi.minHeight=ce),W.includes("width")&&ae?fi.width=ae:W.includes("minWidth")&&ae&&(fi.minWidth=ae)),Fe||(fi.pointerEvents="none"),C.createElement(wt,{open:Le||ft,getContainer:Me&&function(){return Me(q)},autoDestroy:rt},C.createElement($,{prefixCls:at,open:Fe,zIndex:qe,mask:qt,motion:Gt}),C.createElement(Ae.Z,{onResize:ke,disabled:!Fe},function(Vi){return C.createElement(J.default,(0,O.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Le,leavedClassName:"".concat(at,"-hidden")},Wt,{onAppearPrepare:K,onEnterPrepare:K,visible:Fe,onVisibleChanged:function(en){var Yi;Wt==null||(Yi=Wt.onVisibleChanged)===null||Yi===void 0||Yi.call(Wt,en),ye(en)}}),function(ji,en){var Yi=ji.className,er=ji.style,Li=w()(at,Yi,Xe);return C.createElement("div",{ref:(0,H.sQ)(Vi,Be,en),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")},Dt),fi),er),{},{boxSizing:"border-box",zIndex:qe},Je),onMouseEnter:Ct,onMouseLeave:Lt,onPointerEnter:kt,onClick:bt,onPointerDownCapture:Nt},vt&&C.createElement(j,{prefixCls:at,arrow:vt,arrowPos:Se,align:xt}),C.createElement(V,{cache:!Fe&&!ot},ve))})}))}),be=he,Te=C.forwardRef(function(Ce,Be){var me=Ce.children,Xe=Ce.getTriggerDOMNode,at=(0,H.Yr)(me),Je=C.useCallback(function(ye){(0,H.mH)(Be,Xe?Xe(ye):ye)},[Xe]),q=(0,H.x1)(Je,(0,H.C4)(me));return at?C.cloneElement(me,{ref:q}):me}),se=Te,Ee=C.createContext(null),je=Ee;function Ke(Ce){return Ce?Array.isArray(Ce)?Ce:[Ce]:[]}function It(Ce,Be,me,Xe){return C.useMemo(function(){var at=Ke(me!=null?me:Be),Je=Ke(Xe!=null?Xe:Be),q=new Set(at),ye=new Set(Je);return Ce&&(q.has("hover")&&(q.delete("hover"),q.add("click")),ye.has("hover")&&(ye.delete("hover"),ye.add("click"))),[q,ye]},[Ce,Be,me,Xe])}var ee=re(29194);function z(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],me=arguments.length>2?arguments[2]:void 0;return me?Ce[0]===Be[0]:Ce[0]===Be[0]&&Ce[1]===Be[1]}function Z(Ce,Be,me,Xe){for(var at=me.points,Je=Object.keys(Ce),q=0;q<Je.length;q+=1){var ye,Fe=Je[q];if(z((ye=Ce[Fe])===null||ye===void 0?void 0:ye.points,at,Xe))return"".concat(Be,"-placement-").concat(Fe)}return""}function Q(Ce,Be,me,Xe){return Be||(me?{motionName:"".concat(Ce,"-").concat(me)}:Xe?{motionName:Xe}:null)}function fe(Ce){return Ce.ownerDocument.defaultView}function ne(Ce){for(var Be=[],me=Ce==null?void 0:Ce.parentElement,Xe=["hidden","scroll","clip","auto"];me;){var at=fe(me).getComputedStyle(me),Je=at.overflowX,q=at.overflowY,ye=at.overflow;[Je,q,ye].some(function(Fe){return Xe.includes(Fe)})&&Be.push(me),me=me.parentElement}return Be}function A(Ce){var Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ce)?Be:Ce}function L(Ce){return A(parseFloat(Ce),0)}function G(Ce,Be){var me=(0,ue.Z)({},Ce);return(Be||[]).forEach(function(Xe){if(!(Xe instanceof HTMLBodyElement||Xe instanceof HTMLHtmlElement)){var at=fe(Xe).getComputedStyle(Xe),Je=at.overflow,q=at.overflowClipMargin,ye=at.borderTopWidth,Fe=at.borderBottomWidth,Ze=at.borderLeftWidth,ot=at.borderRightWidth,bt=Xe.getBoundingClientRect(),qt=Xe.offsetHeight,vt=Xe.clientHeight,Se=Xe.offsetWidth,xt=Xe.clientWidth,Wt=L(ye),Gt=L(Fe),Le=L(Ze),Me=L(ot),rt=A(Math.round(bt.width/Se*1e3)/1e3),wt=A(Math.round(bt.height/qt*1e3)/1e3),qe=(Se-xt-Le-Me)*rt,Ct=(qt-vt-Wt-Gt)*wt,Lt=Wt*wt,kt=Gt*wt,Nt=Le*rt,Xt=Me*rt,Qe=0,zt=0;if(Je==="clip"){var De=L(q);Qe=De*rt,zt=De*wt}var xe=bt.x+Nt-Qe,ke=bt.y+Lt-zt,K=xe+bt.width+2*Qe-Nt-Xt-qe,W=ke+bt.height+2*zt-Lt-kt-Ct;me.left=Math.max(me.left,xe),me.top=Math.max(me.top,ke),me.right=Math.min(me.right,K),me.bottom=Math.min(me.bottom,W)}}),me}function de(Ce){var Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,me="".concat(Be),Xe=me.match(/^(.*)\%$/);return Xe?Ce*(parseFloat(Xe[1])/100):parseFloat(me)}function ze(Ce,Be){var me=Be||[],Xe=(0,we.Z)(me,2),at=Xe[0],Je=Xe[1];return[de(Ce.width,at),de(Ce.height,Je)]}function pt(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ce[0],Ce[1]]}function Ut(Ce,Be){var me=Be[0],Xe=Be[1],at,Je;return me==="t"?Je=Ce.y:me==="b"?Je=Ce.y+Ce.height:Je=Ce.y+Ce.height/2,Xe==="l"?at=Ce.x:Xe==="r"?at=Ce.x+Ce.width:at=Ce.x+Ce.width/2,{x:at,y:Je}}function Ie(Ce,Be){var me={t:"b",b:"t",l:"r",r:"l"};return Ce.map(function(Xe,at){return at===Be?me[Xe]||"c":Xe}).join("")}function Yt(Ce,Be,me,Xe,at,Je,q){var ye=C.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:at[Xe]||{}}),Fe=(0,we.Z)(ye,2),Ze=Fe[0],ot=Fe[1],bt=C.useRef(0),qt=C.useMemo(function(){return Be?ne(Be):[]},[Be]),vt=C.useRef({}),Se=function(){vt.current={}};Ce||Se();var xt=(0,ie.Z)(function(){if(Be&&me&&Ce){let gr=function(Ji,yn){var Qr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bn,ls=ft.x+Ji,Es=ft.y+yn,ta=ls+gi,Us=Es+Bi,xa=Math.max(ls,Qr.left),ci=Math.max(Es,Qr.top),Ii=Math.min(ta,Qr.right),wn=Math.min(Us,Qr.bottom);return Math.max(0,(Ii-xa)*(wn-ci))},On=function(){vn=ft.y+Di,pn=vn+Bi,cn=ft.x+Si,Kn=cn+gi};var Le,Me,rt,wt,qe=Be,Ct=qe.ownerDocument,Lt=fe(qe),kt=Lt.getComputedStyle(qe),Nt=kt.position,Xt=qe.style.left,Qe=qe.style.top,zt=qe.style.right,De=qe.style.bottom,xe=qe.style.overflow,ke=(0,ue.Z)((0,ue.Z)({},at[Xe]),Je),K=Ct.createElement("div");(Le=qe.parentElement)===null||Le===void 0||Le.appendChild(K),K.style.left="".concat(qe.offsetLeft,"px"),K.style.top="".concat(qe.offsetTop,"px"),K.style.position=Nt,K.style.height="".concat(qe.offsetHeight,"px"),K.style.width="".concat(qe.offsetWidth,"px"),qe.style.left="0",qe.style.top="0",qe.style.right="auto",qe.style.bottom="auto",qe.style.overflow="hidden";var W;if(Array.isArray(me))W={x:me[0],y:me[1],width:0,height:0};else{var ae,ce,ve=me.getBoundingClientRect();ve.x=(ae=ve.x)!==null&&ae!==void 0?ae:ve.left,ve.y=(ce=ve.y)!==null&&ce!==void 0?ce:ve.top,W={x:ve.x,y:ve.y,width:ve.width,height:ve.height}}var ft=qe.getBoundingClientRect(),yt=Lt.getComputedStyle(qe),ut=yt.height,Vt=yt.width;ft.x=(Me=ft.x)!==null&&Me!==void 0?Me:ft.left,ft.y=(rt=ft.y)!==null&&rt!==void 0?rt:ft.top;var ii=Ct.documentElement,mi=ii.clientWidth,ni=ii.clientHeight,Dt=ii.scrollWidth,oi=ii.scrollHeight,Mi=ii.scrollTop,ki=ii.scrollLeft,Bi=ft.height,gi=ft.width,fi=W.height,Vi=W.width,ji={left:0,top:0,right:mi,bottom:ni},en={left:-ki,top:-Mi,right:Dt-ki,bottom:oi-Mi},Yi=ke.htmlRegion,er="visible",Li="visibleFirst";Yi!=="scroll"&&Yi!==Li&&(Yi=er);var zi=Yi===Li,sn=G(en,qt),Pi=G(ji,qt),bn=Yi===er?Pi:sn,an=zi?Pi:bn;qe.style.left="auto",qe.style.top="auto",qe.style.right="0",qe.style.bottom="0";var sr=qe.getBoundingClientRect();qe.style.left=Xt,qe.style.top=Qe,qe.style.right=zt,qe.style.bottom=De,qe.style.overflow=xe,(wt=qe.parentElement)===null||wt===void 0||wt.removeChild(K);var xi=A(Math.round(gi/parseFloat(Vt)*1e3)/1e3),ur=A(Math.round(Bi/parseFloat(ut)*1e3)/1e3);if(xi===0||ur===0||(0,P.Sh)(me)&&!(0,ee.Z)(me))return;var jn=ke.offset,wi=ke.targetOffset,li=ze(ft,jn),Pe=(0,we.Z)(li,2),et=Pe[0],gt=Pe[1],lt=ze(W,wi),At=(0,we.Z)(lt,2),nt=At[0],dt=At[1];W.x-=nt,W.y-=dt;var Bt=ke.points||[],Zt=(0,we.Z)(Bt,2),di=Zt[0],Xi=Zt[1],_i=pt(Xi),Ai=pt(di),Oi=Ut(W,_i),Gi=Ut(ft,Ai),Wi=(0,ue.Z)({},ke),Si=Oi.x-Gi.x+et,Di=Oi.y-Gi.y+gt,on=gr(Si,Di),$i=gr(Si,Di,Pi),Ti=Ut(W,["t","l"]),Zi=Ut(ft,["t","l"]),qi=Ut(W,["b","r"]),Fi=Ut(ft,["b","r"]),un=ke.overflow||{},dn=un.adjustX,$n=un.adjustY,Ki=un.shiftX,Rn=un.shiftY,qn=function(yn){return typeof yn=="boolean"?yn:yn>=0},vn,pn,cn,Kn;On();var yr=qn($n),xn=Ai[0]===_i[0];if(yr&&Ai[0]==="t"&&(pn>an.bottom||vt.current.bt)){var Ln=Di;xn?Ln-=Bi-fi:Ln=Ti.y-Fi.y-gt;var dr=gr(Si,Ln),Rr=gr(Si,Ln,Pi);dr>on||dr===on&&(!zi||Rr>=$i)?(vt.current.bt=!0,Di=Ln,gt=-gt,Wi.points=[Ie(Ai,0),Ie(_i,0)]):vt.current.bt=!1}if(yr&&Ai[0]==="b"&&(vn<an.top||vt.current.tb)){var ar=Di;xn?ar+=Bi-fi:ar=qi.y-Zi.y-gt;var Lr=gr(Si,ar),Dn=gr(Si,ar,Pi);Lr>on||Lr===on&&(!zi||Dn>=$i)?(vt.current.tb=!0,Di=ar,gt=-gt,Wi.points=[Ie(Ai,0),Ie(_i,0)]):vt.current.tb=!1}var tr=qn(dn),Er=Ai[1]===_i[1];if(tr&&Ai[1]==="l"&&(Kn>an.right||vt.current.rl)){var kr=Si;Er?kr-=gi-Vi:kr=Ti.x-Fi.x-et;var Un=gr(kr,Di),In=gr(kr,Di,Pi);Un>on||Un===on&&(!zi||In>=$i)?(vt.current.rl=!0,Si=kr,et=-et,Wi.points=[Ie(Ai,1),Ie(_i,1)]):vt.current.rl=!1}if(tr&&Ai[1]==="r"&&(cn<an.left||vt.current.lr)){var or=Si;Er?or+=gi-Vi:or=qi.x-Zi.x-et;var cr=gr(or,Di),Ir=gr(or,Di,Pi);cr>on||cr===on&&(!zi||Ir>=$i)?(vt.current.lr=!0,Si=or,et=-et,Wi.points=[Ie(Ai,1),Ie(_i,1)]):vt.current.lr=!1}On();var si=Ki===!0?0:Ki;typeof si=="number"&&(cn<Pi.left&&(Si-=cn-Pi.left-et,W.x+Vi<Pi.left+si&&(Si+=W.x-Pi.left+Vi-si)),Kn>Pi.right&&(Si-=Kn-Pi.right-et,W.x>Pi.right-si&&(Si+=W.x-Pi.right+si)));var hr=Rn===!0?0:Rn;typeof hr=="number"&&(vn<Pi.top&&(Di-=vn-Pi.top-gt,W.y+fi<Pi.top+hr&&(Di+=W.y-Pi.top+fi-hr)),pn>Pi.bottom&&(Di-=pn-Pi.bottom-gt,W.y>Pi.bottom-hr&&(Di+=W.y-Pi.bottom+hr)));var br=ft.x+Si,lr=br+gi,Hr=ft.y+Di,tn=Hr+Bi,Ei=W.x,nn=Ei+Vi,Ri=W.y,mr=Ri+fi,Zn=Math.max(br,Ei),fr=Math.min(lr,nn),Pn=(Zn+fr)/2,os=Pn-br,Tr=Math.max(Hr,Ri),Pr=Math.min(tn,mr),Wr=(Tr+Pr)/2,jr=Wr-Hr;q==null||q(Be,Wi);var Yn=sr.right-ft.x-(Si+ft.width),qr=sr.bottom-ft.y-(Di+ft.height);xi===1&&(Si=Math.round(Si),Yn=Math.round(Yn)),ur===1&&(Di=Math.round(Di),qr=Math.round(qr));var ds={ready:!0,offsetX:Si/xi,offsetY:Di/ur,offsetR:Yn/xi,offsetB:qr/ur,arrowX:os/xi,arrowY:jr/ur,scaleX:xi,scaleY:ur,align:Wi};ot(ds)}}),Wt=function(){bt.current+=1;var Me=bt.current;Promise.resolve().then(function(){bt.current===Me&&xt()})},Gt=function(){ot(function(Me){return(0,ue.Z)((0,ue.Z)({},Me),{},{ready:!1})})};return(0,k.Z)(Gt,[Xe]),(0,k.Z)(function(){Ce||Gt()},[Ce]),[Ze.ready,Ze.offsetX,Ze.offsetY,Ze.offsetR,Ze.offsetB,Ze.arrowX,Ze.arrowY,Ze.scaleX,Ze.scaleY,Ze.align,Wt]}var Pt=re(15142);function St(Ce,Be,me,Xe,at){(0,k.Z)(function(){if(Ce&&Be&&me){let bt=function(){Xe(),at()};var Je=Be,q=me,ye=ne(Je),Fe=ne(q),Ze=fe(q),ot=new Set([Ze].concat((0,Pt.Z)(ye),(0,Pt.Z)(Fe)));return ot.forEach(function(qt){qt.addEventListener("scroll",bt,{passive:!0})}),Ze.addEventListener("resize",bt,{passive:!0}),Xe(),function(){ot.forEach(function(qt){qt.removeEventListener("scroll",bt),Ze.removeEventListener("resize",bt)})}}},[Ce,Be,me])}var $e=re(48736);function it(Ce,Be,me,Xe,at,Je,q,ye){var Fe=C.useRef(Ce);Fe.current=Ce;var Ze=C.useRef(!1);C.useEffect(function(){if(Be&&Xe&&(!at||Je)){var bt=function(){Ze.current=!1},qt=function(rt){var wt;Fe.current&&!q(((wt=rt.composedPath)===null||wt===void 0||(wt=wt.call(rt))===null||wt===void 0?void 0:wt[0])||rt.target)&&!Ze.current&&ye(!1)},vt=fe(Xe);vt.addEventListener("pointerdown",bt,!0),vt.addEventListener("mousedown",qt,!0),vt.addEventListener("contextmenu",qt,!0);var Se=(0,f.A)(me);if(Se&&(Se.addEventListener("mousedown",qt,!0),Se.addEventListener("contextmenu",qt,!0)),0)var xt,Wt,Gt,Le;return function(){vt.removeEventListener("pointerdown",bt,!0),vt.removeEventListener("mousedown",qt,!0),vt.removeEventListener("contextmenu",qt,!0),Se&&(Se.removeEventListener("mousedown",qt,!0),Se.removeEventListener("contextmenu",qt,!0))}}},[Be,me,Xe,at,Je]);function ot(){Ze.current=!0}return ot}var mt=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function ht(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pe.Z,Be=C.forwardRef(function(me,Xe){var at=me.prefixCls,Je=at===void 0?"rc-trigger-popup":at,q=me.children,ye=me.action,Fe=ye===void 0?"hover":ye,Ze=me.showAction,ot=me.hideAction,bt=me.popupVisible,qt=me.defaultPopupVisible,vt=me.onPopupVisibleChange,Se=me.afterPopupVisibleChange,xt=me.mouseEnterDelay,Wt=me.mouseLeaveDelay,Gt=Wt===void 0?.1:Wt,Le=me.focusDelay,Me=me.blurDelay,rt=me.mask,wt=me.maskClosable,qe=wt===void 0?!0:wt,Ct=me.getPopupContainer,Lt=me.forceRender,kt=me.autoDestroy,Nt=me.destroyPopupOnHide,Xt=me.popup,Qe=me.popupClassName,zt=me.popupStyle,De=me.popupPlacement,xe=me.builtinPlacements,ke=xe===void 0?{}:xe,K=me.popupAlign,W=me.zIndex,ae=me.stretch,ce=me.getPopupClassNameFromAlign,ve=me.fresh,ft=me.alignPoint,yt=me.onPopupClick,ut=me.onPopupAlign,Vt=me.arrow,ii=me.popupMotion,mi=me.maskMotion,ni=me.popupTransitionName,Dt=me.popupAnimation,oi=me.maskTransitionName,Mi=me.maskAnimation,ki=me.className,Bi=me.getTriggerDOMNode,gi=(0,Ye.Z)(me,mt),fi=kt||Nt||!1,Vi=C.useState(!1),ji=(0,we.Z)(Vi,2),en=ji[0],Yi=ji[1];(0,k.Z)(function(){Yi((0,T.Z)())},[]);var er=C.useRef({}),Li=C.useContext(je),zi=C.useMemo(function(){return{registerSubPopup:function(Ii,wn){er.current[Ii]=wn,Li==null||Li.registerSubPopup(Ii,wn)}}},[Li]),sn=(0,I.Z)(),Pi=C.useState(null),bn=(0,we.Z)(Pi,2),an=bn[0],sr=bn[1],xi=C.useRef(null),ur=(0,ie.Z)(function(ci){xi.current=ci,(0,P.Sh)(ci)&&an!==ci&&sr(ci),Li==null||Li.registerSubPopup(sn,ci)}),jn=C.useState(null),wi=(0,we.Z)(jn,2),li=wi[0],Pe=wi[1],et=C.useRef(null),gt=(0,ie.Z)(function(ci){(0,P.Sh)(ci)&&li!==ci&&(Pe(ci),et.current=ci)}),lt=C.Children.only(q),At=(lt==null?void 0:lt.props)||{},nt={},dt=(0,ie.Z)(function(ci){var Ii,wn,Gn=li;return(Gn==null?void 0:Gn.contains(ci))||((Ii=(0,f.A)(Gn))===null||Ii===void 0?void 0:Ii.host)===ci||ci===Gn||(an==null?void 0:an.contains(ci))||((wn=(0,f.A)(an))===null||wn===void 0?void 0:wn.host)===ci||ci===an||Object.values(er.current).some(function(Sn){return(Sn==null?void 0:Sn.contains(ci))||ci===Sn})}),Bt=Q(Je,ii,Dt,ni),Zt=Q(Je,mi,Mi,oi),di=C.useState(qt||!1),Xi=(0,we.Z)(di,2),_i=Xi[0],Ai=Xi[1],Oi=bt!=null?bt:_i,Gi=(0,ie.Z)(function(ci){bt===void 0&&Ai(ci)});(0,k.Z)(function(){Ai(bt||!1)},[bt]);var Wi=C.useRef(Oi);Wi.current=Oi;var Si=C.useRef([]);Si.current=[];var Di=(0,ie.Z)(function(ci){var Ii;Gi(ci),((Ii=Si.current[Si.current.length-1])!==null&&Ii!==void 0?Ii:Oi)!==ci&&(Si.current.push(ci),vt==null||vt(ci))}),on=C.useRef(),$i=function(){clearTimeout(on.current)},Ti=function(Ii){var wn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;$i(),wn===0?Di(Ii):on.current=setTimeout(function(){Di(Ii)},wn*1e3)};C.useEffect(function(){return $i},[]);var Zi=C.useState(!1),qi=(0,we.Z)(Zi,2),Fi=qi[0],un=qi[1];(0,k.Z)(function(ci){(!ci||Oi)&&un(!0)},[Oi]);var dn=C.useState(null),$n=(0,we.Z)(dn,2),Ki=$n[0],Rn=$n[1],qn=C.useState(null),vn=(0,we.Z)(qn,2),pn=vn[0],cn=vn[1],Kn=function(Ii){cn([Ii.clientX,Ii.clientY])},yr=Yt(Oi,an,ft&&pn!==null?pn:li,De,ke,K,ut),xn=(0,we.Z)(yr,11),Ln=xn[0],dr=xn[1],Rr=xn[2],ar=xn[3],Lr=xn[4],Dn=xn[5],tr=xn[6],Er=xn[7],kr=xn[8],Un=xn[9],In=xn[10],or=It(en,Fe,Ze,ot),cr=(0,we.Z)(or,2),Ir=cr[0],si=cr[1],hr=Ir.has("click"),br=si.has("click")||si.has("contextMenu"),lr=(0,ie.Z)(function(){Fi||In()}),Hr=function(){Wi.current&&ft&&br&&Ti(!1)};St(Oi,li,an,lr,Hr),(0,k.Z)(function(){lr()},[pn,De]),(0,k.Z)(function(){Oi&&!(ke!=null&&ke[De])&&lr()},[JSON.stringify(K)]);var tn=C.useMemo(function(){var ci=Z(ke,Je,Un,ft);return w()(ci,ce==null?void 0:ce(Un))},[Un,ce,ke,Je,ft]);C.useImperativeHandle(Xe,function(){return{nativeElement:et.current,popupElement:xi.current,forceAlign:lr}});var Ei=C.useState(0),nn=(0,we.Z)(Ei,2),Ri=nn[0],mr=nn[1],Zn=C.useState(0),fr=(0,we.Z)(Zn,2),Pn=fr[0],os=fr[1],Tr=function(){if(ae&&li){var Ii=li.getBoundingClientRect();mr(Ii.width),os(Ii.height)}},Pr=function(){Tr(),lr()},Wr=function(Ii){un(!1),In(),Se==null||Se(Ii)},jr=function(){return new Promise(function(Ii){Tr(),Rn(function(){return Ii})})};(0,k.Z)(function(){Ki&&(In(),Ki(),Rn(null))},[Ki]);function Yn(ci,Ii,wn,Gn){nt[ci]=function(Sn){var es;Gn==null||Gn(Sn),Ti(Ii,wn);for(var ir=arguments.length,ks=new Array(ir>1?ir-1:0),Zr=1;Zr<ir;Zr++)ks[Zr-1]=arguments[Zr];(es=At[ci])===null||es===void 0||es.call.apply(es,[At,Sn].concat(ks))}}(hr||br)&&(nt.onClick=function(ci){var Ii;Wi.current&&br?Ti(!1):!Wi.current&&hr&&(Kn(ci),Ti(!0));for(var wn=arguments.length,Gn=new Array(wn>1?wn-1:0),Sn=1;Sn<wn;Sn++)Gn[Sn-1]=arguments[Sn];(Ii=At.onClick)===null||Ii===void 0||Ii.call.apply(Ii,[At,ci].concat(Gn))});var qr=it(Oi,br,li,an,rt,qe,dt,Ti),ds=Ir.has("hover"),gr=si.has("hover"),On,Ji;ds&&(Yn("onMouseEnter",!0,xt,function(ci){Kn(ci)}),Yn("onPointerEnter",!0,xt,function(ci){Kn(ci)}),On=function(Ii){(Oi||Fi)&&an!==null&&an!==void 0&&an.contains(Ii.target)&&Ti(!0,xt)},ft&&(nt.onMouseMove=function(ci){var Ii;(Ii=At.onMouseMove)===null||Ii===void 0||Ii.call(At,ci)})),gr&&(Yn("onMouseLeave",!1,Gt),Yn("onPointerLeave",!1,Gt),Ji=function(){Ti(!1,Gt)}),Ir.has("focus")&&Yn("onFocus",!0,Le),si.has("focus")&&Yn("onBlur",!1,Me),Ir.has("contextMenu")&&(nt.onContextMenu=function(ci){var Ii;Wi.current&&si.has("contextMenu")?Ti(!1):(Kn(ci),Ti(!0)),ci.preventDefault();for(var wn=arguments.length,Gn=new Array(wn>1?wn-1:0),Sn=1;Sn<wn;Sn++)Gn[Sn-1]=arguments[Sn];(Ii=At.onContextMenu)===null||Ii===void 0||Ii.call.apply(Ii,[At,ci].concat(Gn))}),ki&&(nt.className=w()(At.className,ki));var yn=C.useRef(!1);yn.current||(yn.current=Lt||Oi||Fi);var Qr=(0,ue.Z)((0,ue.Z)({},At),nt),ls={},Es=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Es.forEach(function(ci){gi[ci]&&(ls[ci]=function(){for(var Ii,wn=arguments.length,Gn=new Array(wn),Sn=0;Sn<wn;Sn++)Gn[Sn]=arguments[Sn];(Ii=Qr[ci])===null||Ii===void 0||Ii.call.apply(Ii,[Qr].concat(Gn)),gi[ci].apply(gi,Gn)})});var ta=C.cloneElement(lt,(0,ue.Z)((0,ue.Z)({},Qr),ls)),Us={x:Dn,y:tr},xa=Vt?(0,ue.Z)({},Vt!==!0?Vt:{}):null;return C.createElement(C.Fragment,null,C.createElement(Ae.Z,{disabled:!Oi,ref:gt,onResize:Pr},C.createElement(se,{getTriggerDOMNode:Bi},ta)),yn.current&&C.createElement(je.Provider,{value:zi},C.createElement(be,{portal:Ce,ref:ur,prefixCls:Je,popup:Xt,className:w()(Qe,tn),style:zt,target:li,onMouseEnter:On,onMouseLeave:Ji,onPointerEnter:On,zIndex:W,open:Oi,keepDom:Fi,fresh:ve,onClick:yt,onPointerDownCapture:qr,mask:rt,motion:Bt,maskMotion:Zt,onVisibleChanged:Wr,onPrepare:jr,forceRender:Lt,autoDestroy:fi,getPopupContainer:Ct,align:Un,arrow:xa,arrowPos:Us,ready:Ln,offsetX:dr,offsetY:Rr,offsetR:ar,offsetB:Lr,onAlign:lr,stretch:ae,targetWidth:Ri/Er,targetHeight:Pn/kr})))});return Be}var ti=ht(pe.Z)},64018:function(){var Ci,Ft,re,ue=!1,we,Ye;window.PR_SHOULD_USE_CONTINUATION=!0;var pe,X;(function(){var w=window,Ae=["break,continue,do,else,for,if,return,while"],P=[Ae,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],f=[P,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],ie=[f,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],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",C=[f,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],O="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",J=[Ae,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],H=[Ae,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],j=[Ae,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],$=[ie,k,I,C,O,J,H,j],B=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,V="str",he="kwd",be="com",Te="typ",se="lit",Ee="pun",je="pln",Ke="tag",It="dec",ee="src",z="atn",Z="atv",Q="nocode",fe="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function ne(Be){for(var me=0,Xe=!1,at=!1,Je=0,q=Be.length;Je<q;++Je){var ye=Be[Je];if(ye.ignoreCase)at=!0;else if(/[a-z]/i.test(ye.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Xe=!0,at=!1;break}}var Fe={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(Se){var xt=Se.charCodeAt(0);if(xt!==92)return xt;var Wt=Se.charAt(1);return xt=Fe[Wt],xt||("0"<=Wt&&Wt<="7"?parseInt(Se.substring(1),8):Wt==="u"||Wt==="x"?parseInt(Se.substring(2),16):Se.charCodeAt(1))}function ot(Se){if(Se<32)return(Se<16?"\\x0":"\\x")+Se.toString(16);var xt=String.fromCharCode(Se);return xt==="\\"||xt==="-"||xt==="]"||xt==="^"?"\\"+xt:xt}function bt(Se){var xt=Se.substring(1,Se.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Wt=[],Gt=xt[0]==="^",Le=["["];Gt&&Le.push("^");for(var Me=Gt?1:0,rt=xt.length;Me<rt;++Me){var wt=xt[Me];if(/\\[bdsw]/i.test(wt))Le.push(wt);else{var qe=Ze(wt),Ct;Me+2<rt&&xt[Me+1]==="-"?(Ct=Ze(xt[Me+2]),Me+=2):Ct=qe,Wt.push([qe,Ct]),Ct<65||qe>122||(Ct<65||qe>90||Wt.push([Math.max(65,qe)|32,Math.min(Ct,90)|32]),Ct<97||qe>122||Wt.push([Math.max(97,qe)&-33,Math.min(Ct,122)&-33]))}}Wt.sort(function(Xt,Qe){return Xt[0]-Qe[0]||Qe[1]-Xt[1]});for(var Lt=[],kt=[],Me=0;Me<Wt.length;++Me){var Nt=Wt[Me];Nt[0]<=kt[1]+1?kt[1]=Math.max(kt[1],Nt[1]):Lt.push(kt=Nt)}for(var Me=0;Me<Lt.length;++Me){var Nt=Lt[Me];Le.push(ot(Nt[0])),Nt[1]>Nt[0]&&(Nt[1]+1>Nt[0]&&Le.push("-"),Le.push(ot(Nt[1])))}return Le.push("]"),Le.join("")}function qt(Se){for(var xt=Se.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Wt=xt.length,Gt=[],Le=0,Me=0;Le<Wt;++Le){var rt=xt[Le];if(rt==="(")++Me;else if(rt.charAt(0)==="\\"){var wt=+rt.substring(1);wt&&(wt<=Me?Gt[wt]=-1:xt[Le]=ot(wt))}}for(var Le=1;Le<Gt.length;++Le)Gt[Le]===-1&&(Gt[Le]=++me);for(var Le=0,Me=0;Le<Wt;++Le){var rt=xt[Le];if(rt==="(")++Me,Gt[Me]||(xt[Le]="(?:");else if(rt.charAt(0)==="\\"){var wt=+rt.substring(1);wt&&wt<=Me&&(xt[Le]="\\"+Gt[wt])}}for(var Le=0;Le<Wt;++Le)xt[Le]==="^"&&xt[Le+1]!=="^"&&(xt[Le]="");if(Se.ignoreCase&&Xe)for(var Le=0;Le<Wt;++Le){var rt=xt[Le],qe=rt.charAt(0);rt.length>=2&&qe==="["?xt[Le]=bt(rt):qe!=="\\"&&(xt[Le]=rt.replace(/[a-zA-Z]/g,function(kt){var Nt=kt.charCodeAt(0);return"["+String.fromCharCode(Nt&-33,Nt|32)+"]"}))}return xt.join("")}for(var vt=[],Je=0,q=Be.length;Je<q;++Je){var ye=Be[Je];if(ye.global||ye.multiline)throw new Error(""+ye);vt.push("(?:"+qt(ye)+")")}return new RegExp(vt.join("|"),at?"gi":"g")}function A(Be,me){var Xe=/(?:^|\s)nocode(?:\s|$)/,at=[],Je=0,q=[],ye=0;function Fe(Ze){var ot=Ze.nodeType;if(ot==1){if(Xe.test(Ze.className))return;for(var bt=Ze.firstChild;bt;bt=bt.nextSibling)Fe(bt);var qt=Ze.nodeName.toLowerCase();(qt==="br"||qt==="li")&&(at[ye]=`
|
|
|
`,q[ye<<1]=Je++,q[ye++<<1|1]=Ze)}else if(ot==3||ot==4){var vt=Ze.nodeValue;vt.length&&(me?vt=vt.replace(/\r\n?/g,`
|
|
|
`):vt=vt.replace(/[ \t\r\n]+/g," "),at[ye]=vt,q[ye<<1]=Je,Je+=vt.length,q[ye++<<1|1]=Ze)}}return Fe(Be),{sourceCode:at.join("").replace(/\n$/,""),spans:q}}function L(Be,me,Xe,at,Je){if(Xe){var q={sourceNode:Be,pre:1,langExtension:null,numberLines:null,sourceCode:Xe,spans:null,basePos:me,decorations:null};at(q),Je.push.apply(Je,q.decorations)}}var G=/\S/;function de(Be){for(var me=void 0,Xe=Be.firstChild;Xe;Xe=Xe.nextSibling){var at=Xe.nodeType;me=at===1?me?Be:Xe:at===3&&G.test(Xe.nodeValue)?Be:me}return me===Be?void 0:me}function ze(Be,me){var Xe={},at;(function(){for(var ye=Be.concat(me),Fe=[],Ze={},ot=0,bt=ye.length;ot<bt;++ot){var qt=ye[ot],vt=qt[3];if(vt)for(var Se=vt.length;--Se>=0;)Xe[vt.charAt(Se)]=qt;var xt=qt[1],Wt=""+xt;Ze.hasOwnProperty(Wt)||(Fe.push(xt),Ze[Wt]=null)}Fe.push(/[\0-\uffff]/),at=ne(Fe)})();var Je=me.length,q=function(ye){for(var Fe=ye.sourceCode,Ze=ye.basePos,ot=ye.sourceNode,bt=[Ze,je],qt=0,vt=Fe.match(at)||[],Se={},xt=0,Wt=vt.length;xt<Wt;++xt){var Gt=vt[xt],Le=Se[Gt],Me=void 0,rt;if(typeof Le=="string")rt=!1;else{var wt=Xe[Gt.charAt(0)];if(wt)Me=Gt.match(wt[1]),Le=wt[0];else{for(var qe=0;qe<Je;++qe)if(wt=me[qe],Me=Gt.match(wt[1]),Me){Le=wt[0];break}Me||(Le=je)}rt=Le.length>=5&&Le.substring(0,5)==="lang-",rt&&!(Me&&typeof Me[1]=="string")&&(rt=!1,Le=ee),rt||(Se[Gt]=Le)}var Ct=qt;if(qt+=Gt.length,!rt)bt.push(Ze+Ct,Le);else{var Lt=Me[1],kt=Gt.indexOf(Lt),Nt=kt+Lt.length;Me[2]&&(Nt=Gt.length-Me[2].length,kt=Nt-Lt.length);var Xt=Le.substring(5);L(ot,Ze+Ct,Gt.substring(0,kt),q,bt),L(ot,Ze+Ct+kt,Lt,$e(Xt,Lt),bt),L(ot,Ze+Ct+Nt,Gt.substring(Nt),q,bt)}}ye.decorations=bt};return q}function pt(Be){var me=[],Xe=[];Be.tripleQuotedStrings?me.push([V,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Be.multiLineStrings?me.push([V,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):me.push([V,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Be.verbatimStrings&&Xe.push([V,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var at=Be.hashComments;at&&(Be.cStyleComments?(at>1?me.push([be,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):me.push([be,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Xe.push([V,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):me.push([be,/^#[^\r\n]*/,null,"#"])),Be.cStyleComments&&(Xe.push([be,/^\/\/[^\r\n]*/,null]),Xe.push([be,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Je=Be.regexLiterals;if(Je){var q=Je>1?"":`
|
|
|
\r`,ye=q?".":"[\\S\\s]",Fe="/(?=[^/*"+q+"])(?:[^/\\x5B\\x5C"+q+"]|\\x5C"+ye+"|\\x5B(?:[^\\x5C\\x5D"+q+"]|\\x5C"+ye+")*(?:\\x5D|$))+/";Xe.push(["lang-regex",RegExp("^"+fe+"("+Fe+")")])}var Ze=Be.types;Ze&&Xe.push([Te,Ze]);var ot=(""+Be.keywords).replace(/^ | $/g,"");ot.length&&Xe.push([he,new RegExp("^(?:"+ot.replace(/[\s,]+/g,"|")+")\\b"),null]),me.push([je,/^\s+/,null,` \r
|
|
|
\xA0`]);var bt="^.[^\\s\\w.$@'\"`/\\\\]*";return Be.regexLiterals&&(bt+="(?!s*/)"),Xe.push([se,/^@[a-z_$][a-z_$@0-9]*/i,null],[Te,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[je,/^[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"],[je,/^\\[\s\S]?/,null],[Ee,new RegExp(bt),null]),ze(me,Xe)}var Ut=pt({keywords:$,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ie(Be,me,Xe){for(var at=/(?:^|\s)nocode(?:\s|$)/,Je=/\r\n?|\n/,q=Be.ownerDocument,ye=q.createElement("li");Be.firstChild;)ye.appendChild(Be.firstChild);var Fe=[ye];function Ze(xt){var Wt=xt.nodeType;if(Wt==1&&!at.test(xt.className))if(xt.nodeName==="br")ot(xt),xt.parentNode&&xt.parentNode.removeChild(xt);else for(var Gt=xt.firstChild;Gt;Gt=Gt.nextSibling)Ze(Gt);else if((Wt==3||Wt==4)&&Xe){var Le=xt.nodeValue,Me=Le.match(Je);if(Me){var rt=Le.substring(0,Me.index);xt.nodeValue=rt;var wt=Le.substring(Me.index+Me[0].length);if(wt){var qe=xt.parentNode;qe.insertBefore(q.createTextNode(wt),xt.nextSibling)}ot(xt),rt||xt.parentNode.removeChild(xt)}}}function ot(xt){for(;!xt.nextSibling;)if(xt=xt.parentNode,!xt)return;function Wt(Me,rt){var wt=rt?Me.cloneNode(!1):Me,qe=Me.parentNode;if(qe){var Ct=Wt(qe,1),Lt=Me.nextSibling;Ct.appendChild(wt);for(var kt=Lt;kt;kt=Lt)Lt=kt.nextSibling,Ct.appendChild(kt)}return wt}for(var Gt=Wt(xt.nextSibling,0),Le;(Le=Gt.parentNode)&&Le.nodeType===1;)Gt=Le;Fe.push(Gt)}for(var bt=0;bt<Fe.length;++bt)Ze(Fe[bt]);me===(me|0)&&Fe[0].setAttribute("value",me);var qt=q.createElement("ol");qt.className="linenums";for(var vt=Math.max(0,me-1|0)||0,bt=0,Se=Fe.length;bt<Se;++bt)ye=Fe[bt],ye.className="L"+(bt+vt)%10,ye.firstChild||ye.appendChild(q.createTextNode("\xA0")),qt.appendChild(ye);Be.appendChild(qt)}function Yt(Be){var me=/\bMSIE\s(\d+)/.exec(navigator.userAgent);me=me&&+me[1]<=8;var Xe=/\n/g,at=Be.sourceCode,Je=at.length,q=0,ye=Be.spans,Fe=ye.length,Ze=0,ot=Be.decorations,bt=ot.length,qt=0;ot[bt]=Je;var vt,Se;for(Se=vt=0;Se<bt;)ot[Se]!==ot[Se+2]?(ot[vt++]=ot[Se++],ot[vt++]=ot[Se++]):Se+=2;for(bt=vt,Se=vt=0;Se<bt;){for(var xt=ot[Se],Wt=ot[Se+1],Gt=Se+2;Gt+2<=bt&&ot[Gt+1]===Wt;)Gt+=2;ot[vt++]=xt,ot[vt++]=Wt,Se=Gt}bt=ot.length=vt;var Le=Be.sourceNode,Me="";Le&&(Me=Le.style.display,Le.style.display="none");try{for(var rt=null;Ze<Fe;){var wt=ye[Ze],qe=ye[Ze+2]||Je,Ct=ot[qt+2]||Je,Gt=Math.min(qe,Ct),Lt=ye[Ze+1],kt;if(Lt.nodeType!==1&&(kt=at.substring(q,Gt))){me&&(kt=kt.replace(Xe,"\r")),Lt.nodeValue=kt;var Nt=Lt.ownerDocument,Xt=Nt.createElement("span");Xt.className=ot[qt+1];var Qe=Lt.parentNode;Qe.replaceChild(Xt,Lt),Xt.appendChild(Lt),q<qe&&(ye[Ze+1]=Lt=Nt.createTextNode(at.substring(Gt,qe)),Qe.insertBefore(Lt,Xt.nextSibling))}q=Gt,q>=qe&&(Ze+=2),q>=Ct&&(qt+=2)}}finally{Le&&(Le.style.display=Me)}}var Pt={};function St(Be,me){for(var Xe=me.length;--Xe>=0;){var at=me[Xe];Pt.hasOwnProperty(at)?w.console&&console.warn("cannot override language handler %s",at):Pt[at]=Be}}function $e(Be,me){return Be&&Pt.hasOwnProperty(Be)||(Be=/^\s*</.test(me)?"default-markup":"default-code"),Pt[Be]}St(Ut,["default-code"]),St(ze([],[[je,/^[^<?]+/],[It,/^<!\w[^>]*(?:>|$)/],[be,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[Ee,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),St(ze([[je,/^[\s]+/,null,` \r
|
|
|
`],[Z,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[Ke,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[z,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[Ee,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),St(ze([],[[Z,/^[\s\S]+/]]),["uq.val"]),St(pt({keywords:ie,hashComments:!0,cStyleComments:!0,types:B}),["c","cc","cpp","cxx","cyc","m"]),St(pt({keywords:"null,true,false"}),["json"]),St(pt({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:B}),["cs"]),St(pt({keywords:I,cStyleComments:!0}),["java"]),St(pt({keywords:j,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),St(pt({keywords:J,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),St(pt({keywords:O,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),St(pt({keywords:H,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),St(pt({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),St(pt({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),St(ze([],[[V,/^[\s\S]+/]]),["regex"]);function it(Be){var me=Be.langExtension;try{var Xe=A(Be.sourceNode,Be.pre),at=Xe.sourceCode;Be.sourceCode=at,Be.spans=Xe.spans,Be.basePos=0,$e(me,at)(Be),Yt(Be)}catch(Je){w.console&&console.log(Je&&Je.stack||Je)}}function mt(Be,me,Xe){var at=Xe||!1,Je=me||null,q=document.createElement("div");q.innerHTML="<pre>"+Be+"</pre>",q=q.firstChild,at&&Ie(q,at,!0);var ye={langExtension:Je,numberLines:at,sourceNode:q,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return it(ye),q.innerHTML}function ht(Be,me){var Xe=me||document.body,at=Xe.ownerDocument||document;function Je(wt){return Xe.getElementsByTagName(wt)}for(var q=[Je("pre"),Je("code"),Je("xmp")],ye=[],Fe=0;Fe<q.length;++Fe)for(var Ze=0,ot=q[Fe].length;Ze<ot;++Ze)ye.push(q[Fe][Ze]);q=null;var bt=Date;bt.now||(bt={now:function(){return+new Date}});var qt=0,vt=/\blang(?:uage)?-([\w.]+)(?!\S)/,Se=/\bprettyprint\b/,xt=/\bprettyprinted\b/,Wt=/pre|xmp/i,Gt=/^code$/i,Le=/^(?:pre|code|xmp)$/i,Me={};function rt(){for(var wt=w.PR_SHOULD_USE_CONTINUATION?bt.now()+250:1/0;qt<ye.length&&bt.now()<wt;qt++){for(var qe=ye[qt],Ct=Me,Lt=qe;Lt=Lt.previousSibling;){var kt=Lt.nodeType,Nt=(kt===7||kt===8)&&Lt.nodeValue;if(Nt?!/^\??prettify\b/.test(Nt):kt!==3||/\S/.test(Lt.nodeValue))break;if(Nt){Ct={},Nt.replace(/\b(\w+)=([\w:.%+-]+)/g,function(yt,ut,Vt){Ct[ut]=Vt});break}}var Xt=qe.className;if((Ct!==Me||Se.test(Xt))&&!xt.test(Xt)){for(var Qe=!1,zt=qe.parentNode;zt;zt=zt.parentNode){var De=zt.tagName;if(Le.test(De)&&zt.className&&Se.test(zt.className)){Qe=!0;break}}if(!Qe){qe.className+=" prettyprinted";var xe=Ct.lang;if(!xe){xe=Xt.match(vt);var ke;!xe&&(ke=de(qe))&&Gt.test(ke.tagName)&&(xe=ke.className.match(vt)),xe&&(xe=xe[1])}var K;if(Wt.test(qe.tagName))K=1;else{var W=qe.currentStyle,ae=at.defaultView,ce=W?W.whiteSpace:ae&&ae.getComputedStyle?ae.getComputedStyle(qe,null).getPropertyValue("white-space"):0;K=ce&&ce.substring(0,3)==="pre"}var ve=Ct.linenums;(ve=ve==="true"||+ve)||(ve=Xt.match(/\blinenums\b(?::(\d+))?/),ve=ve?ve[1]&&ve[1].length?+ve[1]:!0:!1),ve&&Ie(qe,ve,K);var ft={langExtension:xe,sourceNode:qe,numberLines:ve,pre:K,sourceCode:null,basePos:null,spans:null,decorations:null};it(ft)}}}qt<ye.length?w.setTimeout(rt,250):typeof Be=="function"&&Be()}rt()}var ti=w.PR={createSimpleLexer:ze,registerLangHandler:St,sourceDecorator:pt,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:Z,PR_COMMENT:be,PR_DECLARATION:It,PR_KEYWORD:he,PR_LITERAL:se,PR_NOCODE:Q,PR_PLAIN:je,PR_PUNCTUATION:Ee,PR_SOURCE:ee,PR_STRING:V,PR_TAG:Ke,PR_TYPE:Te,prettyPrintOne:ue?w.prettyPrintOne=mt:pe=mt,prettyPrint:X=ue?w.prettyPrint=ht:X=ht},Ce=w.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return ti})})()},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 pe(w){var Ae=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return w.replace(/#{\s*key\s*}/g,Ae)}function X(w,Ae){var P,f,ie,I,k,T,C=!1;Ae||(Ae={}),P=Ae.debug||!1;try{ie=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(J){if(J.stopPropagation(),Ae.format)if(J.preventDefault(),typeof J.clipboardData=="undefined"){P&&console.warn("unable to use e.clipboardData"),P&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var H=we[Ae.format]||we.default;window.clipboardData.setData(H,w)}else J.clipboardData.clearData(),J.clipboardData.setData(Ae.format,w);Ae.onCopy&&(J.preventDefault(),Ae.onCopy(J.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");C=!0}catch(J){P&&console.error("unable to copy using execCommand: ",J),P&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(Ae.format||"text",w),Ae.onCopy&&Ae.onCopy(window.clipboardData),C=!0}catch(H){P&&console.error("unable to copy using clipboardData: ",H),P&&console.error("falling back to prompt"),f=pe("message"in Ae?Ae.message:Ye),window.prompt(f,w)}}finally{k&&(typeof k.removeRange=="function"?k.removeRange(I):k.removeAllRanges()),T&&document.body.removeChild(T),ie()}return C}Ci.exports=X},53184:function(Ci,Ft,re){"use strict";var ue,we;function Ye(pe,X,w){var Ae=function(P,f){return pe.js_beautify(P,f)};return Ae.js=pe.js_beautify,Ae.css=X.css_beautify,Ae.html=w.html_beautify,Ae.js_beautify=pe.js_beautify,Ae.css_beautify=X.css_beautify,Ae.html_beautify=w.html_beautify,Ae}ue=[re(58553),re(87804),re(40998)],we=function(pe,X,w){return Ye(pe,X,w)}.apply(Ft,ue),we!==void 0&&(Ci.exports=we)},87804:function(Ci,Ft){var re,ue;(function(){var we;(function(){"use strict";var pe=[,,function(P){function f(k){this.__parent=k,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}f.prototype.clone_empty=function(){var k=new f(this.__parent);return k.set_indent(this.__indent_count,this.__alignment_count),k},f.prototype.item=function(k){return k<0?this.__items[this.__items.length+k]:this.__items[k]},f.prototype.has_match=function(k){for(var T=this.__items.length-1;T>=0;T--)if(this.__items[T].match(k))return!0;return!1},f.prototype.set_indent=function(k,T){this.is_empty()&&(this.__indent_count=k||0,this.__alignment_count=T||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},f.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},f.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var k=this.__parent.current_line;return k.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),k.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),k.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,k.__items[0]===" "&&(k.__items.splice(0,1),k.__character_count-=1),!0}return!1},f.prototype.is_empty=function(){return this.__items.length===0},f.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},f.prototype.push=function(k){this.__items.push(k);var T=k.lastIndexOf(`
|
|
|
`);T!==-1?this.__character_count=k.length-T:this.__character_count+=k.length},f.prototype.pop=function(){var k=null;return this.is_empty()||(k=this.__items.pop(),this.__character_count-=k.length),k},f.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},f.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},f.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},f.prototype.toString=function(){var k="";return this.is_empty()?this.__parent.indent_empty_lines&&(k=this.__parent.get_indent_string(this.__indent_count)):(k=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),k+=this.__items.join("")),k};function ie(k,T){this.__cache=[""],this.__indent_size=k.indent_size,this.__indent_string=k.indent_char,k.indent_with_tabs||(this.__indent_string=new Array(k.indent_size+1).join(k.indent_char)),T=T||"",k.indent_level>0&&(T=new Array(k.indent_level+1).join(this.__indent_string)),this.__base_string=T,this.__base_string_length=T.length}ie.prototype.get_indent_size=function(k,T){var C=this.__base_string_length;return T=T||0,k<0&&(C=0),C+=k*this.__indent_size,C+=T,C},ie.prototype.get_indent_string=function(k,T){var C=this.__base_string;return T=T||0,k<0&&(k=0,C=""),T+=k*this.__indent_size,this.__ensure_cache(T),C+=this.__cache[T],C},ie.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},ie.prototype.__add_column=function(){var k=this.__cache.length,T=0,C="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,C=new Array(T+1).join(this.__indent_string)),k&&(C+=new Array(k+1).join(" ")),this.__cache.push(C)};function I(k,T){this.__indent_cache=new ie(k,T),this.raw=!1,this._end_with_newline=k.end_with_newline,this.indent_size=k.indent_size,this.wrap_line_length=k.wrap_line_length,this.indent_empty_lines=k.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}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 C=this.__lines.join(`
|
|
|
`);return k!==`
|
|
|
`&&(C=C.replace(/[\n]/g,k)),C},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 C=this.__lines.length-2;C>=0;){var O=this.__lines[C];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(C+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}C--}},P.exports.Output=I},,,,function(P){function f(k,T){this.raw_options=ie(k,T),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}f.prototype._get_array=function(k,T){var C=this.raw_options[k],O=T||[];return typeof C=="object"?C!==null&&typeof C.concat=="function"&&(O=C.concat()):typeof C=="string"&&(O=C.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var C=this.raw_options[k],O=C===void 0?!!T:!!C;return O},f.prototype._get_characters=function(k,T){var C=this.raw_options[k],O=T||"";return typeof C=="string"&&(O=C.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var C=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(C,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,C){var O=this._get_selection_list(k,T,C);if(O.length!==1)throw new Error("Invalid Option Value: The option '"+k+`' can only be one of the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O[0]},f.prototype._get_selection_list=function(k,T,C){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(C=C||[T[0]],!this._is_valid_selection(C,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,C);if(!this._is_valid_selection(O,T))throw new Error("Invalid Option Value: The option '"+k+`' can contain only the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O},f.prototype._is_valid_selection=function(k,T){return k.length&&T.length&&!k.some(function(C){return T.indexOf(C)===-1})};function ie(k,T){var C={};k=I(k);var O;for(O in k)O!==T&&(C[O]=k[O]);if(T&&k[T])for(O in k[T])C[O]=k[T][O];return C}function I(k){var T={},C;for(C in k){var O=C.replace(/-/g,"_");T[O]=k[C]}return T}P.exports.Options=f,P.exports.normalizeOpts=I,P.exports.mergeOpts=ie},,function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function ie(I){this.__input=I||"",this.__input_length=this.__input.length,this.__position=0}ie.prototype.restart=function(){this.__position=0},ie.prototype.back=function(){this.__position>0&&(this.__position-=1)},ie.prototype.hasNext=function(){return this.__position<this.__input_length},ie.prototype.next=function(){var I=null;return this.hasNext()&&(I=this.__input.charAt(this.__position),this.__position+=1),I},ie.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},ie.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},ie.prototype.test=function(I,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(I,k):!1},ie.prototype.testChar=function(I,k){var T=this.peek(k);return I.lastIndex=0,T!==null&&I.test(T)},ie.prototype.match=function(I){var k=this.__match(I,this.__position);return k?this.__position+=k[0].length:k=null,k},ie.prototype.read=function(I,k,T){var C="",O;return I&&(O=this.match(I),O&&(C+=O[0])),k&&(O||!I)&&(C+=this.readUntil(k,T)),C},ie.prototype.readUntil=function(I,k){var T="",C=this.__position;I.lastIndex=this.__position;var O=I.exec(this.__input);return O?(C=O.index,k&&(C+=O[0].length)):C=this.__input_length,T=this.__input.substring(this.__position,C),this.__position=C,T},ie.prototype.readUntilAfter=function(I){return this.readUntil(I,!0)},ie.prototype.get_regexp=function(I,k){var T=null,C="g";return k&&f&&(C="y"),typeof I=="string"&&I!==""?T=new RegExp(I,C):I&&(T=new RegExp(I.source,C)),T},ie.prototype.get_literal_regexp=function(I){return RegExp(I.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ie.prototype.peekUntilAfter=function(I){var k=this.__position,T=this.readUntilAfter(I);return this.__position=k,T},ie.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=ie},,,,,function(P){function f(ie,I){ie=typeof ie=="string"?ie:ie.source,I=typeof I=="string"?I:I.source,this.__directives_block_pattern=new RegExp(ie+/ beautify( \w+[:]\w+)+ /.source+I,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(ie+/\sbeautify\signore:end\s/.source+I,"g")}f.prototype.get_directives=function(ie){if(!ie.match(this.__directives_block_pattern))return null;var I={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(ie);k;)I[k[1]]=k[2],k=this.__directive_pattern.exec(ie);return I},f.prototype.readIgnored=function(ie){return ie.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},,function(P,f,ie){var I=ie(16).Beautifier,k=ie(17).Options;function T(C,O){var J=new I(C,O);return J.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,ie){var I=ie(17).Options,k=ie(2).Output,T=ie(8).InputScanner,C=ie(13).Directives,O=new C(/\/\*/,/\*\//),J=/\r\n|[\r\n]/,H=/\r\n|[\r\n]/g,j=/\s/,$=/(?:\s|\n)+/g,B=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,V=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function he(be,Te){this._source_text=be||"",this._options=new I(Te),this._ch=null,this._input=null,this.NESTED_AT_RULE={page:!0,"font-face":!0,keyframes:!0,media:!0,supports:!0,document:!0},this.CONDITIONAL_GROUP_RULE={media:!0,supports:!0,document:!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}he.prototype.eatString=function(be){var Te="";for(this._ch=this._input.next();this._ch;){if(Te+=this._ch,this._ch==="\\")Te+=this._input.next();else if(be.indexOf(this._ch)!==-1||this._ch===`
|
|
|
`)break;this._ch=this._input.next()}return Te},he.prototype.eatWhitespace=function(be){for(var Te=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 Te},he.prototype.foundNestedPseudoClass=function(){for(var be=0,Te=1,se=this._input.peek(Te);se;){if(se==="{")return!0;if(se==="(")be+=1;else if(se===")"){if(be===0)return!1;be-=1}else if(se===";"||se==="}")return!1;Te++,se=this._input.peek(Te)}return!1},he.prototype.print_string=function(be){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(be)},he.prototype.preserveSingleSpace=function(be){be&&(this._output.space_before_token=!0)},he.prototype.indent=function(){this._indentLevel++},he.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},he.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var be=this._source_text,Te=this._options.eol;Te==="auto"&&(Te=`
|
|
|
`,be&&J.test(be||"")&&(Te=be.match(J)[0])),be=be.replace(H,`
|
|
|
`);var se=be.match(/^[\t ]*/)[0];this._output=new k(this._options,se),this._input=new T(be),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var Ee=0,je=!1,Ke=!1,It=!1,ee=!1,z=!1,Z=this._ch,Q=!1,fe,ne,A;fe=this._input.read($),ne=fe!=="",A=Z,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),Z=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var L=this._input.read(B),G=O.get_directives(L);G&&G.ignore==="start"&&(L+=O.readIgnored(this._input)),this.print_string(L),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(V)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(ne),this.print_string(this._ch);var de=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);de.match(/[ :]$/)&&(de=this.eatString(": ").replace(/\s+$/,""),this.print_string(de),this._output.space_before_token=!0),Ee===0&&de.indexOf(":")!==-1&&(Ke=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(ne),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ze=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ze.match(/[ :]$/)&&(ze=this.eatString(": ").replace(/\s+$/,""),this.print_string(ze),this._output.space_before_token=!0),Ee===0&&ze.indexOf(":")!==-1?(Ke=!0,this.indent()):ze in this.NESTED_AT_RULE?(this._nestedLevel+=1,ze in this.CONDITIONAL_GROUP_RULE&&(It=!0)):Ee===0&&!Ke&&(ee=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(ne),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Ke&&(Ke=!1,this.outdent()),ee=!1,It?(It=!1,je=this._indentLevel>=this._nestedLevel):je=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&je&&this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(A==="("?this._output.space_before_token=!1:A!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),A==="{"&&this._output.trim(!0),Ke&&(this.outdent(),Ke=!1),this.print_string(this._ch),je=!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}(je||It)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!ee&&Ee===0?(this.print_string(":"),Ke||(Ke=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Ut=A==='"'||A==="'";this.preserveSingleSpace(Ut||ne),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")Q=!1,Ee===0?(Ke&&(this.outdent(),Ke=!1),ee=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),Ee++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),Ee&&(Ee--,this.outdent()));else{var Ie=!1;this._input.lookBack("with")&&(Ie=!0),this.preserveSingleSpace(ne||Ie),this.print_string(this._ch),Ke&&A==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),Ee++,this.indent())}else if(this._ch===")")Ee&&(Ee--,this.outdent()),z&&this._input.peek()===";"&&this._options.selector_separator_newline&&(z=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!Ke||z)&&Ee===0&&!ee?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Ke&&Ee===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&j.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(ne),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),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 Yt=A==='"'||A==="'";this.preserveSingleSpace(Yt||ne),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
|
`&&Q&&this._output.add_new_line()}var Pt=this._output.get_code(Te);return Pt},P.exports.Beautifier=he},function(P,f,ie){var I=ie(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 C=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||C;var O=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var J=0;J<O.length;J++)O[J]!=="expand"?this.brace_style="collapse":this.brace_style=O[J]}k.prototype=new I,P.exports.Options=k}],X={};function w(P){var f=X[P];if(f!==void 0)return f.exports;var ie=X[P]={exports:{}};return pe[P](ie,ie.exports,w),ie.exports}var Ae=w(15);we=Ae})();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 Ae=[,,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 J=this.__items.length-1;J>=0;J--)if(this.__items[J].match(O))return!0;return!1},k.prototype.set_indent=function(O,J){this.is_empty()&&(this.__indent_count=O||0,this.__alignment_count=J||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 J=O.lastIndexOf(`
|
|
|
`);J!==-1?this.__character_count=O.length-J: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,J){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)),J=J||"",O.indent_level>0&&(J=new Array(O.indent_level+1).join(this.__indent_string)),this.__base_string=J,this.__base_string_length=J.length}T.prototype.get_indent_size=function(O,J){var H=this.__base_string_length;return J=J||0,O<0&&(H=0),H+=O*this.__indent_size,H+=J,H},T.prototype.get_indent_string=function(O,J){var H=this.__base_string;return J=J||0,O<0&&(O=0,H=""),J+=O*this.__indent_size,this.__ensure_cache(J),H+=this.__cache[J],H},T.prototype.__ensure_cache=function(O){for(;O>=this.__cache.length;)this.__add_column()},T.prototype.__add_column=function(){var O=this.__cache.length,J=0,H="";this.__indent_size&&O>=this.__indent_size&&(J=Math.floor(O/this.__indent_size),O-=J*this.__indent_size,H=new Array(J+1).join(this.__indent_string)),O&&(H+=new Array(O+1).join(" ")),this.__cache.push(H)};function C(O,J){this.__indent_cache=new T(O,J),this.raw=!1,this._end_with_newline=O.end_with_newline,this.indent_size=O.indent_size,this.wrap_line_length=O.wrap_line_length,this.indent_empty_lines=O.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new k(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}C.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},C.prototype.get_line_number=function(){return this.__lines.length},C.prototype.get_indent_string=function(O,J){return this.__indent_cache.get_indent_string(O,J)},C.prototype.get_indent_size=function(O,J){return this.__indent_cache.get_indent_size(O,J)},C.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},C.prototype.add_new_line=function(O){return this.is_empty()||!O&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},C.prototype.get_code=function(O){this.trim(!0);var J=this.current_line.pop();J&&(J[J.length-1]===`
|
|
|
`&&(J=J.replace(/\n+$/g,"")),this.current_line.push(J)),this._end_with_newline&&this.__add_outputline();var H=this.__lines.join(`
|
|
|
`);return O!==`
|
|
|
`&&(H=H.replace(/[\n]/g,O)),H},C.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},C.prototype.set_indent=function(O,J){return O=O||0,J=J||0,this.next_line.set_indent(O,J),this.__lines.length>1?(this.current_line.set_indent(O,J),!0):(this.current_line.set_indent(),!1)},C.prototype.add_raw_token=function(O){for(var J=0;J<O.newlines;J++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(O.whitespace_before),this.current_line.push(O.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},C.prototype.add_token=function(O){this.__add_space_before_token(),this.current_line.push(O),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},C.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},C.prototype.remove_indent=function(O){for(var J=this.__lines.length;O<J;)this.__lines[O]._remove_indent(),O++;this.current_line._remove_wrap_indent()},C.prototype.trim=function(O){for(O=O===void 0?!1:O,this.current_line.trim();O&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},C.prototype.just_added_newline=function(){return this.current_line.is_empty()},C.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},C.prototype.ensure_empty_line_above=function(O,J){for(var H=this.__lines.length-2;H>=0;){var j=this.__lines[H];if(j.is_empty())break;if(j.item(0).indexOf(O)!==0&&j.item(-1)!==J){this.__lines.splice(H+1,0,new k(this)),this.previous_line=this.__lines[this.__lines.length-2];break}H--}},I.exports.Output=C},function(I){function k(T,C,O,J){this.type=T,this.text=C,this.comments_before=null,this.newlines=O||0,this.whitespace_before=J||"",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,J){this.raw_options=T(O,J),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,J){var H=this.raw_options[O],j=J||[];return typeof H=="object"?H!==null&&typeof H.concat=="function"&&(j=H.concat()):typeof H=="string"&&(j=H.split(/[^a-zA-Z0-9_\/\-]+/)),j},k.prototype._get_boolean=function(O,J){var H=this.raw_options[O],j=H===void 0?!!J:!!H;return j},k.prototype._get_characters=function(O,J){var H=this.raw_options[O],j=J||"";return typeof H=="string"&&(j=H.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),j},k.prototype._get_number=function(O,J){var H=this.raw_options[O];J=parseInt(J,10),isNaN(J)&&(J=0);var j=parseInt(H,10);return isNaN(j)&&(j=J),j},k.prototype._get_selection=function(O,J,H){var j=this._get_selection_list(O,J,H);if(j.length!==1)throw new Error("Invalid Option Value: The option '"+O+`' can only be one of the following values:
|
|
|
`+J+`
|
|
|
You passed in: '`+this.raw_options[O]+"'");return j[0]},k.prototype._get_selection_list=function(O,J,H){if(!J||J.length===0)throw new Error("Selection list cannot be empty.");if(H=H||[J[0]],!this._is_valid_selection(H,J))throw new Error("Invalid Default Value!");var j=this._get_array(O,H);if(!this._is_valid_selection(j,J))throw new Error("Invalid Option Value: The option '"+O+`' can contain only the following values:
|
|
|
`+J+`
|
|
|
You passed in: '`+this.raw_options[O]+"'");return j},k.prototype._is_valid_selection=function(O,J){return O.length&&J.length&&!O.some(function(H){return J.indexOf(H)===-1})};function T(O,J){var H={};O=C(O);var j;for(j in O)j!==J&&(H[j]=O[j]);if(J&&O[J])for(j in O[J])H[j]=O[J][j];return H}function C(O){var J={},H;for(H in O){var j=H.replace(/-/g,"_");J[j]=O[H]}return J}I.exports.Options=k,I.exports.normalizeOpts=C,I.exports.mergeOpts=T},,function(I){var k=RegExp.prototype.hasOwnProperty("sticky");function T(C){this.__input=C||"",this.__input_length=this.__input.length,this.__position=0}T.prototype.restart=function(){this.__position=0},T.prototype.back=function(){this.__position>0&&(this.__position-=1)},T.prototype.hasNext=function(){return this.__position<this.__input_length},T.prototype.next=function(){var C=null;return this.hasNext()&&(C=this.__input.charAt(this.__position),this.__position+=1),C},T.prototype.peek=function(C){var O=null;return C=C||0,C+=this.__position,C>=0&&C<this.__input_length&&(O=this.__input.charAt(C)),O},T.prototype.__match=function(C,O){C.lastIndex=O;var J=C.exec(this.__input);return J&&!(k&&C.sticky)&&J.index!==O&&(J=null),J},T.prototype.test=function(C,O){return O=O||0,O+=this.__position,O>=0&&O<this.__input_length?!!this.__match(C,O):!1},T.prototype.testChar=function(C,O){var J=this.peek(O);return C.lastIndex=0,J!==null&&C.test(J)},T.prototype.match=function(C){var O=this.__match(C,this.__position);return O?this.__position+=O[0].length:O=null,O},T.prototype.read=function(C,O,J){var H="",j;return C&&(j=this.match(C),j&&(H+=j[0])),O&&(j||!C)&&(H+=this.readUntil(O,J)),H},T.prototype.readUntil=function(C,O){var J="",H=this.__position;C.lastIndex=this.__position;var j=C.exec(this.__input);return j?(H=j.index,O&&(H+=j[0].length)):H=this.__input_length,J=this.__input.substring(this.__position,H),this.__position=H,J},T.prototype.readUntilAfter=function(C){return this.readUntil(C,!0)},T.prototype.get_regexp=function(C,O){var J=null,H="g";return O&&k&&(H="y"),typeof C=="string"&&C!==""?J=new RegExp(C,H):C&&(J=new RegExp(C.source,H)),J},T.prototype.get_literal_regexp=function(C){return RegExp(C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},T.prototype.peekUntilAfter=function(C){var O=this.__position,J=this.readUntilAfter(C);return this.__position=O,J},T.prototype.lookBack=function(C){var O=this.__position-1;return O>=C.length&&this.__input.substring(O-C.length,O).toLowerCase()===C},I.exports.InputScanner=T},function(I,k,T){var C=T(8).InputScanner,O=T(3).Token,J=T(10).TokenStream,H=T(11).WhitespacePattern,j={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},$=function(B,V){this._input=new C(B),this._options=V||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new H(this._input)};$.prototype.tokenize=function(){this._input.restart(),this.__tokens=new J,this._reset();for(var B,V=new O(j.START,""),he=null,be=[],Te=new J;V.type!==j.EOF;){for(B=this._get_next_token(V,he);this._is_comment(B);)Te.add(B),B=this._get_next_token(V,he);Te.isEmpty()||(B.comments_before=Te,Te=new J),B.parent=he,this._is_opening(B)?(be.push(he),he=B):he&&this._is_closing(B,he)&&(B.opened=he,he.closed=B,he=be.pop(),B.parent=he),B.previous=V,V.next=B,this.__tokens.add(B),V=B}return this.__tokens},$.prototype._is_first_token=function(){return this.__tokens.isEmpty()},$.prototype._reset=function(){},$.prototype._get_next_token=function(B,V){this._readWhitespace();var he=this._input.read(/.+/g);return he?this._create_token(j.RAW,he):this._create_token(j.EOF,"")},$.prototype._is_comment=function(B){return!1},$.prototype._is_opening=function(B){return!1},$.prototype._is_closing=function(B,V){return!1},$.prototype._create_token=function(B,V){var he=new O(B,V,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return he},$.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 C=null;return T=T||0,T+=this.__position,T>=0&&T<this.__tokens_length&&(C=this.__tokens[T]),C},k.prototype.add=function(T){this.__parent_token&&(T.parent=this.__parent_token),this.__tokens.push(T),this.__tokens_length+=1},I.exports.TokenStream=k},function(I,k,T){var C=T(12).Pattern;function O(J,H){C.call(this,J,H),H?this._line_regexp=this._input.get_regexp(H._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}O.prototype=new C,O.prototype.__set_whitespace_patterns=function(J,H){J+="\\t ",H+="\\n\\r",this._match_pattern=this._input.get_regexp("["+J+H+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+H+"]")},O.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var J=this._input.read(this._match_pattern);if(J===" ")this.whitespace_before_token=" ";else if(J){var H=this.__split(this._newline_regexp,J);this.newline_count=H.length-1,this.whitespace_before_token=H[this.newline_count]}return J},O.prototype.matching=function(J,H){var j=this._create();return j.__set_whitespace_patterns(J,H),j._update(),j},O.prototype._create=function(){return new O(this._input,this)},O.prototype.__split=function(J,H){J.lastIndex=0;for(var j=0,$=[],B=J.exec(H);B;)$.push(H.substring(j,B.index)),j=B.index+B[0].length,B=J.exec(H);return j<H.length?$.push(H.substring(j,H.length)):$.push(""),$},I.exports.WhitespacePattern=O},function(I){function k(T,C){this._input=T,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,C&&(this._starting_pattern=this._input.get_regexp(C._starting_pattern,!0),this._match_pattern=this._input.get_regexp(C._match_pattern,!0),this._until_pattern=this._input.get_regexp(C._until_pattern),this._until_after=C._until_after)}k.prototype.read=function(){var T=this._input.read(this._starting_pattern);return(!this._starting_pattern||T)&&(T+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),T},k.prototype.read_match=function(){return this._input.match(this._match_pattern)},k.prototype.until_after=function(T){var C=this._create();return C._until_after=!0,C._until_pattern=this._input.get_regexp(T),C._update(),C},k.prototype.until=function(T){var C=this._create();return C._until_after=!1,C._until_pattern=this._input.get_regexp(T),C._update(),C},k.prototype.starting_with=function(T){var C=this._create();return C._starting_pattern=this._input.get_regexp(T,!0),C._update(),C},k.prototype.matching=function(T){var C=this._create();return C._match_pattern=this._input.get_regexp(T,!0),C._update(),C},k.prototype._create=function(){return new k(this._input,this)},k.prototype._update=function(){},I.exports.Pattern=k},function(I){function k(T,C){T=typeof T=="string"?T:T.source,C=typeof C=="string"?C:C.source,this.__directives_block_pattern=new RegExp(T+/ beautify( \w+[:]\w+)+ /.source+C,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(T+/\sbeautify\signore:end\s/.source+C,"g")}k.prototype.get_directives=function(T){if(!T.match(this.__directives_block_pattern))return null;var C={};this.__directive_pattern.lastIndex=0;for(var O=this.__directive_pattern.exec(T);O;)C[O[1]]=O[2],O=this.__directive_pattern.exec(T);return C},k.prototype.readIgnored=function(T){return T.readUntilAfter(this.__directives_end_ignore_pattern)},I.exports.Directives=k},function(I,k,T){var C=T(12).Pattern,O={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function J(H,j){C.call(this,H,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 C(H);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}/)}}J.prototype=new C,J.prototype._create=function(){return new J(this._input,this)},J.prototype._update=function(){this.__set_templated_pattern()},J.prototype.disable=function(H){var j=this._create();return j._disabled[H]=!0,j._update(),j},J.prototype.read_options=function(H){var j=this._create();for(var $ in O)j._disabled[$]=H.templating.indexOf($)===-1;return j._update(),j},J.prototype.exclude=function(H){var j=this._create();return j._excluded[H]=!0,j._update(),j},J.prototype.read=function(){var H="";this._match_pattern?H=this._input.read(this._starting_pattern):H=this._input.read(this._starting_pattern,this.__template_pattern);for(var j=this._read_template();j;)this._match_pattern?j+=this._input.read(this._match_pattern):j+=this._input.readUntil(this.__template_pattern),H+=j,j=this._read_template();return this._until_after&&(H+=this._input.readUntilAfter(this._until_pattern)),H},J.prototype.__set_templated_pattern=function(){var H=[];this._disabled.php||H.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||H.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(H.push(this.__patterns.django._starting_pattern.source),H.push(this.__patterns.django_value._starting_pattern.source),H.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||H.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&H.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+H.join("|")+")")},J.prototype._read_template=function(){var H="",j=this._input.peek();if(j==="<"){var $=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&$==="?"&&(H=H||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&$==="%"&&(H=H||this.__patterns.erb.read())}else j==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(H=H||this.__patterns.handlebars_comment.read(),H=H||this.__patterns.handlebars_unescaped.read(),H=H||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(H=H||this.__patterns.django_value.read()),this._excluded.django||(H=H||this.__patterns.django_comment.read(),H=H||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(H=H||this.__patterns.smarty_comment.read(),H=H||this.__patterns.smarty_literal.read(),H=H||this.__patterns.smarty.read()));return H},I.exports.TemplatablePattern=J},,,,function(I,k,T){var C=T(19).Beautifier,O=T(20).Options;function J(H,j,$,B){var V=new C(H,j,$,B);return V.beautify()}I.exports=J,I.exports.defaultOptions=function(){return new O}},function(I,k,T){var C=T(20).Options,O=T(2).Output,J=T(21).Tokenizer,H=T(21).TOKEN,j=/\r\n|[\r\n]/,$=/\r\n|[\r\n]/g,B=function(ee,z){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=ee.max_preserve_newlines,this.preserve_newlines=ee.preserve_newlines,this._output=new O(ee,z)};B.prototype.current_line_has_match=function(ee){return this._output.current_line.has_match(ee)},B.prototype.set_space_before_token=function(ee,z){this._output.space_before_token=ee,this._output.non_breaking_space=z},B.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},B.prototype.add_raw_token=function(ee){this._output.add_raw_token(ee)},B.prototype.print_preserved_newlines=function(ee){var z=0;ee.type!==H.TEXT&&ee.previous.type!==H.TEXT&&(z=ee.newlines?1:0),this.preserve_newlines&&(z=ee.newlines<this.max_preserve_newlines+1?ee.newlines:this.max_preserve_newlines+1);for(var Z=0;Z<z;Z++)this.print_newline(Z>0);return z!==0},B.prototype.traverse_whitespace=function(ee){return ee.whitespace_before||ee.newlines?(this.print_preserved_newlines(ee)||(this._output.space_before_token=!0),!0):!1},B.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},B.prototype.print_newline=function(ee){this._output.add_new_line(ee)},B.prototype.print_token=function(ee){ee.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(ee.text))},B.prototype.indent=function(){this.indent_level++},B.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},B.prototype.get_full_indent=function(ee){return ee=this.indent_level+(ee||0),ee<1?"":this._output.get_indent_string(ee)};var V=function(ee){for(var z=null,Z=ee.next;Z.type!==H.EOF&&ee.closed!==Z;){if(Z.type===H.ATTRIBUTE&&Z.text==="type"){Z.next&&Z.next.type===H.EQUALS&&Z.next.next&&Z.next.next.type===H.VALUE&&(z=Z.next.next.text);break}Z=Z.next}return z},he=function(ee,z){var Z=null,Q=null;return z.closed?(ee==="script"?Z="text/javascript":ee==="style"&&(Z="text/css"),Z=V(z)||Z,Z.search("text/css")>-1?Q="css":Z.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?Q="javascript":Z.search(/(text|application|dojo)\/(x-)?(html)/)>-1?Q="html":Z.search(/test\/null/)>-1&&(Q="null"),Q):null};function be(ee,z){return z.indexOf(ee)!==-1}function Te(ee,z,Z){this.parent=ee||null,this.tag=z?z.tag_name:"",this.indent_level=Z||0,this.parser_token=z||null}function se(ee){this._printer=ee,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(ee){var z=new Te(this._current_frame,ee,this._printer.indent_level);this._current_frame=z},se.prototype._try_pop_frame=function(ee){var z=null;return ee&&(z=ee.parser_token,this._printer.indent_level=ee.indent_level,this._current_frame=ee.parent),z},se.prototype._get_frame=function(ee,z){for(var Z=this._current_frame;Z&&ee.indexOf(Z.tag)===-1;){if(z&&z.indexOf(Z.tag)!==-1){Z=null;break}Z=Z.parent}return Z},se.prototype.try_pop=function(ee,z){var Z=this._get_frame([ee],z);return this._try_pop_frame(Z)},se.prototype.indent_to_tag=function(ee){var z=this._get_frame(ee);z&&(this._printer.indent_level=z.indent_level)};function Ee(ee,z,Z,Q){this._source_text=ee||"",z=z||{},this._js_beautify=Z,this._css_beautify=Q,this._tag_stack=null;var fe=new C(z,"html");this._options=fe,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}Ee.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var ee=this._source_text,z=this._options.eol;this._options.eol==="auto"&&(z=`
|
|
|
`,ee&&j.test(ee)&&(z=ee.match(j)[0])),ee=ee.replace($,`
|
|
|
`);var Z=ee.match(/^[\t ]*/)[0],Q={text:"",type:""},fe=new je(this._options),ne=new B(this._options,Z),A=new J(ee,this._options).tokenize();this._tag_stack=new se(ne);for(var L=null,G=A.next();G.type!==H.EOF;)G.type===H.TAG_OPEN||G.type===H.COMMENT?(L=this._handle_tag_open(ne,G,fe,Q,A),fe=L):G.type===H.ATTRIBUTE||G.type===H.EQUALS||G.type===H.VALUE||G.type===H.TEXT&&!fe.tag_complete?L=this._handle_inside_tag(ne,G,fe,Q):G.type===H.TAG_CLOSE?L=this._handle_tag_close(ne,G,fe):G.type===H.TEXT?L=this._handle_text(ne,G,fe):G.type===H.CONTROL_FLOW_OPEN?L=this._handle_control_flow_open(ne,G):G.type===H.CONTROL_FLOW_CLOSE?L=this._handle_control_flow_close(ne,G):ne.add_raw_token(G),Q=L,G=A.next();var de=ne._output.get_code(z);return de},Ee.prototype._handle_control_flow_open=function(ee,z){var Z={text:z.text,type:z.type};return ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),z.newlines?ee.print_preserved_newlines(z):ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),ee.print_token(z),ee.indent(),Z},Ee.prototype._handle_control_flow_close=function(ee,z){var Z={text:z.text,type:z.type};return ee.deindent(),z.newlines?ee.print_preserved_newlines(z):ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),ee.print_token(z),Z},Ee.prototype._handle_tag_close=function(ee,z,Z){var Q={text:z.text,type:z.type};return ee.alignment_size=0,Z.tag_complete=!0,ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?ee.add_raw_token(z):(Z.tag_start_char==="<"&&(ee.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&Z.has_wrapped_attrs&&ee.print_newline(!1)),ee.print_token(z)),Z.indent_content&&!(Z.is_unformatted||Z.is_content_unformatted)&&(ee.indent(),Z.indent_content=!1),!Z.is_inline_element&&!(Z.is_unformatted||Z.is_content_unformatted)&&ee.set_wrap_point(),Q},Ee.prototype._handle_inside_tag=function(ee,z,Z,Q){var fe=Z.has_wrapped_attrs,ne={text:z.text,type:z.type};return ee.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),Z.is_unformatted?ee.add_raw_token(z):Z.tag_start_char==="{"&&z.type===H.TEXT?ee.print_preserved_newlines(z)?(z.newlines=0,ee.add_raw_token(z)):ee.print_token(z):(z.type===H.ATTRIBUTE?ee.set_space_before_token(!0):(z.type===H.EQUALS||z.type===H.VALUE&&z.previous.type===H.EQUALS)&&ee.set_space_before_token(!1),z.type===H.ATTRIBUTE&&Z.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(ee.traverse_whitespace(z),fe=fe||z.newlines!==0),this._is_wrap_attributes_force&&Z.attr_count>=this._options.wrap_attributes_min_attrs&&(Q.type!==H.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(ee.print_newline(!1),fe=!0)),ee.print_token(z),fe=fe||ee.previous_token_wrapped(),Z.has_wrapped_attrs=fe),ne},Ee.prototype._handle_text=function(ee,z,Z){var Q={text:z.text,type:"TK_CONTENT"};return Z.custom_beautifier_name?this._print_custom_beatifier_text(ee,z,Z):Z.is_unformatted||Z.is_content_unformatted?ee.add_raw_token(z):(ee.traverse_whitespace(z),ee.print_token(z)),Q},Ee.prototype._print_custom_beatifier_text=function(ee,z,Z){var Q=this;if(z.text!==""){var fe=z.text,ne,A=1,L="",G="";Z.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?ne=this._js_beautify:Z.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?ne=this._css_beautify:Z.custom_beautifier_name==="html"&&(ne=function(Yt,Pt){var St=new Ee(Yt,Pt,Q._js_beautify,Q._css_beautify);return St.beautify()}),this._options.indent_scripts==="keep"?A=0:this._options.indent_scripts==="separate"&&(A=-ee.indent_level);var de=ee.get_full_indent(A);if(fe=fe.replace(/\n[ \t]*$/,""),Z.custom_beautifier_name!=="html"&&fe[0]==="<"&&fe.match(/^(<!--|<!\[CDATA\[)/)){var ze=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(fe);if(!ze){ee.add_raw_token(z);return}L=de+ze[1]+`
|
|
|
`,fe=ze[4],ze[5]&&(G=de+ze[5]),fe=fe.replace(/\n[ \t]*$/,""),(ze[2]||ze[3].indexOf(`
|
|
|
`)!==-1)&&(ze=ze[3].match(/[ \t]+$/),ze&&(z.whitespace_before=ze[0]))}if(fe)if(ne){var pt=function(){this.eol=`
|
|
|
`};pt.prototype=this._options.raw_options;var Ut=new pt;fe=ne(de+fe,Ut)}else{var Ie=z.whitespace_before;Ie&&(fe=fe.replace(new RegExp(`
|
|
|
(`+Ie+")?","g"),`
|
|
|
`)),fe=de+fe.replace(/\n/g,`
|
|
|
`+de)}L&&(fe?fe=L+fe+`
|
|
|
`+G:fe=L+G),ee.print_newline(!1),fe&&(z.text=fe,z.whitespace_before="",z.newlines=0,ee.add_raw_token(z),ee.print_newline(!0))}},Ee.prototype._handle_tag_open=function(ee,z,Z,Q,fe){var ne=this._get_tag_open_token(z);if((Z.is_unformatted||Z.is_content_unformatted)&&!Z.is_empty_element&&z.type===H.TAG_OPEN&&!ne.is_start_tag?(ee.add_raw_token(z),ne.start_tag_token=this._tag_stack.try_pop(ne.tag_name)):(ee.traverse_whitespace(z),this._set_tag_position(ee,z,ne,Z,Q),ne.is_inline_element||ee.set_wrap_point(),ee.print_token(z)),ne.is_start_tag&&this._is_wrap_attributes_force){var A=0,L;do L=fe.peek(A),L.type===H.ATTRIBUTE&&(ne.attr_count+=1),A+=1;while(L.type!==H.EOF&&L.type!==H.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(ne.alignment_size=z.text.length+1),!ne.tag_complete&&!ne.is_unformatted&&(ee.alignment_size=ne.alignment_size),ne};var je=function(ee,z,Z){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="",!Z)this.tag_complete=!0;else{var Q;this.tag_start_char=Z.text[0],this.text=Z.text,this.tag_start_char==="<"?(Q=Z.text.match(/^<([^\s>]*)/),this.tag_check=Q?Q[1]:""):(Q=Z.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=Q?Q[1]:"",(Z.text.startsWith("{{#>")||Z.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&Z.next!==null?this.tag_check=Z.next.text.split(" ")[0]:this.tag_check=Z.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),Z.type===H.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||Z.closed&&Z.closed.text==="/>";var fe=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(fe=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!ee.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(fe)))}};Ee.prototype._get_tag_open_token=function(ee){var z=new je(this._options,this._tag_stack.get_parser_token(),ee);return z.alignment_size=this._options.wrap_attributes_indent_size,z.is_end_tag=z.is_end_tag||be(z.tag_check,this._options.void_elements),z.is_empty_element=z.tag_complete||z.is_start_tag&&z.is_end_tag,z.is_unformatted=!z.tag_complete&&be(z.tag_check,this._options.unformatted),z.is_content_unformatted=!z.is_empty_element&&be(z.tag_check,this._options.content_unformatted),z.is_inline_element=be(z.tag_name,this._options.inline)||this._options.inline_custom_elements&&z.tag_name.includes("-")||z.tag_start_char==="{",z},Ee.prototype._set_tag_position=function(ee,z,Z,Q,fe){if(Z.is_empty_element||(Z.is_end_tag?Z.start_tag_token=this._tag_stack.try_pop(Z.tag_name):(this._do_optional_end_element(Z)&&(Z.is_inline_element||ee.print_newline(!1)),this._tag_stack.record_tag(Z),(Z.tag_name==="script"||Z.tag_name==="style")&&!(Z.is_unformatted||Z.is_content_unformatted)&&(Z.custom_beautifier_name=he(Z.tag_check,z)))),be(Z.tag_check,this._options.extra_liners)&&(ee.print_newline(!1),ee._output.just_added_blankline()||ee.print_newline(!0)),Z.is_empty_element){if(Z.tag_start_char==="{"&&Z.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),Z.indent_content=!0;var ne=ee.current_line_has_match(/{{#if/);ne||ee.print_newline(!1)}Z.tag_name==="!--"&&fe.type===H.TAG_CLOSE&&Q.is_end_tag&&Z.text.indexOf(`
|
|
|
`)===-1||(Z.is_inline_element||Z.is_unformatted||ee.print_newline(!1),this._calcluate_parent_multiline(ee,Z))}else if(Z.is_end_tag){var A=!1;A=Z.start_tag_token&&Z.start_tag_token.multiline_content,A=A||!Z.is_inline_element&&!(Q.is_inline_element||Q.is_unformatted)&&!(fe.type===H.TAG_CLOSE&&Z.start_tag_token===Q)&&fe.type!=="TK_CONTENT",(Z.is_content_unformatted||Z.is_unformatted)&&(A=!1),A&&ee.print_newline(!1)}else Z.indent_content=!Z.custom_beautifier_name,Z.tag_start_char==="<"&&(Z.tag_name==="html"?Z.indent_content=this._options.indent_inner_html:Z.tag_name==="head"?Z.indent_content=this._options.indent_head_inner_html:Z.tag_name==="body"&&(Z.indent_content=this._options.indent_body_inner_html)),!(Z.is_inline_element||Z.is_unformatted)&&(fe.type!=="TK_CONTENT"||Z.is_content_unformatted)&&ee.print_newline(!1),this._calcluate_parent_multiline(ee,Z)},Ee.prototype._calcluate_parent_multiline=function(ee,z){z.parent&&ee._output.just_added_newline()&&!((z.is_inline_element||z.is_unformatted)&&z.parent.is_inline_element)&&(z.parent.multiline_content=!0)};var Ke=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","menu","nav","ol","p","pre","section","table","ul"],It=["a","audio","del","ins","map","noscript","video"];Ee.prototype._do_optional_end_element=function(ee){var z=null;if(!(ee.is_empty_element||!ee.is_start_tag||!ee.parent)){if(ee.tag_name==="body")z=z||this._tag_stack.try_pop("head");else if(ee.tag_name==="li")z=z||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(ee.tag_name==="dd"||ee.tag_name==="dt")z=z||this._tag_stack.try_pop("dt",["dl"]),z=z||this._tag_stack.try_pop("dd",["dl"]);else if(ee.parent.tag_name==="p"&&Ke.indexOf(ee.tag_name)!==-1){var Z=ee.parent.parent;(!Z||It.indexOf(Z.tag_name)===-1)&&(z=z||this._tag_stack.try_pop("p"))}else ee.tag_name==="rp"||ee.tag_name==="rt"?(z=z||this._tag_stack.try_pop("rt",["ruby","rtc"]),z=z||this._tag_stack.try_pop("rp",["ruby","rtc"])):ee.tag_name==="optgroup"?z=z||this._tag_stack.try_pop("optgroup",["select"]):ee.tag_name==="option"?z=z||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):ee.tag_name==="colgroup"?z=z||this._tag_stack.try_pop("caption",["table"]):ee.tag_name==="thead"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"])):ee.tag_name==="tbody"||ee.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"])):ee.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"])):(ee.tag_name==="th"||ee.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 ee.parent=this._tag_stack.get_parser_token(),z}},I.exports.Beautifier=Ee},function(I,k,T){var C=T(6).Options;function O(J){C.call(this,J,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}O.prototype=new C,I.exports.Options=O},function(I,k,T){var C=T(9).Tokenizer,O=T(9).TOKEN,J=T(13).Directives,H=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},B=new J(/<\!--/,/-->/),V=function(he,be){C.call(this,he,be),this._current_tag_name="";var Te=new H(this._input).read_options(this._options),se=new j(this._input);if(this.__patterns={word:Te.until(/[\n\r\t <]/),word_control_flow_close_excluded:Te.until(/[\n\r\t <}]/),single_quote:Te.until_after(/'/),double_quote:Te.until_after(/"/),attribute:Te.until(/[\n\r\t =>]|\/>/),element_name:Te.until(/[\n\r\t >\/]/),angular_control_flow_start:se.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:se.starting_with(/{{!--/).until_after(/--}}/),handlebars:se.starting_with(/{{/).until_after(/}}/),handlebars_open:se.until(/[\n\r\t }]/),handlebars_raw_close:se.until(/}}/),comment:se.starting_with(/<!--/).until_after(/-->/),cdata:se.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:se.starting_with(/<!\[/).until_after(/]>/),processing:se.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"),this.__patterns.word_control_flow_close_excluded=this.__patterns.word_control_flow_close_excluded.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var Ee=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=se.matching(Ee).until_after(Ee)}};V.prototype=new C,V.prototype._is_comment=function(he){return!1},V.prototype._is_opening=function(he){return he.type===$.TAG_OPEN||he.type===$.CONTROL_FLOW_OPEN},V.prototype._is_closing=function(he,be){return he.type===$.TAG_CLOSE&&be&&((he.text===">"||he.text==="/>")&&be.text[0]==="<"||he.text==="}}"&&be.text[0]==="{"&&be.text[1]==="{")||he.type===$.CONTROL_FLOW_CLOSE&&he.text==="}"&&be.text.endsWith("{")},V.prototype._reset=function(){this._current_tag_name=""},V.prototype._get_next_token=function(he,be){var Te=null;this._readWhitespace();var se=this._input.peek();return se===null?this._create_token($.EOF,""):(Te=Te||this._read_open_handlebars(se,be),Te=Te||this._read_attribute(se,he,be),Te=Te||this._read_close(se,be),Te=Te||this._read_script_and_style(se,he),Te=Te||this._read_control_flows(se,be),Te=Te||this._read_raw_content(se,he,be),Te=Te||this._read_content_word(se,be),Te=Te||this._read_comment_or_cdata(se),Te=Te||this._read_processing(se),Te=Te||this._read_open(se,be),Te=Te||this._create_token($.UNKNOWN,this._input.next()),Te)},V.prototype._read_comment_or_cdata=function(he){var be=null,Te=null,se=null;if(he==="<"){var Ee=this._input.peek(1);Ee==="!"&&(Te=this.__patterns.comment.read(),Te?(se=B.get_directives(Te),se&&se.ignore==="start"&&(Te+=B.readIgnored(this._input))):Te=this.__patterns.cdata.read()),Te&&(be=this._create_token($.COMMENT,Te),be.directives=se)}return be},V.prototype._read_processing=function(he){var be=null,Te=null,se=null;if(he==="<"){var Ee=this._input.peek(1);(Ee==="!"||Ee==="?")&&(Te=this.__patterns.conditional_comment.read(),Te=Te||this.__patterns.processing.read()),Te&&(be=this._create_token($.COMMENT,Te),be.directives=se)}return be},V.prototype._read_open=function(he,be){var Te=null,se=null;return(!be||be.type===$.CONTROL_FLOW_OPEN)&&he==="<"&&(Te=this._input.next(),this._input.peek()==="/"&&(Te+=this._input.next()),Te+=this.__patterns.element_name.read(),se=this._create_token($.TAG_OPEN,Te)),se},V.prototype._read_open_handlebars=function(he,be){var Te=null,se=null;return(!be||be.type===$.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&he==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(Te=this.__patterns.handlebars_comment.read(),Te=Te||this.__patterns.handlebars.read(),se=this._create_token($.COMMENT,Te)):(Te=this.__patterns.handlebars_open.read(),se=this._create_token($.TAG_OPEN,Te))),se},V.prototype._read_control_flows=function(he,be){var Te="",se=null;if(!this._options.templating.includes("angular"))return se;if(he==="@"){if(Te=this.__patterns.angular_control_flow_start.read(),Te==="")return se;for(var Ee=Te.endsWith("(")?1:0,je=0;!(Te.endsWith("{")&&Ee===je);){var Ke=this._input.next();if(Ke===null)break;Ke==="("?Ee++:Ke===")"&&je++,Te+=Ke}se=this._create_token($.CONTROL_FLOW_OPEN,Te)}else he==="}"&&be&&be.type===$.CONTROL_FLOW_OPEN&&(Te=this._input.next(),se=this._create_token($.CONTROL_FLOW_CLOSE,Te));return se},V.prototype._read_close=function(he,be){var Te=null,se=null;return be&&be.type===$.TAG_OPEN&&(be.text[0]==="<"&&(he===">"||he==="/"&&this._input.peek(1)===">")?(Te=this._input.next(),he==="/"&&(Te+=this._input.next()),se=this._create_token($.TAG_CLOSE,Te)):be.text[0]==="{"&&he==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),se=this._create_token($.TAG_CLOSE,"}}"))),se},V.prototype._read_attribute=function(he,be,Te){var se=null,Ee="";if(Te&&Te.text[0]==="<")if(he==="=")se=this._create_token($.EQUALS,this._input.next());else if(he==='"'||he==="'"){var je=this._input.next();he==='"'?je+=this.__patterns.double_quote.read():je+=this.__patterns.single_quote.read(),se=this._create_token($.VALUE,je)}else Ee=this.__patterns.attribute.read(),Ee&&(be.type===$.EQUALS?se=this._create_token($.VALUE,Ee):se=this._create_token($.ATTRIBUTE,Ee));return se},V.prototype._is_content_unformatted=function(he){return this._options.void_elements.indexOf(he)===-1&&(this._options.content_unformatted.indexOf(he)!==-1||this._options.unformatted.indexOf(he)!==-1)},V.prototype._read_raw_content=function(he,be,Te){var se="";if(Te&&Te.text[0]==="{")se=this.__patterns.handlebars_raw_close.read();else if(be.type===$.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var Ee=be.opened.text.substr(1).toLowerCase();this._is_content_unformatted(Ee)&&(se=this._input.readUntil(new RegExp("</"+Ee+"[\\n\\r\\t ]*?>","ig")))}return se?this._create_token($.TEXT,se):null},V.prototype._read_script_and_style=function(he,be){if(be.type===$.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var Te=be.opened.text.substr(1).toLowerCase();if(Te==="script"||Te==="style"){var se=this._read_comment_or_cdata(he);if(se)return se.type=$.TEXT,se;var Ee=this._input.readUntil(new RegExp("</"+Te+"[\\n\\r\\t ]*?>","ig"));if(Ee)return this._create_token($.TEXT,Ee)}}return null},V.prototype._read_content_word=function(he,be){var Te="";return this._options.unformatted_content_delimiter&&he===this._options.unformatted_content_delimiter[0]&&(Te=this.__patterns.unformatted_content_delimiter.read()),Te||(Te=be&&be.type===$.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),Te?this._create_token($.TEXT,Te):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 Ae[I](T,T.exports,f),T.exports}var ie=f(18);Ye=ie})();var pe=Ye;if(1)ue=[re,re(58553),re(87804)],we=function(Ae){var P=re(58553),f=re(87804);return{html_beautify:function(ie,I){return pe(ie,I,P.js_beautify,f.css_beautify)}}}.apply(Ft,ue),we!==void 0&&(Ci.exports=we);else var X,w})()},58553:function(Ci,Ft){var re,ue;(function(){var we;(function(){"use strict";var pe=[function(P,f,ie){var I=ie(1).Beautifier,k=ie(5).Options;function T(C,O){var J=new I(C,O);return J.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,ie){var I=ie(2).Output,k=ie(3).Token,T=ie(4),C=ie(5).Options,O=ie(7).Tokenizer,J=ie(7).line_starters,H=ie(7).positionable_operators,j=ie(7).TOKEN;function $(L,G){return G.indexOf(L)!==-1}function B(L){return L.replace(/^\s+/g,"")}function V(L){for(var G={},de=0;de<L.length;de++)G[L[de].replace(/-/g,"_")]=L[de];return G}function he(L,G){return L&&L.type===j.RESERVED&&L.text===G}function be(L,G){return L&&L.type===j.RESERVED&&$(L.text,G)}var Te=["case","return","do","if","throw","else","await","break","continue","async"],se=["before-newline","after-newline","preserve-newline"],Ee=V(se),je=[Ee.before_newline,Ee.preserve_newline],Ke={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function It(L,G){G.multiline_frame||G.mode===Ke.ForInitializer||G.mode===Ke.Conditional||L.remove_indent(G.start_line_index)}function ee(L){L=L.replace(T.allLineBreaks,`
|
|
|
`);for(var G=[],de=L.indexOf(`
|
|
|
`);de!==-1;)G.push(L.substring(0,de)),L=L.substring(de+1),de=L.indexOf(`
|
|
|
`);return L.length&&G.push(L),G}function z(L){return L===Ke.ArrayLiteral}function Z(L){return $(L,[Ke.Expression,Ke.ForInitializer,Ke.Conditional])}function Q(L,G){for(var de=0;de<L.length;de++){var ze=L[de].trim();if(ze.charAt(0)!==G)return!1}return!0}function fe(L,G){for(var de=0,ze=L.length,pt;de<ze;de++)if(pt=L[de],pt&&pt.indexOf(G)!==0)return!1;return!0}function ne(L,G){G=G||{},this._source_text=L||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new C(G)}ne.prototype.create_flags=function(L,G){var de=0;L&&(de=L.indentation_level,!this._output.just_added_newline()&&L.line_indent_level>de&&(de=L.line_indent_level));var ze={mode:G,parent:L,last_token:L?L.last_token:new k(j.START_BLOCK,""),last_word:L?L.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:de,alignment:0,line_indent_level:L?L.line_indent_level:de,start_line_index:this._output.get_line_number(),ternary_depth:0};return ze},ne.prototype._reset=function(L){var G=L.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new I(this._options,G),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Ke.BlockStatement);var de=new O(L,this._options);return this._tokens=de.tokenize(),L},ne.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var L,G=this._reset(this._source_text),de=this._options.eol;this._options.eol==="auto"&&(de=`
|
|
|
`,G&&T.lineBreak.test(G||"")&&(de=G.match(T.lineBreak)[0]));for(var ze=this._tokens.next();ze;)this.handle_token(ze),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ze,ze=this._tokens.next();return L=this._output.get_code(de),L},ne.prototype.handle_token=function(L,G){L.type===j.START_EXPR?this.handle_start_expr(L):L.type===j.END_EXPR?this.handle_end_expr(L):L.type===j.START_BLOCK?this.handle_start_block(L):L.type===j.END_BLOCK?this.handle_end_block(L):L.type===j.WORD?this.handle_word(L):L.type===j.RESERVED?this.handle_word(L):L.type===j.SEMICOLON?this.handle_semicolon(L):L.type===j.STRING?this.handle_string(L):L.type===j.EQUALS?this.handle_equals(L):L.type===j.OPERATOR?this.handle_operator(L):L.type===j.COMMA?this.handle_comma(L):L.type===j.BLOCK_COMMENT?this.handle_block_comment(L,G):L.type===j.COMMENT?this.handle_comment(L,G):L.type===j.DOT?this.handle_dot(L):L.type===j.EOF?this.handle_eof(L):L.type===j.UNKNOWN?this.handle_unknown(L,G):this.handle_unknown(L,G)},ne.prototype.handle_whitespace_and_comments=function(L,G){var de=L.newlines,ze=this._options.keep_array_indentation&&z(this._flags.mode);if(L.comments_before)for(var pt=L.comments_before.next();pt;)this.handle_whitespace_and_comments(pt,G),this.handle_token(pt,G),pt=L.comments_before.next();if(ze)for(var Ut=0;Ut<de;Ut+=1)this.print_newline(Ut>0,G);else if(this._options.max_preserve_newlines&&de>this._options.max_preserve_newlines&&(de=this._options.max_preserve_newlines),this._options.preserve_newlines&&de>1){this.print_newline(!1,G);for(var Ie=1;Ie<de;Ie+=1)this.print_newline(!0,G)}};var A=["async","break","continue","return","throw","yield"];ne.prototype.allow_wrap_or_preserved_newline=function(L,G){if(G=G===void 0?!1:G,!this._output.just_added_newline()){var de=this._options.preserve_newlines&&L.newlines||G,ze=$(this._flags.last_token.text,H)||$(L.text,H);if(ze){var pt=$(this._flags.last_token.text,H)&&$(this._options.operator_position,je)||$(L.text,H);de=de&&pt}if(de)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(be(this._flags.last_token,A))return;this._output.set_wrap_point()}}},ne.prototype.print_newline=function(L,G){if(!G&&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 de=this._tokens.peek();this._flags.mode===Ke.Statement&&!(this._flags.if_block&&he(de,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(L)&&(this._flags.multiline_frame=!0)},ne.prototype.print_token_line_indentation=function(L){this._output.just_added_newline()&&(this._options.keep_array_indentation&&L.newlines&&(L.text==="["||z(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(L.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},ne.prototype.print_token=function(L){if(this._output.raw){this._output.add_raw_token(L);return}if(this._options.comma_first&&L.previous&&L.previous.type===j.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var G=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(G),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(L),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(L),this._output.non_breaking_space=!0,this._output.add_token(L.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},ne.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ne.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},ne.prototype.set_mode=function(L){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,L),this._flags=this.create_flags(this._previous_flags,L),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ne.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Ke.Statement&&It(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},ne.prototype.start_of_object_property=function(){return this._flags.parent.mode===Ke.ObjectLiteral&&this._flags.mode===Ke.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"]))},ne.prototype.start_of_statement=function(L){var G=!1;return G=G||be(this._flags.last_token,["var","let","const"])&&L.type===j.WORD,G=G||he(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===Ke.ObjectLiteral&&this._flags.mode===Ke.Statement)&&be(this._flags.last_token,A)&&!L.newlines,G=G||he(this._flags.last_token,"else")&&!(he(L,"if")&&!L.comments_before),G=G||this._flags.last_token.type===j.END_EXPR&&(this._previous_flags.mode===Ke.ForInitializer||this._previous_flags.mode===Ke.Conditional),G=G||this._flags.last_token.type===j.WORD&&this._flags.mode===Ke.BlockStatement&&!this._flags.in_case&&!(L.text==="--"||L.text==="++")&&this._last_last_text!=="function"&&L.type!==j.WORD&&L.type!==j.RESERVED,G=G||this._flags.mode===Ke.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"])),G?(this.set_mode(Ke.Statement),this.indent(),this.handle_whitespace_and_comments(L,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L,be(L,["do","for","if","while"])),!0):!1},ne.prototype.handle_start_expr=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L);var G=Ke.Expression;if(L.text==="["){if(this._flags.last_token.type===j.WORD||this._flags.last_token.text===")"){be(this._flags.last_token,J)&&(this._output.space_before_token=!0),this.print_token(L),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=Ke.ArrayLiteral,z(this._flags.mode)&&(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline()),$(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,G=Ke.ForInitializer):$(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=Ke.Conditional):$(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&L.whitespace_before===""?this._output.space_before_token=!1:($(this._flags.last_token.text,J)||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(L);else if(this._flags.last_token.type===j.WORD){this._output.space_before_token=!1;var de=this._tokens.peek(-3);if(this._options.space_after_named_function&&de){var ze=this._tokens.peek(-4);be(de,["async","function"])||de.text==="*"&&be(ze,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Ke.ObjectLiteral?(de.text==="{"||de.text===","||de.text==="*"&&(ze.text==="{"||ze.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(L);(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===Ke.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(L,L.newlines),this.print_token(L),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},ne.prototype.handle_end_expr=function(L){for(;this._flags.mode===Ke.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(L,L.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(L),this.restore_mode(),It(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Ke.Conditional&&(this._previous_flags.mode=Ke.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},ne.prototype.handle_start_block=function(L){this.handle_whitespace_and_comments(L);var G=this._tokens.peek(),de=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===j.END_EXPR?(this.set_mode(Ke.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Ke.BlockStatement):de&&($(de.text,[":",","])&&$(G.type,[j.STRING,j.WORD,j.RESERVED])||$(G.text,["get","set","..."])&&$(de.type,[j.WORD,j.RESERVED]))?$(this._last_last_text,["class","interface"])&&!$(de.text,[":",","])?this.set_mode(Ke.BlockStatement):this.set_mode(Ke.ObjectLiteral):this._flags.last_token.type===j.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Ke.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(Ke.ObjectLiteral):this.set_mode(Ke.BlockStatement),this._flags.last_token&&be(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var ze=!G.comments_before&&G.text==="}",pt=ze&&this._flags.last_word==="function"&&this._flags.last_token.type===j.END_EXPR;if(this._options.brace_preserve_inline){var Ut=0,Ie=null;this._flags.inline_frame=!0;do if(Ut+=1,Ie=this._tokens.peek(Ut-1),Ie.newlines){this._flags.inline_frame=!1;break}while(Ie.type!==j.EOF&&!(Ie.type===j.END_BLOCK&&Ie.opened===L))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&L.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,Te)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(z(this._previous_flags.mode)&&(this._flags.last_token.type===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(L),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(L),this.indent(),!ze&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},ne.prototype.handle_end_block=function(L){for(this.handle_whitespace_and_comments(L);this._flags.mode===Ke.Statement;)this.restore_mode();var G=this._flags.last_token.type===j.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(z(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(L)},ne.prototype.handle_word=function(L){if(L.type===j.RESERVED){if($(L.text,["set","get"])&&this._flags.mode!==Ke.ObjectLiteral)L.type=j.WORD;else if(L.text==="import"&&$(this._tokens.peek().text,["(","."]))L.type=j.WORD;else if($(L.text,["as","from"])&&!this._flags.import_block)L.type=j.WORD;else if(this._flags.mode===Ke.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(L.type=j.WORD)}}if(this.start_of_statement(L)?be(this._flags.last_token,["var","let","const"])&&L.type===j.WORD&&(this._flags.declaration_statement=!0):L.newlines&&!Z(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(L),this.print_newline()):this.handle_whitespace_and_comments(L),this._flags.do_block&&!this._flags.do_while)if(he(L,"while")){this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&he(L,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Ke.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&be(L,["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(L),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===Ke.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(L),he(L,"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()&&!L.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,A)?this._output.space_before_token=!0:he(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===j.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(Z(this._flags.mode)||z(this._flags.mode))||this.print_newline(),this.print_token(L),this._flags.last_word=L.text;return}var de="NONE";if(this._flags.last_token.type===j.END_BLOCK?this._previous_flags.inline_frame?de="SPACE":be(L,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines?de="NEWLINE":(de="SPACE",this._output.space_before_token=!0):de="NEWLINE":this._flags.last_token.type===j.SEMICOLON&&this._flags.mode===Ke.BlockStatement?de="NEWLINE":this._flags.last_token.type===j.SEMICOLON&&Z(this._flags.mode)?de="SPACE":this._flags.last_token.type===j.STRING?de="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===Ke.ObjectLiteral&&$(this._last_last_text,["{",","]))?de="SPACE":this._flags.last_token.type===j.START_BLOCK?this._flags.inline_frame?de="SPACE":de="NEWLINE":this._flags.last_token.type===j.END_EXPR&&(this._output.space_before_token=!0,de="NEWLINE"),be(L,J)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?de="SPACE":de="NEWLINE"),be(L,["else","catch","finally"]))if((!(this._flags.last_token.type===j.END_BLOCK&&this._previous_flags.mode===Ke.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ze=this._output.current_line;ze.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else de==="NEWLINE"?be(this._flags.last_token,Te)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&be(L,["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(L,["var","let","const"]))&&this._flags.last_token.text!==":"&&(he(L,"if")&&he(L.previous,"else")?this._output.space_before_token=!0:this.print_newline()):be(L,J)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&z(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():de==="SPACE"&&(this._output.space_before_token=!0);L.previous&&(L.previous.type===j.WORD||L.previous.type===j.RESERVED)&&(this._output.space_before_token=!0),this.print_token(L),this._flags.last_word=L.text,L.type===j.RESERVED&&(L.text==="do"?this._flags.do_block=!0:L.text==="if"?this._flags.if_block=!0:L.text==="import"?this._flags.import_block=!0:this._flags.import_block&&he(L,"from")&&(this._flags.import_block=!1))},ne.prototype.handle_semicolon=function(L){this.start_of_statement(L)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(L);for(var G=this._tokens.peek();this._flags.mode===Ke.Statement&&!(this._flags.if_block&&he(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(L)},ne.prototype.handle_string=function(L){L.text.startsWith("`")&&L.newlines===0&&L.whitespace_before===""&&(L.previous.text===")"||this._flags.last_token.type===j.WORD)||(this.start_of_statement(L)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(L),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(L):L.text.startsWith("`")&&this._flags.last_token.type===j.END_EXPR&&(L.previous.text==="]"||L.previous.text===")")&&L.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(L)},ne.prototype.handle_equals=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0},ne.prototype.handle_comma=function(L){this.handle_whitespace_and_comments(L,!0),this.print_token(L),this._output.space_before_token=!0,this._flags.declaration_statement?(Z(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(L)):this._flags.mode===Ke.ObjectLiteral||this._flags.mode===Ke.Statement&&this._flags.parent.mode===Ke.ObjectLiteral?(this._flags.mode===Ke.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(L)},ne.prototype.handle_operator=function(L){var G=L.text==="*"&&(be(this._flags.last_token,["function","yield"])||$(this._flags.last_token.type,[j.START_BLOCK,j.COMMA,j.END_BLOCK,j.SEMICOLON])),de=$(L.text,["-","+"])&&($(this._flags.last_token.type,[j.START_BLOCK,j.START_EXPR,j.EQUALS,j.OPERATOR])||$(this._flags.last_token.text,J)||this._flags.last_token.text===",");if(!this.start_of_statement(L)){var ze=!G;this.handle_whitespace_and_comments(L,ze)}if(L.text==="*"&&this._flags.last_token.type===j.DOT){this.print_token(L);return}if(L.text==="::"){this.print_token(L);return}if($(L.text,["-","+"])&&this.start_of_object_property()){this.print_token(L);return}if(this._flags.last_token.type===j.OPERATOR&&$(this._options.operator_position,je)&&this.allow_wrap_or_preserved_newline(L),L.text===":"&&this._flags.in_case){this.print_token(L),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,Ut=!0,Ie=!1;if(L.text===":"?this._flags.ternary_depth===0?pt=!1:(this._flags.ternary_depth-=1,Ie=!0):L.text==="?"&&(this._flags.ternary_depth+=1),!de&&!G&&this._options.preserve_newlines&&$(L.text,H)){var Yt=L.text===":",Pt=Yt&&Ie,St=Yt&&!Ie;switch(this._options.operator_position){case Ee.before_newline:this._output.space_before_token=!St,this.print_token(L),(!Yt||Pt)&&this.allow_wrap_or_preserved_newline(L),this._output.space_before_token=!0;return;case Ee.after_newline:this._output.space_before_token=!0,!Yt||Pt?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(L):this._output.space_before_token=!1,this.print_token(L),this._output.space_before_token=!0;return;case Ee.preserve_newline:St||this.allow_wrap_or_preserved_newline(L),pt=!(this._output.just_added_newline()||St),this._output.space_before_token=pt,this.print_token(L),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(L),pt=!1;var $e=this._tokens.peek();Ut=$e&&$($e.type,[j.WORD,j.RESERVED])}else if(L.text==="...")this.allow_wrap_or_preserved_newline(L),pt=this._flags.last_token.type===j.START_BLOCK,Ut=!1;else if($(L.text,["--","++","!","~"])||de){if((this._flags.last_token.type===j.COMMA||this._flags.last_token.type===j.START_EXPR)&&this.allow_wrap_or_preserved_newline(L),pt=!1,Ut=!1,L.newlines&&(L.text==="--"||L.text==="++"||L.text==="~")){var it=be(this._flags.last_token,Te)&&L.newlines;it&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(it,!0)}this._flags.last_token.text===";"&&Z(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==="]"&&(L.text==="--"||L.text==="++")):this._flags.last_token.type===j.OPERATOR&&(pt=$(L.text,["--","-","++","+"])&&$(this._flags.last_token.text,["--","-","++","+"]),$(L.text,["+","-"])&&$(this._flags.last_token.text,["--","++"])&&(Ut=!0)),(this._flags.mode===Ke.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Ke.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||pt,this.print_token(L),this._output.space_before_token=Ut},ne.prototype.handle_block_comment=function(L,G){if(this._output.raw){this._output.add_raw_token(L),L.directives&&L.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(L.directives){this.print_newline(!1,G),this.print_token(L),L.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!T.newline.test(L.text)&&!L.newlines){this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0;return}else this.print_block_commment(L,G)},ne.prototype.print_block_commment=function(L,G){var de=ee(L.text),ze,pt=!1,Ut=!1,Ie=L.whitespace_before,Yt=Ie.length;if(this.print_newline(!1,G),this.print_token_line_indentation(L),this._output.add_token(de[0]),this.print_newline(!1,G),de.length>1){for(de=de.slice(1),pt=Q(de,"*"),Ut=fe(de,Ie),pt&&(this._flags.alignment=1),ze=0;ze<de.length;ze++)pt?(this.print_token_line_indentation(L),this._output.add_token(B(de[ze]))):Ut&&de[ze]?(this.print_token_line_indentation(L),this._output.add_token(de[ze].substring(Yt))):(this._output.current_line.set_indent(-1),this._output.add_token(de[ze])),this.print_newline(!1,G);this._flags.alignment=0}},ne.prototype.handle_comment=function(L,G){L.newlines?this.print_newline(!1,G):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(L),this.print_newline(!1,G)},ne.prototype.handle_dot=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),be(this._flags.last_token,Te)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(L,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(L)},ne.prototype.handle_unknown=function(L,G){this.print_token(L),L.text[L.text.length-1]===`
|
|
|
`&&this.print_newline(!1,G)},ne.prototype.handle_eof=function(L){for(;this._flags.mode===Ke.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L)},P.exports.Beautifier=ne},function(P){function f(k){this.__parent=k,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}f.prototype.clone_empty=function(){var k=new f(this.__parent);return k.set_indent(this.__indent_count,this.__alignment_count),k},f.prototype.item=function(k){return k<0?this.__items[this.__items.length+k]:this.__items[k]},f.prototype.has_match=function(k){for(var T=this.__items.length-1;T>=0;T--)if(this.__items[T].match(k))return!0;return!1},f.prototype.set_indent=function(k,T){this.is_empty()&&(this.__indent_count=k||0,this.__alignment_count=T||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},f.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},f.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var k=this.__parent.current_line;return k.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),k.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),k.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,k.__items[0]===" "&&(k.__items.splice(0,1),k.__character_count-=1),!0}return!1},f.prototype.is_empty=function(){return this.__items.length===0},f.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},f.prototype.push=function(k){this.__items.push(k);var T=k.lastIndexOf(`
|
|
|
`);T!==-1?this.__character_count=k.length-T:this.__character_count+=k.length},f.prototype.pop=function(){var k=null;return this.is_empty()||(k=this.__items.pop(),this.__character_count-=k.length),k},f.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},f.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},f.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},f.prototype.toString=function(){var k="";return this.is_empty()?this.__parent.indent_empty_lines&&(k=this.__parent.get_indent_string(this.__indent_count)):(k=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),k+=this.__items.join("")),k};function ie(k,T){this.__cache=[""],this.__indent_size=k.indent_size,this.__indent_string=k.indent_char,k.indent_with_tabs||(this.__indent_string=new Array(k.indent_size+1).join(k.indent_char)),T=T||"",k.indent_level>0&&(T=new Array(k.indent_level+1).join(this.__indent_string)),this.__base_string=T,this.__base_string_length=T.length}ie.prototype.get_indent_size=function(k,T){var C=this.__base_string_length;return T=T||0,k<0&&(C=0),C+=k*this.__indent_size,C+=T,C},ie.prototype.get_indent_string=function(k,T){var C=this.__base_string;return T=T||0,k<0&&(k=0,C=""),T+=k*this.__indent_size,this.__ensure_cache(T),C+=this.__cache[T],C},ie.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},ie.prototype.__add_column=function(){var k=this.__cache.length,T=0,C="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,C=new Array(T+1).join(this.__indent_string)),k&&(C+=new Array(k+1).join(" ")),this.__cache.push(C)};function I(k,T){this.__indent_cache=new ie(k,T),this.raw=!1,this._end_with_newline=k.end_with_newline,this.indent_size=k.indent_size,this.wrap_line_length=k.wrap_line_length,this.indent_empty_lines=k.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}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 C=this.__lines.join(`
|
|
|
`);return k!==`
|
|
|
`&&(C=C.replace(/[\n]/g,k)),C},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 C=this.__lines.length-2;C>=0;){var O=this.__lines[C];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(C+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}C--}},P.exports.Output=I},function(P){function f(ie,I,k,T){this.type=ie,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 ie="\\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",C="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",O="(?:"+C+"|["+ie+k+"])",J="(?:"+C+"|["+I+k+T+"])*";f.identifier=new RegExp(O+J,"g"),f.identifierStart=new RegExp(O),f.identifierMatch=new RegExp("(?:"+C+"|["+I+k+T+"])+");var H=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;f.newline=/[\n\r\u2028\u2029]/,f.lineBreak=new RegExp(`\r
|
|
|
|`+f.newline.source),f.allLineBreaks=new RegExp(f.lineBreak.source,"g")},function(P,f,ie){var I=ie(6).Options,k=["before-newline","after-newline","preserve-newline"];function T(C){I.call(this,C,"js");var O=this.raw_options.brace_style||null;O==="expand-strict"?this.raw_options.brace_style="expand":O==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var J=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var H=0;H<J.length;H++)J[H]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=J[H];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",k),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}T.prototype=new I,P.exports.Options=T},function(P){function f(k,T){this.raw_options=ie(k,T),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}f.prototype._get_array=function(k,T){var C=this.raw_options[k],O=T||[];return typeof C=="object"?C!==null&&typeof C.concat=="function"&&(O=C.concat()):typeof C=="string"&&(O=C.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var C=this.raw_options[k],O=C===void 0?!!T:!!C;return O},f.prototype._get_characters=function(k,T){var C=this.raw_options[k],O=T||"";return typeof C=="string"&&(O=C.replace(/\\r/,"\r").replace(/\\n/,`
|
|
|
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var C=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(C,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,C){var O=this._get_selection_list(k,T,C);if(O.length!==1)throw new Error("Invalid Option Value: The option '"+k+`' can only be one of the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O[0]},f.prototype._get_selection_list=function(k,T,C){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(C=C||[T[0]],!this._is_valid_selection(C,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,C);if(!this._is_valid_selection(O,T))throw new Error("Invalid Option Value: The option '"+k+`' can contain only the following values:
|
|
|
`+T+`
|
|
|
You passed in: '`+this.raw_options[k]+"'");return O},f.prototype._is_valid_selection=function(k,T){return k.length&&T.length&&!k.some(function(C){return T.indexOf(C)===-1})};function ie(k,T){var C={};k=I(k);var O;for(O in k)O!==T&&(C[O]=k[O]);if(T&&k[T])for(O in k[T])C[O]=k[T][O];return C}function I(k){var T={},C;for(C in k){var O=C.replace(/-/g,"_");T[O]=k[C]}return T}P.exports.Options=f,P.exports.normalizeOpts=I,P.exports.mergeOpts=ie},function(P,f,ie){var I=ie(8).InputScanner,k=ie(9).Tokenizer,T=ie(9).TOKEN,C=ie(13).Directives,O=ie(4),J=ie(12).Pattern,H=ie(14).TemplatablePattern;function j(Q,fe){return fe.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},B=new C(/\/\*/,/\*\//),V=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,he=/[0-9]/,be=/[^\d\.]/,Te=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),se=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";se=se.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),se="\\?\\.(?!\\d) "+se,se=se.replace(/ /g,"|");var Ee=new RegExp(se),je="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Ke=je.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),It=new RegExp("^(?:"+Ke.join("|")+")$"),ee,z=function(Q,fe){k.call(this,Q,fe),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var ne=new J(this._input),A=new H(this._input).read_options(this._options);this.__patterns={template:A,identifier:A.starting_with(O.identifier).matching(O.identifierMatch),number:ne.matching(V),punct:ne.matching(Ee),comment:ne.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:ne.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:ne.matching(/<!--/),html_comment_end:ne.matching(/-->/),include:ne.starting_with(/#include/).until_after(O.lineBreak),shebang:ne.starting_with(/#!/).until_after(O.lineBreak),xml:ne.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:A.until(/['\\\n\r\u2028\u2029]/),double_quote:A.until(/["\\\n\r\u2028\u2029]/),template_text:A.until(/[`\\$]/),template_expression:A.until(/[`}\\]/)}};z.prototype=new k,z.prototype._is_comment=function(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,fe){return(Q.type===$.END_BLOCK||Q.type===$.END_EXPR)&&fe&&(Q.text==="]"&&fe.text==="["||Q.text===")"&&fe.text==="("||Q.text==="}"&&fe.text==="{")},z.prototype._reset=function(){ee=!1},z.prototype._get_next_token=function(Q,fe){var ne=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token($.EOF,""):(ne=ne||this._read_non_javascript(A),ne=ne||this._read_string(A),ne=ne||this._read_pair(A,this._input.peek(1)),ne=ne||this._read_word(Q),ne=ne||this._read_singles(A),ne=ne||this._read_comment(A),ne=ne||this._read_regexp(A,Q),ne=ne||this._read_xml(A,Q),ne=ne||this._read_punctuation(),ne=ne||this._create_token($.UNKNOWN,this._input.next()),ne)},z.prototype._read_word=function(Q){var fe;if(fe=this.__patterns.identifier.read(),fe!=="")return fe=fe.replace(O.allLineBreaks,`
|
|
|
`),!(Q.type===$.DOT||Q.type===$.RESERVED&&(Q.text==="set"||Q.text==="get"))&&It.test(fe)?(fe==="in"||fe==="of")&&(Q.type===$.WORD||Q.type===$.STRING)?this._create_token($.OPERATOR,fe):this._create_token($.RESERVED,fe):this._create_token($.WORD,fe);if(fe=this.__patterns.number.read(),fe!=="")return this._create_token($.WORD,fe)},z.prototype._read_singles=function(Q){var fe=null;return Q==="("||Q==="["?fe=this._create_token($.START_EXPR,Q):Q===")"||Q==="]"?fe=this._create_token($.END_EXPR,Q):Q==="{"?fe=this._create_token($.START_BLOCK,Q):Q==="}"?fe=this._create_token($.END_BLOCK,Q):Q===";"?fe=this._create_token($.SEMICOLON,Q):Q==="."&&be.test(this._input.peek(1))?fe=this._create_token($.DOT,Q):Q===","&&(fe=this._create_token($.COMMA,Q)),fe&&this._input.next(),fe},z.prototype._read_pair=function(Q,fe){var ne=null;return Q==="#"&&fe==="{"&&(ne=this._create_token($.START_BLOCK,Q+fe)),ne&&(this._input.next(),this._input.next()),ne},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 fe="";if(Q==="#"){if(this._is_first_token()&&(fe=this.__patterns.shebang.read(),fe))return this._create_token($.UNKNOWN,fe.trim()+`
|
|
|
`);if(fe=this.__patterns.include.read(),fe)return this._create_token($.UNKNOWN,fe.trim()+`
|
|
|
`);Q=this._input.next();var ne="#";if(this._input.hasNext()&&this._input.testChar(he)){do Q=this._input.next(),ne+=Q;while(this._input.hasNext()&&Q!=="#"&&Q!=="=");return Q==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(ne+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(ne+="{}",this._input.next(),this._input.next())),this._create_token($.WORD,ne)}this._input.back()}else if(Q==="<"&&this._is_first_token()){if(fe=this.__patterns.html_comment_start.read(),fe){for(;this._input.hasNext()&&!this._input.testChar(O.newline);)fe+=this._input.next();return ee=!0,this._create_token($.COMMENT,fe)}}else if(ee&&Q==="-"&&(fe=this.__patterns.html_comment_end.read(),fe))return ee=!1,this._create_token($.COMMENT,fe);return null},z.prototype._read_comment=function(Q){var fe=null;if(Q==="/"){var ne="";if(this._input.peek(1)==="*"){ne=this.__patterns.block_comment.read();var A=B.get_directives(ne);A&&A.ignore==="start"&&(ne+=B.readIgnored(this._input)),ne=ne.replace(O.allLineBreaks,`
|
|
|
`),fe=this._create_token($.BLOCK_COMMENT,ne),fe.directives=A}else this._input.peek(1)==="/"&&(ne=this.__patterns.comment.read(),fe=this._create_token($.COMMENT,ne))}return fe},z.prototype._read_string=function(Q){if(Q==="`"||Q==="'"||Q==='"'){var fe=this._input.next();return this.has_char_escapes=!1,Q==="`"?fe+=this._read_string_recursive("`",!0,"${"):fe+=this._read_string_recursive(Q),this.has_char_escapes&&this._options.unescape_strings&&(fe=Z(fe)),this._input.peek()===Q&&(fe+=this._input.next()),fe=fe.replace(O.allLineBreaks,`
|
|
|
`),this._create_token($.STRING,fe)}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,fe){if(Q==="/"&&this._allow_regexp_or_xml(fe)){for(var ne=this._input.next(),A=!1,L=!1;this._input.hasNext()&&(A||L||this._input.peek()!==Q)&&!this._input.testChar(O.newline);)ne+=this._input.peek(),A?A=!1:(A=this._input.peek()==="\\",this._input.peek()==="["?L=!0:this._input.peek()==="]"&&(L=!1)),this._input.next();return this._input.peek()===Q&&(ne+=this._input.next(),ne+=this._input.read(O.identifier)),this._create_token($.STRING,ne)}return null},z.prototype._read_xml=function(Q,fe){if(this._options.e4x&&Q==="<"&&this._allow_regexp_or_xml(fe)){var ne="",A=this.__patterns.xml.read_match();if(A){for(var L=A[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=L.indexOf("{")===0,de=0;A;){var ze=!!A[1],pt=A[2],Ut=!!A[A.length-1]||pt.slice(0,8)==="![CDATA[";if(!Ut&&(pt===L||G&&pt.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ze?--de:++de),ne+=A[0],de<=0)break;A=this.__patterns.xml.read_match()}return A||(ne+=this._input.match(/[\s\S]*/g)[0]),ne=ne.replace(O.allLineBreaks,`
|
|
|
`),this._create_token($.STRING,ne)}}return null};function Z(Q){for(var fe="",ne=0,A=new I(Q),L=null;A.hasNext();)if(L=A.match(/([\s]|[^\\]|\\\\)+/g),L&&(fe+=L[0]),A.peek()==="\\"){if(A.next(),A.peek()==="x")L=A.match(/x([0-9A-Fa-f]{2})/g);else if(A.peek()==="u")L=A.match(/u([0-9A-Fa-f]{4})/g),L||(L=A.match(/u\{([0-9A-Fa-f]+)\}/g));else{fe+="\\",A.hasNext()&&(fe+=A.next());continue}if(!L||(ne=parseInt(L[1],16),ne>126&&ne<=255&&L[0].indexOf("x")===0))return Q;ne>=0&&ne<32||ne>1114111?fe+="\\"+L[0]:ne===34||ne===39||ne===92?fe+="\\"+String.fromCharCode(ne):fe+=String.fromCharCode(ne)}return fe}z.prototype._read_string_recursive=function(Q,fe,ne){var A,L;Q==="'"?L=this.__patterns.single_quote:Q==='"'?L=this.__patterns.double_quote:Q==="`"?L=this.__patterns.template_text:Q==="}"&&(L=this.__patterns.template_expression);for(var G=L.read(),de="";this._input.hasNext();){if(de=this._input.next(),de===Q||!fe&&O.newline.test(de)){this._input.back();break}else de==="\\"&&this._input.hasNext()?(A=this._input.peek(),A==="x"||A==="u"?this.has_char_escapes=!0:A==="\r"&&this._input.peek(1)===`
|
|
|
`&&this._input.next(),de+=this._input.next()):ne&&(ne==="${"&&de==="$"&&this._input.peek()==="{"&&(de+=this._input.next()),ne===de&&(Q==="`"?de+=this._read_string_recursive("}",fe,"`"):de+=this._read_string_recursive("`",fe,"${"),this._input.hasNext()&&(de+=this._input.next())));de+=L.read(),G+=de}return G},P.exports.Tokenizer=z,P.exports.TOKEN=$,P.exports.positionable_operators=Te.slice(),P.exports.line_starters=je.slice()},function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function ie(I){this.__input=I||"",this.__input_length=this.__input.length,this.__position=0}ie.prototype.restart=function(){this.__position=0},ie.prototype.back=function(){this.__position>0&&(this.__position-=1)},ie.prototype.hasNext=function(){return this.__position<this.__input_length},ie.prototype.next=function(){var I=null;return this.hasNext()&&(I=this.__input.charAt(this.__position),this.__position+=1),I},ie.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},ie.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},ie.prototype.test=function(I,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(I,k):!1},ie.prototype.testChar=function(I,k){var T=this.peek(k);return I.lastIndex=0,T!==null&&I.test(T)},ie.prototype.match=function(I){var k=this.__match(I,this.__position);return k?this.__position+=k[0].length:k=null,k},ie.prototype.read=function(I,k,T){var C="",O;return I&&(O=this.match(I),O&&(C+=O[0])),k&&(O||!I)&&(C+=this.readUntil(k,T)),C},ie.prototype.readUntil=function(I,k){var T="",C=this.__position;I.lastIndex=this.__position;var O=I.exec(this.__input);return O?(C=O.index,k&&(C+=O[0].length)):C=this.__input_length,T=this.__input.substring(this.__position,C),this.__position=C,T},ie.prototype.readUntilAfter=function(I){return this.readUntil(I,!0)},ie.prototype.get_regexp=function(I,k){var T=null,C="g";return k&&f&&(C="y"),typeof I=="string"&&I!==""?T=new RegExp(I,C):I&&(T=new RegExp(I.source,C)),T},ie.prototype.get_literal_regexp=function(I){return RegExp(I.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ie.prototype.peekUntilAfter=function(I){var k=this.__position,T=this.readUntilAfter(I);return this.__position=k,T},ie.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=ie},function(P,f,ie){var I=ie(8).InputScanner,k=ie(3).Token,T=ie(10).TokenStream,C=ie(11).WhitespacePattern,O={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},J=function(H,j){this._input=new I(H),this._options=j||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new C(this._input)};J.prototype.tokenize=function(){this._input.restart(),this.__tokens=new T,this._reset();for(var H,j=new k(O.START,""),$=null,B=[],V=new T;j.type!==O.EOF;){for(H=this._get_next_token(j,$);this._is_comment(H);)V.add(H),H=this._get_next_token(j,$);V.isEmpty()||(H.comments_before=V,V=new T),H.parent=$,this._is_opening(H)?(B.push($),$=H):$&&this._is_closing(H,$)&&(H.opened=$,$.closed=H,$=B.pop(),H.parent=$),H.previous=j,j.next=H,this.__tokens.add(H),j=H}return this.__tokens},J.prototype._is_first_token=function(){return this.__tokens.isEmpty()},J.prototype._reset=function(){},J.prototype._get_next_token=function(H,j){this._readWhitespace();var $=this._input.read(/.+/g);return $?this._create_token(O.RAW,$):this._create_token(O.EOF,"")},J.prototype._is_comment=function(H){return!1},J.prototype._is_opening=function(H){return!1},J.prototype._is_closing=function(H,j){return!1},J.prototype._create_token=function(H,j){var $=new k(H,j,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return $},J.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=J,P.exports.TOKEN=O},function(P){function f(ie){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=ie}f.prototype.restart=function(){this.__position=0},f.prototype.isEmpty=function(){return this.__tokens_length===0},f.prototype.hasNext=function(){return this.__position<this.__tokens_length},f.prototype.next=function(){var ie=null;return this.hasNext()&&(ie=this.__tokens[this.__position],this.__position+=1),ie},f.prototype.peek=function(ie){var I=null;return ie=ie||0,ie+=this.__position,ie>=0&&ie<this.__tokens_length&&(I=this.__tokens[ie]),I},f.prototype.add=function(ie){this.__parent_token&&(ie.parent=this.__parent_token),this.__tokens.push(ie),this.__tokens_length+=1},P.exports.TokenStream=f},function(P,f,ie){var I=ie(12).Pattern;function k(T,C){I.call(this,T,C),C?this._line_regexp=this._input.get_regexp(C._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}k.prototype=new I,k.prototype.__set_whitespace_patterns=function(T,C){T+="\\t ",C+="\\n\\r",this._match_pattern=this._input.get_regexp("["+T+C+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+C+"]")},k.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var T=this._input.read(this._match_pattern);if(T===" ")this.whitespace_before_token=" ";else if(T){var C=this.__split(this._newline_regexp,T);this.newline_count=C.length-1,this.whitespace_before_token=C[this.newline_count]}return T},k.prototype.matching=function(T,C){var O=this._create();return O.__set_whitespace_patterns(T,C),O._update(),O},k.prototype._create=function(){return new k(this._input,this)},k.prototype.__split=function(T,C){T.lastIndex=0;for(var O=0,J=[],H=T.exec(C);H;)J.push(C.substring(O,H.index)),O=H.index+H[0].length,H=T.exec(C);return O<C.length?J.push(C.substring(O,C.length)):J.push(""),J},P.exports.WhitespacePattern=k},function(P){function f(ie,I){this._input=ie,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 ie=this._input.read(this._starting_pattern);return(!this._starting_pattern||ie)&&(ie+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),ie},f.prototype.read_match=function(){return this._input.match(this._match_pattern)},f.prototype.until_after=function(ie){var I=this._create();return I._until_after=!0,I._until_pattern=this._input.get_regexp(ie),I._update(),I},f.prototype.until=function(ie){var I=this._create();return I._until_after=!1,I._until_pattern=this._input.get_regexp(ie),I._update(),I},f.prototype.starting_with=function(ie){var I=this._create();return I._starting_pattern=this._input.get_regexp(ie,!0),I._update(),I},f.prototype.matching=function(ie){var I=this._create();return I._match_pattern=this._input.get_regexp(ie,!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(ie,I){ie=typeof ie=="string"?ie:ie.source,I=typeof I=="string"?I:I.source,this.__directives_block_pattern=new RegExp(ie+/ beautify( \w+[:]\w+)+ /.source+I,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(ie+/\sbeautify\signore:end\s/.source+I,"g")}f.prototype.get_directives=function(ie){if(!ie.match(this.__directives_block_pattern))return null;var I={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(ie);k;)I[k[1]]=k[2],k=this.__directive_pattern.exec(ie);return I},f.prototype.readIgnored=function(ie){return ie.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},function(P,f,ie){var I=ie(12).Pattern,k={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function T(C,O){I.call(this,C,O),this.__template_pattern=null,this._disabled=Object.assign({},k),this._excluded=Object.assign({},k),O&&(this.__template_pattern=this._input.get_regexp(O.__template_pattern),this._excluded=Object.assign(this._excluded,O._excluded),this._disabled=Object.assign(this._disabled,O._disabled));var J=new I(C);this.__patterns={handlebars_comment:J.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:J.starting_with(/{{{/).until_after(/}}}/),handlebars:J.starting_with(/{{/).until_after(/}}/),php:J.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:J.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:J.starting_with(/{%/).until_after(/%}/),django_value:J.starting_with(/{{/).until_after(/}}/),django_comment:J.starting_with(/{#/).until_after(/#}/),smarty:J.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:J.starting_with(/{\*/).until_after(/\*}/),smarty_literal:J.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(C){var O=this._create();return O._disabled[C]=!0,O._update(),O},T.prototype.read_options=function(C){var O=this._create();for(var J in k)O._disabled[J]=C.templating.indexOf(J)===-1;return O._update(),O},T.prototype.exclude=function(C){var O=this._create();return O._excluded[C]=!0,O._update(),O},T.prototype.read=function(){var C="";this._match_pattern?C=this._input.read(this._starting_pattern):C=this._input.read(this._starting_pattern,this.__template_pattern);for(var O=this._read_template();O;)this._match_pattern?O+=this._input.read(this._match_pattern):O+=this._input.readUntil(this.__template_pattern),C+=O,O=this._read_template();return this._until_after&&(C+=this._input.readUntilAfter(this._until_pattern)),C},T.prototype.__set_templated_pattern=function(){var C=[];this._disabled.php||C.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||C.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(C.push(this.__patterns.django._starting_pattern.source),C.push(this.__patterns.django_value._starting_pattern.source),C.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||C.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&C.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+C.join("|")+")")},T.prototype._read_template=function(){var C="",O=this._input.peek();if(O==="<"){var J=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&J==="?"&&(C=C||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&J==="%"&&(C=C||this.__patterns.erb.read())}else O==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(C=C||this.__patterns.handlebars_comment.read(),C=C||this.__patterns.handlebars_unescaped.read(),C=C||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(C=C||this.__patterns.django_value.read()),this._excluded.django||(C=C||this.__patterns.django_comment.read(),C=C||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(C=C||this.__patterns.smarty_comment.read(),C=C||this.__patterns.smarty_literal.read(),C=C||this.__patterns.smarty.read()));return C},P.exports.TemplatablePattern=T}],X={};function w(P){var f=X[P];if(f!==void 0)return f.exports;var ie=X[P]={exports:{}};return pe[P](ie,ie.exports,w),ie.exports}var Ae=w(0);we=Ae})();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 ke=0;ke<xe.length;ke++){var K=xe[ke];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(De,K.key,K)}}function re(De,xe,ke){return xe&&Ft(De.prototype,xe),ke&&Ft(De,ke),De}function ue(De,xe){if(De){if(typeof De=="string")return we(De,xe);var ke=Object.prototype.toString.call(De).slice(8,-1);if(ke==="Object"&&De.constructor&&(ke=De.constructor.name),ke==="Map"||ke==="Set")return Array.from(De);if(ke==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ke))return we(De,xe)}}function we(De,xe){(xe==null||xe>De.length)&&(xe=De.length);for(var ke=0,K=new Array(xe);ke<xe;ke++)K[ke]=De[ke];return K}function Ye(De,xe){var ke=typeof Symbol!="undefined"&&De[Symbol.iterator]||De["@@iterator"];if(ke)return(ke=ke.call(De)).next.bind(ke);if(Array.isArray(De)||(ke=ue(De))||xe&&De&&typeof De.length=="number"){ke&&(De=ke);var K=0;return function(){return K>=De.length?{done:!0}:{done:!1,value:De[K++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var pe={exports:{}};function X(){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){pe.exports.defaults=De}pe.exports={defaults:X(),getDefaults:X,changeDefaults:w};var Ae=/[&<>"']/,P=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,ie=/[<>"']|&(?!#?\w+;)/g,I={"&":"&","<":"<",">":">",'"':""","'":"'"},k=function(xe){return I[xe]};function T(De,xe){if(xe){if(Ae.test(De))return De.replace(P,k)}else if(f.test(De))return De.replace(ie,k);return De}var C=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function O(De){return De.replace(C,function(xe,ke){return ke=ke.toLowerCase(),ke==="colon"?":":ke.charAt(0)==="#"?ke.charAt(1)==="x"?String.fromCharCode(parseInt(ke.substring(2),16)):String.fromCharCode(+ke.substring(1)):""})}var J=/(^|[^\[])\^/g;function H(De,xe){De=De.source||De,xe=xe||"";var ke={replace:function(W,ae){return ae=ae.source||ae,ae=ae.replace(J,"$1"),De=De.replace(W,ae),ke},getRegex:function(){return new RegExp(De,xe)}};return ke}var j=/[^\w:]/g,$=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function B(De,xe,ke){if(De){var K;try{K=decodeURIComponent(O(ke)).replace(j,"").toLowerCase()}catch(W){return null}if(K.indexOf("javascript:")===0||K.indexOf("vbscript:")===0||K.indexOf("data:")===0)return null}xe&&!$.test(ke)&&(ke=se(xe,ke));try{ke=encodeURI(ke).replace(/%25/g,"%")}catch(W){return null}return ke}var V={},he=/^[^:]+:\/*[^/]*$/,be=/^([^:]+:)[\s\S]*$/,Te=/^([^:]+:\/*[^/]*)[\s\S]*$/;function se(De,xe){V[" "+De]||(he.test(De)?V[" "+De]=De+"/":V[" "+De]=It(De,"/",!0)),De=V[" "+De];var ke=De.indexOf(":")===-1;return xe.substring(0,2)==="//"?ke?xe:De.replace(be,"$1")+xe:xe.charAt(0)==="/"?ke?xe:De.replace(Te,"$1")+xe:De+xe}var Ee={exec:function(){}};function je(De){for(var xe=1,ke,K;xe<arguments.length;xe++){ke=arguments[xe];for(K in ke)Object.prototype.hasOwnProperty.call(ke,K)&&(De[K]=ke[K])}return De}function Ke(De,xe){var ke=De.replace(/\|/g,function(ae,ce,ve){for(var ft=!1,yt=ce;--yt>=0&&ve[yt]==="\\";)ft=!ft;return ft?"|":" |"}),K=ke.split(/ \|/),W=0;if(K.length>xe)K.splice(xe);else for(;K.length<xe;)K.push("");for(;W<K.length;W++)K[W]=K[W].trim().replace(/\\\|/g,"|");return K}function It(De,xe,ke){var K=De.length;if(K===0)return"";for(var W=0;W<K;){var ae=De.charAt(K-W-1);if(ae===xe&&!ke)W++;else if(ae!==xe&&ke)W++;else break}return De.substr(0,K-W)}function ee(De,xe){if(De.indexOf(xe[1])===-1)return-1;for(var ke=De.length,K=0,W=0;W<ke;W++)if(De[W]==="\\")W++;else if(De[W]===xe[0])K++;else if(De[W]===xe[1]&&(K--,K<0))return W;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 Z(De,xe){if(xe<1)return"";for(var ke="";xe>1;)xe&1&&(ke+=De),xe>>=1,De+=De;return ke+De}var Q={escape:T,unescape:O,edit:H,cleanUrl:B,resolveUrl:se,noopTest:Ee,merge:je,splitCells:Ke,rtrim:It,findClosingBracket:ee,checkSanitizeDeprecation:z,repeatString:Z},fe=pe.exports.defaults,ne=Q.rtrim,A=Q.splitCells,L=Q.escape,G=Q.findClosingBracket;function de(De,xe,ke){var K=xe.href,W=xe.title?L(xe.title):null,ae=De[1].replace(/\\([\[\]])/g,"$1");return De[0].charAt(0)!=="!"?{type:"link",raw:ke,href:K,title:W,text:ae}:{type:"image",raw:ke,href:K,title:W,text:L(ae)}}function ze(De,xe){var ke=De.match(/^(\s+)(?:```)/);if(ke===null)return xe;var K=ke[1];return xe.split(`
|
|
|
`).map(function(W){var ae=W.match(/^\s+/);if(ae===null)return W;var ce=ae[0];return ce.length>=K.length?W.slice(K.length):W}).join(`
|
|
|
`)}var pt=function(){function De(ke){this.options=ke||fe}var xe=De.prototype;return xe.space=function(K){var W=this.rules.block.newline.exec(K);if(W)return W[0].length>1?{type:"space",raw:W[0]}:{raw:`
|
|
|
`}},xe.code=function(K){var W=this.rules.block.code.exec(K);if(W){var ae=W[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:W[0],codeBlockStyle:"indented",text:this.options.pedantic?ae:ne(ae,`
|
|
|
`)}}},xe.fences=function(K){var W=this.rules.block.fences.exec(K);if(W){var ae=W[0],ce=ze(ae,W[3]||"");return{type:"code",raw:ae,lang:W[2]?W[2].trim():W[2],text:ce}}},xe.heading=function(K){var W=this.rules.block.heading.exec(K);if(W){var ae=W[2].trim();if(/#$/.test(ae)){var ce=ne(ae,"#");(this.options.pedantic||!ce||/ $/.test(ce))&&(ae=ce.trim())}return{type:"heading",raw:W[0],depth:W[1].length,text:ae}}},xe.nptable=function(K){var W=this.rules.block.nptable.exec(K);if(W){var ae={type:"table",header:A(W[1].replace(/^ *| *\| *$/g,"")),align:W[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:W[3]?W[3].replace(/\n$/,"").split(`
|
|
|
`):[],raw:W[0]};if(ae.header.length===ae.align.length){var ce=ae.align.length,ve;for(ve=0;ve<ce;ve++)/^ *-+: *$/.test(ae.align[ve])?ae.align[ve]="right":/^ *:-+: *$/.test(ae.align[ve])?ae.align[ve]="center":/^ *:-+ *$/.test(ae.align[ve])?ae.align[ve]="left":ae.align[ve]=null;for(ce=ae.cells.length,ve=0;ve<ce;ve++)ae.cells[ve]=A(ae.cells[ve],ae.header.length);return ae}}},xe.hr=function(K){var W=this.rules.block.hr.exec(K);if(W)return{type:"hr",raw:W[0]}},xe.blockquote=function(K){var W=this.rules.block.blockquote.exec(K);if(W){var ae=W[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:W[0],text:ae}}},xe.list=function(K){var W=this.rules.block.list.exec(K);if(W){var ae=W[0],ce=W[2],ve=ce.length>1,ft={type:"list",raw:ae,ordered:ve,start:ve?+ce.slice(0,-1):"",loose:!1,items:[]},yt=W[0].match(this.rules.block.item),ut=!1,Vt,ii,mi,ni,Dt,oi,Mi,ki,Bi,gi=yt.length;mi=this.rules.block.listItemStart.exec(yt[0]);for(var fi=0;fi<gi;fi++){if(Vt=yt[fi],ae=Vt,this.options.pedantic||(Bi=Vt.match(new RegExp("\\n\\s*\\n {0,"+(mi[0].length-1)+"}\\S")),Bi&&(Dt=Vt.length-Bi.index+yt.slice(fi+1).join(`
|
|
|
`).length,ft.raw=ft.raw.substring(0,ft.raw.length-Dt),Vt=Vt.substring(0,Bi.index),ae=Vt,gi=fi+1)),fi!==gi-1){if(ni=this.rules.block.listItemStart.exec(yt[fi+1]),this.options.pedantic?ni[1].length>mi[1].length:ni[1].length>=mi[0].length||ni[1].length>3){yt.splice(fi,2,yt[fi]+(!this.options.pedantic&&ni[1].length<mi[0].length&&!yt[fi].match(/\n$/)?"":`
|
|
|
`)+yt[fi+1]),fi--,gi--;continue}else(!this.options.pedantic||this.options.smartLists?ni[2][ni[2].length-1]!==ce[ce.length-1]:ve===(ni[2].length===1))&&(Dt=yt.slice(fi+1).join(`
|
|
|
`).length,ft.raw=ft.raw.substring(0,ft.raw.length-Dt),fi=gi-1);mi=ni}ii=Vt.length,Vt=Vt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~Vt.indexOf(`
|
|
|
`)&&(ii-=Vt.length,Vt=this.options.pedantic?Vt.replace(/^ {1,4}/gm,""):Vt.replace(new RegExp("^ {1,"+ii+"}","gm"),"")),Vt=ne(Vt,`
|
|
|
`),fi!==gi-1&&(ae=ae+`
|
|
|
`),oi=ut||/\n\n(?!\s*$)/.test(ae),fi!==gi-1&&(ut=ae.slice(-2)===`
|
|
|
|
|
|
`,oi||(oi=ut)),oi&&(ft.loose=!0),this.options.gfm&&(Mi=/^\[[ xX]\] /.test(Vt),ki=void 0,Mi&&(ki=Vt[1]!==" ",Vt=Vt.replace(/^\[[ xX]\] +/,""))),ft.items.push({type:"list_item",raw:ae,task:Mi,checked:ki,loose:oi,text:Vt})}return ft}},xe.html=function(K){var W=this.rules.block.html.exec(K);if(W)return{type:this.options.sanitize?"paragraph":"html",raw:W[0],pre:!this.options.sanitizer&&(W[1]==="pre"||W[1]==="script"||W[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(W[0]):L(W[0]):W[0]}},xe.def=function(K){var W=this.rules.block.def.exec(K);if(W){W[3]&&(W[3]=W[3].substring(1,W[3].length-1));var ae=W[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:ae,raw:W[0],href:W[2],title:W[3]}}},xe.table=function(K){var W=this.rules.block.table.exec(K);if(W){var ae={type:"table",header:A(W[1].replace(/^ *| *\| *$/g,"")),align:W[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:W[3]?W[3].replace(/\n$/,"").split(`
|
|
|
`):[]};if(ae.header.length===ae.align.length){ae.raw=W[0];var ce=ae.align.length,ve;for(ve=0;ve<ce;ve++)/^ *-+: *$/.test(ae.align[ve])?ae.align[ve]="right":/^ *:-+: *$/.test(ae.align[ve])?ae.align[ve]="center":/^ *:-+ *$/.test(ae.align[ve])?ae.align[ve]="left":ae.align[ve]=null;for(ce=ae.cells.length,ve=0;ve<ce;ve++)ae.cells[ve]=A(ae.cells[ve].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},xe.lheading=function(K){var W=this.rules.block.lheading.exec(K);if(W)return{type:"heading",raw:W[0],depth:W[2].charAt(0)==="="?1:2,text:W[1]}},xe.paragraph=function(K){var W=this.rules.block.paragraph.exec(K);if(W)return{type:"paragraph",raw:W[0],text:W[1].charAt(W[1].length-1)===`
|
|
|
`?W[1].slice(0,-1):W[1]}},xe.text=function(K){var W=this.rules.block.text.exec(K);if(W)return{type:"text",raw:W[0],text:W[0]}},xe.escape=function(K){var W=this.rules.inline.escape.exec(K);if(W)return{type:"escape",raw:W[0],text:L(W[1])}},xe.tag=function(K,W,ae){var ce=this.rules.inline.tag.exec(K);if(ce)return!W&&/^<a /i.test(ce[0])?W=!0:W&&/^<\/a>/i.test(ce[0])&&(W=!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:W,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):L(ce[0]):ce[0]}},xe.link=function(K){var W=this.rules.inline.link.exec(K);if(W){var ae=W[2].trim();if(!this.options.pedantic&&/^</.test(ae)){if(!/>$/.test(ae))return;var ce=ne(ae.slice(0,-1),"\\");if((ae.length-ce.length)%2===0)return}else{var ve=G(W[2],"()");if(ve>-1){var ft=W[0].indexOf("!")===0?5:4,yt=ft+W[1].length+ve;W[2]=W[2].substring(0,ve),W[0]=W[0].substring(0,yt).trim(),W[3]=""}}var ut=W[2],Vt="";if(this.options.pedantic){var ii=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ut);ii&&(ut=ii[1],Vt=ii[3])}else Vt=W[3]?W[3].slice(1,-1):"";return ut=ut.trim(),/^</.test(ut)&&(this.options.pedantic&&!/>$/.test(ae)?ut=ut.slice(1):ut=ut.slice(1,-1)),de(W,{href:ut&&ut.replace(this.rules.inline._escapes,"$1"),title:Vt&&Vt.replace(this.rules.inline._escapes,"$1")},W[0])}},xe.reflink=function(K,W){var ae;if((ae=this.rules.inline.reflink.exec(K))||(ae=this.rules.inline.nolink.exec(K))){var ce=(ae[2]||ae[1]).replace(/\s+/g," ");if(ce=W[ce.toLowerCase()],!ce||!ce.href){var ve=ae[0].charAt(0);return{type:"text",raw:ve,text:ve}}return de(ae,ce,ae[0])}},xe.emStrong=function(K,W,ae){ae===void 0&&(ae="");var ce=this.rules.inline.emStrong.lDelim.exec(K);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 ve=ce[1]||ce[2]||"";if(!ve||ve&&(ae===""||this.rules.inline.punctuation.exec(ae))){var ft=ce[0].length-1,yt,ut,Vt=ft,ii=0,mi=ce[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(mi.lastIndex=0,W=W.slice(-1*K.length+ft);(ce=mi.exec(W))!=null;)if(yt=ce[1]||ce[2]||ce[3]||ce[4]||ce[5]||ce[6],!!yt){if(ut=yt.length,ce[3]||ce[4]){Vt+=ut;continue}else if((ce[5]||ce[6])&&ft%3&&!((ft+ut)%3)){ii+=ut;continue}if(Vt-=ut,!(Vt>0))return ut=Math.min(ut,ut+Vt+ii),Math.min(ft,ut)%2?{type:"em",raw:K.slice(0,ft+ce.index+ut+1),text:K.slice(1,ft+ce.index+ut)}:{type:"strong",raw:K.slice(0,ft+ce.index+ut+1),text:K.slice(2,ft+ce.index+ut-1)}}}}},xe.codespan=function(K){var W=this.rules.inline.code.exec(K);if(W){var ae=W[2].replace(/\n/g," "),ce=/[^ ]/.test(ae),ve=/^ /.test(ae)&&/ $/.test(ae);return ce&&ve&&(ae=ae.substring(1,ae.length-1)),ae=L(ae,!0),{type:"codespan",raw:W[0],text:ae}}},xe.br=function(K){var W=this.rules.inline.br.exec(K);if(W)return{type:"br",raw:W[0]}},xe.del=function(K){var W=this.rules.inline.del.exec(K);if(W)return{type:"del",raw:W[0],text:W[2]}},xe.autolink=function(K,W){var ae=this.rules.inline.autolink.exec(K);if(ae){var ce,ve;return ae[2]==="@"?(ce=L(this.options.mangle?W(ae[1]):ae[1]),ve="mailto:"+ce):(ce=L(ae[1]),ve=ce),{type:"link",raw:ae[0],text:ce,href:ve,tokens:[{type:"text",raw:ce,text:ce}]}}},xe.url=function(K,W){var ae;if(ae=this.rules.inline.url.exec(K)){var ce,ve;if(ae[2]==="@")ce=L(this.options.mangle?W(ae[0]):ae[0]),ve="mailto:"+ce;else{var ft;do ft=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(ft!==ae[0]);ce=L(ae[0]),ae[1]==="www."?ve="http://"+ce:ve=ce}return{type:"link",raw:ae[0],text:ce,href:ve,tokens:[{type:"text",raw:ce,text:ce}]}}},xe.inlineText=function(K,W,ae){var ce=this.rules.inline.text.exec(K);if(ce){var ve;return W?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):L(ce[0]):ce[0]:ve=L(this.options.smartypants?ae(ce[0]):ce[0]),{type:"text",raw:ce[0],text:ve}}},De}(),Ut=Q.noopTest,Ie=Q.edit,Yt=Q.merge,Pt={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Ut,table:Ut,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Pt._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Pt._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Pt.def=Ie(Pt.def).replace("label",Pt._label).replace("title",Pt._title).getRegex(),Pt.bullet=/(?:[*+-]|\d{1,9}[.)])/,Pt.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Pt.item=Ie(Pt.item,"gm").replace(/bull/g,Pt.bullet).getRegex(),Pt.listItemStart=Ie(/^( *)(bull) */).replace("bull",Pt.bullet).getRegex(),Pt.list=Ie(Pt.list).replace(/bull/g,Pt.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Pt.def.source+")").getRegex(),Pt._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",Pt._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Pt.html=Ie(Pt.html,"i").replace("comment",Pt._comment).replace("tag",Pt._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Pt.paragraph=Ie(Pt._paragraph).replace("hr",Pt.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",Pt._tag).getRegex(),Pt.blockquote=Ie(Pt.blockquote).replace("paragraph",Pt.paragraph).getRegex(),Pt.normal=Yt({},Pt),Pt.gfm=Yt({},Pt.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*|$)"}),Pt.gfm.nptable=Ie(Pt.gfm.nptable).replace("hr",Pt.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",Pt._tag).getRegex(),Pt.gfm.table=Ie(Pt.gfm.table).replace("hr",Pt.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",Pt._tag).getRegex(),Pt.pedantic=Yt({},Pt.normal,{html:Ie(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pt._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ut,paragraph:Ie(Pt.normal._paragraph).replace("hr",Pt.hr).replace("heading",` *#{1,6} *[^
|
|
|
]`).replace("lheading",Pt.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var St={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ut,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/\_\_[^_*]*?\*[^_*]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/\*\*[^_*]*?\_[^_*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Ut,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};St._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",St.punctuation=Ie(St.punctuation).replace(/punctuation/g,St._punctuation).getRegex(),St.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,St.escapedEmSt=/\\\*|\\_/g,St._comment=Ie(Pt._comment).replace("(?:-->|$)","-->").getRegex(),St.emStrong.lDelim=Ie(St.emStrong.lDelim).replace(/punct/g,St._punctuation).getRegex(),St.emStrong.rDelimAst=Ie(St.emStrong.rDelimAst,"g").replace(/punct/g,St._punctuation).getRegex(),St.emStrong.rDelimUnd=Ie(St.emStrong.rDelimUnd,"g").replace(/punct/g,St._punctuation).getRegex(),St._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,St._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,St._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])?)+(?![-_])/,St.autolink=Ie(St.autolink).replace("scheme",St._scheme).replace("email",St._email).getRegex(),St._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,St.tag=Ie(St.tag).replace("comment",St._comment).replace("attribute",St._attribute).getRegex(),St._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,St._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,St._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,St.link=Ie(St.link).replace("label",St._label).replace("href",St._href).replace("title",St._title).getRegex(),St.reflink=Ie(St.reflink).replace("label",St._label).getRegex(),St.reflinkSearch=Ie(St.reflinkSearch,"g").replace("reflink",St.reflink).replace("nolink",St.nolink).getRegex(),St.normal=Yt({},St),St.pedantic=Yt({},St.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ie(/^!?\[(label)\]\((.*?)\)/).replace("label",St._label).getRegex(),reflink:Ie(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",St._label).getRegex()}),St.gfm=Yt({},St.normal,{escape:Ie(St.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),St.gfm.url=Ie(St.gfm.url,"i").replace("email",St.gfm._extended_email).getRegex(),St.breaks=Yt({},St.gfm,{br:Ie(St.br).replace("{2,}","*").getRegex(),text:Ie(St.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $e={block:Pt,inline:St},it=pt,mt=pe.exports.defaults,ht=$e.block,ti=$e.inline,Ce=Q.repeatString;function Be(De){return De.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function me(De){var xe="",ke,K,W=De.length;for(ke=0;ke<W;ke++)K=De.charCodeAt(ke),Math.random()>.5&&(K="x"+K.toString(16)),xe+="&#"+K+";";return xe}var Xe=function(){function De(ke){this.tokens=[],this.tokens.links=Object.create(null),this.options=ke||mt,this.options.tokenizer=this.options.tokenizer||new it,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var K={block:ht.normal,inline:ti.normal};this.options.pedantic?(K.block=ht.pedantic,K.inline=ti.pedantic):this.options.gfm&&(K.block=ht.gfm,this.options.breaks?K.inline=ti.breaks:K.inline=ti.gfm),this.tokenizer.rules=K}De.lex=function(K,W){var ae=new De(W);return ae.lex(K)},De.lexInline=function(K,W){var ae=new De(W);return ae.inlineTokens(K)};var xe=De.prototype;return xe.lex=function(K){return K=K.replace(/\r\n|\r/g,`
|
|
|
`).replace(/\t/g," "),this.blockTokens(K,this.tokens,!0),this.inline(this.tokens),this.tokens},xe.blockTokens=function(K,W,ae){W===void 0&&(W=[]),ae===void 0&&(ae=!0),this.options.pedantic&&(K=K.replace(/^ +$/gm,""));for(var ce,ve,ft,yt;K;){if(ce=this.tokenizer.space(K)){K=K.substring(ce.raw.length),ce.type&&W.push(ce);continue}if(ce=this.tokenizer.code(K)){K=K.substring(ce.raw.length),yt=W[W.length-1],yt&&yt.type==="paragraph"?(yt.raw+=`
|
|
|
`+ce.raw,yt.text+=`
|
|
|
`+ce.text):W.push(ce);continue}if(ce=this.tokenizer.fences(K)){K=K.substring(ce.raw.length),W.push(ce);continue}if(ce=this.tokenizer.heading(K)){K=K.substring(ce.raw.length),W.push(ce);continue}if(ce=this.tokenizer.nptable(K)){K=K.substring(ce.raw.length),W.push(ce);continue}if(ce=this.tokenizer.hr(K)){K=K.substring(ce.raw.length),W.push(ce);continue}if(ce=this.tokenizer.blockquote(K)){K=K.substring(ce.raw.length),ce.tokens=this.blockTokens(ce.text,[],ae),W.push(ce);continue}if(ce=this.tokenizer.list(K)){for(K=K.substring(ce.raw.length),ft=ce.items.length,ve=0;ve<ft;ve++)ce.items[ve].tokens=this.blockTokens(ce.items[ve].text,[],!1);W.push(ce);continue}if(ce=this.tokenizer.html(K)){K=K.substring(ce.raw.length),W.push(ce);continue}if(ae&&(ce=this.tokenizer.def(K))){K=K.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(K)){K=K.substring(ce.raw.length),W.push(ce);continue}if(ce=this.tokenizer.lheading(K)){K=K.substring(ce.raw.length),W.push(ce);continue}if(ae&&(ce=this.tokenizer.paragraph(K))){K=K.substring(ce.raw.length),W.push(ce);continue}if(ce=this.tokenizer.text(K)){K=K.substring(ce.raw.length),yt=W[W.length-1],yt&&yt.type==="text"?(yt.raw+=`
|
|
|
`+ce.raw,yt.text+=`
|
|
|
`+ce.text):W.push(ce);continue}if(K){var ut="Infinite loop on byte: "+K.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return W},xe.inline=function(K){var W,ae,ce,ve,ft,yt,ut=K.length;for(W=0;W<ut;W++)switch(yt=K[W],yt.type){case"paragraph":case"text":case"heading":{yt.tokens=[],this.inlineTokens(yt.text,yt.tokens);break}case"table":{for(yt.tokens={header:[],cells:[]},ve=yt.header.length,ae=0;ae<ve;ae++)yt.tokens.header[ae]=[],this.inlineTokens(yt.header[ae],yt.tokens.header[ae]);for(ve=yt.cells.length,ae=0;ae<ve;ae++)for(ft=yt.cells[ae],yt.tokens.cells[ae]=[],ce=0;ce<ft.length;ce++)yt.tokens.cells[ae][ce]=[],this.inlineTokens(ft[ce],yt.tokens.cells[ae][ce]);break}case"blockquote":{this.inline(yt.tokens);break}case"list":{for(ve=yt.items.length,ae=0;ae<ve;ae++)this.inline(yt.items[ae].tokens);break}}return K},xe.inlineTokens=function(K,W,ae,ce){W===void 0&&(W=[]),ae===void 0&&(ae=!1),ce===void 0&&(ce=!1);var ve,ft,yt=K,ut,Vt,ii;if(this.tokens.links){var mi=Object.keys(this.tokens.links);if(mi.length>0)for(;(ut=this.tokenizer.rules.inline.reflinkSearch.exec(yt))!=null;)mi.includes(ut[0].slice(ut[0].lastIndexOf("[")+1,-1))&&(yt=yt.slice(0,ut.index)+"["+Ce("a",ut[0].length-2)+"]"+yt.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(ut=this.tokenizer.rules.inline.blockSkip.exec(yt))!=null;)yt=yt.slice(0,ut.index)+"["+Ce("a",ut[0].length-2)+"]"+yt.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(ut=this.tokenizer.rules.inline.escapedEmSt.exec(yt))!=null;)yt=yt.slice(0,ut.index)+"++"+yt.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;K;){if(Vt||(ii=""),Vt=!1,ve=this.tokenizer.escape(K)){K=K.substring(ve.raw.length),W.push(ve);continue}if(ve=this.tokenizer.tag(K,ae,ce)){K=K.substring(ve.raw.length),ae=ve.inLink,ce=ve.inRawBlock;var ni=W[W.length-1];ni&&ve.type==="text"&&ni.type==="text"?(ni.raw+=ve.raw,ni.text+=ve.text):W.push(ve);continue}if(ve=this.tokenizer.link(K)){K=K.substring(ve.raw.length),ve.type==="link"&&(ve.tokens=this.inlineTokens(ve.text,[],!0,ce)),W.push(ve);continue}if(ve=this.tokenizer.reflink(K,this.tokens.links)){K=K.substring(ve.raw.length);var Dt=W[W.length-1];ve.type==="link"?(ve.tokens=this.inlineTokens(ve.text,[],!0,ce),W.push(ve)):Dt&&ve.type==="text"&&Dt.type==="text"?(Dt.raw+=ve.raw,Dt.text+=ve.text):W.push(ve);continue}if(ve=this.tokenizer.emStrong(K,yt,ii)){K=K.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],ae,ce),W.push(ve);continue}if(ve=this.tokenizer.codespan(K)){K=K.substring(ve.raw.length),W.push(ve);continue}if(ve=this.tokenizer.br(K)){K=K.substring(ve.raw.length),W.push(ve);continue}if(ve=this.tokenizer.del(K)){K=K.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],ae,ce),W.push(ve);continue}if(ve=this.tokenizer.autolink(K,me)){K=K.substring(ve.raw.length),W.push(ve);continue}if(!ae&&(ve=this.tokenizer.url(K,me))){K=K.substring(ve.raw.length),W.push(ve);continue}if(ve=this.tokenizer.inlineText(K,ce,Be)){K=K.substring(ve.raw.length),ve.raw.slice(-1)!=="_"&&(ii=ve.raw.slice(-1)),Vt=!0,ft=W[W.length-1],ft&&ft.type==="text"?(ft.raw+=ve.raw,ft.text+=ve.text):W.push(ve);continue}if(K){var oi="Infinite loop on byte: "+K.charCodeAt(0);if(this.options.silent){console.error(oi);break}else throw new Error(oi)}}return W},re(De,null,[{key:"rules",get:function(){return{block:ht,inline:ti}}}]),De}(),at=pe.exports.defaults,Je=Q.cleanUrl,q=Q.escape,ye=function(){function De(ke){this.options=ke||at}var xe=De.prototype;return xe.code=function(K,W,ae){var ce=(W||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(K,ce);ve!=null&&ve!==K&&(ae=!0,K=ve)}return K=K.replace(/\n$/,"")+`
|
|
|
`,ce?'<pre><code class="'+this.options.langPrefix+q(ce,!0)+'">'+(ae?K:q(K,!0))+`</code></pre>
|
|
|
`:"<pre><code>"+(ae?K:q(K,!0))+`</code></pre>
|
|
|
`},xe.blockquote=function(K){return`<blockquote>
|
|
|
`+K+`</blockquote>
|
|
|
`},xe.html=function(K){return K},xe.heading=function(K,W,ae,ce){return this.options.headerIds?"<h"+W+' id="'+this.options.headerPrefix+ce.slug(ae)+'">'+K+"</h"+W+`>
|
|
|
`:"<h"+W+">"+K+"</h"+W+`>
|
|
|
`},xe.hr=function(){return this.options.xhtml?`<hr/>
|
|
|
`:`<hr>
|
|
|
`},xe.list=function(K,W,ae){var ce=W?"ol":"ul",ve=W&&ae!==1?' start="'+ae+'"':"";return"<"+ce+ve+`>
|
|
|
`+K+"</"+ce+`>
|
|
|
`},xe.listitem=function(K){return"<li>"+K+`</li>
|
|
|
`},xe.checkbox=function(K){return"<input "+(K?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},xe.paragraph=function(K){return"<p>"+K+`</p>
|
|
|
`},xe.table=function(K,W){return W&&(W="<tbody>"+W+"</tbody>"),`<table>
|
|
|
<thead>
|
|
|
`+K+`</thead>
|
|
|
`+W+`</table>
|
|
|
`},xe.tablerow=function(K){return`<tr>
|
|
|
`+K+`</tr>
|
|
|
`},xe.tablecell=function(K,W){var ae=W.header?"th":"td",ce=W.align?"<"+ae+' align="'+W.align+'">':"<"+ae+">";return ce+K+"</"+ae+`>
|
|
|
`},xe.strong=function(K){return"<strong>"+K+"</strong>"},xe.em=function(K){return"<em>"+K+"</em>"},xe.codespan=function(K){return"<code>"+K+"</code>"},xe.br=function(){return this.options.xhtml?"<br/>":"<br>"},xe.del=function(K){return"<del>"+K+"</del>"},xe.link=function(K,W,ae){if(K=Je(this.options.sanitize,this.options.baseUrl,K),K===null)return ae;var ce='<a href="'+q(K)+'"';return W&&(ce+=' title="'+W+'"'),ce+=">"+ae+"</a>",ce},xe.image=function(K,W,ae){if(K=Je(this.options.sanitize,this.options.baseUrl,K),K===null)return ae;var ce='<img src="'+K+'" alt="'+ae+'"';return W&&(ce+=' title="'+W+'"'),ce+=this.options.xhtml?"/>":">",ce},xe.text=function(K){return K},De}(),Fe=function(){function De(){}var xe=De.prototype;return xe.strong=function(K){return K},xe.em=function(K){return K},xe.codespan=function(K){return K},xe.del=function(K){return K},xe.html=function(K){return K},xe.text=function(K){return K},xe.link=function(K,W,ae){return""+ae},xe.image=function(K,W,ae){return""+ae},xe.br=function(){return""},De}(),Ze=function(){function De(){this.seen={}}var xe=De.prototype;return xe.serialize=function(K){return K.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},xe.getNextSafeSlug=function(K,W){var ae=K,ce=0;if(this.seen.hasOwnProperty(ae)){ce=this.seen[K];do ce++,ae=K+"-"+ce;while(this.seen.hasOwnProperty(ae))}return W||(this.seen[K]=ce,this.seen[ae]=0),ae},xe.slug=function(K,W){W===void 0&&(W={});var ae=this.serialize(K);return this.getNextSafeSlug(ae,W.dryrun)},De}(),ot=ye,bt=Fe,qt=Ze,vt=pe.exports.defaults,Se=Q.unescape,xt=function(){function De(ke){this.options=ke||vt,this.options.renderer=this.options.renderer||new ot,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new bt,this.slugger=new qt}De.parse=function(K,W){var ae=new De(W);return ae.parse(K)},De.parseInline=function(K,W){var ae=new De(W);return ae.parseInline(K)};var xe=De.prototype;return xe.parse=function(K,W){W===void 0&&(W=!0);var ae="",ce,ve,ft,yt,ut,Vt,ii,mi,ni,Dt,oi,Mi,ki,Bi,gi,fi,Vi,ji,en=K.length;for(ce=0;ce<en;ce++)switch(Dt=K[ce],Dt.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(Dt.tokens),Dt.depth,Se(this.parseInline(Dt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(Dt.text,Dt.lang,Dt.escaped);continue}case"table":{for(mi="",ii="",yt=Dt.header.length,ve=0;ve<yt;ve++)ii+=this.renderer.tablecell(this.parseInline(Dt.tokens.header[ve]),{header:!0,align:Dt.align[ve]});for(mi+=this.renderer.tablerow(ii),ni="",yt=Dt.cells.length,ve=0;ve<yt;ve++){for(Vt=Dt.tokens.cells[ve],ii="",ut=Vt.length,ft=0;ft<ut;ft++)ii+=this.renderer.tablecell(this.parseInline(Vt[ft]),{header:!1,align:Dt.align[ft]});ni+=this.renderer.tablerow(ii)}ae+=this.renderer.table(mi,ni);continue}case"blockquote":{ni=this.parse(Dt.tokens),ae+=this.renderer.blockquote(ni);continue}case"list":{for(oi=Dt.ordered,Mi=Dt.start,ki=Dt.loose,yt=Dt.items.length,ni="",ve=0;ve<yt;ve++)gi=Dt.items[ve],fi=gi.checked,Vi=gi.task,Bi="",gi.task&&(ji=this.renderer.checkbox(fi),ki?gi.tokens.length>0&&gi.tokens[0].type==="text"?(gi.tokens[0].text=ji+" "+gi.tokens[0].text,gi.tokens[0].tokens&&gi.tokens[0].tokens.length>0&&gi.tokens[0].tokens[0].type==="text"&&(gi.tokens[0].tokens[0].text=ji+" "+gi.tokens[0].tokens[0].text)):gi.tokens.unshift({type:"text",text:ji}):Bi+=ji),Bi+=this.parse(gi.tokens,ki),ni+=this.renderer.listitem(Bi,Vi,fi);ae+=this.renderer.list(ni,oi,Mi);continue}case"html":{ae+=this.renderer.html(Dt.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(Dt.tokens));continue}case"text":{for(ni=Dt.tokens?this.parseInline(Dt.tokens):Dt.text;ce+1<en&&K[ce+1].type==="text";)Dt=K[++ce],ni+=`
|
|
|
`+(Dt.tokens?this.parseInline(Dt.tokens):Dt.text);ae+=W?this.renderer.paragraph(ni):ni;continue}default:{var Yi='Token with "'+Dt.type+'" type was not found.';if(this.options.silent){console.error(Yi);return}else throw new Error(Yi)}}return ae},xe.parseInline=function(K,W){W=W||this.renderer;var ae="",ce,ve,ft=K.length;for(ce=0;ce<ft;ce++)switch(ve=K[ce],ve.type){case"escape":{ae+=W.text(ve.text);break}case"html":{ae+=W.html(ve.text);break}case"link":{ae+=W.link(ve.href,ve.title,this.parseInline(ve.tokens,W));break}case"image":{ae+=W.image(ve.href,ve.title,ve.text);break}case"strong":{ae+=W.strong(this.parseInline(ve.tokens,W));break}case"em":{ae+=W.em(this.parseInline(ve.tokens,W));break}case"codespan":{ae+=W.codespan(ve.text);break}case"br":{ae+=W.br();break}case"del":{ae+=W.del(this.parseInline(ve.tokens,W));break}case"text":{ae+=W.text(ve.text);break}default:{var yt='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(yt);return}else throw new Error(yt)}}return ae},De}(),Wt=Xe,Gt=xt,Le=pt,Me=ye,rt=Fe,wt=Ze,qe=Q.merge,Ct=Q.checkSanitizeDeprecation,Lt=Q.escape,kt=pe.exports.getDefaults,Nt=pe.exports.changeDefaults,Xt=pe.exports.defaults;function Qe(De,xe,ke){if(typeof De=="undefined"||De===null)throw new Error("marked(): input parameter is undefined or null");if(typeof De!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(De)+", string expected");if(typeof xe=="function"&&(ke=xe,xe=null),xe=qe({},Qe.defaults,xe||{}),Ct(xe),ke){var K=xe.highlight,W;try{W=Wt.lex(De,xe)}catch(ft){return ke(ft)}var ae=function(yt){var ut;if(!yt)try{xe.walkTokens&&Qe.walkTokens(W,xe.walkTokens),ut=Gt.parse(W,xe)}catch(Vt){yt=Vt}return xe.highlight=K,yt?ke(yt):ke(null,ut)};if(!K||K.length<3||(delete xe.highlight,!W.length))return ae();var ce=0;Qe.walkTokens(W,function(ft){ft.type==="code"&&(ce++,setTimeout(function(){K(ft.text,ft.lang,function(yt,ut){if(yt)return ae(yt);ut!=null&&ut!==ft.text&&(ft.text=ut,ft.escaped=!0),ce--,ce===0&&ae()})},0))}),ce===0&&ae();return}try{var ve=Wt.lex(De,xe);return xe.walkTokens&&Qe.walkTokens(ve,xe.walkTokens),Gt.parse(ve,xe)}catch(ft){if(ft.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,xe.silent)return"<p>An error occurred:</p><pre>"+Lt(ft.message+"",!0)+"</pre>";throw ft}}Qe.options=Qe.setOptions=function(De){return qe(Qe.defaults,De),Nt(Qe.defaults),Qe},Qe.getDefaults=kt,Qe.defaults=Xt,Qe.use=function(De){var xe=qe({},De);if(De.renderer&&function(){var K=Qe.defaults.renderer||new Me,W=function(ve){var ft=K[ve];K[ve]=function(){for(var yt=arguments.length,ut=new Array(yt),Vt=0;Vt<yt;Vt++)ut[Vt]=arguments[Vt];var ii=De.renderer[ve].apply(K,ut);return ii===!1&&(ii=ft.apply(K,ut)),ii}};for(var ae in De.renderer)W(ae);xe.renderer=K}(),De.tokenizer&&function(){var K=Qe.defaults.tokenizer||new Le,W=function(ve){var ft=K[ve];K[ve]=function(){for(var yt=arguments.length,ut=new Array(yt),Vt=0;Vt<yt;Vt++)ut[Vt]=arguments[Vt];var ii=De.tokenizer[ve].apply(K,ut);return ii===!1&&(ii=ft.apply(K,ut)),ii}};for(var ae in De.tokenizer)W(ae);xe.tokenizer=K}(),De.walkTokens){var ke=Qe.defaults.walkTokens;xe.walkTokens=function(K){De.walkTokens(K),ke&&ke(K)}}Qe.setOptions(xe)},Qe.walkTokens=function(De,xe){for(var ke=Ye(De),K;!(K=ke()).done;){var W=K.value;switch(xe(W),W.type){case"table":{for(var ae=Ye(W.tokens.header),ce;!(ce=ae()).done;){var ve=ce.value;Qe.walkTokens(ve,xe)}for(var ft=Ye(W.tokens.cells),yt;!(yt=ft()).done;)for(var ut=yt.value,Vt=Ye(ut),ii;!(ii=Vt()).done;){var mi=ii.value;Qe.walkTokens(mi,xe)}break}case"list":{Qe.walkTokens(W.items,xe);break}default:W.tokens&&Qe.walkTokens(W.tokens,xe)}}},Qe.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=qe({},Qe.defaults,xe||{}),Ct(xe);try{var ke=Wt.lexInline(De,xe);return xe.walkTokens&&Qe.walkTokens(ke,xe.walkTokens),Gt.parseInline(ke,xe)}catch(K){if(K.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,xe.silent)return"<p>An error occurred:</p><pre>"+Lt(K.message+"",!0)+"</pre>";throw K}},Qe.Parser=Gt,Qe.parser=Gt.parse,Qe.Renderer=Me,Qe.TextRenderer=rt,Qe.Lexer=Wt,Qe.lexer=Wt.lex,Qe.Tokenizer=Le,Qe.Slugger=wt,Qe.parse=Qe;var zt=Qe;return zt})},11690:function(Ci){const Ft=/[&<>"']/,re=/[&<>"']/g,ue=/[<>"']|&(?!#?\w+;)/,we=/[<>"']|&(?!#?\w+;)/g,Ye={"&":"&","<":"<",">":">",'"':""","'":"'"},pe=se=>Ye[se];function X(se,Ee){if(Ee){if(Ft.test(se))return se.replace(re,pe)}else if(ue.test(se))return se.replace(we,pe);return se}const w=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Ae(se){return se.replace(w,(Ee,je)=>(je=je.toLowerCase(),je==="colon"?":":je.charAt(0)==="#"?je.charAt(1)==="x"?String.fromCharCode(parseInt(je.substring(2),16)):String.fromCharCode(+je.substring(1)):""))}const P=/(^|[^\[])\^/g;function f(se,Ee){se=se.source||se,Ee=Ee||"";const je={replace:(Ke,It)=>(It=It.source||It,It=It.replace(P,"$1"),se=se.replace(Ke,It),je),getRegex:()=>new RegExp(se,Ee)};return je}const ie=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(se,Ee,je){if(se){let Ke;try{Ke=decodeURIComponent(Ae(je)).replace(ie,"").toLowerCase()}catch(It){return null}if(Ke.indexOf("javascript:")===0||Ke.indexOf("vbscript:")===0||Ke.indexOf("data:")===0)return null}Ee&&!I.test(je)&&(je=H(Ee,je));try{je=encodeURI(je).replace(/%25/g,"%")}catch(Ke){return null}return je}const T={},C=/^[^:]+:\/*[^/]*$/,O=/^([^:]+:)[\s\S]*$/,J=/^([^:]+:\/*[^/]*)[\s\S]*$/;function H(se,Ee){T[" "+se]||(C.test(se)?T[" "+se]=se+"/":T[" "+se]=V(se,"/",!0)),se=T[" "+se];const je=se.indexOf(":")===-1;return Ee.substring(0,2)==="//"?je?Ee:se.replace(O,"$1")+Ee:Ee.charAt(0)==="/"?je?Ee:se.replace(J,"$1")+Ee:se+Ee}const j={exec:function(){}};function $(se){let Ee=1,je,Ke;for(;Ee<arguments.length;Ee++){je=arguments[Ee];for(Ke in je)Object.prototype.hasOwnProperty.call(je,Ke)&&(se[Ke]=je[Ke])}return se}function B(se,Ee){const je=se.replace(/\|/g,(ee,z,Z)=>{let Q=!1,fe=z;for(;--fe>=0&&Z[fe]==="\\";)Q=!Q;return Q?"|":" |"}),Ke=je.split(/ \|/);let It=0;if(Ke.length>Ee)Ke.splice(Ee);else for(;Ke.length<Ee;)Ke.push("");for(;It<Ke.length;It++)Ke[It]=Ke[It].trim().replace(/\\\|/g,"|");return Ke}function V(se,Ee,je){const Ke=se.length;if(Ke===0)return"";let It=0;for(;It<Ke;){const ee=se.charAt(Ke-It-1);if(ee===Ee&&!je)It++;else if(ee!==Ee&&je)It++;else break}return se.substr(0,Ke-It)}function he(se,Ee){if(se.indexOf(Ee[1])===-1)return-1;const je=se.length;let Ke=0,It=0;for(;It<je;It++)if(se[It]==="\\")It++;else if(se[It]===Ee[0])Ke++;else if(se[It]===Ee[1]&&(Ke--,Ke<0))return It;return-1}function be(se){se&&se.sanitize&&!se.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function Te(se,Ee){if(Ee<1)return"";let je="";for(;Ee>1;)Ee&1&&(je+=se),Ee>>=1,se+=se;return je+se}Ci.exports={escape:X,unescape:Ae,edit:f,cleanUrl:k,resolveUrl:H,noopTest:j,merge:$,splitCells:B,rtrim:V,findClosingBracket:he,checkSanitizeDeprecation:be,repeatString:Te}},75918:function(Ci,Ft,re){"use strict";re.d(Ft,{Wi:function(){return w},Z0:function(){return Ae},aU:function(){return X},eZ:function(){return f},wY:function(){return P}});var ue=re(4348),we=re(69323),Ye=re(13268),pe=function(ie,I,k,T){function C(O){return O instanceof k?O:new k(function(J){J(O)})}return new(k||(k=Promise))(function(O,J){function H(B){try{$(T.next(B))}catch(V){J(V)}}function j(B){try{$(T.throw(B))}catch(V){J(V)}}function $(B){B.done?O(B.value):C(B.value).then(H,j)}$((T=T.apply(ie,I||[])).next())})};class X extends we.JT{constructor(I,k="",T="",C=!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=C,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 pe(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 pe(this,void 0,void 0,function*(){if(!I.enabled)return;this._onBeforeRun.fire({action:I});let T;try{yield this.runAction(I,k)}catch(C){T=C}this._onDidRun.fire({action:I,error:T})})}runAction(I,k){return pe(this,void 0,void 0,function*(){yield I.run(k)})}}class Ae extends X{constructor(I){super(Ae.ID,I,I?"separator text":"separator"),this.checked=!1,this.enabled=!1}}Ae.ID="vs.actions.separator";class P{constructor(I,k,T,C){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=I,this.label=k,this.class=C,this._actions=T}get actions(){return this._actions}dispose(){}run(){return pe(this,void 0,void 0,function*(){})}}class f extends X{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 X},JL:function(){return w},dT:function(){return P},fK:function(){return pe},lA:function(){return Ae}});var ue=re(4348);class we{constructor(){this._icons=new Map,this._onDidRegister=new ue.Q5}add(ie){const I=this._icons.get(ie.id);I?ie.description?I.description=ie.description:console.error(`Duplicate registration of codicon ${ie.id}`):(this._icons.set(ie.id,ie),this._onDidRegister.fire(ie))}get(ie){return this._icons.get(ie)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Ye=new we,pe=Ye;function X(f,ie){return new Ae(f,ie)}function w(f){return f?f.replace(/\$\((.*?)\)/g,(ie,I)=>` ${I} `).trim():""}class Ae{constructor(ie,I,k){this.id=ie,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 ie=new RegExp(`^(${f.iconNameExpression})(${f.iconModifierExpression})?$`);function I(C){if(C instanceof Ae)return["codicon","codicon-"+C.id];const O=ie.exec(C.id);if(!O)return I(Ae.error);let[,J,H]=O;const j=["codicon","codicon-"+J];return H&&j.push("codicon-modifier-"+H.substr(1)),j}f.asClassNameArray=I;function k(C){return I(C).join(" ")}f.asClassName=k;function T(C){return"."+I(C).join(".")}f.asCSSSelector=T})(P||(P={})),function(f){f.add=new f("add",{fontCharacter:"\\ea60"}),f.plus=new f("plus",f.add.definition),f.gistNew=new f("gist-new",f.add.definition),f.repoCreate=new f("repo-create",f.add.definition),f.lightbulb=new f("lightbulb",{fontCharacter:"\\ea61"}),f.lightBulb=new f("light-bulb",{fontCharacter:"\\ea61"}),f.repo=new f("repo",{fontCharacter:"\\ea62"}),f.repoDelete=new f("repo-delete",{fontCharacter:"\\ea62"}),f.gistFork=new f("gist-fork",{fontCharacter:"\\ea63"}),f.repoForked=new f("repo-forked",{fontCharacter:"\\ea63"}),f.gitPullRequest=new f("git-pull-request",{fontCharacter:"\\ea64"}),f.gitPullRequestAbandoned=new f("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),f.recordKeys=new f("record-keys",{fontCharacter:"\\ea65"}),f.keyboard=new f("keyboard",{fontCharacter:"\\ea65"}),f.tag=new f("tag",{fontCharacter:"\\ea66"}),f.tagAdd=new f("tag-add",{fontCharacter:"\\ea66"}),f.tagRemove=new f("tag-remove",{fontCharacter:"\\ea66"}),f.person=new f("person",{fontCharacter:"\\ea67"}),f.personFollow=new f("person-follow",{fontCharacter:"\\ea67"}),f.personOutline=new f("person-outline",{fontCharacter:"\\ea67"}),f.personFilled=new f("person-filled",{fontCharacter:"\\ea67"}),f.gitBranch=new f("git-branch",{fontCharacter:"\\ea68"}),f.gitBranchCreate=new f("git-branch-create",{fontCharacter:"\\ea68"}),f.gitBranchDelete=new f("git-branch-delete",{fontCharacter:"\\ea68"}),f.sourceControl=new f("source-control",{fontCharacter:"\\ea68"}),f.mirror=new f("mirror",{fontCharacter:"\\ea69"}),f.mirrorPublic=new f("mirror-public",{fontCharacter:"\\ea69"}),f.star=new f("star",{fontCharacter:"\\ea6a"}),f.starAdd=new f("star-add",{fontCharacter:"\\ea6a"}),f.starDelete=new f("star-delete",{fontCharacter:"\\ea6a"}),f.starEmpty=new f("star-empty",{fontCharacter:"\\ea6a"}),f.comment=new f("comment",{fontCharacter:"\\ea6b"}),f.commentAdd=new f("comment-add",{fontCharacter:"\\ea6b"}),f.alert=new f("alert",{fontCharacter:"\\ea6c"}),f.warning=new f("warning",{fontCharacter:"\\ea6c"}),f.search=new f("search",{fontCharacter:"\\ea6d"}),f.searchSave=new f("search-save",{fontCharacter:"\\ea6d"}),f.logOut=new f("log-out",{fontCharacter:"\\ea6e"}),f.signOut=new f("sign-out",{fontCharacter:"\\ea6e"}),f.logIn=new f("log-in",{fontCharacter:"\\ea6f"}),f.signIn=new f("sign-in",{fontCharacter:"\\ea6f"}),f.eye=new f("eye",{fontCharacter:"\\ea70"}),f.eyeUnwatch=new f("eye-unwatch",{fontCharacter:"\\ea70"}),f.eyeWatch=new f("eye-watch",{fontCharacter:"\\ea70"}),f.circleFilled=new f("circle-filled",{fontCharacter:"\\ea71"}),f.primitiveDot=new f("primitive-dot",{fontCharacter:"\\ea71"}),f.closeDirty=new f("close-dirty",{fontCharacter:"\\ea71"}),f.debugBreakpoint=new f("debug-breakpoint",{fontCharacter:"\\ea71"}),f.debugBreakpointDisabled=new f("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),f.debugHint=new f("debug-hint",{fontCharacter:"\\ea71"}),f.primitiveSquare=new f("primitive-square",{fontCharacter:"\\ea72"}),f.edit=new f("edit",{fontCharacter:"\\ea73"}),f.pencil=new f("pencil",{fontCharacter:"\\ea73"}),f.info=new f("info",{fontCharacter:"\\ea74"}),f.issueOpened=new f("issue-opened",{fontCharacter:"\\ea74"}),f.gistPrivate=new f("gist-private",{fontCharacter:"\\ea75"}),f.gitForkPrivate=new f("git-fork-private",{fontCharacter:"\\ea75"}),f.lock=new f("lock",{fontCharacter:"\\ea75"}),f.mirrorPrivate=new f("mirror-private",{fontCharacter:"\\ea75"}),f.close=new f("close",{fontCharacter:"\\ea76"}),f.removeClose=new f("remove-close",{fontCharacter:"\\ea76"}),f.x=new f("x",{fontCharacter:"\\ea76"}),f.repoSync=new f("repo-sync",{fontCharacter:"\\ea77"}),f.sync=new f("sync",{fontCharacter:"\\ea77"}),f.clone=new f("clone",{fontCharacter:"\\ea78"}),f.desktopDownload=new f("desktop-download",{fontCharacter:"\\ea78"}),f.beaker=new f("beaker",{fontCharacter:"\\ea79"}),f.microscope=new f("microscope",{fontCharacter:"\\ea79"}),f.vm=new f("vm",{fontCharacter:"\\ea7a"}),f.deviceDesktop=new f("device-desktop",{fontCharacter:"\\ea7a"}),f.file=new f("file",{fontCharacter:"\\ea7b"}),f.fileText=new f("file-text",{fontCharacter:"\\ea7b"}),f.more=new f("more",{fontCharacter:"\\ea7c"}),f.ellipsis=new f("ellipsis",{fontCharacter:"\\ea7c"}),f.kebabHorizontal=new f("kebab-horizontal",{fontCharacter:"\\ea7c"}),f.mailReply=new f("mail-reply",{fontCharacter:"\\ea7d"}),f.reply=new f("reply",{fontCharacter:"\\ea7d"}),f.organization=new f("organization",{fontCharacter:"\\ea7e"}),f.organizationFilled=new f("organization-filled",{fontCharacter:"\\ea7e"}),f.organizationOutline=new f("organization-outline",{fontCharacter:"\\ea7e"}),f.newFile=new f("new-file",{fontCharacter:"\\ea7f"}),f.fileAdd=new f("file-add",{fontCharacter:"\\ea7f"}),f.newFolder=new f("new-folder",{fontCharacter:"\\ea80"}),f.fileDirectoryCreate=new f("file-directory-create",{fontCharacter:"\\ea80"}),f.trash=new f("trash",{fontCharacter:"\\ea81"}),f.trashcan=new f("trashcan",{fontCharacter:"\\ea81"}),f.history=new f("history",{fontCharacter:"\\ea82"}),f.clock=new f("clock",{fontCharacter:"\\ea82"}),f.folder=new f("folder",{fontCharacter:"\\ea83"}),f.fileDirectory=new f("file-directory",{fontCharacter:"\\ea83"}),f.symbolFolder=new f("symbol-folder",{fontCharacter:"\\ea83"}),f.logoGithub=new f("logo-github",{fontCharacter:"\\ea84"}),f.markGithub=new f("mark-github",{fontCharacter:"\\ea84"}),f.github=new f("github",{fontCharacter:"\\ea84"}),f.terminal=new f("terminal",{fontCharacter:"\\ea85"}),f.console=new f("console",{fontCharacter:"\\ea85"}),f.repl=new f("repl",{fontCharacter:"\\ea85"}),f.zap=new f("zap",{fontCharacter:"\\ea86"}),f.symbolEvent=new f("symbol-event",{fontCharacter:"\\ea86"}),f.error=new f("error",{fontCharacter:"\\ea87"}),f.stop=new f("stop",{fontCharacter:"\\ea87"}),f.variable=new f("variable",{fontCharacter:"\\ea88"}),f.symbolVariable=new f("symbol-variable",{fontCharacter:"\\ea88"}),f.array=new f("array",{fontCharacter:"\\ea8a"}),f.symbolArray=new f("symbol-array",{fontCharacter:"\\ea8a"}),f.symbolModule=new f("symbol-module",{fontCharacter:"\\ea8b"}),f.symbolPackage=new f("symbol-package",{fontCharacter:"\\ea8b"}),f.symbolNamespace=new f("symbol-namespace",{fontCharacter:"\\ea8b"}),f.symbolObject=new f("symbol-object",{fontCharacter:"\\ea8b"}),f.symbolMethod=new f("symbol-method",{fontCharacter:"\\ea8c"}),f.symbolFunction=new f("symbol-function",{fontCharacter:"\\ea8c"}),f.symbolConstructor=new f("symbol-constructor",{fontCharacter:"\\ea8c"}),f.symbolBoolean=new f("symbol-boolean",{fontCharacter:"\\ea8f"}),f.symbolNull=new f("symbol-null",{fontCharacter:"\\ea8f"}),f.symbolNumeric=new f("symbol-numeric",{fontCharacter:"\\ea90"}),f.symbolNumber=new f("symbol-number",{fontCharacter:"\\ea90"}),f.symbolStructure=new f("symbol-structure",{fontCharacter:"\\ea91"}),f.symbolStruct=new f("symbol-struct",{fontCharacter:"\\ea91"}),f.symbolParameter=new f("symbol-parameter",{fontCharacter:"\\ea92"}),f.symbolTypeParameter=new f("symbol-type-parameter",{fontCharacter:"\\ea92"}),f.symbolKey=new f("symbol-key",{fontCharacter:"\\ea93"}),f.symbolText=new f("symbol-text",{fontCharacter:"\\ea93"}),f.symbolReference=new f("symbol-reference",{fontCharacter:"\\ea94"}),f.goToFile=new f("go-to-file",{fontCharacter:"\\ea94"}),f.symbolEnum=new f("symbol-enum",{fontCharacter:"\\ea95"}),f.symbolValue=new f("symbol-value",{fontCharacter:"\\ea95"}),f.symbolRuler=new f("symbol-ruler",{fontCharacter:"\\ea96"}),f.symbolUnit=new f("symbol-unit",{fontCharacter:"\\ea96"}),f.activateBreakpoints=new f("activate-breakpoints",{fontCharacter:"\\ea97"}),f.archive=new f("archive",{fontCharacter:"\\ea98"}),f.arrowBoth=new f("arrow-both",{fontCharacter:"\\ea99"}),f.arrowDown=new f("arrow-down",{fontCharacter:"\\ea9a"}),f.arrowLeft=new f("arrow-left",{fontCharacter:"\\ea9b"}),f.arrowRight=new f("arrow-right",{fontCharacter:"\\ea9c"}),f.arrowSmallDown=new f("arrow-small-down",{fontCharacter:"\\ea9d"}),f.arrowSmallLeft=new f("arrow-small-left",{fontCharacter:"\\ea9e"}),f.arrowSmallRight=new f("arrow-small-right",{fontCharacter:"\\ea9f"}),f.arrowSmallUp=new f("arrow-small-up",{fontCharacter:"\\eaa0"}),f.arrowUp=new f("arrow-up",{fontCharacter:"\\eaa1"}),f.bell=new f("bell",{fontCharacter:"\\eaa2"}),f.bold=new f("bold",{fontCharacter:"\\eaa3"}),f.book=new f("book",{fontCharacter:"\\eaa4"}),f.bookmark=new f("bookmark",{fontCharacter:"\\eaa5"}),f.debugBreakpointConditionalUnverified=new f("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),f.debugBreakpointConditional=new f("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),f.debugBreakpointConditionalDisabled=new f("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),f.debugBreakpointDataUnverified=new f("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),f.debugBreakpointData=new f("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),f.debugBreakpointDataDisabled=new f("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),f.debugBreakpointLogUnverified=new f("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),f.debugBreakpointLog=new f("debug-breakpoint-log",{fontCharacter:"\\eaab"}),f.debugBreakpointLogDisabled=new f("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),f.briefcase=new f("briefcase",{fontCharacter:"\\eaac"}),f.broadcast=new f("broadcast",{fontCharacter:"\\eaad"}),f.browser=new f("browser",{fontCharacter:"\\eaae"}),f.bug=new f("bug",{fontCharacter:"\\eaaf"}),f.calendar=new f("calendar",{fontCharacter:"\\eab0"}),f.caseSensitive=new f("case-sensitive",{fontCharacter:"\\eab1"}),f.check=new f("check",{fontCharacter:"\\eab2"}),f.checklist=new f("checklist",{fontCharacter:"\\eab3"}),f.chevronDown=new f("chevron-down",{fontCharacter:"\\eab4"}),f.dropDownButton=new f("drop-down-button",f.chevronDown.definition),f.chevronLeft=new f("chevron-left",{fontCharacter:"\\eab5"}),f.chevronRight=new f("chevron-right",{fontCharacter:"\\eab6"}),f.chevronUp=new f("chevron-up",{fontCharacter:"\\eab7"}),f.chromeClose=new f("chrome-close",{fontCharacter:"\\eab8"}),f.chromeMaximize=new f("chrome-maximize",{fontCharacter:"\\eab9"}),f.chromeMinimize=new f("chrome-minimize",{fontCharacter:"\\eaba"}),f.chromeRestore=new f("chrome-restore",{fontCharacter:"\\eabb"}),f.circleOutline=new f("circle-outline",{fontCharacter:"\\eabc"}),f.debugBreakpointUnverified=new f("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),f.circleSlash=new f("circle-slash",{fontCharacter:"\\eabd"}),f.circuitBoard=new f("circuit-board",{fontCharacter:"\\eabe"}),f.clearAll=new f("clear-all",{fontCharacter:"\\eabf"}),f.clippy=new f("clippy",{fontCharacter:"\\eac0"}),f.closeAll=new f("close-all",{fontCharacter:"\\eac1"}),f.cloudDownload=new f("cloud-download",{fontCharacter:"\\eac2"}),f.cloudUpload=new f("cloud-upload",{fontCharacter:"\\eac3"}),f.code=new f("code",{fontCharacter:"\\eac4"}),f.collapseAll=new f("collapse-all",{fontCharacter:"\\eac5"}),f.colorMode=new f("color-mode",{fontCharacter:"\\eac6"}),f.commentDiscussion=new f("comment-discussion",{fontCharacter:"\\eac7"}),f.compareChanges=new f("compare-changes",{fontCharacter:"\\eafd"}),f.creditCard=new f("credit-card",{fontCharacter:"\\eac9"}),f.dash=new f("dash",{fontCharacter:"\\eacc"}),f.dashboard=new f("dashboard",{fontCharacter:"\\eacd"}),f.database=new f("database",{fontCharacter:"\\eace"}),f.debugContinue=new f("debug-continue",{fontCharacter:"\\eacf"}),f.debugDisconnect=new f("debug-disconnect",{fontCharacter:"\\ead0"}),f.debugPause=new f("debug-pause",{fontCharacter:"\\ead1"}),f.debugRestart=new f("debug-restart",{fontCharacter:"\\ead2"}),f.debugStart=new f("debug-start",{fontCharacter:"\\ead3"}),f.debugStepInto=new f("debug-step-into",{fontCharacter:"\\ead4"}),f.debugStepOut=new f("debug-step-out",{fontCharacter:"\\ead5"}),f.debugStepOver=new f("debug-step-over",{fontCharacter:"\\ead6"}),f.debugStop=new f("debug-stop",{fontCharacter:"\\ead7"}),f.debug=new f("debug",{fontCharacter:"\\ead8"}),f.deviceCameraVideo=new f("device-camera-video",{fontCharacter:"\\ead9"}),f.deviceCamera=new f("device-camera",{fontCharacter:"\\eada"}),f.deviceMobile=new f("device-mobile",{fontCharacter:"\\eadb"}),f.diffAdded=new f("diff-added",{fontCharacter:"\\eadc"}),f.diffIgnored=new f("diff-ignored",{fontCharacter:"\\eadd"}),f.diffModified=new f("diff-modified",{fontCharacter:"\\eade"}),f.diffRemoved=new f("diff-removed",{fontCharacter:"\\eadf"}),f.diffRenamed=new f("diff-renamed",{fontCharacter:"\\eae0"}),f.diff=new f("diff",{fontCharacter:"\\eae1"}),f.discard=new f("discard",{fontCharacter:"\\eae2"}),f.editorLayout=new f("editor-layout",{fontCharacter:"\\eae3"}),f.emptyWindow=new f("empty-window",{fontCharacter:"\\eae4"}),f.exclude=new f("exclude",{fontCharacter:"\\eae5"}),f.extensions=new f("extensions",{fontCharacter:"\\eae6"}),f.eyeClosed=new f("eye-closed",{fontCharacter:"\\eae7"}),f.fileBinary=new f("file-binary",{fontCharacter:"\\eae8"}),f.fileCode=new f("file-code",{fontCharacter:"\\eae9"}),f.fileMedia=new f("file-media",{fontCharacter:"\\eaea"}),f.filePdf=new f("file-pdf",{fontCharacter:"\\eaeb"}),f.fileSubmodule=new f("file-submodule",{fontCharacter:"\\eaec"}),f.fileSymlinkDirectory=new f("file-symlink-directory",{fontCharacter:"\\eaed"}),f.fileSymlinkFile=new f("file-symlink-file",{fontCharacter:"\\eaee"}),f.fileZip=new f("file-zip",{fontCharacter:"\\eaef"}),f.files=new f("files",{fontCharacter:"\\eaf0"}),f.filter=new f("filter",{fontCharacter:"\\eaf1"}),f.flame=new f("flame",{fontCharacter:"\\eaf2"}),f.foldDown=new f("fold-down",{fontCharacter:"\\eaf3"}),f.foldUp=new f("fold-up",{fontCharacter:"\\eaf4"}),f.fold=new f("fold",{fontCharacter:"\\eaf5"}),f.folderActive=new f("folder-active",{fontCharacter:"\\eaf6"}),f.folderOpened=new f("folder-opened",{fontCharacter:"\\eaf7"}),f.gear=new f("gear",{fontCharacter:"\\eaf8"}),f.gift=new f("gift",{fontCharacter:"\\eaf9"}),f.gistSecret=new f("gist-secret",{fontCharacter:"\\eafa"}),f.gist=new f("gist",{fontCharacter:"\\eafb"}),f.gitCommit=new f("git-commit",{fontCharacter:"\\eafc"}),f.gitCompare=new f("git-compare",{fontCharacter:"\\eafd"}),f.gitMerge=new f("git-merge",{fontCharacter:"\\eafe"}),f.githubAction=new f("github-action",{fontCharacter:"\\eaff"}),f.githubAlt=new f("github-alt",{fontCharacter:"\\eb00"}),f.globe=new f("globe",{fontCharacter:"\\eb01"}),f.grabber=new f("grabber",{fontCharacter:"\\eb02"}),f.graph=new f("graph",{fontCharacter:"\\eb03"}),f.gripper=new f("gripper",{fontCharacter:"\\eb04"}),f.heart=new f("heart",{fontCharacter:"\\eb05"}),f.home=new f("home",{fontCharacter:"\\eb06"}),f.horizontalRule=new f("horizontal-rule",{fontCharacter:"\\eb07"}),f.hubot=new f("hubot",{fontCharacter:"\\eb08"}),f.inbox=new f("inbox",{fontCharacter:"\\eb09"}),f.issueClosed=new f("issue-closed",{fontCharacter:"\\eba4"}),f.issueReopened=new f("issue-reopened",{fontCharacter:"\\eb0b"}),f.issues=new f("issues",{fontCharacter:"\\eb0c"}),f.italic=new f("italic",{fontCharacter:"\\eb0d"}),f.jersey=new f("jersey",{fontCharacter:"\\eb0e"}),f.json=new f("json",{fontCharacter:"\\eb0f"}),f.kebabVertical=new f("kebab-vertical",{fontCharacter:"\\eb10"}),f.key=new f("key",{fontCharacter:"\\eb11"}),f.law=new f("law",{fontCharacter:"\\eb12"}),f.lightbulbAutofix=new f("lightbulb-autofix",{fontCharacter:"\\eb13"}),f.linkExternal=new f("link-external",{fontCharacter:"\\eb14"}),f.link=new f("link",{fontCharacter:"\\eb15"}),f.listOrdered=new f("list-ordered",{fontCharacter:"\\eb16"}),f.listUnordered=new f("list-unordered",{fontCharacter:"\\eb17"}),f.liveShare=new f("live-share",{fontCharacter:"\\eb18"}),f.loading=new f("loading",{fontCharacter:"\\eb19"}),f.location=new f("location",{fontCharacter:"\\eb1a"}),f.mailRead=new f("mail-read",{fontCharacter:"\\eb1b"}),f.mail=new f("mail",{fontCharacter:"\\eb1c"}),f.markdown=new f("markdown",{fontCharacter:"\\eb1d"}),f.megaphone=new f("megaphone",{fontCharacter:"\\eb1e"}),f.mention=new f("mention",{fontCharacter:"\\eb1f"}),f.milestone=new f("milestone",{fontCharacter:"\\eb20"}),f.mortarBoard=new f("mortar-board",{fontCharacter:"\\eb21"}),f.move=new f("move",{fontCharacter:"\\eb22"}),f.multipleWindows=new f("multiple-windows",{fontCharacter:"\\eb23"}),f.mute=new f("mute",{fontCharacter:"\\eb24"}),f.noNewline=new f("no-newline",{fontCharacter:"\\eb25"}),f.note=new f("note",{fontCharacter:"\\eb26"}),f.octoface=new f("octoface",{fontCharacter:"\\eb27"}),f.openPreview=new f("open-preview",{fontCharacter:"\\eb28"}),f.package_=new f("package",{fontCharacter:"\\eb29"}),f.paintcan=new f("paintcan",{fontCharacter:"\\eb2a"}),f.pin=new f("pin",{fontCharacter:"\\eb2b"}),f.play=new f("play",{fontCharacter:"\\eb2c"}),f.run=new f("run",{fontCharacter:"\\eb2c"}),f.plug=new f("plug",{fontCharacter:"\\eb2d"}),f.preserveCase=new f("preserve-case",{fontCharacter:"\\eb2e"}),f.preview=new f("preview",{fontCharacter:"\\eb2f"}),f.project=new f("project",{fontCharacter:"\\eb30"}),f.pulse=new f("pulse",{fontCharacter:"\\eb31"}),f.question=new f("question",{fontCharacter:"\\eb32"}),f.quote=new f("quote",{fontCharacter:"\\eb33"}),f.radioTower=new f("radio-tower",{fontCharacter:"\\eb34"}),f.reactions=new f("reactions",{fontCharacter:"\\eb35"}),f.references=new f("references",{fontCharacter:"\\eb36"}),f.refresh=new f("refresh",{fontCharacter:"\\eb37"}),f.regex=new f("regex",{fontCharacter:"\\eb38"}),f.remoteExplorer=new f("remote-explorer",{fontCharacter:"\\eb39"}),f.remote=new f("remote",{fontCharacter:"\\eb3a"}),f.remove=new f("remove",{fontCharacter:"\\eb3b"}),f.replaceAll=new f("replace-all",{fontCharacter:"\\eb3c"}),f.replace=new f("replace",{fontCharacter:"\\eb3d"}),f.repoClone=new f("repo-clone",{fontCharacter:"\\eb3e"}),f.repoForcePush=new f("repo-force-push",{fontCharacter:"\\eb3f"}),f.repoPull=new f("repo-pull",{fontCharacter:"\\eb40"}),f.repoPush=new f("repo-push",{fontCharacter:"\\eb41"}),f.report=new f("report",{fontCharacter:"\\eb42"}),f.requestChanges=new f("request-changes",{fontCharacter:"\\eb43"}),f.rocket=new f("rocket",{fontCharacter:"\\eb44"}),f.rootFolderOpened=new f("root-folder-opened",{fontCharacter:"\\eb45"}),f.rootFolder=new f("root-folder",{fontCharacter:"\\eb46"}),f.rss=new f("rss",{fontCharacter:"\\eb47"}),f.ruby=new f("ruby",{fontCharacter:"\\eb48"}),f.saveAll=new f("save-all",{fontCharacter:"\\eb49"}),f.saveAs=new f("save-as",{fontCharacter:"\\eb4a"}),f.save=new f("save",{fontCharacter:"\\eb4b"}),f.screenFull=new f("screen-full",{fontCharacter:"\\eb4c"}),f.screenNormal=new f("screen-normal",{fontCharacter:"\\eb4d"}),f.searchStop=new f("search-stop",{fontCharacter:"\\eb4e"}),f.server=new f("server",{fontCharacter:"\\eb50"}),f.settingsGear=new f("settings-gear",{fontCharacter:"\\eb51"}),f.settings=new f("settings",{fontCharacter:"\\eb52"}),f.shield=new f("shield",{fontCharacter:"\\eb53"}),f.smiley=new f("smiley",{fontCharacter:"\\eb54"}),f.sortPrecedence=new f("sort-precedence",{fontCharacter:"\\eb55"}),f.splitHorizontal=new f("split-horizontal",{fontCharacter:"\\eb56"}),f.splitVertical=new f("split-vertical",{fontCharacter:"\\eb57"}),f.squirrel=new f("squirrel",{fontCharacter:"\\eb58"}),f.starFull=new f("star-full",{fontCharacter:"\\eb59"}),f.starHalf=new f("star-half",{fontCharacter:"\\eb5a"}),f.symbolClass=new f("symbol-class",{fontCharacter:"\\eb5b"}),f.symbolColor=new f("symbol-color",{fontCharacter:"\\eb5c"}),f.symbolConstant=new f("symbol-constant",{fontCharacter:"\\eb5d"}),f.symbolEnumMember=new f("symbol-enum-member",{fontCharacter:"\\eb5e"}),f.symbolField=new f("symbol-field",{fontCharacter:"\\eb5f"}),f.symbolFile=new f("symbol-file",{fontCharacter:"\\eb60"}),f.symbolInterface=new f("symbol-interface",{fontCharacter:"\\eb61"}),f.symbolKeyword=new f("symbol-keyword",{fontCharacter:"\\eb62"}),f.symbolMisc=new f("symbol-misc",{fontCharacter:"\\eb63"}),f.symbolOperator=new f("symbol-operator",{fontCharacter:"\\eb64"}),f.symbolProperty=new f("symbol-property",{fontCharacter:"\\eb65"}),f.wrench=new f("wrench",{fontCharacter:"\\eb65"}),f.wrenchSubaction=new f("wrench-subaction",{fontCharacter:"\\eb65"}),f.symbolSnippet=new f("symbol-snippet",{fontCharacter:"\\eb66"}),f.tasklist=new f("tasklist",{fontCharacter:"\\eb67"}),f.telescope=new f("telescope",{fontCharacter:"\\eb68"}),f.textSize=new f("text-size",{fontCharacter:"\\eb69"}),f.threeBars=new f("three-bars",{fontCharacter:"\\eb6a"}),f.thumbsdown=new f("thumbsdown",{fontCharacter:"\\eb6b"}),f.thumbsup=new f("thumbsup",{fontCharacter:"\\eb6c"}),f.tools=new f("tools",{fontCharacter:"\\eb6d"}),f.triangleDown=new f("triangle-down",{fontCharacter:"\\eb6e"}),f.triangleLeft=new f("triangle-left",{fontCharacter:"\\eb6f"}),f.triangleRight=new f("triangle-right",{fontCharacter:"\\eb70"}),f.triangleUp=new f("triangle-up",{fontCharacter:"\\eb71"}),f.twitter=new f("twitter",{fontCharacter:"\\eb72"}),f.unfold=new f("unfold",{fontCharacter:"\\eb73"}),f.unlock=new f("unlock",{fontCharacter:"\\eb74"}),f.unmute=new f("unmute",{fontCharacter:"\\eb75"}),f.unverified=new f("unverified",{fontCharacter:"\\eb76"}),f.verified=new f("verified",{fontCharacter:"\\eb77"}),f.versions=new f("versions",{fontCharacter:"\\eb78"}),f.vmActive=new f("vm-active",{fontCharacter:"\\eb79"}),f.vmOutline=new f("vm-outline",{fontCharacter:"\\eb7a"}),f.vmRunning=new f("vm-running",{fontCharacter:"\\eb7b"}),f.watch=new f("watch",{fontCharacter:"\\eb7c"}),f.whitespace=new f("whitespace",{fontCharacter:"\\eb7d"}),f.wholeWord=new f("whole-word",{fontCharacter:"\\eb7e"}),f.window=new f("window",{fontCharacter:"\\eb7f"}),f.wordWrap=new f("word-wrap",{fontCharacter:"\\eb80"}),f.zoomIn=new f("zoom-in",{fontCharacter:"\\eb81"}),f.zoomOut=new f("zoom-out",{fontCharacter:"\\eb82"}),f.listFilter=new f("list-filter",{fontCharacter:"\\eb83"}),f.listFlat=new f("list-flat",{fontCharacter:"\\eb84"}),f.listSelection=new f("list-selection",{fontCharacter:"\\eb85"}),f.selection=new f("selection",{fontCharacter:"\\eb85"}),f.listTree=new f("list-tree",{fontCharacter:"\\eb86"}),f.debugBreakpointFunctionUnverified=new f("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),f.debugBreakpointFunction=new f("debug-breakpoint-function",{fontCharacter:"\\eb88"}),f.debugBreakpointFunctionDisabled=new f("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),f.debugStackframeActive=new f("debug-stackframe-active",{fontCharacter:"\\eb89"}),f.debugStackframeDot=new f("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),f.debugStackframe=new f("debug-stackframe",{fontCharacter:"\\eb8b"}),f.debugStackframeFocused=new f("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),f.debugBreakpointUnsupported=new f("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),f.symbolString=new f("symbol-string",{fontCharacter:"\\eb8d"}),f.debugReverseContinue=new f("debug-reverse-continue",{fontCharacter:"\\eb8e"}),f.debugStepBack=new f("debug-step-back",{fontCharacter:"\\eb8f"}),f.debugRestartFrame=new f("debug-restart-frame",{fontCharacter:"\\eb90"}),f.callIncoming=new f("call-incoming",{fontCharacter:"\\eb92"}),f.callOutgoing=new f("call-outgoing",{fontCharacter:"\\eb93"}),f.menu=new f("menu",{fontCharacter:"\\eb94"}),f.expandAll=new f("expand-all",{fontCharacter:"\\eb95"}),f.feedback=new f("feedback",{fontCharacter:"\\eb96"}),f.groupByRefType=new f("group-by-ref-type",{fontCharacter:"\\eb97"}),f.ungroupByRefType=new f("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),f.account=new f("account",{fontCharacter:"\\eb99"}),f.bellDot=new f("bell-dot",{fontCharacter:"\\eb9a"}),f.debugConsole=new f("debug-console",{fontCharacter:"\\eb9b"}),f.library=new f("library",{fontCharacter:"\\eb9c"}),f.output=new f("output",{fontCharacter:"\\eb9d"}),f.runAll=new f("run-all",{fontCharacter:"\\eb9e"}),f.syncIgnored=new f("sync-ignored",{fontCharacter:"\\eb9f"}),f.pinned=new f("pinned",{fontCharacter:"\\eba0"}),f.githubInverted=new f("github-inverted",{fontCharacter:"\\eba1"}),f.debugAlt=new f("debug-alt",{fontCharacter:"\\eb91"}),f.serverProcess=new f("server-process",{fontCharacter:"\\eba2"}),f.serverEnvironment=new f("server-environment",{fontCharacter:"\\eba3"}),f.pass=new f("pass",{fontCharacter:"\\eba4"}),f.stopCircle=new f("stop-circle",{fontCharacter:"\\eba5"}),f.playCircle=new f("play-circle",{fontCharacter:"\\eba6"}),f.record=new f("record",{fontCharacter:"\\eba7"}),f.debugAltSmall=new f("debug-alt-small",{fontCharacter:"\\eba8"}),f.vmConnect=new f("vm-connect",{fontCharacter:"\\eba9"}),f.cloud=new f("cloud",{fontCharacter:"\\ebaa"}),f.merge=new f("merge",{fontCharacter:"\\ebab"}),f.exportIcon=new f("export",{fontCharacter:"\\ebac"}),f.graphLeft=new f("graph-left",{fontCharacter:"\\ebad"}),f.magnet=new f("magnet",{fontCharacter:"\\ebae"}),f.notebook=new f("notebook",{fontCharacter:"\\ebaf"}),f.redo=new f("redo",{fontCharacter:"\\ebb0"}),f.checkAll=new f("check-all",{fontCharacter:"\\ebb1"}),f.pinnedDirty=new f("pinned-dirty",{fontCharacter:"\\ebb2"}),f.passFilled=new f("pass-filled",{fontCharacter:"\\ebb3"}),f.circleLargeFilled=new f("circle-large-filled",{fontCharacter:"\\ebb4"}),f.circleLargeOutline=new f("circle-large-outline",{fontCharacter:"\\ebb5"}),f.combine=new f("combine",{fontCharacter:"\\ebb6"}),f.gather=new f("gather",{fontCharacter:"\\ebb6"}),f.table=new f("table",{fontCharacter:"\\ebb7"}),f.variableGroup=new f("variable-group",{fontCharacter:"\\ebb8"}),f.typeHierarchy=new f("type-hierarchy",{fontCharacter:"\\ebb9"}),f.typeHierarchySub=new f("type-hierarchy-sub",{fontCharacter:"\\ebba"}),f.typeHierarchySuper=new f("type-hierarchy-super",{fontCharacter:"\\ebbb"}),f.gitPullRequestCreate=new f("git-pull-request-create",{fontCharacter:"\\ebbc"}),f.runAbove=new f("run-above",{fontCharacter:"\\ebbd"}),f.runBelow=new f("run-below",{fontCharacter:"\\ebbe"}),f.notebookTemplate=new f("notebook-template",{fontCharacter:"\\ebbf"}),f.debugRerun=new f("debug-rerun",{fontCharacter:"\\ebc0"}),f.workspaceTrusted=new f("workspace-trusted",{fontCharacter:"\\ebc1"}),f.workspaceUntrusted=new f("workspace-untrusted",{fontCharacter:"\\ebc2"}),f.workspaceUnspecified=new f("workspace-unspecified",{fontCharacter:"\\ebc3"}),f.terminalCmd=new f("terminal-cmd",{fontCharacter:"\\ebc4"}),f.terminalDebian=new f("terminal-debian",{fontCharacter:"\\ebc5"}),f.terminalLinux=new f("terminal-linux",{fontCharacter:"\\ebc6"}),f.terminalPowershell=new f("terminal-powershell",{fontCharacter:"\\ebc7"}),f.terminalTmux=new f("terminal-tmux",{fontCharacter:"\\ebc8"}),f.terminalUbuntu=new f("terminal-ubuntu",{fontCharacter:"\\ebc9"}),f.terminalBash=new f("terminal-bash",{fontCharacter:"\\ebca"}),f.arrowSwap=new f("arrow-swap",{fontCharacter:"\\ebcb"}),f.copy=new f("copy",{fontCharacter:"\\ebcc"}),f.personAdd=new f("person-add",{fontCharacter:"\\ebcd"}),f.filterFilled=new f("filter-filled",{fontCharacter:"\\ebce"}),f.wand=new f("wand",{fontCharacter:"\\ebcf"}),f.debugLineByLine=new f("debug-line-by-line",{fontCharacter:"\\ebd0"}),f.inspect=new f("inspect",{fontCharacter:"\\ebd1"}),f.layers=new f("layers",{fontCharacter:"\\ebd2"}),f.layersDot=new f("layers-dot",{fontCharacter:"\\ebd3"}),f.layersActive=new f("layers-active",{fontCharacter:"\\ebd4"}),f.compass=new f("compass",{fontCharacter:"\\ebd5"}),f.compassDot=new f("compass-dot",{fontCharacter:"\\ebd6"}),f.compassActive=new f("compass-active",{fontCharacter:"\\ebd7"}),f.azure=new f("azure",{fontCharacter:"\\ebd8"}),f.issueDraft=new f("issue-draft",{fontCharacter:"\\ebd9"}),f.gitPullRequestClosed=new f("git-pull-request-closed",{fontCharacter:"\\ebda"}),f.gitPullRequestDraft=new f("git-pull-request-draft",{fontCharacter:"\\ebdb"}),f.debugAll=new f("debug-all",{fontCharacter:"\\ebdc"}),f.debugCoverage=new f("debug-coverage",{fontCharacter:"\\ebdd"}),f.runErrors=new f("run-errors",{fontCharacter:"\\ebde"}),f.folderLibrary=new f("folder-library",{fontCharacter:"\\ebdf"}),f.debugContinueSmall=new f("debug-continue-small",{fontCharacter:"\\ebe0"}),f.beakerStop=new f("beaker-stop",{fontCharacter:"\\ebe1"}),f.graphLine=new f("graph-line",{fontCharacter:"\\ebe2"}),f.graphScatter=new f("graph-scatter",{fontCharacter:"\\ebe3"}),f.pieChart=new f("pie-chart",{fontCharacter:"\\ebe4"}),f.bracket=new f("bracket",f.json.definition),f.bracketDot=new f("bracket-dot",{fontCharacter:"\\ebe5"}),f.bracketError=new f("bracket-error",{fontCharacter:"\\ebe6"}),f.lockSmall=new f("lock-small",{fontCharacter:"\\ebe7"}),f.azureDevops=new f("azure-devops",{fontCharacter:"\\ebe8"}),f.verifiedFilled=new f("verified-filled",{fontCharacter:"\\ebe9"})}(Ae||(Ae={}))},79881:function(Ci,Ft,re){"use strict";re.d(Ft,{B8:function(){return I},Cp:function(){return pe},F0:function(){return P},L6:function(){return ie},VV:function(){return Ae},b1:function(){return f},dL:function(){return Ye},ri:function(){return X}});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(C=>{C(T)})}onUnexpectedError(T){this.unexpectedErrorHandler(T),this.emit(T)}onUnexpectedExternalError(T){this.unexpectedErrorHandler(T)}}const we=new ue;function Ye(k){Ae(k)||we.onUnexpectedError(k)}function pe(k){Ae(k)||we.onUnexpectedExternalError(k)}function X(k){if(k instanceof Error){let{name:T,message:C}=k;const O=k.stacktrace||k.stack;return{$isError:!0,name:T,message:C,stack:O}}return k}const w="Canceled";function Ae(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 ie(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 ie},Q5:function(){return f},ZD:function(){return T},ju:function(){return X}});var ue=re(79881),we=re(69323),Ye=re(34502),pe=re(95830),X;(function(C){C.None=()=>we.JT.None;function O(Z){return(Q,fe=null,ne)=>{let A=!1,L;return L=Z(G=>{if(!A)return L?L.dispose():A=!0,Q.call(fe,G)},null,ne),A&&L.dispose(),L}}C.once=O;function J(Z,Q){return he((fe,ne=null,A)=>Z(L=>fe.call(ne,Q(L)),null,A))}C.map=J;function H(Z,Q){return he((fe,ne=null,A)=>Z(L=>{Q(L),fe.call(ne,L)},null,A))}C.forEach=H;function j(Z,Q){return he((fe,ne=null,A)=>Z(L=>Q(L)&&fe.call(ne,L),null,A))}C.filter=j;function $(Z){return Z}C.signal=$;function B(...Z){return(Q,fe=null,ne)=>(0,we.F8)(...Z.map(A=>A(L=>Q.call(fe,L),null,ne)))}C.any=B;function V(Z,Q,fe){let ne=fe;return J(Z,A=>(ne=Q(ne,A),ne))}C.reduce=V;function he(Z){let Q;const fe=new f({onFirstListenerAdd(){Q=Z(fe.fire,fe)},onLastListenerRemove(){Q.dispose()}});return fe.event}function be(Z,Q,fe=100,ne=!1,A){let L,G,de,ze=0;const pt=new f({leakWarningThreshold:A,onFirstListenerAdd(){L=Z(Ut=>{ze++,G=Q(G,Ut),ne&&!de&&(pt.fire(G),G=void 0),clearTimeout(de),de=setTimeout(()=>{const Ie=G;G=void 0,de=void 0,(!ne||ze>1)&&pt.fire(Ie),ze=0},fe)})},onLastListenerRemove(){L.dispose()}});return pt.event}C.debounce=be;function Te(Z,Q=(fe,ne)=>fe===ne){let fe=!0,ne;return j(Z,A=>{const L=fe||!Q(A,ne);return fe=!1,ne=A,L})}C.latch=Te;function se(Z,Q){return[C.filter(Z,Q),C.filter(Z,fe=>!Q(fe))]}C.split=se;function Ee(Z,Q=!1,fe=[]){let ne=fe.slice(),A=Z(de=>{ne?ne.push(de):G.fire(de)});const L=()=>{ne&&ne.forEach(de=>G.fire(de)),ne=null},G=new f({onFirstListenerAdd(){A||(A=Z(de=>G.fire(de)))},onFirstListenerDidAdd(){ne&&(Q?setTimeout(L):L())},onLastListenerRemove(){A&&A.dispose(),A=null}});return G.event}C.buffer=Ee;class je{constructor(Q){this.event=Q}map(Q){return new je(J(this.event,Q))}forEach(Q){return new je(H(this.event,Q))}filter(Q){return new je(j(this.event,Q))}reduce(Q,fe){return new je(V(this.event,Q,fe))}latch(){return new je(Te(this.event))}debounce(Q,fe=100,ne=!1,A){return new je(be(this.event,Q,fe,ne,A))}on(Q,fe,ne){return this.event(Q,fe,ne)}once(Q,fe,ne){return O(this.event)(Q,fe,ne)}}function Ke(Z){return new je(Z)}C.chain=Ke;function It(Z,Q,fe=ne=>ne){const ne=(...de)=>G.fire(fe(...de)),A=()=>Z.on(Q,ne),L=()=>Z.removeListener(Q,ne),G=new f({onFirstListenerAdd:A,onLastListenerRemove:L});return G.event}C.fromNodeEventEmitter=It;function ee(Z,Q,fe=ne=>ne){const ne=(...de)=>G.fire(fe(...de)),A=()=>Z.addEventListener(Q,ne),L=()=>Z.removeEventListener(Q,ne),G=new f({onFirstListenerAdd:A,onLastListenerRemove:L});return G.event}C.fromDOMEventEmitter=ee;function z(Z){return new Promise(Q=>O(Z)(Q))}C.toPromise=z})(X||(X={}));class w{constructor(O){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${O}_${w._idPool++}`}start(O){this._stopWatch=new pe.G(!0),this._listenerCount=O}stop(){if(this._stopWatch){const O=this._stopWatch.elapsed();this._elapsedOverall+=O,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${O.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}w._idPool=0;let Ae=-1;class P{constructor(O,J=Math.random().toString(18).slice(2,5)){this.customThreshold=O,this.name=J,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(O){let J=Ae;if(typeof this.customThreshold=="number"&&(J=this.customThreshold),J<=0||O<J)return;this._stacks||(this._stacks=new Map);const H=new Error().stack.split(`
|
|
|
`).slice(3).join(`
|
|
|
`),j=this._stacks.get(H)||0;if(this._stacks.set(H,j+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=J*.5;let $,B=0;for(const[V,he]of this._stacks)(!$||B<he)&&($=V,B=he);console.warn(`[${this.name}] potential listener LEAK detected, having ${O} listeners already. MOST frequent listener (${B}):`),console.warn($)}return()=>{const $=this._stacks.get(H)||0;this._stacks.set(H,$-1)}}}class f{constructor(O){var J;this._disposed=!1,this._options=O,this._leakageMon=Ae>0?new P(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((J=this._options)===null||J===void 0)&&J._profName?new w(this._options._profName):void 0}get event(){return this._event||(this._event=(O,J,H)=>{var j;this._listeners||(this._listeners=new Ye.S);const $=this._listeners.isEmpty();$&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const B=this._listeners.push(J?[O,J]:O);$&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,O,J);const V=(j=this._leakageMon)===null||j===void 0?void 0:j.check(this._listeners.size),he=(0,we.OF)(()=>{V&&V(),this._disposed||(B(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return H instanceof we.SL?H.add(he):Array.isArray(H)&&H.push(he),he}),this._event}fire(O){var J,H;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Ye.S);for(let j of this._listeners)this._deliveryQueue.push([j,O]);for((J=this._perfMon)===null||J===void 0||J.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(B){(0,ue.dL)(B)}}(H=this._perfMon)===null||H===void 0||H.stop()}}dispose(){var O,J,H,j,$;this._disposed||(this._disposed=!0,(O=this._listeners)===null||O===void 0||O.clear(),(J=this._deliveryQueue)===null||J===void 0||J.clear(),(j=(H=this._options)===null||H===void 0?void 0:H.onLastListenerRemove)===null||j===void 0||j.call(H),($=this._leakageMon)===null||$===void 0||$.dispose())}}class ie 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 ie{constructor(O){var J;super(O),this._delay=(J=O.delay)!==null&&J!==void 0?J: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(J,H,j)=>O($=>{const B=this.buffers[this.buffers.length-1];B?B.push(()=>J.call(H,$)):J.call(H,$)},void 0,j)}bufferEvents(O){const J=[];this.buffers.push(J);const H=O();return this.buffers.pop(),J.forEach(j=>j()),H}}class T{constructor(){this.listening=!1,this.inputEvent=X.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 pe=!1,X;return function(){return pe||(pe=!0,X=we.apply(Ye,arguments)),X}}},88226:function(Ci,Ft,re){"use strict";re.d(Ft,{$:function(){return ue}});var ue;(function(we){function Ye(B){return B&&typeof B=="object"&&typeof B[Symbol.iterator]=="function"}we.is=Ye;const pe=Object.freeze([]);function X(){return pe}we.empty=X;function*w(B){yield B}we.single=w;function Ae(B){return B||pe}we.from=Ae;function P(B){return!B||B[Symbol.iterator]().next().done===!0}we.isEmpty=P;function f(B){return B[Symbol.iterator]().next().value}we.first=f;function ie(B,V){for(const he of B)if(V(he))return!0;return!1}we.some=ie;function I(B,V){for(const he of B)if(V(he))return he}we.find=I;function*k(B,V){for(const he of B)V(he)&&(yield he)}we.filter=k;function*T(B,V){let he=0;for(const be of B)yield V(be,he++)}we.map=T;function*C(...B){for(const V of B)for(const he of V)yield he}we.concat=C;function*O(B){for(const V of B)for(const he of V)yield he}we.concatNested=O;function J(B,V,he){let be=he;for(const Te of B)be=V(be,Te);return be}we.reduce=J;function*H(B,V,he=B.length){for(V<0&&(V+=B.length),he<0?he+=B.length:he>B.length&&(he=B.length);V<he;V++)yield B[V]}we.slice=H;function j(B,V=Number.POSITIVE_INFINITY){const he=[];if(V===0)return[he,B];const be=B[Symbol.iterator]();for(let Te=0;Te<V;Te++){const se=be.next();if(se.done)return[he,we.empty()];he.push(se.value)}return[he,{[Symbol.iterator](){return be}}]}we.consume=j;function $(B,V,he=(be,Te)=>be===Te){const be=B[Symbol.iterator](),Te=V[Symbol.iterator]();for(;;){const se=be.next(),Ee=Te.next();if(se.done!==Ee.done)return!1;if(se.done)return!0;if(!he(se.value,Ee.value))return!1}}we.equals=$})(ue||(ue={}))},69323:function(Ci,Ft,re){"use strict";re.d(Ft,{B9:function(){return T},F8:function(){return C},JT:function(){return H},Jz:function(){return $},OF:function(){return O},SL:function(){return J},Wf:function(){return k},XK:function(){return j},dk:function(){return ie}});var ue=re(17845),we=re(88226);const Ye=!1;let pe=null;function X(B){pe=B}if(Ye){const B="__is_disposable_tracked__";X(new class{trackDisposable(V){const he=new Error("Potentially leaked disposable").stack;setTimeout(()=>{V[B]||console.log(he)},3e3)}setParent(V,he){if(V&&V!==H.None)try{V[B]=!0}catch(be){}}markAsDisposed(V){if(V&&V!==H.None)try{V[B]=!0}catch(he){}}markAsSingleton(V){}})}function w(B){return pe==null||pe.trackDisposable(B),B}function Ae(B){pe==null||pe.markAsDisposed(B)}function P(B,V){pe==null||pe.setParent(B,V)}function f(B,V){if(pe)for(const he of B)pe.setParent(he,V)}function ie(B){return pe==null||pe.markAsSingleton(B),B}class I extends Error{constructor(V){super(`Encountered errors while disposing of store. Errors: [${V.join(", ")}]`),this.errors=V}}function k(B){return typeof B.dispose=="function"&&B.dispose.length===0}function T(B){if(we.$.is(B)){let V=[];for(const he of B)if(he)try{he.dispose()}catch(be){V.push(be)}if(V.length===1)throw V[0];if(V.length>1)throw new I(V);return Array.isArray(B)?[]:B}else if(B)return B.dispose(),B}function C(...B){const V=O(()=>T(B));return f(B,V),V}function O(B){const V=w({dispose:(0,ue.I)(()=>{Ae(V),B()})});return V}class J{constructor(){this._toDispose=new Set,this._isDisposed=!1,w(this)}dispose(){this._isDisposed||(Ae(this),this._isDisposed=!0,this.clear())}clear(){try{T(this._toDispose.values())}finally{this._toDispose.clear()}}add(V){if(!V)return V;if(V===this)throw new Error("Cannot register a disposable on itself!");return P(V,this),this._isDisposed?J.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}}J.DISABLE_DISPOSED_WARNING=!1;class H{constructor(){this._store=new J,w(this),P(this._store,this)}dispose(){Ae(this),this._store.dispose()}_register(V){if(V===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(V)}}H.None=Object.freeze({dispose(){}});class j{constructor(){this._isDisposed=!1,w(this)}get value(){return this._isDisposed?void 0:this._value}set value(V){var he;this._isDisposed||V===this._value||((he=this._value)===null||he===void 0||he.dispose(),V&&P(V,this),this._value=V)}clear(){this.value=void 0}dispose(){var V;this._isDisposed=!0,Ae(this),(V=this._value)===null||V===void 0||V.dispose(),this._value=void 0}clearAndLeak(){const V=this._value;return this._value=void 0,V&&P(V,null),V}}class ${constructor(V){this.object=V}dispose(){}}},34502:function(Ci,Ft,re){"use strict";re.d(Ft,{S:function(){return we}});class ue{constructor(pe){this.element=pe,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 pe=this._first;for(;pe!==ue.Undefined;){const X=pe.next;pe.prev=ue.Undefined,pe.next=ue.Undefined,pe=X}this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}unshift(pe){return this._insert(pe,!1)}push(pe){return this._insert(pe,!0)}_insert(pe,X){const w=new ue(pe);if(this._first===ue.Undefined)this._first=w,this._last=w;else if(X){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 Ae=!1;return()=>{Ae||(Ae=!0,this._remove(w))}}shift(){if(this._first!==ue.Undefined){const pe=this._first.element;return this._remove(this._first),pe}}pop(){if(this._last!==ue.Undefined){const pe=this._last.element;return this._remove(this._last),pe}}_remove(pe){if(pe.prev!==ue.Undefined&&pe.next!==ue.Undefined){const X=pe.prev;X.next=pe.next,pe.next.prev=X}else pe.prev===ue.Undefined&&pe.next===ue.Undefined?(this._first=ue.Undefined,this._last=ue.Undefined):pe.next===ue.Undefined?(this._last=this._last.prev,this._last.next=ue.Undefined):pe.prev===ue.Undefined&&(this._first=this._first.next,this._first.prev=ue.Undefined);this._size-=1}*[Symbol.iterator](){let pe=this._first;for(;pe!==ue.Undefined;)yield pe.element,pe=pe.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 je},WE:function(){return se},dz:function(){return B},gn:function(){return Te},li:function(){return O},r:function(){return ee},tY:function(){return he},xS:function(){return Ee}});var ue=re(97671),we;const Ye="en";let pe=!1,X=!1,w=!1,Ae=!1,P=!1,f=!1,ie=!1,I,k=null,T=null,C;const O=typeof self=="object"?self:typeof re.g=="object"?re.g:{};let J;typeof O.vscode!="undefined"&&typeof O.vscode.process!="undefined"?J=O.vscode.process:typeof ue!="undefined"&&(J=ue);const H=typeof((we=J==null?void 0:J.versions)===null||we===void 0?void 0:we.electron)=="string"&&J.type==="renderer";if(typeof navigator=="object"&&!H)C=navigator.userAgent,pe=C.indexOf("Windows")>=0,X=C.indexOf("Macintosh")>=0,ie=(C.indexOf("Macintosh")>=0||C.indexOf("iPad")>=0||C.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,w=C.indexOf("Linux")>=0,f=!0,I=navigator.language,k=I;else if(typeof J=="object"){pe=J.platform==="win32",X=J.platform==="darwin",w=J.platform==="linux",Ae=w&&!!J.env.SNAP&&!!J.env.SNAP_REVISION,I=Ye,k=Ye;const z=J.env.VSCODE_NLS_CONFIG;if(z)try{const Z=JSON.parse(z),Q=Z.availableLanguages["*"];I=Z.locale,k=Q||Ye,T=Z._translationsConfigFile}catch(Z){}P=!0}else console.error("Unable to resolve platform.");let j=0;X?j=1:pe?j=3:w&&(j=2);const $=pe,B=X,V=w,he=P,be=f,Te=ie,se=C,Ee=function(){if(O.setImmediate)return O.setImmediate.bind(O);if(typeof O.postMessage=="function"&&!O.importScripts){let Q=[];O.addEventListener("message",ne=>{if(ne.data&&ne.data.vscodeSetImmediateId)for(let A=0,L=Q.length;A<L;A++){const G=Q[A];if(G.id===ne.data.vscodeSetImmediateId){Q.splice(A,1),G.callback();return}}});let fe=0;return ne=>{const A=++fe;Q.push({id:A,callback:ne}),O.postMessage({vscodeSetImmediateId:A},"*")}}if(typeof(J==null?void 0:J.nextTick)=="function")return J.nextTick.bind(J);const Z=Promise.resolve();return Q=>Z.then(Q)}(),je=X||ie?2:pe?1:3;let Ke=!0,It=!1;function ee(){if(!It){It=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,Ke=new Uint16Array(z.buffer)[0]===513}return Ke}},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(X){this._highResolution=we&&X,this._startTime=this._now(),this._stopTime=-1}static create(X=!0){return new Ye(X)}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 ze},C8:function(){return Pt},GF:function(){return I},HO:function(){return fe},IO:function(){return k},K7:function(){return Yt},Kw:function(){return it},LC:function(){return O},Mh:function(){return Ee},P1:function(){return je},PJ:function(){return mt},Qe:function(){return pt},R1:function(){return ie},RP:function(){return G},S6:function(){return ht},TT:function(){return $},Ut:function(){return A},V8:function(){return J},WU:function(){return Ye},YK:function(){return It},YU:function(){return pe},ZG:function(){return Ke},ZH:function(){return z},ab:function(){return Ut},c1:function(){return St},df:function(){return be},ec:function(){return X},fi:function(){return ti},fy:function(){return w},j3:function(){return Ae},j_:function(){return V},m5:function(){return ue},mK:function(){return he},mr:function(){return T},oH:function(){return me},oL:function(){return P},ok:function(){return se},ow:function(){return H},qq:function(){return Te},qu:function(){return j},rL:function(){return ee},uS:function(){return $e},un:function(){return f},uq:function(){return C},vH:function(){return Q},xe:function(){return Ie},zY:function(){return B}});function ue(q){return!q||typeof q!="string"?!0:q.trim().length===0}const we=/{(\d+)}/g;function Ye(q,...ye){return ye.length===0?q:q.replace(we,function(Fe,Ze){const ot=parseInt(Ze,10);return isNaN(ot)||ot<0||ot>=ye.length?Fe:ye[ot]})}function pe(q){return q.replace(/[<>&]/g,function(ye){switch(ye){case"<":return"<";case">":return">";case"&":return"&";default:return ye}})}function X(q){return q.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function w(q,ye=" "){const Fe=Ae(q,ye);return P(Fe,ye)}function Ae(q,ye){if(!q||!ye)return q;const Fe=ye.length;if(Fe===0||q.length===0)return q;let Ze=0;for(;q.indexOf(ye,Ze)===Ze;)Ze=Ze+Fe;return q.substring(Ze)}function P(q,ye){if(!q||!ye)return q;const Fe=ye.length,Ze=q.length;if(Fe===0||Ze===0)return q;let ot=Ze,bt=-1;for(;bt=q.lastIndexOf(ye,ot-1),!(bt===-1||bt+Fe!==ot);){if(bt===0)return"";ot=bt}return q.substring(0,ot)}function f(q){return q.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function ie(q){return q.replace(/\*/g,"")}function I(q,ye,Fe={}){if(!q)throw new Error("Cannot create regex from empty string");ye||(q=X(q)),Fe.wholeWord&&(/\B/.test(q.charAt(0))||(q="\\b"+q),/\B/.test(q.charAt(q.length-1))||(q=q+"\\b"));let Ze="";return Fe.global&&(Ze+="g"),Fe.matchCase||(Ze+="i"),Fe.multiline&&(Ze+="m"),Fe.unicode&&(Ze+="u"),new RegExp(q,Ze)}function k(q){return q.source==="^"||q.source==="^$"||q.source==="$"||q.source==="^\\s*$"?!1:!!(q.exec("")&&q.lastIndex===0)}function T(q){return(q.global?"g":"")+(q.ignoreCase?"i":"")+(q.multiline?"m":"")+(q.unicode?"u":"")}function C(q){return q.split(/\r\n|\r|\n/)}function O(q){for(let ye=0,Fe=q.length;ye<Fe;ye++){const Ze=q.charCodeAt(ye);if(Ze!==32&&Ze!==9)return ye}return-1}function J(q,ye=0,Fe=q.length){for(let Ze=ye;Ze<Fe;Ze++){const ot=q.charCodeAt(Ze);if(ot!==32&&ot!==9)return q.substring(ye,Ze)}return q.substring(ye,Fe)}function H(q,ye=q.length-1){for(let Fe=ye;Fe>=0;Fe--){const Ze=q.charCodeAt(Fe);if(Ze!==32&&Ze!==9)return Fe}return-1}function j(q,ye){return q<ye?-1:q>ye?1:0}function $(q,ye,Fe=0,Ze=q.length,ot=0,bt=ye.length){for(;Fe<Ze&&ot<bt;Fe++,ot++){let Se=q.charCodeAt(Fe),xt=ye.charCodeAt(ot);if(Se<xt)return-1;if(Se>xt)return 1}const qt=Ze-Fe,vt=bt-ot;return qt<vt?-1:qt>vt?1:0}function B(q,ye){return V(q,ye,0,q.length,0,ye.length)}function V(q,ye,Fe=0,Ze=q.length,ot=0,bt=ye.length){for(;Fe<Ze&&ot<bt;Fe++,ot++){let Se=q.charCodeAt(Fe),xt=ye.charCodeAt(ot);if(Se===xt)continue;if(Se>=128||xt>=128)return $(q.toLowerCase(),ye.toLowerCase(),Fe,Ze,ot,bt);he(Se)&&(Se-=32),he(xt)&&(xt-=32);const Wt=Se-xt;if(Wt!==0)return Wt}const qt=Ze-Fe,vt=bt-ot;return qt<vt?-1:qt>vt?1:0}function he(q){return q>=97&&q<=122}function be(q){return q>=65&&q<=90}function Te(q,ye){return q.length===ye.length&&V(q,ye)===0}function se(q,ye){const Fe=ye.length;return ye.length>q.length?!1:V(q,ye,0,Fe)===0}function Ee(q,ye){let Fe,Ze=Math.min(q.length,ye.length);for(Fe=0;Fe<Ze;Fe++)if(q.charCodeAt(Fe)!==ye.charCodeAt(Fe))return Fe;return Ze}function je(q,ye){let Fe,Ze=Math.min(q.length,ye.length);const ot=q.length-1,bt=ye.length-1;for(Fe=0;Fe<Ze;Fe++)if(q.charCodeAt(ot-Fe)!==ye.charCodeAt(bt-Fe))return Fe;return Ze}function Ke(q){return 55296<=q&&q<=56319}function It(q){return 56320<=q&&q<=57343}function ee(q,ye){return(q-55296<<10)+(ye-56320)+65536}function z(q,ye,Fe){const Ze=q.charCodeAt(Fe);if(Ke(Ze)&&Fe+1<ye){const ot=q.charCodeAt(Fe+1);if(It(ot))return ee(Ze,ot)}return Ze}function Z(q,ye){const Fe=q.charCodeAt(ye-1);if(It(Fe)&&ye>1){const Ze=q.charCodeAt(ye-2);if(Ke(Ze))return ee(Ze,Fe)}return Fe}function Q(q,ye){const Fe=Ce.getInstance(),Ze=ye,ot=q.length,bt=z(q,ot,ye);ye+=bt>=65536?2:1;let qt=Fe.getGraphemeBreakType(bt);for(;ye<ot;){const vt=z(q,ot,ye),Se=Fe.getGraphemeBreakType(vt);if(ti(qt,Se))break;ye+=vt>=65536?2:1,qt=Se}return ye-Ze}function fe(q,ye){const Fe=Ce.getInstance(),Ze=ye,ot=Z(q,ye);ye-=ot>=65536?2:1;let bt=Fe.getGraphemeBreakType(ot);for(;ye>0;){const qt=Z(q,ye),vt=Fe.getGraphemeBreakType(qt);if(ti(vt,bt))break;ye-=qt>=65536?2:1,bt=vt}return Ze-ye}const ne=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function A(q){return ne.test(q)}const L=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function G(q){return L.test(q)}const de=/^[\t\n\r\x20-\x7E]*$/;function ze(q){return de.test(q)}const pt=/[\u2028\u2029]/;function Ut(q){return pt.test(q)}function Ie(q){for(let ye=0,Fe=q.length;ye<Fe;ye++)if(Yt(q.charCodeAt(ye)))return!0;return!1}function Yt(q){return q=+q,q>=11904&&q<=55215||q>=63744&&q<=64255||q>=65281&&q<=65374}function Pt(q){return q>=127462&&q<=127487||q===8986||q===8987||q===9200||q===9203||q>=9728&&q<=10175||q===11088||q===11093||q>=127744&&q<=128591||q>=128640&&q<=128764||q>=128992&&q<=129003||q>=129280&&q<=129535||q>=129648&&q<=129750}const St="\uFEFF";function $e(q){return!!(q&&q.length>0&&q.charCodeAt(0)===65279)}function it(q,ye=!1){return q?(ye&&(q=q.replace(/\\./g,"")),q.toLowerCase()!==q):!1}function mt(q){return q=q%(2*26),q<26?String.fromCharCode(97+q):String.fromCharCode(65+q-26)}function ht(q){return Ce.getInstance().getGraphemeBreakType(q)}function ti(q,ye){return q===0?ye!==5&&ye!==7:q===2&&ye===3?!1:q===4||q===2||q===3||ye===4||ye===2||ye===3?!0:!(q===8&&(ye===8||ye===9||ye===11||ye===12)||(q===11||q===9)&&(ye===9||ye===10)||(q===12||q===10)&&ye===10||ye===5||ye===13||ye===7||q===1||q===13&&ye===14||q===6&&ye===6)}class Ce{constructor(){this._data=Be()}static getInstance(){return Ce._INSTANCE||(Ce._INSTANCE=new Ce),Ce._INSTANCE}getGraphemeBreakType(ye){if(ye<32)return ye===10?3:ye===13?2:4;if(ye<127)return 0;const Fe=this._data,Ze=Fe.length/3;let ot=1;for(;ot<=Ze;)if(ye<Fe[3*ot])ot=2*ot;else if(ye>Fe[3*ot+1])ot=2*ot+1;else return Fe[3*ot+2];return 0}}Ce._INSTANCE=null;function Be(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function me(q,ye){if(q===0)return 0;const Fe=Xe(q,ye);if(Fe!==void 0)return Fe;const Ze=Z(ye,q);return q-=at(Ze),q}function Xe(q,ye){let Fe=Z(ye,q);for(q-=at(Fe);Je(Fe)||Fe===65039||Fe===8419;){if(q===0)return;Fe=Z(ye,q),q-=at(Fe)}if(Pt(Fe)){if(q>=0){const Ze=Z(ye,q);Ze===8205&&(q-=at(Ze))}return q}}function at(q){return q>=65536?2:1}function Je(q){return 127995<=q&&q<=127999}},72999:function(Ci,Ft,re){"use strict";re.d(Ft,{$E:function(){return O},$K:function(){return Ae},D8:function(){return k},HD:function(){return we},IU:function(){return J},Jp:function(){return P},Kn:function(){return Ye},cW:function(){return ie},f6:function(){return H},hj:function(){return pe},jn:function(){return X},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 pe($){return typeof $=="number"&&!isNaN($)}function X($){return $===!0||$===!1}function w($){return typeof $=="undefined"}function Ae($){return!P($)}function P($){return w($)||$===null}function f($,B){if(!$)throw new Error(B?`Unexpected type, expected '${B}'`:"Unexpected type")}function ie($){if(P($))throw new Error("Assertion Failed: argument is undefined or null");return $}function I($){return typeof $=="function"}function k($,B){const V=Math.min($.length,B.length);for(let he=0;he<V;he++)T($[he],B[he])}function T($,B){if(we(B)){if(typeof $!==B)throw new Error(`argument does not match constraint: typeof ${B}`)}else if(I(B)){try{if($ instanceof B)return}catch(V){}if(!P($)&&$.constructor===B||B.length===1&&B.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 C($){let B=[],V=Object.getPrototypeOf($);for(;Object.prototype!==V;)B=B.concat(Object.getOwnPropertyNames(V)),V=Object.getPrototypeOf(V);return B}function O($){const B=[];for(const V of C($))typeof $[V]=="function"&&B.push(V);return B}function J($,B){const V=be=>function(){const Te=Array.prototype.slice.call(arguments,0);return B(be,Te)};let he={};for(const be of $)he[be]=V(be);return he}function H($){return $===null?void 0:$}function j($,B="Unreachable"){throw new Error(B)}},13268:function(Ci,Ft,re){"use strict";re.d(Ft,{N:function(){return we}});function ue(Ye,pe){let X;return pe.length===0?X=Ye:X=Ye.replace(/\{(\d+)\}/g,function(w,Ae){const P=Ae[0];return typeof pe[P]!="undefined"?pe[P]:w}),X}function we(Ye,pe,...X){return ue(pe,X)}},96236:function(Ci,Ft,re){"use strict";re.d(Ft,{BH:function(){return J},NZ:function(){return H},U8:function(){return j},co:function(){return O},eH:function(){return C},vr:function(){return T}});var ue=re(75918),we=re(52615),Ye=re(4348),pe=re(88226),X=re(69323),w=re(34502),Ae=re(35884),P=re(90689),f=re(16925),ie=re(49055),I=function($,B,V,he){var be=arguments.length,Te=be<3?B:he===null?he=Object.getOwnPropertyDescriptor(B,V):he,se;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Te=Reflect.decorate($,B,V,he);else for(var Ee=$.length-1;Ee>=0;Ee--)(se=$[Ee])&&(Te=(be<3?se(Te):be>3?se(B,V,Te):se(B,V))||Te);return be>3&&Te&&Object.defineProperty(B,V,Te),Te},k=function($,B){return function(V,he){B(V,he,$)}};function T($){return $.command!==void 0}class C{constructor(B){this.id=C._idPool++,this._debugName=B}}C._idPool=0,C.CommandPalette=new C("CommandPalette"),C.EditorContext=new C("EditorContext"),C.SimpleEditorContext=new C("SimpleEditorContext"),C.EditorContextCopy=new C("EditorContextCopy"),C.EditorContextPeek=new C("EditorContextPeek"),C.MenubarEditMenu=new C("MenubarEditMenu"),C.MenubarCopy=new C("MenubarCopy"),C.MenubarGoMenu=new C("MenubarGoMenu"),C.MenubarSelectionMenu=new C("MenubarSelectionMenu"),C.InlineCompletionsActions=new C("InlineCompletionsActions");const O=(0,f.yh)("menuService"),J=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Ye.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:$=>$===C.CommandPalette}}addCommand($){return this.addCommands(pe.$.single($))}addCommands($){for(const B of $)this._commands.set(B.id,B);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,X.OF)(()=>{let B=!1;for(const V of $)B=this._commands.delete(V.id)||B;B&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand($){return this._commands.get($)}getCommands(){const $=new Map;return this._commands.forEach((B,V)=>$.set(V,B)),$}appendMenuItem($,B){return this.appendMenuItems(pe.$.single({id:$,item:B}))}appendMenuItems($){const B=new Set,V=new w.S;for(const{id:he,item:be}of $){let Te=this._menuItems.get(he);Te||(Te=new w.S,this._menuItems.set(he,Te)),V.push(Te.push(be)),B.add(he)}return this._onDidChangeMenu.fire(B),(0,X.OF)(()=>{if(V.size>0){for(let he of V)he();this._onDidChangeMenu.fire(B),V.clear()}})}getMenuItems($){let B;return this._menuItems.has($)?B=[...this._menuItems.get($)]:B=[],$===C.CommandPalette&&this._appendImplicitItems(B),B}_appendImplicitItems($){const B=new Set;for(const V of $)T(V)&&(B.add(V.command.id),V.alt&&B.add(V.alt.id));this._commands.forEach((V,he)=>{B.has(he)||$.push({command:V})})}};class H extends ue.wY{constructor(B,V,he,be){super(`submenuitem.${B.submenu.id}`,typeof B.title=="string"?B.title:B.title.value,[],"submenu"),this.item=B,this._menuService=V,this._contextKeyService=he,this._options=be}get actions(){const B=[],V=this._menuService.createMenu(this.item.submenu,this._contextKeyService),he=V.getActions(this._options);V.dispose();for(const[,be]of he)be.length>0&&(B.push(...be),B.push(new ue.Z0));return B.length&&B.pop(),B}}let j=class Tp{constructor(B,V,he,be,Te){var se,Ee;if(this._commandService=Te,this.id=B.id,this.label=he!=null&&he.renderShortTitle&&B.shortTitle?typeof B.shortTitle=="string"?B.shortTitle:B.shortTitle.value:typeof B.title=="string"?B.title:B.title.value,this.tooltip=(Ee=typeof B.tooltip=="string"?B.tooltip:(se=B.tooltip)===null||se===void 0?void 0:se.value)!==null&&Ee!==void 0?Ee:"",this.enabled=!B.precondition||be.contextMatchesRules(B.precondition),this.checked=void 0,B.toggled){const je=B.toggled.condition?B.toggled:{condition:B.toggled};this.checked=be.contextMatchesRules(je.condition),this.checked&&je.tooltip&&(this.tooltip=typeof je.tooltip=="string"?je.tooltip:je.tooltip.value),je.title&&(this.label=typeof je.title=="string"?je.title:je.title.value)}this.item=B,this.alt=V?new Tp(V,void 0,he,be,Te):void 0,this._options=he,ie.kS.isThemeIcon(B.icon)&&(this.class=we.dT.asClassName(B.icon))}dispose(){}run(...B){var V,he;let be=[];return!((V=this._options)===null||V===void 0)&&V.arg&&(be=[...be,this._options.arg]),!((he=this._options)===null||he===void 0)&&he.shouldForwardArgs&&(be=[...be,...B]),this._commandService.executeCommand(this.id,...be)}};j=I([k(3,P.i6),k(4,Ae.H)],j)},35884:function(Ci,Ft,re){"use strict";re.d(Ft,{H:function(){return Ae},P:function(){return P}});var ue=re(4348),we=re(88226),Ye=re(69323),pe=re(34502),X=re(72999),w=re(16925);const Ae=(0,w.yh)("commandService"),P=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new ue.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(f,ie){if(!f)throw new Error("invalid command");if(typeof f=="string"){if(!ie)throw new Error("invalid command");return this.registerCommand({id:f,handler:ie})}if(f.description){const O=[];for(let H of f.description.args)O.push(H.constraint);const J=f.handler;f.handler=function(H,...j){return(0,X.D8)(j,O),J(H,...j)}}const{id:I}=f;let k=this._commands.get(I);k||(k=new pe.S,this._commands.set(I,k));let T=k.unshift(f),C=(0,Ye.OF)(()=>{T();const O=this._commands.get(I);O!=null&&O.isEmpty()&&this._commands.delete(I)});return this._onDidRegisterCommand.fire(I),C}registerCommandAlias(f,ie){return P.registerCommand(f,(I,...k)=>I.get(Ae).executeCommand(ie,...k))}getCommand(f){const ie=this._commands.get(f);if(!(!ie||ie.isEmpty()))return we.$.first(ie)}getCommands(){const f=new Map;for(const ie of this._commands.keys()){const I=this.getCommand(ie);I&&f.set(ie,I)}return f}};P.registerCommand("noop",()=>{})},90689:function(Ci,Ft,re){"use strict";re.d(Ft,{Ao:function(){return Ae},Eq:function(){return ee},Fb:function(){return P},K8:function(){return Q},i6:function(){return It},uy:function(){return Ke}});var ue=re(23345),we=re(82983),Ye=re(16925);let pe=ue.WE||"";const X=new Map;X.set("false",!1),X.set("true",!0),X.set("isMac",ue.dz),X.set("isLinux",ue.IJ),X.set("isWindows",ue.ED),X.set("isWeb",ue.$L),X.set("isMacNative",ue.dz&&!ue.$L),X.set("isEdge",pe.indexOf("Edg/")>=0),X.set("isFirefox",pe.indexOf("Firefox")>=0),X.set("isChrome",pe.indexOf("Chrome")>=0),X.set("isSafari",pe.indexOf("Safari")>=0);const w=Object.prototype.hasOwnProperty;class Ae{static has(A){return k.create(A)}static equals(A,L){return T.create(A,L)}static regex(A,L){return be.create(A,L)}static not(A){return H.create(A)}static and(...A){return Ee.create(A,null)}static or(...A){return je.create(A,null,!0)}static deserialize(A,L=!1){if(A)return this._deserializeOrExpression(A,L)}static _deserializeOrExpression(A,L){let G=A.split("||");return je.create(G.map(de=>this._deserializeAndExpression(de,L)),null,!0)}static _deserializeAndExpression(A,L){let G=A.split("&&");return Ee.create(G.map(de=>this._deserializeOne(de,L)),null)}static _deserializeOne(A,L){if(A=A.trim(),A.indexOf("!=")>=0){let G=A.split("!=");return J.create(G[0].trim(),this._deserializeValue(G[1],L))}if(A.indexOf("==")>=0){let G=A.split("==");return T.create(G[0].trim(),this._deserializeValue(G[1],L))}if(A.indexOf("=~")>=0){let G=A.split("=~");return be.create(G[0].trim(),this._deserializeRegexValue(G[1],L))}if(A.indexOf(" in ")>=0){let G=A.split(" in ");return C.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(A)){const G=A.split(">=");return B.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(A)){const G=A.split(">");return $.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(A)){const G=A.split("<=");return he.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(A)){const G=A.split("<");return V.create(G[0].trim(),G[1].trim())}return/^\!\s*/.test(A)?H.create(A.substr(1).trim()):k.create(A)}static _deserializeValue(A,L){if(A=A.trim(),A==="true")return!0;if(A==="false")return!1;let G=/^'([^']*)'$/.exec(A);return G?G[1].trim():A}static _deserializeRegexValue(A,L){if((0,we.m5)(A)){if(L)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let G=A.indexOf("/"),de=A.lastIndexOf("/");if(G===de||G<0){if(L)throw new Error(`bad regexp-value '${A}', missing /-enclosure`);return console.warn(`bad regexp-value '${A}', missing /-enclosure`),null}let ze=A.slice(G+1,de),pt=A[de+1]==="i"?"i":"";try{return new RegExp(ze,pt)}catch(Ut){if(L)throw new Error(`bad regexp-value '${A}', parse error: ${Ut}`);return console.warn(`bad regexp-value '${A}', parse error: ${Ut}`),null}}}function P(ne,A){const L=ne?ne.substituteConstants():void 0,G=A?A.substituteConstants():void 0;return!L&&!G?!0:!L||!G?!1:L.equals(G)}function f(ne,A){return ne.cmp(A)}class ie{constructor(){this.type=0}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!1}serialize(){return"false"}keys(){return[]}negate(){return I.INSTANCE}}ie.INSTANCE=new ie;class I{constructor(){this.type=1}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!0}serialize(){return"true"}keys(){return[]}negate(){return ie.INSTANCE}}I.INSTANCE=new I;class k{constructor(A,L){this.key=A,this.negated=L,this.type=2}static create(A,L=null){const G=X.get(A);return typeof G=="boolean"?G?I.INSTANCE:ie.INSTANCE:new k(A,L)}cmp(A){return A.type!==this.type?this.type-A.type:z(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=X.get(this.key);return typeof A=="boolean"?A?I.INSTANCE:ie.INSTANCE:this}evaluate(A){return!!A.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=H.create(this.key,this)),this.negated}}class T{constructor(A,L,G){this.key=A,this.value=L,this.negated=G,this.type=4}static create(A,L,G=null){if(typeof L=="boolean")return L?k.create(A,G):H.create(A,G);const de=X.get(A);return typeof de=="boolean"?L===(de?"true":"false")?I.INSTANCE:ie.INSTANCE:new T(A,L,G)}cmp(A){return A.type!==this.type?this.type-A.type:Z(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=X.get(this.key);if(typeof A=="boolean"){const L=A?"true":"false";return this.value===L?I.INSTANCE:ie.INSTANCE}return this}evaluate(A){return A.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=J.create(this.key,this.value,this)),this.negated}}class C{constructor(A,L){this.key=A,this.valueKey=L,this.type=10,this.negated=null}static create(A,L){return new C(A,L)}cmp(A){return A.type!==this.type?this.type-A.type:Z(this.key,this.valueKey,A.key,A.valueKey)}equals(A){return A.type===this.type?this.key===A.key&&this.valueKey===A.valueKey:!1}substituteConstants(){return this}evaluate(A){const L=A.getValue(this.valueKey),G=A.getValue(this.key);return Array.isArray(L)?L.indexOf(G)>=0:typeof G=="string"&&typeof L=="object"&&L!==null?w.call(L,G):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=O.create(this)),this.negated}}class O{constructor(A){this._actual=A,this.type=11}static create(A){return new O(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class J{constructor(A,L,G){this.key=A,this.value=L,this.negated=G,this.type=5}static create(A,L,G=null){if(typeof L=="boolean")return L?H.create(A,G):k.create(A,G);const de=X.get(A);return typeof de=="boolean"?L===(de?"true":"false")?ie.INSTANCE:I.INSTANCE:new J(A,L,G)}cmp(A){return A.type!==this.type?this.type-A.type:Z(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=X.get(this.key);if(typeof A=="boolean"){const L=A?"true":"false";return this.value===L?ie.INSTANCE:I.INSTANCE}return this}evaluate(A){return A.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=T.create(this.key,this.value,this)),this.negated}}class H{constructor(A,L){this.key=A,this.negated=L,this.type=3}static create(A,L=null){const G=X.get(A);return typeof G=="boolean"?G?ie.INSTANCE:I.INSTANCE:new H(A,L)}cmp(A){return A.type!==this.type?this.type-A.type:z(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=X.get(this.key);return typeof A=="boolean"?A?ie.INSTANCE:I.INSTANCE:this}evaluate(A){return!A.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=k.create(this.key,this)),this.negated}}function j(ne,A){if(typeof ne=="string"){const L=parseFloat(ne);isNaN(L)||(ne=L)}return typeof ne=="string"||typeof ne=="number"?A(ne):ie.INSTANCE}class ${constructor(A,L,G){this.key=A,this.value=L,this.negated=G,this.type=12}static create(A,L,G=null){return j(L,de=>new $(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:Z(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=he.create(this.key,this.value,this)),this.negated}}class B{constructor(A,L,G){this.key=A,this.value=L,this.negated=G,this.type=13}static create(A,L,G=null){return j(L,de=>new B(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:Z(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=V.create(this.key,this.value,this)),this.negated}}class V{constructor(A,L,G){this.key=A,this.value=L,this.negated=G,this.type=14}static create(A,L,G=null){return j(L,de=>new V(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:Z(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=B.create(this.key,this.value,this)),this.negated}}class he{constructor(A,L,G){this.key=A,this.value=L,this.negated=G,this.type=15}static create(A,L,G=null){return j(L,de=>new he(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:Z(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=$.create(this.key,this.value,this)),this.negated}}class be{constructor(A,L){this.key=A,this.regexp=L,this.type=7,this.negated=null}static create(A,L){return new be(A,L)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.key<A.key)return-1;if(this.key>A.key)return 1;const L=this.regexp?this.regexp.source:"",G=A.regexp?A.regexp.source:"";return L<G?-1:L>G?1:0}equals(A){if(A.type===this.type){const L=this.regexp?this.regexp.source:"",G=A.regexp?A.regexp.source:"";return this.key===A.key&&L===G}return!1}substituteConstants(){return this}evaluate(A){let L=A.getValue(this.key);return this.regexp?this.regexp.test(L):!1}serialize(){const A=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${A}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Te.create(this)),this.negated}}class Te{constructor(A){this._actual=A,this.type=8}static create(A){return new Te(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function se(ne){let A=null;for(let L=0,G=ne.length;L<G;L++){const de=ne[L].substituteConstants();if(ne[L]!==de&&A===null){A=[];for(let ze=0;ze<L;ze++)A[ze]=ne[ze]}A!==null&&(A[L]=de)}return A===null?ne:A}class Ee{constructor(A,L){this.expr=A,this.negated=L,this.type=6}static create(A,L){return Ee._normalizeArr(A,L)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let L=0,G=this.expr.length;L<G;L++){const de=f(this.expr[L],A.expr[L]);if(de!==0)return de}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let L=0,G=this.expr.length;L<G;L++)if(!this.expr[L].equals(A.expr[L]))return!1;return!0}return!1}substituteConstants(){const A=se(this.expr);return A===this.expr?this:Ee.create(A,this.negated)}evaluate(A){for(let L=0,G=this.expr.length;L<G;L++)if(!this.expr[L].evaluate(A))return!1;return!0}static _normalizeArr(A,L){const G=[];let de=!1;for(const ze of A)if(ze){if(ze.type===1){de=!0;continue}if(ze.type===0)return ie.INSTANCE;if(ze.type===6){G.push(...ze.expr);continue}G.push(ze)}if(G.length===0&&de)return I.INSTANCE;if(G.length!==0){if(G.length===1)return G[0];G.sort(f);for(let ze=1;ze<G.length;ze++)G[ze-1].equals(G[ze])&&(G.splice(ze,1),ze--);if(G.length===1)return G[0];for(;G.length>1;){const ze=G[G.length-1];if(ze.type!==9)break;G.pop();const pt=G.pop(),Ut=G.length===0,Ie=je.create(ze.expr.map(Yt=>Ee.create([Yt,pt],null)),null,Ut);Ie&&(G.push(Ie),G.sort(f))}return G.length===1?G[0]:new Ee(G,L)}}serialize(){return this.expr.map(A=>A.serialize()).join(" && ")}keys(){const A=[];for(let L of this.expr)A.push(...L.keys());return A}negate(){if(!this.negated){const A=[];for(let L of this.expr)A.push(L.negate());this.negated=je.create(A,this,!0)}return this.negated}}class je{constructor(A,L){this.expr=A,this.negated=L,this.type=9}static create(A,L,G){return je._normalizeArr(A,L,G)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let L=0,G=this.expr.length;L<G;L++){const de=f(this.expr[L],A.expr[L]);if(de!==0)return de}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let L=0,G=this.expr.length;L<G;L++)if(!this.expr[L].equals(A.expr[L]))return!1;return!0}return!1}substituteConstants(){const A=se(this.expr);return A===this.expr?this:je.create(A,this.negated,!1)}evaluate(A){for(let L=0,G=this.expr.length;L<G;L++)if(this.expr[L].evaluate(A))return!0;return!1}static _normalizeArr(A,L,G){let de=[],ze=!1;if(A){for(let pt=0,Ut=A.length;pt<Ut;pt++){const Ie=A[pt];if(Ie){if(Ie.type===0){ze=!0;continue}if(Ie.type===1)return I.INSTANCE;if(Ie.type===9){de=de.concat(Ie.expr);continue}de.push(Ie)}}if(de.length===0&&ze)return ie.INSTANCE;de.sort(f)}if(de.length!==0){if(de.length===1)return de[0];for(let pt=1;pt<de.length;pt++)de[pt-1].equals(de[pt])&&(de.splice(pt,1),pt--);if(de.length===1)return de[0];if(G){for(let pt=0;pt<de.length;pt++)for(let Ut=pt+1;Ut<de.length;Ut++)Q(de[pt],de[Ut])&&(de.splice(Ut,1),Ut--);if(de.length===1)return de[0]}return new je(de,L)}}serialize(){return this.expr.map(A=>A.serialize()).join(" || ")}keys(){const A=[];for(let L of this.expr)A.push(...L.keys());return A}negate(){if(!this.negated){let A=[];for(let L of this.expr)A.push(L.negate());for(;A.length>1;){const L=A.shift(),G=A.shift(),de=[];for(const pt of fe(L))for(const Ut of fe(G))de.push(Ee.create([pt,Ut],null));const ze=A.length===0;A.unshift(je.create(de,null,ze))}this.negated=A[0]}return this.negated}}class Ke extends k{constructor(A,L,G){super(A,null),this._defaultValue=L,typeof G=="object"?Ke._info.push(Object.assign(Object.assign({},G),{key:A})):G!==!0&&Ke._info.push({key:A,description:G,type:L!=null?typeof L:void 0})}static all(){return Ke._info.values()}bindTo(A){return A.createKey(this.key,this._defaultValue)}getValue(A){return A.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(A){return T.create(this.key,A)}}Ke._info=[];const It=(0,Ye.yh)("contextKeyService"),ee="setContext";function z(ne,A){return ne<A?-1:ne>A?1:0}function Z(ne,A,L,G){return ne<L?-1:ne>L?1:A<G?-1:A>G?1:0}function Q(ne,A){if(A.type===6&&ne.type!==9&&ne.type!==6){for(const de of A.expr)if(ne.equals(de))return!0}const L=ne.negate(),G=fe(L).concat(fe(A));G.sort(f);for(let de=0;de<G.length;de++){const pt=G[de].negate();for(let Ut=de+1;Ut<G.length;Ut++){const Ie=G[Ut];if(pt.equals(Ie))return!0}}return!1}function fe(ne){return ne.type===9?ne.expr:[ne]}},16925:function(Ci,Ft,re){"use strict";re.d(Ft,{I8:function(){return ue},TG:function(){return we},jt:function(){return X},yh:function(){return pe}});var ue;(function(w){w.serviceIds=new Map,w.DI_TARGET="$di$target",w.DI_DEPENDENCIES="$di$dependencies";function Ae(P){return P[w.DI_DEPENDENCIES]||[]}w.getServiceDependencies=Ae})(ue||(ue={}));const we=pe("instantiationService");function Ye(w,Ae,P,f){Ae[ue.DI_TARGET]===Ae?Ae[ue.DI_DEPENDENCIES].push({id:w,index:P,optional:f}):(Ae[ue.DI_DEPENDENCIES]=[{id:w,index:P,optional:f}],Ae[ue.DI_TARGET]=Ae)}function pe(w){if(ue.serviceIds.has(w))return ue.serviceIds.get(w);const Ae=function(P,f,ie){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ye(Ae,P,ie,!1)};return Ae.toString=()=>w,ue.serviceIds.set(w,Ae),Ae}function X(w){return function(Ae,P,f){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Ye(w,Ae,f,!0)}}},44650:function(Ci,Ft,re){"use strict";re.d(Ft,{B:function(){return pe}});var ue=re(76068),we=re(72999);class Ye{constructor(){this.data=new Map}add(w,Ae){ue.ok(we.HD(w)),ue.ok(we.Kn(Ae)),ue.ok(!this.data.has(w),"There is already an extension with this id"),this.data.set(w,Ae)}as(w){return this.data.get(w)||null}}const pe=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 Ae},bB:function(){return J},kS:function(){return ie},m6:function(){return I}});var ue=re(52615),we=re(4348),Ye=re(69323),pe=re(16925),X=re(44650),w=re(66213);const Ae=(0,pe.yh)("themeService");var P;(function(H){function j($){return $&&typeof $=="object"&&typeof $.id=="string"}H.isThemeColor=j})(P||(P={}));function f(H){return{id:H}}var ie;(function(H){function j(Te){return Te&&typeof Te=="object"&&typeof Te.id=="string"&&(typeof Te.color=="undefined"||P.isThemeColor(Te.color))}H.isThemeIcon=j;const $=new RegExp(`^\\$\\((${ue.dT.iconNameExpression}(?:${ue.dT.iconModifierExpression})?)\\)$`);function B(Te){const se=$.exec(Te);if(!se)return;let[,Ee]=se;return{id:Ee}}H.fromString=B;function V(Te,se){let Ee=Te.id;const je=Ee.lastIndexOf("~");return je!==-1&&(Ee=Ee.substring(0,je)),se&&(Ee=`${Ee}~${se}`),{id:Ee}}H.modify=V;function he(Te,se){var Ee,je;return Te.id===se.id&&((Ee=Te.color)===null||Ee===void 0?void 0:Ee.id)===((je=se.color)===null||je===void 0?void 0:je.id)}H.isEqual=he;function be(Te,se){return{id:Te.id,color:se?f(se):void 0}}H.asThemeIcon=be,H.asClassNameArray=ue.dT.asClassNameArray,H.asClassName=ue.dT.asClassName,H.asCSSSelector=ue.dT.asCSSSelector})(ie||(ie={}));function I(H){switch(H){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 C=new T;X.B.add(k.ThemingContribution,C);function O(H){return C.onColorThemeChange(H)}class J 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(67711),we=re(98506),Ye=re(52873),pe=re(16886),X=re(33346),w=re(92310),Ae=re.n(w),P=re(18929),f=re(59301),ie=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],I=(0,f.forwardRef)(function(k,T){var C=k.prefixCls,O=C===void 0?"rc-checkbox":C,J=k.className,H=k.style,j=k.checked,$=k.disabled,B=k.defaultChecked,V=B===void 0?!1:B,he=k.type,be=he===void 0?"checkbox":he,Te=k.title,se=k.onChange,Ee=(0,X.Z)(k,ie),je=(0,f.useRef)(null),Ke=(0,f.useRef)(null),It=(0,P.Z)(V,{value:j}),ee=(0,pe.Z)(It,2),z=ee[0],Z=ee[1];(0,f.useImperativeHandle)(T,function(){return{focus:function(A){var L;(L=je.current)===null||L===void 0||L.focus(A)},blur:function(){var A;(A=je.current)===null||A===void 0||A.blur()},input:je.current,nativeElement:Ke.current}});var Q=Ae()(O,J,(0,Ye.Z)((0,Ye.Z)({},"".concat(O,"-checked"),z),"".concat(O,"-disabled"),$)),fe=function(A){$||("checked"in k||Z(A.target.checked),se==null||se({target:(0,we.Z)((0,we.Z)({},k),{},{type:be,checked:A.target.checked}),stopPropagation:function(){A.stopPropagation()},preventDefault:function(){A.preventDefault()},nativeEvent:A.nativeEvent}))};return f.createElement("span",{className:Q,title:Te,style:H,ref:Ke},f.createElement("input",(0,ue.Z)({},Ee,{className:"".concat(O,"-input"),ref:je,onChange:fe,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 Te}});var ue=re(67711),we=re(52873),Ye=re(16886),pe=re(33346),X=re(65030),w=re(92310),Ae=re.n(w),P=re(8654),f=re(59301),ie=re(10228),I=re(16089),k=ie.Z.ESC,T=ie.Z.TAB;function C(se){var Ee=se.visible,je=se.triggerRef,Ke=se.onVisibleChange,It=se.autoFocus,ee=se.overlayRef,z=f.useRef(!1),Z=function(){if(Ee){var A,L;(A=je.current)===null||A===void 0||(L=A.focus)===null||L===void 0||L.call(A),Ke==null||Ke(!1)}},Q=function(){var A;return(A=ee.current)!==null&&A!==void 0&&A.focus?(ee.current.focus(),z.current=!0,!0):!1},fe=function(A){switch(A.keyCode){case k:Z();break;case T:{var L=!1;z.current||(L=Q()),L?A.preventDefault():Z();break}}};f.useEffect(function(){return Ee?(window.addEventListener("keydown",fe),It&&(0,I.Z)(Q,3),function(){window.removeEventListener("keydown",fe),z.current=!1}):function(){z.current=!1}},[Ee])}var O=(0,f.forwardRef)(function(se,Ee){var je=se.overlay,Ke=se.arrow,It=se.prefixCls,ee=(0,f.useMemo)(function(){var Z;return typeof je=="function"?Z=je():Z=je,Z},[je]),z=(0,P.sQ)(Ee,(0,P.C4)(ee));return f.createElement(f.Fragment,null,Ke&&f.createElement("div",{className:"".concat(It,"-arrow")}),f.cloneElement(ee,{ref:(0,P.Yr)(ee)?z:void 0}))}),J=O,H={adjustX:1,adjustY:1},j=[0,0],$={topLeft:{points:["bl","tl"],overflow:H,offset:[0,-4],targetOffset:j},top:{points:["bc","tc"],overflow:H,offset:[0,-4],targetOffset:j},topRight:{points:["br","tr"],overflow:H,offset:[0,-4],targetOffset:j},bottomLeft:{points:["tl","bl"],overflow:H,offset:[0,4],targetOffset:j},bottom:{points:["tc","bc"],overflow:H,offset:[0,4],targetOffset:j},bottomRight:{points:["tr","br"],overflow:H,offset:[0,4],targetOffset:j}},B=$,V=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function he(se,Ee){var je,Ke=se.arrow,It=Ke===void 0?!1:Ke,ee=se.prefixCls,z=ee===void 0?"rc-dropdown":ee,Z=se.transitionName,Q=se.animation,fe=se.align,ne=se.placement,A=ne===void 0?"bottomLeft":ne,L=se.placements,G=L===void 0?B:L,de=se.getPopupContainer,ze=se.showAction,pt=se.hideAction,Ut=se.overlayClassName,Ie=se.overlayStyle,Yt=se.visible,Pt=se.trigger,St=Pt===void 0?["hover"]:Pt,$e=se.autoFocus,it=se.overlay,mt=se.children,ht=se.onVisibleChange,ti=(0,pe.Z)(se,V),Ce=f.useState(),Be=(0,Ye.Z)(Ce,2),me=Be[0],Xe=Be[1],at="visible"in se?Yt:me,Je=f.useRef(null),q=f.useRef(null),ye=f.useRef(null);f.useImperativeHandle(Ee,function(){return Je.current});var Fe=function(Gt){Xe(Gt),ht==null||ht(Gt)};C({visible:at,triggerRef:ye,onVisibleChange:Fe,autoFocus:$e,overlayRef:q});var Ze=function(Gt){var Le=se.onOverlayClick;Xe(!1),Le&&Le(Gt)},ot=function(){return f.createElement(J,{ref:q,overlay:it,prefixCls:z,arrow:It})},bt=function(){return typeof it=="function"?ot:ot()},qt=function(){var Gt=se.minOverlayWidthMatchTrigger,Le=se.alignPoint;return"minOverlayWidthMatchTrigger"in se?Gt:!Le},vt=function(){var Gt=se.openClassName;return Gt!==void 0?Gt:"".concat(z,"-open")},Se=f.cloneElement(mt,{className:Ae()((je=mt.props)===null||je===void 0?void 0:je.className,at&&vt()),ref:(0,P.Yr)(mt)?(0,P.sQ)(ye,(0,P.C4)(mt)):void 0}),xt=pt;return!xt&&St.indexOf("contextMenu")!==-1&&(xt=["click"]),f.createElement(X.Z,(0,ue.Z)({builtinPlacements:G},ti,{prefixCls:z,ref:Je,popupClassName:Ae()(Ut,(0,we.Z)({},"".concat(z,"-show-arrow"),It)),popupStyle:Ie,action:St,showAction:ze,hideAction:xt,popupPlacement:A,popupAlign:fe,popupTransitionName:Z,popupAnimation:Q,popupVisible:at,stretch:qt()?"minWidth":"",popup:bt(),onPopupVisibleChange:Fe,onPopupClick:Ze,getPopupContainer:de}),Se)}var be=f.forwardRef(he),Te=be},20922:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return St}});var ue=re(67711),we=re(52873),Ye=re(26420),pe=re(16886),X=re(33346),w=re(42573),Ae=re(58698);function P(){return typeof BigInt=="function"}function f($e){return!$e&&$e!==0&&!Number.isNaN($e)||!String($e).trim()}function ie($e){var it=$e.trim(),mt=it.startsWith("-");mt&&(it=it.slice(1)),it=it.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),it.startsWith(".")&&(it="0".concat(it));var ht=it||"0",ti=ht.split("."),Ce=ti[0]||"0",Be=ti[1]||"0";Ce==="0"&&Be==="0"&&(mt=!1);var me=mt?"-":"";return{negative:mt,negativeStr:me,trimStr:ht,integerStr:Ce,decimalStr:Be,fullStr:"".concat(me).concat(ht)}}function I($e){var it=String($e);return!Number.isNaN(Number(it))&&it.includes("e")}function k($e){var it=String($e);if(I($e)){var mt=Number(it.slice(it.indexOf("e-")+2)),ht=it.match(/\.(\d+)/);return ht!=null&&ht[1]&&(mt+=ht[1].length),mt}return it.includes(".")&&C(it)?it.length-it.indexOf(".")-1:0}function T($e){var it=String($e);if(I($e)){if($e>Number.MAX_SAFE_INTEGER)return String(P()?BigInt($e).toString():Number.MAX_SAFE_INTEGER);if($e<Number.MIN_SAFE_INTEGER)return String(P()?BigInt($e).toString():Number.MIN_SAFE_INTEGER);it=$e.toFixed(k(it))}return ie(it).fullStr}function C($e){return typeof $e=="number"?!Number.isNaN($e):$e?/^\s*-?\d+(\.\d+)?\s*$/.test($e)||/^\s*-?\d+\.\s*$/.test($e)||/^\s*-?\.\d+\s*$/.test($e):!1}var O=function(){function $e(it){if((0,w.Z)(this,$e),(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(it)){this.empty=!0;return}if(this.origin=String(it),it==="-"||Number.isNaN(it)){this.nan=!0;return}var mt=it;if(I(mt)&&(mt=Number(mt)),mt=typeof mt=="string"?mt:T(mt),C(mt)){var ht=ie(mt);this.negative=ht.negative;var ti=ht.trimStr.split(".");this.integer=BigInt(ti[0]);var Ce=ti[1]||"0";this.decimal=BigInt(Ce),this.decimalLen=Ce.length}else this.nan=!0}return(0,Ae.Z)($e,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(mt){var ht="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(mt,"0"));return BigInt(ht)}},{key:"negate",value:function(){var mt=new $e(this.toString());return mt.negative=!mt.negative,mt}},{key:"cal",value:function(mt,ht,ti){var Ce=Math.max(this.getDecimalStr().length,mt.getDecimalStr().length),Be=this.alignDecimal(Ce),me=mt.alignDecimal(Ce),Xe=ht(Be,me).toString(),at=ti(Ce),Je=ie(Xe),q=Je.negativeStr,ye=Je.trimStr,Fe="".concat(q).concat(ye.padStart(at+1,"0"));return new $e("".concat(Fe.slice(0,-at),".").concat(Fe.slice(-at)))}},{key:"add",value:function(mt){if(this.isInvalidate())return new $e(mt);var ht=new $e(mt);return ht.isInvalidate()?this:this.cal(ht,function(ti,Ce){return ti+Ce},function(ti){return ti})}},{key:"multi",value:function(mt){var ht=new $e(mt);return this.isInvalidate()||ht.isInvalidate()?new $e(NaN):this.cal(ht,function(ti,Ce){return ti*Ce},function(ti){return ti*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(mt){return this.toString()===(mt==null?void 0:mt.toString())}},{key:"lessEquals",value:function(mt){return this.add(mt.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var mt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return mt?this.isInvalidate()?"":ie("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),$e}(),J=function(){function $e(it){if((0,w.Z)(this,$e),(0,we.Z)(this,"origin",""),(0,we.Z)(this,"number",void 0),(0,we.Z)(this,"empty",void 0),f(it)){this.empty=!0;return}this.origin=String(it),this.number=Number(it)}return(0,Ae.Z)($e,[{key:"negate",value:function(){return new $e(-this.toNumber())}},{key:"add",value:function(mt){if(this.isInvalidate())return new $e(mt);var ht=Number(mt);if(Number.isNaN(ht))return this;var ti=this.number+ht;if(ti>Number.MAX_SAFE_INTEGER)return new $e(Number.MAX_SAFE_INTEGER);if(ti<Number.MIN_SAFE_INTEGER)return new $e(Number.MIN_SAFE_INTEGER);var Ce=Math.max(k(this.number),k(ht));return new $e(ti.toFixed(Ce))}},{key:"multi",value:function(mt){var ht=Number(mt);if(this.isInvalidate()||Number.isNaN(ht))return new $e(NaN);var ti=this.number*ht;if(ti>Number.MAX_SAFE_INTEGER)return new $e(Number.MAX_SAFE_INTEGER);if(ti<Number.MIN_SAFE_INTEGER)return new $e(Number.MIN_SAFE_INTEGER);var Ce=Math.max(k(this.number),k(ht));return new $e(ti.toFixed(Ce))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(mt){return this.toNumber()===(mt==null?void 0:mt.toNumber())}},{key:"lessEquals",value:function(mt){return this.add(mt.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var mt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return mt?this.isInvalidate()?"":T(this.number):this.origin}}]),$e}();function H($e){return P()?new O($e):new J($e)}function j($e,it,mt){var ht=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if($e==="")return"";var ti=ie($e),Ce=ti.negativeStr,Be=ti.integerStr,me=ti.decimalStr,Xe="".concat(it).concat(me),at="".concat(Ce).concat(Be);if(mt>=0){var Je=Number(me[mt]);if(Je>=5&&!ht){var q=H($e).add("".concat(Ce,"0.").concat("0".repeat(mt)).concat(10-Je));return j(q.toString(),it,mt,ht)}return mt===0?at:"".concat(at).concat(it).concat(me.padEnd(mt,"0").slice(0,mt))}return Xe===".0"?at:"".concat(at).concat(Xe)}var $=H,B=re(92310),V=re.n(B),he=re(36901),be=re(34280);function Te($e,it){return typeof Proxy!="undefined"&&$e?new Proxy($e,{get:function(ht,ti){if(it[ti])return it[ti];var Ce=ht[ti];return typeof Ce=="function"?Ce.bind(ht):Ce}}):$e}var se=re(8654),Ee=re(59301),je=re(48736);function Ke($e,it){var mt=(0,Ee.useRef)(null);function ht(){try{var Ce=$e.selectionStart,Be=$e.selectionEnd,me=$e.value,Xe=me.substring(0,Ce),at=me.substring(Be);mt.current={start:Ce,end:Be,value:me,beforeTxt:Xe,afterTxt:at}}catch(Je){}}function ti(){if($e&&mt.current&&it)try{var Ce=$e.value,Be=mt.current,me=Be.beforeTxt,Xe=Be.afterTxt,at=Be.start,Je=Ce.length;if(Ce.startsWith(me))Je=me.length;else if(Ce.endsWith(Xe))Je=Ce.length-mt.current.afterTxt.length;else{var q=me[at-1],ye=Ce.indexOf(q,at-1);ye!==-1&&(Je=ye+1)}$e.setSelectionRange(Je,Je)}catch(Fe){(0,je.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(Fe.message))}}return[ht,ti]}var It=re(49658),ee=function(){var it=(0,Ee.useState)(!1),mt=(0,pe.Z)(it,2),ht=mt[0],ti=mt[1];return(0,be.Z)(function(){ti((0,It.Z)())},[]),ht},z=ee,Z=re(16089),Q=200,fe=600;function ne($e){var it=$e.prefixCls,mt=$e.upNode,ht=$e.downNode,ti=$e.upDisabled,Ce=$e.downDisabled,Be=$e.onStep,me=Ee.useRef(),Xe=Ee.useRef([]),at=Ee.useRef();at.current=Be;var Je=function(){clearTimeout(me.current)},q=function(Se,xt){Se.preventDefault(),Je(),at.current(xt);function Wt(){at.current(xt),me.current=setTimeout(Wt,Q)}me.current=setTimeout(Wt,fe)};Ee.useEffect(function(){return function(){Je(),Xe.current.forEach(function(vt){return Z.Z.cancel(vt)})}},[]);var ye=z();if(ye)return null;var Fe="".concat(it,"-handler"),Ze=V()(Fe,"".concat(Fe,"-up"),(0,we.Z)({},"".concat(Fe,"-up-disabled"),ti)),ot=V()(Fe,"".concat(Fe,"-down"),(0,we.Z)({},"".concat(Fe,"-down-disabled"),Ce)),bt=function(){return Xe.current.push((0,Z.Z)(Je))},qt={unselectable:"on",role:"button",onMouseUp:bt,onMouseLeave:bt};return Ee.createElement("div",{className:"".concat(Fe,"-wrap")},Ee.createElement("span",(0,ue.Z)({},qt,{onMouseDown:function(Se){q(Se,!0)},"aria-label":"Increase Value","aria-disabled":ti,className:Ze}),mt||Ee.createElement("span",{unselectable:"on",className:"".concat(it,"-handler-up-inner")})),Ee.createElement("span",(0,ue.Z)({},qt,{onMouseDown:function(Se){q(Se,!1)},"aria-label":"Decrease Value","aria-disabled":Ce,className:ot}),ht||Ee.createElement("span",{unselectable:"on",className:"".concat(it,"-handler-down-inner")})))}function A($e){var it=typeof $e=="number"?T($e):ie($e).fullStr,mt=it.includes(".");return mt?ie(it.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:$e+"0"}var L=re(30292),G=function(){var $e=(0,Ee.useRef)(0),it=function(){Z.Z.cancel($e.current)};return(0,Ee.useEffect)(function(){return it},[]),function(mt){it(),$e.current=(0,Z.Z)(function(){mt()})}},de=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],ze=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],pt=function(it,mt){return it||mt.isEmpty()?mt.toString():mt.toNumber()},Ut=function(it){var mt=$(it);return mt.isInvalidate()?null:mt},Ie=Ee.forwardRef(function($e,it){var mt=$e.prefixCls,ht=$e.className,ti=$e.style,Ce=$e.min,Be=$e.max,me=$e.step,Xe=me===void 0?1:me,at=$e.defaultValue,Je=$e.value,q=$e.disabled,ye=$e.readOnly,Fe=$e.upHandler,Ze=$e.downHandler,ot=$e.keyboard,bt=$e.changeOnWheel,qt=bt===void 0?!1:bt,vt=$e.controls,Se=vt===void 0?!0:vt,xt=$e.classNames,Wt=$e.stringMode,Gt=$e.parser,Le=$e.formatter,Me=$e.precision,rt=$e.decimalSeparator,wt=$e.onChange,qe=$e.onInput,Ct=$e.onPressEnter,Lt=$e.onStep,kt=$e.changeOnBlur,Nt=kt===void 0?!0:kt,Xt=$e.domRef,Qe=(0,X.Z)($e,de),zt="".concat(mt,"-input"),De=Ee.useRef(null),xe=Ee.useState(!1),ke=(0,pe.Z)(xe,2),K=ke[0],W=ke[1],ae=Ee.useRef(!1),ce=Ee.useRef(!1),ve=Ee.useRef(!1),ft=Ee.useState(function(){return $(Je!=null?Je:at)}),yt=(0,pe.Z)(ft,2),ut=yt[0],Vt=yt[1];function ii(nt){Je===void 0&&Vt(nt)}var mi=Ee.useCallback(function(nt,dt){if(!dt)return Me>=0?Me:Math.max(k(nt),k(Xe))},[Me,Xe]),ni=Ee.useCallback(function(nt){var dt=String(nt);if(Gt)return Gt(dt);var Bt=dt;return rt&&(Bt=Bt.replace(rt,".")),Bt.replace(/[^\w.-]+/g,"")},[Gt,rt]),Dt=Ee.useRef(""),oi=Ee.useCallback(function(nt,dt){if(Le)return Le(nt,{userTyping:dt,input:String(Dt.current)});var Bt=typeof nt=="number"?T(nt):nt;if(!dt){var Zt=mi(Bt,dt);if(C(Bt)&&(rt||Zt>=0)){var di=rt||".";Bt=j(Bt,di,Zt)}}return Bt},[Le,mi,rt]),Mi=Ee.useState(function(){var nt=at!=null?at:Je;return ut.isInvalidate()&&["string","number"].includes((0,Ye.Z)(nt))?Number.isNaN(nt)?"":nt:oi(ut.toString(),!1)}),ki=(0,pe.Z)(Mi,2),Bi=ki[0],gi=ki[1];Dt.current=Bi;function fi(nt,dt){gi(oi(nt.isInvalidate()?nt.toString(!1):nt.toString(!dt),dt))}var Vi=Ee.useMemo(function(){return Ut(Be)},[Be,Me]),ji=Ee.useMemo(function(){return Ut(Ce)},[Ce,Me]),en=Ee.useMemo(function(){return!Vi||!ut||ut.isInvalidate()?!1:Vi.lessEquals(ut)},[Vi,ut]),Yi=Ee.useMemo(function(){return!ji||!ut||ut.isInvalidate()?!1:ut.lessEquals(ji)},[ji,ut]),er=Ke(De.current,K),Li=(0,pe.Z)(er,2),zi=Li[0],sn=Li[1],Pi=function(dt){return Vi&&!dt.lessEquals(Vi)?Vi:ji&&!ji.lessEquals(dt)?ji:null},bn=function(dt){return!Pi(dt)},an=function(dt,Bt){var Zt=dt,di=bn(Zt)||Zt.isEmpty();if(!Zt.isEmpty()&&!Bt&&(Zt=Pi(Zt)||Zt,di=!0),!ye&&!q&&di){var Xi=Zt.toString(),_i=mi(Xi,Bt);return _i>=0&&(Zt=$(j(Xi,".",_i)),bn(Zt)||(Zt=$(j(Xi,".",_i,!0)))),Zt.equals(ut)||(ii(Zt),wt==null||wt(Zt.isEmpty()?null:pt(Wt,Zt)),Je===void 0&&fi(Zt,Bt)),Zt}return ut},sr=G(),xi=function nt(dt){if(zi(),Dt.current=dt,gi(dt),!ce.current){var Bt=ni(dt),Zt=$(Bt);Zt.isNaN()||an(Zt,!0)}qe==null||qe(dt),sr(function(){var di=dt;Gt||(di=dt.replace(/。/g,".")),di!==dt&&nt(di)})},ur=function(){ce.current=!0},jn=function(){ce.current=!1,xi(De.current.value)},wi=function(dt){xi(dt.target.value)},li=function(dt){var Bt;if(!(dt&&en||!dt&&Yi)){ae.current=!1;var Zt=$(ve.current?A(Xe):Xe);dt||(Zt=Zt.negate());var di=(ut||$(0)).add(Zt.toString()),Xi=an(di,!1);Lt==null||Lt(pt(Wt,Xi),{offset:ve.current?A(Xe):Xe,type:dt?"up":"down"}),(Bt=De.current)===null||Bt===void 0||Bt.focus()}},Pe=function(dt){var Bt=$(ni(Bi)),Zt;Bt.isNaN()?Zt=an(ut,dt):Zt=an(Bt,dt),Je!==void 0?fi(ut,!1):Zt.isNaN()||fi(Zt,!1)},et=function(){ae.current=!0},gt=function(dt){var Bt=dt.key,Zt=dt.shiftKey;ae.current=!0,ve.current=Zt,Bt==="Enter"&&(ce.current||(ae.current=!1),Pe(!1),Ct==null||Ct(dt)),ot!==!1&&!ce.current&&["Up","ArrowUp","Down","ArrowDown"].includes(Bt)&&(li(Bt==="Up"||Bt==="ArrowUp"),dt.preventDefault())},lt=function(){ae.current=!1,ve.current=!1};Ee.useEffect(function(){if(qt&&K){var nt=function(Zt){li(Zt.deltaY<0),Zt.preventDefault()},dt=De.current;if(dt)return dt.addEventListener("wheel",nt,{passive:!1}),function(){return dt.removeEventListener("wheel",nt)}}});var At=function(){Nt&&Pe(!1),W(!1),ae.current=!1};return(0,be.o)(function(){ut.isInvalidate()||fi(ut,!1)},[Me,Le]),(0,be.o)(function(){var nt=$(Je);Vt(nt);var dt=$(ni(Bi));(!nt.equals(dt)||!ae.current||Le)&&fi(nt,ae.current)},[Je]),(0,be.o)(function(){Le&&sn()},[Bi]),Ee.createElement("div",{ref:Xt,className:V()(mt,ht,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(mt,"-focused"),K),"".concat(mt,"-disabled"),q),"".concat(mt,"-readonly"),ye),"".concat(mt,"-not-a-number"),ut.isNaN()),"".concat(mt,"-out-of-range"),!ut.isInvalidate()&&!bn(ut))),style:ti,onFocus:function(){W(!0)},onBlur:At,onKeyDown:gt,onKeyUp:lt,onCompositionStart:ur,onCompositionEnd:jn,onBeforeInput:et},Se&&Ee.createElement(ne,{prefixCls:mt,upNode:Fe,downNode:Ze,upDisabled:en,downDisabled:Yi,onStep:li}),Ee.createElement("div",{className:"".concat(zt,"-wrap")},Ee.createElement("input",(0,ue.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":Be,"aria-valuenow":ut.isInvalidate()?null:ut.toString(),step:Xe},Qe,{ref:(0,se.sQ)(De,it),className:zt,value:Bi,onChange:wi,disabled:q,readOnly:ye}))))}),Yt=Ee.forwardRef(function($e,it){var mt=$e.disabled,ht=$e.style,ti=$e.prefixCls,Ce=ti===void 0?"rc-input-number":ti,Be=$e.value,me=$e.prefix,Xe=$e.suffix,at=$e.addonBefore,Je=$e.addonAfter,q=$e.className,ye=$e.classNames,Fe=(0,X.Z)($e,ze),Ze=Ee.useRef(null),ot=Ee.useRef(null),bt=Ee.useRef(null),qt=function(Se){bt.current&&(0,L.nH)(bt.current,Se)};return Ee.useImperativeHandle(it,function(){return Te(bt.current,{focus:qt,nativeElement:Ze.current.nativeElement||ot.current})}),Ee.createElement(he.BaseInput,{className:q,triggerFocus:qt,prefixCls:Ce,value:Be,disabled:mt,style:ht,prefix:me,suffix:Xe,addonAfter:Je,addonBefore:at,classNames:ye,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:Ze},Ee.createElement(Ie,(0,ue.Z)({prefixCls:Ce,disabled:mt,ref:bt,domRef:ot,className:ye==null?void 0:ye.input},Fe)))}),Pt=Yt,St=Pt},66003:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return Ae}});var ue=re(33346),we=re(98506),Ye=re(26420),pe=re(59301),X=["show"];function w(P,f){if(!f.max)return!0;var ie=f.strategy(P);return ie<=f.max}function Ae(P,f){return pe.useMemo(function(){var ie={};f&&(ie.show=(0,Ye.Z)(f)==="object"&&f.formatter?f.formatter:!!f),ie=(0,we.Z)((0,we.Z)({},ie),P);var I=ie,k=I.show,T=(0,ue.Z)(I,X);return(0,we.Z)((0,we.Z)({},T),{},{show:!!k,showFormatter:typeof k=="function"?k:void 0,strategy:T.strategy||function(C){return C.length}})},[P,f])}},36901:function(Ci,Ft,re){"use strict";re.r(Ft),re.d(Ft,{BaseInput:function(){return ie},default:function(){return B}});var ue=re(98506),we=re(67711),Ye=re(52873),pe=re(26420),X=re(92310),w=re.n(X),Ae=re(59301),P=re(30292),f=Ae.forwardRef(function(V,he){var be,Te,se,Ee=V.inputElement,je=V.children,Ke=V.prefixCls,It=V.prefix,ee=V.suffix,z=V.addonBefore,Z=V.addonAfter,Q=V.className,fe=V.style,ne=V.disabled,A=V.readOnly,L=V.focused,G=V.triggerFocus,de=V.allowClear,ze=V.value,pt=V.handleReset,Ut=V.hidden,Ie=V.classes,Yt=V.classNames,Pt=V.dataAttrs,St=V.styles,$e=V.components,it=V.onClear,mt=je!=null?je:Ee,ht=($e==null?void 0:$e.affixWrapper)||"span",ti=($e==null?void 0:$e.groupWrapper)||"span",Ce=($e==null?void 0:$e.wrapper)||"span",Be=($e==null?void 0:$e.groupAddon)||"span",me=(0,Ae.useRef)(null),Xe=function(rt){var wt;(wt=me.current)!==null&&wt!==void 0&&wt.contains(rt.target)&&(G==null||G())},at=(0,P.X3)(V),Je=(0,Ae.cloneElement)(mt,{value:ze,className:w()((be=mt.props)===null||be===void 0?void 0:be.className,!at&&(Yt==null?void 0:Yt.variant))||null}),q=(0,Ae.useRef)(null);if(Ae.useImperativeHandle(he,function(){return{nativeElement:q.current||me.current}}),at){var ye=null;if(de){var Fe=!ne&&!A&&ze,Ze="".concat(Ke,"-clear-icon"),ot=(0,pe.Z)(de)==="object"&&de!==null&&de!==void 0&&de.clearIcon?de.clearIcon:"\u2716";ye=Ae.createElement("button",{type:"button",tabIndex:-1,onClick:function(rt){pt==null||pt(rt),it==null||it()},onMouseDown:function(rt){return rt.preventDefault()},className:w()(Ze,(0,Ye.Z)((0,Ye.Z)({},"".concat(Ze,"-hidden"),!Fe),"".concat(Ze,"-has-suffix"),!!ee))},ot)}var bt="".concat(Ke,"-affix-wrapper"),qt=w()(bt,(0,Ye.Z)((0,Ye.Z)((0,Ye.Z)((0,Ye.Z)((0,Ye.Z)({},"".concat(Ke,"-disabled"),ne),"".concat(bt,"-disabled"),ne),"".concat(bt,"-focused"),L),"".concat(bt,"-readonly"),A),"".concat(bt,"-input-with-clear-btn"),ee&&de&&ze),Ie==null?void 0:Ie.affixWrapper,Yt==null?void 0:Yt.affixWrapper,Yt==null?void 0:Yt.variant),vt=(ee||de)&&Ae.createElement("span",{className:w()("".concat(Ke,"-suffix"),Yt==null?void 0:Yt.suffix),style:St==null?void 0:St.suffix},ye,ee);Je=Ae.createElement(ht,(0,we.Z)({className:qt,style:St==null?void 0:St.affixWrapper,onClick:Xe},Pt==null?void 0:Pt.affixWrapper,{ref:me}),It&&Ae.createElement("span",{className:w()("".concat(Ke,"-prefix"),Yt==null?void 0:Yt.prefix),style:St==null?void 0:St.prefix},It),Je,vt)}if((0,P.He)(V)){var Se="".concat(Ke,"-group"),xt="".concat(Se,"-addon"),Wt="".concat(Se,"-wrapper"),Gt=w()("".concat(Ke,"-wrapper"),Se,Ie==null?void 0:Ie.wrapper,Yt==null?void 0:Yt.wrapper),Le=w()(Wt,(0,Ye.Z)({},"".concat(Wt,"-disabled"),ne),Ie==null?void 0:Ie.group,Yt==null?void 0:Yt.groupWrapper);Je=Ae.createElement(ti,{className:Le,ref:q},Ae.createElement(Ce,{className:Gt},z&&Ae.createElement(Be,{className:xt},z),Je,Z&&Ae.createElement(Be,{className:xt},Z)))}return Ae.cloneElement(Je,{className:w()((Te=Je.props)===null||Te===void 0?void 0:Te.className,Q)||null,style:(0,ue.Z)((0,ue.Z)({},(se=Je.props)===null||se===void 0?void 0:se.style),fe),hidden:Ut})}),ie=f,I=re(15142),k=re(16886),T=re(33346),C=re(18929),O=re(2738),J=re(66003),H=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],j=(0,Ae.forwardRef)(function(V,he){var be=V.autoComplete,Te=V.onChange,se=V.onFocus,Ee=V.onBlur,je=V.onPressEnter,Ke=V.onKeyDown,It=V.onKeyUp,ee=V.prefixCls,z=ee===void 0?"rc-input":ee,Z=V.disabled,Q=V.htmlSize,fe=V.className,ne=V.maxLength,A=V.suffix,L=V.showCount,G=V.count,de=V.type,ze=de===void 0?"text":de,pt=V.classes,Ut=V.classNames,Ie=V.styles,Yt=V.onCompositionStart,Pt=V.onCompositionEnd,St=(0,T.Z)(V,H),$e=(0,Ae.useState)(!1),it=(0,k.Z)($e,2),mt=it[0],ht=it[1],ti=(0,Ae.useRef)(!1),Ce=(0,Ae.useRef)(!1),Be=(0,Ae.useRef)(null),me=(0,Ae.useRef)(null),Xe=function(zt){Be.current&&(0,P.nH)(Be.current,zt)},at=(0,C.Z)(V.defaultValue,{value:V.value}),Je=(0,k.Z)(at,2),q=Je[0],ye=Je[1],Fe=q==null?"":String(q),Ze=(0,Ae.useState)(null),ot=(0,k.Z)(Ze,2),bt=ot[0],qt=ot[1],vt=(0,J.Z)(G,L),Se=vt.max||ne,xt=vt.strategy(Fe),Wt=!!Se&&xt>Se;(0,Ae.useImperativeHandle)(he,function(){var Qe;return{focus:Xe,blur:function(){var De;(De=Be.current)===null||De===void 0||De.blur()},setSelectionRange:function(De,xe,ke){var K;(K=Be.current)===null||K===void 0||K.setSelectionRange(De,xe,ke)},select:function(){var De;(De=Be.current)===null||De===void 0||De.select()},input:Be.current,nativeElement:((Qe=me.current)===null||Qe===void 0?void 0:Qe.nativeElement)||Be.current}}),(0,Ae.useEffect)(function(){Ce.current&&(Ce.current=!1),ht(function(Qe){return Qe&&Z?!1:Qe})},[Z]);var Gt=function(zt,De,xe){var ke=De;if(!ti.current&&vt.exceedFormatter&&vt.max&&vt.strategy(De)>vt.max){if(ke=vt.exceedFormatter(De,{max:vt.max}),De!==ke){var K,W;qt([((K=Be.current)===null||K===void 0?void 0:K.selectionStart)||0,((W=Be.current)===null||W===void 0?void 0:W.selectionEnd)||0])}}else if(xe.source==="compositionEnd")return;ye(ke),Be.current&&(0,P.rJ)(Be.current,zt,Te,ke)};(0,Ae.useEffect)(function(){if(bt){var Qe;(Qe=Be.current)===null||Qe===void 0||Qe.setSelectionRange.apply(Qe,(0,I.Z)(bt))}},[bt]);var Le=function(zt){Gt(zt,zt.target.value,{source:"change"})},Me=function(zt){ti.current=!1,Gt(zt,zt.currentTarget.value,{source:"compositionEnd"}),Pt==null||Pt(zt)},rt=function(zt){je&&zt.key==="Enter"&&!Ce.current&&(Ce.current=!0,je(zt)),Ke==null||Ke(zt)},wt=function(zt){zt.key==="Enter"&&(Ce.current=!1),It==null||It(zt)},qe=function(zt){ht(!0),se==null||se(zt)},Ct=function(zt){Ce.current&&(Ce.current=!1),ht(!1),Ee==null||Ee(zt)},Lt=function(zt){ye(""),Xe(),Be.current&&(0,P.rJ)(Be.current,zt,Te)},kt=Wt&&"".concat(z,"-out-of-range"),Nt=function(){var zt=(0,O.Z)(V,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return Ae.createElement("input",(0,we.Z)({autoComplete:be},zt,{onChange:Le,onFocus:qe,onBlur:Ct,onKeyDown:rt,onKeyUp:wt,className:w()(z,(0,Ye.Z)({},"".concat(z,"-disabled"),Z),Ut==null?void 0:Ut.input),style:Ie==null?void 0:Ie.input,ref:Be,size:Q,type:ze,onCompositionStart:function(xe){ti.current=!0,Yt==null||Yt(xe)},onCompositionEnd:Me}))},Xt=function(){var zt=Number(Se)>0;if(A||vt.show){var De=vt.showFormatter?vt.showFormatter({value:Fe,count:xt,maxLength:Se}):"".concat(xt).concat(zt?" / ".concat(Se):"");return Ae.createElement(Ae.Fragment,null,vt.show&&Ae.createElement("span",{className:w()("".concat(z,"-show-count-suffix"),(0,Ye.Z)({},"".concat(z,"-show-count-has-suffix"),!!A),Ut==null?void 0:Ut.count),style:(0,ue.Z)({},Ie==null?void 0:Ie.count)},De),A)}return null};return Ae.createElement(ie,(0,we.Z)({},St,{prefixCls:z,className:w()(fe,kt),handleReset:Lt,value:Fe,focused:mt,triggerFocus:Xe,suffix:Xt(),disabled:Z,classes:pt,classNames:Ut,styles:Ie}),Nt())}),$=j,B=$},30292:function(Ci,Ft,re){"use strict";re.d(Ft,{He:function(){return ue},X3:function(){return we},nH:function(){return X},rJ:function(){return pe}});function ue(w){return!!(w.addonBefore||w.addonAfter)}function we(w){return!!(w.prefix||w.suffix||w.allowClear)}function Ye(w,Ae,P){var f=Ae.cloneNode(!0),ie=Object.create(w,{target:{value:f},currentTarget:{value:f}});return f.value=P,typeof Ae.selectionStart=="number"&&typeof Ae.selectionEnd=="number"&&(f.selectionStart=Ae.selectionStart,f.selectionEnd=Ae.selectionEnd),f.setSelectionRange=function(){Ae.setSelectionRange.apply(Ae,arguments)},ie}function pe(w,Ae,P,f){if(P){var ie=Ae;if(Ae.type==="click"){ie=Ye(Ae,w,""),P(ie);return}if(w.type!=="file"&&f!==void 0){ie=Ye(Ae,w,f),P(ie);return}P(ie)}}function X(w,Ae){if(w){w.focus(Ae);var P=Ae||{},f=P.cursor;if(f){var ie=w.value.length;switch(f){case"start":w.setSelectionRange(0,0);break;case"end":w.setSelectionRange(ie,ie);break;default:w.setSelectionRange(0,ie)}}}}},28321:function(Ci,Ft,re){"use strict";re.d(Ft,{iz:function(){return Yi},ck:function(){return ke},BW:function(){return sn},sN:function(){return ke},Wd:function(){return ji},ZP:function(){return li},Xl:function(){return je}});var ue=re(67711),we=re(52873),Ye=re(98506),pe=re(15142),X=re(16886),w=re(33346),Ae=re(92310),P=re.n(Ae),f=re(11780),ie=re(18929),I=re(13697),k=re(48736),T=re(59301),C=re(4676),O=T.createContext(null);function J(Pe,et){return Pe===void 0?null:"".concat(Pe,"-").concat(et)}function H(Pe){var et=T.useContext(O);return J(et,Pe)}var j=re(80547),$=["children","locked"],B=T.createContext(null);function V(Pe,et){var gt=(0,Ye.Z)({},Pe);return Object.keys(et).forEach(function(lt){var At=et[lt];At!==void 0&&(gt[lt]=At)}),gt}function he(Pe){var et=Pe.children,gt=Pe.locked,lt=(0,w.Z)(Pe,$),At=T.useContext(B),nt=(0,j.Z)(function(){return V(At,lt)},[At,lt],function(dt,Bt){return!gt&&(dt[0]!==Bt[0]||!(0,I.Z)(dt[1],Bt[1],!0))});return T.createElement(B.Provider,{value:nt},et)}var be=[],Te=T.createContext(null);function se(){return T.useContext(Te)}var Ee=T.createContext(be);function je(Pe){var et=T.useContext(Ee);return T.useMemo(function(){return Pe!==void 0?[].concat((0,pe.Z)(et),[Pe]):et},[et,Pe])}var Ke=T.createContext(null),It=T.createContext({}),ee=It,z=re(29194);function Z(Pe){var et=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,z.Z)(Pe)){var gt=Pe.nodeName.toLowerCase(),lt=["input","select","textarea","button"].includes(gt)||Pe.isContentEditable||gt==="a"&&!!Pe.getAttribute("href"),At=Pe.getAttribute("tabindex"),nt=Number(At),dt=null;return At&&!Number.isNaN(nt)?dt=nt:lt&&dt===null&&(dt=0),lt&&Pe.disabled&&(dt=null),dt!==null&&(dt>=0||et&&dt<0)}return!1}function Q(Pe){var et=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,gt=(0,pe.Z)(Pe.querySelectorAll("*")).filter(function(lt){return Z(lt,et)});return Z(Pe,et)&>.unshift(Pe),gt}var fe=null;function ne(){fe=document.activeElement}function A(){fe=null}function L(){if(fe)try{fe.focus()}catch(Pe){}}function G(Pe,et){if(et.keyCode===9){var gt=Q(Pe),lt=gt[et.shiftKey?0:gt.length-1],At=lt===document.activeElement||Pe===document.activeElement;if(At){var nt=gt[et.shiftKey?gt.length-1:0];nt.focus(),et.preventDefault()}}}var de=re(10228),ze=re(16089),pt=de.Z.LEFT,Ut=de.Z.RIGHT,Ie=de.Z.UP,Yt=de.Z.DOWN,Pt=de.Z.ENTER,St=de.Z.ESC,$e=de.Z.HOME,it=de.Z.END,mt=[Ie,Yt,pt,Ut];function ht(Pe,et,gt,lt){var At,nt="prev",dt="next",Bt="children",Zt="parent";if(Pe==="inline"&<===Pt)return{inlineTrigger:!0};var di=(0,we.Z)((0,we.Z)({},Ie,nt),Yt,dt),Xi=(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},pt,gt?dt:nt),Ut,gt?nt:dt),Yt,Bt),Pt,Bt),_i=(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},Ie,nt),Yt,dt),Pt,Bt),St,Zt),pt,gt?Bt:Zt),Ut,gt?Zt:Bt),Ai={inline:di,horizontal:Xi,vertical:_i,inlineSub:di,horizontalSub:_i,verticalSub:_i},Oi=(At=Ai["".concat(Pe).concat(et?"":"Sub")])===null||At===void 0?void 0:At[lt];switch(Oi){case nt:return{offset:-1,sibling:!0};case dt:return{offset:1,sibling:!0};case Zt:return{offset:-1,sibling:!1};case Bt:return{offset:1,sibling:!1};default:return null}}function ti(Pe){for(var et=Pe;et;){if(et.getAttribute("data-menu-list"))return et;et=et.parentElement}return null}function Ce(Pe,et){for(var gt=Pe||document.activeElement;gt;){if(et.has(gt))return gt;gt=gt.parentElement}return null}function Be(Pe,et){var gt=Q(Pe,!0);return gt.filter(function(lt){return et.has(lt)})}function me(Pe,et,gt){var lt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Pe)return null;var At=Be(Pe,et),nt=At.length,dt=At.findIndex(function(Bt){return gt===Bt});return lt<0?dt===-1?dt=nt-1:dt-=1:lt>0&&(dt+=1),dt=(dt+nt)%nt,At[dt]}var Xe=function(et,gt){var lt=new Set,At=new Map,nt=new Map;return et.forEach(function(dt){var Bt=document.querySelector("[data-menu-id='".concat(J(gt,dt),"']"));Bt&&(lt.add(Bt),nt.set(Bt,dt),At.set(dt,Bt))}),{elements:lt,key2element:At,element2key:nt}};function at(Pe,et,gt,lt,At,nt,dt,Bt,Zt,di){var Xi=T.useRef(),_i=T.useRef();_i.current=et;var Ai=function(){ze.Z.cancel(Xi.current)};return T.useEffect(function(){return function(){Ai()}},[]),function(Oi){var Gi=Oi.which;if([].concat(mt,[Pt,St,$e,it]).includes(Gi)){var Wi=nt(),Si=Xe(Wi,lt),Di=Si,on=Di.elements,$i=Di.key2element,Ti=Di.element2key,Zi=$i.get(et),qi=Ce(Zi,on),Fi=Ti.get(qi),un=ht(Pe,dt(Fi,!0).length===1,gt,Gi);if(!un&&Gi!==$e&&Gi!==it)return;(mt.includes(Gi)||[$e,it].includes(Gi))&&Oi.preventDefault();var dn=function(Kn){if(Kn){var yr=Kn,xn=Kn.querySelector("a");xn!=null&&xn.getAttribute("href")&&(yr=xn);var Ln=Ti.get(Kn);Bt(Ln),Ai(),Xi.current=(0,ze.Z)(function(){_i.current===Ln&&yr.focus()})}};if([$e,it].includes(Gi)||un.sibling||!qi){var $n;!qi||Pe==="inline"?$n=At.current:$n=ti(qi);var Ki,Rn=Be($n,on);Gi===$e?Ki=Rn[0]:Gi===it?Ki=Rn[Rn.length-1]:Ki=me($n,on,qi,un.offset),dn(Ki)}else if(un.inlineTrigger)Zt(Fi);else if(un.offset>0)Zt(Fi,!0),Ai(),Xi.current=(0,ze.Z)(function(){Si=Xe(Wi,lt);var cn=qi.getAttribute("aria-controls"),Kn=document.getElementById(cn),yr=me(Kn,Si.elements);dn(yr)},5);else if(un.offset<0){var qn=dt(Fi,!0),vn=qn[qn.length-2],pn=$i.get(vn);Zt(vn,!1),dn(pn)}}di==null||di(Oi)}}function Je(Pe){Promise.resolve().then(Pe)}var q="__RC_UTIL_PATH_SPLIT__",ye=function(et){return et.join(q)},Fe=function(et){return et.split(q)},Ze="rc-menu-more";function ot(){var Pe=T.useState({}),et=(0,X.Z)(Pe,2),gt=et[1],lt=(0,T.useRef)(new Map),At=(0,T.useRef)(new Map),nt=T.useState([]),dt=(0,X.Z)(nt,2),Bt=dt[0],Zt=dt[1],di=(0,T.useRef)(0),Xi=(0,T.useRef)(!1),_i=function(){Xi.current||gt({})},Ai=(0,T.useCallback)(function($i,Ti){var Zi=ye(Ti);At.current.set(Zi,$i),lt.current.set($i,Zi),di.current+=1;var qi=di.current;Je(function(){qi===di.current&&_i()})},[]),Oi=(0,T.useCallback)(function($i,Ti){var Zi=ye(Ti);At.current.delete(Zi),lt.current.delete($i)},[]),Gi=(0,T.useCallback)(function($i){Zt($i)},[]),Wi=(0,T.useCallback)(function($i,Ti){var Zi=lt.current.get($i)||"",qi=Fe(Zi);return Ti&&Bt.includes(qi[0])&&qi.unshift(Ze),qi},[Bt]),Si=(0,T.useCallback)(function($i,Ti){return $i.filter(function(Zi){return Zi!==void 0}).some(function(Zi){var qi=Wi(Zi,!0);return qi.includes(Ti)})},[Wi]),Di=function(){var Ti=(0,pe.Z)(lt.current.keys());return Bt.length&&Ti.push(Ze),Ti},on=(0,T.useCallback)(function($i){var Ti="".concat(lt.current.get($i)).concat(q),Zi=new Set;return(0,pe.Z)(At.current.keys()).forEach(function(qi){qi.startsWith(Ti)&&Zi.add(At.current.get(qi))}),Zi},[]);return T.useEffect(function(){return function(){Xi.current=!0}},[]),{registerPath:Ai,unregisterPath:Oi,refreshOverflowKeys:Gi,isSubPathKey:Si,getKeyPath:Wi,getKeys:Di,getSubPathKeys:on}}function bt(Pe){var et=T.useRef(Pe);et.current=Pe;var gt=T.useCallback(function(){for(var lt,At=arguments.length,nt=new Array(At),dt=0;dt<At;dt++)nt[dt]=arguments[dt];return(lt=et.current)===null||lt===void 0?void 0:lt.call.apply(lt,[et].concat(nt))},[]);return Pe?gt:void 0}var qt=Math.random().toFixed(5).toString().slice(2),vt=0;function Se(Pe){var et=(0,ie.Z)(Pe,{value:Pe}),gt=(0,X.Z)(et,2),lt=gt[0],At=gt[1];return T.useEffect(function(){vt+=1;var nt="".concat(qt,"-").concat(vt);At("rc-menu-uuid-".concat(nt))},[]),lt}var xt=re(42573),Wt=re(58698),Gt=re(74700),Le=re(45080),Me=re(2738),rt=re(8654);function wt(Pe,et,gt,lt){var At=T.useContext(B),nt=At.activeKey,dt=At.onActive,Bt=At.onInactive,Zt={active:nt===Pe};return et||(Zt.onMouseEnter=function(di){gt==null||gt({key:Pe,domEvent:di}),dt(Pe)},Zt.onMouseLeave=function(di){lt==null||lt({key:Pe,domEvent:di}),Bt(Pe)}),Zt}function qe(Pe){var et=T.useContext(B),gt=et.mode,lt=et.rtl,At=et.inlineIndent;if(gt!=="inline")return null;var nt=Pe;return lt?{paddingRight:nt*At}:{paddingLeft:nt*At}}function Ct(Pe){var et=Pe.icon,gt=Pe.props,lt=Pe.children,At;return et===null||et===!1?null:(typeof et=="function"?At=T.createElement(et,(0,Ye.Z)({},gt)):typeof et!="boolean"&&(At=et),At||lt||null)}var Lt=["item"];function kt(Pe){var et=Pe.item,gt=(0,w.Z)(Pe,Lt);return Object.defineProperty(gt,"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."),et}}),gt}var Nt=["title","attribute","elementRef"],Xt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Qe=["active"],zt=function(Pe){(0,Gt.Z)(gt,Pe);var et=(0,Le.Z)(gt);function gt(){return(0,xt.Z)(this,gt),et.apply(this,arguments)}return(0,Wt.Z)(gt,[{key:"render",value:function(){var At=this.props,nt=At.title,dt=At.attribute,Bt=At.elementRef,Zt=(0,w.Z)(At,Nt),di=(0,Me.Z)(Zt,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,k.ZP)(!dt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),T.createElement(f.Z.Item,(0,ue.Z)({},dt,{title:typeof nt=="string"?nt:void 0},di,{ref:Bt}))}}]),gt}(T.Component),De=T.forwardRef(function(Pe,et){var gt=Pe.style,lt=Pe.className,At=Pe.eventKey,nt=Pe.warnKey,dt=Pe.disabled,Bt=Pe.itemIcon,Zt=Pe.children,di=Pe.role,Xi=Pe.onMouseEnter,_i=Pe.onMouseLeave,Ai=Pe.onClick,Oi=Pe.onKeyDown,Gi=Pe.onFocus,Wi=(0,w.Z)(Pe,Xt),Si=H(At),Di=T.useContext(B),on=Di.prefixCls,$i=Di.onItemClick,Ti=Di.disabled,Zi=Di.overflowDisabled,qi=Di.itemIcon,Fi=Di.selectedKeys,un=Di.onActive,dn=T.useContext(ee),$n=dn._internalRenderMenuItem,Ki="".concat(on,"-item"),Rn=T.useRef(),qn=T.useRef(),vn=Ti||dt,pn=(0,rt.x1)(et,qn),cn=je(At),Kn=function(In){return{key:At,keyPath:(0,pe.Z)(cn).reverse(),item:Rn.current,domEvent:In}},yr=Bt||qi,xn=wt(At,vn,Xi,_i),Ln=xn.active,dr=(0,w.Z)(xn,Qe),Rr=Fi.includes(At),ar=qe(cn.length),Lr=function(In){if(!vn){var or=Kn(In);Ai==null||Ai(kt(or)),$i(or)}},Dn=function(In){if(Oi==null||Oi(In),In.which===de.Z.ENTER){var or=Kn(In);Ai==null||Ai(kt(or)),$i(or)}},tr=function(In){un(At),Gi==null||Gi(In)},Er={};Pe.role==="option"&&(Er["aria-selected"]=Rr);var kr=T.createElement(zt,(0,ue.Z)({ref:Rn,elementRef:pn,role:di===null?"none":di||"menuitem",tabIndex:dt?null:-1,"data-menu-id":Zi&&Si?null:Si},(0,Me.Z)(Wi,["extra"]),dr,Er,{component:"li","aria-disabled":dt,style:(0,Ye.Z)((0,Ye.Z)({},ar),gt),className:P()(Ki,(0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(Ki,"-active"),Ln),"".concat(Ki,"-selected"),Rr),"".concat(Ki,"-disabled"),vn),lt),onClick:Lr,onKeyDown:Dn,onFocus:tr}),Zt,T.createElement(Ct,{props:(0,Ye.Z)((0,Ye.Z)({},Pe),{},{isSelected:Rr}),icon:yr}));return $n&&(kr=$n(kr,Pe,{selected:Rr})),kr});function xe(Pe,et){var gt=Pe.eventKey,lt=se(),At=je(gt);return T.useEffect(function(){if(lt)return lt.registerPath(gt,At),function(){lt.unregisterPath(gt,At)}},[At]),lt?null:T.createElement(De,(0,ue.Z)({},Pe,{ref:et}))}var ke=T.forwardRef(xe),K=["className","children"],W=function(et,gt){var lt=et.className,At=et.children,nt=(0,w.Z)(et,K),dt=T.useContext(B),Bt=dt.prefixCls,Zt=dt.mode,di=dt.rtl;return T.createElement("ul",(0,ue.Z)({className:P()(Bt,di&&"".concat(Bt,"-rtl"),"".concat(Bt,"-sub"),"".concat(Bt,"-").concat(Zt==="inline"?"inline":"vertical"),lt),role:"menu"},nt,{"data-menu-list":!0,ref:gt}),At)},ae=T.forwardRef(W);ae.displayName="SubMenuList";var ce=ae,ve=re(11592);function ft(Pe,et){return(0,ve.Z)(Pe).map(function(gt,lt){if(T.isValidElement(gt)){var At,nt,dt=gt.key,Bt=(At=(nt=gt.props)===null||nt===void 0?void 0:nt.eventKey)!==null&&At!==void 0?At:dt,Zt=Bt==null;Zt&&(Bt="tmp_key-".concat([].concat((0,pe.Z)(et),[lt]).join("-")));var di={key:Bt,eventKey:Bt};return T.cloneElement(gt,di)}return gt})}var yt=re(65030),ut={adjustX:1,adjustY:1},Vt={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}},ii={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}},mi=null;function ni(Pe,et,gt){if(et)return et;if(gt)return gt[Pe]||gt.other}var Dt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function oi(Pe){var et=Pe.prefixCls,gt=Pe.visible,lt=Pe.children,At=Pe.popup,nt=Pe.popupStyle,dt=Pe.popupClassName,Bt=Pe.popupOffset,Zt=Pe.disabled,di=Pe.mode,Xi=Pe.onVisibleChange,_i=T.useContext(B),Ai=_i.getPopupContainer,Oi=_i.rtl,Gi=_i.subMenuOpenDelay,Wi=_i.subMenuCloseDelay,Si=_i.builtinPlacements,Di=_i.triggerSubMenuAction,on=_i.forceSubMenuRender,$i=_i.rootClassName,Ti=_i.motion,Zi=_i.defaultMotions,qi=T.useState(!1),Fi=(0,X.Z)(qi,2),un=Fi[0],dn=Fi[1],$n=Oi?(0,Ye.Z)((0,Ye.Z)({},ii),Si):(0,Ye.Z)((0,Ye.Z)({},Vt),Si),Ki=Dt[di],Rn=ni(di,Ti,Zi),qn=T.useRef(Rn);di!=="inline"&&(qn.current=Rn);var vn=(0,Ye.Z)((0,Ye.Z)({},qn.current),{},{leavedClassName:"".concat(et,"-hidden"),removeOnLeave:!1,motionAppear:!0}),pn=T.useRef();return T.useEffect(function(){return pn.current=(0,ze.Z)(function(){dn(gt)}),function(){ze.Z.cancel(pn.current)}},[gt]),T.createElement(yt.Z,{prefixCls:et,popupClassName:P()("".concat(et,"-popup"),(0,we.Z)({},"".concat(et,"-rtl"),Oi),dt,$i),stretch:di==="horizontal"?"minWidth":null,getPopupContainer:Ai,builtinPlacements:$n,popupPlacement:Ki,popupVisible:un,popup:At,popupStyle:nt,popupAlign:Bt&&{offset:Bt},action:Zt?[]:[Di],mouseEnterDelay:Gi,mouseLeaveDelay:Wi,onPopupVisibleChange:Xi,forceRender:on,popupMotion:vn,fresh:!0},lt)}var Mi=re(77900);function ki(Pe){var et=Pe.id,gt=Pe.open,lt=Pe.keyPath,At=Pe.children,nt="inline",dt=T.useContext(B),Bt=dt.prefixCls,Zt=dt.forceSubMenuRender,di=dt.motion,Xi=dt.defaultMotions,_i=dt.mode,Ai=T.useRef(!1);Ai.current=_i===nt;var Oi=T.useState(!Ai.current),Gi=(0,X.Z)(Oi,2),Wi=Gi[0],Si=Gi[1],Di=Ai.current?gt:!1;T.useEffect(function(){Ai.current&&Si(!1)},[_i]);var on=(0,Ye.Z)({},ni(nt,di,Xi));lt.length>1&&(on.motionAppear=!1);var $i=on.onVisibleChanged;return on.onVisibleChanged=function(Ti){return!Ai.current&&!Ti&&Si(!0),$i==null?void 0:$i(Ti)},Wi?null:T.createElement(he,{mode:nt,locked:!Ai.current},T.createElement(Mi.default,(0,ue.Z)({visible:Di},on,{forceRender:Zt,removeOnLeave:!1,leavedClassName:"".concat(Bt,"-hidden")}),function(Ti){var Zi=Ti.className,qi=Ti.style;return T.createElement(ce,{id:et,className:Zi,style:qi},At)}))}var Bi=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],gi=["active"],fi=T.forwardRef(function(Pe,et){var gt=Pe.style,lt=Pe.className,At=Pe.title,nt=Pe.eventKey,dt=Pe.warnKey,Bt=Pe.disabled,Zt=Pe.internalPopupClose,di=Pe.children,Xi=Pe.itemIcon,_i=Pe.expandIcon,Ai=Pe.popupClassName,Oi=Pe.popupOffset,Gi=Pe.popupStyle,Wi=Pe.onClick,Si=Pe.onMouseEnter,Di=Pe.onMouseLeave,on=Pe.onTitleClick,$i=Pe.onTitleMouseEnter,Ti=Pe.onTitleMouseLeave,Zi=(0,w.Z)(Pe,Bi),qi=H(nt),Fi=T.useContext(B),un=Fi.prefixCls,dn=Fi.mode,$n=Fi.openKeys,Ki=Fi.disabled,Rn=Fi.overflowDisabled,qn=Fi.activeKey,vn=Fi.selectedKeys,pn=Fi.itemIcon,cn=Fi.expandIcon,Kn=Fi.onItemClick,yr=Fi.onOpenChange,xn=Fi.onActive,Ln=T.useContext(ee),dr=Ln._internalRenderSubMenuItem,Rr=T.useContext(Ke),ar=Rr.isSubPathKey,Lr=je(),Dn="".concat(un,"-submenu"),tr=Ki||Bt,Er=T.useRef(),kr=T.useRef(),Un=Xi!=null?Xi:pn,In=_i!=null?_i:cn,or=$n.includes(nt),cr=!Rn&&or,Ir=ar(vn,nt),si=wt(nt,tr,$i,Ti),hr=si.active,br=(0,w.Z)(si,gi),lr=T.useState(!1),Hr=(0,X.Z)(lr,2),tn=Hr[0],Ei=Hr[1],nn=function(Ji){tr||Ei(Ji)},Ri=function(Ji){nn(!0),Si==null||Si({key:nt,domEvent:Ji})},mr=function(Ji){nn(!1),Di==null||Di({key:nt,domEvent:Ji})},Zn=T.useMemo(function(){return hr||(dn!=="inline"?tn||ar([qn],nt):!1)},[dn,hr,qn,tn,nt,ar]),fr=qe(Lr.length),Pn=function(Ji){tr||(on==null||on({key:nt,domEvent:Ji}),dn==="inline"&&yr(nt,!or))},os=bt(function(On){Wi==null||Wi(kt(On)),Kn(On)}),Tr=function(Ji){dn!=="inline"&&yr(nt,Ji)},Pr=function(){xn(nt)},Wr=qi&&"".concat(qi,"-popup"),jr=T.useMemo(function(){return T.createElement(Ct,{icon:dn!=="horizontal"?In:void 0,props:(0,Ye.Z)((0,Ye.Z)({},Pe),{},{isOpen:cr,isSubMenu:!0})},T.createElement("i",{className:"".concat(Dn,"-arrow")}))},[dn,In,Pe,cr,Dn]),Yn=T.createElement("div",(0,ue.Z)({role:"menuitem",style:fr,className:"".concat(Dn,"-title"),tabIndex:tr?null:-1,ref:Er,title:typeof At=="string"?At:null,"data-menu-id":Rn&&qi?null:qi,"aria-expanded":cr,"aria-haspopup":!0,"aria-controls":Wr,"aria-disabled":tr,onClick:Pn,onFocus:Pr},br),At,jr),qr=T.useRef(dn);if(dn!=="inline"&&Lr.length>1?qr.current="vertical":qr.current=dn,!Rn){var ds=qr.current;Yn=T.createElement(oi,{mode:ds,prefixCls:Dn,visible:!Zt&&cr&&dn!=="inline",popupClassName:Ai,popupOffset:Oi,popupStyle:Gi,popup:T.createElement(he,{mode:ds==="horizontal"?"vertical":ds},T.createElement(ce,{id:Wr,ref:kr},di)),disabled:tr,onVisibleChange:Tr},Yn)}var gr=T.createElement(f.Z.Item,(0,ue.Z)({ref:et,role:"none"},Zi,{component:"li",style:gt,className:P()(Dn,"".concat(Dn,"-").concat(dn),lt,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(Dn,"-open"),cr),"".concat(Dn,"-active"),Zn),"".concat(Dn,"-selected"),Ir),"".concat(Dn,"-disabled"),tr)),onMouseEnter:Ri,onMouseLeave:mr}),Yn,!Rn&&T.createElement(ki,{id:Wr,open:cr,keyPath:Lr},di));return dr&&(gr=dr(gr,Pe,{selected:Ir,active:Zn,open:cr,disabled:tr})),T.createElement(he,{onItemClick:os,mode:dn==="horizontal"?"vertical":dn,itemIcon:Un,expandIcon:In},gr)}),Vi=T.forwardRef(function(Pe,et){var gt=Pe.eventKey,lt=Pe.children,At=je(gt),nt=ft(lt,At),dt=se();T.useEffect(function(){if(dt)return dt.registerPath(gt,At),function(){dt.unregisterPath(gt,At)}},[At]);var Bt;return dt?Bt=nt:Bt=T.createElement(fi,(0,ue.Z)({ref:et},Pe),nt),T.createElement(Ee.Provider,{value:At},Bt)}),ji=Vi,en=re(26420);function Yi(Pe){var et=Pe.className,gt=Pe.style,lt=T.useContext(B),At=lt.prefixCls,nt=se();return nt?null:T.createElement("li",{role:"separator",className:P()("".concat(At,"-item-divider"),et),style:gt})}var er=["className","title","eventKey","children"],Li=T.forwardRef(function(Pe,et){var gt=Pe.className,lt=Pe.title,At=Pe.eventKey,nt=Pe.children,dt=(0,w.Z)(Pe,er),Bt=T.useContext(B),Zt=Bt.prefixCls,di="".concat(Zt,"-item-group");return T.createElement("li",(0,ue.Z)({ref:et,role:"presentation"},dt,{onClick:function(_i){return _i.stopPropagation()},className:P()(di,gt)}),T.createElement("div",{role:"presentation",className:"".concat(di,"-title"),title:typeof lt=="string"?lt:void 0},lt),T.createElement("ul",{role:"group",className:"".concat(di,"-list")},nt))}),zi=T.forwardRef(function(Pe,et){var gt=Pe.eventKey,lt=Pe.children,At=je(gt),nt=ft(lt,At),dt=se();return dt?nt:T.createElement(Li,(0,ue.Z)({ref:et},(0,Me.Z)(Pe,["warnKey"])),nt)}),sn=zi,Pi=["label","children","key","type","extra"];function bn(Pe,et,gt){var lt=et.item,At=et.group,nt=et.submenu,dt=et.divider;return(Pe||[]).map(function(Bt,Zt){if(Bt&&(0,en.Z)(Bt)==="object"){var di=Bt,Xi=di.label,_i=di.children,Ai=di.key,Oi=di.type,Gi=di.extra,Wi=(0,w.Z)(di,Pi),Si=Ai!=null?Ai:"tmp-".concat(Zt);return _i||Oi==="group"?Oi==="group"?T.createElement(At,(0,ue.Z)({key:Si},Wi,{title:Xi}),bn(_i,et,gt)):T.createElement(nt,(0,ue.Z)({key:Si},Wi,{title:Xi}),bn(_i,et,gt)):Oi==="divider"?T.createElement(dt,(0,ue.Z)({key:Si},Wi)):T.createElement(lt,(0,ue.Z)({key:Si},Wi,{extra:Gi}),Xi,(!!Gi||Gi===0)&&T.createElement("span",{className:"".concat(gt,"-item-extra")},Gi))}return null}).filter(function(Bt){return Bt})}function an(Pe,et,gt,lt,At){var nt=Pe,dt=(0,Ye.Z)({divider:Yi,item:ke,group:sn,submenu:ji},lt);return et&&(nt=bn(et,dt,At)),ft(nt,gt)}var sr=["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"],xi=[],ur=T.forwardRef(function(Pe,et){var gt,lt=Pe,At=lt.prefixCls,nt=At===void 0?"rc-menu":At,dt=lt.rootClassName,Bt=lt.style,Zt=lt.className,di=lt.tabIndex,Xi=di===void 0?0:di,_i=lt.items,Ai=lt.children,Oi=lt.direction,Gi=lt.id,Wi=lt.mode,Si=Wi===void 0?"vertical":Wi,Di=lt.inlineCollapsed,on=lt.disabled,$i=lt.disabledOverflow,Ti=lt.subMenuOpenDelay,Zi=Ti===void 0?.1:Ti,qi=lt.subMenuCloseDelay,Fi=qi===void 0?.1:qi,un=lt.forceSubMenuRender,dn=lt.defaultOpenKeys,$n=lt.openKeys,Ki=lt.activeKey,Rn=lt.defaultActiveFirst,qn=lt.selectable,vn=qn===void 0?!0:qn,pn=lt.multiple,cn=pn===void 0?!1:pn,Kn=lt.defaultSelectedKeys,yr=lt.selectedKeys,xn=lt.onSelect,Ln=lt.onDeselect,dr=lt.inlineIndent,Rr=dr===void 0?24:dr,ar=lt.motion,Lr=lt.defaultMotions,Dn=lt.triggerSubMenuAction,tr=Dn===void 0?"hover":Dn,Er=lt.builtinPlacements,kr=lt.itemIcon,Un=lt.expandIcon,In=lt.overflowedIndicator,or=In===void 0?"...":In,cr=lt.overflowedIndicatorPopupClassName,Ir=lt.getPopupContainer,si=lt.onClick,hr=lt.onOpenChange,br=lt.onKeyDown,lr=lt.openAnimation,Hr=lt.openTransitionName,tn=lt._internalRenderMenuItem,Ei=lt._internalRenderSubMenuItem,nn=lt._internalComponents,Ri=(0,w.Z)(lt,sr),mr=T.useMemo(function(){return[an(Ai,_i,xi,nn,nt),an(Ai,_i,xi,{},nt)]},[Ai,_i,nn]),Zn=(0,X.Z)(mr,2),fr=Zn[0],Pn=Zn[1],os=T.useState(!1),Tr=(0,X.Z)(os,2),Pr=Tr[0],Wr=Tr[1],jr=T.useRef(),Yn=Se(Gi),qr=Oi==="rtl",ds=(0,ie.Z)(dn,{value:$n,postState:function(Cn){return Cn||xi}}),gr=(0,X.Z)(ds,2),On=gr[0],Ji=gr[1],yn=function(Cn){var Fn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Ur(){Ji(Cn),hr==null||hr(Cn)}Fn?(0,C.flushSync)(Ur):Ur()},Qr=T.useState(On),ls=(0,X.Z)(Qr,2),Es=ls[0],ta=ls[1],Us=T.useRef(!1),xa=T.useMemo(function(){return(Si==="inline"||Si==="vertical")&&Di?["vertical",Di]:[Si,!1]},[Si,Di]),ci=(0,X.Z)(xa,2),Ii=ci[0],wn=ci[1],Gn=Ii==="inline",Sn=T.useState(Ii),es=(0,X.Z)(Sn,2),ir=es[0],ks=es[1],Zr=T.useState(wn),wa=(0,X.Z)(Zr,2),ps=wa[0],Sa=wa[1];T.useEffect(function(){ks(Ii),Sa(wn),Us.current&&(Gn?Ji(Es):yn(xi))},[Ii,wn]);var Is=T.useState(0),Ea=(0,X.Z)(Is,2),nr=Ea[0],ia=Ea[1],ka=nr>=fr.length-1||ir!=="horizontal"||$i;T.useEffect(function(){Gn&&ta(On)},[On]),T.useEffect(function(){return Us.current=!0,function(){Us.current=!1}},[]);var ms=ot(),qa=ms.registerPath,Eo=ms.unregisterPath,ts=ms.refreshOverflowKeys,gs=ms.isSubPathKey,Jo=ms.getKeyPath,Za=ms.getKeys,Qo=ms.getSubPathKeys,Vl=T.useMemo(function(){return{registerPath:qa,unregisterPath:Eo}},[qa,Eo]),el=T.useMemo(function(){return{isSubPathKey:gs}},[gs]);T.useEffect(function(){ts(ka?xi:fr.slice(nr+1).map(function(st){return st.key}))},[nr,ka]);var Ya=(0,ie.Z)(Ki||Rn&&((gt=fr[0])===null||gt===void 0?void 0:gt.key),{value:Ki}),tl=(0,X.Z)(Ya,2),Ts=tl[0],Xa=tl[1],Ja=bt(function(st){Xa(st)}),ko=bt(function(){Xa(void 0)});(0,T.useImperativeHandle)(et,function(){return{list:jr.current,focus:function(Cn){var Fn,Ur=Za(),Yr=Xe(Ur,Yn),sa=Yr.elements,aa=Yr.key2element,eo=Yr.element2key,sl=Be(jr.current,sa),to=Ts!=null?Ts:sl[0]?eo.get(sl[0]):(Fn=fr.find(function(Hl){return!Hl.props.disabled}))===null||Fn===void 0?void 0:Fn.key,As=aa.get(to);if(to&&As){var Ps;As==null||(Ps=As.focus)===null||Ps===void 0||Ps.call(As,Cn)}}}});var il=(0,ie.Z)(Kn||[],{value:yr,postState:function(Cn){return Array.isArray(Cn)?Cn:Cn==null?xi:[Cn]}}),To=(0,X.Z)(il,2),na=To[0],nl=To[1],_s=function(Cn){if(vn){var Fn=Cn.key,Ur=na.includes(Fn),Yr;cn?Ur?Yr=na.filter(function(aa){return aa!==Fn}):Yr=[].concat((0,pe.Z)(na),[Fn]):Yr=[Fn],nl(Yr);var sa=(0,Ye.Z)((0,Ye.Z)({},Cn),{},{selectedKeys:Yr});Ur?Ln==null||Ln(sa):xn==null||xn(sa)}!cn&&On.length&&ir!=="inline"&&yn(xi)},Ao=bt(function(st){si==null||si(kt(st)),_s(st)}),Lo=bt(function(st,Cn){var Fn=On.filter(function(Yr){return Yr!==st});if(Cn)Fn.push(st);else if(ir!=="inline"){var Ur=Qo(st);Fn=Fn.filter(function(Yr){return!Ur.has(Yr)})}(0,I.Z)(On,Fn,!0)||yn(Fn,!0)}),rl=function(Cn,Fn){var Ur=Fn!=null?Fn:!On.includes(Cn);Lo(Cn,Ur)},zs=at(ir,Ts,qr,Yn,jr,Za,Jo,Xa,rl,br);T.useEffect(function(){Wr(!0)},[]);var Qa=T.useMemo(function(){return{_internalRenderMenuItem:tn,_internalRenderSubMenuItem:Ei}},[tn,Ei]),ra=ir!=="horizontal"||$i?fr:fr.map(function(st,Cn){return T.createElement(he,{key:st.key,overflowDisabled:Cn>nr},st)}),Gl=T.createElement(f.Z,(0,ue.Z)({id:Gi,ref:jr,prefixCls:"".concat(nt,"-overflow"),component:"ul",itemComponent:ke,className:P()(nt,"".concat(nt,"-root"),"".concat(nt,"-").concat(ir),Zt,(0,we.Z)((0,we.Z)({},"".concat(nt,"-inline-collapsed"),ps),"".concat(nt,"-rtl"),qr),dt),dir:Oi,style:Bt,role:"menu",tabIndex:Xi,data:ra,renderRawItem:function(Cn){return Cn},renderRawRest:function(Cn){var Fn=Cn.length,Ur=Fn?fr.slice(-Fn):null;return T.createElement(ji,{eventKey:Ze,title:or,disabled:ka,internalPopupClose:Fn===0,popupClassName:cr},Ur)},maxCount:ir!=="horizontal"||$i?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Cn){ia(Cn)},onKeyDown:zs},Ri));return T.createElement(ee.Provider,{value:Qa},T.createElement(O.Provider,{value:Yn},T.createElement(he,{prefixCls:nt,rootClassName:dt,mode:ir,openKeys:On,rtl:qr,disabled:on,motion:Pr?ar:null,defaultMotions:Pr?Lr:null,activeKey:Ts,onActive:Ja,onInactive:ko,selectedKeys:na,inlineIndent:Rr,subMenuOpenDelay:Zi,subMenuCloseDelay:Fi,forceSubMenuRender:un,builtinPlacements:Er,triggerSubMenuAction:tr,getPopupContainer:Ir,itemIcon:kr,expandIcon:Un,onItemClick:Ao,onOpenChange:Lo},T.createElement(Ke.Provider,{value:el},Gl),T.createElement("div",{style:{display:"none"},"aria-hidden":!0},T.createElement(Te.Provider,{value:Vl},Pn)))))}),jn=ur,wi=jn;wi.Item=ke,wi.SubMenu=ji,wi.ItemGroup=sn,wi.Divider=Yi;var li=wi},11780:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return ne}});var ue=re(67711),we=re(98506),Ye=re(16886),pe=re(33346),X=re(59301),w=re(92310),Ae=re.n(w),P=re(29301),f=re(34280),ie=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],I=void 0;function k(A,L){var G=A.prefixCls,de=A.invalidate,ze=A.item,pt=A.renderItem,Ut=A.responsive,Ie=A.responsiveDisabled,Yt=A.registerSize,Pt=A.itemKey,St=A.className,$e=A.style,it=A.children,mt=A.display,ht=A.order,ti=A.component,Ce=ti===void 0?"div":ti,Be=(0,pe.Z)(A,ie),me=Ut&&!mt;function Xe(Fe){Yt(Pt,Fe)}X.useEffect(function(){return function(){Xe(null)}},[]);var at=pt&&ze!==I?pt(ze,{index:ht}):it,Je;de||(Je={opacity:me?0:1,height:me?0:I,overflowY:me?"hidden":I,order:Ut?ht:I,pointerEvents:me?"none":I,position:me?"absolute":I});var q={};me&&(q["aria-hidden"]=!0);var ye=X.createElement(Ce,(0,ue.Z)({className:Ae()(!de&&G,St),style:(0,we.Z)((0,we.Z)({},Je),$e)},q,Be,{ref:L}),at);return Ut&&(ye=X.createElement(P.Z,{onResize:function(Ze){var ot=Ze.offsetWidth;Xe(ot)},disabled:Ie},ye)),ye}var T=X.forwardRef(k);T.displayName="Item";var C=T,O=re(6089),J=re(4676),H=re(16089);function j(A){if(typeof MessageChannel=="undefined")(0,H.Z)(A);else{var L=new MessageChannel;L.port1.onmessage=function(){return A()},L.port2.postMessage(void 0)}}function $(){var A=X.useRef(null),L=function(de){A.current||(A.current=[],j(function(){(0,J.unstable_batchedUpdates)(function(){A.current.forEach(function(ze){ze()}),A.current=null})})),A.current.push(de)};return L}function B(A,L){var G=X.useState(L),de=(0,Ye.Z)(G,2),ze=de[0],pt=de[1],Ut=(0,O.Z)(function(Ie){A(function(){pt(Ie)})});return[ze,Ut]}var V=X.createContext(null),he=["component"],be=["className"],Te=["className"],se=function(L,G){var de=X.useContext(V);if(!de){var ze=L.component,pt=ze===void 0?"div":ze,Ut=(0,pe.Z)(L,he);return X.createElement(pt,(0,ue.Z)({},Ut,{ref:G}))}var Ie=de.className,Yt=(0,pe.Z)(de,be),Pt=L.className,St=(0,pe.Z)(L,Te);return X.createElement(V.Provider,{value:null},X.createElement(C,(0,ue.Z)({ref:G,className:Ae()(Ie,Pt)},Yt,St)))},Ee=X.forwardRef(se);Ee.displayName="RawItem";var je=Ee,Ke=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],It="responsive",ee="invalidate";function z(A){return"+ ".concat(A.length," ...")}function Z(A,L){var G=A.prefixCls,de=G===void 0?"rc-overflow":G,ze=A.data,pt=ze===void 0?[]:ze,Ut=A.renderItem,Ie=A.renderRawItem,Yt=A.itemKey,Pt=A.itemWidth,St=Pt===void 0?10:Pt,$e=A.ssr,it=A.style,mt=A.className,ht=A.maxCount,ti=A.renderRest,Ce=A.renderRawRest,Be=A.suffix,me=A.component,Xe=me===void 0?"div":me,at=A.itemComponent,Je=A.onVisibleChange,q=(0,pe.Z)(A,Ke),ye=$e==="full",Fe=$(),Ze=B(Fe,null),ot=(0,Ye.Z)(Ze,2),bt=ot[0],qt=ot[1],vt=bt||0,Se=B(Fe,new Map),xt=(0,Ye.Z)(Se,2),Wt=xt[0],Gt=xt[1],Le=B(Fe,0),Me=(0,Ye.Z)(Le,2),rt=Me[0],wt=Me[1],qe=B(Fe,0),Ct=(0,Ye.Z)(qe,2),Lt=Ct[0],kt=Ct[1],Nt=B(Fe,0),Xt=(0,Ye.Z)(Nt,2),Qe=Xt[0],zt=Xt[1],De=(0,X.useState)(null),xe=(0,Ye.Z)(De,2),ke=xe[0],K=xe[1],W=(0,X.useState)(null),ae=(0,Ye.Z)(W,2),ce=ae[0],ve=ae[1],ft=X.useMemo(function(){return ce===null&&ye?Number.MAX_SAFE_INTEGER:ce||0},[ce,bt]),yt=(0,X.useState)(!1),ut=(0,Ye.Z)(yt,2),Vt=ut[0],ii=ut[1],mi="".concat(de,"-item"),ni=Math.max(rt,Lt),Dt=ht===It,oi=pt.length&&Dt,Mi=ht===ee,ki=oi||typeof ht=="number"&&pt.length>ht,Bi=(0,X.useMemo)(function(){var wi=pt;return oi?bt===null&&ye?wi=pt:wi=pt.slice(0,Math.min(pt.length,vt/St)):typeof ht=="number"&&(wi=pt.slice(0,ht)),wi},[pt,St,bt,ht,oi]),gi=(0,X.useMemo)(function(){return oi?pt.slice(ft+1):pt.slice(Bi.length)},[pt,Bi,oi,ft]),fi=(0,X.useCallback)(function(wi,li){var Pe;return typeof Yt=="function"?Yt(wi):(Pe=Yt&&(wi==null?void 0:wi[Yt]))!==null&&Pe!==void 0?Pe:li},[Yt]),Vi=(0,X.useCallback)(Ut||function(wi){return wi},[Ut]);function ji(wi,li,Pe){ce===wi&&(li===void 0||li===ke)||(ve(wi),Pe||(ii(wi<pt.length-1),Je==null||Je(wi)),li!==void 0&&K(li))}function en(wi,li){qt(li.clientWidth)}function Yi(wi,li){Gt(function(Pe){var et=new Map(Pe);return li===null?et.delete(wi):et.set(wi,li),et})}function er(wi,li){kt(li),wt(Lt)}function Li(wi,li){zt(li)}function zi(wi){return Wt.get(fi(Bi[wi],wi))}(0,f.Z)(function(){if(vt&&typeof ni=="number"&&Bi){var wi=Qe,li=Bi.length,Pe=li-1;if(!li){ji(0,null);return}for(var et=0;et<li;et+=1){var gt=zi(et);if(ye&&(gt=gt||0),gt===void 0){ji(et-1,void 0,!0);break}if(wi+=gt,Pe===0&&wi<=vt||et===Pe-1&&wi+zi(Pe)<=vt){ji(Pe,null);break}else if(wi+ni>vt){ji(et-1,wi-gt-Qe+Lt);break}}Be&&zi(0)+Qe>vt&&K(null)}},[vt,Wt,Lt,Qe,fi,Bi]);var sn=Vt&&!!gi.length,Pi={};ke!==null&&oi&&(Pi={position:"absolute",left:ke,top:0});var bn={prefixCls:mi,responsive:oi,component:at,invalidate:Mi},an=Ie?function(wi,li){var Pe=fi(wi,li);return X.createElement(V.Provider,{key:Pe,value:(0,we.Z)((0,we.Z)({},bn),{},{order:li,item:wi,itemKey:Pe,registerSize:Yi,display:li<=ft})},Ie(wi,li))}:function(wi,li){var Pe=fi(wi,li);return X.createElement(C,(0,ue.Z)({},bn,{order:li,key:Pe,item:wi,renderItem:Vi,itemKey:Pe,registerSize:Yi,display:li<=ft}))},sr={order:sn?ft:Number.MAX_SAFE_INTEGER,className:"".concat(mi,"-rest"),registerSize:er,display:sn},xi=ti||z,ur=Ce?X.createElement(V.Provider,{value:(0,we.Z)((0,we.Z)({},bn),sr)},Ce(gi)):X.createElement(C,(0,ue.Z)({},bn,sr),typeof xi=="function"?xi(gi):xi),jn=X.createElement(Xe,(0,ue.Z)({className:Ae()(!Mi&&de,mt),style:it,ref:L},q),Bi.map(an),ki?ur:null,Be&&X.createElement(C,(0,ue.Z)({},bn,{responsive:Dt,responsiveDisabled:!oi,order:ft,className:"".concat(mi,"-suffix"),registerSize:Li,display:!0,style:Pi}),Be));return Dt?X.createElement(P.Z,{onResize:en,disabled:!oi},jn):jn}var Q=X.forwardRef(Z);Q.displayName="Overflow",Q.Item=je,Q.RESPONSIVE=It,Q.INVALIDATE=ee;var fe=Q,ne=fe},29301:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return ee}});var ue=re(67711),we=re(59301),Ye=re(11592),pe=re(48736),X=re(98506),w=re(26420),Ae=re(76846),P=re(8654),f=we.createContext(null);function ie(z){var Z=z.children,Q=z.onBatchResize,fe=we.useRef(0),ne=we.useRef([]),A=we.useContext(f),L=we.useCallback(function(G,de,ze){fe.current+=1;var pt=fe.current;ne.current.push({size:G,element:de,data:ze}),Promise.resolve().then(function(){pt===fe.current&&(Q==null||Q(ne.current),ne.current=[])}),A==null||A(G,de,ze)},[Q,A]);return we.createElement(f.Provider,{value:L},Z)}var I=re(76374),k=new Map;function T(z){z.forEach(function(Z){var Q,fe=Z.target;(Q=k.get(fe))===null||Q===void 0||Q.forEach(function(ne){return ne(fe)})})}var C=new I.Z(T),O=null,J=null;function H(z,Z){k.has(z)||(k.set(z,new Set),C.observe(z)),k.get(z).add(Z)}function j(z,Z){k.has(z)&&(k.get(z).delete(Z),k.get(z).size||(C.unobserve(z),k.delete(z)))}var $=re(42573),B=re(58698),V=re(74700),he=re(45080),be=function(z){(0,V.Z)(Q,z);var Z=(0,he.Z)(Q);function Q(){return(0,$.Z)(this,Q),Z.apply(this,arguments)}return(0,B.Z)(Q,[{key:"render",value:function(){return this.props.children}}]),Q}(we.Component);function Te(z,Z){var Q=z.children,fe=z.disabled,ne=we.useRef(null),A=we.useRef(null),L=we.useContext(f),G=typeof Q=="function",de=G?Q(ne):Q,ze=we.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),pt=!G&&we.isValidElement(de)&&(0,P.Yr)(de),Ut=pt?(0,P.C4)(de):null,Ie=(0,P.x1)(Ut,ne),Yt=function(){var it;return(0,Ae.ZP)(ne.current)||(ne.current&&(0,w.Z)(ne.current)==="object"?(0,Ae.ZP)((it=ne.current)===null||it===void 0?void 0:it.nativeElement):null)||(0,Ae.ZP)(A.current)};we.useImperativeHandle(Z,function(){return Yt()});var Pt=we.useRef(z);Pt.current=z;var St=we.useCallback(function($e){var it=Pt.current,mt=it.onResize,ht=it.data,ti=$e.getBoundingClientRect(),Ce=ti.width,Be=ti.height,me=$e.offsetWidth,Xe=$e.offsetHeight,at=Math.floor(Ce),Je=Math.floor(Be);if(ze.current.width!==at||ze.current.height!==Je||ze.current.offsetWidth!==me||ze.current.offsetHeight!==Xe){var q={width:at,height:Je,offsetWidth:me,offsetHeight:Xe};ze.current=q;var ye=me===Math.round(Ce)?Ce:me,Fe=Xe===Math.round(Be)?Be:Xe,Ze=(0,X.Z)((0,X.Z)({},q),{},{offsetWidth:ye,offsetHeight:Fe});L==null||L(Ze,$e,ht),mt&&Promise.resolve().then(function(){mt(Ze,$e)})}},[]);return we.useEffect(function(){var $e=Yt();return $e&&!fe&&H($e,St),function(){return j($e,St)}},[ne.current,fe]),we.createElement(be,{ref:A},pt?we.cloneElement(de,{ref:Ie}):de)}var se=we.forwardRef(Te),Ee=se,je="rc-observer-key";function Ke(z,Z){var Q=z.children,fe=typeof Q=="function"?[Q]:(0,Ye.Z)(Q);return fe.map(function(ne,A){var L=(ne==null?void 0:ne.key)||"".concat(je,"-").concat(A);return we.createElement(Ee,(0,ue.Z)({},z,{key:L,ref:A===0?Z:void 0}),ne)})}var It=we.forwardRef(Ke);It.Collection=ie;var ee=It},29443:function(Ci,Ft,re){"use strict";re.d(Ft,{Z:function(){return Gt}});var ue=re(67711),we=re(52873),Ye=re(98506),pe=re(16886),X=re(26420),w=re(33346),Ae=re(92310),P=re.n(Ae),f=re(18929),ie=re(49658),I=re(59301),k=(0,I.createContext)(null),T=re(15142),C=re(29301),O=re(6089),J=re(8654),H=re(16089),j=function(Me){var rt=Me.activeTabOffset,wt=Me.horizontal,qe=Me.rtl,Ct=Me.indicator,Lt=Ct===void 0?{}:Ct,kt=Lt.size,Nt=Lt.align,Xt=Nt===void 0?"center":Nt,Qe=(0,I.useState)(),zt=(0,pe.Z)(Qe,2),De=zt[0],xe=zt[1],ke=(0,I.useRef)(),K=I.useCallback(function(ae){return typeof kt=="function"?kt(ae):typeof kt=="number"?kt:ae},[kt]);function W(){H.Z.cancel(ke.current)}return(0,I.useEffect)(function(){var ae={};if(rt)if(wt){ae.width=K(rt.width);var ce=qe?"right":"left";Xt==="start"&&(ae[ce]=rt[ce]),Xt==="center"&&(ae[ce]=rt[ce]+rt.width/2,ae.transform=qe?"translateX(50%)":"translateX(-50%)"),Xt==="end"&&(ae[ce]=rt[ce]+rt.width,ae.transform="translateX(-100%)")}else ae.height=K(rt.height),Xt==="start"&&(ae.top=rt.top),Xt==="center"&&(ae.top=rt.top+rt.height/2,ae.transform="translateY(-50%)"),Xt==="end"&&(ae.top=rt.top+rt.height,ae.transform="translateY(-100%)");return W(),ke.current=(0,H.Z)(function(){xe(ae)}),W},[rt,wt,qe,Xt,K]),{style:De}},$=j,B={width:0,height:0,left:0,top:0};function V(Le,Me,rt){return(0,I.useMemo)(function(){for(var wt,qe=new Map,Ct=Me.get((wt=Le[0])===null||wt===void 0?void 0:wt.key)||B,Lt=Ct.left+Ct.width,kt=0;kt<Le.length;kt+=1){var Nt=Le[kt].key,Xt=Me.get(Nt);if(!Xt){var Qe;Xt=Me.get((Qe=Le[kt-1])===null||Qe===void 0?void 0:Qe.key)||B}var zt=qe.get(Nt)||(0,Ye.Z)({},Xt);zt.right=Lt-zt.left-zt.width,qe.set(Nt,zt)}return qe},[Le.map(function(wt){return wt.key}).join("_"),Me,rt])}function he(Le,Me){var rt=I.useRef(Le),wt=I.useState({}),qe=(0,pe.Z)(wt,2),Ct=qe[1];function Lt(kt){var Nt=typeof kt=="function"?kt(rt.current):kt;Nt!==rt.current&&Me(Nt,rt.current),rt.current=Nt,Ct({})}return[rt.current,Lt]}var be=.1,Te=.01,se=20,Ee=Math.pow(.995,se);function je(Le,Me){var rt=(0,I.useState)(),wt=(0,pe.Z)(rt,2),qe=wt[0],Ct=wt[1],Lt=(0,I.useState)(0),kt=(0,pe.Z)(Lt,2),Nt=kt[0],Xt=kt[1],Qe=(0,I.useState)(0),zt=(0,pe.Z)(Qe,2),De=zt[0],xe=zt[1],ke=(0,I.useState)(),K=(0,pe.Z)(ke,2),W=K[0],ae=K[1],ce=(0,I.useRef)();function ve(mi){var ni=mi.touches[0],Dt=ni.screenX,oi=ni.screenY;Ct({x:Dt,y:oi}),window.clearInterval(ce.current)}function ft(mi){if(qe){var ni=mi.touches[0],Dt=ni.screenX,oi=ni.screenY;Ct({x:Dt,y:oi});var Mi=Dt-qe.x,ki=oi-qe.y;Me(Mi,ki);var Bi=Date.now();Xt(Bi),xe(Bi-Nt),ae({x:Mi,y:ki})}}function yt(){if(qe&&(Ct(null),ae(null),W)){var mi=W.x/De,ni=W.y/De,Dt=Math.abs(mi),oi=Math.abs(ni);if(Math.max(Dt,oi)<be)return;var Mi=mi,ki=ni;ce.current=window.setInterval(function(){if(Math.abs(Mi)<Te&&Math.abs(ki)<Te){window.clearInterval(ce.current);return}Mi*=Ee,ki*=Ee,Me(Mi*se,ki*se)},se)}}var ut=(0,I.useRef)();function Vt(mi){var ni=mi.deltaX,Dt=mi.deltaY,oi=0,Mi=Math.abs(ni),ki=Math.abs(Dt);Mi===ki?oi=ut.current==="x"?ni:Dt:Mi>ki?(oi=ni,ut.current="x"):(oi=Dt,ut.current="y"),Me(-oi,-oi)&&mi.preventDefault()}var ii=(0,I.useRef)(null);ii.current={onTouchStart:ve,onTouchMove:ft,onTouchEnd:yt,onWheel:Vt},I.useEffect(function(){function mi(Mi){ii.current.onTouchStart(Mi)}function ni(Mi){ii.current.onTouchMove(Mi)}function Dt(Mi){ii.current.onTouchEnd(Mi)}function oi(Mi){ii.current.onWheel(Mi)}return document.addEventListener("touchmove",ni,{passive:!1}),document.addEventListener("touchend",Dt,{passive:!0}),Le.current.addEventListener("touchstart",mi,{passive:!0}),Le.current.addEventListener("wheel",oi,{passive:!1}),function(){document.removeEventListener("touchmove",ni),document.removeEventListener("touchend",Dt)}},[])}var Ke=re(34280);function It(Le){var Me=(0,I.useState)(0),rt=(0,pe.Z)(Me,2),wt=rt[0],qe=rt[1],Ct=(0,I.useRef)(0),Lt=(0,I.useRef)();return Lt.current=Le,(0,Ke.o)(function(){var kt;(kt=Lt.current)===null||kt===void 0||kt.call(Lt)},[wt]),function(){Ct.current===wt&&(Ct.current+=1,qe(Ct.current))}}function ee(Le){var Me=(0,I.useRef)([]),rt=(0,I.useState)({}),wt=(0,pe.Z)(rt,2),qe=wt[1],Ct=(0,I.useRef)(typeof Le=="function"?Le():Le),Lt=It(function(){var Nt=Ct.current;Me.current.forEach(function(Xt){Nt=Xt(Nt)}),Me.current=[],Ct.current=Nt,qe({})});function kt(Nt){Me.current.push(Nt),Lt()}return[Ct.current,kt]}var z={width:0,height:0,left:0,top:0,right:0};function Z(Le,Me,rt,wt,qe,Ct,Lt){var kt=Lt.tabs,Nt=Lt.tabPosition,Xt=Lt.rtl,Qe,zt,De;return["top","bottom"].includes(Nt)?(Qe="width",zt=Xt?"right":"left",De=Math.abs(rt)):(Qe="height",zt="top",De=-rt),(0,I.useMemo)(function(){if(!kt.length)return[0,0];for(var xe=kt.length,ke=xe,K=0;K<xe;K+=1){var W=Le.get(kt[K].key)||z;if(Math.floor(W[zt]+W[Qe])>Math.floor(De+Me)){ke=K-1;break}}for(var ae=0,ce=xe-1;ce>=0;ce-=1){var ve=Le.get(kt[ce].key)||z;if(ve[zt]<De){ae=ce+1;break}}return ae>=ke?[0,0]:[ae,ke]},[Le,Me,wt,qe,Ct,De,Nt,kt.map(function(xe){return xe.key}).join("_"),Xt])}function Q(Le){var Me;return Le instanceof Map?(Me={},Le.forEach(function(rt,wt){Me[wt]=rt})):Me=Le,JSON.stringify(Me)}var fe="TABS_DQ";function ne(Le){return String(Le).replace(/"/g,fe)}function A(Le,Me,rt,wt){return!(!rt||wt||Le===!1||Le===void 0&&(Me===!1||Me===null))}var L=I.forwardRef(function(Le,Me){var rt=Le.prefixCls,wt=Le.editable,qe=Le.locale,Ct=Le.style;return!wt||wt.showAdd===!1?null:I.createElement("button",{ref:Me,type:"button",className:"".concat(rt,"-nav-add"),style:Ct,"aria-label":(qe==null?void 0:qe.addAriaLabel)||"Add tab",onClick:function(kt){wt.onEdit("add",{event:kt})}},wt.addIcon||"+")}),G=L,de=I.forwardRef(function(Le,Me){var rt=Le.position,wt=Le.prefixCls,qe=Le.extra;if(!qe)return null;var Ct,Lt={};return(0,X.Z)(qe)==="object"&&!I.isValidElement(qe)?Lt=qe:Lt.right=qe,rt==="right"&&(Ct=Lt.right),rt==="left"&&(Ct=Lt.left),Ct?I.createElement("div",{className:"".concat(wt,"-extra-content"),ref:Me},Ct):null}),ze=de,pt=re(96478),Ut=re(28321),Ie=re(10228),Yt=I.forwardRef(function(Le,Me){var rt=Le.prefixCls,wt=Le.id,qe=Le.tabs,Ct=Le.locale,Lt=Le.mobile,kt=Le.more,Nt=kt===void 0?{}:kt,Xt=Le.style,Qe=Le.className,zt=Le.editable,De=Le.tabBarGutter,xe=Le.rtl,ke=Le.removeAriaLabel,K=Le.onTabClick,W=Le.getPopupContainer,ae=Le.popupClassName,ce=(0,I.useState)(!1),ve=(0,pe.Z)(ce,2),ft=ve[0],yt=ve[1],ut=(0,I.useState)(null),Vt=(0,pe.Z)(ut,2),ii=Vt[0],mi=Vt[1],ni=Nt.icon,Dt=ni===void 0?"More":ni,oi="".concat(wt,"-more-popup"),Mi="".concat(rt,"-dropdown"),ki=ii!==null?"".concat(oi,"-").concat(ii):null,Bi=Ct==null?void 0:Ct.dropdownAriaLabel;function gi(Li,zi){Li.preventDefault(),Li.stopPropagation(),zt.onEdit("remove",{key:zi,event:Li})}var fi=I.createElement(Ut.ZP,{onClick:function(zi){var sn=zi.key,Pi=zi.domEvent;K(sn,Pi),yt(!1)},prefixCls:"".concat(Mi,"-menu"),id:oi,tabIndex:-1,role:"listbox","aria-activedescendant":ki,selectedKeys:[ii],"aria-label":Bi!==void 0?Bi:"expanded dropdown"},qe.map(function(Li){var zi=Li.closable,sn=Li.disabled,Pi=Li.closeIcon,bn=Li.key,an=Li.label,sr=A(zi,Pi,zt,sn);return I.createElement(Ut.sN,{key:bn,id:"".concat(oi,"-").concat(bn),role:"option","aria-controls":wt&&"".concat(wt,"-panel-").concat(bn),disabled:sn},I.createElement("span",null,an),sr&&I.createElement("button",{type:"button","aria-label":ke||"remove",tabIndex:0,className:"".concat(Mi,"-menu-item-remove"),onClick:function(ur){ur.stopPropagation(),gi(ur,bn)}},Pi||zt.removeIcon||"\xD7"))}));function Vi(Li){for(var zi=qe.filter(function(sr){return!sr.disabled}),sn=zi.findIndex(function(sr){return sr.key===ii})||0,Pi=zi.length,bn=0;bn<Pi;bn+=1){sn=(sn+Li+Pi)%Pi;var an=zi[sn];if(!an.disabled){mi(an.key);return}}}function ji(Li){var zi=Li.which;if(!ft){[Ie.Z.DOWN,Ie.Z.SPACE,Ie.Z.ENTER].includes(zi)&&(yt(!0),Li.preventDefault());return}switch(zi){case Ie.Z.UP:Vi(-1),Li.preventDefault();break;case Ie.Z.DOWN:Vi(1),Li.preventDefault();break;case Ie.Z.ESC:yt(!1);break;case Ie.Z.SPACE:case Ie.Z.ENTER:ii!==null&&K(ii,Li);break}}(0,I.useEffect)(function(){var Li=document.getElementById(ki);Li&&Li.scrollIntoView&&Li.scrollIntoView(!1)},[ii]),(0,I.useEffect)(function(){ft||mi(null)},[ft]);var en=(0,we.Z)({},xe?"marginRight":"marginLeft",De);qe.length||(en.visibility="hidden",en.order=1);var Yi=P()((0,we.Z)({},"".concat(Mi,"-rtl"),xe)),er=Lt?null:I.createElement(pt.Z,(0,ue.Z)({prefixCls:Mi,overlay:fi,visible:qe.length?ft:!1,onVisibleChange:yt,overlayClassName:P()(Yi,ae),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:W},Nt),I.createElement("button",{type:"button",className:"".concat(rt,"-nav-more"),style:en,"aria-haspopup":"listbox","aria-controls":oi,id:"".concat(wt,"-more"),"aria-expanded":ft,onKeyDown:ji},Dt));return I.createElement("div",{className:P()("".concat(rt,"-nav-operations"),Qe),style:Xt,ref:Me},er,I.createElement(G,{prefixCls:rt,locale:Ct,editable:zt}))}),Pt=I.memo(Yt,function(Le,Me){return Me.tabMoving}),St=function(Me){var rt=Me.prefixCls,wt=Me.id,qe=Me.active,Ct=Me.focus,Lt=Me.tab,kt=Lt.key,Nt=Lt.label,Xt=Lt.disabled,Qe=Lt.closeIcon,zt=Lt.icon,De=Me.closable,xe=Me.renderWrapper,ke=Me.removeAriaLabel,K=Me.editable,W=Me.onClick,ae=Me.onFocus,ce=Me.onBlur,ve=Me.onKeyDown,ft=Me.onMouseDown,yt=Me.onMouseUp,ut=Me.style,Vt=Me.tabCount,ii=Me.currentPosition,mi="".concat(rt,"-tab"),ni=A(De,Qe,K,Xt);function Dt(gi){Xt||W(gi)}function oi(gi){gi.preventDefault(),gi.stopPropagation(),K.onEdit("remove",{key:kt,event:gi})}var Mi=I.useMemo(function(){return zt&&typeof Nt=="string"?I.createElement("span",null,Nt):Nt},[Nt,zt]),ki=I.useRef(null);I.useEffect(function(){Ct&&ki.current&&ki.current.focus()},[Ct]);var Bi=I.createElement("div",{key:kt,"data-node-key":ne(kt),className:P()(mi,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(mi,"-with-remove"),ni),"".concat(mi,"-active"),qe),"".concat(mi,"-disabled"),Xt),"".concat(mi,"-focus"),Ct)),style:ut,onClick:Dt},I.createElement("div",{ref:ki,role:"tab","aria-selected":qe,id:wt&&"".concat(wt,"-tab-").concat(kt),className:"".concat(mi,"-btn"),"aria-controls":wt&&"".concat(wt,"-panel-").concat(kt),"aria-disabled":Xt,tabIndex:Xt?null:qe?0:-1,onClick:function(fi){fi.stopPropagation(),Dt(fi)},onKeyDown:ve,onMouseDown:ft,onMouseUp:yt,onFocus:ae,onBlur:ce},Ct&&I.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"Tab ".concat(ii," of ").concat(Vt)),zt&&I.createElement("span",{className:"".concat(mi,"-icon")},zt),Nt&&Mi),ni&&I.createElement("button",{type:"button",role:"tab","aria-label":ke||"remove",tabIndex:qe?0:-1,className:"".concat(mi,"-remove"),onClick:function(fi){fi.stopPropagation(),oi(fi)}},Qe||K.removeIcon||"\xD7"));return xe?xe(Bi):Bi},$e=St,it=function(Me,rt){var wt=Me.offsetWidth,qe=Me.offsetHeight,Ct=Me.offsetTop,Lt=Me.offsetLeft,kt=Me.getBoundingClientRect(),Nt=kt.width,Xt=kt.height,Qe=kt.left,zt=kt.top;return Math.abs(Nt-wt)<1?[Nt,Xt,Qe-rt.left,zt-rt.top]:[wt,qe,Lt,Ct]},mt=function(Me){var rt=Me.current||{},wt=rt.offsetWidth,qe=wt===void 0?0:wt,Ct=rt.offsetHeight,Lt=Ct===void 0?0:Ct;if(Me.current){var kt=Me.current.getBoundingClientRect(),Nt=kt.width,Xt=kt.height;if(Math.abs(Nt-qe)<1)return[Nt,Xt]}return[qe,Lt]},ht=function(Me,rt){return Me[rt?0:1]},ti=I.forwardRef(function(Le,Me){var rt=Le.className,wt=Le.style,qe=Le.id,Ct=Le.animated,Lt=Le.activeKey,kt=Le.rtl,Nt=Le.extra,Xt=Le.editable,Qe=Le.locale,zt=Le.tabPosition,De=Le.tabBarGutter,xe=Le.children,ke=Le.onTabClick,K=Le.onTabScroll,W=Le.indicator,ae=I.useContext(k),ce=ae.prefixCls,ve=ae.tabs,ft=(0,I.useRef)(null),yt=(0,I.useRef)(null),ut=(0,I.useRef)(null),Vt=(0,I.useRef)(null),ii=(0,I.useRef)(null),mi=(0,I.useRef)(null),ni=(0,I.useRef)(null),Dt=zt==="top"||zt==="bottom",oi=he(0,function(tn,Ei){Dt&&K&&K({direction:tn>Ei?"left":"right"})}),Mi=(0,pe.Z)(oi,2),ki=Mi[0],Bi=Mi[1],gi=he(0,function(tn,Ei){!Dt&&K&&K({direction:tn>Ei?"top":"bottom"})}),fi=(0,pe.Z)(gi,2),Vi=fi[0],ji=fi[1],en=(0,I.useState)([0,0]),Yi=(0,pe.Z)(en,2),er=Yi[0],Li=Yi[1],zi=(0,I.useState)([0,0]),sn=(0,pe.Z)(zi,2),Pi=sn[0],bn=sn[1],an=(0,I.useState)([0,0]),sr=(0,pe.Z)(an,2),xi=sr[0],ur=sr[1],jn=(0,I.useState)([0,0]),wi=(0,pe.Z)(jn,2),li=wi[0],Pe=wi[1],et=ee(new Map),gt=(0,pe.Z)(et,2),lt=gt[0],At=gt[1],nt=V(ve,lt,Pi[0]),dt=ht(er,Dt),Bt=ht(Pi,Dt),Zt=ht(xi,Dt),di=ht(li,Dt),Xi=Math.floor(dt)<Math.floor(Bt+Zt),_i=Xi?dt-di:dt-Zt,Ai="".concat(ce,"-nav-operations-hidden"),Oi=0,Gi=0;Dt&&kt?(Oi=0,Gi=Math.max(0,Bt-_i)):(Oi=Math.min(0,_i-Bt),Gi=0);function Wi(tn){return tn<Oi?Oi:tn>Gi?Gi:tn}var Si=(0,I.useRef)(null),Di=(0,I.useState)(),on=(0,pe.Z)(Di,2),$i=on[0],Ti=on[1];function Zi(){Ti(Date.now())}function qi(){Si.current&&clearTimeout(Si.current)}je(Vt,function(tn,Ei){function nn(Ri,mr){Ri(function(Zn){var fr=Wi(Zn+mr);return fr})}return Xi?(Dt?nn(Bi,tn):nn(ji,Ei),qi(),Zi(),!0):!1}),(0,I.useEffect)(function(){return qi(),$i&&(Si.current=setTimeout(function(){Ti(0)},100)),qi},[$i]);var Fi=Z(nt,_i,Dt?ki:Vi,Bt,Zt,di,(0,Ye.Z)((0,Ye.Z)({},Le),{},{tabs:ve})),un=(0,pe.Z)(Fi,2),dn=un[0],$n=un[1],Ki=(0,O.Z)(function(){var tn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lt,Ei=nt.get(tn)||{width:0,height:0,left:0,right:0,top:0};if(Dt){var nn=ki;kt?Ei.right<ki?nn=Ei.right:Ei.right+Ei.width>ki+_i&&(nn=Ei.right+Ei.width-_i):Ei.left<-ki?nn=-Ei.left:Ei.left+Ei.width>-ki+_i&&(nn=-(Ei.left+Ei.width-_i)),ji(0),Bi(Wi(nn))}else{var Ri=Vi;Ei.top<-Vi?Ri=-Ei.top:Ei.top+Ei.height>-Vi+_i&&(Ri=-(Ei.top+Ei.height-_i)),Bi(0),ji(Wi(Ri))}}),Rn=(0,I.useState)(),qn=(0,pe.Z)(Rn,2),vn=qn[0],pn=qn[1],cn=(0,I.useState)(!1),Kn=(0,pe.Z)(cn,2),yr=Kn[0],xn=Kn[1],Ln=ve.filter(function(tn){return!tn.disabled}).map(function(tn){return tn.key}),dr=function(Ei){var nn=Ln.indexOf(vn||Lt),Ri=Ln.length,mr=(nn+Ei+Ri)%Ri,Zn=Ln[mr];pn(Zn)},Rr=function(Ei){var nn=Ei.code,Ri=kt&&Dt,mr=Ln[0],Zn=Ln[Ln.length-1];switch(nn){case"ArrowLeft":{Dt&&dr(Ri?1:-1);break}case"ArrowRight":{Dt&&dr(Ri?-1:1);break}case"ArrowUp":{Ei.preventDefault(),Dt||dr(-1);break}case"ArrowDown":{Ei.preventDefault(),Dt||dr(1);break}case"Home":{Ei.preventDefault(),pn(mr);break}case"End":{Ei.preventDefault(),pn(Zn);break}case"Enter":case"Space":{Ei.preventDefault(),ke(Lt,Ei);break}case"Backspace":case"Delete":{var fr=Ln.indexOf(vn),Pn=ve.find(function(Tr){return Tr.key===vn}),os=A(Pn==null?void 0:Pn.closable,Pn==null?void 0:Pn.closeIcon,Xt,Pn==null?void 0:Pn.disabled);os&&(Ei.preventDefault(),Ei.stopPropagation(),Xt.onEdit("remove",{key:vn,event:Ei}),fr===Ln.length-1?dr(-1):dr(1));break}}},ar={};Dt?ar[kt?"marginRight":"marginLeft"]=De:ar.marginTop=De;var Lr=ve.map(function(tn,Ei){var nn=tn.key;return I.createElement($e,{id:qe,prefixCls:ce,key:nn,tab:tn,style:Ei===0?void 0:ar,closable:tn.closable,editable:Xt,active:nn===Lt,focus:nn===vn,renderWrapper:xe,removeAriaLabel:Qe==null?void 0:Qe.removeAriaLabel,tabCount:Ln.length,currentPosition:Ei+1,onClick:function(mr){ke(nn,mr)},onKeyDown:Rr,onFocus:function(){yr||pn(nn),Ki(nn),Zi(),Vt.current&&(kt||(Vt.current.scrollLeft=0),Vt.current.scrollTop=0)},onBlur:function(){pn(void 0)},onMouseDown:function(){xn(!0)},onMouseUp:function(){xn(!1)}})}),Dn=function(){return At(function(){var Ei,nn=new Map,Ri=(Ei=ii.current)===null||Ei===void 0?void 0:Ei.getBoundingClientRect();return ve.forEach(function(mr){var Zn,fr=mr.key,Pn=(Zn=ii.current)===null||Zn===void 0?void 0:Zn.querySelector('[data-node-key="'.concat(ne(fr),'"]'));if(Pn){var os=it(Pn,Ri),Tr=(0,pe.Z)(os,4),Pr=Tr[0],Wr=Tr[1],jr=Tr[2],Yn=Tr[3];nn.set(fr,{width:Pr,height:Wr,left:jr,top:Yn})}}),nn})};(0,I.useEffect)(function(){Dn()},[ve.map(function(tn){return tn.key}).join("_")]);var tr=It(function(){var tn=mt(ft),Ei=mt(yt),nn=mt(ut);Li([tn[0]-Ei[0]-nn[0],tn[1]-Ei[1]-nn[1]]);var Ri=mt(ni);ur(Ri);var mr=mt(mi);Pe(mr);var Zn=mt(ii);bn([Zn[0]-Ri[0],Zn[1]-Ri[1]]),Dn()}),Er=ve.slice(0,dn),kr=ve.slice($n+1),Un=[].concat((0,T.Z)(Er),(0,T.Z)(kr)),In=nt.get(Lt),or=$({activeTabOffset:In,horizontal:Dt,indicator:W,rtl:kt}),cr=or.style;(0,I.useEffect)(function(){Ki()},[Lt,Oi,Gi,Q(In),Q(nt),Dt]),(0,I.useEffect)(function(){tr()},[kt]);var Ir=!!Un.length,si="".concat(ce,"-nav-wrap"),hr,br,lr,Hr;return Dt?kt?(br=ki>0,hr=ki!==Gi):(hr=ki<0,br=ki!==Oi):(lr=Vi<0,Hr=Vi!==Oi),I.createElement(C.Z,{onResize:tr},I.createElement("div",{ref:(0,J.x1)(Me,ft),role:"tablist","aria-orientation":Dt?"horizontal":"vertical",className:P()("".concat(ce,"-nav"),rt),style:wt,onKeyDown:function(){Zi()}},I.createElement(ze,{ref:yt,position:"left",extra:Nt,prefixCls:ce}),I.createElement(C.Z,{onResize:tr},I.createElement("div",{className:P()(si,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(si,"-ping-left"),hr),"".concat(si,"-ping-right"),br),"".concat(si,"-ping-top"),lr),"".concat(si,"-ping-bottom"),Hr)),ref:Vt},I.createElement(C.Z,{onResize:tr},I.createElement("div",{ref:ii,className:"".concat(ce,"-nav-list"),style:{transform:"translate(".concat(ki,"px, ").concat(Vi,"px)"),transition:$i?"none":void 0}},Lr,I.createElement(G,{ref:ni,prefixCls:ce,locale:Qe,editable:Xt,style:(0,Ye.Z)((0,Ye.Z)({},Lr.length===0?void 0:ar),{},{visibility:Ir?"hidden":null})}),I.createElement("div",{className:P()("".concat(ce,"-ink-bar"),(0,we.Z)({},"".concat(ce,"-ink-bar-animated"),Ct.inkBar)),style:cr}))))),I.createElement(Pt,(0,ue.Z)({},Le,{removeAriaLabel:Qe==null?void 0:Qe.removeAriaLabel,ref:mi,prefixCls:ce,tabs:Un,className:!Ir&&Ai,tabMoving:!!$i})),I.createElement(ze,{ref:ut,position:"right",extra:Nt,prefixCls:ce})))}),Ce=ti,Be=I.forwardRef(function(Le,Me){var rt=Le.prefixCls,wt=Le.className,qe=Le.style,Ct=Le.id,Lt=Le.active,kt=Le.tabKey,Nt=Le.children;return I.createElement("div",{id:Ct&&"".concat(Ct,"-panel-").concat(kt),role:"tabpanel",tabIndex:Lt?0:-1,"aria-labelledby":Ct&&"".concat(Ct,"-tab-").concat(kt),"aria-hidden":!Lt,style:qe,className:P()(rt,Lt&&"".concat(rt,"-active"),wt),ref:Me},Nt)}),me=Be,Xe=["renderTabBar"],at=["label","key"],Je=function(Me){var rt=Me.renderTabBar,wt=(0,w.Z)(Me,Xe),qe=I.useContext(k),Ct=qe.tabs;if(rt){var Lt=(0,Ye.Z)((0,Ye.Z)({},wt),{},{panes:Ct.map(function(kt){var Nt=kt.label,Xt=kt.key,Qe=(0,w.Z)(kt,at);return I.createElement(me,(0,ue.Z)({tab:Nt,key:Xt,tabKey:Xt},Qe))})});return rt(Lt,Ce)}return I.createElement(Ce,wt)},q=Je,ye=re(77900),Fe=["key","forceRender","style","className","destroyInactiveTabPane"],Ze=function(Me){var rt=Me.id,wt=Me.activeKey,qe=Me.animated,Ct=Me.tabPosition,Lt=Me.destroyInactiveTabPane,kt=I.useContext(k),Nt=kt.prefixCls,Xt=kt.tabs,Qe=qe.tabPane,zt="".concat(Nt,"-tabpane");return I.createElement("div",{className:P()("".concat(Nt,"-content-holder"))},I.createElement("div",{className:P()("".concat(Nt,"-content"),"".concat(Nt,"-content-").concat(Ct),(0,we.Z)({},"".concat(Nt,"-content-animated"),Qe))},Xt.map(function(De){var xe=De.key,ke=De.forceRender,K=De.style,W=De.className,ae=De.destroyInactiveTabPane,ce=(0,w.Z)(De,Fe),ve=xe===wt;return I.createElement(ye.default,(0,ue.Z)({key:xe,visible:ve,forceRender:ke,removeOnLeave:!!(Lt||ae),leavedClassName:"".concat(zt,"-hidden")},qe.tabPaneMotion),function(ft,yt){var ut=ft.style,Vt=ft.className;return I.createElement(me,(0,ue.Z)({},ce,{prefixCls:zt,id:rt,tabKey:xe,animated:Qe,active:ve,style:(0,Ye.Z)((0,Ye.Z)({},K),ut),className:P()(W,Vt),ref:yt}))})})))},ot=Ze,bt=re(48736);function qt(){var Le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},Me;return Le===!1?Me={inkBar:!1,tabPane:!1}:Le===!0?Me={inkBar:!0,tabPane:!1}:Me=(0,Ye.Z)({inkBar:!0},(0,X.Z)(Le)==="object"?Le:{}),Me.tabPaneMotion&&Me.tabPane===void 0&&(Me.tabPane=!0),!Me.tabPaneMotion&&Me.tabPane&&(Me.tabPane=!1),Me}var vt=["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,xt=I.forwardRef(function(Le,Me){var rt=Le.id,wt=Le.prefixCls,qe=wt===void 0?"rc-tabs":wt,Ct=Le.className,Lt=Le.items,kt=Le.direction,Nt=Le.activeKey,Xt=Le.defaultActiveKey,Qe=Le.editable,zt=Le.animated,De=Le.tabPosition,xe=De===void 0?"top":De,ke=Le.tabBarGutter,K=Le.tabBarStyle,W=Le.tabBarExtraContent,ae=Le.locale,ce=Le.more,ve=Le.destroyInactiveTabPane,ft=Le.renderTabBar,yt=Le.onChange,ut=Le.onTabClick,Vt=Le.onTabScroll,ii=Le.getPopupContainer,mi=Le.popupClassName,ni=Le.indicator,Dt=(0,w.Z)(Le,vt),oi=I.useMemo(function(){return(Lt||[]).filter(function(li){return li&&(0,X.Z)(li)==="object"&&"key"in li})},[Lt]),Mi=kt==="rtl",ki=qt(zt),Bi=(0,I.useState)(!1),gi=(0,pe.Z)(Bi,2),fi=gi[0],Vi=gi[1];(0,I.useEffect)(function(){Vi((0,ie.Z)())},[]);var ji=(0,f.Z)(function(){var li;return(li=oi[0])===null||li===void 0?void 0:li.key},{value:Nt,defaultValue:Xt}),en=(0,pe.Z)(ji,2),Yi=en[0],er=en[1],Li=(0,I.useState)(function(){return oi.findIndex(function(li){return li.key===Yi})}),zi=(0,pe.Z)(Li,2),sn=zi[0],Pi=zi[1];(0,I.useEffect)(function(){var li=oi.findIndex(function(et){return et.key===Yi});if(li===-1){var Pe;li=Math.max(0,Math.min(sn,oi.length-1)),er((Pe=oi[li])===null||Pe===void 0?void 0:Pe.key)}Pi(li)},[oi.map(function(li){return li.key}).join("_"),Yi,sn]);var bn=(0,f.Z)(null,{value:rt}),an=(0,pe.Z)(bn,2),sr=an[0],xi=an[1];(0,I.useEffect)(function(){rt||(xi("rc-tabs-".concat(Se)),Se+=1)},[]);function ur(li,Pe){ut==null||ut(li,Pe);var et=li!==Yi;er(li),et&&(yt==null||yt(li))}var jn={id:sr,activeKey:Yi,animated:ki,tabPosition:xe,rtl:Mi,mobile:fi},wi=(0,Ye.Z)((0,Ye.Z)({},jn),{},{editable:Qe,locale:ae,more:ce,tabBarGutter:ke,onTabClick:ur,onTabScroll:Vt,extra:W,style:K,panes:null,getPopupContainer:ii,popupClassName:mi,indicator:ni});return I.createElement(k.Provider,{value:{tabs:oi,prefixCls:qe}},I.createElement("div",(0,ue.Z)({ref:Me,id:rt,className:P()(qe,"".concat(qe,"-").concat(xe),(0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(qe,"-mobile"),fi),"".concat(qe,"-editable"),Qe),"".concat(qe,"-rtl"),Mi),Ct)},Dt),I.createElement(q,(0,ue.Z)({},wi,{renderTabBar:ft})),I.createElement(ot,(0,ue.Z)({destroyInactiveTabPane:ve},jn,{animated:ki}))))}),Wt=xt,Gt=Wt},29125:function(Ci,Ft,re){"use strict";re.d(Ft,{G:function(){return pe},Z:function(){return j}});var ue=re(92310),we=re.n(ue),Ye=re(59301);function pe($){var B=$.children,V=$.prefixCls,he=$.id,be=$.overlayInnerStyle,Te=$.bodyClassName,se=$.className,Ee=$.style;return Ye.createElement("div",{className:we()("".concat(V,"-content"),se),style:Ee},Ye.createElement("div",{className:we()("".concat(V,"-inner"),Te),id:he,role:"tooltip",style:be},typeof B=="function"?B():B))}var X=re(67711),w=re(98506),Ae=re(33346),P=re(65030),f={shiftX:64,adjustY:1},ie={adjustX:1,shiftY:!0},I=[0,0],k={left:{points:["cr","cl"],overflow:ie,offset:[-4,0],targetOffset:I},right:{points:["cl","cr"],overflow:ie,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:ie,offset:[-4,0],targetOffset:I},topRight:{points:["br","tr"],overflow:f,offset:[0,-4],targetOffset:I},rightTop:{points:["tl","tr"],overflow:ie,offset:[4,0],targetOffset:I},bottomRight:{points:["tr","br"],overflow:f,offset:[0,4],targetOffset:I},rightBottom:{points:["bl","br"],overflow:ie,offset:[4,0],targetOffset:I},bottomLeft:{points:["tl","bl"],overflow:f,offset:[0,4],targetOffset:I},leftBottom:{points:["br","bl"],overflow:ie,offset:[-4,0],targetOffset:I}},T=null,C=re(80402),O=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],J=function(B,V){var he=B.overlayClassName,be=B.trigger,Te=be===void 0?["hover"]:be,se=B.mouseEnterDelay,Ee=se===void 0?0:se,je=B.mouseLeaveDelay,Ke=je===void 0?.1:je,It=B.overlayStyle,ee=B.prefixCls,z=ee===void 0?"rc-tooltip":ee,Z=B.children,Q=B.onVisibleChange,fe=B.afterVisibleChange,ne=B.transitionName,A=B.animation,L=B.motion,G=B.placement,de=G===void 0?"right":G,ze=B.align,pt=ze===void 0?{}:ze,Ut=B.destroyTooltipOnHide,Ie=Ut===void 0?!1:Ut,Yt=B.defaultVisible,Pt=B.getTooltipContainer,St=B.overlayInnerStyle,$e=B.arrowContent,it=B.overlay,mt=B.id,ht=B.showArrow,ti=ht===void 0?!0:ht,Ce=B.classNames,Be=B.styles,me=(0,Ae.Z)(B,O),Xe=(0,C.Z)(mt),at=(0,Ye.useRef)(null);(0,Ye.useImperativeHandle)(V,function(){return at.current});var Je=(0,w.Z)({},me);"visible"in B&&(Je.popupVisible=B.visible);var q=function(){return Ye.createElement(pe,{key:"content",prefixCls:z,id:Xe,bodyClassName:Ce==null?void 0:Ce.body,overlayInnerStyle:(0,w.Z)((0,w.Z)({},St),Be==null?void 0:Be.body)},it)},ye=function(){var Ze=Ye.Children.only(Z),ot=(Ze==null?void 0:Ze.props)||{},bt=(0,w.Z)((0,w.Z)({},ot),{},{"aria-describedby":it?Xe:null});return Ye.cloneElement(Z,bt)};return Ye.createElement(P.Z,(0,X.Z)({popupClassName:we()(he,Ce==null?void 0:Ce.root),prefixCls:z,popup:q,action:Te,builtinPlacements:k,popupPlacement:de,ref:at,popupAlign:pt,getPopupContainer:Pt,onPopupVisibleChange:Q,afterPopupVisibleChange:fe,popupTransitionName:ne,popupAnimation:A,popupMotion:L,defaultPopupVisible:Yt,autoDestroy:Ie,mouseLeaveDelay:Ke,popupStyle:(0,w.Z)((0,w.Z)({},It),Be==null?void 0:Be.root),mouseEnterDelay:Ee,arrow:ti},Je),ye())},H=(0,Ye.forwardRef)(J),j=H},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 pe($){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pe=function(V){return typeof V}:pe=function(V){return V&&typeof Symbol=="function"&&V.constructor===Symbol&&V!==Symbol.prototype?"symbol":typeof V},pe($)}function X($,B){var V=Object.keys($);if(Object.getOwnPropertySymbols){var he=Object.getOwnPropertySymbols($);B&&(he=he.filter(function(be){return Object.getOwnPropertyDescriptor($,be).enumerable})),V.push.apply(V,he)}return V}function w($){for(var B=1;B<arguments.length;B++){var V=arguments[B]!=null?arguments[B]:{};B%2?X(V,!0).forEach(function(he){H($,he,V[he])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(V)):X(V).forEach(function(he){Object.defineProperty($,he,Object.getOwnPropertyDescriptor(V,he))})}return $}function Ae($,B){if($==null)return{};var V=P($,B),he,be;if(Object.getOwnPropertySymbols){var Te=Object.getOwnPropertySymbols($);for(be=0;be<Te.length;be++)he=Te[be],!(B.indexOf(he)>=0)&&Object.prototype.propertyIsEnumerable.call($,he)&&(V[he]=$[he])}return V}function P($,B){if($==null)return{};var V={},he=Object.keys($),be,Te;for(Te=0;Te<he.length;Te++)be=he[Te],!(B.indexOf(be)>=0)&&(V[be]=$[be]);return V}function f($,B){if(!($ instanceof B))throw new TypeError("Cannot call a class as a function")}function ie($,B){for(var V=0;V<B.length;V++){var he=B[V];he.enumerable=he.enumerable||!1,he.configurable=!0,"value"in he&&(he.writable=!0),Object.defineProperty($,he.key,he)}}function I($,B,V){return B&&ie($.prototype,B),V&&ie($,V),$}function k($,B){return B&&(pe(B)==="object"||typeof B=="function")?B:C($)}function T($){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(V){return V.__proto__||Object.getPrototypeOf(V)},T($)}function C($){if($===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return $}function O($,B){if(typeof B!="function"&&B!==null)throw new TypeError("Super expression must either be null or a function");$.prototype=Object.create(B&&B.prototype,{constructor:{value:$,writable:!0,configurable:!0}}),B&&J($,B)}function J($,B){return J=Object.setPrototypeOf||function(he,be){return he.__proto__=be,he},J($,B)}function H($,B,V){return B in $?Object.defineProperty($,B,{value:V,enumerable:!0,configurable:!0,writable:!0}):$[B]=V,$}var j=function($){O(B,$);function B(){var V,he;f(this,B);for(var be=arguments.length,Te=new Array(be),se=0;se<be;se++)Te[se]=arguments[se];return he=k(this,(V=T(B)).call.apply(V,[this].concat(Te))),H(C(he),"onClick",function(Ee){var je=he.props,Ke=je.text,It=je.onCopy,ee=je.children,z=je.options,Z=ue.default.Children.only(ee),Q=(0,we.default)(Ke,z);It&&It(Ke,Q),Z&&Z.props&&typeof Z.props.onClick=="function"&&Z.props.onClick(Ee)}),he}return I(B,[{key:"render",value:function(){var he=this.props,be=he.text,Te=he.onCopy,se=he.options,Ee=he.children,je=Ae(he,["text","onCopy","options","children"]),Ke=ue.default.Children.only(Ee);return ue.default.cloneElement(Ke,w({},je,{onClick:this.onClick}))}}]),B}(ue.default.PureComponent);Ft.CopyToClipboard=j,H(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 ee(z,Z){var Q=-1;return z.some(function(fe,ne){return fe[0]===Z?(Q=ne,!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(Z){var Q=ee(this.__entries__,Z),fe=this.__entries__[Q];return fe&&fe[1]},z.prototype.set=function(Z,Q){var fe=ee(this.__entries__,Z);~fe?this.__entries__[fe][1]=Q:this.__entries__.push([Z,Q])},z.prototype.delete=function(Z){var Q=this.__entries__,fe=ee(Q,Z);~fe&&Q.splice(fe,1)},z.prototype.has=function(Z){return!!~ee(this.__entries__,Z)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(Z,Q){Q===void 0&&(Q=null);for(var fe=0,ne=this.__entries__;fe<ne.length;fe++){var A=ne[fe];Z.call(Q,A[1],A[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")()}(),pe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Ye):function(ee){return setTimeout(function(){return ee(Date.now())},1e3/60)}}(),X=2;function w(ee,z){var Z=!1,Q=!1,fe=0;function ne(){Z&&(Z=!1,ee()),Q&&L()}function A(){pe(ne)}function L(){var G=Date.now();if(Z){if(G-fe<X)return;Q=!0}else Z=!0,Q=!1,setTimeout(A,z);fe=G}return L}var Ae=20,P=["top","right","bottom","left","width","height","size","weight"],f=typeof MutationObserver!="undefined",ie=function(){function ee(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=w(this.refresh.bind(this),Ae)}return ee.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},ee.prototype.removeObserver=function(z){var Z=this.observers_,Q=Z.indexOf(z);~Q&&Z.splice(Q,1),!Z.length&&this.connected_&&this.disconnect_()},ee.prototype.refresh=function(){var z=this.updateObservers_();z&&this.refresh()},ee.prototype.updateObservers_=function(){var z=this.observers_.filter(function(Z){return Z.gatherActive(),Z.hasActive()});return z.forEach(function(Z){return Z.broadcastActive()}),z.length>0},ee.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)},ee.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)},ee.prototype.onTransitionEnd_=function(z){var Z=z.propertyName,Q=Z===void 0?"":Z,fe=P.some(function(ne){return!!~Q.indexOf(ne)});fe&&this.refresh()},ee.getInstance=function(){return this.instance_||(this.instance_=new ee),this.instance_},ee.instance_=null,ee}(),I=function(ee,z){for(var Z=0,Q=Object.keys(z);Z<Q.length;Z++){var fe=Q[Z];Object.defineProperty(ee,fe,{value:z[fe],enumerable:!1,writable:!1,configurable:!0})}return ee},k=function(ee){var z=ee&&ee.ownerDocument&&ee.ownerDocument.defaultView;return z||Ye},T=be(0,0,0,0);function C(ee){return parseFloat(ee)||0}function O(ee){for(var z=[],Z=1;Z<arguments.length;Z++)z[Z-1]=arguments[Z];return z.reduce(function(Q,fe){var ne=ee["border-"+fe+"-width"];return Q+C(ne)},0)}function J(ee){for(var z=["top","right","bottom","left"],Z={},Q=0,fe=z;Q<fe.length;Q++){var ne=fe[Q],A=ee["padding-"+ne];Z[ne]=C(A)}return Z}function H(ee){var z=ee.getBBox();return be(0,0,z.width,z.height)}function j(ee){var z=ee.clientWidth,Z=ee.clientHeight;if(!z&&!Z)return T;var Q=k(ee).getComputedStyle(ee),fe=J(Q),ne=fe.left+fe.right,A=fe.top+fe.bottom,L=C(Q.width),G=C(Q.height);if(Q.boxSizing==="border-box"&&(Math.round(L+ne)!==z&&(L-=O(Q,"left","right")+ne),Math.round(G+A)!==Z&&(G-=O(Q,"top","bottom")+A)),!B(ee)){var de=Math.round(L+ne)-z,ze=Math.round(G+A)-Z;Math.abs(de)!==1&&(L-=de),Math.abs(ze)!==1&&(G-=ze)}return be(fe.left,fe.top,L,G)}var $=function(){return typeof SVGGraphicsElement!="undefined"?function(ee){return ee instanceof k(ee).SVGGraphicsElement}:function(ee){return ee instanceof k(ee).SVGElement&&typeof ee.getBBox=="function"}}();function B(ee){return ee===k(ee).document.documentElement}function V(ee){return we?$(ee)?H(ee):j(ee):T}function he(ee){var z=ee.x,Z=ee.y,Q=ee.width,fe=ee.height,ne=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,A=Object.create(ne.prototype);return I(A,{x:z,y:Z,width:Q,height:fe,top:Z,right:z+Q,bottom:fe+Z,left:z}),A}function be(ee,z,Z,Q){return{x:ee,y:z,width:Z,height:Q}}var Te=function(){function ee(z){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=be(0,0,0,0),this.target=z}return ee.prototype.isActive=function(){var z=V(this.target);return this.contentRect_=z,z.width!==this.broadcastWidth||z.height!==this.broadcastHeight},ee.prototype.broadcastRect=function(){var z=this.contentRect_;return this.broadcastWidth=z.width,this.broadcastHeight=z.height,z},ee}(),se=function(){function ee(z,Z){var Q=he(Z);I(this,{target:z,contentRect:Q})}return ee}(),Ee=function(){function ee(z,Z,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_=Z,this.callbackCtx_=Q}return ee.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 Z=this.observations_;Z.has(z)||(Z.set(z,new Te(z)),this.controller_.addObserver(this),this.controller_.refresh())}},ee.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 Z=this.observations_;Z.has(z)&&(Z.delete(z),Z.size||this.controller_.removeObserver(this))}},ee.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},ee.prototype.gatherActive=function(){var z=this;this.clearActive(),this.observations_.forEach(function(Z){Z.isActive()&&z.activeObservations_.push(Z)})},ee.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,Z=this.activeObservations_.map(function(Q){return new se(Q.target,Q.broadcastRect())});this.callback_.call(z,Z,z),this.clearActive()}},ee.prototype.clearActive=function(){this.activeObservations_.splice(0)},ee.prototype.hasActive=function(){return this.activeObservations_.length>0},ee}(),je=typeof WeakMap!="undefined"?new WeakMap:new ue,Ke=function(){function ee(z){if(!(this instanceof ee))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var Z=ie.getInstance(),Q=new Ee(z,Z,this);je.set(this,Q)}return ee}();["observe","unobserve","disconnect"].forEach(function(ee){Ke.prototype[ee]=function(){var z;return(z=je.get(this))[ee].apply(z,arguments)}});var It=function(){return typeof Ye.ResizeObserver!="undefined"?Ye.ResizeObserver:Ke}();Ft.Z=It},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()}}},81168:function(Ci,Ft,re){"use strict";re.d(Ft,{ZP:function(){return Oa}});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 pe=function(h){return h.NETWORK_ERROR="networkError",h.MEDIA_ERROR="mediaError",h.KEY_SYSTEM_ERROR="keySystemError",h.MUX_ERROR="muxError",h.OTHER_ERROR="otherError",h}({}),X=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 Ae={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},P={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class f{constructor(t,n=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=n,this.totalWeight_=s}sample(t,n){const s=Math.pow(this.alpha_,t);this.estimate_=n*(1-s)+s*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class ie{constructor(t,n,s,o=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new f(t),this.fast_=new f(n),this.defaultTTFB_=o,this.ttfb_=new f(t)}update(t,n){const{slow_:s,fast_:o,ttfb_:l}=this;s.halfLife!==t&&(this.slow_=new f(t,s.getEstimate(),s.getTotalWeight())),o.halfLife!==n&&(this.fast_=new f(n,o.getEstimate(),o.getTotalWeight())),l.halfLife!==t&&(this.ttfb_=new f(t,l.getEstimate(),l.getTotalWeight()))}sample(t,n){t=Math.max(t,this.minDelayMs_);const s=8*n,o=t/1e3,l=s/o;this.fast_.sample(o,l),this.slow_.sample(o,l)}sampleTTFB(t){const n=t/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(n,2)/2);this.ttfb_.sample(s,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function I(h,t,n){return(t=J(t))in h?Object.defineProperty(h,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):h[t]=n,h}function k(){return k=Object.assign?Object.assign.bind():function(h){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(h[s]=n[s])}return h},k.apply(null,arguments)}function T(h,t){var n=Object.keys(h);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(h);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(h,o).enumerable})),n.push.apply(n,s)}return n}function C(h){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T(Object(n),!0).forEach(function(s){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 J(h){var t=O(h,"string");return typeof t=="symbol"?t:t+""}class H{constructor(t,n){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${t}]:`;this.trace=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 B(){return k({},$)}function V(h,t){const n=self.console[h];return n?n.bind(self.console,`${t?"["+t+"] ":""}[${h}] >`):j}function he(h,t,n){return t[h]?t[h].bind(t):V(h,n)}const be=B();function Te(h,t,n){const s=B();if(typeof console=="object"&&h===!0||typeof h=="object"){const o=["debug","log","info","warn","error"];o.forEach(l=>{s[l]=he(l,h,n)});try{s.log(`Debug logs enabled for "${t}" in hls.js version 1.6.7`)}catch(l){return B()}o.forEach(l=>{be[l]=he(l,h)})}else k(be,s);return s}const se=be;function Ee(h=!0){return typeof self=="undefined"?void 0:(h||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function je(h){return typeof self!="undefined"&&h===self.ManagedMediaSource}function Ke(h,t){const n=Object.keys(h),s=Object.keys(t),o=n.length,l=s.length;return!o||!l||o===l&&!n.some(c=>s.indexOf(c)===-1)}function It(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 ee={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 Uint8Array.from(h.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function Z(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var Q={exports:{}},fe;function ne(){return fe||(fe=1,function(h,t){(function(n){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,o=/^(?=([^\/?#]*))\1([^]*)$/,l=/(?:\/|^)\.(?=\/)/g,c=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,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 D=p.parseURL(_);if(!D)throw new Error("Error trying to parse base URL.");if(!D.netLoc&&D.path&&D.path[0]!=="/"){var M=o.exec(D.path);D.netLoc=M[1],D.path=M[2]}D.netLoc&&!D.path&&(D.path="/");var U={scheme:D.scheme,netLoc:S.netLoc,path:null,params:S.params,query:S.query,fragment:S.fragment};if(!S.netLoc&&(U.netLoc=D.netLoc,S.path[0]!=="/"))if(!S.path)U.path=D.path,S.params||(U.params=D.params,S.query||(U.query=D.query));else{var N=D.path,te=N.substring(0,N.lastIndexOf("/")+1)+S.path;U.path=p.normalizePath(te)}return U.path===null&&(U.path=v.alwaysNormalize?p.normalizePath(S.path):S.path),p.buildURLFromParts(U)},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 A=ne();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 G={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class de{constructor(t){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof t=="string"&&(t={url:t}),this.base=t,Yt(this,"stats")}setByteRange(t,n){const s=t.split("@",2);let o;s.length===1?o=(n==null?void 0:n.byteRangeEndOffset)||0:o=parseInt(s[1]),this._byteRange=[o,parseInt(s[0])+o]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[G.AUDIO]:null,[G.VIDEO]:null,[G.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(t){this._streams=t}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new L),this._stats}set stats(t){this._stats=t}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=A.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[G.AUDIO]=null,t[G.VIDEO]=null,t[G.AUDIOVIDEO]=null}}function ze(h){return h.sn!=="initSegment"}class pt extends de{constructor(t,n){super(n),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=t}get byteLength(){if(this.hasStats){const t=this.stats.total;if(t)return t}if(this.byteRange){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 ze(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(t){this.setStart(this.start+t)}setStart(t){this.start=t,this._ref&&(this._ref.start=t)}setDuration(t){this.duration=t,this._ref&&(this._ref.duration=t)}setKeyFormat(t){if(this.levelkeys){const n=this.levelkeys[t];n&&!this._decryptdata&&(this._decryptdata=n.getDecryptData(this.sn))}}abortRequests(){var t,n;(t=this.loader)==null||t.abort(),(n=this.keyLoader)==null||n.abort()}setElementaryStreamInfo(t,n,s,o,l,c=!1){const{elementaryStreams: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 Ut extends de{constructor(t,n,s,o,l){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=n,this.index=o;const c=t.enumeratedString("BYTERANGE");c&&this.setByteRange(c,l),l&&(this.fragOffset=l.fragOffset+l.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}function Ie(h,t){const n=Object.getPrototypeOf(h);if(n){const s=Object.getOwnPropertyDescriptor(n,t);return s||Ie(n,t)}}function Yt(h,t){const n=Ie(h,t);n&&(n.enumerable=!0,Object.defineProperty(h,t,n))}const Pt=Math.pow(2,32)-1,St=[].push,$e={video:1,audio:2,id3:3,text:4};function it(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 ht(h,t){const n=Ce(h,t);return n<0?4294967296+n:n}function ti(h,t){let n=ht(h,t);return n*=Math.pow(2,32),n+=ht(h,t+4),n}function Ce(h,t){return h[t]<<24|h[t+1]<<16|h[t+2]<<8|h[t+3]}function Be(h){const t=h.byteLength;for(let n=0;n<t;){const s=ht(h,n);if(s>8&&h[n+4]===109&&h[n+5]===111&&h[n+6]===111&&h[n+7]===102)return!0;n=s>1?n+s:t}return!1}function me(h,t){const n=[];if(!t.length)return n;const s=h.byteLength;for(let o=0;o<s;){const l=ht(h,o),c=it(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 _=me(h.subarray(o+8,p),t.slice(1));_.length&&St.apply(n,_)}o=p}return n}function Xe(h){const t=[],n=h[0];let s=8;const o=ht(h,s);s+=4;let l=0,c=0;n===0?(l=ht(h,s),c=ht(h,s+4),s+=8):(l=ti(h,s),c=ti(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=ht(h,v);v+=4;const S=y&2147483647;if((y&2147483648)>>>31===1)return se.warn("SIDX has hierarchical references (not supported)"),null;const M=ht(h,v);v+=4,t.push({referenceSize:S,subsegmentDuration:M,info:{duration:M/o,start:p,end:p+S-1}}),p+=S,v+=4,s=v}return{earliestPresentationTime:l,timescale:o,version:n,referencesCount:_,references:t}}function at(h){const t=[],n=me(h,["moov","trak"]);for(let o=0;o<n.length;o++){const l=n[o],c=me(l,["tkhd"])[0];if(c){let p=c[0];const _=ht(c,p===0?12:20),m=me(l,["mdia","mdhd"])[0];if(m){p=m[0];const v=ht(m,p===0?12:20),y=me(l,["mdia","hdlr"])[0];if(y){const S=it(y.subarray(8,12)),D={soun:G.AUDIO,vide:G.VIDEO}[S],M=me(l,["mdia","minf","stbl","stsd"])[0],U=Je(M);D?(t[_]={timescale:v,type:D,stsd:U},t[D]=C({timescale:v,id:_},U)):t[_]={timescale:v,type:S,stsd:U}}}}}return me(h,["moov","mvex","trex"]).forEach(o=>{const l=ht(o,4),c=t[l];c&&(c.default={duration:ht(o,12),flags:ht(o,20)})}),t}function Je(h){const t=h.subarray(8),n=t.subarray(86),s=it(t.subarray(4,8));let o=s,l;const c=s==="enca"||s==="encv";if(c){const m=me(t,[s])[0].subarray(s==="enca"?28:78);me(m,["sinf"]).forEach(y=>{const S=me(y,["schm"])[0];if(S){const D=it(S.subarray(4,8));if(D==="cbcs"||D==="cenc"){const M=me(y,["frma"])[0];M&&(o=it(M))}}})}const p=o;switch(o){case"avc1":case"avc2":case"avc3":case"avc4":{const _=me(n,["avcC"])[0];_&&_.length>3&&(o+="."+Ze(_[1])+Ze(_[2])+Ze(_[3]),l=q(p==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const _=me(t,[s])[0],m=me(_.subarray(28),["esds"])[0];if(m&&m.length>7){let v=4;if(m[v++]!==3)break;v=Fe(m,v),v+=2;const y=m[v++];if(y&128&&(v+=2),y&64&&(v+=m[v++]),m[v++]!==4)break;v=Fe(m,v);const S=m[v++];if(S===64)o+="."+Ze(S);else break;if(v+=12,m[v++]!==5)break;v=Fe(m,v);const D=m[v++];let M=(D&248)>>3;M===31&&(M+=1+((D&7)<<3)+((m[v]&224)>>5)),o+="."+M}break}case"hvc1":case"hev1":{const _=me(n,["hvcC"])[0];if(_&&_.length>12){const m=_[1],v=["","A","B","C"][m>>6],y=m&31,S=ht(_,2),D=(m&32)>>5?"H":"L",M=_[12],U=_.subarray(6,12);o+="."+v+y,o+="."+ye(S).toString(16).toUpperCase(),o+="."+D+M;let N="";for(let te=U.length;te--;){const _e=U[te];(_e||N)&&(N="."+_e.toString(16).toUpperCase()+N)}o+=N}l=q(p=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{o=q(o,n)||o;break}case"vp09":{const _=me(n,["vpcC"])[0];if(_&&_.length>6){const m=_[4],v=_[5],y=_[6]>>4&15;o+="."+ot(m)+"."+ot(v)+"."+ot(y)}break}case"av01":{const _=me(n,["av1C"])[0];if(_&&_.length>2){const m=_[1]>>>5,v=_[1]&31,y=_[2]>>>7?"H":"M",S=(_[2]&64)>>6,D=(_[2]&32)>>5,M=m===2&&S?D?12:10:S?10:8,U=(_[2]&16)>>4,N=(_[2]&8)>>3,te=(_[2]&4)>>2,_e=_[2]&3;o+="."+m+"."+ot(v)+y+"."+ot(M)+"."+U+"."+N+te+_e+"."+ot(1)+"."+ot(1)+"."+ot(1)+"."+0,l=q("dav1",n)}break}}return{codec:o,encrypted:c,supplemental:l}}function q(h,t){const n=me(t,["dvvC"]),s=n.length?n[0]:me(t,["dvcC"])[0];if(s){const o=s[2]>>1&127,l=s[2]<<5&32|s[3]>>3&31;return h+"."+ot(o)+"."+ot(l)}}function ye(h){let t=0;for(let n=0;n<32;n++)t|=(h>>n&1)<<31-n;return t>>>0}function Fe(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 ot(h){return(h<10?"0":"")+h}function bt(h,t){if(!h||!t)return h;const n=t.keyId;return n&&t.isCommonEncryption&&me(h,["moov","trak"]).forEach(o=>{const c=me(o,["mdia","minf","stbl","stsd"])[0].subarray(8);let p=me(c,["enca"]);const _=p.length>0;_||(p=me(c,["encv"])),p.forEach(m=>{const v=_?m.subarray(28):m.subarray(78);me(v,["sinf"]).forEach(S=>{const D=qt(S);if(D){const M=D.subarray(8,24);M.some(U=>U!==0)||(se.log(`[eme] Patching keyId in 'enc${_?"a":"v"}>sinf>>tenc' box: ${ee.hexDump(M)} -> ${ee.hexDump(n)}`),D.set(n,8))}})})}),h}function qt(h){const t=me(h,["schm"])[0];if(t){const n=it(t.subarray(4,8));if(n==="cbcs"||n==="cenc")return me(h,["schi","tenc"])[0]}return null}function vt(h,t,n){const s={},o=me(h,["moof","traf"]);for(let l=0;l<o.length;l++){const c=o[l],p=me(c,["tfhd"])[0],_=ht(p,4),m=t[_];if(!m)continue;const v=s[_]||(s[_]={start:NaN,duration:0,sampleCount:0,timescale:m.timescale,type:m.type}),y=me(c,["tfdt"])[0];if(y){const le=y[0];let Re=ht(y,4);le===1&&(Re===Pt?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Re*=Pt+1,Re+=ht(y,8))),ue(Re)&&(!ue(v.start)||Re<v.start)&&(v.start=Re)}const S=m.default,D=ht(p,0)|(S==null?void 0:S.flags);let M=(S==null?void 0:S.duration)||0;D&8&&(D&2?M=ht(p,12):M=ht(p,8));const U=me(c,["trun"]);let N=v.start||0,te=0,_e=M;for(let le=0;le<U.length;le++){const Re=U[le],Ue=ht(Re,4),_t=v.sampleCount;v.sampleCount+=Ue;const Ne=Re[3]&1,We=Re[3]&4,tt=Re[2]&1,Oe=Re[2]&2,Rt=Re[2]&4,ei=Re[2]&8;let pi=8,yi=Ue;for(Ne&&(pi+=4),We&&Ue&&(!(Re[pi+1]&1)&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=_t),pi+=4,tt?(_e=ht(Re,pi),pi+=4):_e=M,Oe&&(pi+=4),ei&&(pi+=4),N+=_e,te+=_e,yi--);yi--;)tt?(_e=ht(Re,pi),pi+=4):_e=M,Oe&&(pi+=4),Rt&&(Re[pi+1]&1||v.keyFrameIndex===void 0&&(v.keyFrameIndex=v.sampleCount-(yi+1),v.keyFrameStart=N),pi+=4),ei&&(pi+=4),N+=_e,te+=_e;!te&&M&&(te+=M*Ue)}v.duration+=te}if(!Object.keys(s).some(l=>s[l].duration)){let l=1/0,c=0;const p=me(h,["sidx"]);for(let _=0;_<p.length;_++){const m=Xe(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){const t={valid:null,remainder:null},n=me(h,["moof"]);if(n.length<2)return t.remainder=h,t;const s=n[n.length-1];return t.valid=h.slice(0,s.byteOffset-8),t.remainder=h.slice(s.byteOffset-8),t}function xt(h,t){const n=new Uint8Array(h.length+t.length);return n.set(h),n.set(t,h.length),n}function Wt(h,t){const n=[],s=t.samples,o=t.timescale,l=t.id;let c=!1;return me(s,["moof"]).map(_=>{const m=_.byteOffset-8;me(_,["traf"]).map(y=>{const S=me(y,["tfdt"]).map(D=>{const M=D[0];let U=ht(D,4);return M===1&&(U*=Math.pow(2,32),U+=ht(D,8)),U/o})[0];return S!==void 0&&(h=S),me(y,["tfhd"]).map(D=>{const M=ht(D,4),U=ht(D,0)&16777215,N=(U&1)!==0,te=(U&2)!==0,_e=(U&8)!==0;let le=0;const Re=(U&16)!==0;let Ue=0;const _t=(U&32)!==0;let Ne=8;M===l&&(N&&(Ne+=8),te&&(Ne+=4),_e&&(le=ht(D,Ne),Ne+=4),Re&&(Ue=ht(D,Ne),Ne+=4),_t&&(Ne+=4),t.type==="video"&&(c=Gt(t.codec)),me(y,["trun"]).map(We=>{const tt=We[0],Oe=ht(We,0)&16777215,Rt=(Oe&1)!==0;let ei=0;const pi=(Oe&4)!==0,yi=(Oe&256)!==0;let vi=0;const ui=(Oe&512)!==0;let Ui=0;const Jt=(Oe&1024)!==0,Hi=(Oe&2048)!==0;let Ni=0;const ri=ht(We,4);let jt=8;Rt&&(ei=ht(We,jt),jt+=4),pi&&(jt+=4);let hn=ei+m;for(let mn=0;mn<ri;mn++){if(yi?(vi=ht(We,jt),jt+=4):vi=le,ui?(Ui=ht(We,jt),jt+=4):Ui=Ue,Jt&&(jt+=4),Hi&&(tt===0?Ni=ht(We,jt):Ni=Ce(We,jt),jt+=4),t.type===G.VIDEO){let kn=0;for(;kn<Ui;){const gn=ht(s,hn);if(hn+=4,Le(c,s[hn])){const Mn=s.subarray(hn,hn+gn);Me(Mn,c?2:1,h+Ni/o,n)}hn+=gn,kn+=gn+4}}h+=vi/o}}))})})}),n}function Gt(h){if(!h)return!1;const t=h.substring(0,4);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function Le(h,t){if(h){const n=t>>1&63;return n===39||n===40}else return(t&31)===6}function Me(h,t,n,s){const o=rt(h);let l=0;l+=t;let c=0,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 D=ht(o,v);if(v+=4,D===1195456820){const M=o[v++];if(M===3){const U=o[v++],N=31&U,te=64&U,_e=te?2+N*3:0,le=new Uint8Array(_e);if(te){le[0]=U;for(let Re=1;Re<_e;Re++)le[Re]=o[v++]}s.push({type:M,payloadType:c,pts:n,bytes:le})}}}}}else if(c===5&&p>16){const y=[];for(let M=0;M<16;M++){const U=o[v++].toString(16);y.push(U.length==1?"0"+U:U),(M===3||M===5||M===7||M===9)&&y.push("-")}const S=p-16,D=new Uint8Array(S);for(let M=0;M<S;M++)D[M]=o[v++];s.push({payloadType:c,pts:n,uuid:y.join(""),userData:It(D),userDataBytes:D})}}}function rt(h){const t=h.byteLength,n=[];let s=1;for(;s<t-2;)h[s]===0&&h[s+1]===0&&h[s+2]===3?(n.push(s+2),s+=2):s++;if(n.length===0)return h;const o=t-n.length,l=new Uint8Array(o);let c=0;for(s=0;s<o;c++,s++)c===n[0]&&(c++,n.shift()),l[s]=h[c];return l}function wt(h){const t=h[0];let n="",s="",o=0,l=0,c=0,p=0,_=0,m=0;if(t===0){for(;it(h.subarray(m,m+1))!=="\0";)n+=it(h.subarray(m,m+1)),m+=1;for(n+=it(h.subarray(m,m+1)),m+=1;it(h.subarray(m,m+1))!=="\0";)s+=it(h.subarray(m,m+1)),m+=1;s+=it(h.subarray(m,m+1)),m+=1,o=ht(h,12),l=ht(h,16),p=ht(h,20),_=ht(h,24),m=28}else if(t===1){m+=4,o=ht(h,m),m+=4;const y=ht(h,m);m+=4;const S=ht(h,m);for(m+=4,c=ba(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=ht(h,m),m+=4,_=ht(h,m),m+=4;it(h.subarray(m,m+1))!=="\0";)n+=it(h.subarray(m,m+1)),m+=1;for(n+=it(h.subarray(m,m+1)),m+=1;it(h.subarray(m,m+1))!=="\0";)s+=it(h.subarray(m,m+1)),m+=1;s+=it(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 qe(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),qe([112,115,115,104],new Uint8Array([s,0,0,0]),h,l,o,c,n||new Uint8Array)}const Lt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),kt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Nt(h,t){const n=kt[t];return!!n&&!!n[h.slice(0,4)]}function Xt(h,t,n=!0){return!h.split(",").some(s=>!Qe(s,t,n))}function Qe(h,t,n=!0){var s;const o=Ee(n);return(s=o==null?void 0:o.isTypeSupported(zt(h,t)))!=null?s:!1}function zt(h,t){return`${t}/mp4;codecs=${h}`}function De(h){if(h){const t=h.substring(0,4);return kt.video[t]}return 2}function xe(h){const t=Lt();return h.split(",").reduce((n,s)=>{const l=t&&Gt(s)?9:kt.video[s];return l?(l*2+n)/(n?3:2):(kt.audio[s]+n)/(n?2:1)},0)}const ke={};function K(h,t=!0){if(ke[h])return ke[h];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[h];for(let o=0;o<n.length;o++){var s;if(Qe(n[o],"audio",t))return ke[h]=n[o],n[o];if(n[o]==="mp3"&&(s=Ee(t))!=null&&s.isTypeSupported("audio/mpeg"))return""}return h}const W=/flac|opus|mp4a\.40\.34/i;function ae(h,t=!0){return h.replace(W,n=>K(n.toLowerCase(),t))}function ce(h,t){const n=[];if(h){const s=h.split(",");for(let o=0;o<s.length;o++)Nt(s[o],"video")||n.push(s[o])}return t&&n.push(t),n.join(",")}function ve(h,t){if(h&&(h.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(h)!==-1)&&(ft(h,"audio")||ft(h,"video")))return h;if(t){const n=t.split(",");if(n.length>1){if(h){for(let s=n.length;s--;)if(n[s].substring(0,4)===h.substring(0,4))return n[s]}return n[0]}}return t||h}function ft(h,t){return Nt(h,t)&&Qe(h,t)}function yt(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 ut(h){if(h.startsWith("av01.")){const t=h.split("."),n=["0","111","01","01","01","0"];for(let s=t.length;s>4&&s<10;s++)t[s]=n[s-4];return t.join(".")}return h}function Vt(h){const t=Ee(h)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function ii(h){return h.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const mi={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function ni(h,t){return{supported:!1,configurations:t,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:h}}function Dt(h,t,n,s,o,l){const c=h.videoCodec,p=h.audioCodec?h.audioGroups:null,_=l==null?void 0:l.audioCodec,m=l==null?void 0:l.channels,v=m?parseInt(m):_?1/0:2;let y=null;if(p!=null&&p.length)try{p.length===1&&p[0]?y=t.groups[p[0]].channels:y=p.reduce((S,D)=>{if(D){const M=t.groups[D];if(!M)throw new Error(`Audio track group ${D} not found`);Object.keys(M.channels).forEach(U=>{S[U]=(S[U]||0)+M.channels[U]})}return S},{2:0})}catch(S){return!0}return c!==void 0&&(c.split(",").some(S=>Gt(S))||h.width>1920&&h.height>1088||h.height>1920&&h.width>1088||h.frameRate>Math.max(s,30)||h.videoRange!=="SDR"&&h.videoRange!==n||h.bitrate>Math.max(o,8e6))||!!y&&ue(v)&&Object.keys(y).some(S=>parseInt(S)>v)}function oi(h,t,n,s={}){const o=h.videoCodec;if(!o&&!h.audioCodec||!n)return Promise.resolve(mi);const l=[],c=Mi(h),p=c.length,_=ki(h,t,p>0),m=_.length;for(let v=p||1*m||1;v--;){const y={type:"media-source"};if(p&&(y.video=c[v%p]),m){y.audio=_[v%m];const S=y.audio.bitrate;y.video&&S&&(y.video.bitrate-=S)}l.push(y)}if(o){const v=navigator.userAgent;if(o.split(",").some(y=>Gt(y))&&Lt())return Promise.resolve(ni(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${v})`),l))}return Promise.all(l.map(v=>{const y=fi(v);return s[y]||(s[y]=n.decodingInfo(v))})).then(v=>({supported:!v.some(y=>!y.supported),configurations:l,decodingInfoResults:v})).catch(v=>({supported:!1,configurations:l,decodingInfoResults:[],error:v}))}function Mi(h){var t;const n=(t=h.videoCodec)==null?void 0:t.split(","),s=gi(h),o=h.width||640,l=h.height||480,c=h.frameRate||30,p=h.videoRange.toLowerCase();return n?n.map(_=>{const m={contentType:zt(ut(_),"video"),width:o,height:l,bitrate:s,framerate:c};return p!=="sdr"&&(m.transferFunction=p),m}):[]}function ki(h,t,n){var s;const o=(s=h.audioCodec)==null?void 0:s.split(","),l=gi(h);return o&&h.audioGroups?h.audioGroups.reduce((c,p)=>{var _;const m=p?(_=t.groups[p])==null?void 0:_.tracks:null;return m?m.reduce((v,y)=>{if(y.groupId===p){const S=parseFloat(y.channels||"");o.forEach(D=>{const M={contentType:zt(D,"audio"),bitrate:n?Bi(D,l):l};S&&(M.channels=""+S),v.push(M)})}return v},c):c},[]):[]}function Bi(h,t){if(t<=1)return 1;let n=128e3;return h==="ec-3"?n=768e3:h==="ac-3"&&(n=64e4),Math.min(t/2,n)}function gi(h){return Math.ceil(Math.max(h.bitrate*.9,h.averageBitrate)/1e3)*1e3||1}function fi(h){let t="";const{audio:n,video:s}=h;if(s){const o=ii(s.contentType);t+=`${o}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(n){const o=ii(n.contentType);t+=`${s?"_":""}${o}_c${n.channels}`}return t}const Vi=["NONE","TYPE-0","TYPE-1",null];function ji(h){return Vi.indexOf(h)>-1}const en=["SDR","PQ","HLG"];function Yi(h){return!!h&&en.indexOf(h)>-1}var er={No:"",Yes:"YES",v2:"v2"};function Li(h){const{canSkipUntil:t,canSkipDateRanges:n,age:s}=h,o=s<t/2;return t&&o?n?er.v2:er.Yes:er.No}class zi{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 sn{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 Pi(this._audioGroups,t)}hasSubtitleGroup(t){return Pi(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 Pi(h,t){return!t||!h?!1:h.indexOf(t)!==-1}function bn(){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 an(h,t){let n=!1,s=[];if(h&&(n=h!=="SDR",s=[h]),t){s=t.allowedVideoRanges||en.slice(0);const o=s.join("")!=="SDR"&&!t.videoCodec;n=t.preferHDR!==void 0?t.preferHDR:o&&bn(),n||(s=["SDR"])}return{preferHDR:n,allowedVideoRanges:s}}const sr=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}},xi=(h,t)=>JSON.stringify(h,sr(t));function ur(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,D=1/0,M=1/0,U=1/0,N=0,te=[];const{preferHDR:_e,allowedVideoRanges:le}=an(t,o);for(let We=l.length;We--;){const tt=h[l[We]];v||(v=tt.channels[2]>0),S=Math.min(S,tt.minHeight),D=Math.min(D,tt.minFramerate),M=Math.min(M,tt.minBitrate),le.filter(Rt=>tt.videoRanges[Rt]>0).length>0&&(y=!0)}S=ue(S)?S:0,D=ue(D)?D:0;const Re=Math.max(1080,S),Ue=Math.max(30,D);M=ue(M)?M:n,n=Math.max(M,n),y||(t=void 0);const _t=l.length>1;return{codecSet:l.reduce((We,tt)=>{const Oe=h[tt];if(tt===We)return We;if(te=y?le.filter(Rt=>Oe.videoRanges[Rt]>0):[],_t){if(Oe.minBitrate>n)return jn(tt,`min bitrate of ${Oe.minBitrate} > current estimate of ${n}`),We;if(!Oe.hasDefaultAudio)return jn(tt,"no renditions with default or auto-select sound found"),We;if(p&&tt.indexOf(p.substring(0,4))%5!==0)return jn(tt,`audio codec preference "${p}" not found`),We;if(c&&!m){if(!Oe.channels[c])return jn(tt,`no renditions with ${c} channel sound found (channels options: ${Object.keys(Oe.channels)})`),We}else if((!p||m)&&v&&Oe.channels[2]===0)return jn(tt,"no renditions with stereo sound found"),We;if(Oe.minHeight>Re)return jn(tt,`min resolution of ${Oe.minHeight} > maximum of ${Re}`),We;if(Oe.minFramerate>Ue)return jn(tt,`min framerate of ${Oe.minFramerate} > maximum of ${Ue}`),We;if(!te.some(Rt=>Oe.videoRanges[Rt]>0))return jn(tt,`no variants with VIDEO-RANGE of ${xi(te)} found`),We;if(_&&tt.indexOf(_.substring(0,4))%5!==0)return jn(tt,`video codec preference "${_}" not found`),We;if(Oe.maxScore<N)return jn(tt,`max score of ${Oe.maxScore} < selected max of ${N}`),We}return We&&(xe(tt)>=xe(We)||Oe.fragmentError>h[We].fragmentError)?We:(U=Oe.minIndex,N=Oe.maxScore,tt)},void 0),videoRanges:te,preferHDR:_e,minFramerate:D,minBitrate:M,minIndex:U}}function jn(h,t){se.log(`[abr] start candidates with "${h}" ignored because ${t}`)}function wi(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 li(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 Pe(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 et(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(gt(h,o,n))return s}return-1}function gt(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||lt(l,t.lang))&&(l===void 0||t.assocLang===c)&&(p===void 0||t.default===p)&&(_===void 0||t.forced===_)&&(!("characteristics"in h)||At(h.characteristics||"",t.characteristics))&&(n===void 0||n(h,t))}function lt(h,t="--"){return h.length===t.length?h===t:h.startsWith(t)||t.startsWith(h)}function At(h,t=""){const n=h.split(","),s=t.split(",");return n.length===s.length&&!n.some(o=>s.indexOf(o)===-1)}function nt(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 dt(h,t,n,s,o){const l=t[s],p=t.reduce((S,D,M)=>{const U=D.uri;return(S[U]||(S[U]=[])).push(M),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=Bt(t,s,S=>{if(S.videoRange!==_||S.frameRate!==m||S.codecSet.substring(0,4)!==v)return!1;const D=S.audioGroups,M=n.filter(U=>!D||D.indexOf(U.groupId)!==-1);return et(h,M,o)>-1});return y>-1?y:Bt(t,s,S=>{const D=S.audioGroups,M=n.filter(U=>!D||D.indexOf(U.groupId)!==-1);return et(h,M,o)>-1})}function Bt(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 Zt(h,t){var n;return!!h&&h!==((n=t.loadLevelObj)==null?void 0:n.uri)}class di extends H{constructor(t){super("abr",t.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=n=>{var s;const{fragCurrent:o,partCurrent:l,hls:c}=this,{autoLevelEnabled: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,D=c.minAutoLevel,M=o.level,U=this._nextAutoLevel;if(v.aborted||v.loaded&&v.loaded===v.total||M<=D){this.clearTimer(),this._nextAutoLevel=-1;return}if(!p)return;const N=U>-1&&U!==M,te=!!n||N;if(!te&&(_.paused||!_.playbackRate||!_.readyState))return;const _e=c.mainForwardBufferInfo;if(!te&&_e===null)return;const le=this.bwEstimator.getEstimateTTFB(),Re=Math.abs(_.playbackRate);if(S<=Math.max(le,1e3*(y/(Re*2))))return;const Ue=_e?_e.len/Re:0,_t=v.loading.first?v.loading.first-v.loading.start:-1,Ne=v.loaded&&_t>-1,We=this.getBwEstimate(),tt=c.levels,Oe=tt[M],Rt=Math.max(v.loaded,Math.round(y*(o.bitrate||Oe.averageBitrate)/8));let ei=Ne?S-_t:S;ei<1&&Ne&&(ei=Math.min(S,v.loaded*8/We));const pi=Ne?v.loaded*1e3/ei:0,yi=le/1e3,vi=pi?(Rt-v.loaded)/pi:Rt*8/We+yi;if(vi<=Ue)return;const ui=pi?pi*8:We,Ui=((s=(n==null?void 0:n.details)||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,Jt=this.hls.config.abrBandWidthUpFactor;let Hi=Number.POSITIVE_INFINITY,Ni;for(Ni=M-1;Ni>D;Ni--){const mn=tt[Ni].maxBitrate,kn=!tt[Ni].details||Ui;if(Hi=this.getTimeToLoadFrag(yi,ui,y*mn,kn),Hi<Math.min(Ue,y+yi))break}if(Hi>=vi||Hi>y*10)return;Ne?this.bwEstimator.sample(S-Math.min(le,_t),v.loaded):this.bwEstimator.sampleTTFB(S);const ri=tt[Ni].maxBitrate;this.getBwEstimate()*Jt>ri&&this.resetEstimator(ri);const jt=this.findBestLevel(ri,D,Ni,0,Ue,1,1);jt>-1&&(Ni=jt),this.warn(`Fragment ${o.sn}${l?" part "+l.index:""} of level ${M} is loading too slowly;
|
|
|
Fragment duration: ${o.duration.toFixed(3)}
|
|
|
Time to underbuffer: ${Ue.toFixed(3)} s
|
|
|
Estimated load time for current fragment: ${vi.toFixed(3)} s
|
|
|
Estimated load time for down switch fragment: ${Hi.toFixed(3)} s
|
|
|
TTFB estimate: ${_t|0} ms
|
|
|
Current BW estimate: ${ue(We)?We|0:"Unknown"} bps
|
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
|
Switching to level ${Ni} @ ${ri|0} bps`),c.nextLoadLevel=c.nextAutoLevel=Ni,this.clearTimer();const hn=()=>{if(this.clearTimer(),this.fragCurrent===o&&this.hls.loadLevel===Ni&&Ni>0){const mn=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Ni>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,Ni>D){let kn=this.findBestLevel(this.hls.levels[D].bitrate,D,Ni,0,mn,1,1);kn===-1&&(kn=D),this.hls.nextLoadLevel=this.hls.nextAutoLevel=kn,this.resetEstimator(this.hls.levels[kn].bitrate)}}};N||vi>Hi*2?hn():this.timer=self.setInterval(hn,Hi*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 ie(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=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,n){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(t,n){const s=n.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var o;this.fragCurrent=s,this.partCurrent=(o=n.part)!=null?o:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(t,n){this.clearTimer()}onError(t,n){if(!n.fatal)switch(n.details){case X.BUFFER_ADD_CODEC_ERROR:case X.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case X.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 N=this.findBestLevel(_,c,o,m,0,v,y);if(N>=0)return this.rebufferNotice=-1,N}let S=p?Math.min(p,l.maxStarvationDelay):l.maxStarvationDelay;if(!m){const N=this.bitrateTestDelay;N&&(S=(p?Math.min(p,l.maxLoadingDelay):l.maxLoadingDelay)-N,this.info(`bitrate test took ${Math.round(1e3*N)}ms, set first fragment max fetchDuration to ${Math.round(1e3*S)} ms`),v=y=1)}const D=this.findBestLevel(_,c,o,m,S,v,y);if(this.rebufferNotice!==D&&(this.rebufferNotice=D,this.info(`${m?"rebuffering expected":"buffer is empty"}, optimal quality level ${D}`)),D>-1)return D;const M=s.levels[c],U=s.loadLevelObj;return U&&(M==null?void 0:M.bitrate)<U.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:D}=this,{levels:M,allAudioTracks:U,loadLevel:N,config:te}=this.hls;if(M.length===1)return 0;const _e=M[y],le=!!((_=this.hls.latestLevelDetails)!=null&&_.live),Re=N===-1||v===-1;let Ue,_t="SDR",Ne=(_e==null?void 0:_e.frameRate)||0;const{audioPreference:We,videoPreference:tt}=te,Oe=this.audioTracksByGroup||(this.audioTracksByGroup=wi(U));let Rt=-1;if(Re){if(this.firstSelection!==-1)return this.firstSelection;const Ui=this.codecTiers||(this.codecTiers=li(M,Oe,n,s)),Jt=ur(Ui,_t,t,We,tt),{codecSet:Hi,videoRanges:Ni,minFramerate:ri,minBitrate:jt,minIndex:hn,preferHDR:mn}=Jt;Rt=hn,Ue=Hi,_t=mn?Ni[Ni.length-1]:Ni[0],Ne=ri,t=Math.max(t,jt),this.log(`picked start tier ${xi(Jt)}`)}else Ue=_e==null?void 0:_e.codecSet,_t=_e==null?void 0:_e.videoRange;const ei=D?D.duration:S?S.duration:0,pi=this.bwEstimator.getEstimateTTFB()/1e3,yi=[];for(let Ui=s;Ui>=n;Ui--){var vi,ui;const Jt=M[Ui],Hi=Ui>y;if(!Jt)continue;if(te.useMediaCapabilities&&!Jt.supportedResult&&!Jt.supportedPromise){const gn=navigator.mediaCapabilities;typeof(gn==null?void 0:gn.decodingInfo)=="function"&&Dt(Jt,Oe,_t,Ne,t,We)?(Jt.supportedPromise=oi(Jt,Oe,gn,this.supportedCache),Jt.supportedPromise.then(Mn=>{if(!this.hls)return;Jt.supportedResult=Mn;const xs=this.hls.levels,Sr=xs.indexOf(Jt);Mn.error?this.warn(`MediaCapabilities decodingInfo error: "${Mn.error}" for level ${Sr} ${xi(Mn)}`):Mn.supported?Mn.decodingInfoResults.some(hs=>hs.smooth===!1||hs.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Sr} not smooth or powerEfficient: ${xi(Mn)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Sr} ${xi(Mn)}`),Sr>-1&&xs.length>1&&(this.log(`Removing unsupported level ${Sr}`),this.hls.removeLevel(Sr),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):Jt.supportedResult=mi}if((Ue&&Jt.codecSet!==Ue||_t&&Jt.videoRange!==_t||Hi&&Ne>Jt.frameRate||!Hi&&Ne>0&&Ne<Jt.frameRate||(vi=Jt.supportedResult)!=null&&(ui=vi.decodingInfoResults)!=null&&ui.some(gn=>gn.smooth===!1))&&(!Re||Ui!==Rt)){yi.push(Ui);continue}const Ni=Jt.details,ri=(D?Ni==null?void 0:Ni.partTarget:Ni==null?void 0:Ni.averagetargetduration)||ei;let jt;Hi?jt=p*t:jt=c*t;const hn=ei&&o>=ei*2&&l===0?Jt.averageBitrate:Jt.maxBitrate,mn=this.getTimeToLoadFrag(pi,jt,hn*ri,Ni===void 0);if(jt>=hn&&(Ui===v||Jt.loadError===0&&Jt.fragmentError===0)&&(mn<=pi||!ue(mn)||le&&!this.bitrateTestDelay||mn<m)){const gn=this.forcedAutoLevel;return Ui!==N&&(gn===-1||gn!==N)&&(yi.length&&this.trace(`Skipped level(s) ${yi.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${M[yi[0]].codecs}" ${M[yi[0]].videoRange}; not compatible with "${Ue}" ${_t}`),this.info(`switch candidate:${y}->${Ui} adjustedbw(${Math.round(jt)})-bitrate=${Math.round(jt-hn)} ttfb:${pi.toFixed(1)} avgDuration:${ri.toFixed(1)} maxFetchDuration:${m.toFixed(1)} fetchDuration:${mn.toFixed(1)} firstSelection:${Re} codecSet:${Jt.codecSet} videoRange:${Jt.videoRange} hls.loadLevel:${N}`)),Re&&(this.firstSelection=Ui),Ui}}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 Xi={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 _i(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(Wi(t,n,c))return c}return null}function Ai(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)&&Gi(n,s,l)===0||Oi(l,h,Math.min(o,s))))return l;const c=Xi.search(t,Gi.bind(null,n,s));return c&&(c!==h||!l)?c:l}function Oi(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 Gi(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 Wi(h,t,n){const s=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-s>h}function Si(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 Xi.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 Di(h){switch(h.details){case X.FRAG_LOAD_TIMEOUT:case X.KEY_LOAD_TIMEOUT:case X.LEVEL_LOAD_TIMEOUT:case X.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function on(h,t){const n=Di(t);return h.default[`${n?"timeout":"error"}Retry`]}function $i(h,t){const n=h.backoff==="linear"?1:Math.pow(2,t);return Math.min(n*h.retryDelayMs,h.maxRetryDelayMs)}function Ti(h){return C(C({},h),{errorRetry:null,timeoutRetry:null})}function Zi(h,t,n,s){if(!h)return!1;const o=s==null?void 0:s.code,l=t<h.maxNumRetry&&(qi(o)||!!n);return h.shouldRetry?h.shouldRetry(h,t,n,s,l):l}function qi(h){return h===0&&navigator.onLine===!1||!!h&&(h<400||h>499)}var Fi={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},un={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class dn extends H{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 X.FRAG_LOAD_ERROR:case X.FRAG_LOAD_TIMEOUT:case X.KEY_LOAD_ERROR:case X.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case X.FRAG_PARSING_ERROR:if((s=n.frag)!=null&&s.gap){n.errorAction=$n();return}case X.FRAG_GAP:case X.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=Fi.SendAlternateToPenaltyBox;return}case X.LEVEL_EMPTY_ERROR:case X.LEVEL_PARSING_ERROR:{var c,p;const m=n.parent===P.MAIN?n.level:o.loadLevel;n.details===X.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 X.LEVEL_LOAD_ERROR:case X.LEVEL_LOAD_TIMEOUT:typeof(l==null?void 0:l.level)=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,l.level));return;case X.AUDIO_TRACK_LOAD_ERROR:case X.AUDIO_TRACK_LOAD_TIMEOUT:case X.SUBTITLE_LOAD_ERROR:case X.SUBTITLE_TRACK_LOAD_TIMEOUT:if(l){const m=o.loadLevelObj;if(m&&(l.type===Ae.AUDIO_TRACK&&m.hasAudioGroup(l.groupId)||l.type===Ae.SUBTITLE_TRACK&&m.hasSubtitleGroup(l.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,o.loadLevel),n.errorAction.action=Fi.SendAlternateToPenaltyBox,n.errorAction.flags=un.MoveAllAlternatesMatchingHost;return}}return;case X.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const m=o.loadLevelObj,v=m==null?void 0:m.attrs["HDCP-LEVEL"];v?n.errorAction={action:Fi.SendAlternateToPenaltyBox,flags:un.MoveAllAlternatesMatchingHDCP,hdcpLevel:v}:this.keySystemError(n)}return;case X.BUFFER_ADD_CODEC_ERROR:case X.REMUX_ALLOC_ERROR:case X.BUFFER_APPEND_ERROR:if(!n.errorAction){var _;n.errorAction=this.getLevelSwitchAction(n,(_=n.level)!=null?_:o.loadLevel)}return;case X.INTERNAL_EXCEPTION:case X.BUFFER_APPENDING_ERROR:case X.BUFFER_FULL_ERROR:case X.LEVEL_SWITCH_ERROR:case X.BUFFER_STALLED_ERROR:case X.BUFFER_SEEK_OVER_HOLE:case X.BUFFER_NUDGE_ON_STALL:n.errorAction=$n();return}n.type===pe.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=on(s.config.playlistLoadPolicy,t),l=this.playlistError++;if(Zi(o,l,Di(t),t.response))return{action:Fi.RetryRequest,flags:un.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=on(t.details.startsWith("key")?c:l,t),_=n.levels.reduce((v,y)=>v+y.fragmentError,0);if(o&&(t.details!==X.FRAG_GAP&&o.fragmentError++,Zi(p,_,Di(t),t.response)))return{action:Fi.RetryRequest,flags:un.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===X.BUFFER_APPEND_ERROR&&o.fragmentError++;let v=-1;const{levels:y,loadLevel:S,minAutoLevel:D,maxAutoLevel:M}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const U=(l=t.frag)==null?void 0:l.type,te=(U===P.AUDIO&&m===X.FRAG_PARSING_ERROR||t.sourceBufferName==="audio"&&(m===X.BUFFER_ADD_CODEC_ERROR||m===X.BUFFER_APPEND_ERROR))&&y.some(({audioCodec:_t})=>o.audioCodec!==_t),le=t.sourceBufferName==="video"&&(m===X.BUFFER_ADD_CODEC_ERROR||m===X.BUFFER_APPEND_ERROR)&&y.some(({codecSet:_t,audioCodec:Ne})=>o.codecSet!==_t&&o.audioCodec===Ne),{type:Re,groupId:Ue}=(c=t.context)!=null?c:{};for(let _t=y.length;_t--;){const Ne=(_t+S)%y.length;if(Ne!==S&&Ne>=D&&Ne<=M&&y[Ne].loadError===0){var p,_;const We=y[Ne];if(m===X.FRAG_GAP&&U===P.MAIN&&t.frag){const tt=y[Ne].details;if(tt){const Oe=Ai(t.frag,tt.fragments,t.frag.start);if(Oe!=null&&Oe.gap)continue}}else{if(Re===Ae.AUDIO_TRACK&&We.hasAudioGroup(Ue)||Re===Ae.SUBTITLE_TRACK&&We.hasSubtitleGroup(Ue))continue;if(U===P.AUDIO&&(p=o.audioGroups)!=null&&p.some(tt=>We.hasAudioGroup(tt))||U===P.SUBTITLE&&(_=o.subtitleGroups)!=null&&_.some(tt=>We.hasSubtitleGroup(tt))||te&&o.audioCodec===We.audioCodec||!te&&o.audioCodec!==We.audioCodec||le&&o.codecSet===We.codecSet)continue}v=Ne;break}}if(v>-1&&s.loadLevel!==v)return t.levelRetry=!0,this.playlistError=0,{action:Fi.SendAlternateToPenaltyBox,flags:un.None,nextAutoLevel:v}}return{action:Fi.SendAlternateToPenaltyBox,flags:un.MoveAllAlternatesMatchingHost}}onErrorOut(t,n){var s;switch((s=n.errorAction)==null?void 0:s.action){case Fi.DoNothing:break;case Fi.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==X.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 Fi.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 un.None:this.switchLevel(t,c);break;case un.MoveAllAlternatesMatchingHDCP:l&&(n.maxHdcpLevel=Vi[Vi.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===X.BUFFER_ADD_CODEC_ERROR&&t.mimeType&&t.sourceBufferName!=="audiovideo")){const s=ii(t.mimeType),o=this.hls.levels;for(let l=o.length;l--;)o[l][`${t.sourceBufferName}Codec`]===s&&this.hls.removeLevel(l)}}}function $n(h){const t={action:Fi.DoNothing,flags:un.None};return h&&(t.resolved=!0),t}var Ki={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Rn{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=vn(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),qn(l)||this.removeParts(s.sn-1,s.type)):this.removeFragment(l.body)}removeParts(t,n){const s=this.activePartLists[n];s&&(this.activePartLists[n]=pn(s,o=>o.fragment.sn>=t))}fragBuffered(t,n){const s=vn(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 D=Math.max(c,o.start(v)),M=Math.min(p,o.end(v));M>D&&(l.partial=!0,l.time.push({startPTS:D,endPTS:M}))}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&&qn(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||qn(n))}getState(t){const n=vn(t),s=this.fragments[n];return s?s.buffered?qn(s)?Ki.PARTIAL:Ki.OK:Ki.APPENDING:Ki.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=vn(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=vn(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=vn(t);t.clearElementaryStreamInfo();const s=this.activePartLists[t.type];if(s){const o=t.sn;this.activePartLists[t.type]=pn(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 qn(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 vn(h){return`${h.type}_${h.level}_${h.sn}`}function pn(h,t){return h.filter(n=>{const s=t(n);return s||n.clearElementaryStreamInfo(),s})}var cn={cbc:0,ctr:1};class Kn{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 cn.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,t);case cn.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 yr(h){const t=h.byteLength,n=t&&new DataView(h.buffer).getUint8(t-1);return n?h.slice(0,t-n):h}class xn{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],D=new Uint32Array(256);let M=0,U=0,N=0;for(N=0;N<256;N++)N<128?D[N]=N<<1:D[N]=N<<1^283;for(N=0;N<256;N++){let te=U^U<<1^U<<2^U<<3^U<<4;te=te>>>8^te&255^99,t[M]=te,n[te]=M;const _e=D[M],le=D[_e],Re=D[le];let Ue=D[te]*257^te*16843008;o[M]=Ue<<24|Ue>>>8,l[M]=Ue<<16|Ue>>>16,c[M]=Ue<<8|Ue>>>24,p[M]=Ue,Ue=Re*16843009^le*65537^_e*257^M*16843008,m[te]=Ue<<24|Ue>>>8,v[te]=Ue<<16|Ue>>>16,y[te]=Ue<<8|Ue>>>24,S[te]=Ue,M?(M=_e^D[D[D[Re^_e]]],U^=D[D[U]]):M=U=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,D=this.invSubMix,M=D[0],U=D[1],N=D[2],te=D[3];let _e,le;for(p=0;p<c;p++){if(p<l){_e=m[p]=n[p];continue}le=_e,p%l===0?(le=le<<8|le>>>24,le=y[le>>>24]<<24|y[le>>>16&255]<<16|y[le>>>8&255]<<8|y[le&255],le^=S[p/l|0]<<24):l>6&&p%l===4&&(le=y[le>>>24]<<24|y[le>>>16&255]<<16|y[le>>>8&255]<<8|y[le&255]),m[p]=_e=(m[p-l]^le)>>>0}for(_=0;_<c;_++)p=c-_,_&3?le=m[p]:le=m[p-4],_<4||p<=4?v[_]=le:v[_]=M[y[le>>>24]]^U[y[le>>>16&255]]^N[y[le>>>8&255]]^te[y[le&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 D=S[0],M=S[1],U=S[2],N=S[3];const te=new Int32Array(t),_e=new Int32Array(te.length);let le,Re,Ue,_t,Ne,We,tt,Oe,Rt,ei,pi,yi,vi,ui;const Ui=this.networkToHostOrderSwap;for(;n<te.length;){for(Rt=Ui(te[n]),ei=Ui(te[n+1]),pi=Ui(te[n+2]),yi=Ui(te[n+3]),Ne=Rt^l[0],We=yi^l[1],tt=pi^l[2],Oe=ei^l[3],vi=4,ui=1;ui<o;ui++)le=_[Ne>>>24]^m[We>>16&255]^v[tt>>8&255]^y[Oe&255]^l[vi],Re=_[We>>>24]^m[tt>>16&255]^v[Oe>>8&255]^y[Ne&255]^l[vi+1],Ue=_[tt>>>24]^m[Oe>>16&255]^v[Ne>>8&255]^y[We&255]^l[vi+2],_t=_[Oe>>>24]^m[Ne>>16&255]^v[We>>8&255]^y[tt&255]^l[vi+3],Ne=le,We=Re,tt=Ue,Oe=_t,vi=vi+4;le=c[Ne>>>24]<<24^c[We>>16&255]<<16^c[tt>>8&255]<<8^c[Oe&255]^l[vi],Re=c[We>>>24]<<24^c[tt>>16&255]<<16^c[Oe>>8&255]<<8^c[Ne&255]^l[vi+1],Ue=c[tt>>>24]<<24^c[Oe>>16&255]<<16^c[Ne>>8&255]<<8^c[We&255]^l[vi+2],_t=c[Oe>>>24]<<24^c[Ne>>16&255]<<16^c[We>>8&255]<<8^c[tt&255]^l[vi+3],_e[n]=Ui(le^D),_e[n+1]=Ui(_t^M),_e[n+2]=Ui(Ue^U),_e[n+3]=Ui(Re^N),D=Rt,M=ei,U=pi,N=yi,n=n+4}return _e.buffer}}class Ln{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=dr(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}function dr(h){switch(h){case cn.cbc:return"AES-CBC";case cn.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${h}`)}}const Rr=16;class ar{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?yr(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!==cn.cbc||n.byteLength!==16)return se.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),p&&(t=xt(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 xn),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 Ln(this.subtle,n,o)}return this.fastAesKey.expandKey().then(l=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Kn(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%Rr;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 Lr=Math.pow(2,17);class Dn{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 Un({type:pe.NETWORK_ERROR,details:X.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(M=>M[0]==="GAP")){_(Er(t));return}else t.gap=!1;const m=this.loader=l?new l(o):new c(o),v=tr(t);t.loader=m;const y=Ti(o.fragLoadPolicy.default),S={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:t.sn==="initSegment"?1/0:Lr};t.stats=m.stats;const D={onSuccess:(M,U,N,te)=>{this.resetLoader(t,m);let _e=M.data;N.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(_e.slice(0,16)),_e=_e.slice(16)),p({frag:t,part:null,payload:_e,networkDetails:te})},onError:(M,U,N,te)=>{this.resetLoader(t,m),_(new Un({type:pe.NETWORK_ERROR,details:X.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:C({url:s,data:void 0},M),error:new Error(`HTTP Error ${M.code} ${M.text}`),networkDetails:N,stats:te}))},onAbort:(M,U,N)=>{this.resetLoader(t,m),_(new Un({type:pe.NETWORK_ERROR,details:X.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:N,stats:M}))},onTimeout:(M,U,N)=>{this.resetLoader(t,m),_(new Un({type:pe.NETWORK_ERROR,details:X.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${S.timeout}ms`),networkDetails:N,stats:M}))}};n&&(D.onProgress=(M,U,N,te)=>n({frag:t,part:null,payload:N,networkDetails:te})),m.load(v,S,D)})}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){_(Er(t,n));return}const m=this.loader=l?new l(o):new c(o),v=tr(t,n);t.loader=m;const y=Ti(o.fragLoadPolicy.default),S={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Lr};n.stats=m.stats,m.load(v,S,{onSuccess:(D,M,U,N)=>{this.resetLoader(t,m),this.updateStatsFromPart(t,n);const te={frag:t,part:n,payload:D.data,networkDetails:N};s(te),p(te)},onError:(D,M,U,N)=>{this.resetLoader(t,m),_(new Un({type:pe.NETWORK_ERROR,details:X.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:n,response:C({url:v.url,data:void 0},D),error:new Error(`HTTP Error ${D.code} ${D.text}`),networkDetails:U,stats:N}))},onAbort:(D,M,U)=>{t.stats.aborted=n.stats.aborted,this.resetLoader(t,m),_(new Un({type:pe.NETWORK_ERROR,details:X.INTERNAL_ABORTED,fatal:!1,frag:t,part:n,error:new Error("Aborted"),networkDetails:U,stats:D}))},onTimeout:(D,M,U)=>{this.resetLoader(t,m),_(new Un({type:pe.NETWORK_ERROR,details:X.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:n,error:new Error(`Timeout after ${S.timeout}ms`),networkDetails:U,stats:D}))}})})}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 tr(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"&&kr((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 Er(h,t){const n=new Error(`GAP ${h.gap?"tag":"attribute"} found`),s={type:pe.MEDIA_ERROR,details:X.FRAG_GAP,fatal:!1,frag:h,error:n,networkDetails:null};return t&&(s.part=t),(t||h).stats.aborted=!0,new Un(s)}function kr(h){return h==="AES-128"||h==="AES-256"}class Un extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class In extends H{constructor(t,n){super(t,n),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(t){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class or{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=cr(),this.buffering={audio:cr(),video:cr(),audiovideo:cr()},this.level=t,this.sn=n,this.id=s,this.size=o,this.part=l,this.partial=c}}function cr(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Ir={length:0,start:()=>0,end:()=>0};class si{static isBuffered(t,n){if(t){const s=si.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=si.getBuffered(t);return si.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=si.bufferedRanges(t);if(o.length)return si.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||Ir}catch(n){return se.log("failed to get media.buffered",n),Ir}}}const hr=/\{\$([a-zA-Z0-9-_]+)\}/g;function br(h){return hr.test(h)}function lr(h,t){if(h.variableList!==null||h.hasVariableRefs){const n=h.variableList;return t.replace(hr,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 tn(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 Ei=/^(\d+)x(\d+)$/,nn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ri{constructor(t,n){typeof t=="string"&&(t=Ri.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=Ei.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(nn.lastIndex=0;(s=nn.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=lr(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 mr="com.apple.hls.interstitial";function Zn(h){return h!=="ID"&&h!=="CLASS"&&h!=="CUE"&&h!=="START-DATE"&&h!=="DURATION"&&h!=="END-DATE"&&h!=="END-ON-NEXT"}function fr(h){return h==="SCTE35-OUT"||h==="SCTE35-IN"||h==="SCTE35-CMD"}class Pn{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 Ri({}),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===mr}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 os=10;class Tr{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||os}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 Pr(h){return h==="AES-128"||h==="AES-256"||h==="AES-256-CTR"}function Wr(h){switch(h){case"AES-128":case"AES-256":return cn.cbc;case"AES-256-CTR":return cn.ctr;default:throw new Error(`invalid full segment method ${h}`)}}function jr(h){return Uint8Array.from(atob(h),t=>t.charCodeAt(0))}function Yn(h){return Uint8Array.from(unescape(encodeURIComponent(h)),t=>t.charCodeAt(0))}function qr(h){const t=Yn(h).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}function ds(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 gr(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=jr(c)):n=qr(c)}}return n}const On=typeof self!="undefined"?self:void 0;var Ji={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},yn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Qr(h){switch(h){case yn.FAIRPLAY:return Ji.FAIRPLAY;case yn.PLAYREADY:return Ji.PLAYREADY;case yn.WIDEVINE:return Ji.WIDEVINE;case yn.CLEARKEY:return Ji.CLEARKEY}}function ls(h){switch(h){case Ji.FAIRPLAY:return yn.FAIRPLAY;case Ji.PLAYREADY:return yn.PLAYREADY;case Ji.WIDEVINE:return yn.WIDEVINE;case Ji.CLEARKEY:return yn.CLEARKEY}}function Es(h){const{drmSystems:t,widevineLicenseUrl:n}=h,s=t?[Ji.FAIRPLAY,Ji.WIDEVINE,Ji.PLAYREADY,Ji.CLEARKEY].filter(o=>!!t[o]):[];return!s[Ji.WIDEVINE]&&n&&s.push(Ji.WIDEVINE),s}const ta=function(h){return On!=null&&(h=On.navigator)!=null&&h.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Us(h,t,n,s){let o;switch(h){case Ji.FAIRPLAY:o=["cenc","sinf"];break;case Ji.WIDEVINE:case Ji.PLAYREADY:o=["cenc"];break;case Ji.CLEARKEY:o=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${h}`)}return xa(o,t,n,s)}function xa(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 ci(h){var t;return h.sessionType==="persistent-license"||!!((t=h.sessionTypes)!=null&&t.some(n=>n==="persistent-license"))}function Ii(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 _=jr(p).subarray(0,16);return ds(_),_}}return null}let wn={};class Gn{static clearKeyUriToKeyIdMap(){wn={}}constructor(t,n,s,o=[1],l=null,c){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=n,this.keyFormat=s,this.keyFormatVersions=o,this.iv=l,this.encrypted=t?t!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Pr(t),c!=null&&c.startsWith("0x")&&(this.keyId=new Uint8Array(z(c)))}matches(t){var n,s;return t.uri===this.uri&&t.method===this.method&&t.encrypted===this.encrypted&&t.keyFormat===this.keyFormat&&t.keyFormatVersions.join(",")===this.keyFormatVersions.join(",")&&((n=t.iv)==null?void 0:n.join(","))===((s=this.iv)==null?void 0:s.join(","))}isSupported(){if(this.method){if(Pr(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case yn.FAIRPLAY:case yn.WIDEVINE:case yn.PLAYREADY:case yn.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(Pr(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=Sn(t);return new Gn(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.pssh&&this.keyId)return this;const n=gr(this.uri);if(n)switch(this.keyFormat){case yn.WIDEVINE:if(this.pssh=n,!this.keyId&&n.length>=22){const s=n.length-22;this.keyId=n.subarray(s,s+16)}break;case yn.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=Ii(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=wn[this.uri];if(!s){const o=Object.keys(wn).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,o),wn[this.uri]=s}this.keyId=s}return this}}function Sn(h){const t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=h>>8*(15-n)&255;return t}const es=/#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,ir=/#EXT-X-MEDIA:(.*)/g,ks=/^#EXT(?:INF|-X-TARGETDURATION):/m,Zr=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),wa=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 ps{static findGroup(t,n){for(let s=0;s<t.length;s++){const o=t[s];if(o.id===n)return o}}static resolve(t,n){return A.buildAbsoluteURL(n,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return ks.test(t)}static parseMasterPlaylist(t,n){const s=br(t),o={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},l=[];es.lastIndex=0;let c;for(;(c=es.exec(t))!=null;)if(c[1]){var p;const m=new Ri(c[1],o),v=lr(o,c[2]),y={attrs:m,bitrate:m.decimalInteger("BANDWIDTH")||m.decimalInteger("AVERAGE-BANDWIDTH"),name:m.NAME,url:ps.resolve(v,n)},S=m.decimalResolution("RESOLUTION");S&&(y.width=S.width,y.height=S.height),ia(m.CODECS,y);const D=m["SUPPLEMENTAL-CODECS"];D&&(y.supplemental={},ia(D,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 Ri(v,o),S=y["DATA-ID"];S&&(o.sessionData===null&&(o.sessionData={}),o.sessionData[S]=y);break}case"SESSION-KEY":{const y=Ea(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 Ri(v,o);Hr(o,y,n)}break}case"CONTENT-STEERING":{const y=new Ri(v,o);o.contentSteering={uri:ps.resolve(y["SERVER-URI"],n),pathwayId:y["PATHWAY-ID"]||"."};break}case"START":{o.startTimeOffset=nr(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(ir.lastIndex=0;(o=ir.exec(t))!==null;){const m=new Ri(o[1],s),v=m.TYPE;if(v){const y=p[v],S=l[v]||[];l[v]=S;const D=m.LANGUAGE,M=m["ASSOC-LANGUAGE"],U=m.CHANNELS,N=m.CHARACTERISTICS,te=m["INSTREAM-ID"],_e={attrs:m,bitrate:0,id:_++,groupId:m["GROUP-ID"]||"",name:m.NAME||D||"",type:v,default:m.bool("DEFAULT"),autoselect:m.bool("AUTOSELECT"),forced:m.bool("FORCED"),lang:D,url:m.URI?ps.resolve(m.URI,n):""};if(M&&(_e.assocLang=M),U&&(_e.channels=U),N&&(_e.characteristics=N),te&&(_e.instreamId=te),y!=null&&y.length){const le=ps.findGroup(y,_e.groupId)||y[0];ka(_e,le,"audioCodec"),ka(_e,le,"textCodec")}S.push(_e)}}return l}static parseLevelPlaylist(t,n,s,o,l,c){var p;const _={url:n},m=new Tr(n),v=m.fragments,y=[];let S=null,D=0,M=0,U=0,N=0,te=0,_e=null,le=new pt(o,_),Re,Ue,_t,Ne=-1,We=!1,tt=null,Oe;if(Zr.lastIndex=0,m.m3u8=t,m.hasVariableRefs=br(t),((p=Zr.exec(t))==null?void 0:p[0])!=="#EXTM3U")return m.playlistParsingError=new Error("Missing format identifier #EXTM3U"),m;for(;(Re=Zr.exec(t))!==null;){We&&(We=!1,le=new pt(o,_),le.playlistOffset=U,le.start=U,le.sn=D,le.cc=N,te&&(le.bitrate=te),le.level=s,S&&(le.initSegment=S,S.rawProgramDateTime&&(le.rawProgramDateTime=S.rawProgramDateTime,S.rawProgramDateTime=null),tt&&(le.setByteRange(tt),tt=null)));const yi=Re[1];if(yi){le.duration=parseFloat(yi);const vi=(" "+Re[2]).slice(1);le.title=vi||null,le.tagList.push(vi?["INF",yi,vi]:["INF",yi])}else if(Re[3]){if(ue(le.duration)){le.playlistOffset=U,le.start=U,_t&&ts(le,_t,m),le.sn=D,le.level=s,le.cc=N,v.push(le);const vi=(" "+Re[3]).slice(1);le.relurl=lr(m,vi),qa(le,_e,y),_e=le,U+=le.duration,D++,M=0,We=!0}}else{if(Re=Re[0].match(wa),!Re){se.warn("No matches on slow regex match for level playlist!");continue}for(Ue=1;Ue<Re.length&&Re[Ue]===void 0;Ue++);const vi=(" "+Re[Ue]).slice(1),ui=(" "+Re[Ue+1]).slice(1),Ui=Re[Ue+2]?(" "+Re[Ue+2]).slice(1):null;switch(vi){case"BYTERANGE":_e?le.setByteRange(ui,_e):le.setByteRange(ui);break;case"PROGRAM-DATE-TIME":le.rawProgramDateTime=ui,le.tagList.push(["PROGRAM-DATE-TIME",ui]),Ne===-1&&(Ne=v.length);break;case"PLAYLIST-TYPE":m.type&&gs(m,vi,Re),m.type=ui.toUpperCase();break;case"MEDIA-SEQUENCE":m.startSN!==0?gs(m,vi,Re):v.length>0&&Jo(m,vi,Re),D=m.startSN=parseInt(ui);break;case"SKIP":{m.skippedSegments&&gs(m,vi,Re);const Jt=new Ri(ui,m),Hi=Jt.decimalInteger("SKIPPED-SEGMENTS");if(ue(Hi)){m.skippedSegments+=Hi;for(let ri=Hi;ri--;)v.push(null);D+=Hi}const Ni=Jt.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ni&&(m.recentlyRemovedDateranges=(m.recentlyRemovedDateranges||[]).concat(Ni.split(" ")));break}case"TARGETDURATION":m.targetduration!==0&&gs(m,vi,Re),m.targetduration=Math.max(parseInt(ui),1);break;case"VERSION":m.version!==null&&gs(m,vi,Re),m.version=parseInt(ui);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":m.live||gs(m,vi,Re),m.live=!1;break;case"#":(ui||Ui)&&le.tagList.push(Ui?[ui,Ui]:[ui]);break;case"DISCONTINUITY":N++,le.tagList.push(["DIS"]);break;case"GAP":le.gap=!0,le.tagList.push([vi]);break;case"BITRATE":le.tagList.push([vi,ui]),te=parseInt(ui)*1e3,ue(te)?le.bitrate=te:te=0;break;case"DATERANGE":{const Jt=new Ri(ui,m),Hi=new Pn(Jt,m.dateRanges[Jt.ID],m.dateRangeTagCount);m.dateRangeTagCount++,Hi.isValid||m.skippedSegments?m.dateRanges[Hi.id]=Hi:se.warn(`Ignoring invalid DATERANGE tag: "${ui}"`),le.tagList.push(["EXT-X-DATERANGE",ui]);break}case"DEFINE":{{const Jt=new Ri(ui,m);"IMPORT"in Jt?tn(m,Jt,c):Hr(m,Jt,n)}break}case"DISCONTINUITY-SEQUENCE":m.startCC!==0?gs(m,vi,Re):v.length>0&&Jo(m,vi,Re),m.startCC=N=parseInt(ui);break;case"KEY":{const Jt=Ea(ui,n,m);if(Jt.isSupported()){if(Jt.method==="NONE"){_t=void 0;break}_t||(_t={});const Hi=_t[Jt.keyFormat];Hi!=null&&Hi.matches(Jt)||(Hi&&(_t=k({},_t)),_t[Jt.keyFormat]=Jt)}else se.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${ui}"`);break}case"START":m.startTimeOffset=nr(ui);break;case"MAP":{const Jt=new Ri(ui,m);if(le.duration){const Hi=new pt(o,_);Eo(Hi,Jt,s,_t),S=Hi,le.initSegment=S,S.rawProgramDateTime&&!le.rawProgramDateTime&&(le.rawProgramDateTime=S.rawProgramDateTime)}else{const Hi=le.byteRangeEndOffset;if(Hi){const Ni=le.byteRangeStartOffset;tt=`${Hi-Ni}@${Ni}`}else tt=null;Eo(le,Jt,s,_t),S=le,We=!0}S.cc=N;break}case"SERVER-CONTROL":{Oe&&gs(m,vi,Re),Oe=new Ri(ui),m.canBlockReload=Oe.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Oe.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Oe.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Oe.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Oe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{m.partTarget&&gs(m,vi,Re);const Jt=new Ri(ui);m.partTarget=Jt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Jt=m.partList;Jt||(Jt=m.partList=[]);const Hi=M>0?Jt[Jt.length-1]:void 0,Ni=M++,ri=new Ri(ui,m),jt=new Ut(ri,le,_,Ni,Hi);Jt.push(jt),le.duration+=jt.duration;break}case"PRELOAD-HINT":{const Jt=new Ri(ui,m);m.preloadHint=Jt;break}case"RENDITION-REPORT":{const Jt=new Ri(ui,m);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Jt);break}default:se.warn(`line parsed but not handled: ${Re}`);break}}}_e&&!_e.relurl?(v.pop(),U-=_e.duration,m.partList&&(m.fragmentHint=_e)):m.partList&&(qa(le,_e,y),le.cc=N,m.fragmentHint=le,_t&&ts(le,_t,m)),m.targetduration||(m.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Rt=v.length,ei=v[0],pi=v[Rt-1];if(U+=m.skippedSegments*m.targetduration,U>0&&Rt&&pi){m.averagetargetduration=U/Rt;const yi=pi.sn;m.endSN=yi!=="initSegment"?yi:0,m.live||(pi.endList=!0),ei&&m.startCC===void 0&&(m.startCC=ei.cc),Ne>0&&(ms(v,Ne),ei&&y.unshift(ei))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(U+=m.fragmentHint.duration),m.totalduration=U,y.length&&m.dateRangeTagCount&&ei&&Sa(y,m),m.endCC=N,m}}function Sa(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=Is(t,_,h,m,o);if(v!==-1){p.tagAnchor=t.fragments[v].ref;break}}}}function Is(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 D=S;D>m;D--){const M=v[D].programDateTime;if(t>=M&&t<M+v[D].duration*1e3)return D}}return m}}}return-1}function Ea(h,t,n){var s,o;const l=new Ri(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?ps.resolve(p,t):"",S=(m||"1").split("/").map(Number).filter(Number.isFinite);return new Gn(c,y,v,S,_,l.KEYID)}function nr(h){const n=new Ri(h).decimalFloatingPoint("TIME-OFFSET");return ue(n)?n:null}function ia(h,t){let n=(h||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const o=n.filter(l=>Nt(l,s));o.length&&(t[`${s}Codec`]=o.map(l=>l.split("/")[0]).join(","),n=n.filter(l=>o.indexOf(l)===-1))}),t.unknownCodecs=n}function ka(h,t,n){const s=t[n];s&&(h[n]=s)}function ms(h,t){let n=h[t];for(let s=t;s--;){const o=h[s];if(!o)return;o.programDateTime=n.programDateTime-o.duration*1e3,n=o}}function qa(h,t,n){h.rawProgramDateTime?n.push(h):t!=null&&t.programDateTime&&(h.programDateTime=t.endProgramDateTime)}function Eo(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 ts(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 gs(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function Jo(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function Za(h,t){const n=t.startPTS;if(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 Qo(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 N=Math.abs(m-n);ue(t.deltaPTS)?t.deltaPTS=Math.max(N,t.deltaPTS):t.deltaPTS=N,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 D;const M=S-h.startSN,U=h.fragments;for(U[M]=t,D=M;D>0;D--)Za(U[D],U[D-1]);for(D=M;D<U.length-1;D++)Za(U[D],U[D+1]);return h.fragmentHint&&Za(U[U.length-1],h.fragmentHint),h.PTSKnown=h.alignedSliding=!0,y}function Vl(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;tl(h,t,(m,v,y,S)=>{if((!t.startCC||t.skippedSegments)&&v.cc!==m.cc){const D=m.cc-v.cc;for(let M=y;M<S.length;M++)S[M].cc+=D;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=el(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&&qa(c[v],c[v-1],m);Sa(m,t)}t.endCC=l[l.length-1].cc}if(!t.startCC){var p;const m=il(h,t.startSN-1);t.startCC=(p=m==null?void 0:m.cc)!=null?p:l[0].cc}Ya(h.partList,t.partList,(m,v)=>{v.elementaryStreams=m.elementaryStreams,v.stats=m.stats}),o?Qo(t,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS):Xa(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 el(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 Pn(n[p].attr,_);m.isValid?(o[p]=m,_||(m.tagOrder+=c)):se.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${xi(n[p].attr)}"`)}),o}function Ya(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 tl(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=Ts(`media sequence mismatch ${y.sn}:`,h,t,v,y);return}else if(v.cc!==y.cc){t.playlistParsingError=Ts(`discontinuity sequence mismatch (${v.cc}!=${y.cc})`,h,t,v,y);return}}}}function Ts(h,t,n,s,o){return new Error(`${h} ${o.url}
|
|
|
Playlist starting @${t.startSN}
|
|
|
${t.m3u8}
|
|
|
|
|
|
Playlist starting @${n.startSN}
|
|
|
${n.m3u8}`)}function Xa(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;Ja(t,c)}function Ja(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 ko(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 il(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 To(h,t,n){return h?na(h.partList,t,n):null}function na(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 nl(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 _s(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 Ao(h,t){return!!(h&&t.startCC<h.endCC&&t.endCC>h.startCC)}function Lo(h,t){if(h){const n=h.start+t;h.start=h.startPTS=n,h.endPTS=n+h.duration}}function rl(h,t){const n=t.fragments;for(let s=0,o=n.length;s<o;s++)Lo(n[s],h);t.fragmentHint&&Lo(t.fragmentHint,h),t.alignedSliding=!0}function zs(h,t){h&&(Qa(t,h),!t.alignedSliding&&h&&ra(t,h),!t.alignedSliding&&h&&!t.skippedSegments&&Xa(h,t,!1))}function Qa(h,t){if(!Ao(t,h))return;const n=Math.min(t.endCC,h.endCC),s=_s(t.fragments,n),o=_s(h.fragments,n);if(!s||!o)return;se.log(`Aligning playlist at start of dicontinuity sequence ${n}`);const l=s.start-o.start;rl(l,h)}function ra(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=_s(s,c),l=_s(n,c)),(!o||!l)&&(o=s[Math.floor(s.length/2)],l=_s(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);rl(m,h)}const Gl={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}},st={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 Cn extends In{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=st.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=si.bufferInfo(m||_,y,c.maxBufferHole),D=!S.len;if(this.log(`Media seeking to ${ue(y)?y.toFixed(3):y}, state: ${v}, ${D?"out of":"in"} buffer`),this.state===st.ENDED)this.resetLoadingState();else if(p){const M=c.maxFragLookUpTolerance,U=p.start-M,N=p.start+p.duration+M;if(D||N<S.start||U>S.end){const te=y>N;(y<U||te)&&(te&&p.loader&&(this.log(`Cancelling fragment load for seek (sn: ${p.sn})`),p.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(_){this.fragmentTracker.removeFragmentsInRange(y,1/0,this.playlistType,!0);const M=this.lastCurrentTime;if(y>M&&(this.lastCurrentTime=y),!this.loadingParts){const U=Math.max(S.end,y),N=this.shouldLoadParts(this.getLevelDetails(),U);N&&(this.log(`LL-Part loading ON after seeking to ${y.toFixed(2)} with buffer @${U.toFixed(2)}`),this.loadingParts=N)}}this.hls.hasEnoughToStart||(this.log(`Setting ${D?"startPosition":"nextLoadPosition"} to ${y} for seek without enough to start`),this.nextLoadPosition=y,D&&(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 Dn(t.config),this.keyLoader=s,this.fragmentTracker=n,this.config=t.config,this.decrypter=new ar(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===st.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=st.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=si.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 si.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===st.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=st.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===st.FRAG_LOADING||!this.fragCurrent&&c===st.PARSING)&&(this.fragmentTracker.removeFragment(p),this.state=st.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===st.STOPPED||this.state===st.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)===Ki.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)===Ki.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&&Pr(p.method)){const _=self.performance.now();return this.decrypter.decrypt(new Uint8Array(c),p.key.buffer,p.iv.buffer,Wr(p.method)).catch(m=>{throw o.trigger(w.ERROR,{type:pe.MEDIA_ERROR,details:X.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===st.STOPPED||this.state===st.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!==st.STOPPED&&(this.state=st.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?Gl.toString(si.getBuffered(s)):"(detached)"})`),ze(t)){var o;if(t.type!==P.SUBTITLE){const c=t.elementaryStreams;if(!Object.keys(c).some(p=>!!c[p])){this.state=st.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=st.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 or(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=st.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===st.KEY_LOADING&&(this.state=st.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,this.startFragRequested),p&&this.log("[eme] blocking frag load until media-keys acquired"));const _=this.fragPrevious;if(ze(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&&ze(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 D=y[S];t=this.fragCurrent=D.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${D.index} (${S}/${y.length-1}) of ${this.fragInfo(t,!1,D)}) cc: ${t.cc} [${c.startSN}-${c.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=D.start+D.duration,this.state=st.FRAG_LOADING;let M;return p?M=p.then(U=>!U||this.fragContextChanged(U.frag)?null:this.doFragPartsLoad(t,D,n,o)).catch(U=>this.handleFragLoadError(U)):M=this.doFragPartsLoad(t,D,n,o).catch(U=>this.handleFragLoadError(U)),this.hls.trigger(w.FRAG_LOADING,{frag:t,part:D,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):M}else if(!t.url||this.loadedEndOfParts(y,s))return Promise.resolve(null)}}if(ze(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=st.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 D=S.part;this.hls.trigger(w.FRAG_LOADED,S);const M=To(s.details,t.sn,y.index+1)||na(m,t.sn,y.index+1);if(M)v(M);else return l({frag:t,part:D,partsLoaded:_})}).catch(c)};v(n)})}handleFragLoadError(t){if("data"in t){const n=t.data;t.data&&n.details===X.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):this.hls.trigger(w.ERROR,n)}else this.hls.trigger(w.ERROR,{type:pe.OTHER_ERROR,details:X.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const n=this.getCurrentContext(t);if(!n||this.state!==st.PARSING){!this.fragCurrent&&this.state!==st.STOPPED&&this.state!==st.ERROR&&(this.state=st.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?To(_,l,c):null,v=m?m.fragment:il(_,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!==st.PARSING)return;const{data1:p,data2:_}=t;let m=p;if(p&&_&&(m=xt(p,_)),!((c=m)!=null&&c.length))return;const v=this.initPTS[n.cc],y=v?-v.baseTime/v.timescale:void 0,S={type:t.type,frag:n,part:s,chunkMeta:o,offset:y,parent:n.type,data:m};if(this.hls.trigger(w.BUFFER_APPENDING,S),t.dropped&&t.independent&&!s){if(l)return;this.flushBufferGap(n)}}flushBufferGap(t){const n=this.media;if(!n)return;if(!si.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,t.start);return}const s=n.currentTime,o=si.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=si.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 si.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,D=this.hls.liveSyncPosition,M=_?(S!==-1&&S>=c?S:D)||_.start:t;this.log(`Setting startPosition to ${M} to match start frag at live edge. mainStart: ${S} liveSyncPosition: ${D} frag.start: ${(m=_)==null?void 0:m.start}`),this.startPosition=this.nextLoadPosition=M}}else t<=c&&(_=s[0]);if(!_){const y=this.loadingParts?n.partEnd:n.fragmentEnd;_=this.getFragmentAtPosition(t,y,n)}let v=this.filterReplacedPrimary(_,n);if(!v&&_){const y=_.sn-n.startSN;v=this.filterReplacedPrimary(s[y+1]||null,n)}return this.mapToInitFragWhenRequired(v)}isLoopLoading(t,n){const s=this.fragmentTracker.getState(t);return(s===Ki.OK||s===Ki.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(Fn(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(Fn(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=_i(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=Si(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 D;const U=t<this.lastCurrentTime||t>n-m||(D=this.media)!=null&&D.paused||!this.startFragRequested?0:m;S=Ai(l,c,t,U)}else S=c[c.length-1];if(S){const M=S.sn-s.startSN,U=this.fragmentTracker.getState(S);if((U===Ki.OK||U===Ki.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 te=c[M+1];S.sn<p&&this.fragmentTracker.getState(te)!==Ki.OK?S=te: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){zs(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&&ze(t)&&t.stats.aborted&&(this.log(`Fragment ${t.sn}${n?" part "+n.index:""} of ${this.playlistLabel()} ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){(!this.fragCurrent||!this.fragContextChanged(t)&&this.state!==st.FRAG_LOADING_WAITING_RETRY)&&(this.state=st.IDLE)}onFragmentOrKeyLoadError(t,n){if(n.chunkMeta&&!n.frag){const M=this.getCurrentContext(n.chunkMeta);M&&(n.frag=M.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===X.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===Fi.RetryRequest,D=y&&!c.resolved&&_===un.MoveAllAlternatesMatchingHost;if(!S&&D&&ze(s)&&!s.endList)this.resetFragmentErrors(t),this.treatAsGap(s),c.resolved=!0;else if((S||D)&&m<v.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const M=$i(v,m);this.warn(`Fragment ${s.sn} of ${t} ${s.level} errored with ${n.details}, retrying loading ${m+1}/${v.maxNumRetry} in ${M}ms`),c.resolved=!0,this.retryDate=self.performance.now()+M,this.state=st.FRAG_LOADING_WAITING_RETRY}else if(v&&c)if(this.resetFragmentErrors(t),m<v.maxNumRetry)!l&&p!==Fi.RemoveAlternatePermanently&&(c.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${m})`);return}else p===Fi.SendAlternateToPenaltyBox?this.state=st.WAITING_LEVEL:this.state=st.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(t){if(this.state===st.PARSING||this.state===st.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!==st.STOPPED&&(this.state=st.IDLE)}afterBufferFlushed(t,n,s){if(!t)return;const o=si.getBuffered(t);this.fragmentTracker.detectEvictedFragments(n,o,s),this.state===st.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==st.STOPPED&&(this.state=st.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:Qo(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:pe.MEDIA_ERROR,details:X.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=st.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 Fn(h){return!!h.interstitialsController&&h.enableInterstitialPlayback!==!1}class Ur{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=Yr(t,n);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function Yr(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 sa={exports:{}},aa;function eo(){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 D=new o(v,y||_,S),M=n?n+m:m;return _._events[M]?_._events[M].fn?_._events[M]=[_._events[M],D]:_._events[M].push(D):(_._events[M]=D,_._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,D=y.length,M=new Array(D);S<D;S++)M[S]=y[S].fn;return M},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,D,M){var U=n?n+m:m;if(!this._events[U])return!1;var N=this._events[U],te=arguments.length,_e,le;if(N.fn){switch(N.once&&this.removeListener(m,N.fn,void 0,!0),te){case 1:return N.fn.call(N.context),!0;case 2:return N.fn.call(N.context,v),!0;case 3:return N.fn.call(N.context,v,y),!0;case 4:return N.fn.call(N.context,v,y,S),!0;case 5:return N.fn.call(N.context,v,y,S,D),!0;case 6:return N.fn.call(N.context,v,y,S,D,M),!0}for(le=1,_e=new Array(te-1);le<te;le++)_e[le-1]=arguments[le];N.fn.apply(N.context,_e)}else{var Re=N.length,Ue;for(le=0;le<Re;le++)switch(N[le].once&&this.removeListener(m,N[le].fn,void 0,!0),te){case 1:N[le].fn.call(N[le].context);break;case 2:N[le].fn.call(N[le].context,v);break;case 3:N[le].fn.call(N[le].context,v,y);break;case 4:N[le].fn.call(N[le].context,v,y,S);break;default:if(!_e)for(Ue=1,_e=new Array(te-1);Ue<te;Ue++)_e[Ue-1]=arguments[Ue];N[le].fn.apply(N[le].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 D=n?n+m:m;if(!this._events[D])return this;if(!v)return c(this,D),this;var M=this._events[D];if(M.fn)M.fn===v&&(!S||M.once)&&(!y||M.context===y)&&c(this,D);else{for(var U=0,N=[],te=M.length;U<te;U++)(M[U].fn!==v||S&&!M[U].once||y&&M[U].context!==y)&&N.push(M[U]);N.length?this._events[D]=N.length===1?N[0]:N:c(this,D)}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}(sa)),sa.exports}var sl=eo(),to=Z(sl);const As="1.6.7",Ps={};function Hl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function th(){const h=Ps[As];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 Ps[As]=o,o}function ih(h){const t=Ps[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 Ps[h]=o,o}function al(h){const t=Ps[h||As];if(t&&t.clientCount--===1){const{worker:s,objectURL:o}=t;delete Ps[h||As],o&&self.URL.revokeObjectURL(o),s.terminate()}}function ju(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 Wl(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 ol(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 Do(h,t){const n=t;let s=0;for(;Wl(h,t);){s+=10;const o=ol(h,t+6);s+=o,ju(h,t+10)&&(s+=10),t+=s}if(s>0)return h.subarray(n,n+s)}function nh(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 D=new Error(`invalid ADTS sampling index:${c}`);h.emit(w.ERROR,w.ERROR,{type:pe.MEDIA_ERROR,details:X.FRAG_PARSING_ERROR,fatal:!0,error:D,reason:D.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 Or(h,t){return h[t]===255&&(h[t+1]&246)===240}function Vs(h,t){return h[t+1]&1?7:9}function Gs(h,t){return(h[t+3]&3)<<11|h[t+4]<<3|(h[t+5]&224)>>>5}function rh(h,t){return t+5<h.length}function Co(h,t){return t+1<h.length&&Or(h,t)}function sh(h,t){return rh(h,t)&&Or(h,t)&&Gs(h,t)<=h.length-t}function ah(h,t){if(Co(h,t)){const n=Vs(h,t);if(t+n>=h.length)return!1;const s=Gs(h,t);if(s<=n)return!1;const o=t+s;return o===h.length||Co(h,o)}return!1}function jl(h,t,n,s,o){if(!h.samplerate){const l=nh(t,n,s,o);if(!l)return;k(h,l)}}function qu(h){return 1024*9e4/h}function oh(h,t){const n=Vs(h,t);if(t+n<=h.length){const s=Gs(h,t)-n;if(s>0)return{headerLength:n,frameLength:s}}}function Zu(h,t,n,s,o){const l=qu(h.samplerate),c=s+o*l,p=oh(t,n);let _;if(p){const{frameLength:y,headerLength:S}=p,D=S+y,M=Math.max(0,n+D-t.length);M?(_=new Uint8Array(D-S),_.set(t.subarray(n+S,t.length),0)):_=t.subarray(n+S,n+D);const U={unit:_,pts:c};return M||h.samples.push(U),{sample:U,length:D,missing:M}}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 ql(h,t){return Wl(h,t)&&ol(h,t+6)+10<=h.length-t}function lh(h){return h instanceof ArrayBuffer?h:h.byteOffset==0&&h.byteLength==h.buffer.byteLength?h.buffer:new Uint8Array(h).buffer}function Zl(h,t=0,n=1/0){return Yu(h,t,n,Uint8Array)}function Yu(h,t,n,s){const o=Xu(h);let l=1;"BYTES_PER_ELEMENT"in s&&(l=s.BYTES_PER_ELEMENT);const c=Hs(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 Xu(h){return h instanceof ArrayBuffer?h:h.buffer}function Hs(h){return h&&h.buffer instanceof ArrayBuffer&&h.byteLength!==void 0&&h.byteOffset!==void 0}function Ju(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=It(Zl(h.data,1,s)),l=h.data[2+s],c=h.data.subarray(3+s).indexOf(0);if(c===-1)return;const p=It(Zl(h.data,3+s,c));let _;return o==="-->"?_=It(Zl(h.data,4+s+c)):_=lh(h.data.subarray(4+s+c)),t.mimeType=o,t.pictureType=l,t.description=p,t.data=_,t}function Qu(h){if(h.size<2)return;const t=It(h.data,!0),n=new Uint8Array(h.data.subarray(t.length+1));return{key:h.type,info:t,data:n.buffer}}function uh(h){if(h.size<2)return;if(h.type==="TXXX"){let n=1;const s=It(h.data.subarray(n),!0);n+=s.length+1;const o=It(h.data.subarray(n));return{key:h.type,info:s,data:o}}const t=It(h.data.subarray(1));return{key:h.type,info:"",data:t}}function ch(h){if(h.type==="WXXX"){if(h.size<2)return;let n=1;const s=It(h.data.subarray(n),!0);n+=s.length+1;const o=It(h.data.subarray(n));return{key:h.type,info:s,data:o}}const t=It(h.data);return{key:h.type,info:"",data:t}}function hh(h){return h.type==="PRIV"?Qu(h):h.type[0]==="W"?ch(h):h.type==="APIC"?Ju(h):uh(h)}function fh(h){const t=String.fromCharCode(h[0],h[1],h[2],h[3]),n=ol(h,4),s=10;return{type:t,size:n,data:h.subarray(s,s+n)}}const Mo=10,dh=10;function ec(h){let t=0;const n=[];for(;Wl(h,t);){const s=ol(h,t+6);h[t+5]>>6&1&&(t+=Mo),t+=Mo;const o=t+s;for(;t+dh<o;){const l=fh(h.subarray(t)),c=hh(l);c&&n.push(c),t+=l.size+Mo}ju(h,t)&&(t+=Mo)}return n}function tc(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"}function ph(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 Yl(h){const t=ec(h);for(let n=0;n<t.length;n++){const s=t[n];if(tc(s))return ph(s)}}let us=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 Dr(h="",t=9e4){return{type:h,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class ll{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=xt(this.cachedData,t),this.cachedData=null);let s=Do(t,0),o=s?s.length:0,l;const c=this._audioTrack,p=this._id3Track,_=s?Yl(s):void 0,m=t.length;for((this.basePTS===null||this.frameIndex===0&&ue(_))&&(this.basePTS=oa(_,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:us.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 ql(t,o)?(s=Do(t,o),p.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:us.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=xt(this.cachedData,v):this.cachedData=v}}return{audioTrack:c,videoTrack:Dr(),id3Track:p,textTrack:Dr()}}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:Dr(),id3Track:this._id3Track,textTrack:Dr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const oa=(h,t,n)=>{if(ue(h))return h*90;const s=n?n.baseTime*9e4/n.timescale:0;return t*9e4+s};let ul=null;const ic=[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],nc=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],mh=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],rc=[0,1,1,4];function sc(h,t,n,s,o){if(n+24>t.length)return;const l=ac(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 ac(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=ic[_*14+o-1]*1e3,y=nc[(n===3?0:n===2?1:2)*3+l],S=p===3?1:2,D=mh[n][s],M=rc[s],U=D*8*M,N=Math.floor(D*m/y+c)*M;if(ul===null){const le=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ul=le?parseInt(le[1]):0}return!!ul&&ul<=87&&s===2&&m>=224e3&&p===0&&(h[t+3]=h[t+3]|128),{sampleRate:y,channelCount:S,frameLength:N,samplesPerFrame:U}}}function Xl(h,t){return h[t]===255&&(h[t+1]&224)===224&&(h[t+1]&6)!==0}function oc(h,t){return t+1<h.length&&Xl(h,t)}function gh(h,t){return Xl(h,t)&&4<=h.length-t}function lc(h,t){if(t+1<h.length&&Xl(h,t)){const s=ac(h,t);let o=4;s!=null&&s.frameLength&&(o=s.frameLength);const l=t+o;return l===h.length||oc(h,l)}return!1}class _h extends ll{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=Do(t,0);let o=(s==null?void 0:s.length)||0;if(lc(t,o))return!1;for(let l=t.length;o<l;o++)if(ah(t,o))return n.log("ADTS sync word found !"),!0;return!1}canParse(t,n){return sh(t,n)}appendFrame(t,n,s){jl(t,this.observer,n,s,t.manifestCodec);const o=Zu(t,n,s,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o}}const uc=(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 vh extends ll{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=cl(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=Do(t,0);if(!n)return!1;const s=n.length;return t[s]===11&&t[s+1]===119&&Yl(n)!==void 0&&uc(t,s)<16}}function cl(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 D=(t[n+6]<<8|t[n+7])>>12-S&1,U=[2,1,2,3,3,4,4,5][y]+D,N=t[n+5]>>3,te=t[n+5]&7,_e=new Uint8Array([l<<6|N<<1|te>>2,(te&3)<<6|y<<3|D<<2|_>>4,_<<4&224]),le=1536/p*9e4,Re=s+o*le,Ue=t.subarray(n,n+v);return h.config=_e,h.channelCount=U,h.samplerate=p,h.samples.push({unit:Ue,pts:Re}),v}class yh extends ll{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=Do(t,0);let s=(n==null?void 0:n.length)||0;if(n&&t[s]===11&&t[s+1]===119&&Yl(n)!==void 0&&uc(t,s)<=16)return!1;for(let o=t.length;s<o;s++)if(lc(t,s))return se.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,n){return gh(t,n)}appendFrame(t,n,s){if(this.basePTS!==null)return sc(t,n,s,this.basePTS,this.frameIndex)}}const bh=/\/emsg[-/]ID3/i;class xh{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=Dr("video",1),c=this.audioTrack=Dr("audio",1),p=this.txtTrack=Dr("text",1);if(this.id3Track=Dr("id3",1),this.timeOffset=0,!(t!=null&&t.byteLength))return;const _=at(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=$e.text,l.sampleDuration=0,l.duration=c.duration=o}resetContiguity(){this.remainderData=null}static probe(t){return Be(t)}demux(t,n){this.timeOffset=n;let s=t;const o=this.videoTrack,l=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=xt(this.remainderData,t));const p=Se(s);this.remainderData=p.remainder,o.samples=p.valid||new Uint8Array}else o.samples=s;const c=this.extractID3Track(o,n);return l.samples=Wt(n,o),{videoTrack:o,audioTrack:this.audioTrack,id3Track:c,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,n=this.videoTrack,s=this.txtTrack;n.samples=this.remainderData||new Uint8Array,this.remainderData=null;const o=this.extractID3Track(n,this.timeOffset);return s.samples=Wt(t,n),{videoTrack:n,audioTrack:Dr(),id3Track:o,textTrack:Dr()}}extractID3Track(t,n){const s=this.id3Track;if(t.samples.length){const o=me(t.samples,["emsg"]);o&&o.forEach(l=>{const c=wt(l);if(bh.test(c.schemeIdUri)){const p=cc(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:us.emsg,duration:_})}else if(this.config.enableEmsgKLVMetadata&&c.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const p=cc(c,n);s.samples.push({data:c.payload,len:c.payload.byteLength,dts:p,pts:p,type:us.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 cc(h,t){return ue(h.presentationTime)?h.presentationTime/h.timeScale:t+h.presentationTimeDelta/h.timeScale}class wh{constructor(t,n,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new ar(n,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,cn.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=rt(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 io{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,D=0;for(l===-1&&(S=0,D=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 M={data:n.subarray(S,v),type:D};p.push(M)}else{const M=this.getLastNalUnit(t.samples);M&&(c&&_<=4-c&&M.state&&(M.data=M.data.subarray(0,M.data.byteLength-c)),v>0&&(M.data=xt(M.data,n.subarray(0,v)),M.state=0))}_<o?(y=this.getNALuType(n,_),S=_,D=y,l=0):l=-1}else l=0}if(S>=0&&l>=0){const M={data:n.subarray(S,o),type:D,state:l};p.push(M)}if(p.length===0){const M=this.getLastNalUnit(t.samples);M&&(M.data=xt(M.data,n))}return t.naluState=l,p}}class Ws{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 Jl extends io{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 U=!1;p=!0;const N=m.data;if(_&&N.length>4){const te=this.readSliceType(N);(te===2||te===4||te===7||te===9)&&(U=!0)}if(U){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=U;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,Me(m.data,1,s.pts,n.samples);break}case 7:{var D,M;p=!0,_=!0;const U=m.data,N=this.readSPS(U);if(!t.sps||t.width!==N.width||t.height!==N.height||((D=t.pixelRatio)==null?void 0:D[0])!==N.pixelRatio[0]||((M=t.pixelRatio)==null?void 0:M[1])!==N.pixelRatio[1]){t.width=N.width,t.height=N.height,t.pixelRatio=N.pixelRatio,t.sps=[U];const te=U.subarray(1,4);let _e="avc1.";for(let le=0;le<3;le++){let Re=te[le].toString(16);Re.length<2&&(Re="0"+Re),_e+=Re}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 Ws(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 Ws(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),D=n.readBoolean.bind(n),M=n.skipBits.bind(n),U=n.skipEG.bind(n),N=n.skipUEG.bind(n),te=this.skipScalingList.bind(this);v();const _e=v();if(y(5),M(3),v(),N(),_e===100||_e===110||_e===122||_e===244||_e===44||_e===83||_e===86||_e===118||_e===128){const We=S();if(We===3&&M(1),N(),N(),M(1),D())for(_=We!==3?8:12,m=0;m<_;m++)D()&&(m<6?te(16,n):te(64,n))}N();const le=S();if(le===0)S();else if(le===1)for(M(1),U(),U(),p=S(),m=0;m<p;m++)U();N(),M(1);const Re=S(),Ue=S(),_t=y(1);_t===0&&M(1),M(1),D()&&(s=S(),o=S(),l=S(),c=S());let Ne=[1,1];if(D()&&D())switch(v()){case 1:Ne=[1,1];break;case 2:Ne=[12,11];break;case 3:Ne=[10,11];break;case 4:Ne=[16,11];break;case 5:Ne=[40,33];break;case 6:Ne=[24,11];break;case 7:Ne=[20,11];break;case 8:Ne=[32,11];break;case 9:Ne=[80,33];break;case 10:Ne=[18,11];break;case 11:Ne=[15,11];break;case 12:Ne=[64,33];break;case 13:Ne=[160,99];break;case 14:Ne=[4,3];break;case 15:Ne=[3,2];break;case 16:Ne=[2,1];break;case 255:{Ne=[v()<<8|v(),v()<<8|v()];break}}return{width:Math.ceil((Re+1)*16-s*2-o*2),height:(2-_t)*(Ue+1)*16-(_t?2:4)*(l+c),pixelRatio:Ne}}}class hc extends io{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,Me(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 D=this.readSPS(m.data);t.width=D.width,t.height=D.height,t.pixelRatio=D.pixelRatio,t.codec=D.codecString,t.sps=[],typeof t.params!="object"&&(t.params={});for(const M in D.params)t.params[M]=D.params[M]}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 D=this.readPPS(m.data);for(const M in D)t.params[M]=D[M]}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 Ws(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 Ws(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(),D=n.readUByte(),M=n.readUByte(),U=n.readUByte(),N=n.readUByte(),te=n.readUByte(),_e=[],le=[];for(let Tn=0;Tn<s;Tn++)_e.push(n.readBoolean()),le.push(n.readBoolean());if(s>0)for(let Tn=s;Tn<8;Tn++)n.readBits(2);for(let Tn=0;Tn<s;Tn++)_e[Tn]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),le[Tn]&&n.readUByte();n.readUEG();const Re=n.readUEG();Re==3&&n.skipBits(1);const Ue=n.readUEG(),_t=n.readUEG(),Ne=n.readBoolean();let We=0,tt=0,Oe=0,Rt=0;Ne&&(We+=n.readUEG(),tt+=n.readUEG(),Oe+=n.readUEG(),Rt+=n.readUEG());const ei=n.readUEG(),pi=n.readUEG(),yi=n.readUEG(),vi=n.readBoolean();for(let Tn=vi?0:s;Tn<=s;Tn++)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 Jr=0;Jr<4;Jr++)for(let Ms=0;Ms<(Jr===3?2:6);Ms++)if(!n.readBoolean())n.readUEG();else{const as=Math.min(64,1<<4+(Jr<<1));Jr>1&&n.readEG();for(let vo=0;vo<as;vo++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const Jt=n.readUEG();let Hi=0;for(let Tn=0;Tn<Jt;Tn++){let Jr=!1;if(Tn!==0&&(Jr=n.readBoolean()),Jr){Tn===Jt&&n.readUEG(),n.readBoolean(),n.readUEG();let Ms=0;for(let _o=0;_o<=Hi;_o++){const as=n.readBoolean();let vo=!1;as||(vo=n.readBoolean()),(as||vo)&&Ms++}Hi=Ms}else{const Ms=n.readUEG(),_o=n.readUEG();Hi=Ms+_o;for(let as=0;as<Ms;as++)n.readUEG(),n.readBoolean();for(let as=0;as<_o;as++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const Tn=n.readUEG();for(let Jr=0;Jr<Tn;Jr++){for(let Ms=0;Ms<yi+4;Ms++)n.readBits(1);n.readBits(1)}}let ri=0,jt=1,hn=1,mn=!0,kn=1,gn=0;n.readBoolean(),n.readBoolean();let Mn=!1;if(n.readBoolean()){if(n.readBoolean()){const Xs=n.readUByte(),Wo=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Ml=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Xs>0&&Xs<16?(jt=Wo[Xs-1],hn=Ml[Xs-1]):Xs===255&&(jt=n.readBits(16),hn=n.readBits(16))}if(n.readBoolean()&&n.readBoolean(),n.readBoolean()&&(n.readBits(3),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.readUByte(),n.readUByte())),n.readBoolean()&&(n.readUEG(),n.readUEG()),n.readBoolean(),n.readBoolean(),n.readBoolean(),Mn=n.readBoolean(),Mn&&(We+=n.readUEG(),tt+=n.readUEG(),Oe+=n.readUEG(),Rt+=n.readUEG()),n.readBoolean()&&(kn=n.readBits(32),gn=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const Ml=n.readBoolean(),yo=n.readBoolean();let Fa=!1;(Ml||yo)&&(Fa=n.readBoolean(),Fa&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),Fa&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let Cu=0;Cu<=s;Cu++){mn=n.readBoolean();const Pd=mn||n.readBoolean();let Tf=!1;Pd?n.readEG():Tf=n.readBoolean();const Mu=Tf?1:n.readUEG()+1;if(Ml)for(let Ba=0;Ba<Mu;Ba++)n.readUEG(),n.readUEG(),Fa&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(yo)for(let Ba=0;Ba<Mu;Ba++)n.readUEG(),n.readUEG(),Fa&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),ri=n.readUEG())}let Sr=Ue,hs=_t;if(Ne||Mn){let Tn=1,Jr=1;Re===1?Tn=Jr=2:Re==2&&(Tn=2),Sr=Ue-Tn*tt-Tn*We,hs=_t-Jr*Rt-Jr*Oe}const go=o?["A","B","C"][o]:"",Id=p<<24|_<<16|m<<8|v;let Du=0;for(let Tn=0;Tn<32;Tn++)Du=(Du|(Id>>Tn&1)<<31-Tn)>>>0;let $c=Du.toString(16);return c===1&&$c==="2"&&($c="6"),{codecString:`hvc1.${go}${c}.${$c}.${l?"H":"L"}${te}.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,D,M,U,N],general_level_idc:te,bit_depth:ei+8,bit_depth_luma_minus8:ei,bit_depth_chroma_minus8:pi,min_spatial_segmentation_idc:ri,chroma_format_idc:Re,frame_rate:{fixed:mn,fps:gn/kn}},width:Sr,height:hs,pixelRatio:[jt,hn]}}readPPS(t){const n=new Ws(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 Cr=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(Cr*5,n-Cr)+1,o=0;for(;o<s;){let l=!1,c=-1,p=0;for(let _=o;_<n;_+=Cr)if(t[_]===71&&(n-_===Cr||t[_+Cr]===71)){if(p++,c===-1&&(c=_,c!==0&&(s=Math.min(c+Cr*99,t.length-Cr)+1)),l||(l=Ql(t,_)===0),l&&p>1&&(c===0&&p>2||_+Cr>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:$e[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,D=_.pid,M=p.pesData,U=_.pesData,N=null,te=this.pmtParsed,_e=this._pmtId,le=t.length;if(this.remainderData&&(t=xt(this.remainderData,t),le=t.length,this.remainderData=null),le<Cr&&!o)return this.remainderData=t,{audioTrack:p,videoTrack:c,id3Track:_,textTrack:m};const Re=Math.max(0,la.syncOffset(t));le-=(le-Re)%Cr,le<t.byteLength&&!o&&(this.remainderData=new Uint8Array(t.buffer,le,t.buffer.byteLength-le));let Ue=0;for(let Ne=Re;Ne<le;Ne+=Cr)if(t[Ne]===71){const We=!!(t[Ne+1]&64),tt=Ql(t,Ne),Oe=(t[Ne+3]&48)>>4;let Rt;if(Oe>1){if(Rt=Ne+5+t[Ne+4],Rt===Ne+Cr)continue}else Rt=Ne+4;switch(tt){case v:if(We){if(y&&(l=Os(y,this.logger))){if(this.videoParser===null)switch(c.segmentCodec){case"avc":this.videoParser=new Jl;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(Rt,Ne+Cr)),y.size+=Ne+Cr-Rt);break;case S:if(We){if(M&&(l=Os(M,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}M={data:[],size:0}}M&&(M.data.push(t.subarray(Rt,Ne+Cr)),M.size+=Ne+Cr-Rt);break;case D:We&&(U&&(l=Os(U,this.logger))&&this.parseID3PES(_,l),U={data:[],size:0}),U&&(U.data.push(t.subarray(Rt,Ne+Cr)),U.size+=Ne+Cr-Rt);break;case 0:We&&(Rt+=t[Rt]+1),_e=this._pmtId=eu(t,Rt);break;case _e:{We&&(Rt+=t[Rt]+1);const ei=Sh(t,Rt,this.typeSupported,s,this.observer,this.logger);v=ei.videoPid,v>0&&(c.pid=v,c.segmentCodec=ei.segmentVideoCodec),S=ei.audioPid,S>0&&(p.pid=S,p.segmentCodec=ei.segmentAudioCodec),D=ei.id3Pid,D>0&&(_.pid=D),N!==null&&!te&&(this.logger.warn(`MPEG-TS PMT found at ${Ne} after unknown PID '${N}'. Backtracking to sync byte @${Re} to parse all TS packets.`),N=null,Ne=Re-188),te=this.pmtParsed=!0;break}case 17:case 8191:break;default:N=tt;break}}else Ue++;Ue>0&&tu(this.observer,new Error(`Found ${Ue} TS packet/s that do not start with 0x47`),void 0,this.logger),c.pesData=y,p.pesData=M,_.pesData=U;const _t={audioTrack:p,videoTrack:c,id3Track:_,textTrack:m};return o&&this.extractRemainingSamples(_t),_t}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=Os(c,this.logger))){if(this.videoParser===null)switch(s.segmentCodec){case"avc":this.videoParser=new Jl;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=Os(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=Os(_,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 wh(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=xt(o.sample.unit,l);else{const D=S-y;o.sample.unit.set(l.subarray(0,y),D),t.samples.push(o.sample),s=o.missing}}let c,p;for(c=s,p=l.length;c<p-1&&!Co(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",tu(this.observer,new Error(y),S,this.logger),!S)return}jl(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=Zu(t,l,c,_,m),c+=v.length,v.missing){this.aacOverFlow=v;break}else for(m++;c<p-1&&!Co(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(oc(s,c)){const _=sc(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&&(_=cl(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?us.emsg:us.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(s)}}function Ql(h,t){return((h[t+1]&31)<<8)+h[t+2]}function eu(h,t){return(h[t+10]&31)<<8|h[t+11]}function Sh(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=Ql(h,t),y=(h[t+3]&15)<<8|h[t+4];switch(h[t]){case 207:if(!s){iu("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){iu("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){iu("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,D=y;for(;D>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 U=h[S+1]+2;S+=U,D-=U}}break;case 194:case 135:return tu(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 tu(h,t,n,s){s.warn(`parsing error: ${t.message}`),h.emit(w.ERROR,w.ERROR,{type:pe.MEDIA_ERROR,details:X.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:t,reason:t.message})}function iu(h,t){t.log(`${h} with AES-128-CBC encryption found in unencrypted stream`)}function Os(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]=xt(_[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 D=0,M=_.length;D<M;D++){s=_[D];let U=s.byteLength;if(y)if(y>U){y-=U;continue}else s=s.subarray(y),U-=y,y=0;S.set(s,n),n+=U}return o&&(o-=l+3),{data:S,pts:c,dts:p,len:o}}return null}class nu{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 ua=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/(ua+1)),o=Math.floor(n%(ua+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/(ua+1)),o=Math.floor(n%(ua+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/(ua+1)),p=Math.floor(s%(ua+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/(ua+1)),c=Math.floor(n%(ua+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 xt(Ge.FTYP,n)}static hvc1(t){const n=t.params,s=[t.vps,t.sps,t.pps],o=4,l=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),o-1|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),s.length]);let c=l.length;for(let M=0;M<s.length;M+=1){c+=3;for(let U=0;U<s[M].length;U+=1)c+=2+s[M][U].length}const p=new Uint8Array(c);p.set(l,0),c=l.length;const _=s.length-1;for(let M=0;M<s.length;M+=1){p.set(new Uint8Array([32+M|(M===_?128:0),0,s[M].length]),c),c+=3;for(let U=0;U<s[M].length;U+=1)p.set(new Uint8Array([s[M][U].length>>8,s[M][U].length&255]),c),c+=2,p.set(s[M][U],c),c+=s[M][U].length}const m=Ge.box(Ge.types.hvcC,p),v=t.width,y=t.height,S=t.pixelRatio[0],D=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,D>>24,D>>16&255,D>>8&255,D&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 Eh(h,t,n=1,s=!1){return ru(h,t,1/n,s)}function Ta(h,t=!1){return ru(h,1e3,1/fc,t)}function su(h,t=1){return ru(h,fc,1/t)}const au=10*1e3,kh=1024,Th=1152,Ah=1536;let ca=null,Ro=null;function hl(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 no extends H{constructor(t,n,s,o){if(super("mp4-remuxer",o),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=n,this.typeSupported=s,this.ISGenerated=!1,ca===null){const c=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ca=c?parseInt(c[1]):0}if(Ro===null){const l=navigator.userAgent.match(/Safari\/(\d+)/i);Ro=l?parseInt(l[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=t}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(t){let n=!1;const s=t[0].pts,o=t.reduce((l,c)=>{let p=c.pts,_=p-l;return _<-4294967296&&(n=!0,p=vs(p,s),_=p-l),_>0?l:p},s);return n&&this.debug("PTS rollover detected"),o}remux(t,n,s,o,l,c,p,_){let m,v,y,S,D,M,U=l,N=l;const te=t.pid>-1,_e=n.pid>-1,le=n.samples.length,Re=t.samples.length>0,Ue=p&&le>0||le>1;if((!te||Re)&&(!_e||Ue)||this.ISGenerated||p){if(this.ISGenerated){var Ne,We,tt,Oe;const yi=this.videoTrackConfig;(yi&&(n.width!==yi.width||n.height!==yi.height||((Ne=n.pixelRatio)==null?void 0:Ne[0])!==((We=yi.pixelRatio)==null?void 0:We[0])||((tt=n.pixelRatio)==null?void 0:tt[1])!==((Oe=yi.pixelRatio)==null?void 0:Oe[1]))||!yi&&Ue||this.nextAudioTs===null&&Re)&&this.resetInitSegment()}this.ISGenerated||(y=this.generateIS(t,n,l,c));const Rt=this.isVideoContiguous;let ei=-1,pi;if(Ue&&(ei=dc(n.samples),!Rt&&this.config.forceKeyFrameOnDiscontinuity))if(M=!0,ei>0){this.warn(`Dropped ${ei} out of ${le} video samples due to a missing keyframe`);const yi=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(ei),n.dropped+=ei,N+=(n.samples[0].pts-yi)/n.inputTimeScale,pi=N}else ei===-1&&(this.warn(`No keyframe found out of ${le} video samples`),M=!1);if(this.ISGenerated){if(Re&&Ue){const yi=this.getVideoStartPts(n.samples),ui=(vs(t.samples[0].pts,yi)-yi)/n.inputTimeScale;U+=Math.max(0,ui),N+=Math.max(0,-ui)}if(Re){if(t.samplerate||(this.warn("regenerate InitSegment as audio detected"),y=this.generateIS(t,n,l,c)),v=this.remuxAudio(t,U,this.isAudioContiguous,c,_e||Ue||_===P.AUDIO?N:void 0),Ue){const yi=v?v.endPTS-v.startPTS:0;n.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),y=this.generateIS(t,n,l,c)),m=this.remuxVideo(n,N,Rt,yi)}}else Ue&&(m=this.remuxVideo(n,N,Rt,0));m&&(m.firstKeyFrame=ei,m.independent=ei!==-1,m.firstKeyFramePTS=pi)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(D=fl(s,l,this._initPTS,this._initDTS)),o.samples.length&&(S=pc(o,l,this._initPTS))),{audio:v,video:m,initSegment:y,independent:M,text:S,id3:D}}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,D,M,U;if(v&&(S=D=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&&(U=t.id,M=t.inputTimeScale,!m||M!==m.timescale?S=D=l[0].pts-Math.round(M*s):v=!1)}if(n.sps&&n.pps&&c.length){if(n.timescale=n.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:n.codec,initSegment:Ge.initSegment([n]),metadata:{width:n.width,height:n.height}},v)if(U=n.id,M=n.inputTimeScale,!m||M!==m.timescale){const N=this.getVideoStartPts(c),te=Math.round(M*s);D=Math.min(D,vs(c[0].dts,N)-te),S=Math.min(S,N-te)}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:M},this._initDTS={baseTime:D,timescale:M}):S=M=void 0,{tracks:_,initPTS:S,timescale:M,trackId:U}}remuxVideo(t,n,s,o){const l=t.inputTimeScale,c=t.samples,p=[],_=c.length,m=this._initPTS,v=m.baseTime*l/m.timescale;let y=this.nextVideoTs,S=8,D=this.videoSampleDuration,M,U,N=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,_e=!1;if(!s||y===null){const ri=v+n*l,jt=c[0].pts-vs(c[0].dts,c[0].pts);ca&&y!==null&&Math.abs(ri-jt-(y+v))<15e3?s=!0:y=ri-jt-v}const le=y+v;for(let ri=0;ri<_;ri++){const jt=c[ri];jt.pts=vs(jt.pts,le),jt.dts=vs(jt.dts,le),jt.dts<c[ri>0?ri-1:ri].dts&&(_e=!0)}_e&&c.sort(function(ri,jt){const hn=ri.dts-jt.dts,mn=ri.pts-jt.pts;return hn||mn}),M=c[0].dts,U=c[c.length-1].dts;const Re=U-M,Ue=Re?Math.round(Re/(_-1)):D||t.inputTimeScale/30;if(s){const ri=M-le,jt=ri>Ue,hn=ri<-1;if((jt||hn)&&(jt?this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Ta(ri,!0)} ms (${ri}dts) hole between fragments detected at ${n.toFixed(3)}`):this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Ta(-ri,!0)} ms (${ri}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!hn||le>=c[0].pts||ca)){M=le;const mn=c[0].pts-ri;if(jt)c[0].dts=M,c[0].pts=mn;else{let kn=!0;for(let gn=0;gn<c.length&&!(c[gn].dts>mn&&kn);gn++){const Mn=c[gn].pts;if(c[gn].dts-=ri,c[gn].pts-=ri,gn<c.length-1){const xs=c[gn+1].pts,Sr=c[gn].pts,hs=xs<=Sr,go=xs<=Mn;kn=hs==go}}}this.log(`Video: Initial PTS/DTS adjusted: ${Ta(mn,!0)}/${Ta(M,!0)}, delta: ${Ta(ri,!0)} ms`)}}M=Math.max(0,M);let _t=0,Ne=0,We=M;for(let ri=0;ri<_;ri++){const jt=c[ri],hn=jt.units,mn=hn.length;let kn=0;for(let gn=0;gn<mn;gn++)kn+=hn[gn].data.length;Ne+=kn,_t+=mn,jt.length=kn,jt.dts<We?(jt.dts=We,We+=Ue/4|0||1):We=jt.dts,N=Math.min(jt.pts,N),te=Math.max(jt.pts,te)}U=c[_-1].dts;const tt=Ne+4*_t+8;let Oe;try{Oe=new Uint8Array(tt)}catch(ri){this.observer.emit(w.ERROR,w.ERROR,{type:pe.MUX_ERROR,details:X.REMUX_ALLOC_ERROR,fatal:!1,error:ri,bytes:tt,reason:`fail allocating video mdat ${tt}`});return}const Rt=new DataView(Oe.buffer);Rt.setUint32(0,tt),Oe.set(Ge.types.mdat,4);let ei=!1,pi=Number.POSITIVE_INFINITY,yi=Number.POSITIVE_INFINITY,vi=Number.NEGATIVE_INFINITY,ui=Number.NEGATIVE_INFINITY;for(let ri=0;ri<_;ri++){const jt=c[ri],hn=jt.units;let mn=0;for(let Mn=0,xs=hn.length;Mn<xs;Mn++){const Sr=hn[Mn],hs=Sr.data,go=Sr.data.byteLength;Rt.setUint32(S,go),S+=4,Oe.set(hs,S),S+=go,mn+=4+go}let kn;if(ri<_-1)D=c[ri+1].dts-jt.dts,kn=c[ri+1].pts-jt.pts;else{const Mn=this.config,xs=ri>0?jt.dts-c[ri-1].dts:Ue;if(kn=ri>0?jt.pts-c[ri-1].pts:Ue,Mn.stretchShortVideoTrack&&this.nextAudioTs!==null){const Sr=Math.floor(Mn.maxBufferHole*l),hs=(o?N+o*l:this.nextAudioTs+v)-jt.pts;hs>Sr?(D=hs-xs,D<0?D=xs:ei=!0,this.log(`It is approximately ${hs/90} ms to the next segment; using duration ${D/90} ms for the last video frame.`)):D=xs}else D=xs}const gn=Math.round(jt.pts-jt.dts);pi=Math.min(pi,D),vi=Math.max(vi,D),yi=Math.min(yi,kn),ui=Math.max(ui,kn),p.push(hl(jt.key,D,mn,gn))}if(p.length){if(ca){if(ca<70){const ri=p[0].flags;ri.dependsOn=2,ri.isNonSync=0}}else if(Ro&&ui-yi<vi-pi&&Ue/vi<.025&&p[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let ri=M;for(let jt=0,hn=p.length;jt<hn;jt++){const mn=ri+p[jt].duration,kn=ri+p[jt].cts;if(jt<hn-1){const gn=mn+p[jt+1].cts;p[jt].duration=gn-kn}else p[jt].duration=jt?p[jt-1].duration:Ue;p[jt].cts=0,ri=mn}}}D=ei||!D?Ue:D;const Ui=U+D;this.nextVideoTs=y=Ui-v,this.videoSampleDuration=D,this.isVideoContiguous=!0;const Ni={data1:Ge.moof(t.sequenceNumber++,M,k(t,{samples:p})),data2:Oe,startPTS:(N-v)/l,endPTS:(te+D-v)/l,startDTS:(M-v)/l,endDTS:y/l,type:"video",hasAudio:!1,hasVideo:!0,nb:p.length,dropped:t.dropped};return t.samples=[],t.dropped=0,Ni}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return Th;case"ac3":return Ah;default:return kh}}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,D=[],M=l!==void 0;let U=t.samples,N=S?0:8,te=this.nextAudioTs||-1;const _e=y.baseTime*c/y.timescale,le=_e+n*c;if(this.isAudioContiguous=s=s||U.length&&te>0&&(o&&Math.abs(le-(te+_e))<9e3||Math.abs(vs(U[0].pts,le)-(te+_e))<20*v),U.forEach(function(ui){ui.pts=vs(ui.pts,le)}),!s||te<0){if(U=U.filter(ui=>ui.pts>=0),!U.length)return;l===0?te=0:o&&!M?te=Math.max(0,le-_e):te=U[0].pts-_e}if(t.segmentCodec==="aac"){const ui=this.config.maxAudioFramesDrift;for(let Ui=0,Jt=te+_e;Ui<U.length;Ui++){const Hi=U[Ui],Ni=Hi.pts,ri=Ni-Jt,jt=Math.abs(1e3*ri/c);if(ri<=-ui*v&&M)Ui===0&&(this.warn(`Audio frame @ ${(Ni/c).toFixed(3)}s overlaps marker by ${Math.round(1e3*ri/c)} ms.`),this.nextAudioTs=te=Ni-_e,Jt=Ni);else if(ri>=ui*v&&jt<au&&M){let hn=Math.round(ri/v);for(Jt=Ni-hn*v;Jt<0&&hn&&v;)hn--,Jt+=v;Ui===0&&(this.nextAudioTs=te=Jt-_e),this.warn(`Injecting ${hn} audio frames @ ${((Jt-_e)/c).toFixed(3)}s due to ${Math.round(1e3*ri/c)} ms gap.`);for(let mn=0;mn<hn;mn++){let kn=nu.getSilentFrame(t.parsedCodec||t.manifestCodec||t.codec,t.channelCount);kn||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),kn=Hi.unit.subarray()),U.splice(Ui,0,{unit:kn,pts:Jt}),Jt+=v,Ui++}}Hi.pts=Jt,Jt+=v}}let Re=null,Ue=null,_t,Ne=0,We=U.length;for(;We--;)Ne+=U[We].unit.byteLength;for(let ui=0,Ui=U.length;ui<Ui;ui++){const Jt=U[ui],Hi=Jt.unit;let Ni=Jt.pts;if(Ue!==null){const jt=D[ui-1];jt.duration=Math.round((Ni-Ue)/_)}else if(s&&t.segmentCodec==="aac"&&(Ni=te+_e),Re=Ni,Ne>0){Ne+=N;try{_t=new Uint8Array(Ne)}catch(jt){this.observer.emit(w.ERROR,w.ERROR,{type:pe.MUX_ERROR,details:X.REMUX_ALLOC_ERROR,fatal:!1,error:jt,bytes:Ne,reason:`fail allocating audio mdat ${Ne}`});return}S||(new DataView(_t.buffer).setUint32(0,Ne),_t.set(Ge.types.mdat,4))}else return;_t.set(Hi,N);const ri=Hi.byteLength;N+=ri,D.push(hl(!0,m,ri,0)),Ue=Ni}const tt=D.length;if(!tt)return;const Oe=D[D.length-1];te=Ue-_e,this.nextAudioTs=te+_*Oe.duration;const Rt=S?new Uint8Array(0):Ge.moof(t.sequenceNumber++,Re/_,k({},t,{samples:D}));t.samples=[];const ei=(Re-_e)/c,pi=te/c,vi={data1:Rt,data2:_t,startPTS:ei,endPTS:pi,startDTS:ei,endDTS:pi,type:"audio",hasAudio:!0,hasVideo:!1,nb:tt};return this.isAudioContiguous=!0,vi}}function vs(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 dc(h){for(let t=0;t<h.length;t++)if(h[t].key)return t;return-1}function fl(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=vs(_.pts-n.baseTime*l/n.timescale,t*l)/l,_.dts=vs(_.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=vs(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 Lh extends H{constructor(t,n,s,o){super("passthrough-remuxer",o),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(t){this.lastEndTime=null;const n=this.initPTS;n&&t&&n.baseTime===t.baseTime&&n.timescale===t.timescale||(this.initPTS=t)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(t,n,s,o){this.audioCodec=n,this.videoCodec=s,this.generateInitSegment(bt(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=at(t);o.audio&&(n=pl(o.audio,G.AUDIO,this)),o.video&&(s=pl(o.video,G.VIDEO,this));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.warn("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 D={initPTS:void 0,timescale:void 0,trackId:void 0};let M=this.initData;if((p=M)!=null&&p.length||(this.generateInitSegment(S),M=this.initData),!((_=M)!=null&&_.length))return this.warn("Failed to generate initSegment."),y;this.emitInitSegment&&(D.tracks=this.initTracks,this.emitInitSegment=!1);const U=vt(S,M,this),N=M.audio?U[M.audio.id]:null,te=M.video?U[M.video.id]:null,_e=dl(te,1/0),le=dl(N,1/0),Re=dl(te,0,!0),Ue=dl(N,0,!0);let _t,Ne=l,We=0;if(N&&(!te||!m&&le<_e||m&&m.trackId===M.audio.id)?(D.trackId=M.audio.id,_t=N,We=Ue-le):te&&(D.trackId=M.video.id,_t=te,We=Re-_e),_t){const ui=_t.timescale;Ne=_t.start/ui,D.initPTS=_t.start-l*ui,D.timescale=ui,m||(this.initPTS=m={baseTime:D.initPTS,timescale:ui,trackId:D.trackId})}(c||!m)&&(Dh(m,Ne,l,We)||D.timescale!==m.timescale)&&(D.initPTS=Ne-l,D.timescale=1,m&&m.timescale===1&&this.warn(`Adjusting initPTS @${l} from ${m.baseTime/m.timescale} to ${D.initPTS}`),this.initPTS=m={baseTime:D.initPTS,timescale:1});const tt=t?Ne-m.baseTime/m.timescale:v,Oe=tt+We;We>0?this.lastEndTime=Oe:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Rt=!!M.audio,ei=!!M.video;let pi="";Rt&&(pi+="audio"),ei&&(pi+="video");const yi={data1:S,startPTS:tt,startDTS:tt,endPTS:Oe,endDTS:Oe,type:pi,hasAudio:Rt,hasVideo:ei,nb:1,dropped:0};y.audio=Rt&&!ei?yi:void 0,y.video=ei?yi:void 0;const vi=te==null?void 0:te.sampleCount;if(vi){const ui=te.keyFrameIndex,Ui=ui!==-1;yi.nb=vi,yi.dropped=ui===0||this.isVideoContiguous?0:Ui?ui:vi,yi.independent=Ui,yi.firstKeyFrame=ui,Ui&&te.keyFrameStart&&(yi.firstKeyFramePTS=(te.keyFrameStart-m.baseTime)/m.timescale),this.isVideoContiguous||(y.independent=Ui),this.isVideoContiguous||(this.isVideoContiguous=Ui),yi.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${ui}/${vi} dropped: ${yi.dropped} start: ${yi.firstKeyFramePTS||"NA"}`)}return y.initSegment=D,y.id3=fl(s,l,m,m),o.samples.length&&(y.text=pc(o,l,m)),y}}function dl(h,t,n=!1){return(h==null?void 0:h.start)!==void 0?(h.start+(n?h.duration:0))/h.timescale:t}function Dh(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 pl(h,t,n){const s=h==null?void 0:h.codec;return s&&s.length>4?s:t===G.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?ae(s,!1):(n.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(n.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let Qt;try{Qt=self.performance.now.bind(self.performance)}catch(h){Qt=Date.now}const cs=[{demux:xh,remux:Lh},{demux:la,remux:no},{demux:_h,remux:no},{demux:yh,remux:no}];cs.splice(2,0,{demux:vh,remux:no});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=Qt();let c=new Uint8Array(t);const{currentTransmuxState:p,transmuxConfig:_}=this;o&&(this.currentTransmuxState=o);const{contiguous:m,discontinuity:v,trackSwitch:y,accurateTimeOffset:S,timeOffset:D,initSegmentChange:M}=o||p,{audioCodec:U,videoCodec:N,defaultInitPts:te,duration:_e,initSegmentData:le}=_,Re=Ch(c,n);if(Re&&Pr(Re.method)){const We=this.getDecrypter(),tt=Wr(Re.method);if(We.isSync()){let Oe=We.softwareDecrypt(c,Re.key.buffer,Re.iv.buffer,tt);if(s.part>-1){const ei=We.flush();Oe=ei&&ei.buffer}if(!Oe)return l.executeEnd=Qt(),zr(s);c=new Uint8Array(Oe)}else return this.asyncResult=!0,this.decryptionPromise=We.webCryptoDecrypt(c,Re.key.buffer,Re.iv.buffer,tt).then(Oe=>{const Rt=this.push(Oe,null,s);return this.decryptionPromise=null,Rt}),this.decryptionPromise}const Ue=this.needsProbing(v,y);if(Ue){const We=this.configureTransmuxer(c);if(We)return this.logger.warn(`[transmuxer] ${We.message}`),this.observer.emit(w.ERROR,w.ERROR,{type:pe.MEDIA_ERROR,details:X.FRAG_PARSING_ERROR,fatal:!1,error:We,reason:We.message}),l.executeEnd=Qt(),zr(s)}(v||y||M||Ue)&&this.resetInitSegment(le,U,N,_e,n),(v||M||Ue)&&this.resetInitialTimestamp(te),m||this.resetContiguity();const _t=this.transmux(c,Re,D,S,s);this.asyncResult=ha(_t);const Ne=this.currentTransmuxState;return Ne.contiguous=!0,Ne.discontinuity=!1,Ne.trackSwitch=!1,l.executeEnd=Qt(),_t}flush(t){const n=t.transmuxing;n.executeStart=Qt();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=Qt();const y=[zr(t)];return this.asyncResult?Promise.resolve(y):y}const v=_.flush(p);return ha(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=Qt()}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=cs.length;y<S;y++){var c;if((c=cs[y].demux)!=null&&c.probe(t,this.logger)){l=cs[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 ar(this.config)),t}}function Ch(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 zr=h=>({remuxResult:{},chunkMeta:h});function ha(h){return"then"in h&&h.then instanceof Function}class Mh{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 ed{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 Rh=0;class ro{constructor(t,n,s,o){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Rh++,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:pe.OTHER_ERROR,details:X.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 to,this.observer.on(w.FRAG_DECRYPTED,c),this.observer.on(w.ERROR,c);const p=Vt(l.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const _=this.hls.logger;if(l.workerPath||Hl()){try{l.workerPath?(_.log(`loading Web Worker ${l.workerPath} for "${n}"`),this.workerContext=ih(l.workerPath)):(_.log(`injecting Web Worker for "${n}"`),this.workerContext=th());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:xi(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=Rh++;const n=this.hls.config,s=Vt(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:s,id:this.id,config:xi(n)})}}terminateWorker(){if(this.workerContext){const{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),al(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:D,transmuxer:M}=this,U=c?c.start:l.start,N=l.decryptdata,te=this.frag,_e=!(te&&l.cc===te.cc),le=!(te&&m.level===te.level),Re=te?m.sn-te.sn:-1,Ue=this.part?m.part-this.part.index:-1,_t=Re===0&&m.id>1&&m.id===(te==null?void 0:te.stats.chunkCount),Ne=!le&&(Re===1||Re===0&&(Ue===1||_t&&Ue<=0)),We=self.performance.now();(le||Re||l.stats.parsing.start===0)&&(l.stats.parsing.start=We),c&&(Ue||!Ne)&&(c.stats.parsing.start=We);const tt=!(te&&((y=l.initSegment)==null?void 0:y.url)===((S=te.initSegment)==null?void 0:S.url)),Oe=new ed(_e,Ne,_,le,U,tt);if(!Ne||_e||tt){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: ${le}
|
|
|
contiguous: ${Ne}
|
|
|
accurateTimeOffset: ${_}
|
|
|
timeOffset: ${U}
|
|
|
initSegmentChange: ${tt}`);const Rt=new Mh(s,o,n,p,v);this.configureTransmuxer(Rt)}if(this.frag=l,this.part=c,this.workerContext)this.workerContext.worker.postMessage({instanceNo:D,cmd:"demux",data:t,decryptdata:N,chunkMeta:m,state:Oe},t instanceof ArrayBuffer?[t]:[]);else if(M){const Rt=M.push(t,N,m,Oe);ha(Rt)?Rt.then(ei=>{this.handleTransmuxComplete(ei)}).catch(ei=>{this.transmuxerError(ei,m,"transmuxer-interface push error")}):this.handleTransmuxComplete(Rt)}}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);ha(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:pe.MEDIA_ERROR,details:X.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 Ls=100;class td extends Cn{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===st.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===st.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(),_=Si(c,l,p);_&&(this.log(`Syncing with main frag at ${_.start} cc ${_.cc}`),this.startFragRequested=!1,this.nextLoadPosition=_.start,this.resetLoadingState(),this.state===st.IDLE&&this.doTickIdle())}startLoad(t,n){if(!this.levels){this.startPosition=t,this.state=st.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Ls),s>0&&t===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),t=s,this.state=st.IDLE):this.state=st.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}doTick(){switch(this.state){case st.IDLE:this.doTickIdle();break;case st.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=st.WAITING_INIT_PTS}break}case st.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=st.IDLE}break}case st.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=st.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=st.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=st.WAITING_TRACK,this.startFragRequested=!1;return}const m=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&m&&(this.bufferFlushed=!1,this.afterBufferFlushed(m,G.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=st.ENDED;return}const y=v.len,S=n.maxBufferLength,D=_.fragments,M=D[0].start,U=this.getLoadPosition(),N=this.flushing?U:v.end;if(this.switchingTrack&&o){const le=U;_.PTSKnown&&le<M&&(v.end>M||v.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),o.currentTime=M+.05)}if(y>=S&&!this.switchingTrack&&N<D[D.length-1].start)return;let te=this.getNextFragment(N,_);if(te&&this.isLoopLoading(te,N)&&(te=this.getNextFragmentLoopLoading(te,_,v,P.MAIN,S)),!te){this.bufferFlushed=!0;return}let _e=((t=this.mainFragLoading)==null?void 0:t.frag)||null;if(!this.audioOnly&&this.startFragRequested&&_e&&ze(te)&&!te.endList&&(!_.live||!this.loadingParts&&N<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(_e)===Ki.OK&&(this.mainFragLoading=_e=null),_e&&ze(_e))){if(te.start>_e.end){const Re=this.fragmentTracker.getFragAtPos(N,P.MAIN);Re&&Re.end>_e.end&&(_e=Re,this.mainFragLoading={frag:Re,targetBufferTime:null})}if(te.start>_e.end)return}this.loadFragment(te,p,N)}onMediaDetaching(t,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(t,n)}onAudioTracksUpdated(t,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(s=>new sn(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!==st.STOPPED&&(this.setInterval(Ls),this.state=st.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!==st.STOPPED&&(this.state=st.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||(Qa(l,m),l.alignedSliding||ra(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===st.WAITING_TRACK&&!this.waitForCdnTuneIn(l)&&(this.state=st.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 ro(this.hls,P.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const D=this.initPTS[s.cc],M=(n=s.initSegment)==null?void 0:n.data;if(D!==void 0){const N=o?o.index:-1,te=N!==-1,_e=new or(s.level,s.sn,s.stats.chunkCount,l.byteLength,N,te);S.push(l,M,y,"",s,o,v.totalduration,!1,_e,D)}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:U}=this.waitingData=this.waitingData||{frag:s,part:o,cache:new Ur,complete:!1};U.push(new Uint8Array(l)),this.state!==st.STOPPED&&(this.state=st.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(t){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(t,n){this.bufferFlushed=this.flushing=!1;const s=n.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(t,n){!this.audioOnly&&n.frag.type===P.MAIN&&ze(n.frag)&&(this.mainFragLoading=n,this.state===st.IDLE&&this.tick())}onFragBuffered(t,n){const{frag:s,part:o}=n;if(s.type!==P.AUDIO){!this.audioOnly&&s.type===P.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${o?" p: "+o.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(ze(s)){this.fragPrevious=s;const l=this.switchingTrack;l&&(this.bufferedTrack=l,this.switchingTrack=null,this.hls.trigger(w.AUDIO_TRACK_SWITCHED,C({},l)))}this.fragBufferedComplete(s,o),this.media&&this.tick()}onError(t,n){var s;if(n.fatal){this.state=st.ERROR;return}switch(n.details){case X.FRAG_GAP:case X.FRAG_PARSING_ERROR:case X.FRAG_DECRYPT_ERROR:case X.FRAG_LOAD_ERROR:case X.FRAG_LOAD_TIMEOUT:case X.KEY_LOAD_ERROR:case X.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.AUDIO,n);break;case X.AUDIO_TRACK_LOAD_ERROR:case X.AUDIO_TRACK_LOAD_TIMEOUT:case X.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===st.WAITING_TRACK&&((s=n.context)==null?void 0:s.type)===Ae.AUDIO_TRACK&&(this.state=st.IDLE);break;case X.BUFFER_ADD_CODEC_ERROR:case X.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)||this.resetLoadingState();break;case X.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case X.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(t,{type:n}){n!==G.VIDEO&&(this.flushing=!0)}onBufferFlushed(t,{type:n}){if(n!==G.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===st.ENDED&&(this.state=st.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:D,id3:M,initSegment:U}=l;if(this.fragContextChanged(_)||!y){this.fragmentTracker.removeFragment(_);return}if(this.state=st.PARSING,this.switchingTrack&&S&&this.completeAudioSwitch(this.switchingTrack),U!=null&&U.tracks){const N=_.initSegment||_;this._bufferInitSegment(v,U.tracks,N,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:s,tracks:U.tracks})}if(S){const{startPTS:N,endPTS:te,startDTS:_e,endDTS:le}=S;m&&(m.elementaryStreams[G.AUDIO]={startPTS:N,endPTS:te,startDTS:_e,endDTS:le}),_.setElementaryStreamInfo(G.AUDIO,N,te,_e,le),this.bufferFragmentData(S,_,m,c)}if(M!=null&&(n=M.samples)!=null&&n.length){const N=k({id:s,frag:_,details:y},M);o.trigger(w.FRAG_PARSING_METADATA,N)}if(D){const N=k({id:s,frag:_,details:y},D);o.trigger(w.FRAG_PARSING_USERDATA,N)}}_bufferInitSegment(t,n,s,o){if(this.state!==st.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===Ki.NOT_LOADED||o===Ki.PARTIAL){var l;if(!ze(t))this._loadInitSegment(t,n);else if((l=n.details)!=null&&l.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=st.WAITING_INIT_PTS;const c=this.mainDetails;c&&c.fragmentStart!==n.details.fragmentStart&&ra(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;gt({name:n,lang:s,assocLang:o,characteristics:l,audioCodec:c,channels:p},t,nt)||(Zt(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,C({},t))}}class js extends H{constructor(t,n){super(n,t.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=t}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(t,n,s){const o=n==null?void 0:n.renditionReports;if(o){let l=-1;for(let c=0;c<o.length;c++){const 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&&Li(s);return new zi(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){Vl(s,o);const _e=o.playlistParsingError;if(_e){this.warn(_e);const le=this.hls;if(!le.config.ignorePlaylistParsingErrors){var m;const{networkDetails:Re}=n;le.trigger(w.ERROR,{type:pe.NETWORK_ERROR,details:X.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:Re,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,D=(o.edge-S)*1e3,M=ko(o,D);if(o.requestScheduled+M<c?o.requestScheduled=c:o.requestScheduled+=M,this.log(`live playlist ${t} ${o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:o.updated?"UPDATED":"MISSED"}`),!this.canLoad||!o.live)return;let U,N,te;if(o.canBlockReload&&o.endSN&&o.advanced){const _e=this.hls.config.lowLatencyMode,le=o.lastPartSn,Re=o.endSN,Ue=o.lastPartIndex,_t=Ue!==-1,Ne=le===Re;_t?Ne?(N=Re+1,te=_e?0:Ue):(N=le,te=_e?Ue+1:o.maxPartIndex):N=Re+1;const We=o.age,tt=We+o.ageHeader;let Oe=Math.min(tt-o.partTarget,o.targetduration*1.5);if(Oe>0){if(tt>o.targetduration*3)this.log(`Playlist last advanced ${We.toFixed(2)}s ago. Omitting segment and part directives.`),N=void 0,te=void 0;else if(s!=null&&s.tuneInGoal&&tt-o.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${Oe} with playlist age: ${o.age}`),Oe=0;else{const Rt=Math.floor(Oe/o.targetduration);if(N+=Rt,te!==void 0){const ei=Math.round(Oe%o.targetduration/o.partTarget);te+=ei}this.log(`CDN Tune-in age: ${o.ageHeader}s last advanced ${We.toFixed(2)}s goal: ${Oe} skip sn ${Rt} to part ${te}`)}o.tuneInGoal=Oe}if(U=this.getDeliveryDirectives(o,n.deliveryDirectives,N,te),_e||!Ne){o.requestScheduled=c,this.loadingPlaylist(v,U);return}}else(o.canBlockReload||o.canSkipUntil)&&(U=this.getDeliveryDirectives(o,n.deliveryDirectives,N,te));U&&N!==void 0&&o.canBlockReload&&(o.requestScheduled=l.loading.first+Math.max(M-p*2,M/2)),this.scheduleLoading(v,U,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=Li(t);return n!=null&&n.skip&&t.deltaUpdateFailed&&(s=n.msn,o=n.part,l=er.No),new zi(s,o,l)}checkRetry(t){const n=t.details,s=Di(t),o=t.errorAction,{action:l,retryCount:c=0,retryConfig:p}=o||{},_=!!o&&!!p&&(l===Fi.RetryRequest||!o.resolved&&l===Fi.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=$i(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 gc(h,t){if(h.length!==t.length)return!1;for(let n=0;n<h.length;n++)if(!so(h[n].attrs,t[n].attrs))return!1;return!0}function so(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 ml(h,t){return t.label.toLowerCase()===h.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(h.lang||"").toLowerCase())}class Ih extends js{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,D)=>{S.id=D});else if(!l&&!this.tracksInGroup.length)return;this.tracksInGroup=p;const _=this.hls.config.audioPreference;if(!l&&_){const S=et(_,p,nt);if(S>-1)l=p[S];else{const D=et(_,this.tracks);l=this.tracks[D]}}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:pe.MEDIA_ERROR,details:X.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:S})}}}onError(t,n){n.fatal||!n.context||n.context.type===Ae.AUDIO_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const n=this.hls;if(n.config.audioPreference=t,t){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const o=this.currentTrack;if(o&>(t,o,nt))return o;const l=et(t,this.tracksInGroup,nt);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=dt(t,n.levels,s,c,nt);if(p===-1)return null;n.nextLoadLevel=p}if(t.channels||t.audioCodec){const c=et(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,C({},o)),l))return;const c=this.switchParams(o.url,s==null?void 0:s.details,o.details);this.loadPlaylist(c)}findTrackId(t){const n=this.tracksInGroup;for(let s=0;s<n.length;s++){const o=n[s];if(!(this.selectDefaultTrack&&!o.default)&&(!t||gt(t,o,nt)))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(gt({name:s,lang:o,assocLang:l,characteristics:c,audioCodec:p,channels:_},v,nt))return m}for(let m=0;m<n.length;m++){const v=n[m];if(so(t.attrs,v.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return m}for(let m=0;m<n.length;m++){const v=n[m];if(so(t.attrs,v.attrs,["LANGUAGE"]))return m}}return-1}loadPlaylist(t){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&Zt(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 Io{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 ou=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,lu="HlsJsTrackRemovedError";class Ph extends Error{constructor(t){super(t),this.name=lu}}class id extends H{constructor(t,n){super("buffer-controller",t.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var o;this.hls&&((o=this.mediaSource)==null?void 0:o.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:o,mediaSource:l}=this;s&&this.log("Media source opened"),!(!o||!l)&&(l.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(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=je(Ee(t.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:t}=this;t.on(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=Ee(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),nd(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: ${xi(s,(_,m)=>_==="initSegment"?void 0:m)};
|
|
|
transfer tracks: ${xi(o,(_,m)=>_==="initSegment"?void 0:m)}}`),!Ke(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,D=v.id;if(S.hasFragments(D)||S.hasParts(D)){const N=si.getBuffered(y);S.detectEvictedFragments(m,N,D,null,!0)}const M=Po(m),U=[m,y];this.sourceBuffers[M]=U,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[Po(t)]=[null,null];const n=this.tracks[t];n&&(n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Io(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:D,levelCodec:M,container:U,metadata:N,supplemental:te}=y;let _e=s[p];const le=(_=this.transferData)==null||(m=_.tracks)==null?void 0:m[p],Re=le!=null&&le.buffer?le:_e,Ue=(Re==null?void 0:Re.pendingCodec)||(Re==null?void 0:Re.codec),_t=Re==null?void 0:Re.levelCodec;_e||(_e=s[p]={buffer:void 0,listeners:[],codec:D,supplemental:te,container:U,levelCodec:M,metadata:N,id:S});const Ne=ve(Ue,_t),We=Ne==null?void 0:Ne.replace(ou,"$1");let tt=ve(D,M);const Oe=(v=tt)==null?void 0:v.replace(ou,"$1");tt&&Ne&&We!==Oe&&(p.slice(0,5)==="audio"&&(tt=ae(tt,this.appendSource)),this.log(`switching codec ${Ue} to ${tt}`),tt!==(_e.pendingCodec||_e.codec)&&(_e.pendingCodec=tt),_e.container=U,this.appendChangeType(p,U,tt))}),(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&&si.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,offset:v}=n,y=m.buffering[l],{sn:S,cc:D}=p,M=self.performance.now();y.start=M;const U=p.stats.buffering,N=_?_.stats.buffering:null;U.start===0&&(U.start=M),N&&N.start===0&&(N.start=M);const te=s.audio;let _e=!1;l==="audio"&&(te==null?void 0:te.container)==="audio/mpeg"&&(_e=!this.lastMpegAudioChunk||m.id===1||this.lastMpegAudioChunk.sn!==m.sn,this.lastMpegAudioChunk=m);const le=s.video,Re=le==null?void 0:le.buffer;if(Re&&S!=="initSegment"){const Ne=_||p,We=this.blockedAudioAppend;if(l==="audio"&&c!=="main"&&!this.blockedAudioAppend){const Oe=Ne.start+Ne.duration*.05,Rt=Re.buffered,ei=this.currentOp("video");!Rt.length&&!ei?this.blockAudio(Ne):!ei&&!si.isBuffered(Re,Oe)&&this.lastVideoAppendEnd<Oe&&this.blockAudio(Ne)}else if(l==="video"){const tt=Ne.end;if(We){const Oe=We.frag.start;(tt>Oe||tt<this.lastVideoAppendEnd||si.isBuffered(Re,Oe))&&this.unblockAudio()}this.lastVideoAppendEnd=tt}}const Ue=(_||p).start,_t={label:`append-${l}`,execute:()=>{var Ne;y.executeStart=self.performance.now();const We=(Ne=this.tracks[l])==null?void 0:Ne.buffer;We&&(_e?this.updateTimestampOffset(We,Ue,.1,l,S,D):v!==void 0&&ue(v)&&this.updateTimestampOffset(We,v,1e-6,l,S,D)),this.appendExecutor(o,l)},onStart:()=>{},onComplete:()=>{const Ne=self.performance.now();y.executeEnd=y.end=Ne,U.first===0&&(U.first=Ne),N&&N.first===0&&(N.first=Ne);const We={};this.sourceBuffers.forEach(([tt,Oe])=>{tt&&(We[tt]=si.getBuffered(Oe))}),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:We})},onError:Ne=>{var We;const tt={type:pe.MEDIA_ERROR,parent:p.type,details:X.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:p,part:_,chunkMeta:m,error:Ne,err:Ne,fatal:!1},Oe=(We=this.media)==null?void 0:We.error;if(Ne.code===DOMException.QUOTA_EXCEEDED_ERR||Ne.name=="QuotaExceededError"||"quota"in Ne)tt.details=X.BUFFER_FULL_ERROR;else if(Ne.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Oe)tt.errorAction=$n(!0);else if(Ne.name===lu&&this.sourceBufferCount===0)tt.errorAction=$n(!0);else{const Rt=++this.appendErrors[l];this.warn(`Failed ${Rt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${l}" sourceBuffer (${Oe||"no media error"})`),(Rt>=this.hls.config.appendErrorMaxRetry||Oe)&&(tt.fatal=!0)}this.hls.trigger(w.ERROR,tt)}};this.append(_t,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[G.AUDIOVIDEO]?l.push("audiovideo"):(c[G.AUDIO]&&l.push("audio"),c[G.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(){this.blockUntilOpen(()=>{const t=this.getDurationAndRange();t&&this.updateMediaSource(t)})}onError(t,n){if(n.details===X.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=si.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=si.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}) ${xi(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:pe.MEDIA_ERROR,details:X.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":""} ${xi(p)}`);try{const v=s.addSourceBuffer(m),y=Po(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:pe.MEDIA_ERROR,details:X.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")&&Xt(s,"video")&&(o=ce(o,s));const l=ve(o,t.levelCodec);return l?n.slice(0,5)==="audio"?ae(l,this.appendSource):l:""}trackSourceBuffer(t,n){const s=n.buffer;if(!s)return;const o=this.getTrackCodec(n,t);this.tracks[t]={buffer:s,codec:o,container:n.container,levelCodec:n.levelCodec,supplemental:n.supplemental,metadata:n.metadata,id:n.id,listeners:[]},this.removeBufferListeners(t),this.addBufferListener(t,"updatestart",this.onSBUpdateStart),this.addBufferListener(t,"updateend",this.onSBUpdateEnd),this.addBufferListener(t,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(t,"bufferedchange",(l,c)=>{const 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:pe.MEDIA_ERROR,details:X.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:o,fatal:!1});const l=this.currentOp(t);l&&l.onError(o)}updateTimestampOffset(t,n,s,o,l,c){const p=n-t.timestampOffset;Math.abs(p)>=s&&(this.log(`Updating ${o} SourceBuffer timestampOffset to ${n} (sn: ${l} cc: ${c})`),t.timestampOffset=n)}removeExecutor(t,n,s){const{media:o,mediaSource:l}=this,c=this.tracks[t],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 Ph(`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 nd(h,t){const n=self.document.createElement("source");n.type="video/mp4",n.src=t,h.appendChild(n)}function Po(h){return h==="audio"?1:0}class _c{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,_c.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 is={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},sd={HLS:"h"},Qi={OBJECT:"CMCD-Object",REQUEST:"CMCD-Request",SESSION:"CMCD-Session",STATUS:"CMCD-Status"},Xn={[Qi.OBJECT]:["br","ab","d","ot","tb","tpb","lb","tab","lab","url"],[Qi.REQUEST]:["pb","bl","tbl","dl","ltc","mtp","nor","nrr","rc","sn","sta","su","ttfb","ttfbb","ttlb","cmsdd","cmsds","smrt","df","cs"],[Qi.SESSION]:["cid","pr","sf","sid","st","v","msd"],[Qi.STATUS]:["bs","bsd","cdn","rtp","bg","pt","ec","e"]};class Ds{constructor(t,n){Array.isArray(t)&&(t=t.map(s=>s instanceof Ds?s:new Ds(s))),this.value=t,this.params=n}}const Fh="Dict";function ys(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 Bh(h,t,n,s){return new Error(`failed to ${h} "${ys(t)}" as ${n}`,{cause:s})}function Vr(h,t,n){return Bh("serialize",h,t,n)}class bc{constructor(t){this.description=t}}const Nh="Bare Item",od="Boolean";function xc(h){if(typeof h!="boolean")throw Vr(h,od);return h?"?1":"?0"}function gl(h){return btoa(String.fromCharCode(...h))}const _l="Byte Sequence";function $t(h){if(ArrayBuffer.isView(h)===!1)throw Vr(h,_l);return`:${gl(h)}:`}const wc="Integer";function uu(h){return h<-999999999999999||999999999999999<h}function vl(h){if(uu(h))throw Vr(h,wc);return h.toString()}function cu(h){return`@${vl(h.getTime()/1e3)}`}function $h(h,t){if(h<0)return-$h(-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 ld="Decimal";function ud(h){const t=$h(h,3);if(Math.floor(Math.abs(t)).toString().length>12)throw Vr(h,ld);const n=t.toString();return n.includes(".")?n:`${n}.0`}const xr="String",cd=/[\x00-\x1f\x7f]+/;function Sc(h){if(cd.test(h))throw Vr(h,xr);return`"${h.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function hu(h){return h.description||h.toString().slice(7,-1)}const fu="Token";function Aa(h){const t=hu(h);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw Vr(t,fu);return t}function La(h){switch(typeof h){case"number":if(!ue(h))throw Vr(h,Nh);return Number.isInteger(h)?vl(h):ud(h);case"string":return Sc(h);case"symbol":return Aa(h);case"boolean":return xc(h);case"object":if(h instanceof Date)return cu(h);if(h instanceof Uint8Array)return $t(h);if(h instanceof bc)return Aa(h);default:throw Vr(h,Nh)}}const bs="Key";function fa(h){if(/^[a-z*][a-z0-9\-_.*]*$/.test(h)===!1)throw Vr(h,bs);return h}function Fr(h){return h==null?"":Object.entries(h).map(([t,n])=>n===!0?`;${fa(t)}`:`;${fa(t)}=${La(n)}`).join("")}function da(h){return h instanceof Ds?`${La(h.value)}${Fr(h.params)}`:La(h)}function yl(h){return`(${h.value.map(da).join(" ")})${Fr(h.params)}`}function qs(h,t={whitespace:!0}){if(typeof h!="object")throw Vr(h,Fh);const n=h instanceof Map?h.entries():Object.entries(h),s=t!=null&&t.whitespace?" ":"";return Array.from(n).map(([o,l])=>{l instanceof Ds||(l=new Ds(l));let c=fa(o);return l.value===!0?c+=Fr(l.params):(c+="=",Array.isArray(l.value)?c+=yl(l):c+=da(l)),c}).join(`,${s}`)}function Kh(h,t){return qs(h,t)}function Uh(h){return["ot","sf","st","e","sta"].includes(h)}function Ec(h){return typeof h=="number"?ue(h):h!=null&&h!==""&&h!==!1}function hd(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 wr=h=>Math.round(h),Zs=(h,t)=>(t!=null&&t.baseUrl&&(h=hd(h,t.baseUrl)),encodeURIComponent(h)),du=h=>wr(h/100)*100,zh={br:wr,d:wr,bl:du,dl:du,mtp:du,nor:Zs,rtp:du,tb:wr};function kc(h,t){const n={};if(h==null||typeof h!="object")return n;const s=Object.keys(h).sort(),o=k({},zh,t==null?void 0:t.formatters),l=t==null?void 0:t.filter;return s.forEach(c=>{if((l==null?void 0:l(c))===!1)return;let p=h[c];const _=o[c];_&&(p=_(p,t)),!(c==="v"&&p===1)&&(c=="pr"&&p===1||Ec(p)&&(Uh(c)&&typeof p=="string"&&(p=new bc(p)),n[c]=p))}),n}function ln(h,t={}){return h?Kh(kc(h,t),k({whitespace:!1},t)):""}function Oo(h,t={}){const n={};if(!h)return n;const s=Object.entries(h),o=Object.entries(Xn).concat(Object.entries((t==null?void 0:t.customHeaderMap)||{})),l=s.reduce((c,p)=>{var _,m;const[v,y]=p,S=((_=o.find(D=>D[1].includes(v)))===null||_===void 0?void 0:_[0])||Qi.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]=ln(_,t),c),n)}function ao(h,t,n){return k(h,Oo(t,n))}const pu="CMCD";function ct(h,t={}){if(!h)return"";const n=ln(h,t);return`${pu}=${encodeURIComponent(n)}`}const Vh=/CMCD=[^&#]+/;function fd(h,t,n){const s=ct(t,n);if(!s)return h;if(Vh.test(h))return h.replace(Vh,s);const o=h.includes("?")?"&":"?";return`${h}${o}${s}`}class Tc{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:is.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:_};(_===is.VIDEO||_===is.AUDIO||_==is.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:sd.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===is.INIT||n.ot===is.VIDEO||n.ot===is.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={}),ao(t.headers,n,l)):t.url=fd(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 is.TIMED_TEXT;if(t.sn==="initSegment")return is.INIT;if(n==="audio")return is.AUDIO;if(n==="main")return this.hls.audioTracks.length?is.VIDEO:is.MUXED}getTopBandwidth(t){let n=0,s;const o=this.hls;if(t===is.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===is.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!n?NaN:si.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 dd=3e5;class bl extends H{constructor(t){super("content-steering",t.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(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)===Fi.SendAlternateToPenaltyBox&&s.flags===un.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),n.details===X.BUFFER_APPEND_ERROR&&!n.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${c} levels: ${o&&o.length} priorities: ${xi(l)} penalized: ${xi(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]>dd&&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,nl(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===Ae.AUDIO_TRACK&&o[l].hasAudioGroup(t)||n===Ae.SUBTITLE_TRACK&&o[l].hasSubtitleGroup(t))return o[l].pathwayId;return s}clonePathways(t){const n=this.levels;if(!n)return;const s={},o={};t.forEach(l=>{const{ID:c,"BASE-ID":p,"URI-REPLACEMENT":_}=l;if(n.some(v=>v.pathwayId===c))return;const m=this.getLevelsForPathway(p).map(v=>{const y=new Ri(v.attrs);y["PATHWAY-ID"]=c;const S=y.AUDIO&&`${y.AUDIO}_clone_${c}`,D=y.SUBTITLES&&`${y.SUBTITLES}_clone_${c}`;S&&(s[y.AUDIO]=S,y.AUDIO=S),D&&(o[y.SUBTITLES]=D,y.SUBTITLES=D);const M=Hh(v.uri,y["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",_),U=new sn({attrs:y,audioCodec:v.audioCodec,bitrate:v.bitrate,height:v.height,name:v.name,url:M,videoCodec:v.videoCodec,width:v.width});if(v.audioGroups)for(let N=1;N<v.audioGroups.length;N++)U.addGroupId("audio",`${v.audioGroups[N]}_clone_${c}`);if(v.subtitleGroups)for(let N=1;N<v.subtitleGroups.length;N++)U.addGroupId("text",`${v.subtitleGroups[N]}_clone_${c}`);return U});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,D)=>{this.log(`Loaded steering manifest: "${o}"`);const M=v.data;if((M==null?void 0:M.VERSION)!==1){this.log(`Steering VERSION ${M.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=M.TTL;const{"RELOAD-URI":U,"PATHWAY-CLONES":N,"PATHWAY-PRIORITY":te}=M;if(U)try{this.uri=new self.URL(U,o).href}catch(le){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${U}`);return}this.scheduleRefresh(this.uri||S.url),N&&this.clonePathways(N);const _e={steeringManifest:M,url:o.toString()};this.hls.trigger(w.STEERING_MANIFEST_LOADED,_e),te&&this.updatePathwayPriority(te)},onError:(v,y,S,D)=>{if(this.log(`Error loading steering manifest: ${v.code} ${v.text} (${y.url})`),this.stopLoad(),v.code===410){this.enabled=!1,this.log(`Steering manifest ${y.url} no longer available`);return}let M=this.timeToLoad*1e3;if(v.code===429){const U=this.loader;if(typeof(U==null?void 0:U.getResponseHeader)=="function"){const N=U.getResponseHeader("Retry-After");N&&(M=parseFloat(N)*1e3)}this.log(`Steering manifest ${y.url} rate limited`);return}this.scheduleRefresh(this.uri||y.url,M)},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 Ri(p.attrs),p.url=p.attrs.URI=Hh(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 Hh(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 Hn(h,t,n){Br(h,t,n),h.addEventListener(t,n)}function Br(h,t,n){h.removeEventListener(t,n)}class pa extends H{constructor(t){super("eme",t.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=pa.CDMCleanupPromise?[pa.CDMCleanupPromise]:[],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.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===Ji.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 ns?p(y):p(new ns({type:pe.KEY_SYSTEM_ERROR,details:X.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 ta===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=Us(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: ${xi(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: ${ee.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 ee.hexDump(t.keyId)}updateKeySession(t,n){var s;const o=t.mediaKeysSession;return this.log(`Updating key-session "${o.sessionId}" for keyID ${ee.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})=>ls(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=ls(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=Es(this.config),s=t.map(Qr).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 ns?this.hls.trigger(w.ERROR,t.data):this.hls.trigger(w.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:X.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))}getKeySystemForKeyPromise(t){const n=this.getKeyIdString(t),s=this.keyIdToKeySessionPromise[n];if(!s){const o=Qr(t.keyFormat),l=o?[o]:Es(this.config);return this.attemptKeySystemAccess(l)}return s}getKeySystemSelectionPromise(t){if(t.length||(t=Es(this.config)),t.length===0)throw new ns({type:pe.KEY_SYSTEM_ERROR,details:X.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${xi({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 M=p.call(this.hls,n,s,t);if(!M)throw new Error("Invalid response from configured generateRequest filter");n=M.initDataType,s=M.initData?M.initData:null,t.decryptdata.pssh=s?new Uint8Array(s):null}catch(M){var _;if(this.warn(M.message),(_=this.hls)!=null&&_.config.debug)throw M}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 to,y=t._onmessage=M=>{const U=t.mediaKeysSession;if(!U){v.emit("error",new Error("invalid state"));return}const{messageType:N,message:te}=M;this.log(`"${N}" message event for session "${U.sessionId}" message size: ${te.byteLength}`),N==="license-request"||N==="license-renewal"?this.renewLicense(t,te).catch(_e=>{v.eventNames().length?v.emit("error",_e):this.handleError(_e)}):N==="license-release"?t.keySystem===Ji.FAIRPLAY&&(this.updateKeySession(t,Yn("acknowledged")),this.removeSession(t)):this.warn(`unhandled media key message type "${N}"`)},S=t._onkeystatuseschange=M=>{if(!t.mediaKeysSession){v.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(t);const N=t.keyStatus;v.emit("keyStatus",N),N==="expired"&&(this.warn(`${t.keySystem} expired for key ${m}`),this.renewKeySession(t))};Hn(t.mediaKeysSession,"message",y),Hn(t.mediaKeysSession,"keystatuseschange",S);const D=new Promise((M,U)=>{v.on("error",U),v.on("keyStatus",N=>{N.startsWith("usable")?M():N==="output-restricted"?U(new ns({type:pe.KEY_SYSTEM_ERROR,details:X.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):N==="internal-error"?U(new ns({type:pe.KEY_SYSTEM_ERROR,details:X.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${N}"`)):N==="expired"?U(new Error("key expired while generating request")):this.warn(`unhandled key status change "${N}"`)})});return t.mediaKeysSession.generateRequest(n,s).then(()=>{var M;this.log(`Request generated for key-session "${(M=t.mediaKeysSession)==null?void 0:M.sessionId}" keyId: ${m}`)}).catch(M=>{throw new ns({type:pe.KEY_SYSTEM_ERROR,details:X.KEY_SYSTEM_NO_SESSION,error:M,fatal:!1},`Error generating key-session request: ${M}`)}).then(()=>D).catch(M=>{throw v.removeAllListeners(),this.removeSession(t),M}).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: ${ee.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${ee.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,D,M,U)=>{c(S.data)},onError:(S,D,M,U)=>{p(new ns({type:pe.KEY_SYSTEM_ERROR,details:X.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:M,response:C({url:_.url,data:void 0},S)},`"${t}" certificate request failed (${l}). Status: ${S.code} (${S.text})`))},onTimeout:(S,D,M)=>{p(new ns({type:pe.KEY_SYSTEM_ERROR,details:X.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:M,response:{url:_.url,data:void 0}},`"${t}" certificate request timed out (${l})`))},onAbort:(S,D,M)=>{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 ns({type:pe.KEY_SYSTEM_ERROR,details:X.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 ns({type:pe.KEY_SYSTEM_ERROR,details:X.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 D=(c=v.querySelector("name"))==null?void 0:c.textContent,M=(p=v.querySelector("value"))==null?void 0:p.textContent;D&&M&&t.setRequestHeader(D,M)}}const _=o.querySelector("Challenge"),m=_==null?void 0:_.textContent;if(!m)throw new Error("Cannot find <Challenge> in key message");return Yn(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 ns({type:pe.KEY_SYSTEM_ERROR,details:X.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==Ji.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,Hn(s,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media;t&&(Br(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,Gn.clearKeyUriToKeyIdMap();const o=s.length;pa.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:pe.OTHER_ERROR,details:X.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:pe.OTHER_ERROR,details:X.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(ci(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:pe.OTHER_ERROR,details:X.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:pe.OTHER_ERROR,details:X.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${p}`)})})}}}pa.CDMCleanupPromise=void 0;class ns 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 pd{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 Wh(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 mu(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 oo(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 Fo(h,t,n,s){const o=h.mode;if(o==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0){const l=lo(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 rs(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 lo(h,t,n){const s=[],o=rs(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 xl(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 jh extends js{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=xl(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;xl(s.textTracks).forEach(c=>{oo(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=et(p,c);if(v>-1)l=c[v];else{const y=et(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||gt(l,t)))return o}if(t){for(let o=0;o<n.length;o++){const l=n[o];if(so(t.attrs,l.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return o}for(let o=0;o<n.length;o++){const l=n[o];if(so(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(ml(o,t))return s}}return-1}onError(t,n){n.fatal||!n.context||n.context.type===Ae.SUBTITLE_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}setSubtitleOption(t){if(this.hls.config.subtitlePreference=t,t){if(t.id===-1)return this.setSubtitleTrack(-1),null;const n=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,n.length){const s=this.currentTrack;if(s&>(t,s))return s;const o=et(t,this.tracksInGroup);if(o>-1){const l=this.tracksInGroup[o];return this.setSubtitleTrack(o),l}else{if(s)return null;{const l=et(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=xl(t.textTracks),s=this.currentTrack;let o;if(s&&(o=n.filter(l=>ml(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 Ac(){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 wl(h){let t=5381,n=h.length;for(;n;)t=t*33^h.charCodeAt(--n);return(t>>>0).toString()}const Bo=.025;let gu=function(h){return h[h.Point=0]="Point",h[h.Range=1]="Range",h}({});function md(h,t,n){return`${h.identifier}-${n+1}-${wl(t)}`}class qh{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 Bn(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=Bn(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 Bn(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)<Bo))}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"?gu.Range:gu.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 uo(this)}}function Bn(h,t){return h-t.start<t.duration/2&&!(Math.abs(h-(t.start+t.duration))<Bo)?t.start:t.start+t.duration}function Zh(h,t,n){const s=new self.URL(h,n);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",t),s}function Lc(h,t){for(;(n=h.assetList[++t])!=null&&n.error;)var n;return t}function uo(h){return`["${h.identifier}" ${h.cue.pre?"<pre>":h.cue.post?"<post>":""}${h.timelineStart.toFixed(2)}-${h.resumeTime.toFixed(2)}]`}function No(h){const t=h.timelineStart,n=h.duration||0;return`["${h.identifier}" ${t.toFixed(2)}-${(t+n).toFixed(2)}]`}class Sl{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=Zh(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=si.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=si.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: ${No(this.assetItem)} ${(t=this.hls)==null?void 0:t.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Yh=.033;class Xh extends H{constructor(t,n){super("interstitials-sched",n),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=t}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(t=>t.reset()),this.events=this.items=null}resetErrorsInRange(t,n){return this.events?this.events.reduce((s,o)=>t<=o.startOffset&&n>o.startOffset?(delete o.error,s+1):s,0):0}get duration(){const t=this.items;return t?t[t.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(t){return t&&this.eventMap[t]||null}hasEvent(t){return t in this.eventMap}findItemIndex(t,n){if(t.event)return this.findEventIndex(t.event.identifier);let s=-1;t.nextEvent?s=this.findEventIndex(t.nextEvent.identifier)-1:t.previousEvent&&(s=this.findEventIndex(t.previousEvent.identifier)+1);const o=this.items;if(o)for(o[s]||(n===void 0&&(n=t.start),s=this.findItemIndexAtTime(n));s>=0&&(l=o[s])!=null&&l.event;){var l;s--}return s}findItemIndexAtTime(t,n){const s=this.items;if(s)for(let o=0;o<s.length;o++){let l=s[o];if(n&&n!=="primary"&&(l=l[n]),t===l.start||t>l.start&&t<l.end)return o}return-1}findJumpRestrictedIndex(t,n){const s=this.items;if(s)for(let o=t;o<=n&&s[o];o++){const l=s[o].event;if(l!=null&&l.restrictions.jump&&!l.appendInPlace)return o}return-1}findEventIndex(t){const n=this.items;if(n)for(let o=n.length;o--;){var s;if(((s=n[o].event)==null?void 0:s.identifier)===t)return o}return-1}findAssetIndex(t,n){const s=t.assetList,o=s.length;if(o>1)for(let l=0;l<o;l++){const c=s[l];if(!c.error){const 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,D=v.cue.pre,M=v.cue.post;if(y&&!D)return-1;if(D&&!y||S&&!M)return 1;if(M&&!S)return-1;if(!y&&!D&&!S&&!M){const U=m.startTime,N=v.startTime;if(U!==N)return U-N}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 qh(_,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,D=v.cue.post,M=t[y-1]||null,U=v.appendInPlace,N=D?l:v.startOffset,te=v.duration,_e=v.timelineOccupancy===gu.Range?te:0,le=v.resumptionOffset,Re=(M==null?void 0:M.startTime)===N,Ue=N+v.cumulativeDuration;let _t=U?Ue+te:N+le;if(S||!D&&N<=0){const We=m;m+=_e,v.timelineStart=Ue;const tt=c;c+=te,s.push({event:v,start:Ue,end:_t,playout:{start:tt,end:c},integrated:{start:We,end:m}})}else if(N<=l){if(!Re){const Oe=N-_;if(Oe>Yh){const Rt=_,ei=m;m+=Oe;const pi=c;c+=Oe;const yi={previousEvent:t[y-1]||null,nextEvent:v,start:Rt,end:Rt+Oe,playout:{start:pi,end:c},integrated:{start:ei,end:m}};s.push(yi)}else Oe>0&&M&&(M.cumulativeDuration+=Oe,s[s.length-1].end=N)}D&&(_t=Ue),v.timelineStart=Ue;const We=m;m+=_e;const tt=c;c+=te,s.push({event:v,start:Ue,end:_t,playout:{start:tt,end:c},integrated:{start:We,end:m}})}else return;const Ne=v.resumeTime;D||Ne>l?_=l:_=Ne}),_<l){var p;const v=_,y=m,S=l-_;m+=S;const D=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:D,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=Ai(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<Yh&&(t[_+1].appendInPlace=!1,t[_+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${p}`));const D=ue(p.resumeOffset)?p.resumeOffset:p.duration;l+=D})}primaryCanResumeInPlaceAt(t,n){const s=t.resumeTime,o=t.startTime+t.resumptionOffset;return Math.abs(s-o)>Bo?(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=Ai(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)<Bo+v||Math.abs(m.end-s)<Bo+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 ma(h){return`[${h.event?'"'+h.event.identifier+'"':"primary"}: ${h.start.toFixed(2)}-${h.end.toFixed(2)}]`}class El{constructor(t){this.hls=void 0,this.hls=t}destroy(){this.hls=null}loadAssetList(t,n){const s=t.assetListUrl;let o;try{o=Zh(s,this.hls.sessionId,t.baseUrl)}catch(S){const D=this.assignAssetListError(t,X.ASSET_LIST_LOAD_ERROR,S,s);this.hls.trigger(w.ERROR,D);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,D,M,U)=>{const N=S.data,te=N==null?void 0:N.ASSETS;if(!Array.isArray(te)){const _e=this.assignAssetListError(t,X.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),M.url,D,U);this.hls.trigger(w.ERROR,_e);return}t.assetListResponse=N,this.hls.trigger(w.ASSET_LIST_LOADED,{event:t,assetListResponse:N,networkDetails:U})},onError:(S,D,M,U)=>{const N=this.assignAssetListError(t,X.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${S.code} ${S.text} (${D.url})`),D.url,U,M);this.hls.trigger(w.ERROR,N)},onTimeout:(S,D,M)=>{const U=this.assignAssetListError(t,X.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${D.url})`),D.url,S,M);this.hls.trigger(w.ERROR,U)}};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:pe.NETWORK_ERROR,details:n,fatal:!1,interstitial:t,url:o,error:s,networkDetails:c,stats:l}}}function Jh(h){h==null||h.play().catch(()=>{})}class Qh extends H{constructor(t,n){super("interstitials",t.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)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 D=this.findItemIndex(p);if(S>D){const M=this.schedule.findJumpRestrictedIndex(D+1,S);if(M>D){this.setSchedulePosition(M);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(M=>M.identifier),y=!!(p.length||v.length);(y||o)&&this.log(`INTERSTITIALS_UPDATED (${p.length}): ${p}
|
|
|
Schedule: ${_.map(M=>ma(M))} pos: ${this.timelinePos}`),v.length&&this.log(`Removed events ${v}`),this.playerQueue.forEach(M=>{if(M.interstitial.appendInPlace){const U=M.assetItem.timelineStart,N=M.timelineOffset-U;if(N)try{M.timelineOffset=U}catch(te){Math.abs(N)>Bo&&this.warn(`${te} ("${M.assetId}" ${M.timelineOffset}->${U})`)}}});let S=null;if(c){const M=this.updateItem(c,this.timelinePos);this.itemsMatch(c,M)&&(this.playingItem=M,this.waitingItem=this.endedItem=null,S=()=>this.trimInPlace(M,c))}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const D=this.bufferingItem;if(D){const M=this.updateItem(D,this.bufferedPos);this.itemsMatch(D,M)?(this.bufferingItem=M,S||(S=()=>this.trimInPlace(M,D))):D.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(D.event,null))}if(s.forEach(M=>{M.assetList.forEach(U=>{this.clearAssetPlayer(U.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 El(t),this.schedule=new Xh(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){Br(t,"play",this.onPlay),Br(t,"pause",this.onPause),Br(t,"seeking",this.onSeeking),Br(t,"timeupdate",this.onTimeupdate)}onMediaAttaching(t,n){const s=this.media=n.media;Hn(s,"seeking",this.onSeeking),Hn(s,"timeupdate",this.onTimeupdate),Hn(s,"play",this.onPlay),Hn(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,D,M,U)=>{if(y){let N=y[S].start;const te=y.event;if(te){if(S==="playout"||te.timelineOccupancy!==gu.Point){const _e=s(D);(_e==null?void 0:_e.interstitial)===te&&(N+=_e.assetItem.startOffset+_e[U])}}else{const _e=M==="bufferedPos"?c():t[M];N+=_e-y.start}return N}return 0},l=(y,S)=>{if(y!==0&&S!=="primary"&&t.schedule.length){var D;const M=t.schedule.findItemIndexAtTime(y),U=(D=t.schedule.items)==null?void 0:D[M];if(U){const N=U[S].start-U.start;return y+N}}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 D,M;const U=t.effectivePlayingItem;if(U!=null&&(D=U.event)!=null&&D.restrictions.skip)return;t.log(`seek to ${y} "${S}"`);const N=t.effectivePlayingItem,te=t.schedule.findItemIndexAtTime(y,S),_e=(M=t.schedule.items)==null?void 0:M[te],le=t.getBufferingPlayer(),Re=le==null?void 0:le.interstitial,Ue=Re==null?void 0:Re.appendInPlace,_t=N&&t.itemsMatch(N,_e);if(N&&(Ue||_t)){const We=s(t.playingAsset),tt=(We==null?void 0:We.media)||t.primaryMedia;if(tt){const Oe=S==="primary"?tt.currentTime:o(N,S,t.playingAsset,"timelinePos","currentTime"),Rt=y-Oe,ei=(Ue?Oe:tt.currentTime)+Rt;if(ei>=0&&(!We||Ue||ei<=We.duration)){tt.currentTime=ei;return}}}if(_e){let We=y;if(S!=="primary"){const Oe=_e[S].start,Rt=y-Oe;We=_e.start+Rt}const tt=!t.isInterstitial(_e);if((!t.isInterstitial(N)||N.event.appendInPlace)&&(tt||_e.event.appendInPlace)){const Oe=t.media||(Ue?le==null?void 0:le.media:null);Oe&&(Oe.currentTime=We)}else if(N){const Oe=t.findItemIndex(N);if(te>Oe){const ei=t.schedule.findJumpRestrictedIndex(Oe+1,te);if(ei>Oe){t.setSchedulePosition(ei);return}}let Rt=0;if(tt)t.timelinePos=We,t.checkBuffer();else{var Ne;const ei=_e==null||(Ne=_e.event)==null?void 0:Ne.assetList;if(ei){const pi=y-(_e[S]||_e).start;for(let yi=ei.length;yi--;){const vi=ei[yi];if(vi.duration&&pi>=vi.startOffset&&pi<vi.startOffset+vi.duration){Rt=yi;break}}}}t.setSchedulePosition(te,Rt)}}},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(),D=t.effectivePlayingItem;D&&D===S&&_(y+D.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(D=>t.getAssetPlayer(D.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 D=t.findItemIndex(y);if(S.appendInPlace){const M=y.playout.start+y.event.duration;_(M+.001,"playout")}else t.advanceAfterAssetEnded(S,D,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} ${xi(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 D=this.getBufferingPlayer();D?(l=D.transferMedia(),v=`${D}`):v="detached MediaSource"}else v="detached media";if(!l){if(m)l=this.detachedData,this.log(`using detachedData: MediaSource ${xi(l)}`);else if(!this.detachedData||c.media===n){const D=this.playerQueue;D.length>1&&D.forEach(M=>{if(p&&M.interstitial.appendInPlace!==_){const U=M.interstitial;this.clearInterstitial(M.interstitial,null),U.appendInPlace=!1,U.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${U}`)}}),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 D=p&&t.assetId===this.schedule.assetIdAtEnd;S.overrides={duration:this.schedule.duration,endOfStream:!p||D,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=Lc(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 D=m.findAssetIndex(v);if(this.log(`INTERSTITIAL_ASSET_ENDED ${D+1}/${m.assetList.length} ${No(v)}`),this.endedAsset=v,this.playingAsset=null,this.hls.trigger(w.INTERSTITIAL_ASSET_ENDED,{asset:v,assetListIndex:D,event:m,schedule:s.slice(0),scheduleIndex:t,player:S}),l!==this.playingItem){this.itemsMatch(l,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(m,this.findItemIndex(this.playingItem),D);return}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} ${ma(l)}`),m.hasPlayed=!0,this.hls.trigger(w.INTERSTITIAL_ENDED,{event:m,schedule:s.slice(0),scheduleIndex:t}),m.cue.once)){this.updateSchedule();const D=this.schedule.items;if(o&&D){const M=this.findItemIndex(o);this.advanceSchedule(M,D,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 D=Lc(m,s-1);if(m.isAssetPastPlayoutLimit(D)){this.advanceAfterAssetEnded(m,t,s);return}s=D}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 ${ma(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 D=n[t+1],M=this.media;D&&M&&!this.isInterstitial(D)&&M.currentTime<D.start&&(M.currentTime=this.timelinePos=D.start),this.advanceAfterAssetEnded(m,t,s||0);return}if(y||(y=this.getAssetPlayer(S.identifier)),y===null||y.destroyed){const D=m.assetList.length;this.warn(`asset ${s+1}/${D} 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&&Jh(y.media)}else c!==null?(this.resumePrimary(c,t,o),this.shouldPlay&&Jh(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 ${ma(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 ${ma(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:si.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=C(C({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=o,this.schedule.parseInterstitialDateRanges(o,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(t,n){const s=this.hls.audioTracks[n.id],o=this.mediaSelection;if(!o){this.altSelection=C(C({},this.altSelection),{},{audio:s});return}const l=C(C({},o),{},{audio:s});this.mediaSelection=l}onSubtitleTrackUpdated(t,n){const s=this.hls.subtitleTracks[n.id],o=this.mediaSelection;if(!o){this.altSelection=C(C({},this.altSelection),{},{subtitles:s});return}const l=C(C({},o),{},{subtitles:s});this.mediaSelection=l}onAudioTrackSwitching(t,n){const s=Pe(n);this.playerQueue.forEach(o=>o.hls.setAudioOption(n)||o.hls.setAudioOption(s))}onSubtitleTrackSwitch(t,n){const s=Pe(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=si.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=si.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),D=n[S];if((_===-1&&l&&t>=l.end||(m=D.event)!=null&&m.appendInPlace&&t+.01>=D.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(D);else{const M=this.primaryDetails;this.primaryLive&&M&&t>M.edge-M.targetduration&&D.start<M.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(D)&&this.preloadAssets(D.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 ${ma(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:md(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 le=this.timelinePos-n.timelineStart;if(le>1){const Re=n.duration;Re&&le<Re&&(v=le)}}const y=n.identifier,S=C(C({},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 D=S.cmcd;D!=null&&D.sessionId&&D.contentId&&(S.cmcd=k({},D,{contentId:wl(n.uri)})),this.getAssetPlayer(y)&&this.warn(`Duplicate date range identifier ${t} and asset ${y}`);const M=new Sl(this.HlsPlayerClass,S,t,n);this.playerQueue.push(M),t.assetList[s]=n;const U=le=>{if(le.live){const _t=new Error(`Interstitials MUST be VOD assets ${t}`),Ne={fatal:!0,type:pe.OTHER_ERROR,details:X.INTERSTITIAL_ASSET_ITEM_ERROR,error:_t};this.handleAssetItemError(Ne,t,this.schedule.findEventIndex(t.identifier),s,_t.message);return}const Re=le.edge-le.fragmentStart,Ue=n.duration;(Ue===null||Re>Ue)&&(this.log(`Interstitial asset "${y}" duration change ${Ue} > ${Re}`),n.duration=Re,this.updateSchedule())};M.on(w.LEVEL_UPDATED,(le,{details:Re})=>U(Re)),M.on(w.LEVEL_PTS_UPDATED,(le,{details:Re})=>U(Re));const N=(le,Re)=>{const Ue=this.getAssetPlayer(y);if(Ue&&Re.tracks){Ue.off(w.BUFFER_CODECS,N),Ue.tracks=Re.tracks;const _t=this.primaryMedia;this.bufferingAsset===Ue.assetItem&&_t&&!Ue.media&&this.bufferAssetPlayer(Ue,_t)}};M.on(w.BUFFER_CODECS,N);const te=()=>{var le;const Re=this.getAssetPlayer(y);if(this.log(`buffered to end of asset ${Re}`),!Re)return;const Ue=this.schedule.findEventIndex(t.identifier),_t=(le=this.schedule.items)==null?void 0:le[Ue];if(this.isInterstitial(_t)){const We=t.findAssetIndex(n),tt=Lc(t,We);if(!t.isAssetPastPlayoutLimit(tt))this.bufferedToItem(_t,tt);else{var Ne;const Oe=(Ne=this.schedule.items)==null?void 0:Ne[Ue+1];Oe&&this.bufferedToItem(Oe)}}};M.on(w.BUFFERED_TO_END,te);const _e=le=>()=>{if(!this.getAssetPlayer(y))return;this.shouldPlay=!0;const Ue=this.schedule.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,Ue,le)};return M.once(w.MEDIA_ENDED,_e(s)),M.once(w.PLAYOUT_LIMIT_REACHED,_e(1/0)),M.on(w.ERROR,(le,Re)=>{const Ue=this.getAssetPlayer(y);if(Re.details===X.BUFFER_STALLED_ERROR){if(Ue!=null&&Ue.media){const _t=Ue.currentTime,Ne=Ue.duration-_t;_t&&t.appendInPlace&&Ne/Ue.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${y} ${t} at ${Ue.media.currentTime}`),te()):(this.warn(`Stalled at ${_t} of ${_t+Ne} in asset ${y} ${t}`),this.onTimeupdate(),this.checkBuffer(!0))}return}this.handleAssetItemError(Re,t,this.schedule.findEventIndex(t.identifier),s,`Asset player error ${Re.error} ${t}`)}),M.on(w.DESTROYING,()=>{if(!this.getAssetPlayer(y))return;const Re=new Error(`Asset player destroyed unexpectedly ${y}`),Ue={fatal:!0,type:pe.OTHER_ERROR,details:X.INTERSTITIAL_ASSET_ITEM_ERROR,error:Re};this.handleAssetItemError(Ue,t,this.schedule.findEventIndex(t.identifier),s,Re.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${No(n)}`),this.hls.trigger(w.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:s,event:t,player:M}),M}clearInterstitial(t,n){t.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,n)}),t.reset()}resetAssetPlayer(t){const n=this.getAssetPlayerQueueIndex(t);if(n!==-1){this.log(`reset asset player "${t}" after error`);const s=this.playerQueue[n];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(t,n){const s=this.getAssetPlayerQueueIndex(t);if(s!==-1){this.log(`clear asset player "${t}" toSegment: ${n&&ma(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} ${No(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&&!Ke(y,t.tracks)){const S=new Error(`Asset ${No(c)} SourceBuffer tracks ('${Object.keys(t.tracks)}') are not compatible with primary content tracks ('${Object.keys(y)}')`),D={fatal:!0,type:pe.OTHER_ERROR,details:X.INTERSTITIAL_ASSET_ITEM_ERROR,error:S},M=l.findAssetIndex(c);this.handleAssetItemError(D,l,p,M,S.message);return}}this.transferMediaTo(t,n)}handleAssetItemError(t,n,s,o,l){if(t.details===X.BUFFER_STALLED_ERROR)return;const c=n.assetList[o];this.warn(`INTERSTITIAL_ASSET_ERROR ${c&&No(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:$n(!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,D=new Error(l);if(c&&(this.clearAssetPlayer(p,null),c.error=D),!n.assetList.some(M=>!M.error))n.error=D;else{for(let M=o;M<n.assetList.length;M++)this.resetAssetPlayer(n.assetList[M].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?ma(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((M,U)=>{const N=parseFloat(M.DURATION);this.createAsset(o,U,m,p+m,N,M.URI),m+=N}),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 D;const M=this.schedule.findEventIndex(l),U=(D=this.schedule.items)==null?void 0:D[M];if(U){if(!this.playingItem&&this.timelinePos>U.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==M){o.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${o}`),this.primaryFallback(o);return}this.setBufferingItem(U)}this.setSchedulePosition(M)}else if((S==null?void 0:S.identifier)===l&&S.appendInPlace){const M=o.assetList[0],U=this.getAssetPlayer(M.identifier),N=this.primaryMedia;M&&U&&N&&this.bufferAssetPlayer(U,N)}}onError(t,n){switch(n.details){case X.ASSET_LIST_PARSING_ERROR:case X.ASSET_LIST_LOAD_ERROR:case X.ASSET_LIST_LOAD_TIMEOUT:{const s=n.interstitial;s&&this.primaryFallback(s);break}case X.BUFFER_STALLED_ERROR:{this.onTimeupdate(),this.checkBuffer(!0);break}}}}const _u=500;class ef extends Cn{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=st.IDLE,this.setInterval(_u),this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(t,n){this.tracksBuffered=[],super.onMediaDetaching(t,n)}onLevelLoaded(t,n){this.mainDetails=n.details}onSubtitleFragProcessed(t,n){const{frag:s,success:o}=n;if(this.fragContextChanged(s)||(ze(s)&&(this.fragPrevious=s),this.state=st.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===X.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==st.STOPPED&&(this.state=st.IDLE))}onSubtitleTracksUpdated(t,{subtitleTracks:n}){if(this.levels&&gc(this.levels,n)){this.levels=n.map(s=>new sn(s));return}this.tracksBuffered=[],this.levels=n.map(s=>{const o=new sn(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!==st.STOPPED&&this.setInterval(_u)}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){if(c.deltaUpdateFailed)return;const y=this.mainDetails;if(!y){this.startFragRequested=!1;return}const S=y.fragments[0];if(!_.details)c.hasProgramDateTime&&y.hasProgramDateTime?(ra(c,y),m=c.fragmentStart):S&&(m=S.start,Ja(c,m));else{var v;m=this.alignPlaylists(c,_.details,(v=this.levelLastLoaded)==null?void 0:v.details),m===0&&S&&(m=S.start,Ja(c,m))}y&&!this.startFragRequested&&this.setStartPosition(y,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===st.IDLE&&(Ai(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&&Pr(o.method)){const c=performance.now();this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer,Wr(o.method)).catch(p=>{throw l.trigger(w.ERROR,{type:pe.MEDIA_ERROR,details:X.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=st.IDLE})}}doTick(){if(!this.media){this.state=st.IDLE;return}if(this.state===st.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=si.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,D=m.edge;let M=null;const U=this.fragPrevious;if(p<D){const _e=o.maxFragLookUpTolerance,le=p>D-_e?0:_e;M=Ai(U,y,Math.max(y[0].start,p),le),!M&&U&&U.start<y[0].start&&(M=y[0])}else M=y[S-1];if(M=this.filterReplacedPrimary(M,s.details),!M)return;const N=M.sn-m.startSN,te=y[N-1];if(te&&te.cc===M.cc&&this.fragmentTracker.getState(te)===Ki.NOT_LOADED&&(M=te),this.fragmentTracker.getState(M)===Ki.NOT_LOADED){const _e=this.mapToInitFragWhenRequired(M);_e&&this.loadFragment(_e,s,p)}}}loadFragment(t,n,s){ze(t)?super.loadFragment(t,n,s):this._loadInitSegment(t,n)}get mediaBufferTimeRanges(){return new gd(this.tracksBuffered[this.currentTrackId]||[])}}class gd{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 _d={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},tf=h=>String.fromCharCode(_d[h]||h),Fs=15,ga=100,vd={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},yd={17:2,18:4,21:6,22:8,23:10,19:13,20:15},bd={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Da={25:2,26:4,29:6,30:8,31:10,27:13,28:15},co=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class $o{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 ss=function(t){const n=[];for(let s=0;s<t.length;s++)n.push(t[s].toString(16));return n};class Ys{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 Ca{constructor(){this.uchar=" ",this.penState=new Ys}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 vu{constructor(t){this.chars=[],this.pos=0,this.currPenState=new Ys,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<ga;n++)this.chars.push(new Ca);this.logger=t}equals(t){for(let n=0;n<ga;n++)if(!this.chars[n].equals(t.chars[n]))return!1;return!0}copy(t){for(let n=0;n<ga;n++)this.chars[n].copy(t.chars[n])}isEmpty(){let t=!0;for(let n=0;n<ga;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>ga&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=ga)}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=tf(t);if(this.pos>=ga){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<ga;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<ga;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 Ko{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 vu(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 = "+xi(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 = "+xi(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 kl{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 Ko(s),this.nonDisplayedMemory=new Ko(s),this.lastOutputScreen=new Ko(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: "+xi(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 Tl{constructor(t,n,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=rf(),this.logger=void 0;const o=this.logger=new $o;this.channels=[null,new kl(t,n,o),new kl(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,()=>"["+ss([n[s],n[s+1]])+"] -> ("+ss([o,l])+")");const _=this.cmdHistory;if(o>=16&&o<=31){if(nf(o,l,_)){yu(null,null,_),this.logger.log(3,()=>"Repeated command ("+ss([o,l])+") is dropped");continue}yu(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 yu(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 "+ss([o,l])+" orig: "+ss([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 ("+ss([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?vd[t]:bd[t]:s=c===1?yd[t]:Da[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 '"+tf(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 = "+ss(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=co[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()}yu(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 yu(h,t,n){n.a=h,n.b=t}function nf(h,t,n){return n.a===h&&n.b===t}function rf(){return{a:null,b:null}}var bu=function(){if(On!=null&&On.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="",D=!1,M=p,U=_,N=m,te=null,_e="",le=!0,Re="auto",Ue="start",_t=50,Ne="middle",We=50,tt="middle";Object.defineProperty(v,"id",l({},y,{get:function(){return S},set:function(Oe){S=""+Oe}})),Object.defineProperty(v,"pauseOnExit",l({},y,{get:function(){return D},set:function(Oe){D=!!Oe}})),Object.defineProperty(v,"startTime",l({},y,{get:function(){return M},set:function(Oe){if(typeof Oe!="number")throw new TypeError("Start time must be set to a number.");M=Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"endTime",l({},y,{get:function(){return U},set:function(Oe){if(typeof Oe!="number")throw new TypeError("End time must be set to a number.");U=Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"text",l({},y,{get:function(){return N},set:function(Oe){N=""+Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"region",l({},y,{get:function(){return te},set:function(Oe){te=Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"vertical",l({},y,{get:function(){return _e},set:function(Oe){const Rt=s(Oe);if(Rt===!1)throw new SyntaxError("An invalid or illegal string was specified.");_e=Rt,this.hasBeenReset=!0}})),Object.defineProperty(v,"snapToLines",l({},y,{get:function(){return le},set:function(Oe){le=!!Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"line",l({},y,{get:function(){return Re},set:function(Oe){if(typeof Oe!="number"&&Oe!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Re=Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"lineAlign",l({},y,{get:function(){return Ue},set:function(Oe){const Rt=o(Oe);if(!Rt)throw new SyntaxError("An invalid or illegal string was specified.");Ue=Rt,this.hasBeenReset=!0}})),Object.defineProperty(v,"position",l({},y,{get:function(){return _t},set:function(Oe){if(Oe<0||Oe>100)throw new Error("Position must be between 0 and 100.");_t=Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"positionAlign",l({},y,{get:function(){return Ne},set:function(Oe){const Rt=o(Oe);if(!Rt)throw new SyntaxError("An invalid or illegal string was specified.");Ne=Rt,this.hasBeenReset=!0}})),Object.defineProperty(v,"size",l({},y,{get:function(){return We},set:function(Oe){if(Oe<0||Oe>100)throw new Error("Size must be between 0 and 100.");We=Oe,this.hasBeenReset=!0}})),Object.defineProperty(v,"align",l({},y,{get:function(){return tt},set:function(Oe){const Rt=o(Oe);if(!Rt)throw new SyntaxError("An invalid or illegal string was specified.");tt=Rt,this.hasBeenReset=!0}})),v.displayState=void 0}return c.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},c}();class xd{decode(t,n){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function Dc(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 wd{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 sf(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 Cc=new bu(0,0,""),xu=Cc.align==="middle"?"middle":"center";function Sd(h,t,n){const s=h;function o(){const p=Dc(h);if(p===null)throw new Error("Malformed timestamp: "+s);return h=h.replace(/^[^\sa-zA-Z-]+/,""),p}function l(p,_){const m=new wd;sf(p,function(S,D){let M;switch(S){case"region":for(let U=n.length-1;U>=0;U--)if(n[U].id===D){m.set(S,n[U].region);break}break;case"vertical":m.alt(S,D,["rl","lr"]);break;case"line":M=D.split(","),m.integer(S,M[0]),m.percent(S,M[0])&&m.set("snapToLines",!1),m.alt(S,M[0],["auto"]),M.length===2&&m.alt("lineAlign",M[1],["start",xu,"end"]);break;case"position":M=D.split(","),m.percent(S,M[0]),M.length===2&&m.alt("positionAlign",M[1],["start",xu,"end","line-left","line-right","auto"]);break;case"size":m.percent(S,D);break;case"align":m.alt(S,D,["start",xu,"end","left","right"]);break}},/:/,/\s/),_.region=m.get("region",null),_.vertical=m.get("vertical","");let v=m.get("line","auto");v==="auto"&&Cc.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",xu);let y=m.get("position","auto");y==="auto"&&Cc.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 af(h){return h.replace(/<br(?: \/)?>/gi,`
|
|
|
`)}class Ed{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new xd,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=af(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){sf(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 bu(0,0,""),n.state="CUE",l.indexOf("-->")===-1){n.cue.id=l;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{Sd(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 wu=/\r\n|\n\r|\n|\r/g,ho=function(t,n,s=0){return t.slice(s,s+n.length)===n},fo=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 Bs(h,t,n){return wl(h.toString())+wl(t.toString())+wl(n)}const of=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 lf(h,t,n,s,o,l,c){const p=new Ed,_=It(new Uint8Array(h)).trim().replace(wu,`
|
|
|
`).split(`
|
|
|
`),m=[],v=t?su(t.baseTime,t.timescale):0;let y="00:00.000",S=0,D=0,M,U=!0;p.oncue=function(N){const te=n[s];let _e=n.ccOffset;const le=(S-v)/9e4;if(te!=null&&te.new&&(D!==void 0?_e=n.ccOffset=te.start:of(n,s,le)),le){if(!t){M=new Error("Missing initPTS for VTT MPEGTS");return}_e=le-n.presentationOffset}const Re=N.endTime-N.startTime,Ue=vs((N.startTime+_e-D)*9e4,o*9e4)/9e4;N.startTime=Math.max(Ue,0),N.endTime=Math.max(Ue+Re,0);const _t=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(_t)),N.id||(N.id=Bs(N.startTime,N.endTime,_t)),N.endTime>0&&m.push(N)},p.onparsingerror=function(N){M=N},p.onflush=function(){if(M){c(M);return}l(m)},_.forEach(N=>{if(U)if(ho(N,"X-TIMESTAMP-MAP=")){U=!1,N.slice(16).split(",").forEach(te=>{ho(te,"LOCAL:")?y=te.slice(6):ho(te,"MPEGTS:")&&(S=parseInt(te.slice(7)))});try{D=fo(y)/1e3}catch(te){M=te}return}else N===""&&(U=!1);p.parse(N+`
|
|
|
`)}),p.flush()}const Su="stpp.ttml.im1t",uf=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,cf=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,hf={left:"start",center:"center",right:"end",start:"start",end:"end"};function ff(h,t,n,s){const o=me(new Uint8Array(h),["mdat"]);if(o.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const l=o.map(p=>It(p)),c=Eh(t.baseTime,1,t.timescale);try{l.forEach(p=>n(kd(p,c)))}catch(p){s(p)}}function kd(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",_=En(Mc(o,"styling","style")),m=En(Mc(o,"layout","region")),v=Mc(o,"body","[begin]");return[].map.call(v,y=>{const S=Al(y,p);if(!S||!y.hasAttribute("begin"))return null;const D=ku(y.getAttribute("begin"),c),M=ku(y.getAttribute("dur"),c);let U=ku(y.getAttribute("end"),c);if(D===null)throw _a(y);if(U===null){if(M===null)throw _a(y);U=D+M}const N=new bu(D-t,U-t,S);N.id=Bs(N.startTime,N.endTime,N.text);const te=m[y.getAttribute("region")],_e=_[y.getAttribute("style")],le=Eu(te,_e,_),{textAlign:Re}=le;if(Re){const Ue=hf[Re];Ue&&(N.lineAlign=Ue),N.align=Re}return k(N,le),N}).filter(y=>y!==null)}function Mc(h,t,n){const s=h.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(n)):[]}function En(h){return h.reduce((t,n)=>{const s=n.getAttribute("xml:id");return s&&(t[s]=n),t},{})}function Al(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?Al(s,t):t?n+s.textContent.trim().replace(/\s+/g," "):n+s.textContent},"")}function Eu(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=Rc(t,s,_)||Rc(h,s,_)||Rc(o,s,_);return m&&(p[_]=m),p},{})}function Rc(h,t,n){return h&&h.hasAttributeNS(t,n)?h.getAttributeNS(t,n):null}function _a(h){return new Error(`Could not parse ttml timestamp ${h}`)}function ku(h,t){if(!h)return null;let n=Dc(h);return n===null&&(uf.test(h)?n=po(h,t):cf.test(h)&&(n=df(h,t))),n}function po(h,t){const n=uf.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 df(h,t){const n=cf.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 Wn{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 pf{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=Ll(),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 Wn(this,"textTrack1"),n=new Wn(this,"textTrack2"),s=new Wn(this,"textTrack3"),o=new Wn(this,"textTrack4");this.cea608Parser1=new Tl(1,t,n),this.cea608Parser2=new Tl(3,s,o)}addCues(t,n,s,o,l){let c=!1;for(let p=l.length;p--;){const _=l[p],m=gf(_[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.initPTS[p.frag.cc]?this.onFragLoaded(w.FRAG_LOADED,p):this.hls.trigger(w.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(t,n){const{media:s}=this;if(s)for(let o=0;o<s.textTracks.length;o++){const l=s.textTracks[o];if(mf(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,oo(s[t]),Wh(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=>{oo(o[l]),delete o[l]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Ll(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:t}=this;if(!t)return;const n=t.textTracks;if(n)for(let s=0;s<n.length;s++)oo(n[s])}onSubtitleTracksUpdated(t,n){const s=n.subtitleTracks||[],o=s.some(l=>l.textCodec===Su);if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(gc(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const c=this.media,p=c?xl(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]&&mf(p[S],_)){y=p[S],p[S]=null;break}y&&(v=y)}if(v)oo(v);else{const y=Ic(_);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===Su?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;ff(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?xt(s.initSegment.data,new Uint8Array(o)).buffer:o;lf(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||ff(n,this.initPTS[t.cc],()=>{s.textCodec=Su,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=>mu(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(_=>Fo(p[_],n,s))}if(this.config.renderTextTracksNatively&&n===0&&o!==void 0){const{textTracks:p}=this;Object.keys(p).forEach(_=>Fo(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 Ic(h){return h.characteristics&&/transcribes-spoken-dialog/gi.test(h.characteristics)&&/describes-music-and-sound/gi.test(h.characteristics)?"captions":"subtitles"}function mf(h,t){return!!h&&h.kind===Ic(t)&&ml(t,h)}function gf(h,t,n,s){return Math.min(t,s)-Math.max(h,n)}function Ll(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Uo=/\s/,_f={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 U=0;U<l.chars.length;U++)Uo.test(l.chars[U].uchar)&&p?_++:(m+=l.chars[U].uchar,p=!1);l.cueStartTime=t,t===n&&(n+=1e-4),_>=16?_--:_++;const D=af(m.trim()),M=Bs(t,n,D);h!=null&&(y=h.cues)!=null&&y.getCueById(M)||(c=new v(t,n,D),c.id=M,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,D)=>S.line==="auto"||D.line==="auto"?0:S.line>8&&D.line>8?D.line-S.line:S.line-D.line),o.forEach(S=>mu(h,S))),o}};function Xr(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}const vf=/(\d+)-(\d+)\/(\d+)/;class Pc{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||v0,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=Mt(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),(ha(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(y=>{var S;this.response=this.loader=y;const D=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-(D-o.loading.start)),!y.ok){const{status:U,statusText:N}=y;throw new yf(N||"fetch, bad network response",U,y)}o.loading.first=D,o.total=_0(y.headers)||o.total;const M=(S=this.callbacks)==null?void 0:S.onProgress;return M&&ue(n.highWaterMark)?this.loadProgressively(y,o,t,n.highWaterMark,M):c?y.arrayBuffer():t.responseType==="json"?y.json():y.text()}).then(y=>{var S,D;const M=this.response;if(!M)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);const U=y[p];U&&(o.loaded=o.total=U);const N={url:M.url,data:y,code:M.status},te=(S=this.callbacks)==null?void 0:S.onProgress;te&&!ue(n.highWaterMark)&&te(o,t,y,M),(D=this.callbacks)==null||D.onSuccess(N,o,t,M)}).catch(y=>{var S;if(self.clearTimeout(this.requestTimeout),o.aborted)return;const D=y&&y.code||0,M=y?y.message:null;(S=this.callbacks)==null||S.onError({code:D,text:M},t,y?y.details:null,o)})}getCacheAge(){let t=null;if(this.response){const n=this.response.headers.get("age");t=n?parseFloat(n):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,n,s,o=0,l){const c=new Ur,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 Mt(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 Jn(h){const t=vf.exec(h);if(t)return parseInt(t[2])-parseInt(t[1])+1}function _0(h){const t=h.get("Content-Range");if(t){const s=Jn(t);if(ue(s))return s}const n=h.get("Content-Length");if(n)return parseInt(n)}function v0(h,t){return new self.Request(h.url,t)}class yf extends Error{constructor(t,n,s){super(t),this.code=void 0,this.details=void 0,this.code=n,this.details=s}}const bf=/^age:\s*[\d.]+\s*$/im;class zo{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 M=v!=null?v:n.response;if(M!=null){var c,p;s.loading.end=Math.max(self.performance.now(),s.loading.first);const U=n.responseType==="arraybuffer"?M.byteLength:M.length;s.loaded=s.total=U,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const N=(c=this.callbacks)==null?void 0:c.onProgress;N&&N(s,t,M,n);const te={url:n.responseURL,data:M,code:m};(p=this.callbacks)==null||p.onSuccess(te,s,t,n);return}}const y=l.loadPolicy.errorRetry,S=s.retry,D={url:t.url,data:void 0,code:m};if(Zi(y,S,!1,D))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(Zi(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=$i(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&&bf.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 Tu={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Td=C(C({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:zo,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:di,bufferController:id,capLevelController:_c,errorController:dn,fpsController:pd,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:ta,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:Tu},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},Ad()),{},{subtitleStreamController:ef,subtitleTrackController:jh,timelineController:pf,audioStreamController:td,audioTrackController:Ih,emeController:pa,cmcdController:Tc,contentSteeringController:bl,interstitialsController:Qh});function Ad(){return{cueHandler:_f,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 xf(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=Ma(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 D=s[p].default;switch(t[p]={default:D},v){case"TimeOut":D.maxLoadTimeMs=S,D.maxTimeToFirstByteMs=S;break;case"MaxRetry":D.errorRetry.maxNumRetry=S,D.timeoutRetry.maxNumRetry=S;break;case"RetryDelay":D.errorRetry.retryDelayMs=S,D.timeoutRetry.retryDelayMs=S;break;case"MaxRetryTimeout":D.errorRetry.maxRetryDelayMs=S,D.timeoutRetry.maxRetryDelayMs=S;break}}}),m.length&&n.warn(`hls.js config: "${m.join('", "')}" setting(s) are deprecated, use "${p}": ${xi(t[p])}`)}),C(C({},s),t)}function Ma(h){return h&&typeof h=="object"?Array.isArray(h)?h.map(Ma):Object.keys(h).reduce((t,n)=>(t[n]=Ma(h[n]),t),{}):h}function Mr(h,t){const n=h.loader;n!==Pc&&n!==zo?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1):Xr()&&(h.loader=Pc,h.progressive=!0,h.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Ra=2,Oc=.1,mo=.05,Cs=100;class Ld extends In{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(Cs),this.mediaSource=n.mediaSource;const s=this.media=n.media;Hn(s,"playing",this.onMediaPlaying),Hn(s,"waiting",this.onMediaWaiting),Hn(s,"ended",this.onMediaEnded)}onMediaDetaching(t,n){this.clearInterval();const{media:s}=this;s&&(Br(s,"playing",this.onMediaPlaying),Br(s,"waiting",this.onMediaWaiting),Br(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(!si.getBuffered(c).length){this.nudgeRetry=0;return}const y=si.bufferInfo(c,t,0),S=y.nextStart||0,D=this.fragmentTracker;if(p&&D&&this.hls){const _t=Vo(this.hls.inFlightFragments,t),Ne=y.len>Ra,We=!S||_t||S-t>Ra&&!D.getPartialFragment(t);if(Ne||We)return;this.moved=!1}const M=(o=this.hls)==null?void 0:o.latestLevelDetails;if(!this.moved&&this.stalled!==null&&D){if(!(y.len>0)&&!S)return;const Ne=Math.max(S,y.start||0)-t,tt=!!(M!=null&&M.live)?M.targetduration*2:Ra,Oe=D.getPartialFragment(t);if(Ne>0&&(Ne<=tt||Oe)){c.paused||this._trySkipBufferHole(Oe);return}}const U=l.detectStallWithCurrentTimeMs,N=self.performance.now(),te=this.waiting;let _e=this.stalled;if(_e===null)if(te>0&&N-te<U)_e=this.stalled=te;else{this.stalled=N;return}const le=N-_e;if(!p&&(le>=U||te)&&this.hls){var Re;if(((Re=this.mediaSource)==null?void 0:Re.readyState)==="ended"&&!(M!=null&&M.live)&&Math.abs(t-((M==null?void 0:M.edge)||0))<1){if(this.ended)return;this.ended=t||1,this.hls.trigger(w.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(y),!this.media||!this.hls)return}const Ue=si.bufferInfo(c,t,l.maxBufferHole);this._tryFixBufferStall(Ue,le,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=si.bufferedInfo(si.timeRangesToArray(this.buffered.audio),t,0);if(l.len>1&&n>=l.start){const c=si.timeRangesToArray(o),p=si.bufferedInfo(c,n,0).bufferedIndex;if(p>-1&&p<c.length-1){const _=si.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,D=si.bufferInfo(this.media,t,0);this.hls.trigger(w.ERROR,{type:pe.MEDIA_ERROR,details:X.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:S,buffer:D.len,bufferInfo:D})}}}}}_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 (${xi(t)})`);this.warn(c.message),n.trigger(w.ERROR,{type:pe.MEDIA_ERROR,details:X.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=si.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 M=!1;if(c===0){const U=s.getAppendedFrag(0,P.MAIN);U&&_<U.end&&(M=!0)}if(!M){const U=t||s.getAppendedFrag(c,P.MAIN);if(U){var m;if(!((m=this.hls.loadLevelObj)!=null&&m.details)||Vo(this.hls.inFlightFragments,_))return 0;let te=!1,_e=U.end;for(;_e<_;){const le=s.getAppendedFrag(_e,P.MAIN)||s.getPartialFragment(_e);if(le)_e+=le.duration;else{te=!0;break}}if(te)return 0}}}const D=Math.max(_+mo,c+Oc);if(this.warn(`skipping hole, adjusting currentTime from ${c} to ${D}`),this.moved=!0,o.currentTime=D,!(t!=null&&t.gap)){const M=new Error(`fragment loaded with buffer holes, seeking from ${c} to ${D}`);this.hls.trigger(w.ERROR,{type:pe.MEDIA_ERROR,details:X.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:M,reason:M.message,frag:t||void 0,buffer:p.len,bufferInfo:p})}return D}}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:pe.MEDIA_ERROR,details:X.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:pe.MEDIA_ERROR,details:X.BUFFER_STALLED_ERROR,error:p,fatal:!0,buffer:t.len,bufferInfo:t})}}}function Vo(h,t){const n=Go(h.main);if(n&&n.start<=t)return n;const s=Go(h.audio);return s&&s.start<=t?s:null}function Go(h){if(!h)return null;switch(h.state){case st.IDLE:case st.STOPPED:case st.ENDED:case st.ERROR:return null}return h.frag}const wf=.25;function Fc(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Dl(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,xi(o?C({type:o},s):s))}return l}const Au=(()=>{const h=Fc();try{h&&new h(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Dd{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&&oo(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 Wh(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=Fc();if(c)for(let p=0;p<l.length;p++){const _=l[p].type;if(_===us.emsg&&!s||!o)continue;const m=ec(l[p].data);if(m){const v=l[p].pts;let y=v+l[p].duration;y>Au&&(y=Au),y-v<=0&&(y=v+wf);for(let D=0;D<m.length;D++){const M=m[D];if(!tc(M)){this.updateId3CueEnds(v,_);const U=Dl(c,v,y,M,_);U&&this.id3Track.addCue(U)}}}}}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===Au&&(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===us.audioId3&&_:o==="video"?m=v=>v.type===us.emsg&&p:m=v=>v.type===us.audioId3&&_||v.type===us.emsg&&p,Fo(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],D=c[S].cues;delete c[S],Object.keys(D).forEach(M=>{try{const U=D[M];U.removeEventListener("enter",this.onEventCueEnter),s.removeCue(U)}catch(U){}})}}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=Fc();for(let v=0;v<l.length;v++){const y=l[v],S=o[y],D=S.startTime,M=c[y],U=(M==null?void 0:M.cues)||{};let N=(M==null?void 0:M.durationKnown)||!1,te=Au;const{duration:_e,endDate:le}=S;if(le&&_e!==null)te=D+_e,N=!0;else if(S.endOnNext&&!N){const Ue=l.reduce((_t,Ne)=>{if(Ne!==S.id){const We=o[Ne];if(We.class===S.class&&We.startDate>S.startDate&&(!_t||S.startDate<_t.startDate))return We}return _t},null);Ue&&(te=Ue.startTime,N=!0)}const Re=Object.keys(S.attr);for(let Ue=0;Ue<Re.length;Ue++){const _t=Re[Ue];if(!Zn(_t))continue;const Ne=U[_t];if(Ne)N&&!M.durationKnown?Ne.endTime=te:Math.abs(Ne.startTime-D)>.01&&(Ne.startTime=D,Ne.endTime=te);else if(m){let We=S.attr[_t];fr(_t)&&(We=z(We));const Oe=Dl(m,D,te,{key:_t,data:We},us.dateRange);Oe&&(Oe.id=y,this.id3Track.addCue(Oe),U[_t]=Oe,this.hls.config.interstitialsController&&(_t==="X-ASSET-LIST"||_t==="X-ASSET-URL")&&Oe.addEventListener("enter",this.onEventCueEnter))}}c[y]={cues:U,dateRange:S,durationKnown:N}}}}class Cd{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,D=Math.min(y,Math.max(1,S));this.changeMediaPlaybackRate(n,D)}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===X.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 Cl extends js{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:D}=v;S&&(v.audioCodec=S=ae(S,s)||void 0),D&&(D=v.videoCodec=yt(D));const{width:M,height:U,unknownCodecs:N}=v;let te=N?N.length:0;if(N)for(let Oe=te;Oe--;){const Rt=N[Oe];this.isAudioSupported(Rt)?(v.audioCodec=S=S?`${S},${Rt}`:Rt,te--,kt.audio[S.substring(0,4)]=2):this.isVideoSupported(Rt)&&(v.videoCodec=D=D?`${D},${Rt}`:Rt,te--,kt.video[D.substring(0,4)]=2)}if(p||(p=!!(M&&U)),_||(_=!!D),m||(m=!!S),te||S&&!this.isAudioSupported(S)||D&&!this.isVideoSupported(D)){this.log(`Some or all CODECS not supported "${y.CODECS}"`);return}const{CODECS:_e,"FRAME-RATE":le,"HDCP-LEVEL":Re,"PATHWAY-ID":Ue,RESOLUTION:_t,"VIDEO-RANGE":Ne}=y,tt=`${`${Ue||"."}-`}${v.bitrate}-${_t}-${le}-${_e}-${Ne}-${Re}`;if(l[tt])if(l[tt].uri!==v.url&&!v.attrs["PATHWAY-ID"]){const Oe=c[tt]+=1;v.attrs["PATHWAY-ID"]=new Array(Oe+1).join(".");const Rt=this.createLevel(v);l[tt]=Rt,o.push(Rt)}else l[tt].addGroupId("audio",y.AUDIO),l[tt].addGroupId("text",y.SUBTITLES);else{const Oe=this.createLevel(v);l[tt]=Oe,c[tt]=1,o.push(Oe)}}),this.filterAndSortMediaOptions(o,n,p,_,m)}createLevel(t){const n=new sn(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=ni(o,[])}return n}isAudioSupported(t){return Xt(t,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(t){return Xt(t,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(t,n,s,o,l){let c=[],p=[],_=t;if((s||o)&&l&&(_=_.filter(({videoCodec:N,videoRange:te,width:_e,height:le})=>(!!N||!!(_e&&le))&&Yi(te))),_.length===0){Promise.resolve().then(()=>{if(this.hls){let N="no level with compatible codecs found in manifest",te=N;n.levels.length&&(te=`one or more CODECS in variant not supported: ${xi(n.levels.map(le=>le.attrs.CODECS).filter((le,Re,Ue)=>Ue.indexOf(le)===Re))}`,this.warn(te),N+=` (${te})`);const _e=new Error(N);this.hls.trigger(w.ERROR,{type:pe.MEDIA_ERROR,details:X.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:_e,reason:te})}});return}n.audioTracks&&(c=n.audioTracks.filter(N=>!N.audioCodec||this.isAudioSupported(N.audioCodec)),Ho(c)),n.subtitles&&(p=n.subtitles,Ho(p));const m=_.slice(0);_.sort((N,te)=>{if(N.attrs["HDCP-LEVEL"]!==te.attrs["HDCP-LEVEL"])return(N.attrs["HDCP-LEVEL"]||"")>(te.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&N.height!==te.height)return N.height-te.height;if(N.frameRate!==te.frameRate)return N.frameRate-te.frameRate;if(N.videoRange!==te.videoRange)return en.indexOf(N.videoRange)-en.indexOf(te.videoRange);if(N.videoCodec!==te.videoCodec){const _e=De(N.videoCodec),le=De(te.videoCodec);if(_e!==le)return le-_e}if(N.uri===te.uri&&N.codecSet!==te.codecSet){const _e=xe(N.codecSet),le=xe(te.codecSet);if(_e!==le)return le-_e}return N.averageBitrate!==te.averageBitrate?N.averageBitrate-te.averageBitrate:0});let v=m[0];if(this.steering&&(_=this.steering.filterParsedLevels(_),_.length!==m.length)){for(let N=0;N<m.length;N++)if(m[N].pathwayId===_[0].pathwayId){v=m[N];break}}this._levels=_;for(let N=0;N<_.length;N++)if(_[N]===v){var y;this._firstLevel=N;const te=v.bitrate,_e=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${_.length} level(s) found, first bitrate: ${te}`),((y=this.hls.userConfig)==null?void 0:y.abrEwmaDefaultEstimate)===void 0){const le=Math.min(te,this.hls.config.abrEwmaDefaultEstimateMax);le>_e&&_e===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=le)}break}const S=l&&!o,D=this.hls.config,M=!!(D.audioStreamController&&D.audioTrackController),U={levels:_,audioTracks:c,subtitleTracks:p,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:l,video:o,altAudio:M&&!S&&c.some(N=>!!N.url)};this.hls.trigger(w.MANIFEST_PARSED,U)}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:pe.OTHER_ERROR,details:X.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===Ae.LEVEL&&n.context.level===this.level&&this.checkRetry(n)}onFragBuffered(t,{frag:n}){if(n!==void 0&&n.type===P.MAIN){const s=n.elementaryStreams;if(!Object.keys(s).some(l=>!!s[l]))return;const o=this._levels[n.level];o!=null&&o.loadError&&(this.log(`Resetting level error count of ${o.loadError} on frag buffered`),o.loadError=0)}}onLevelLoaded(t,n){var s;const{level:o,details:l}=n,c=n.levelInfo;if(!c){var 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));nl(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 Ho(h){const t={};h.forEach(n=>{const s=n.groupId||"";n.id=t[s]=t[s]||0,t[s]++})}function Lu(){return self.SourceBuffer||self.WebKitSourceBuffer}function Ia(){if(!Ee())return!1;const t=Lu();return!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function"}function Pa(){if(!Ia())return!1;const h=Ee();return typeof(h==null?void 0:h.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>h.isTypeSupported(zt(t,"video")))||["mp4a.40.2","fLaC"].some(t=>h.isTypeSupported(zt(t,"audio"))))}function Md(){var h;const t=Lu();return typeof(t==null||(h=t.prototype)==null?void 0:h.changeType)=="function"}const Sf=100;class Bc extends Cn{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(Sf),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=st.IDLE,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}else this._forceStartLoad=!0,this.state=st.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case st.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=st.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=st.IDLE;break}break}case st.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=st.IDLE}}break}this.state===st.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 U={};this.altAudio===2&&(U.type="video"),this.hls.trigger(w.BUFFER_EOS,U),this.state=st.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===st.WAITING_LEVEL||this.waitForLive(c)){this.level=l,this.state=st.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 D=this.getNextFragment(S,m);if(this.couldBacktrack&&!this.fragPrevious&&D&&ze(D)&&this.fragmentTracker.getState(D)!==Ki.OK){var M;const N=((M=this.backtrackFragment)!=null?M:D).sn-m.startSN,te=m.fragments[N-1];te&&D.cc===te.cc&&(D=te,this.fragmentTracker.removeFragment(te))}else this.backtrackFragment&&p.len&&(this.backtrackFragment=null);if(D&&this.isLoopLoading(D,S)){if(!D.gap){const N=this.audioOnly&&!this.altAudio?G.AUDIO:G.VIDEO,te=(N===G.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;te&&this.afterBufferFlushed(te,N,P.MAIN)}D=this.getNextFragmentLoopLoading(D,m,p,P.MAIN,y)}D&&(D.initSegment&&!D.initSegment.data&&!this.bitrateTest&&(D=D.initSegment),this.loadFragment(D,c,S))}loadFragment(t,n,s){const o=this.fragmentTracker.getState(t);o===Ki.NOT_LOADED||o===Ki.PARTIAL?ze(t)?this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,n)):super.loadFragment(t,n,s):this._loadInitSegment(t,n):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,P.MAIN)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:n}=this;if(n!=null&&n.readyState){let s;const o=this.getAppendedFrag(n.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);const l=this.getLevelDetails();if(l!=null&&l.live){const 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 st.KEY_LOADING:case st.FRAG_LOADING:case st.FRAG_LOADING_WAITING_RETRY:case st.PARSING:case st.PARSED:this.state=st.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;Hn(s,"playing",this.onMediaPlaying),Hn(s,"seeked",this.onMediaSeeked)}onMediaDetaching(t,n){const{media:s}=this;s&&(Br(s,"playing",this.onMediaPlaying),Br(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&&!Md(),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!==st.IDLE)return;const o=n.levelInfo;(!o.details||o.details.live&&(this.levelLastLoaded!==o||o.details.expired)||this.waitForCdnTuneIn(o.details))&&(this.state=st.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===st.FRAG_LOADING||this.state===st.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===st.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=st.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=si.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:D}=si.bufferedInfo(y.buffered,l,0);D&&(s.currentTime=D)}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),D=this.transmuxer=this.transmuxer||new ro(this.hls,P.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),M=o?o.index:-1,U=M!==-1,N=new or(s.level,s.sn,s.stats.chunkCount,l.byteLength,M,U),te=this.initPTS[s.cc];D.push(l,y,S,m,s,o,_.totalduration,v,N,te)}onAudioTrackSwitching(t,n){const s=this.hls,o=this.altAudio===2;if(Zt(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=Zt(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===st.PARSED&&(this.state=st.IDLE);return}const p=o?o.stats:s.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),ze(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,o)}const c=this.media;c&&(!this._hasEnoughToStart&&si.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=st.ERROR;return}switch(n.details){case X.FRAG_GAP:case X.FRAG_PARSING_ERROR:case X.FRAG_DECRYPT_ERROR:case X.FRAG_LOAD_ERROR:case X.FRAG_LOAD_TIMEOUT:case X.KEY_LOAD_ERROR:case X.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.MAIN,n);break;case X.LEVEL_LOAD_ERROR:case X.LEVEL_LOAD_TIMEOUT:case X.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===st.WAITING_LEVEL&&((s=n.context)==null?void 0:s.type)===Ae.LEVEL&&(this.state=st.IDLE);break;case X.BUFFER_ADD_CODEC_ERROR:case X.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.resetLoadingState();break;case X.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case X.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=st.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(t,{type:n}){if(n!==G.AUDIO||!this.altAudio){const s=(n===G.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,n,P.MAIN),this.tick())}}onLevelsUpdated(t,n){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=n.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const n=t.currentTime;let s=this.startPosition;if(s>=0&&n<s){if(t.seeking){this.log(`could not seek to ${s}, already seeking at ${n}`);return}const o=this.timelineOffset;o&&s&&(s+=o);const l=this.getLevelDetails(),c=si.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=st.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:D,initSegment:M}=l,{details:U}=v,N=this.altAudio?void 0:l.audio;if(this.fragContextChanged(_)){this.fragmentTracker.removeFragment(_);return}if(this.state=st.PARSING,M){if(M!=null&&M.tracks){const Re=_.initSegment||_;this._bufferInitSegment(v,M.tracks,Re,c),o.trigger(w.FRAG_PARSING_INIT_SEGMENT,{frag:Re,id:s,tracks:M.tracks})}const te=M.initPTS,_e=M.timescale,le=this.initPTS[_.cc];ue(te)&&(!le||le.baseTime!==te||le.timescale!==_e)&&(this.initPTS[_.cc]={baseTime:te,timescale:_e},o.trigger(w.INIT_PTS_FOUND,{frag:_,id:s,initPTS:te,timescale:_e}))}if(y&&U){N&&y.type==="audiovideo"&&this.logMuxedErr(_);const te=U.fragments[_.sn-1-U.startSN],_e=_.sn===U.startSN,le=!te||_.cc>te.cc;if(l.independent!==!1){const{startPTS:Re,endPTS:Ue,startDTS:_t,endDTS:Ne}=y;if(m)m.elementaryStreams[y.type]={startPTS:Re,endPTS:Ue,startDTS:_t,endDTS:Ne};else if(y.firstKeyFrame&&y.independent&&c.id===1&&!le&&(this.couldBacktrack=!0),y.dropped&&y.independent){const We=this.getMainFwdBufferInfo(),tt=(We?We.end:this.getLoadPosition())+this.config.maxBufferHole,Oe=y.firstKeyFramePTS?y.firstKeyFramePTS:Re;if(!_e&&tt<Oe-this.config.maxBufferHole&&!le){this.backtrack(_);return}else le&&(_.gap=!0);_.setElementaryStreamInfo(y.type,_.start,Ue,_.start,Ne,!0)}else _e&&Re-(U.appliedTimelineOffset||0)>Ra&&(_.gap=!0);_.setElementaryStreamInfo(y.type,Re,Ue,_t,Ne),this.backtrackFragment&&(this.backtrackFragment=_),this.bufferFragmentData(y,_,m,c,_e||le)}else if(_e||le)_.gap=!0;else{this.backtrack(_);return}}if(N){const{startPTS:te,endPTS:_e,startDTS:le,endDTS:Re}=N;m&&(m.elementaryStreams[G.AUDIO]={startPTS:te,endPTS:_e,startDTS:le,endDTS:Re}),_.setElementaryStreamInfo(G.AUDIO,te,_e,le,Re),this.bufferFragmentData(N,_,m,c)}if(U&&D!=null&&(n=D.samples)!=null&&n.length){const te={id:s,frag:_,details:U,samples:D.samples};o.trigger(w.FRAG_PARSING_METADATA,te)}if(U&&S){const te={id:s,frag:_,details:U,samples:S.samples};o.trigger(w.FRAG_PARSING_USERDATA,te)}}logMuxedErr(t){this.warn(`${ze(t)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${t.url}`)}_bufferInitSegment(t,n,s,o){if(this.state!==st.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){const m=t.audioCodec;let v=ve(l.codec,m);v==="mp4a"&&(v="mp4a.40.5");const y=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){v&&(v.indexOf("mp4a.40.5")!==-1?v="mp4a.40.2":v="mp4a.40.5");const S=l.metadata;S&&"channelCount"in S&&(S.channelCount||1)!==1&&y.indexOf("firefox")===-1&&(v="mp4a.40.5")}v&&v.indexOf("mp4a.40.5")!==-1&&y.indexOf("android")!==-1&&l.container!=="audio/mpeg"&&(v="mp4a.40.2",this.log(`Android: force audio codec to ${v}`)),m&&m!==v&&this.log(`Swapping manifest audio codec "${m}" for "${v}"`),l.levelCodec=v,l.id=P.MAIN,this.log(`Init audio buffer, container:${l.container}, codecs[selected/level/parsed]=[${v||""}/${m||""}/${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=st.IDLE}checkFragmentChanged(){const t=this.media;let n=null;if(t&&t.readyState>1&&t.seeking===!1){const s=t.currentTime;if(si.isBuffered(t,s)?n=this.getAppendedFrag(s):si.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?Ai(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 Ef{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=X.KEY_LOAD_ERROR,s,o,l){return new Un({type:pe.NETWORK_ERROR,details:n,fatal:!1,frag:t,response:l,error:s,networkDetails:o})}loadClear(t,n,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(n.length)for(let o=0,l=n.length;o<l;o++){const c=n[o];if(t.cc<=c.cc&&(!ze(t)||!ze(c)||t.sn<c.sn)||!s&&o==l-1)return this.emeController.selectKeySystemFormat(c).then(p=>{if(!this.emeController)return;c.setKeyFormat(p);const _=Qr(p);if(_)return this.emeController.getKeySystemAccess([_])})}if(this.config.requireKeySystemAccessOnStart){const o=Es(this.config);if(o.length)return this.emeController.getKeySystemAccess(o)}}return null}load(t){return!t.decryptdata&&t.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(t).then(n=>this.loadInternal(t,n)):this.loadInternal(t)}loadInternal(t,n){var s,o;n&&t.setKeyFormat(n);const l=t.decryptdata;if(!l){const 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,X.KEY_LOAD_ERROR,m))}const c=l.uri;if(!c)return Promise.reject(this.createKeyLoadError(t,X.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,X.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,D,M,U)=>{const{frag:N,keyInfo:te,url:_e}=M;if(!N.decryptdata||te!==this.keyUriToKeyInfo[_e])return p(this.createKeyLoadError(N,X.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),U));te.decryptdata.key=N.decryptdata.key=new Uint8Array(S.data),N.keyLoader=null,te.loader=null,c({frag:N,keyInfo:te})},onError:(S,D,M,U)=>{this.resetLoader(D),p(this.createKeyLoadError(n,X.KEY_LOAD_ERROR,new Error(`HTTP Error ${S.code} loading key ${S.text}`),M,C({url:_.url,data:void 0},S)))},onTimeout:(S,D,M)=>{this.resetLoader(D),p(this.createKeyLoadError(n,X.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),M))},onAbort:(S,D,M)=>{this.resetLoader(D),p(this.createKeyLoadError(n,X.INTERNAL_ABORTED,new Error("key loading aborted"),M))}};l.load(_,v,y)})}resetLoader(t){const{frag:n,keyInfo:s,url:o}=t,l=s.loader;n.keyLoader===l&&(n.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[o],l&&l.destroy()}}function kf(h){const{type:t}=h;switch(t){case Ae.AUDIO_TRACK:return P.AUDIO;case Ae.SUBTITLE_TRACK:return P.SUBTITLE;default:return P.MAIN}}function Nc(h,t){let n=h.url;return(n===void 0||n.indexOf("data:")===0)&&(n=t.url),n}class Rd{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:Ae.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:Ae.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:Ae.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:Ae.SUBTITLE_TRACK,url:l,deliveryDirectives:c,levelOrTrack:p})}onLevelsUpdated(t,n){const s=this.loaders[Ae.LEVEL];if(s){const o=s.context;o&&!n.levels.some(l=>l===o.levelOrTrack)&&(s.abort(),delete this.loaders[Ae.LEVEL])}}load(t){var n;const s=this.hls.config;let o=this.getInternalLoader(t);if(o){const 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===Ae.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===Ae.LEVEL&&t.level!==null?m=this.hls.levels[t.level].details:t.type===Ae.AUDIO_TRACK&&t.id!==null?m=this.hls.audioTracks[t.id].details:t.type===Ae.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 D=this.getInternalLoader(y);this.resetInternalLoader(y.type);const M=m.data;if(M.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(m,y,new Error("no EXTM3U delimiter"),S||null,v);return}v.parsing.start=performance.now(),ps.isMediaPlaylist(M)||y.type!==Ae.MANIFEST?this.handleTrackOrLevelPlaylist(m,v,y,S||null,D):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=Nc(t,s),_=ps.parseMasterPlaylist(c,p);if(_.playlistParsingError){this.handleManifestParsingError(t,s,_.playlistParsingError,o,n);return}const{contentSteering:m,levels:v,sessionData:y,sessionKeys:S,startTimeOffset:D,variableList:M}=_;this.variableList=M;const{AUDIO:U=[],SUBTITLES:N,"CLOSED-CAPTIONS":te}=ps.parseMasterPlaylistMedia(c,p,_);U.length&&!U.some(le=>!le.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"),U.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ri({}),bitrate:0,url:""})),l.trigger(w.MANIFEST_LOADED,{levels:v,audioTracks:U,subtitles:N,captions:te,contentSteering:m,url:p,stats:n,networkDetails:o,sessionData:y,sessionKeys:S,startTimeOffset:D,variableList:M})}handleTrackOrLevelPlaylist(t,n,s,o,l){const c=this.hls,{id:p,level:_,type:m}=s,v=Nc(t,s),y=ue(_)?_:ue(p)?p:0,S=kf(s),D=ps.parseLevelPlaylist(t.data,v,y,S,0,this.variableList);if(m===Ae.MANIFEST){const M={attrs:new Ri({}),bitrate:0,details:D,name:"",url:v};D.requestScheduled=n.loading.start+ko(D,0),c.trigger(w.MANIFEST_LOADED,{levels:[M],audioTracks:[],url:v,stats:n,networkDetails:o,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),s.levelDetails=D,this.handlePlaylistLoaded(D,t,n,s,o,l)}handleManifestParsingError(t,n,s,o,l){this.hls.trigger(w.ERROR,{type:pe.NETWORK_ERROR,details:X.MANIFEST_PARSING_ERROR,fatal:n.type===Ae.MANIFEST,url:t.url,err:s,error:s,reason:s.message,response:t,context:n,networkDetails:o,stats:l})}handleNetworkError(t,n,s=!1,o,l){let c=`A network ${s?"timeout":"error"+(o?" (status "+o.code+")":"")} occurred while loading ${t.type}`;t.type===Ae.LEVEL?c+=`: ${t.level} id: ${t.id}`:(t.type===Ae.AUDIO_TRACK||t.type===Ae.SUBTITLE_TRACK)&&(c+=` id: ${t.id} group-id: "${t.groupId}"`);const p=new Error(c);this.hls.logger.warn(`[playlist-loader]: ${c}`);let _=X.UNKNOWN,m=!1;const v=this.getInternalLoader(t);switch(t.type){case Ae.MANIFEST:_=s?X.MANIFEST_LOAD_TIMEOUT:X.MANIFEST_LOAD_ERROR,m=!0;break;case Ae.LEVEL:_=s?X.LEVEL_LOAD_TIMEOUT:X.LEVEL_LOAD_ERROR,m=!1;break;case Ae.AUDIO_TRACK:_=s?X.AUDIO_TRACK_LOAD_TIMEOUT:X.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case Ae.SUBTITLE_TRACK:_=s?X.SUBTITLE_TRACK_LOAD_TIMEOUT:X.SUBTITLE_LOAD_ERROR,m=!1;break}v&&this.resetInternalLoader(t.type);const y={type:pe.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=C({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,D=Nc(n,o),M=kf(o),U=typeof o.level=="number"&&M===P.MAIN?m:void 0;if(!t.fragments.length){const te=t.playlistParsingError=new Error("No Segments found in Playlist");p.trigger(w.ERROR,{type:pe.NETWORK_ERROR,details:X.LEVEL_EMPTY_ERROR,fatal:!1,url:D,error:te,reason:te.message,response:n,context:o,level:U,parent:M,networkDetails:l,stats:s});return}t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));const N=t.playlistParsingError;if(N){if(this.hls.logger.warn(N),!p.config.ignorePlaylistParsingErrors){p.trigger(w.ERROR,{type:pe.NETWORK_ERROR,details:X.LEVEL_PARSING_ERROR,fatal:!1,url:D,error:N,reason:N.message,response:n,context:o,level:U,parent:M,networkDetails:l,stats:s});return}t.playlistParsingError=null}switch(t.live&&c&&(c.getCacheAge&&(t.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(t.ageHeader))&&(t.ageHeader=0)),_){case Ae.MANIFEST:case Ae.LEVEL:p.trigger(w.LEVEL_LOADED,{details:t,levelInfo:o.levelOrTrack||p.levels[0],level:U||0,id:v||0,stats:s,networkDetails:l,deliveryDirectives:S,withoutMultiVariant:_===Ae.MANIFEST});break;case Ae.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 Ae.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 Oa{static get version(){return As}static isMSESupported(){return Ia()}static isSupported(){return Pa()}static getMediaSource(){return Ee()}static get Events(){return w}static get MetadataSchema(){return us}static get ErrorTypes(){return pe}static get ErrorDetails(){return X}static get DefaultConfig(){return Oa.defaultConfig?Oa.defaultConfig:Td}static set DefaultConfig(t){Oa.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 to,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const n=this.logger=Te(t.debug||!1,"Hls instance",t.assetPlayerId),s=this.config=xf(Oa.DefaultConfig,t,n);this.userConfig=t,s.progressive&&Mr(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 Rn(this),S=s.interstitialsController,D=S?this.interstitialsController=new S(this,Oa):null,M=this.bufferController=new l(this,y),U=this.capLevelController=new c(this),N=new _(this),te=new Rd(this),_e=s.contentSteeringController,le=_e?new _e(this):null,Re=this.levelController=new Cl(this,le),Ue=new Dd(this),_t=new Ef(this.config),Ne=this.streamController=new Bc(this,y,_t),We=this.gapController=new Ld(this,y);U.setStreamController(Ne),N.setStreamController(Ne);const tt=[te,Re,Ne];D&&tt.splice(1,0,D),le&&tt.splice(1,0,le),this.networkControllers=tt;const Oe=[v,M,We,U,N,Ue,y];this.audioTrackController=this.createController(s.audioTrackController,tt);const Rt=s.audioStreamController;Rt&&tt.push(this.audioStreamController=new Rt(this,y,_t)),this.subtitleTrackController=this.createController(s.subtitleTrackController,tt);const ei=s.subtitleStreamController;ei&&tt.push(this.subtititleStreamController=new ei(this,y,_t)),this.createController(s.timelineController,Oe),_t.emeController=this.emeController=this.createController(s.emeController,Oe),this.cmcdController=this.createController(s.cmcdController,Oe),this.latencyController=this.createController(Cd,Oe),this.coreComponents=Oe,tt.push(m);const pi=m.onErrorOut;typeof pi=="function"&&this.on(w.ERROR,pi,m),this.on(w.MANIFEST_LOADED,te.onManifestLoaded,te)}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:pe.OTHER_ERROR,details:X.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:pe.OTHER_ERROR,details:X.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=A.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${o}`),n&&s&&(s!==o||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(n)),this.trigger(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=Ac()),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){ji(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=wi(n);return oi(t,s,navigator.mediaCapabilities)}}Oa.defaultConfig=void 0},48136:function(Ci,Ft,re){"use strict";var ue=Object.defineProperty,we=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,Ae=(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={}))X.call(i,r)&&Ae(e,r,i[r]);if(pe)for(var r of pe(i))w.call(i,r)&&Ae(e,r,i[r]);return e},f=(e,i)=>we(e,Ye(i)),ie=e=>typeof e=="symbol"?e:e+"",I=(e,i)=>{var r={};for(var a in e)X.call(e,a)&&i.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&pe)for(var a of pe(e))i.indexOf(a)<0&&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 C(){return"window"in globalThis&&"document"in globalThis}function O(){return"matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0}function J(){return typeof navigator.vibrate=="function"}function H(){var e,i;if(!C())return"other";const r=(i=(e=navigator.userAgentData)==null?void 0:e.platform)!=null?i:navigator.platform;return/^mac/i.test(r)?navigator.maxTouchPoints===5?"ios":"macos":/^win/i.test(r)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function j(){if(!C())return!0;if(/firefox/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/firefox\/(\d+)/i);return e?parseInt(e[1])>=78:!1}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/edg\/(\d+)/i);return e?parseInt(e[1])>=79:!1}return!0}function $(){return HTMLElement.prototype.hasOwnProperty("popover")}var B={strings:T,_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return B._locale||(B._locale=C()?navigator.language.slice(0,5):"en-US"),B._locale},set locale(e){B._locale=e,B._numberFormatter=void 0,B.dirty=!0},get numberFormatter(){return B._numberFormatter||(B._numberFormatter=new Intl.NumberFormat(B.locale)),B._numberFormatter},merge(e,i){if(typeof e=="string"&&i)B.strings[e]=P(P({},B.strings[e]),i),B.dirty=!0;else for(const r of Object.keys(e))B.merge(r,e[r])},get dirty(){return B._dirty},set dirty(e){B._dirty||B._dirty===e||(B._dirty=!0,setTimeout(()=>{B._dirty=!1,this._subscribers.forEach(i=>i==null?void 0:i())},0))},subscribe(e){return B._subscribers.push(e),B._subscribers.length-1},unsubscribe(e){e<0||e>=B._subscribers.length||(B._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=B.locale;B.strings[a]&&(r=B.strings[a][e]);const u=a.slice(0,2);if(!r&&B.strings[u]&&(r=B.strings[u][e]),r||(r=B.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=B.numberFormatter.format(R)),r=r.replace(g[1],R)}g=d.exec(r)}return r=r.replace(/%%/g,"%"),r}var he={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},be={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},Te={red:"#fbbbb6",orange:"#ffe0c2",yellow:"#fff1c2",lime:"#d0e8b9",green:"#bceac4",teal:"#b9f1f1",cyan:"#b8e5c9",blue:"#b6d9fb",indigo:"#d1c2f0",purple:"#e3baf8",magenta:"#f9c8e0",black:"#353535","dark-grey":"#8C8C8C",grey:"#D0D0D0","light-grey":"#F0F0F0",white:"#ffffff"},se={red:"#d7170b",orange:"#fe8a2b",yellow:"#ffc02b",lime:"#63b215",green:"#21ba3a",teal:"#17cfcf",cyan:"#13a7ec",blue:"#0d80f2",indigo:"#63c",purple:"#a219e6",magenta:"#eb4799",black:"#000","dark-grey":"#666",grey:"#A6A6A6","light-grey":"#d4d5d2",white:"#ffffff"},Ee={Red:"red",Orange:"orange",Yellow:"yellow",LimeGreen:"lime",Green:"green",TealBlue:"teal",Blue:"blue",Violet:"indigo",Purple:"purple",Magenta:"magenta",Black:"black",Gray:"grey",White:"white"},je={Apricot:"#FBB982",Aquamarine:"#00B5BE",Bittersweet:"#C04F17",Black:"#221E1F",Blue:"#2D2F92",BlueGreen:"#00B3B8",BlueViolet:"#473992",BrickRed:"#B6321C",Brown:"#792500",BurntOrange:"#F7921D",CadetBlue:"#74729A",CarnationPink:"#F282B4",Cerulean:"#00A2E3",CornflowerBlue:"#41B0E4",Cyan:"#00AEEF",Dandelion:"#FDBC42",DarkOrchid:"#A4538A",Emerald:"#00A99D",ForestGreen:"#009B55",Fuchsia:"#8C368C",Goldenrod:"#FFDF42",Gray:"#949698",Green:"#00A64F",GreenYellow:"#DFE674",JungleGreen:"#00A99A",Lavender:"#F49EC4",Limegreen:"#8DC73E",Magenta:"#EC008C",Mahogany:"#A9341F",Maroon:"#AF3235",Melon:"#F89E7B",MidnightBlue:"#006795",Mulberry:"#A93C93",NavyBlue:"#006EB8",OliveGreen:"#3C8031",Orange:"#F58137",OrangeRed:"#ED135A",Orchid:"#AF72B0",Peach:"#F7965A",Periwinkle:"#7977B8",PineGreen:"#008B72",Plum:"#92268F",ProcessBlue:"#00B0F0",Purple:"#99479B",RawSienna:"#974006",Red:"#ED1B23",RedOrange:"#F26035",RedViolet:"#A1246B",Rhodamine:"#EF559F",RoyalBlue:"#0071BC",RoyalPurple:"#613F99",RubineRed:"#ED017D",Salmon:"#F69289",SeaGreen:"#3FBC9D",Sepia:"#671800",SkyBlue:"#46C5DD",SpringGreen:"#C6DC67",Tan:"#DA9D76",TealBlue:"#00AEB3",Thistle:"#D883B7",Turquoise:"#00B4CE",Violet:"#58429B",VioletRed:"#EF58A0",White:"#FFFFFF",WildStrawberry:"#EE2967",Yellow:"#FFF200",YellowGreen:"#98CC70",YellowOrange:"#FAA21A"};function Ke(e){var i,r,a,u,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],Et=Ve==null?void 0:Ve.toLowerCase(),Kt=Ve&&(g=(d=(u=(a=(r=se[Et])!=null?r:se[Ee[Ve]])!=null?a:be[Ve])!=null?u:je[Ve])!=null?d:he[Ve])!=null?g:b[Ot].trim();let Tt=Kt.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(Tt!=null&&Tt[1]&&Tt[2]&&Tt[3])F=Math.max(0,Math.min(255,Number.parseInt(Tt[1],16))),Y=Math.max(0,Math.min(255,Number.parseInt(Tt[2],16))),oe=Math.max(0,Math.min(255,Number.parseInt(Tt[3],16)));else if(Tt=Kt.match(/^#([\da-f]{3})$/i),Tt!=null&&Tt[1]){const ai=Number.parseInt(Tt[1][0],16),bi=Number.parseInt(Tt[1][1],16),hi=Number.parseInt(Tt[1][2],16);F=Math.max(0,Math.min(255,ai*16+ai)),Y=Math.max(0,Math.min(255,bi*16+bi)),oe=Math.max(0,Math.min(255,hi*16+hi))}else if(Tt=Kt.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),Tt!=null&&Tt[1]&&Tt[2]&&Tt[3])F=Math.max(0,Math.min(255,Number.parseInt(Tt[1]))),Y=Math.max(0,Math.min(255,Number.parseInt(Tt[2]))),oe=Math.max(0,Math.min(255,Number.parseInt(Tt[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 It(e){var i,r;return e=e.trim(),(r=(i=Te[e.toLowerCase()])!=null?i:Te[Ee[e]])!=null?r:Ke(e)}function ee(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 Z(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 fe(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 ne(e){let{r:i,g:r,b:a}=e;i=i/255,r=r/255,a=a/255;const u=Math.min(i,r,a),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 A(e){let i=ee(e);if(!i)return e;let{h:r,s:a,l:u}=ne(i);return a+=.1,u-=.1,fe(Z({h:r,s:a,l:u}))}var L={60:"\\lt",62:"\\gt",111:"o",38:"\\&",123:"\\lbrace",125:"\\rbrace",91:"\\lbrack",93:"\\rbrack",58:"\\colon",160:"~",172:"\\neg",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",8224:"\\dagger",8225:"\\ddagger",8230:"\\ldots",8308:"^{4}",8309:"^{5}",8310:"^{6}",8311:"^{7}",8312:"^{8}",8313:"^{9}",8314:"^{+}",8315:"^{-}",8316:"^{=}",8319:"^{n}",8320:"_{0}",8321:"_{1}",8322:"_{2}",8323:"_{3}",8324:"_{4}",8325:"_{5}",8326:"_{6}",8327:"_{7}",8328:"_{8}",8329:"_{9}",8330:"_{+}",8331:"_{-}",8332:"_{=}",8336:"_{a}",8337:"_{e}",8338:"_{o}",8339:"_{x}",8242:"\\prime",39:"\\prime",8592:"\\gets",8594:"\\to",9651:"\\triangle",9661:"\\triangledown",8715:"\\owns",8727:"\\ast",8739:"\\vert",8741:"\\Vert",8743:"\\land",8744:"\\lor",8901:"\\cdot",8904:"\\bowtie",8800:"\\ne",8804:"\\le",8805:"\\ge",8869:"\\bot",10231:"\\biconditional",10232:"\\impliedby",10233:"\\implies",10234:"\\iff",8450:"\\mathbb{C}",8469:"\\mathbb{N}",8473:"\\mathbb{P}",8474:"\\mathbb{Q}",8477:"\\mathbb{R}",8484:"\\mathbb{Z}",8461:"\\mathbb{H}",8476:"\\Re",8465:"\\Im",42:"\\ast",11036:"\\square",9633:"\\square",8720:"\\coprod",8716:"\\not\\ni",9671:"\\diamond",8846:"\\uplus",8851:"\\sqcap",8852:"\\sqcup",8768:"\\wr",8750:"\\oint",8226:"\\textbullet",8722:"-",978:"\\Upsilon"},G={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},de=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{start:119964,len:26,offset:65,variant:"script"},{start:119990,len:26,offset:97,variant:"script"},{start:120016,len:26,offset:65,variant:"script",style:"bold"},{start:120042,len:26,offset:97,variant:"script",style:"bold"},{start:120068,len:26,offset:65,variant:"fraktur"},{start:120094,len:26,offset:97,variant:"fraktur"},{start:120172,len:26,offset:65,variant:"fraktur",style:"bold"},{start:120198,len:26,offset:97,variant:"fraktur",style:"bold"},{start:120120,len:26,offset:65,variant:"double-struck"},{start:120146,len:26,offset:97,variant:"double-struck"},{start:120224,len:26,offset:65,variant:"sans-serif"},{start:120250,len:26,offset:97,variant:"sans-serif"},{start:120276,len:26,offset:65,variant:"sans-serif",style:"bold"},{start:120302,len:26,offset:97,variant:"sans-serif",style:"bold"},{start:120328,len:26,offset:65,variant:"sans-serif",style:"italic"},{start:120354,len:26,offset:97,variant:"sans-serif",style:"italic"},{start:120380,len:26,offset:65,variant:"sans-serif",style:"bolditalic"},{start:120406,len:26,offset:97,variant:"sans-serif",style:"bolditalic"},{start:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,style:"bolditalic"},{start:120662,len:25,offset:913,variant:"sans-serif",style:"bold"},{start:120688,len:25,offset:945,variant:"sans-serif",style:"bold"},{start:120720,len:25,offset:913,variant:"sans-serif",style:"bolditalic"},{start:120746,len:25,offset:945,variant:"sans-serif",style:"bolditalic"},{start:120782,len:10,offset:48,variant:"main",style:"bold"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"},{start:120822,len:10,offset:48,variant:"monospace"}];function ze(e,i,r){if(!/[A-Za-z\d]/.test(e)||(r==="up"&&(r=void 0),!i&&!r))return e;const a=e.codePointAt(0);if(a===void 0)return e;for(const u of de)if((!i||u.variant===i)&&(!r||u.style===r)&&a>=u.offset&&a<u.offset+u.len){const d=u.start+a-u.offset;return String.fromCodePoint(G[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 G)if(G[r]===e){e=(i=r.codePointAt(0))!=null?i:0;break}for(const r of de)if(e>=r.start&&e<r.start+r.len)return{char:String.fromCodePoint(e-r.start+r.offset),variant:r.variant,style:r.style};return{char:String.fromCodePoint(e)}}function Ut(e){var i;let r="";for(const a of e){if("{}<>[]$&#^_%:'\u02DC".includes(a)){r+=a;continue}const u=(i=a.codePointAt(0))!=null?i:0;let d=L[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 Ie(e){return e?Array.isArray(e)?e:typeof e=="object"&&"group"in e?e.group:[]:[]}var Yt={},Pt=P({},L),St={},$e={},it={darr:"\\downarrow",dArr:"\\Downarrow",Darr:"\\Downarrow",lang:"\\langle",rang:"\\rangle",uarr:"\\uparrow",uArr:"\\Uparrow",Uarr:"\\Uparrow",N:"\\mathbb{N}",R:"\\mathbb{R}",Z:"\\mathbb{Z}",alef:"\\aleph",alefsym:"\\aleph",Alpha:"\\mathrm{A}",Beta:"\\mathrm{B}",bull:"\\bullet",Chi:"\\mathrm{X}",clubs:"\\clubsuit",cnums:"\\mathbb{C}",Complex:"\\mathbb{C}",Dagger:"\\ddagger",diamonds:"\\diamondsuit",empty:"\\emptyset",Epsilon:"\\mathrm{E}",Eta:"\\mathrm{H}",exist:"\\exists",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",Harr:"\\Leftrightarrow",hearts:"\\heartsuit",image:"\\Im",infin:"\\infty",Iota:"\\mathrm{I}",isin:"\\in",Kappa:"\\mathrm{K}",larr:"\\leftarrow",lArr:"\\Leftarrow",Larr:"\\Leftarrow",lrarr:"\\leftrightarrow",lrArr:"\\Leftrightarrow",Lrarr:"\\Leftrightarrow",Mu:"\\mathrm{M}",natnums:"\\mathbb{N}",Nu:"\\mathrm{N}",Omicron:"\\mathrm{O}",plusmn:"\\pm",rarr:"\\rightarrow",rArr:"\\Rightarrow",Rarr:"\\Rightarrow",real:"\\Re",reals:"\\mathbb{R}",Reals:"\\mathbb{R}",Rho:"\\mathrm{P}",sdot:"\\cdot",sect:"\\S",spades:"\\spadesuit",sub:"\\subset",sube:"\\subseteq",supe:"\\supseteq",Tau:"\\mathrm{T}",thetasym:"\\vartheta",weierp:"\\wp",Zeta:"\\mathrm{Z}"},mt={varGamma:"\\mathit{\\Gamma}",varDelta:"\\mathit{\\Delta}",varTheta:"\\mathit{\\Theta}",varLambda:"\\mathit{\\Lambda}",varXi:"\\mathit{\\Xi}",varPi:"\\mathit{\\Pi}",varSigma:"\\mathit{\\Sigma}",varUpsilon:"\\mathit{\\Upsilon}",varPhi:"\\mathit{\\Phi}",varPsi:"\\mathit{\\Psi}",varOmega:"\\mathit{\\Omega}",pmod:{def:"\\quad(\\operatorname{mod}\\ #1)",args:1,expand:!1,captureSelection:!1},mod:{def:"\\quad\\operatorname{mod}\\,\\,#1",args:1,expand:!1},bmod:{def:"\\;\\mathbin{\\operatorname{mod }}",expand:!1}},ht={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}},ti={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:ht},"amsmath.sty":{package:mt,primitive:!0},"texvc.sty":{package:it,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},Be=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/,me,Xe;j()?(me=new RegExp("\\p{Letter}","u"),Xe=new RegExp("[0-9\\p{Letter}]","u")):(me=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,Xe=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/);function at(e,i,r="mord",a){i!==void 0&&(Yt[e]={definitionType:"symbol",type:r,variant:a,codepoint:i},Pt[i]||(Pt[i]=e))}function Je(e,i,r){if(typeof e=="string"){for(let a=0;a<e.length;a++){const u=e.charAt(a);at(u,u.codePointAt(0))}return}for(const[a,u,d,g]of e)at(a,u,d!=null?d:i,g!=null?g:r)}function q(e,i){for(let r=e;r<=i;r++)at(String.fromCodePoint(r),r)}function ye(e){var i;return(i=$e[e])!=null?i:null}function Fe(e,i){var r,a;if(i.length===0||i==="\\"||!i.startsWith("\\"))return[];const u=[];for(const g in St)g.startsWith(i)&&!St[g].infix&&u.push({match:g,frequency:(r=St[g].frequency)!=null?r:0});for(const g in Yt)g.startsWith(i)&&u.push({match:g,frequency:(a=Yt[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 ot(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(...ot(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(...ot(r[a]))}return i}function bt(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 qt(e,i){typeof e=="string"&&(e=[e]);const r={tabular:!1,params:[],createAtom:i};for(const a of e)$e[a]=r}function vt(e,i,r){typeof e=="string"&&(e=[e]);const u={tabular:!0,params:ot(i),createAtom:r};for(const d of e)$e[d]=u}function Se(e,i,r){var a,u;r||(r={});const d={definitionType:"function",params:ot(i),ifMode:r.ifMode,isFunction:(a=r.isFunction)!=null?a:!1,applyMode:r.applyMode,infix:(u=r.infix)!=null?u:!1,parse:r.parse,createAtom:r.createAtom,applyStyle:r.applyStyle,serialize:r.serialize,render:r.render};if(typeof e=="string")St["\\"+e]=d;else for(const g of e)St["\\"+g]=d}var xt;function Wt(e){return xt||(xt=Le(ti)),e?Le(P(P({},xt),e)):xt}function Gt(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 Le(e){if(!e)return{};const i={};for(const r of Object.keys(e)){const a=e[r];if(a==null)delete i[r];else if(typeof a=="object"&&"package"in a)for(const u of Object.keys(a.package))i[u]=Gt(a.package[u],{expand:!a.primitive,captureSelection:a.captureSelection});else i[r]=Gt(a)}return i}function Me(e,i="math"){if(!e||e.length===0)return null;let r=null;if(e.startsWith("\\")){if(r=St[e],r)return!r.ifMode||r.ifMode===i?r:null;i==="math"?r=Yt[e]:Ce[e]&&(r={definitionType:"symbol",type:"mord",codepoint:Ce[e]})}else if(i==="math"){if(r=Yt[e],!r&&e.length===1){const a=wt("math",e.codePointAt(0));return a.startsWith("\\")?f(P({},Me(a,"math")),{command:a}):null}}else Ce[e]?r={definitionType:"symbol",type:"mord",codepoint:Ce[e]}:i==="text"&&(r={definitionType:"symbol",type:"mord",codepoint:e.codePointAt(0)});return r!=null?r:null}function rt(e,i){if(!e.startsWith("\\"))return null;const r=e.slice(1);return i[r]}function wt(e,i){if(i===void 0)return"";if(e==="math"&&Pt[i])return Pt[i];if(e==="text"){const r=Object.keys(Ce).find(a=>Ce[a]===i);return r||String.fromCodePoint(i)}return String.fromCodePoint(i)}var qe=[0,.68889,0,0,.72222],Ct=[0,.68889,0,0,.66667],Lt=[0,.68889,0,0,.77778],kt=[0,.68889,0,0,.61111],Nt=[.16667,.68889,0,0,.77778],Xt=[0,.68889,0,0,.55556],Qe=[0,0,0,0,.25],zt=[0,.825,0,0,2.33334],De=[0,.9,0,0,2.33334],xe=[0,.68889,0,0,.54028],ke=[-.03598,.46402,0,0,.5],K=[-.13313,.36687,0,0,1],W=[.01354,.52239,0,0,1],ae=[.01354,.52239,0,0,1.11111],ce=[0,.54986,0,0,1],ve=[0,.69224,0,0,.5],ft=[0,.43056,0,0,1],yt=[.08198,.58198,0,0,.77778],ut=[.19444,.69224,0,0,.41667],Vt=[.1808,.675,0,0,1],ii=[.19444,.69224,0,0,.83334],mi=[.13667,.63667,0,0,1],ni=[-.064,.437,0,0,1.334],Dt=[.08167,.58167,0,0,.77778],oi=[0,.69224,0,0,.72222],Mi=[0,.69224,0,0,.66667],ki=[-.13313,.36687,0,0,.77778],Bi=[.06062,.54986,0,0,.77778],gi=[0,.69224,0,0,.77778],fi=[.25583,.75583,0,0,.77778],Vi=[.25142,.75726,0,0,.77778],ji=[.20576,.70576,0,0,.77778],en=[.30274,.79383,0,0,.77778],Yi=[.22958,.72958,0,0,.77778],er=[.1808,.675,0,0,.77778],Li=[.13667,.63667,0,0,.77778],zi=[.13597,.63597,0,0,.77778],sn=[.03517,.54986,0,0,.77778],Pi=[0,.675,0,0,.77778],bn=[.19444,.69224,0,0,.61111],an=[0,.54986,0,0,.76042],sr=[0,.54986,0,0,.66667],xi=[.0391,.5391,0,0,.77778],ur=[.03517,.54986,0,0,1.33334],jn=[.38569,.88569,0,0,.77778],wi=[.23222,.74111,0,0,.77778],li=[.19444,.69224,0,0,.77778],Pe=[0,.37788,0,0,.5],et=[0,.54986,0,0,.72222],gt=[0,.69224,0,0,.83334],lt=[.11111,.69224,0,0,.66667],At=[.26167,.75726,0,0,.77778],nt=[.48256,.98256,0,0,.77778],dt=[.28481,.79383,0,0,.77778],Bt=[.08167,.58167,0,0,.22222],Zt=[.08167,.58167,0,0,.38889],di=[0,.43056,.04028,0,.66667],Xi=[.41951,.91951,0,0,.77778],_i=[.24982,.74947,0,0,.38865],Ai=[.08319,.58283,0,0,.75623],Oi=[0,.10803,0,0,.27764],Gi=[0,.47534,0,0,.50181],Wi=[.18906,.47534,0,0,.50181],Si=[0,.69141,0,0,.50181],Di=[.24982,.74947,0,0,.27764],on=[0,.69141,0,0,.21471],$i=[.25,.75,0,0,.44722],Ti=[0,.64444,0,0,.575],Zi=[.08556,.58556,0,0,.89444],qi=[0,.69444,0,0,.89444],Fi=[0,.68611,0,0,.9],un=[0,.68611,0,0,.86944],dn=[.25,.75,0,0,.575],$n=[.25,.75,0,0,.31944],Ki=[0,.69444,0,0,.63889],Rn=[0,.69444,0,0,.31944],qn=[0,.44444,0,0,.63889],vn=[0,.44444,0,0,.51111],pn=[0,.69444,0,0,.575],cn=[.13333,.63333,0,0,.89444],Kn=[0,.44444,0,0,.31944],yr=[0,.69444,0,0,.86944],xn=[0,.68611,0,0,.69166],Ln=[0,.68611,0,0,.83055],dr=[0,.68611,0,0,.89444],Rr=[0,.69444,0,0,.60278],ar=[.19444,.69444,0,0,.51111],Lr=[0,.69444,0,0,.83055],Dn=[-.10889,.39111,0,0,1.14999],tr=[.19444,.69444,0,0,.575],Er=[.19444,.69444,0,0,1.14999],kr=[.19444,.69444,0,0,.70277],Un=[.05556,.75,0,0,.575],In=[0,.68611,0,0,.95833],or=[.08556,.58556,0,0,.76666],cr=[-.02639,.47361,0,0,.575],Ir=[0,.44444,0,0,.89444],si=[0,.55556,0,0,.76666],hr=[-.10889,.39111,0,0,.89444],br=[.00222,.50222,0,0,.89444],lr=[.19667,.69667,0,0,.89444],Hr=[.08556,.58556,0,0,1.14999],tn=[0,.69444,0,0,.70277],Ei=[-.02778,.47222,0,0,.575],nn=[.25,.75,0,0,.51111],Ri=[-.13889,.36111,0,0,1.14999],mr=[.19444,.69444,0,0,1.02222],Zn=[.12963,.69444,0,0,.89444],fr=[.19444,.69444,0,0,.44722],Pn=[0,.64444,.13167,0,.59111],os=[.19444,.64444,.13167,0,.59111],Tr=[0,.68611,.17208,0,.8961],Pr=[.19444,.44444,.105,0,.53222],Wr=[0,.44444,.085,0,.82666],jr=[0,.69444,.06709,0,.59111],Yn=[0,.69444,.12945,0,.35555],qr=[0,.69444,0,0,.94888],ds=[0,.69444,.11472,0,.59111],gr=[0,.68611,.10778,0,.88555],On=[0,.69444,.07939,0,.62055],Ji=[0,.69444,.12417,0,.30667],yn=[0,.64444,.13556,0,.51111],Qr=[.19444,.64444,.13556,0,.51111],ls=[0,.68333,.16389,0,.74333],Es=[.19444,.43056,.08847,0,.46],ta=[0,.43056,.07514,0,.71555],Us=[0,.69444,.06646,0,.51111],xa=[0,.69444,0,0,.83129],ci=[0,.69444,.1225,0,.51111],Ii=[0,.68333,.09403,0,.76666],wn=[0,.68333,.11111,0,.76666],Gn=[0,.69444,.06961,0,.51444],Sn=[0,.69444,0,0,.27778],es=[.25,.75,0,0,.38889],ir=[0,.64444,0,0,.5],ks=[0,.69444,0,0,.77778],Zr=[0,.68333,0,0,.75],wa=[0,.68333,0,0,.77778],ps=[0,.68333,0,0,.68056],Sa=[0,.68333,0,0,.72222],Is=[.25,.75,0,0,.5],Ea=[.25,.75,0,0,.27778],nr=[0,.69444,0,0,.5],ia=[0,.69444,0,0,.55556],ka=[0,.43056,0,0,.44445],ms=[0,.43056,0,0,.5],qa=[.19444,.43056,0,0,.55556],Eo=[0,.43056,0,0,.55556],ts=[.08333,.58333,0,0,.77778],gs=[0,.43056,0,0,.27778],Jo=[0,.66786,0,0,.27778],Za=[0,.69444,0,0,.75],Qo=[0,.66786,0,0,.5],Vl=[0,.68333,0,0,.625],el=[.19444,.69444,0,0,.44445],Ya=[0,.69444,0,0,.72222],tl=[.19444,.69444,0,0,.5],Ts=[.19444,.69444,0,0,1],Xa=[.011,.511,0,0,1.126],Ja=[.19444,.69444,0,0,.61111],ko=[.05556,.75,0,0,.5],il=[0,.68333,0,0,.83334],To=[.0391,.5391,0,0,.66667],na=[-.05555,.44445,0,0,.5],nl=[0,.43056,0,0,.77778],_s=[0,.55556,0,0,.66667],Ao=[-.03625,.46375,0,0,.77778],Lo=[-.01688,.48312,0,0,.77778],rl=[.0391,.5391,0,0,1],zs=[0,.69444,0,0,.61111],Qa=[-.03472,.46528,0,0,.5],ra=[.25,.75,0,0,.44445],Gl=[-.14236,.35764,0,0,1],st=[.244,.744,0,0,.412],Cn=[.19444,.69444,0,0,.88889],Fn=[.12963,.69444,0,0,.77778],Ur=[.19444,.69444,0,0,.38889],Yr=[.011,.511,0,0,1.638],sa=[.19444,.69444,0,0,0],aa=[0,.44444,0,0,.575],eo=[.19444,.44444,0,0,.575],sl=[0,.68611,0,0,.75555],to=[0,.69444,0,0,.66759],As=[0,.68611,0,0,.80555],Ps=[0,.68611,.08229,0,.98229],Hl=[0,.68611,0,0,.76666],th=[0,.44444,0,0,.58472],ih=[.19444,.44444,0,0,.6118],al=[.19444,.43056,0,0,.5],ju=[0,.68333,.02778,.08334,.76278],Wl=[0,.68333,.08125,.05556,.83125],ol=[0,.43056,0,.05556,.48472],Do=[.19444,.43056,0,.08334,.51702],nh=[.25,.75,0,0,.42778],Or=[0,.69444,0,0,.55],Vs=[0,.69444,0,0,.73334],Gs=[0,.69444,0,0,.79445],rh=[0,.69444,0,0,.51945],Co=[0,.69444,0,0,.70278],sh=[0,.69444,0,0,.76389],ah=[.25,.75,0,0,.34306],jl=[0,.69444,0,0,.56111],qu=[0,.69444,0,0,.25556],oh=[.19444,.45833,0,0,.56111],Zu=[0,.45833,0,0,.56111],ql=[0,.69444,0,0,.30556],lh=[0,.69444,0,0,.58056],Zl=[0,.69444,0,0,.67223],Yu=[0,.69444,0,0,.85556],Xu=[0,.69444,0,0,.55834],Hs=[0,.65556,.11156,0,.5],Ju=[0,.69444,.08094,0,.70834],Qu=[.17014,0,0,0,.44445],uh=[0,.69444,.0799,0,.5],ch=[0,.69444,0,0,.73752],hh=[0,.69444,.09205,0,.5],fh=[0,.69444,.09031,0,.77778],Mo=[0,.69444,.07816,0,.27778],dh=[0,.69444,.00316,0,.5],ec=[.19444,.69444,0,0,.83334],tc=[.05556,.75,0,0,.83334],ph=[0,.75,0,0,.5],Yl=[.125,.08333,0,0,.27778],us=[0,.08333,0,0,.27778],Dr=[0,.65556,0,0,.5],ll=[0,.69444,0,0,.47222],oa=[0,.69444,0,0,.66667],ul=[0,.69444,0,0,.59722],ic=[0,.69444,0,0,.54167],nc=[0,.69444,0,0,.70834],mh=[.25,.75,0,0,.28889],rc=[0,.69444,0,0,.51667],sc=[0,.44444,0,0,.44445],ac=[.19444,.44444,0,0,.51667],Xl=[0,.44444,0,0,.38333],oc=[0,.44444,0,0,.51667],gh=[0,.69444,0,0,.83334],lc=[.35001,.85,0,0,.45834],_h=[.35001,.85,0,0,.57778],uc=[.35001,.85,0,0,.41667],vh=[.35001,.85,0,0,.58334],cl=[0,.72222,0,0,.55556],yh=[1e-5,.6,0,0,.66667],bh=[1e-5,.6,0,0,.77778],xh=[.25001,.75,0,0,.94445],cc=[.306,.805,.19445,0,.47222],wh=[.30612,.805,.19445,0,.47222],io=[.25001,.75,0,0,.83334],Ws=[.35001,.85,0,0,.47222],Jl=[.25001,.75,0,0,1.11111],hc=[.65002,1.15,0,0,.59722],Cr=[.65002,1.15,0,0,.81111],la=[.65002,1.15,0,0,.47222],Ql=[.65002,1.15,0,0,.66667],eu=[0,.75,0,0,1],Sh=[.55001,1.05,0,0,1.27778],tu=[.862,1.36,.44445,0,.55556],iu=[.86225,1.36,.44445,0,.55556],Os=[.55001,1.05,0,0,1.11111],nu=[.65002,1.15,0,0,.52778],ua=[.65002,1.15,0,0,.61111],Ge=[.55001,1.05,0,0,1.51112],fc=[.95003,1.45,0,0,.73611],ru=[.95003,1.45,0,0,1.04445],Eh=[.95003,1.45,0,0,.52778],Ta=[.95003,1.45,0,0,.75],su=[0,.75,0,0,1.44445],au=[.95003,1.45,0,0,.58334],kh=[1.25003,1.75,0,0,.79167],Th=[1.25003,1.75,0,0,1.27778],Ah=[1.25003,1.75,0,0,.58334],ca=[1.25003,1.75,0,0,.80556],Ro=[0,.825,0,0,1.8889],hl=[1.25003,1.75,0,0,.63889],no=[.64502,1.155,0,0,.875],vs=[1e-5,.6,0,0,.875],dc=[-99e-5,.601,0,0,.66667],fl=[.64502,1.155,0,0,.66667],pc=[1e-5,.9,0,0,.88889],Lh=[.65002,1.15,0,0,.88889],dl=[.90001,0,0,0,.88889],Dh=[-.00499,.605,0,0,1.05556],pl=[0,.12,0,0,.45],Qt=[0,.61111,0,0,.525],cs=[.08333,.69444,0,0,.525],mc=[-.08056,.53055,0,0,.525],Ch=[-.05556,.55556,0,0,.525],zr=[0,.43056,0,0,.525],ha=[.22222,.43056,0,0,.525],Mh=[0,0,0,0,.525],ed={"AMS-Regular":{32:Qe,65:qe,66:Ct,67:qe,68:qe,69:Ct,70:kt,71:Lt,72:Lt,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:Lt,76:Ct,77:[0,.68889,0,0,.94445],78:qe,79:Nt,80:kt,81:Nt,82:qe,83:Xt,84:Ct,85:qe,86:qe,87:[0,.68889,0,0,1],88:qe,89:qe,90:Ct,107:Xt,160:Qe,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:Xt,295:xe,710:zt,732:De,770:zt,771:De,989:Dt,1008:di,8245:[0,.54986,0,0,.275],8463:xe,8487:qe,8498:Xt,8502:Ct,8503:[0,.68889,0,0,.44445],8504:Ct,8513:[0,.68889,0,0,.63889],8592:ke,8594:ke,8602:K,8603:K,8606:W,8608:W,8610:ae,8611:ae,8619:ce,8620:ce,8621:[-.13313,.37788,0,0,1.38889],8622:K,8624:ve,8625:ve,8630:ft,8631:ft,8634:yt,8635:yt,8638:ut,8639:ut,8642:ut,8643:ut,8644:Vt,8646:Vt,8647:Vt,8648:ii,8649:Vt,8650:ii,8651:W,8652:W,8653:K,8654:K,8655:K,8666:mi,8667:mi,8669:[-.13313,.37788,0,0,1],8672:ni,8674:ni,8705:[0,.825,0,0,.5],8708:Xt,8709:Dt,8717:[0,.43056,0,0,.42917],8722:ke,8724:[.08198,.69224,0,0,.77778],8726:Dt,8733:gi,8736:oi,8737:oi,8738:[.03517,.52239,0,0,.72222],8739:Bt,8740:[.25142,.74111,0,0,.27778],8741:Zt,8742:[.25142,.74111,0,0,.5],8756:Mi,8757:Mi,8764:ki,8765:[-.13313,.37788,0,0,.77778],8769:ki,8770:Ao,8774:en,8776:Lo,8778:Dt,8782:Bi,8783:Bi,8785:yt,8786:yt,8787:yt,8790:gi,8791:Yi,8796:[.08198,.91667,0,0,.77778],8806:fi,8807:fi,8808:Vi,8809:Vi,8812:[.25583,.75583,0,0,.5],8814:ji,8815:ji,8816:en,8817:en,8818:Yi,8819:Yi,8822:er,8823:er,8828:Li,8829:Li,8830:Yi,8831:Yi,8832:ji,8833:ji,8840:en,8841:en,8842:zi,8843:zi,8847:sn,8848:sn,8858:yt,8859:yt,8861:yt,8862:Pi,8863:Pi,8864:Pi,8865:Pi,8872:[0,.69224,0,0,.61111],8873:oi,8874:[0,.69224,0,0,.88889],8876:kt,8877:kt,8878:qe,8879:qe,8882:sn,8883:sn,8884:Li,8885:Li,8888:[0,.54986,0,0,1.11111],8890:qa,8891:bn,8892:bn,8901:[0,.54986,0,0,.27778],8903:Dt,8905:Dt,8906:Dt,8907:gi,8908:gi,8909:[-.03598,.46402,0,0,.77778],8910:an,8911:an,8912:sn,8913:sn,8914:sr,8915:sr,8916:Mi,8918:xi,8919:xi,8920:ur,8921:ur,8922:jn,8923:jn,8926:Li,8927:Li,8928:en,8929:en,8934:wi,8935:wi,8936:wi,8937:wi,8938:ji,8939:ji,8940:en,8941:en,8994:li,8995:li,9416:[.15559,.69224,0,0,.90222],9484:ve,9488:ve,9492:Pe,9496:Pe,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:Pi,9633:Pi,9650:et,9651:et,9654:sn,9660:et,9661:et,9664:sn,9674:lt,9733:[.19444,.69224,0,0,.94445],10003:gt,10016:gt,10731:lt,10846:[.19444,.75583,0,0,.61111],10877:Li,10878:Li,10885:fi,10886:fi,10887:zi,10888:zi,10889:At,10890:At,10891:nt,10892:nt,10901:Li,10902:Li,10933:Vi,10934:Vi,10935:At,10936:At,10937:At,10938:At,10949:fi,10950:fi,10955:dt,10956:dt,57350:Bt,57351:Zt,57352:Dt,57353:di,57356:Vi,57357:Vi,57358:Xi,57359:en,57360:en,57361:Xi,57366:Vi,57367:Vi,57368:Vi,57369:Vi,57370:zi,57371:zi},"Caligraphic-Regular":{32:Qe,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:Qe},"Fraktur-Regular":{32:Qe,33:[0,.69141,0,0,.29574],34:on,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:_i,41:_i,42:[0,.62119,0,0,.27764],43:Ai,44:Oi,45:Ai,46:Oi,47:[.24982,.74947,0,0,.50181],48:Gi,49:Gi,50:Gi,51:Wi,52:Wi,53:Wi,54:Si,55:Wi,56:Si,57:Wi,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:Di,93:Di,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:Qe,8216:on,8217:on,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:Qe,33:[0,.69444,0,0,.35],34:Rr,35:[.19444,.69444,0,0,.95833],36:Un,37:[.05556,.75,0,0,.95833],38:qi,39:Rn,40:$i,41:$i,42:[0,.75,0,0,.575],43:cn,44:[.19444,.15556,0,0,.31944],45:Xl,46:[0,.15556,0,0,.31944],47:dn,48:Ti,49:Ti,50:Ti,51:Ti,52:Ti,53:Ti,54:Ti,55:Ti,56:Ti,57:Ti,58:Kn,59:[.19444,.44444,0,0,.31944],60:Zi,61:hr,62:Zi,63:[0,.69444,0,0,.54305],64:qi,65:un,66:[0,.68611,0,0,.81805],67:Ln,68:[0,.68611,0,0,.88194],69:sl,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:Fi,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:Fi,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:un,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:$n,92:dn,93:$n,94:pn,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:Ki,99:vn,100:Ki,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:Ki,105:Rn,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:Rn,109:[0,.44444,0,0,.95833],110:qn,111:aa,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:qn,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:vn,123:dn,124:$n,125:dn,126:[.35,.34444,0,0,.575],160:Qe,163:[0,.69444,0,0,.86853],168:pn,172:[0,.44444,0,0,.76666],176:yr,177:cn,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:cn,216:[.04861,.73472,0,0,.89444],223:ul,230:[0,.44444,0,0,.83055],247:cn,248:[.09722,.54167,0,0,.575],305:Kn,338:[0,.68611,0,0,1.16944],339:Ir,567:[.19444,.44444,0,0,.35139],710:pn,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:pn,715:pn,728:pn,729:Rn,730:yr,732:pn,733:pn,915:xn,916:In,920:dr,923:As,926:Hl,928:Fi,931:Ln,933:dr,934:Ln,936:dr,937:Ln,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:Rn,8217:Rn,8220:Rr,8221:Rr,8224:ar,8225:ar,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:to,8465:Lr,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:Lr,8501:tn,8592:Dn,8593:tr,8594:Dn,8595:tr,8596:Dn,8597:dn,8598:Er,8599:Er,8600:Er,8601:Er,8636:Dn,8637:Dn,8640:Dn,8641:Dn,8656:Dn,8657:kr,8658:Dn,8659:kr,8660:Dn,8661:[.25,.75,0,0,.70277],8704:Ki,8706:[0,.69444,.06389,0,.62847],8707:Ki,8709:Un,8711:In,8712:or,8715:or,8722:cn,8723:cn,8725:dn,8726:dn,8727:Ei,8728:cr,8729:cr,8730:[.18,.82,0,0,.95833],8733:Ir,8734:[0,.44444,0,0,1.14999],8736:oi,8739:$n,8741:dn,8743:si,8744:si,8745:si,8746:si,8747:[.19444,.69444,.12778,0,.56875],8764:hr,8768:[.19444,.69444,0,0,.31944],8771:br,8776:[.02444,.52444,0,0,.89444],8781:br,8801:br,8804:lr,8805:lr,8810:Hr,8811:Hr,8826:Zi,8827:Zi,8834:Zi,8835:Zi,8838:lr,8839:lr,8846:si,8849:lr,8850:lr,8851:si,8852:si,8853:cn,8854:cn,8855:cn,8856:cn,8857:cn,8866:tn,8867:tn,8868:qi,8869:qi,8900:cr,8901:[-.02639,.47361,0,0,.31944],8902:Ei,8968:nn,8969:nn,8970:nn,8971:nn,8994:Ri,8995:Ri,9651:mr,9657:Ei,9661:mr,9667:Ei,9711:Er,9824:Zn,9825:Zn,9826:Zn,9827:Zn,9837:[0,.75,0,0,.44722],9838:fr,9839:fr,10216:$i,10217:$i,10815:Fi,10927:lr,10928:lr,57376:sa},"Main-BoldItalic":{32:Qe,33:[0,.69444,.11417,0,.38611],34:On,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:Yn,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:Pn,49:Pn,50:Pn,51:Pn,52:os,53:Pn,54:Pn,55:os,56:Pn,57:Pn,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:ds,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:Tr,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:Tr,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:jr,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:Pr,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:Pr,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:Qe,168:[0,.69444,.11473,0,.59111],176:qr,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:jr,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:Yn,730:qr,732:ds,733:ds,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:Tr,931:[0,.68611,.11431,0,.82666],933:gr,934:[0,.68611,.05632,0,.82666],936:gr,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:Yn,8217:Yn,8220:[0,.69444,.16772,0,.62055],8221:On},"Main-Italic":{32:Qe,33:Ji,34:Gn,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:Ji,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:yn,49:yn,50:yn,51:yn,52:Qr,53:yn,54:yn,55:Qr,56:yn,57:yn,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:ci,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:ls,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:ls,79:Ii,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:ls,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:Us,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:Es,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:Es,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:Qe,168:[0,.66786,.10474,0,.51111],176:xa,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:ta,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:ta,710:Us,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:xa,732:[0,.66786,.11585,0,.51111],733:ci,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:Ii,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:ls,931:[0,.68333,.12028,0,.71555],933:wn,934:[0,.68333,.05986,0,.71555],936:wn,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:Ji,8217:Ji,8220:[0,.69444,.1685,0,.51444],8221:Gn,8463:xe},"Main-Regular":{32:Qe,33:Sn,34:nr,35:ec,36:ko,37:tc,38:ks,39:Sn,40:es,41:es,42:ph,43:ts,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:Is,48:ir,49:ir,50:ir,51:ir,52:ir,53:ir,54:ir,55:ir,56:ir,57:ir,58:gs,59:[.19444,.43056,0,0,.27778],60:xi,61:ki,62:xi,63:ll,64:ks,65:Zr,66:[0,.68333,0,0,.70834],67:Sa,68:[0,.68333,0,0,.76389],69:ps,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:Zr,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:wa,76:Vl,77:[0,.68333,0,0,.91667],78:Zr,79:wa,80:ps,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:Sa,85:Zr,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:Zr,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:Ea,92:Is,93:Ea,94:nr,95:[.31,.12056,.02778,0,.5],97:ms,98:ia,99:ka,100:ia,101:ka,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:ia,105:Jo,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:Sn,109:[0,.43056,0,0,.83334],110:Eo,111:ms,112:qa,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:Eo,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:Is,124:Ea,125:Is,126:[.35,.31786,0,0,.5],160:Qe,163:[0,.69444,0,0,.76909],167:el,168:Qo,172:[0,.43056,0,0,.66667],176:Za,177:ts,182:Ja,184:Qu,198:[0,.68333,0,0,.90278],215:ts,216:[.04861,.73194,0,0,.77778],223:nr,230:[0,.43056,0,0,.72222],247:ts,248:[.09722,.52778,0,0,.5],305:gs,338:[0,.68333,0,0,1.01389],339:nl,567:[.19444,.43056,0,0,.30556],710:nr,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:nr,715:nr,728:nr,729:Jo,730:Za,732:Qo,733:nr,915:Vl,916:il,920:wa,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:Zr,931:Sa,933:wa,934:Sa,936:wa,937:Sa,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:Sn,8217:Sn,8220:nr,8221:nr,8224:el,8225:el,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:xe,8465:Ya,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:Ya,8501:zs,8592:K,8593:tl,8594:K,8595:tl,8596:K,8597:Is,8598:Ts,8599:Ts,8600:Ts,8601:Ts,8614:[.011,.511,0,0,1],8617:Xa,8618:Xa,8636:K,8637:K,8640:K,8641:K,8652:[.011,.671,0,0,1],8656:K,8657:Ja,8658:K,8659:Ja,8660:K,8661:[.25,.75,0,0,.61111],8704:ia,8706:[0,.69444,.05556,.08334,.5309],8707:ia,8709:ko,8711:il,8712:To,8715:To,8722:ts,8723:ts,8725:Is,8726:Is,8727:Qa,8728:na,8729:na,8730:[.2,.8,0,0,.83334],8733:nl,8734:ft,8736:oi,8739:Ea,8741:Is,8743:_s,8744:_s,8745:_s,8746:_s,8747:[.19444,.69444,.11111,0,.41667],8764:ki,8768:[.19444,.69444,0,0,.27778],8771:Ao,8773:[-.022,.589,0,0,1],8776:Lo,8781:Ao,8784:[-.133,.67,0,0,.778],8801:Ao,8804:zi,8805:zi,8810:rl,8811:rl,8826:xi,8827:xi,8834:xi,8835:xi,8838:zi,8839:zi,8846:_s,8849:zi,8850:zi,8851:_s,8852:_s,8853:ts,8854:ts,8855:ts,8856:ts,8857:ts,8866:zs,8867:zs,8868:ks,8869:ks,8872:[.249,.75,0,0,.867],8900:na,8901:[-.05555,.44445,0,0,.27778],8902:Qa,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:ra,8969:ra,8970:ra,8971:ra,8994:Gl,8995:Gl,9136:st,9137:st,9651:Cn,9657:Qa,9661:Cn,9667:Qa,9711:Ts,9824:Fn,9825:Fn,9826:Fn,9827:Fn,9837:[0,.75,0,0,.38889],9838:Ur,9839:Ur,10216:es,10217:es,10222:st,10223:st,10229:[.011,.511,0,0,1.609],10230:Yr,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:Yr,10815:Zr,10927:zi,10928:zi,57376:sa},"Math-BoldItalic":{32:Qe,48:aa,49:aa,50:aa,51:eo,52:eo,53:eo,54:Ti,55:eo,56:Ti,57:eo,65:un,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:Ps,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:to,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:th,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:Qe,915:[0,.68611,.15972,0,.65694],916:In,920:[0,.68611,.03194,0,.86722],923:As,926:[0,.68611,.07458,0,.84125],928:Ps,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:Hl,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:th,960:[0,.44444,.03704,0,.68241],961:ih,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:ih,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:Qe,48:ms,49:ms,50:ms,51:al,52:al,53:al,54:ir,55:al,56:ir,57:al,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:Wl,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:ju,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:ol,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:Qe,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:ju,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:Wl,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:ol,960:[0,.43056,.03588,0,.57003],961:Do,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:Do,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:Qe,33:[0,.69444,0,0,.36667],34:Xu,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:ql,40:nh,41:nh,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:Or,49:Or,50:Or,51:Or,52:Or,53:Or,54:Or,55:Or,56:Or,57:Or,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:rh,64:Vs,65:Vs,66:Vs,67:Co,68:Gs,69:[0,.69444,0,0,.64167],70:zs,71:Vs,72:Gs,73:[0,.69444,0,0,.33056],74:rh,75:sh,76:lh,77:[0,.69444,0,0,.97778],78:Gs,79:Gs,80:Co,81:[.10556,.69444,0,0,.79445],82:Co,83:zs,84:Vs,85:sh,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:Vs,89:[0,.69444,.0275,0,.73334],90:Zl,91:ah,93:ah,94:Or,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:jl,99:[0,.45833,0,0,.48889],100:jl,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:jl,105:qu,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:qu,109:[0,.45833,0,0,.86667],110:Zu,111:[0,.45833,0,0,.55],112:oh,113:oh,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:Zu,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:Qe,168:Or,176:Vs,180:Or,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:Or,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:Or,729:ql,730:Vs,732:Or,733:Or,915:lh,916:[0,.69444,0,0,.91667],920:Yu,923:Zl,926:Vs,928:Gs,931:Gs,933:Yu,934:Gs,936:Yu,937:Gs,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:ql,8217:ql,8220:Xu,8221:Xu},"SansSerif-Italic":{32:Qe,33:[0,.69444,.05733,0,.31945],34:dh,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:Mo,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:Yl,45:[0,.44444,.01946,0,.33333],46:us,47:[.25,.75,.13164,0,.5],48:Hs,49:Hs,50:Hs,51:Hs,52:Hs,53:Hs,54:Hs,55:Hs,56:Hs,57:Hs,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:oa,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:Ju,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:ic,77:[0,.69444,.08094,0,.875],78:Ju,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:uh,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:Qe,168:[0,.67937,.06385,0,.5],176:ch,184:Qu,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:uh,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:hh,715:nr,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:ch,732:[0,.67659,.08826,0,.5],733:hh,915:[0,.69444,.13372,0,.54167],916:gh,920:[0,.69444,.07555,0,.77778],923:zs,926:[0,.69444,.12816,0,.66667],928:Ju,931:[0,.69444,.11983,0,.72222],933:fh,934:[0,.69444,.04603,0,.72222],936:fh,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:Mo,8217:Mo,8220:[0,.69444,.14205,0,.5],8221:dh},"SansSerif-Regular":{32:Qe,33:[0,.69444,0,0,.31945],34:nr,35:ec,36:ko,37:tc,38:[0,.69444,0,0,.75834],39:Sn,40:es,41:es,42:ph,43:ts,44:Yl,45:[0,.44444,0,0,.33333],46:us,47:Is,48:Dr,49:Dr,50:Dr,51:Dr,52:Dr,53:Dr,54:Dr,55:Dr,56:Dr,57:Dr,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:ll,64:oa,65:oa,66:oa,67:Ki,68:[0,.69444,0,0,.72223],69:ul,70:[0,.69444,0,0,.56945],71:oa,72:nc,73:Sn,74:ll,75:[0,.69444,0,0,.69445],76:ic,77:[0,.69444,0,0,.875],78:nc,79:[0,.69444,0,0,.73611],80:Ki,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:ia,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:oa,89:[0,.69444,.025,0,.66667],90:zs,91:mh,93:mh,94:nr,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:rc,99:sc,100:rc,101:sc,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:rc,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:oc,111:[0,.44444,0,0,.5],112:ac,113:ac,114:[0,.44444,.01389,0,.34167],115:Xl,116:[0,.57143,0,0,.36111],117:oc,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:Qe,168:[0,.67937,0,0,.5],176:oa,184:Qu,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:nr,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:nr,715:nr,728:nr,729:[0,.67937,0,0,.27778],730:oa,732:[0,.67659,0,0,.5],733:nr,915:ic,916:gh,920:ks,923:zs,926:oa,928:nc,931:Ya,933:ks,934:Ya,936:ks,937:Ya,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:Sn,8217:Sn,8220:nr,8221:nr},"Script-Regular":{32:Qe,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:Qe},"Size1-Regular":{32:Qe,40:lc,41:lc,47:_h,91:uc,92:_h,93:uc,123:vh,125:vh,160:Qe,710:cl,732:cl,770:cl,771:cl,8214:[-99e-5,.601,0,0,.77778],8593:yh,8595:yh,8657:bh,8659:bh,8719:xh,8720:xh,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:wh,8748:cc,8749:cc,8750:wh,8896:io,8897:io,8898:io,8899:io,8968:Ws,8969:Ws,8970:Ws,8971:Ws,9168:dc,10216:Ws,10217:Ws,10752:Jl,10753:Jl,10754:Jl,10756:io,10758:io},"Size2-Regular":{32:Qe,40:hc,41:hc,47:Cr,91:la,92:Cr,93:la,123:Ql,125:Ql,160:Qe,710:eu,732:eu,770:eu,771:eu,8719:Sh,8720:Sh,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:iu,8748:tu,8749:tu,8750:iu,8896:Os,8897:Os,8898:Os,8899:Os,8968:nu,8969:nu,8970:nu,8971:nu,10216:ua,10217:ua,10752:Ge,10753:Ge,10754:Ge,10756:Os,10758:Os},"Size3-Regular":{32:Qe,40:fc,41:fc,47:ru,91:Eh,92:ru,93:Eh,123:Ta,125:Ta,160:Qe,710:su,732:su,770:su,771:su,8730:[.95003,1.45,0,0,1],8968:au,8969:au,8970:au,8971:au,10216:Ta,10217:Ta},"Size4-Regular":{32:Qe,40:kh,41:kh,47:Th,91:Ah,92:Th,93:Ah,123:ca,125:ca,160:Qe,710:Ro,732:Ro,770:Ro,771:Ro,8730:[1.25003,1.75,0,0,1],8968:hl,8969:hl,8970:hl,8971:hl,9115:no,9116:vs,9117:no,9118:no,9119:vs,9120:no,9121:fl,9122:dc,9123:fl,9124:fl,9125:dc,9126:fl,9127:pc,9128:Lh,9129:dl,9130:[0,.3,0,0,.88889],9131:pc,9132:Lh,9133:dl,9143:[.88502,.915,0,0,1.05556],10216:ca,10217:ca,57344:Dh,57345:Dh,57680:pl,57681:pl,57682:pl,57683:pl},"Typewriter-Regular":{32:Mh,33:Qt,34:Qt,35:Qt,36:cs,37:cs,38:Qt,39:Qt,40:cs,41:cs,42:[0,.52083,0,0,.525],43:mc,44:[.13889,.125,0,0,.525],45:mc,46:[0,.125,0,0,.525],47:cs,48:Qt,49:Qt,50:Qt,51:Qt,52:Qt,53:Qt,54:Qt,55:Qt,56:Qt,57:Qt,58:zr,59:[.13889,.43056,0,0,.525],60:Ch,61:[-.19549,.41562,0,0,.525],62:Ch,63:Qt,64:Qt,65:Qt,66:Qt,67:Qt,68:Qt,69:Qt,70:Qt,71:Qt,72:Qt,73:Qt,74:Qt,75:Qt,76:Qt,77:Qt,78:Qt,79:Qt,80:Qt,81:[.13889,.61111,0,0,.525],82:Qt,83:Qt,84:Qt,85:Qt,86:Qt,87:Qt,88:Qt,89:Qt,90:Qt,91:cs,92:cs,93:cs,94:Qt,95:[.09514,0,0,0,.525],96:Qt,97:zr,98:Qt,99:zr,100:Qt,101:zr,102:Qt,103:ha,104:Qt,105:Qt,106:[.22222,.61111,0,0,.525],107:Qt,108:Qt,109:zr,110:zr,111:zr,112:ha,113:ha,114:zr,115:zr,116:[0,.55358,0,0,.525],117:zr,118:zr,119:zr,120:zr,121:ha,122:zr,123:cs,124:cs,125:cs,126:Qt,127:Qt,160:Mh,176:Qt,184:[.19445,0,0,0,.525],305:zr,567:ha,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:Qt,715:Qt,728:Qt,730:Qt,770:Qt,771:Qt,776:Qt,915:Qt,916:Qt,920:Qt,923:Qt,926:Qt,928:Qt,931:Qt,933:Qt,934:Qt,936:Qt,937:Qt,8216:Qt,8217:Qt,8242:Qt,9251:[.11111,.21944,0,0,.525]}},Rh=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,ro=10,Ls=.25,td=1.2,js=.431,gc={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[js,js,js],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:[Ls,Ls,Ls],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]},so=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],ml=5,Ih={"\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 Io(e,i){e===void 0&&(e=77);const r=ed[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 Ih)e=Ih[a].codePointAt(0);else if(Rh.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 ou={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]},lu={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]},Ph={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 id(e){if(lu[e]){const[E,R,F]=lu[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="${Ph[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]=ou[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="${Ph[E]}"></path></svg></span>`).join("");return`<span style="display:inline-block;height:${b}em;min-width:${r}em;">${x}</span>`}function Oh(e){return ou[e]?ou[e][2]/1e3:lu[e][2]}function nd(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=ba(2,16)+d*ba(2,10)+g,r++}}i.push(a)}return i}var Po=8205,_c=[[Po,1],[65038,2],[127995,5],[129456,4],[917536,96]],vc,is=[127462,127487];function rd(e){var i;if(vc===void 0){vc={};for(const r of _c)for(let a=r[0];a<=r[0]+r[1]-1;a++)vc[a]=!0}return(i=vc[e])!=null?i:!1}function sd(e){return e>=is[0]&&e<=is[1]}function ad(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;const i=[],r=nd(e);let a=0;for(;a<r.length;){const u=r[a++],d=r[a];if(d===Po){const g=a-1;for(a+=2;r[a]===Po;)a+=2;i.push(String.fromCodePoint(...r.slice(g,a-g+1)))}else if(rd(d)){const g=a-1;for(;rd(r[a]);)a+=r[a]===Po?2:1;i.push(String.fromCodePoint(...r.slice(g,2*a-g-1)))}else sd(u)?(a+=1,i.push(String.fromCodePoint(...r.slice(a-2,2)))):i.push(String.fromCodePoint(u))}return i}var m0=class{constructor(e){this.obeyspaces=!1,this.pos=0,this.s=ad(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 g0(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 m0(Ut(r.join(""))),d=[];do d.push(...g0(u,i));while(!u.end());return d}function Qi(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 Xn(e,...i){return console.assert(e.startsWith("\\")),i.length===0?e:Qi([e,...i.map(r=>`{${r}}`)])}function Ds(e){return Qi(e.map(i=>{var r;return(r={"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"}[i])!=null?r:i}))}var Fh=class eh{constructor(i){eh._registry[i]=this}static createAtom(i,r,a){return eh._registry[i].createAtom(r,Me(r,i),a)}static serialize(i,r){var a;if(!i||i.length===0)return"";if((a=r.skipStyles)!=null&&a){const u=[];for(const d of Bh(i)){const g=eh._registry[d[0].mode];u.push(...g.serialize(d,r))}return Qi(u)}return Qi(od(i,r))}static getFont(i,r,a){return eh._registry[i].getFont(r,a)}};Fh._registry={};var ys=Fh;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 Vr(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 bc(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 Vr(g,"color")){const E=x[0].computedStyle,R=ys._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(Xn("\\textcolor",(r=E.verbatimColor)!=null?r:E.color,Qi(R))):d.push(Qi(R))}}return d}function Nh(e,i){const{parent:r}=e[0],a=r==null?void 0:r.computedStyle.backgroundColor;return Vr(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 Xn("\\colorbox",(d=g.verbatimBackgroundColor)!=null?d:g.backgroundColor,Qi(bc(u,f(P({},i),{defaultMode:"text"}))))}return Qi(bc(u,i))})}function od(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 Vr(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 xc(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 gl(e){if(e.length===0)return"ord";const i=xc(e[0].type),r=xc(e[e.length-1].type);return i&&i===r?i:"ord"}function _l(e,i){if(typeof e=="string")return e;if(typeof e=="number"){console.assert(Number.isFinite(e));const r=Math.ceil(100*e)/100;return r===0?"0":r.toString()+(i!=null?i:"")}return""}var $t=class Ap{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 Ap&&(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=ys.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),$h(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=_l(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=_l(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"]=_l(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"]=_l(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"]=_l(i,"em")))}get width(){return this._width*this.scale}set width(i){this._width=i,this.hasExplicitWidth=!0}set softWidth(i){}get height(){return this._height*this.scale}set height(i){this._height=i}get depth(){return this._depth*this.scale}set depth(i){this._depth=i}wrap(i){const r=i.parent;if(!r)return this;i.isPhantom&&this.setStyle("opacity",0);const a=i.color;a&&a!==r.color&&this.setStyle("color",a);let u=i.backgroundColor;this.isSelected&&(u=A(u)),u&&u!==r.backgroundColor&&(this.setStyle("background-color",u),this.setStyle("display","inline-block"));const 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=id(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 wc(e){if(!e||e.length===0)return[];e[0].children=wc(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=wc(e[r].children),i.push(e[r]));return i}function uu(e){return e.children&&(e.children=wc(e.children)),e}function vl(e,i){if(!e)return new $t(null,i);const r=new $t(null,{classes:"ML__strut",type:"ignore"});r.setStyle("height",Math.max(0,e.height),"em");const a=[r];if(e.depth!==0){const u=new $t(null,{classes:"ML__strut--bottom",type:"ignore"});u.setStyle("height",e.height+e.depth,"em"),u.setStyle("vertical-align",-e.depth,"em"),a.push(u)}return a.push(e),new $t(a,f(P({},i),{type:"lift"}))}function cu(e){const i=Oh(e)/2,r=new $t(null,{maxFontSize:0});return r.height=i+.166,r.depth=i-.166,r.svgBody=e,r}function $h(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=Io(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 ld(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 ud(e){var i;const[r,a]=ld(e);if(!r)return[[],0,0];const u=new $t(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 $t([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 $t(g,{classes:"vlist"});if(F.softWidth=R,F.height=x,F.setStyle("height",x,"em"),b>=0)return[[new $t(F,{classes:"vlist-r"})],x,-b];const Y=new $t(new $t(null),{classes:"vlist"});Y.height=-b,Y.setStyle("height",-b,"em");const oe=new $t(8203,{classes:"vlist-s",maxFontSize:0});return oe.softWidth=0,oe.height=0,oe.depth=0,[[new $t([F,oe],{classes:"vlist-r"}),new $t(Y,{classes:"vlist-r"})],x,-b]}var xr=class extends $t{constructor(e,i){var r;const[a,u,d]=ud(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 cd(e,i){var r,a,u,d,g;const b=e.metrics,x=new $t(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 xr({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 xr({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 xr({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 xr({bottom:ge,children:[{box:x},b.bigOpSpacing5]}).wrap(e)}return new $t(oe,{type:(g=i.type)!=null?g:"op"})}var Sc=7,hu=6,fu=5,Aa=4,La=3,bs=2,fa=1,Fr=0,da=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(gc).reduce((u,d)=>f(P({},u),{[d]:gc[d][a]}),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return qs[[Fr,fa,Fr,fa,bs,La,bs,La][this.id]]}get sub(){return qs[[Fr,Fr,Fr,Fr,bs,bs,bs,bs][this.id]]}get fracNum(){return qs[[Fr,fa,Fr,fa,bs,La,Aa,fu][this.id]]}get fracDen(){return qs[[Fr,Fr,Fr,Fr,bs,bs,Aa,Aa][this.id]]}get cramp(){return qs[[Fr,Fr,bs,bs,Aa,Aa,hu,hu][this.id]]}get isTight(){return this.sizeDelta<0}},yl={7:new da(Sc,0,!1),6:new da(hu,0,!0),5:new da(fu,0,!1),4:new da(Aa,0,!0),3:new da(La,-3,!1),2:new da(bs,-3,!0),1:new da(fa,-4,!1),0:new da(Fr,-4,!0)},qs=f(P({},yl),{displaystyle:yl[Sc],textstyle:yl[fu],scriptstyle:yl[La],scriptscriptstyle:yl[fa]});function Kh(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:ro,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=ba(10,i);return Math.round(e.dimension/ro*a*u)/u}return e.dimension*a}function Uh(e,i){if(e===null)return 0;const r=Kh(e)/ro;if(Number.isFinite(i)){const a=ba(10,i);return Math.round(r*a)/a}return r}function Ec(e){var i;return`${e.dimension}${(i=e.unit)!=null?i:"pt"}`}function hd(e){let i=Ec(e.glue);return e.grow&&e.grow.dimension!==0&&(i+=` plus ${Ec(e.grow)}`),e.shrink&&e.shrink.dimension!==0&&(i+=` minus ${Ec(e.shrink)}`),i}function wr(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=hd(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 Zs(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:Zs(e.glue,i),shrink:Zs(e.shrink,i),grow:Zs(e.grow,i)}:e.shrink?{glue:Zs(e.glue,i),shrink:Zs(e.shrink,i)}:e.grow?{glue:Zs(e.glue,i),grow:Zs(e.grow,i)}:{glue:Zs(e.glue,i)}:null}var du={"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 zh(){return P({},du)}function kc(){return{registers:zh(),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"\u25A2",letterShapeStyle:B.locale.startsWith("fr")?"french":"tex",minFontScale:0,colorMap:Ke,backgroundColorMap:It,getMacro:e=>rt(e,Wt())}}var ln=class Lp{constructor(i,r){var a,u,d,g,b,x,E,R,F,Y,oe,ge,He,Ot,Ve;let Et;i!=null&&i.parent?(this.parent=i.parent,Et=i.parent,this.registers={}):(Et=P(P({},kc()),(a=i==null?void 0:i.from)!=null?a:{}),this.registers=Et.registers),Et.atomIdsSettings&&(this.atomIdsSettings=P({},Et.atomIdsSettings)),this.renderPlaceholder=Et.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=Et.letterShapeStyle,this.minFontScale=Et.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:ml;let Kt=(He=(ge=this.parent)==null?void 0:ge.mathstyle)!=null?He:qs.displaystyle;if(typeof(i==null?void 0:i.mathstyle)=="string"){if(Et instanceof Lp)switch(i.mathstyle){case"cramp":Kt=Kt.cramp;break;case"superscript":Kt=Kt.sup;break;case"subscript":Kt=Kt.sub;break;case"numerator":Kt=Kt.fracNum;break;case"denominator":Kt=Kt.fracDen;break}switch(i.mathstyle){case"textstyle":Kt=qs.textstyle;break;case"displaystyle":Kt=qs.displaystyle;break;case"scriptstyle":Kt=qs.scriptstyle;break;case"scriptscriptstyle":Kt=qs.scriptscriptstyle;break;case"":case"auto":break}}this.mathstyle=Kt,this.smartFence=Et.smartFence,this.placeholderSymbol=Et.placeholderSymbol,this.colorMap=(Ot=Et.colorMap)!=null?Ot:Tt=>Tt,this.backgroundColorMap=(Ve=Et.backgroundColorMap)!=null?Ve:Tt=>Tt,this.getMacro=Et.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===Sc||this.mathstyle.id===hu}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(so[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 Uh(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:Kh(a,r)/ro}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}},Oo=["body","above","below","superscript","subscript"];function ao(e){return typeof e=="string"&&Oo.includes(e)}function pu(e){return e!==void 0&&Array.isArray(e)&&e.length===2}var ct=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=Vh(r),g=[];for(const x of d){const E=x[0].style,R=fd(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 $t(g,{classes:b,type:a==null?void 0:a.type}).wrap(i)}static serialize(i,r){return ys.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=dd(this.args)),this._branches)for(const r of Object.keys(this._branches))this._branches[r]&&(i[r]=this._branches[r].filter(a=>a.type!=="first").map(a=>a.toJson()));return i.type==="mord"&&Object.keys(i).length===2&&"value"in i?i.value:i}get changeCounter(){return this.parent?this.parent.changeCounter:this._changeCounter}set isDirty(i){if(i){this.parent||this._changeCounter++,"verbatimLatex"in this&&(this.verbatimLatex=void 0),this._children=void 0;let{parent:r}=this;for(;r;)r.parent||r._changeCounter++,"verbatimLatex"in r&&(r.verbatimLatex=void 0),r._children=void 0,r=r.parent}}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):this.body&&this.command?Qi([Xn(this.command,this.bodyToLatex(i)),this.supsubToLatex(i)]):this.body?Qi([this.bodyToLatex(i),this.supsubToLatex(i)]):!this.value||this.value==="\u200B"?"":this.command}bodyToLatex(i){var r;return ys.serialize(this.body,f(P({},i),{defaultMode:(r=i.defaultMode)!=null?r:this.latexMode}))}aboveToLatex(i){return ys.serialize(this.above,i)}belowToLatex(i){return ys.serialize(this.below,i)}supsubToLatex(i){let r="";if(i=f(P({},i),{defaultMode:"math"}),this.branch("subscript")!==void 0){const a=ys.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=ys.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(ao(i)&&this._branches)return this._branches[i]}get branches(){if(!this._branches)return[];const i=[];for(const r of Oo)this._branches[r]&&i.push(r);return i}createBranch(i){return console.assert(ao(i)),ao(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 pu(this.parentBranch)?this.parentBranch[0]:-1}get col(){return pu(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(ao(r)),!ao(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(ao(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 Oo)if(this._branches[r])for(const a of this._branches[r])i.push(...a.children),i.push(a);return this._children=i,i}render(i){if(this.type==="first"&&!i.atomIdsSettings)return null;const r=Me(this.command,this.mode);if(r!=null&&r.render)return r.render(this,i);const a=new 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/ro/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 xr({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*js),ge=new xr({shift:F,children:[{box:x,marginRight:oe,marginLeft:this.isCharacterBox()?-u.italic:0}]})):!x&&b&&(R=Math.max(R,Y,b.depth+.25*js),ge=new xr({shift:-R,children:[{box:b,marginRight:oe}]}));return new $t([u,new $t(ge,{caret:this.caret,isSelected:this.isSelected,classes:"msubsup"})],{type:r.type})}attachLimits(i,r){const a=this.superscript?wo.createBox(new 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):cd(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:xc(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 $t(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 $t(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 Vh(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 fd(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&&Tc(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()||Tc(ge))&&(!Y||oe!==ge.isDigit())&&(oe=ge.isDigit(),Y=(g=ge.id)!=null?g:""),Y&&(!(ge.isDigit()||Tc(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 $t(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 Tc(e){return e.mode==="text"}function dd(e){return e.map(i=>i===null?"<null>":Array.isArray(i)&&i[0]instanceof ct?{atoms:i.map(r=>r.toJson())}:typeof i=="object"&&"group"in i?{group:i.group.map(r=>r.toJson())}:i)}var bl=class Dp extends ct{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 Dp(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:wt("text",this.value.codePointAt(0))}};function Gh(e,i){if(e.direction===i.direction){const r=e.ranges.length;if(i.ranges.length===r){let a=0;for(;a<r&&Hh(e.ranges[a],i.ranges[a])==="equal";)a++;return a===r?"equal":"different"}}return"different"}function Hh(e,i){return e[0]===i[0]&&e[1]===i[1]?"equal":"different"}function Hn(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 Br(e){return typeof e=="number"&&!Number.isNaN(e)}function pa(e){return Array.isArray(e)&&e.length===2}function ns(e){return e!=null&&typeof e=="object"&&"ranges"in e&&Array.isArray(e.ranges)}function pd(e,i){const r=e.at(i);let a;if(r){a=r.mode;let u=r.parent;for(;!a&&u;)u&&(a=u.mode),u=u.parent}return a}function Wh(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],Et=0;for(;Ve!=null&&Ve.type&&/^(subsup|placeholder)$/.test(Ve.type);)Et+=1,Ve=e[Et];return r=!Ve||Ve.type==="first",Ve&&(He=Ve.mode==="text",a=!He&&Ve.type==="mord"&&me.test(Ve.value),u=!He&&Ve.type==="mord"&&/\d+$/.test(Ve.value),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 mu(e,i,r){return r?Wh(e,r[i]):""}var oo={"&":"\\&","%":"\\%",$:"\\$","''":"^{\\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 Fo(e,i){var r;let a=(r=i==null?void 0:i.format)!=null?r:"auto";return a==="auto"&&([a,e]=wl(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",rs(e,{inlineShortcuts:i==null?void 0:i.inlineShortcuts})]):["latex",e]}function rs(e,i){var r,a,u;if(!e)return"";let d=!1,g;const b=(r=i.inlineShortcuts)!=null?r:oo;if(!d&&(e.startsWith("^")||e.startsWith("_"))&&(g=lo(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[0]+"{"+g.match+"}",e+=rs(g.rest,i),d=!0),d||(g=e.match(/^(sqrt|\u221A)(.*)/),g&&(g=lo(g[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt{"+((a=g.match)!=null?a:"\\placeholder{}")+"}",e+=rs(g.rest,i),d=!0)),d||(g=e.match(/^(\\cbrt|\u221B)(.*)/),g&&(g=lo(g[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt[3]{"+((u=g.match)!=null?u:"\\placeholder{}")+"}",e+=rs(g.rest,i),d=!0)),d||(g=e.match(/^abs(.*)/),g&&(g=lo(g[1],{inlineShortcuts:b,noWrap:!0}),e="\\left|"+g.match+"\\right|",e+=rs(g.rest,i),d=!0)),d||(g=e.match(/^["”“](.*?)["”“](.*)/),g&&(e="\\text{"+g[1]+"}",e+=rs(g[2],i),d=!0)),d||(g=e.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/),g&&(e=xl(g[1],b),e+=rs(g[2],i),d=!0)),!d&&/^([fgh])[^a-zA-Z]/.test(e)&&(g=lo(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[1]==="("?e[0]+"\\left("+g.match+"\\right)":e[0]+g.match,e+=rs(g.rest,i),d=!0),d||(g=e.match(/^([a-zA-Z]+)(.*)/),g&&(e=xl(g[1],b),e+=rs(g[2],i),d=!0)),!d)if(g=lo(e,{inlineShortcuts:b,noWrap:!0}),g.match&&g.rest[0]==="/"){const x=lo(g.rest.slice(1),{inlineShortcuts:b,noWrap:!0});x.match&&(e="\\frac{"+g.match+"}{"+x.match+"}"+rs(x.rest,i)),d=!0}else g.match&&(e=e.startsWith("(")?"\\left("+g.match+"\\right)"+rs(g.rest,i):g.match+rs(g.rest,i),d=!0);return d||(g=e.match(/^(\s+)(.*)$/),g&&(e=" "+rs(g[2],i),d=!0)),e}function lo(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=rs(e.substring(1,b-1),i):(u==="{"&&d==="}"&&(u="\\{",d="\\}"),r="\\left"+u+rs(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=mu(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 xl(e,i){let r=mu(null,e,i);return r?(r=r.replace("_{#?}",""),r=r.replace("^{#?}",""),r+=" "):r=e,r}var jh=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function Ac(e){const i=e.trim();for(const r of jh)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 wl(e){if(e=e.trim(),e.length<=1)return["latex",e];let i;return[i,e]=Ac(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 Bo="$$",gu="$$",md=(e,i,r)=>(jh.some(a=>i.startsWith(a[0])&&i.endsWith(a[1]))||(i=`${Bo} ${i} ${gu}`),i),qh=class Qf{constructor(i){Qf._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)?Qf._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]:Hn(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]:Hn(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 bl).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 Qf._modes[d].insert(i,r,a)}onPaste(i,r){return!1}insert(i,r,a){return!1}};qh._modes={};var Bn=qh,Zh=[{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","^"]}],Lc={"\\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 uo(e){var i;return((i=e.element)==null?void 0:i.mathfield)===e}function No(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 Sl(e){const i=No(e);if(!i)return null;const r=i.getBoundingClientRect();return{x:r.right,y:r.bottom,height:r.height}}function Yh(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 Xh(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 ma(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=ma(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 El(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?ma(d):null,e.atomBoundsCache&&(u?e.atomBoundsCache.set(i.id,u):e.atomBoundsCache.delete(i.id)),u!=null?u:null}function Jh(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=Xh(e,El(e,u),x);if(E){const R=Yh(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 Qh(e,i){return e.model.selection.ranges.reduce((r,a)=>r.concat(...Jh(e,a,i)),[])}function _u(e,i){return e==="*"||i==="none"?!0:i==="same-origin"?!window.origin||e===window.origin:typeof i=="function"?i(e):!1}function ef(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);
|
|
|
}
|
|
|
`,tf=`#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);
|
|
|
}
|
|
|
`,Fs=`/* 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;
|
|
|
}
|
|
|
`,ga=`/* 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);*/
|
|
|
}
|
|
|
`,vd=`.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;
|
|
|
}
|
|
|
`,Da;function co(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=tf;break;case"suggestion-popover":i=Fs;break;case"keystroke-caption":i=ga;break;case"virtual-keyboard":i=vd;break;case"ui":i=yd;break;case"menu":i=bd;break;default:debugger}return i}function $o(e){return Da||(Da={}),Da[e]||(Da[e]=new CSSStyleSheet,Da[e].replaceSync(co(e))),Da[e]}var ss;function Ys(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(co(e))),window.document.head.appendChild(r);return}if(ss||(ss={}),((i=ss[e])!=null?i:0)!==0)ss[e]+=1;else{const r=$o(e);document.adoptedStyleSheets=[...document.adoptedStyleSheets,r],ss[e]=1}}function Ca(e){if("adoptedStyleSheets"in document&&ss!=null&&ss[e]&&(ss[e]-=1,ss[e]<=0)){const i=Da[e];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r!==i)}}var vu=class Cp extends ct{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 Cp(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=ct.createBox(a,this.body))!=null?r:new $t("\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,js),b;if(this.svgAccent)b=cu(this.svgAccent),g=a.metrics.bigOpSpacing1-g;else if(this.accent){const E=new $t(this.accent,{fontFamily:"Main-Regular"});E.italic=0;const R=this.accent===8407?" ML__accent-vec":"";b=new $t(new $t(E),{classes:"ML__accent-body"+R})}b=new xr({shift:0,children:[{box:new $t(u)},-g,{box:b,marginLeft:u.left+2*d,classes:["ML__center"]}]});const x=new $t(b,{type:"lift"});return this.caret&&(x.caret=this.caret),this.bind(a,x.wrap(a)),this.attachSupsub(a,{base:x})}},Ko={"(":")","{":"}","[":"]","|":"|","\\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"},kl=Object.fromEntries(Object.entries(Ko).map(([e,i])=>[i,e]));function Tl(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 yu(e,i,r,a){var u;const g=new $t(Tl(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)*Ls),g}function nf(e,i,r,a,u){var d,g;const b=new ln({parent:a,mathstyle:"textstyle"},u==null?void 0:u.style),x=new $t(Tl(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)*Ls),x}function rf(e,i,r,a,u){var d;let g,b,x,E;g=x=E=Tl(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=Io(g,R),Y=F.height+F.depth,oe=Io(x,R),ge=oe.height+oe.depth,He=Io(E,R),Ot=He.height+He.depth;let Ve=0,Et=1;if(b!==null){const $r=Io(b,R);Ve=$r.height+$r.depth,Et=2}const Kt=Y+Ot+Ve,Tt=Math.max(0,Math.ceil((i-Kt)/(Et*ge))),ai=Kt+Tt*Et*ge;let bi=Ls;r&&(bi=bi*a.scalingFactor);const hi=ai/2-bi,fn=.008,Nn=[];Nn.push({box:new $t(E,{fontFamily:R})}),Nn.push(-fn);const Ht=new $t(x,{fontFamily:R});if(b===null)for(let $r=0;$r<Tt;$r++)Nn.push({box:Ht});else{for(let $r=0;$r<Tt;$r++)Nn.push({box:Ht});Nn.push(-fn),Nn.push({box:new $t(b,{fontFamily:R})}),Nn.push(-fn);for(let $r=0;$r<Tt;$r++)Nn.push({box:Ht})}Nn.push(-fn),Nn.push({box:new $t(g,{fontFamily:R})});let $s="";R==="Size1-Regular"?$s=" delim-size1":R==="Size4-Regular"&&($s=" delim-size4");const Va=new xr({bottom:hi,children:Nn},{classes:$s});return new $t(Va,f(P({},u!=null?u:{}),{classes:((d=u==null?void 0:u.classes)!=null?d:"")+" ML__delim-mult"}))}var bu=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","\u230A","\u230B","\u2308","\u2309"]),xd=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","\u27EE","\u27EF","\u23B0","\u23B1"]),Dc=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),wd=[0,1.2,1.8,2.4,3];function sf(e,i,r,a){return e===void 0||e==="."?fo(r,a.classes):(e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle"),bu.has(e)||Dc.has(e)?nf(e,i,!1,r,a):xd.has(e)?rf(e,wd[i],!1,r,a):(console.assert(!1,"Unknown delimiter '"+e+"'"),null))}var Cc=[{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}],xu=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],Sd=[{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 af(e){return e.type==="small"?"Main-Regular":e.type==="large"?"Size"+e.size+"-Regular":(console.assert(e.type==="stack"),"Size4-Regular")}function Ed(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=Io(e,af(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(so[Math.max(1,a.size-2)],a.minFontScale):r[d].mathstyle==="scriptstyle"&&(b*=Math.max(so[Math.max(1,a.size-1)],a.minFontScale))),b>i)return r[d]}return r[r.length-1]}function wu(e,i,r,a,u,d){if(!i||i.length===0||i===".")return fo(u);i==="<"||i==="\\lt"?i="\\langle":(i===">"||i==="\\gt")&&(i="\\rangle");let g;Dc.has(i)?g=Cc:bu.has(i)?g=Sd:g=xu;const b=Ed(Tl(i),r,g,u),x=new ln({parent:u,mathstyle:b.mathstyle},d==null?void 0:d.style);return b.type==="small"?yu(i,x,a,f(P({},d),{type:e})):b.type==="large"?nf(i,b.size,a,x,f(P({},d),{type:e})):(console.assert(b.type==="stack"),rf(i,r,a,x,f(P({},d),{type:e})))}function ho(e,i,r,a,u,d){if(i===".")return fo(u,d==null?void 0:d.classes);const g=Ls*u.scalingFactor,b=901,x=5/ro,E=Math.max(r-g,a+g),R=Math.max(E/500*b,2*E-x);return wu(e,i,R,!0,u,d)}function fo(e,i){const r=new $t(null,{classes:" nulldelimiter "+(i!=null?i:""),type:"ignore"});return r.width=e.getRegisterAsEm("nulldelimiterspace"),r.wrap(new ln({parent:e,mathstyle:"textstyle"}))}var Bs=class Mp extends ct{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 Mp(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{}"}},of=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],lf=["cases","dcases","rcases"],Su=["align","align*","aligned","gather","gathered","split"],uf=["array","subequations","eqnarray"];function cf(e){return uf.concat(Su).concat(lf).concat(of).includes(e)}function hf(e){return of.includes(e)}function ff(e){return lf.includes(e)}function kd(e){return Su.includes(e)}function Mc(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 ct({type:"first",mode:e.mode})]):oe[0].type!=="first"?F.push([new ct({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 ct({type:"first",mode:e.mode}),new Bs]);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 En=class Rp extends ct{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=Mc(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 Rp(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(pu(i))return(r=this.array[i[0]][i[1]])!=null?r:void 0}createBranch(i){var r;return pu(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(ao(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*td,He=.7*ge,Ot=.3*ge;let Ve=0;const Et=[];let Kt=0;const Tt=this.array.length;for(let Vn=0;Vn<Tt;++Vn){const vr=this.array[Vn];Kt=Math.max(Kt,vr.length);const Kr=new ln({parent:x,mathstyle:this.mathstyleName},this.style);let Ga=He/Kr.scalingFactor,Ha=Ot/Kr.scalingFactor;const Wa={cells:[],height:0,depth:0,pos:0};for(const ya of vr){const p0=(u=ct.createBox(Kr,ya,{type:"ignore"}))!=null?u:new $t(null,{type:"ignore"});Ha=Math.max(Ha,p0.depth),Ga=Math.max(Ga,p0.height),Wa.cells.push(p0)}let ja=(d=Uh(this.rowGaps[Vn]))!=null?d:0;ja>0&&(ja+=Ot,Ha=Math.max(Ha,ja),ja=0),Vn<Tt-1&&!hf(this.environmentName)&&this.environmentName!=="cases"&&this.environmentName!=="array"&&(Ha+=x.getRegisterAsEm("jot")),Wa.height=Ga,Wa.depth=Ha,Ve+=Ga,Wa.pos=Ve,Ve+=Ha+ja,Et.push(Wa)}const ai=Ve/2+Ls,bi=[];for(let Vn=0;Vn<Kt;Vn++){const vr=[];for(const Kr of Et){const Ga=Kr.cells[Vn];Ga.depth=Kr.depth,Ga.height=Kr.height,vr.push({box:Ga,shift:Kr.pos-ai})}vr.length>0&&bi.push(new xr({individualShift:vr}))}const hi=[];let fn=!1,Nn=!1,Ht=0,$s=!this.leftDelim;const{colFormat:Va}=this;for(const Vn of Va){if("align"in Vn&&Ht>=bi.length)break;if("align"in Vn)fn?hi.push(Eu(2*oe)):(Nn||$s)&&hi.push(Eu(oe)),hi.push(new $t(bi[Ht],{classes:"col-align-"+Vn.align})),Ht++,fn=!0,Nn=!1,$s=!1;else if("gap"in Vn){if(typeof Vn.gap=="number")hi.push(Eu(Vn.gap));else{const vr=Rc(i,Et,ai,Vn.gap);vr&&hi.push(vr)}fn=!1,Nn=!1,$s=!1}else if("separator"in Vn){const vr=new $t(null,{classes:"vertical-separator"});vr.height=Ve,vr.setStyle("height",Ve,"em"),vr.setStyle("border-right",`${E}em ${Vn.separator} currentColor`),vr.setStyle("vertical-align",-(Ve-ai),"em");let Kr=0;Nn?Kr=F-E:fn&&(Kr=oe-E),vr.left=Kr,hi.push(vr),fn=!1,Nn=!0,$s=!1}}fn&&!this.rightDelim&&hi.push(Eu(oe));const Qs=new $t(hi,{classes:"mtable"});if((!this.leftDelim||this.leftDelim===".")&&(!this.rightDelim||this.rightDelim==="."))return this.caret&&(Qs.caret=this.caret),this.bind(i,Qs);const $r=Qs.height,Ks=Qs.depth,Ss=this.bind(i,new $t([this.bind(i,ho("open",(g=this.leftDelim)!=null?g:".",$r,Ks,x,{isSelected:this.isSelected})),Qs,this.bind(i,ho("close",(b=this.rightDelim)!=null?b:".",$r,Ks,x,{isSelected:this.isSelected}))],{type:"ord"}));return Ss?(Ss.setStyle("display","inline-block"),this.caret&&(Ss.caret=this.caret),this.bind(i,this.attachSupsub(i,{base:Ss}))):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(ct.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}}`),Qi(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 ct({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(Al(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(Al(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,Al(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,Al(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 Al(e){const i=new ct({type:"first",mode:e.mode});i.parent=e;const r=new Bs;return r.parent=e,[i,r]}function Eu(e){const i=new $t(null,{classes:"arraycolsep"});return i.width=e,i}function Rc(e,i,r,a){if(!a)return null;const u=[];for(const d of i){const g=ct.createBox(e,a,{type:"ignore"});g&&(g.depth=d.depth,g.height=d.height,u.push({box:g,shift:d.pos-r}))}return new xr({individualShift:u}).wrap(e)}var _a=class Ip extends ct{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 Ip(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=ct.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 $t(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 $t([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?Qi([this.bodyToLatex(i),this.supsubToLatex(i)]):super._serialize(i)}},ku=class Pp extends ct{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 Pp(i.value,i)}toJson(){return super.toJson()}get computedStyle(){return{}}render(i){const r=new $t(this.value,{classes:"ML__composition",type:"composition"});return this.bind(i,r),this.caret&&(r.caret=this.caret),r}_serialize(i){return""}},po=class Op extends ct{constructor(i){super({type:"error",value:i,command:i,mode:"math"}),this.verbatimLatex=i}static fromJson(i){return new Op(i.command)}toJson(){return super.toJson()}render(i){const r=this.createBox(i,{classes:"ML__error"});return this.caret&&(r.caret=this.caret),r}},df=class Fp extends ct{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 Fp(i.body,i.mode,i.style)}render(i){const r=ct.createBox(i,this.body,{type:this.boxType});return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):`{${this.bodyToLatex(i)}}`}},Wn=class Bp extends ct{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 Bp((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"?Qi(["\\left",(r=this.leftDelim)!=null?r:".",this.bodyToLatex(i),"\\right",u]):this.variant==="mleft...mright"?Qi(["\\mleft",(a=this.leftDelim)!=null?a:".",this.bodyToLatex(i),"\\mright",u]):Qi([!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=Ko[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=ct.createBox(u,this.body,{type:"inner"}))!=null?r:new $t(null,{type:"inner"}),b=g.height/d.scalingFactor,x=g.depth/d.scalingFactor,E=[];if(this.leftDelim&&E.push(this.bind(d,ho("open",this.leftDelim,b,x,d,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),g&&(pf(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,ho("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 $t(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 pf(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,ho("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&&pf(g.children,i,r,a,u)}}var Ic=class Np extends ct{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 Np(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=ct.createBox(i,this.body);return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}},mf=class $p extends ct{constructor(){super({type:"macro-argument"})}static fromJson(i){return new $p}toJson(){return super.toJson()}_serialize(i){return""}render(i){return null}},gf=class Kp extends ct{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 Kp(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=ct.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 $t(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 $t(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 $t([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]"),Xn(u,a)}},Ll=class Up extends ct{constructor(i){super({type:"subsup",style:i==null?void 0:i.style}),this.subsupPlacement="auto"}static fromJson(i){const r=new Up(i);for(const a of Oo)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 $t(null),g=new $t(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 Uo(e){return e?!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(e):!1}var _f=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:Ds(this.tokens.slice(this.index,this.index+10)),after:Ds(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 Ll({style:this.style}),this.mathlist.push(e)),e}hasPattern(e){return e.test(this.tokens[this.index])}hasInfixCommand(){var e;const{index:i}=this;if(i<this.tokens.length&&this.tokens[i].startsWith("\\")){const r=Me(this.tokens[i],this.parseMode);return!r||r.definitionType==="symbol"||r.ifMode&&!r.ifMode.includes(this.parseMode)?!1:(e=r.infix)!=null?e:!1}return!1}matchColumnSeparator(){return!this.tabularMode||this.peek()!=="&"?!1:(this.index++,!0)}matchRowSeparator(){if(!this.tabularMode)return!1;const e=this.peek();return e!=="\\\\"&&e!=="\\cr"&&e!=="\\tabularnewline"?!1:(this.index++,!0)}placeholder(){var e;const i=(e=this.args)==null?void 0:e.call(this,"?");return i?Xr(i,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new Bs({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();Uo(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(Uo(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()||!Uo(this.peek()))return null;const u=this.scanString();return u.length>0?{string:u}:null}scanDimen(){const e=this.scanNumber(!1);if(e===null)return null;const i=e.number;this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace();let r;return this.matchKeyword("pt")?r="pt":this.matchKeyword("mm")?r="mm":this.matchKeyword("cm")?r="cm":this.matchKeyword("ex")?r="ex":this.matchKeyword("px")?r="px":this.matchKeyword("em")?r="em":this.matchKeyword("bp")?r="bp":this.matchKeyword("dd")?r="dd":this.matchKeyword("pc")?r="pc":this.matchKeyword("in")?r="in":this.matchKeyword("mu")&&(r="mu"),r?{dimension:i,unit:r}:{dimension:i}}scanGlueOrDimen(){const e=this.scanDimen();if(e===null)return null;if(this.skipWhitespace(),this.match("\\relax"))return e;const i={glue:e};if(this.matchKeyword("plus")){const r=this.scanDimen();if(r)i.grow=r;else return i}if(this.skipWhitespace(),this.match("\\relax"))return i;if(this.skipWhitespace(),this.matchKeyword("minus")){const r=this.scanDimen();if(r)i.shrink=r;else return i}return!i.grow&&!i.shrink?e:i}scanColspec(){this.skipWhitespace();const e=[];for(;!this.end()&&!(this.peek()==="<}>"||this.peek()==="]");){const i=this.get();i==="c"||i==="r"||i==="l"?e.push({align:i}):i==="|"?e.push({separator:"solid"}):i===":"?e.push({separator:"dashed"}):i==="@"&&(this.match("<{>")&&(this.beginContext({mode:"math"}),e.push({gap:this.scan(r=>r==="<}>")}),this.endContext()),this.match("<}>")||this.onError({code:"unbalanced-braces"}))}return e}scanModeSet(){let e;if(this.match("\\(")&&(e="textstyle"),!e&&this.match("\\[")&&(e="displaystyle"),!e)return null;this.beginContext({mode:"math",mathstyle:e});const i=this.scan(r=>r===(e==="displaystyle"?"\\]":"\\)"));return this.match(e==="displaystyle"?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanModeShift(){let e="";if(this.match("<$>")&&(e="<$>"),!e&&this.match("<$$>")&&(e="<$$>"),!e)return null;this.beginContext({mode:"math",mathstyle:"textstyle"});const i=this.scan(r=>r===e);return this.match(e)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanEnvironment(){if(!this.match("\\begin"))return null;const e=this.scanArgument("string");if(!e)return null;const i=ye(e);if(!i)return this.onError({code:"unknown-environment",arg:e}),null;const r=[];if(i.params)for(const b of i.params)if(b.isOptional)r.push(this.scanOptionalArgument(b.type));else{const 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=Me(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 df(i,this.parseMode,this.style);return r.verbatimLatex=Ds(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 Wn("",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(!Uo(e)&&!e.startsWith("\\"))return null;this.next();const i=Me(e,"math");return i?i.definitionType==="function"&&i.ifMode&&!i.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:e}),null):i.definitionType==="symbol"&&(i.type==="mopen"||i.type==="mclose")||/^(\.|\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e)?e:(this.onError({code:"unexpected-delimiter",arg:e}),null):(this.onError({code:"unknown-command",arg:e}),null)}scanLeftRight(){var e;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new po("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new po("\\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 po(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 Wn(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 ct({type:"mord",command:"\\doubleprime",mode:"math",value:"\u2032\u2032"}),"superscript"):i.addChild(new ct({type:"mord",command:"\\prime",mode:"math",value:"\u2032"}),"superscript"):(this.match("^")||this.match("_"))&&i.addChildren(Ie(this.scanArgument("expression")),e==="_"?"subscript":"superscript"),e=this.peek();return!0}parseLimits(){if(this.parseMode!=="math")return!1;const e=this.match("\\limits"),i=!e&&this.match("\\nolimits"),r=!i&&!e&&this.match("\\displaylimits");if(!e&&!i&&!r)return!1;const a=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return a===null?!1:(a.explicitSubsupPlacement=!0,e&&(a.subsupPlacement="over-under"),i&&(a.subsupPlacement="adjacent"),r&&(a.subsupPlacement="auto"),!0)}scanArguments(e){if(!(e!=null&&e.params))return[void 0,[]];let i;const r=[];let a=e.infix?2:0;for(;a<e.params.length;){const u=e.params[a];u.type==="rest"?r.push(this.scan(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(Uo(e)){const r=ys.createAtom(this.parseMode,e,P({},this.style));return r?[r]:null}if(i=this.scanMacro(e),i)return[i];if(e.startsWith("\\")){const r=Me(e,this.parseMode);if(!r)return this.onError({code:"unknown-command",arg:e}),[new po(e)];if(r.definitionType==="symbol"){const a=P({},this.style);r.variant&&(a.variant=r.variant),i=new ct({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 po(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=ct.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 gf(b,F,Y,ge!=null?ge:R,{mode:this.parseMode,style:this.style})]:[new Bs({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=Qi([e,Ds(this.tokens.slice(b,this.index))]);return[new ct({type:"text",value:"",verbatimLatex:R})]}}let u=this.scanMacro(e);if(u)return[u];const d=Me(e,this.parseMode);if(!d)return this.parseMode==="text"?(/[a-zA-Z]/.test((i=this.peek())!=null?i:"")&&(e+=" "),[...e].map(b=>new ct({type:"text",value:b,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:e}),[new po(e)]);const g=this.index;if(d.definitionType==="symbol"){const b=P({},this.style);d.variant&&(b.variant=d.variant),u=new ct({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 Ie(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=Ie(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,Ie(oe)}this.style=R}else u=new ct({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 ct&&u.verbatimLatex===void 0&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){const b=Qi([e,Ds(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(Uo(e)){const i=ys.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 bl(" "," ",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=Ds(this.tokens.slice(x,this.index))}d[g]=b}return new Ic(e,{expand:r.expand,captureSelection:r.captureSelection,args:a===this.index?null:Ds(this.tokens.slice(a,this.index)),style:this.parsingContext.style,body:Xr(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 Xr(e,i){var r,a,u,d;const g=(r=i==null?void 0:i.args)!=null?r:void 0,b=new _f(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 vf(e,i){var r;const a=new _f(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 Pc=class zp extends ct{constructor(i,r){super({type:"chem"},{command:i,mode:"math"});const a=Jn.go(Mt.go(r,i==="\\pu"?"pu":"ce"),!1);this.body=Xr(a),this._verbatimLatex=i+"{"+r+"}",this.arg=r,this.captureSelection=!0}static fromJson(i){return new zp(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=ct.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 Pc(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,Et){if(typeof Et=="string")return Ve.indexOf(Et)!==0?null:Et;var Kt=Ve.match(Et);return Kt?Kt[0]:null},F=function(Ve,Et,Kt){for(var Tt=0;Et<Ve.length;){var ai=Ve.charAt(Et),bi=R(Ve.substr(Et),Kt);if(bi!==null&&Tt===0)return{endMatchBegin:Et,endMatchEnd:Et+bi.length};if(ai==="{")Tt++;else if(ai==="}"){if(Tt===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];Tt--}Et++}return Tt>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 Jn={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+=Jn._go2(d),d.type_==="1st-level escape"&&(a=!0))}return!i&&!a&&r&&(r="{"+r+"}"),r},_goInner:function(e){return e&&Jn.go(e,!0)},_go2:function(e){var i;switch(e.type_){case"chemfive":i="";var r={a:Jn._goInner(e.a),b:Jn._goInner(e.b),p:Jn._goInner(e.p),o:Jn._goInner(e.o),q:Jn._goInner(e.q),d:Jn._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 "+Jn._goInner(e.p1);break;case"state of aggregation subscript":i="\\mskip1mu "+Jn._goInner(e.p1);break;case"bond":if(i=Jn._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{"+Jn._goInner(e.p1)+"}{"+Jn._goInner(e.p2)+"}";i="\\mathchoice{\\textstyle"+u+"}{"+u+"}{"+u+"}{"+u+"}";break;case"tex-math":i=e.p1+" ";break;case"frac-ce":i="\\frac{"+Jn._goInner(e.p1)+"}{"+Jn._goInner(e.p2)+"}";break;case"overset":i="\\overset{"+Jn._goInner(e.p1)+"}{"+Jn._goInner(e.p2)+"}";break;case"underset":i="\\underset{"+Jn._goInner(e.p1)+"}{"+Jn._goInner(e.p2)+"}";break;case"underbrace":i="\\underbrace{"+Jn._goInner(e.p1)+"}_{"+Jn._goInner(e.p2)+"}";break;case"color":i="{\\color{"+e.color1+"}{"+Jn._goInner(e.color2)+"}}";break;case"color0":i="\\color{"+e.color+"}";break;case"arrow":var d={rd:Jn._goInner(e.rd),rq:Jn._goInner(e.rq)},g=Jn._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=Jn._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 _0(e){}function v0(e){}var yf=class Vp extends ct{constructor(i){super(f(P({},i),{type:"delim"})),this.value=i.delim,this.size=i.size}static fromJson(i){return new Vp(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size})}render(i){return new $t(this.value,{type:"middle"})}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):Xn(this.command,this.value)}},bf=class Gp extends ct{constructor(i){super(f(P({},i),{type:"sizeddelim",value:i.delim})),this.delimType=i.delimType,this.size=i.size}static fromJson(i){return new Gp(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(i){let r=sf(this.value,this.size,i,{classes:{open:"mopen",close:"mclose"}[this.delimType],type:this.delimType,isSelected:this.isSelected});return r?(r=this.bind(i,r),this.caret&&(r.caret=this.caret),r):null}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):Xn(this.command,this.value)}},zo=class Hp extends ct{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 Hp(i.command,i.body,i.notation,i)}toJson(){return f(P({},super.toJson()),{notation:this.notation,shadow:this.shadow,strokeWidth:this.strokeWidth,strokeStyle:this.strokeStyle,svgStrokeStyle:this.svgStrokeStyle,strokeColor:this.strokeColor,borderStyle:this.borderStyle,padding:this.padding})}_serialize(i){var r;if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const a=Me(this.command,this.mode);if(a!=null&&a.serialize)return a.serialize(this,i);let u=(r=this.command)!=null?r:"";if(this.command==="\\enclose"){u+="{"+Object.keys(this.notation).join(" ")+"}";let 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 Xn(u,this.bodyToLatex(i))}render(i){const r=new ln({parent:i},this.style),a=ct.createBox(r,this.body);if(!a)return null;const u=Td(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 $t(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 Et=d;Et+Ot-.4*He<0&&(Et=.4*He-Ot),E+='<polygon points="',E+=`${Ve},${Et} ${Ve-He-.4*Ot},${Et+Ot-.4*He} `,E+=`${Ve-.7*He},${Et+.7*Ot} ${Ve-He+.4*Ot},${Et+Ot+.4*He} `,E+=`${Ve},${Et}`,E+=`" stroke='none' fill="${this.strokeColor}"`,E+="/>"}let R=0;if(this.notation.phasorangle){const Y=xf(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=xf(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="${Ad(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 $t([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="${Tu(i)}" y1="${Tu(r)}" x2="${Tu(a)}" y2="${Tu(u)}" vector-effect="non-scaling-stroke"></line>`}};function Tu(e){return typeof e=="number"?`${Math.floor(100*e)/100}%`:e}function Td(e){if(!e)return"1px";const i=e.match(/([0-9][a-zA-Z\%]+)/);return i===null?"1px":i[1]}function Ad(e){return(Math.floor(100*e.metrics.sqrtRuleThickness/e.scalingFactor)/100/10).toString()+"em"}function xf(e){const i=e.isDisplayStyle?js:e.metrics.defaultRuleThickness;return e.metrics.defaultRuleThickness+e.scalingFactor*i/4}var Ma=class Wp extends ct{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 Wp(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 $t([new $t(this.numerPrefix),ct.createBox(g,this.above)],{isTight:g.isTight,type:"ignore"}):(r=ct.createBox(g,this.above,{type:"ignore"}))!=null?r:new $t(null,{type:"ignore"}),x=new ln({parent:u,mathstyle:this.continuousFraction?"":"denominator"},this.style),E=this.denomPrefix?new $t([new $t(this.denomPrefix),ct.createBox(x,this.below,{type:"ignore"})]):(a=ct.createBox(x,this.below,{type:"ignore"}))!=null?a:new $t(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 hi=F-He-(Ot-oe);hi<Y&&(F+=(Y-hi)/2,oe+=(Y-hi)/2),Ve=new xr({individualShift:[{box:b,shift:-F,classes:[...ge,"ML__center"]},{box:E,shift:oe,classes:[...ge,"ML__center"]}]}).wrap(u)}else{const hi=new $t(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});hi.softWidth=Math.max(b.width,E.width),hi.height=R/2,hi.depth=R/2;const fn=Ls+R/2;F<Y+He+fn&&(F=Y+He+fn);const Nn=Ls-R/2;oe<Y+Ot-Nn&&(oe=Y+Ot-Nn),Ve=new xr({individualShift:[{box:E,shift:oe,classes:[...ge,"ML__center"]},{box:hi,shift:-Nn,classes:ge},{box:b,shift:-F,classes:[...ge,"ML__center"]}]}).wrap(u)}const Et=u.isDisplayStyle?d.delim1:d.delim2,Kt=this.leftDelim?this.bind(i,wu("open",this.leftDelim,Et,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):fo(u,"open");let Tt=null;this.continuousFraction?Tt=new $t(null,{type:"close"}):this.rightDelim?Tt=this.bind(i,wu("close",this.rightDelim,Et,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):Tt=fo(u,"close");const ai=new $t([Kt,Ve,Tt],{isTight:u.isTight,type:"inner",classes:"mfrac"}),bi=this.bind(i,ai);return this.caret&&(bi.caret=this.caret),this.attachSupsub(i,{base:bi})}},Mr=class jp extends ct{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 jp(i.value);return i.isSuggestion&&(r.isSuggestion=!0),i.isError&&(r.isError=!0),r}toJson(){const i={};return this.isSuggestion&&(i.isSuggestion=!0),this.isError&&(i.isError=!0),P({type:"latex",value:this.value},i)}get computedStyle(){return{}}render(i){const r=new $t(this.value,{classes:this.isSuggestion?"ML__suggestion":this.isError?"ML__error":"",type:"latex",maxFontSize:1});return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}},Ra=class qp extends ct{constructor(i){super({type:"latexgroup",mode:"latex"}),this.body=[...i].map(r=>new Mr(r)),this.skipBoundary=!1}static fromJson(i){return new qp("")}toJson(){return super.toJson()}render(i){const r=ct.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:""}},Oc=class Zp extends ct{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 Zp(i.symbol,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.subsupPlacement&&(i.limits=this.subsupPlacement),this.isExtensibleSymbol&&(i.isExtensibleSymbol=!0),this.value&&(i.symbol=this.value),i}render(i){var r;const a=i.isDisplayStyle&&this.value!=="\\smallint",u=new $t(this.value,{fontFamily:a?"Size2-Regular":"Size1-Regular",classes:"op-symbol "+(a?"large-op":"small-op"),type:"op",maxFontSize:i.scalingFactor,isSelected:this.isSelected});if(!u)return null;u.right=u.italic;const d=(u.height-u.depth)/2-Ls*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 $t(this.bind(i,b),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(i)}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=[];return a.push(this.command),this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&a.push("\\limits"),this.subsupPlacement==="adjacent"&&a.push("\\nolimits"),this.subsupPlacement==="auto"&&a.push("\\displaylimits")),a.push(this.supsubToLatex(i)),Qi(a)}},mo=class Yp extends ct{constructor(i){const r=i.body;super(f(P({},i),{type:"overlap",body:typeof r=="string"?[new ct({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 Yp(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=ct.createBox(i,this.body,{classes:"inner"});return r?(this.caret&&(r.caret=this.caret),this.bind(i,new $t([r,new $t(null,{classes:"fix"})],{classes:this.align==="right"?"rlap":"llap",type:this.boxType}))):null}},Cs=class Xp extends ct{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 Xp(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?cu(this.svgBody):ct.createBox(i,this.body,{type:"ignore"});const a=new ln({parent:i,mathstyle:"scriptstyle"},this.style);let u=null;this.svgAbove?u=cu(this.svgAbove):this.above&&(u=ct.createBox(a,this.above,{type:"ignore"}));let d=null;this.svgBelow?d=cu(this.svgBelow):this.below&&(d=ct.createBox(a,this.below,{type:"ignore"})),this.paddedBody&&(r=new $t([fo(i,"open"),r,fo(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 $t(i.base,{type:i.type});return b.setStyle("position","relative"),b}let r=0;i.above&&(r=e.metrics.bigOpSpacing5);let a=null;const u=i.base,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 xr({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 xr({top:u.height-d,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:g},{box:u,classes:["ML__center"]}]}):i.above&&(a=new xr({bottom:u.depth+d,children:[{box:u,classes:["ML__center"]},r,{box:i.above,classes:g},e.metrics.bigOpSpacing5]}));return new $t(a,{type:i.type})}var Vo=class Jp extends ct{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 Jp(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),ct.createBox(r,this.body,{classes:"inner"});const a=ct.createBox(this.isInvisible?r:i,this.body);if(!a)return null;if(this.smashWidth){const u=new $t(null,{classes:"fix"});return new $t([a,u],{classes:"rlap"}).wrap(i)}if(!this.smashHeight&&!this.smashDepth)return a;if(this.smashHeight&&(a.height=0),this.smashDepth&&(a.depth=0),a.children)for(const u of a.children)this.smashHeight&&(u.height=0),this.smashDepth&&(u.depth=0);return new xr({firstBaseline:[{box:a}]},{type:a.type}).wrap(i)}},Go=class Qp extends ct{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 Qp(i)}toJson(){const i=super.toJson();return this.width!==void 0&&(i.width=this.width),this._braced&&(i.braced=!0),i}render(i){var r;if(this.command==="space")return new $t(this.mode==="math"?null:" ");let a;if(this.width!==void 0)a=new $t(null,{classes:"mspace"}),a.left=i.toEm(this.width);else{const u=(r={"\\qquad":"qquad","\\quad":"quad","\\enspace":"enspace","\\;":"thickspace","\\:":"mediumspace","\\>":"mediumspace","\\,":"thinspace","\\!":"negativethinspace"}[this.command])!=null?r:"mediumspace";a=new $t(null,{classes:u})}return a=this.bind(i,a),this.caret&&(a.caret=this.caret),a}_serialize(i){var r;if(!i.expandMacro&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const a=Me(this.command,this.mode);if(a!=null&&a.serialize)return a.serialize(this,i);const u=(r=this.command)!=null?r:"";return this.width===void 0?u:this._braced&&!("register"in this.width)?`${u}{${wr(this.width)}}`:`${u}${wr(this.width)}`}},wf=class em extends ct{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 em(f(P({},i),{index:i.above}))}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=this.command,u=this.bodyToLatex(i);return this.above&&!this.hasEmptyBranch("above")?Xn(`${a}[${this.aboveToLatex(i)}]`,u):/^[0-9]$/.test(u)?`${a}${u}`:Xn(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=ct.createBox(a,this.body,{type:"inner"}))!=null?r:new $t(null),d=a.scalingFactor,g=a.metrics.defaultRuleThickness/d,b=i.isDisplayStyle?js:g,x=new $t(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 $t(wu("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 xr({firstBaseline:[{box:new $t(u)},E-2*g,{box:x},g]})),Ot=ct.createBox(new ln({parent:i,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!Ot){const Kt=new $t([oe,He],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return Kt.setStyle("display","inline-block"),Kt.setStyle("height",Kt.height+Kt.depth,"em"),this.caret&&(Kt.caret=this.caret),this.bind(i,Kt)}const Ve=new xr({shift:-.6*(Math.max(oe.height,He.height)-Math.max(oe.depth,He.depth)),children:[{box:Ot}]}),Et=new $t([new $t(Ve,{classes:"ML__sqrt-index",type:"ignore"}),oe,He],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return Et.height=oe.height,Et.depth=oe.depth,this.caret&&(Et.caret=this.caret),this.bind(i,Et)}},Fc=class extends $t{constructor(e){super(null,{type:"skip"}),this._width=e}toMarkup(){return`<span style="display:inline-block;width:${Math.ceil(this.width*100)/100}em"></span>`}};function Dl(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"){Dl(e.parent,i);return}a>0&&r[a-1].type==="skip"?r[a-1].width+=i:r.splice(a,0,new Fc(i))}var Au={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}},Dd={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function Cd(e){Ho(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 Cl(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 Ho(r,(g,b)=>{var x,E,R;if(!g)return;const F=g.type,Y=b.isTight?(x=Dd[F])!=null?x:null:(E=Au[F])!=null?E:null,oe=(R=Y==null?void 0:Y[b.type])!=null?R:null;oe===3&&Dl(b,a),oe===4&&Dl(b,u),oe===5&&Dl(b,d)}),e}function Ho(e,i,r=void 0){if(!e)return r;e=[...e];for(const a of e)a.type==="lift"?r=Ho(a.children,i,r):a.type==="ignore"?Ho(a.children,i):(i(r,a),Ho(a.children,i),r=a);return r}var Lu=class tm extends ct{constructor(i){super({type:"tooltip",command:i.command,mode:i.mode,style:i.style,body:i.body,displayContainsHighlight:!0}),this.tooltip=new ct({type:"root",mode:i.content,body:i.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(i){return new tm(f(P({},i),{tooltip:Pa(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=ct.createBox(new ln,this.body);if(!r)return null;const a=new ln({parent:i,mathstyle:"displaystyle"},{fontSize:ml}),u=uu(Cl(new $t(this.tooltip.render(a),{classes:"ML__tooltip-content"}),a)),d=new $t([u,r],{classes:"ML__tooltip-container"});return this.caret&&(d.caret=this.caret),this.bind(i,d)}},Ia=class im extends ct{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 im(i.symbol,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.variantStyle&&(i.variantStyle=this.variantStyle),this.subsupPlacement&&(i.limits=this.subsupPlacement),this.value&&(i.symbol=this.value),i}render(i){var r;const a=new $t(this.value,{type:"op",mode:"math",maxFontSize:i.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:i.letterShapeStyle});let u=a;if(this.superscript||this.subscript){const 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 $t(this.bind(i,u),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(i)}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=[this.command];return this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&a.push("\\limits"),this.subsupPlacement==="adjacent"&&a.push("\\nolimits"),this.subsupPlacement==="auto"&&a.push("\\displaylimits")),a.push(this.supsubToLatex(i)),Qi(a)}};function Pa(e){if(k(e))return e.map(a=>Pa(a));if(typeof e=="string")return ct.fromJson(e);e=P({},e);for(const a of Oo)e[a]&&(e[a]=Pa(e[a]));e.args&&(e.args=Md(e.args)),e.array&&(e.array=Pa(e.array));const i=e.type;let r;i==="accent"&&(r=vu.fromJson(e)),i==="array"&&(r=En.fromJson(e)),i==="box"&&(r=_a.fromJson(e)),i==="chem"&&(r=Pc.fromJson(e)),i==="composition"&&(r=ku.fromJson(e)),i==="delim"&&(r=yf.fromJson(e)),i==="enclose"&&(r=zo.fromJson(e)),i==="error"&&(r=po.fromJson(e)),i==="extensible-symbol"&&(r=Oc.fromJson(e)),i==="genfrac"&&(r=Ma.fromJson(e)),i==="group"&&(r=df.fromJson(e)),i==="latex"&&(r=Mr.fromJson(e)),i==="latexgroup"&&(r=Ra.fromJson(e)),i==="leftright"&&(r=Wn.fromJson(e)),i==="macro"&&(r=Ic.fromJson(e)),i==="macro-argument"&&(r=mf.fromJson(e)),i==="operator"&&(r=Ia.fromJson(e)),i==="overlap"&&(r=mo.fromJson(e)),i==="overunder"&&(r=Cs.fromJson(e)),i==="placeholder"&&(r=Bs.fromJson(e)),i==="prompt"&&(r=gf.fromJson(e)),i==="phantom"&&(r=Vo.fromJson(e)),i==="sizeddelim"&&(r=bf.fromJson(e)),i==="spacing"&&(r=Go.fromJson(e)),i==="subsup"&&(r=Ll.fromJson(e)),i==="surd"&&(r=wf.fromJson(e)),i==="text"&&(r=bl.fromJson(e)),i==="tooltip"&&(r=Lu.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=ct.fromJson(e));for(const a of Oo)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 Md(e){if(e&&Array.isArray(e))return e.map(i=>i==="<null>"?null:typeof i=="object"&&"group"in i?{group:i.group.map(r=>Pa(r))}:typeof i=="object"&&"atoms"in i?i.atoms.map(r=>Pa(r)):i)}var Sf={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"]},Bc={"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]$/},Ef=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,kf=/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/,Nc=[/^[a-z]$/,/^[A-Z]$/,Ef,kf],Rd={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]},Oa=class extends ys{constructor(){super("math")}createAtom(e,i,r){var a,u,d,g;if(i===null)return new ct({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 ct({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 ct({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=h(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&&Nc.forEach((b,x)=>{var E;b.test(e.value)&&Rd[(E=i.letterShapeStyle)!=null?E:"tex"][x]==="it"&&(a="italic")}),a==="up"&&(a=void 0);const u=a?r+"-"+a:r;console.assert(Sf[u]!==void 0);const[d,g]=Sf[u];return Bc[r]&&!Bc[r].test(e.value)?(e.value=ze(e.value,r,a),null):(Ef.test(e.value)&&(e.classes+=" lcGreek"),g&&(e.classes+=" "+g),d)}};function h(e,i){const{parent:r}=e[0],a=t(r);return Vr(e,"variant").map(u=>{const d=t(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=Qi(u.map(x=>x._serialize(i)));return g?Xn(g,b):b})}function t(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 Oa;function n(e,i){return e.map(r=>r._serialize(i))}function s(e,i){return Vr(e,"fontShape").map(r=>{const a=n(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?`{${Xn("\\fontshape",u)}${Qi(a)}}`:d?Xn(d,Qi(a)):Qi(a)})}function o(e,i){return Vr(e,"fontSeries").map(r=>{const a=s(r,i),{fontSeries:u}=r[0].style;let d="";return u==="b"&&(d="\\textbf"),u==="l"&&(d="\\textlf"),u==="m"&&(d="\\textmd"),u&&!d?`{${Xn("\\fontseries",u)}${Qi(a)}}`:d?Xn(d,Qi(a)):Qi(a)})}function l(e,i){return Vr(e,"fontSize").map(r=>{var a,u;const d=o(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} ${Qi(d)}`:Qi(d)})}function c(e,i,r){return Vr(e,"fontFamily").map(a=>{var u,d;const g=l(a,i),b=(d={roman:"textrm",monospace:"texttt","sans-serif":"textsf"}[(u=a[0].style.fontFamily)!=null?u:""])!=null?d:"";return b?`\\${b}{${Qi(g)}}`:a[0].style.fontFamily?`{\\fontfamily{${a[0].style.fontFamily}} ${Qi(g)}}`:r?`\\text{${Qi(g)}}`:Qi(g)})}var p={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"},_=class extends ys{constructor(){super("text")}createAtom(e,i,r){return i&&i.definitionType==="symbol"?new bl(e,String.fromCodePoint(i.codepoint),r!=null?r:{}):null}serialize(e,i){return c(e,f(P({},i),{defaultMode:"text"}),i.defaultMode!=="text")}getFont(e,i){var r,a,u,d,g;const{fontFamily:b}=i;if(p[b]?e.classes+=" "+p[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 _;var m=class extends ys{constructor(){super("latex")}createAtom(e){return new Mr(e)}serialize(e,i){return e.filter(r=>r instanceof Mr&&!r.isSuggestion).map(r=>r.value)}getFont(){return null}};new m;var v={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:["","=","","="]}},y={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:["","=","","="]}},S={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:["\\","|","",""]}},D={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:[")",")",")",")"]}},M={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:["=","=","=","="]}},U={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:["<",">","",""]}},N={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"]}},te={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:["=","=","=","="]}},_e={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:["<",">","|",""]}},le={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:[".",".",".","."]}},Re={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"]}},Ue={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:["<",">","",""]}},_t={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 Ne(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 We(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 tt={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]"},Oe=[],Rt;function ei(){switch(H()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function pi(e){(!e.platform||e.platform===ei())&&Oe.push(e)}function yi(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=tt[e])!=null?r:"",a}function vi(e){if(e.code)return e;const i=Object.entries(Jt().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 ui(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 Oe)((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);Oe.sort((u,d)=>d.score-u.score)}function Ui(e){Rt=Oe.find(i=>e.startsWith(i.locale))}function Jt(){return Rt!=null?Rt:Oe[0]}function Hi(){switch(ei()){case"apple":return y;case"windows":return S;case"linux":return D}return y}switch(ei()){case"apple":pi(y),pi(M),pi(Re),pi(te);break;case"windows":pi(S),pi(U),pi(Ue),pi(_e);break;case"linux":pi(D),pi(N),pi(_t),pi(le);break}pi(v);function Ni(e){var i;const r=/macos|ios/.test(H()),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 ri(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 jt(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 hn(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 mn=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 kn(e){return e.ctrlKey||e.metaKey||["Dead","Process"].includes(e.key)?!1:e.code===""?!0:mn.has(e.code)}function gn(){var e;let i=document.activeElement;for(;(e=i==null?void 0:i.shadowRoot)!=null&&e.activeElement;)i=i.shadowRoot.activeElement;return i}var Mn=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=gn();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:"",gn()!==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 xs(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=Mn.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:()=>gn()===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 Sr(e){var i;if(!e||!kn(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 hs(e){e=vi(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 go(e){if(C()){const i=H(),r=e.startsWith("!"),a=e.endsWith(i);if(r&&!a||!r&&a)return!0}return e==="!other"?!1:e==="other"}function Id(e,i,r){if(e.length===0)return"";const a=We(Ne(hs(r))),u=We({key:r.key,shift:r.shiftKey,alt:r.altKey,ctrl:r.ctrlKey,meta:r.metaKey||r.ctrlKey&&/macos|ios/.test(H()),cmd:!1,win:!1});for(let 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 Du(e){let i=e;return k(i)&&(i=i.length>0?i[0]+"("+i.slice(1).join("")+")":""),i}function $c(e,i){let r=[];if(typeof i=="string"){const d=Lc[i];k(d)?r=d.slice():d&&r.push(d)}const a=Du(i),u=new RegExp("^"+a.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(const d of e)u.test(Du(d.command))&&r.push(d.key);return r.map(Ni)}function y0(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=Ne(e.key);let a=e.ifPlatform;if(r.cmd){if(a&&a!=="macos"&&a!=="ios")throw new Error('Unexpected "cmd" modifier with platform "'+a+`"
|
|
|
"cmd" modifier can only be used with macOS or iOS platform.`);a||(a=H()==="ios"?"ios":"macos"),r.win=!1,r.cmd=!1,r.meta=!0}if(r.win){if(a&&a!=="windows")throw new Error('Unexpected "win" modifier with platform "'+a+`"
|
|
|
"win" modifier can only be used with Windows platform.`);a="windows",r.win=!1,r.cmd=!1,r.meta=!0}if(a&&!go(a))return;if(/^\[.+\]$/.test(r.key))return f(P({},e),{key:We(r)});const u=yi(r.key,i);if(!u)return f(P({},e),{key:We(r)});if(u.shift&&r.shift||u.alt&&r.alt)throw new Error(`The keybinding ${e.key} (${Tn(e.command)}) is conflicting with the key combination ${We(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:We(u)})}function Tn(e){if(Array.isArray(e)){const i=[...e];return i.shift()+"("+i.map(r=>typeof r=="string"?`"${r}"`:r.toString()).join(", ")+")"}return e}function Jr(e,i){const r=[],a=[];for(const u of e)try{const d=y0(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} (${Tn(u.command)}) matches ${g.key} (${Tn(g.command)}) with the ${i.displayName} keyboard layout`);a.push(d)}catch(d){d instanceof Error&&r.push(d.message)}return[a,r]}var Ms=class extends Bn{constructor(){super("latex")}createAtom(e){return new Mr(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"}),pr(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(Hn(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)Be.test(x)&&d.push(new Mr(x));let g=e.at(e.position);if(g instanceof Ra&&(g=g.lastChild),!(g.parent instanceof Ra)){const x=new Ra("");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 _o(e){return e.atoms.find(i=>i.type==="latexgroup")}function as(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 vo(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 Mr&&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 Mr&&x.isSuggestion),b||g++}return[a-1,g-1]}new Ms;function Xs(e){const i=as(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 Wo(e,i){var r;const{model:a}=e;Xs(e);for(const R of as(a))R.isError=!1;if(!a.selectionIsCollapsed||e.options.popoverPolicy==="off"){Ru(e);return}const u=[];let d=a.at(a.position);for(;d&&d instanceof Mr&&/^[a-zA-Z\*]$/.test(d.value);)d=d.leftSibling;if(d&&d instanceof Mr&&d.value==="\\")for(u.push(d),d=d.rightSibling;d&&d instanceof Mr&&/^[a-zA-Z\*]$/.test(d.value);)u.push(d),d=d.rightSibling;const g=u.map(R=>R.value).join(""),b=Fe(e,g);if(b.length===0){if(/^\\[a-zA-Z\*]+$/.test(g))for(const R of u)R.isError=!0;Ru(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 Mr(F,{isSuggestion:!0})),R),Rl(e,{interactive:!0})}Tf(e,b)}function Ml(e){const[i,r]=vo(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 yo(e,i="accept",r){var a,u;Ru(e);const d=_o(e.model);if(!d)return!1;if(i==="accept-suggestion"||i==="accept-all"){const E=as(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=as(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"||(Bn.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 Fa(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 Cu(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 Pd(e,i){const r=new ln({from:e.context}),a=new ct({mode:"math",type:"root",body:Xr(i,{context:r})}),u=uu(Cl(new $t(a.render(r),{classes:"ML__base"}),r));return vl(u,{classes:"ML__latex"}).toMarkup()}function Tf(e,i){var r;if(i.length===0){Ru(e);return}let a="";for(const[d,g]of i.entries()){const b=g,x=Pd(e,g),E=$c(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=om(e,`<ul>${a}</ul>`);Mu()&&((r=u.querySelector(".ML__popover__current"))==null||r.scrollIntoView({block:"nearest",inline:"nearest"})),setTimeout(()=>{var d;u&&!Mu()&&(u.classList.add("is-visible"),Ba(e),(d=u.querySelector(".ML__popover__current"))==null||d.scrollIntoView({block:"nearest",inline:"nearest"}))},32)}function Mu(){const e=document.getElementById("mathlive-suggestion-popover");return e?e.classList.contains("is-visible"):!1}function Ba(e,i){var r;if(!e.element||e.element.mathfield!==e||!Mu())return;if(((r=e.model.at(e.model.position))==null?void 0:r.type)!=="latex"){Ru(e);return}if(i!=null&&i.deferred){setTimeout(()=>Ba(e),32);return}const a=Sl(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 Ru(e){e.suggestionIndex=0;const i=document.getElementById("mathlive-suggestion-popover");i&&(i.classList.remove("is-visible"),i.innerHTML="")}function om(e,i){let r=document.getElementById("mathlive-suggestion-popover");return r||(r=Fa("mathlive-suggestion-popover"),Ys("suggestion-popover"),Ys("core"),r.addEventListener("pointerdown",a=>a.preventDefault()),r.addEventListener("click",a=>{let u=a.target;for(;u&&!u.dataset.command;)u=u.parentElement;u&&(yo(e,"reject"),Bn.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")&&(Cu("mathlive-suggestion-popover"),Ca("suggestion-popover"),Ca("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 Af=null,b0,x0,Od=((x0=(b0=globalThis==null?void 0:globalThis.document)==null?void 0:b0.currentScript)==null?void 0:x0.src)||um();function w0(e){return Xo(this,null,function*(){if(/^(?:[a-z+]+:)?\/\//i.test(e))return new URL(e).href;if(Af===null)try{const i=yield fetch(Od,{method:"HEAD"});i.status===200&&(Af=i.url)}catch(i){console.error(`Invalid URL "${e}" (relative to "${Od}")`)}return new URL(e,Af!=null?Af:Od).href})}function cm(e,i,r={}){return new FontFace(e,`url(${i}.woff2) format('woff2')`,r)}var Ns="not-loaded";function hm(){return Xo(this,null,function*(){return Ns="not-loaded",Lf()})}function Lf(){return Xo(this,null,function*(){var e;if(Ns!=="not-loaded")return;if(Ns="loading",(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))!=null?e:!1){Ns="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))){Ns="ready";return}if(!window.MathfieldElement.fontsDirectory){Ns="not-loaded";return}const u=yield w0(window.MathfieldElement.fontsDirectory);if(!u){document.body.classList.add("ML__fonts-did-not-load"),Ns="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)),Ns="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")}Ns="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 pr(e,i){e&&(e.dirty||(e.dirty=!0,requestAnimationFrame(()=>{uo(e)&&e.dirty&&(e.atomBoundsCache=new Map,Rl(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(ct.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 vl(Cl(u,a),{classes:e.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})}function S0(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 Rl(e,i){if(!uo(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=S0(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">${Nr(x)}</span>`)}a.innerHTML=window.MathfieldElement.createHTML(g),Df(e,i.interactive),e.dirty=!1}function Df(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)&&Ns!=="error"&&Ns!=="ready"&&setTimeout(()=>{Ns==="ready"?Df(e):setTimeout(()=>Df(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){Ba(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=Xh(e,El(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(Qh(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 E0=3,Na;function Rs(e,i){i=P({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},i!=null?i:{}),Na||(Na={});for(const r of Object.keys(e))console.assert(!Na[r],"Selector already defined: ",r),Na[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()),Na[i]}function Iu(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=Na[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)||Xs(e),Na[a].fn(e.model,...u),Wo(e),g=!0,d=!0}else if(x==="virtual-keyboard")g=(r=window.mathVirtualKeyboard.executeCommand(i))!=null?r:!1,d=!0;else if(Na[a]){if(!e.isSelectionEditable&&(b!=null&&b.changeContent))return e.model.announce("plonk"),!1;/^(undo|redo)/.test(a)&&e.flushInlineShortcutBuffer(),g=Na[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&&pr(e),d}function gm(e,i){var r;if(!e)return!1;e.focus(),yp.keypressVibration&&J()&&navigator.vibrate(E0);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}Rs({performWithFeedback:(e,i)=>gm(e,i)});function _m(e){return Wo(e,{atIndex:e.suggestionIndex+1}),!1}function vm(e){return Wo(e,{atIndex:e.suggestionIndex-1}),!1}Rs({complete:yo},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),Rs({nextSuggestion:_m,previousSuggestion:vm},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var Cf="mathlive#virtual-keyboard-message";function Bd(e){var i;return e.type!=="message"?!1:((i=e.data)==null?void 0:i.type)===Cf}var ym=class nm{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 nm),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(!_u(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;Iu(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:Cf,action:i},r),this.targetOrigin)}},k0={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]"]]}},Mf={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"}]},Kc;function T0(e,i){var r,a,u;const d=jo.singleton;if(!d)return;const g=Pu(e),b=(a=(r=d.getKeycap(g==null?void 0:g.id))==null?void 0:r.variants)!=null?a:"";if(typeof b=="string"&&!A0(b)||Array.isArray(b)&&b.length===0){i==null||i();return}const x={};let E="";for(const He of xm(b)){const Ot=D0(He),Ve=Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);x[Ve]=Ot;const[Et,Kt]=Rf(Ot);E+=`<div id=${Ve} class="item ${Kt}">${Et}</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=yp.createHTML(E),Mn.open({root:(u=d==null?void 0:d.container)==null?void 0:u.querySelector(".ML__keyboard"),child:R}),Kc=new AbortController;const{signal:oe}=Kc,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 Et=Pu(Ve.target);!(Et!=null&&Et.id)||!x[Et.id]||(Nd(x[Et.id]),Uc(),i==null||i(),Ve.preventDefault())},{capture:!0,passive:!1,signal:oe}),R.addEventListener("pointerenter",Ve=>{const Et=Pu(Ve.target);!(Et!=null&&Et.id)||!x[Et.id]||Et.classList.add("is-active")},{capture:!0,signal:oe}),R.addEventListener("pointerleave",Ve=>{const Et=Pu(Ve.target);!(Et!=null&&Et.id)||!x[Et.id]||Et.classList.remove("is-active")},{capture:!0,signal:oe}),window.addEventListener("pointercancel",()=>{Uc(),i==null||i()},{signal:oe}),window.addEventListener("pointerup",()=>{Uc(),i==null||i()},{signal:oe})})}}function Uc(){Kc==null||Kc.abort(),Kc=null,Mn.state==="open"&&Mn.close()}function bm(e){if(e==="foreground-color"){const i=[];for(const r of Object.keys(se))i.push({class:"swatch-button",label:'<span style="border: 3px solid '+se[r]+'"></span>',command:["applyStyle",{color:r}]});return i}if(e==="background-color"){const i=[];for(const r of Object.keys(Te))i.push({class:"swatch-button",label:'<span style="background:'+Te[r]+'"></span>',command:["applyStyle",{backgroundColor:r}]});return i}}function A0(e){return Mf[e]!==void 0}function xm(e){var i;return typeof e!="string"?e:(Mf[e]||(Mf[e]=(i=bm(e))!=null?i:[]),Mf[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 zc(e){if(!e)return"";const i=new ln,r=new ct({mode:"math",type:"root",body:Xr(e,{context:i,args:u=>u==="@"?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}),a=uu(Cl(new $t(r.render(i),{classes:"ML__base"}),i));return vl(a,{classes:"ML__latex"}).toMarkup()}function Vc(e){var i;if(Array.isArray(e))return e.map(a=>Vc(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=>D0(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=Jt();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"}[B.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:A0(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:Vc({rows:g})}}function L0(e){if(e==="alphabetic")return Em();if(typeof e=="string")return console.assert(k0[e]!==void 0,`MathLive 0.98.5: unknown keyboard layout "${e}"`),L0(k0[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:Vc({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:Vc(e.markup)})}else i=P({},e),"layers"in e?i.layers=Vc(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()){Ou(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 Tm(e,i){let r="";if(e.editToolbar==="none")return"";const u=[];i.selectionIsCollapsed?u.push("undo","redo","pasteFromClipboard"):u.push("cutToClipboard","copyToClipboard","pasteFromClipboard");const 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 Am(e){for(const i of e)Lm(i)}function Lm(e){const i=jo.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]=Rf(r);e.innerHTML=window.MathfieldElement.createHTML(a)}}function Dm(){Ys("virtual-keyboard"),Ys("core"),Lf()}function Cm(){Ca("core"),Ca("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))});Am(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]=Rf(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 Rf(e,i={shifted:!1}){var r,a,u,d,g,b,x;let E="",R=(r=e.class)!=null?r:"";if(i.shifted&&Ou(e)&&(R+=" is-active"),i.shifted&&"shift"in e)typeof e.shift=="string"?E=zc(e.shift):typeof e.shift=="object"&&(E=e.shift.label?e.shift.label:(a=zc(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=zc(e.latex||e.insert||"")||e.key)!=null?g:"",e.shift){let F;typeof e.shift=="string"?F=zc(e.shift):e.shift.label?F=e.shift.label:F=(b=zc(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 Il={"[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 D0(e){var i;if(typeof e=="string"){if(e==="[.]"&&window.MathfieldElement.decimalSeparator===","&&(e="[,]"),!Il[e])return{latex:e};e={label:e}}let r;return"label"in e&&e.label&&Il[e.label]&&(r=f(P(P({},Il[e.label]),e),{label:Il[e.label].label})),"key"in e&&e.key&&Il[e.key]&&(r=f(P(P({},Il[e.key]),e),{key:Il[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 Gc;function Om(e){var i;if(e.button!==0)return;const r=jo.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=Pu(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",If(g),{capture:!0,signal:b}),u.addEventListener("pointerleave",If(g),{capture:!0,signal:b}),u.addEventListener("pointercancel",If(g),{signal:b}),u.addEventListener("pointerup",If(g),{signal:b}),Ou(d)&&(u.classList.add("is-active"),r.shiftPressCount++),d.variants&&(Gc&&clearTimeout(Gc),Gc=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 If(e){return i=>{const r=Pu(i.target);if(!(r!=null&&r.id))return;const a=jo.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"),Ou(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"),Ou(u)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted));return}if(i.type==="pointerup"){Gc&&clearTimeout(Gc),Ou(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=jo.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 Pu(e){if(!e)return;let i=e;for(;i&&!Fm(i);)i=i.parentElement;return i!=null?i:void 0}function Ou(e){return!!e.class&&/(^|\s)shift($|\s)/.test(e.class)}var jo=class rm{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=C0();g&&!g.readOnly&&g.mathVirtualKeyboardPolicy==="auto"&&O()&&this.show({animate:!0})},300)}),document.addEventListener("focusout",u=>{u.target.mathVirtualKeyboardPolicy!=="manual"&&setTimeout(()=>{C0()||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=>L0(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 rm}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]=Rf(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}),Uc(),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(!_u(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=Iu(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:Cf,action:i},r)}));return}if(a)a.postMessage(P({type:Cf,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=Tm(this,i)}update(i){this._style=i.style,this.updateToolbar(i)}connect(){this.connectedMathfieldWindow=window}disconnect(){this.connectedMathfieldWindow=void 0}executeCommand(i){let r,a=[],u=Iu(i);return k(i)?(r=i[0],r==="performWithFeedback"&&(i=i.slice(1),u=Iu(i)),a=i.slice(1)):r=i,r=r.replace(/-\w/g,d=>d[1].toUpperCase()),u==="virtual-keyboard"?Na[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 C0(){var e,i;let r=gn(),a=null;for(;r;){if("host"in r&&((i=(e=r.host)==null?void 0:e.tagName)==null?void 0:i.toLowerCase())==="math-field"){a=r.host;break}r=r.parentNode}return a}if(C()&&!("mathVirtualKeyboard"in window))if(window===window.top){const e=jo.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e})}else Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>ym.singleton,configurable:!0});function Pf(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=jo.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>d})}u="manual"}i.mathVirtualKeyboardPolicy=u;break;case"letterShapeStyle":e.letterShapeStyle==="auto"?B.locale.startsWith("fr")?i.letterShapeStyle="french":i.letterShapeStyle="tex":i.letterShapeStyle=e.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(e.defaultMode)?i.defaultMode=e.defaultMode:(console.error('MathLive 0.98.5: valid values for defaultMode are "text", "math" or "inline-math"'),i.defaultMode="math");break;case"macros":i.macros=Le(e.macros);break;default:k(e[r])?i[r]=[...e[r]]:typeof e[r]=="object"&&!(e[r]instanceof Element)&&r!=="computeEngine"?i[r]=P({},e[r]):i[r]=e[r]}return i}function Pl(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 Of(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:Ke,backgroundColorMap:It,letterShapeStyle:B.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:Zh,inlineShortcuts:oo,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",virtualKeyboardTargetOrigin:window==null?void 0:window.origin,originValidator:"none",onInlineShortcut:()=>"",onScrollIntoView:null,onExport:md,value:""}}function M0(e){return e.defaultMode==="inline-math"?"math":e.defaultMode}function qo(e,i){!e||!i||(k(e)?e.forEach(r=>qo(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),qo(e.body,i),qo(e.above,i),qo(e.below,i),qo(e.subscript,i),qo(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=ml),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 ku(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)}qt(["math","displaymath"],Js),qt("center",Js),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 En("lines",e.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}]})}),vt("array","{columns:colspec}",(e,i,r,a)=>new En(e,Kd(i),r,{columns:a[0],mathstyleName:"textstyle"})),vt(["equation","equation*","subequations"],"",(e,i,r)=>new En(e,Kd(i),r,{columns:[{align:"c"}]})),vt(["multline","multline*"],"",Js),vt(["align","align*","aligned","eqnarray"],"",Js),vt("split","",Js),vt(["gather","gathered"],"",Js),vt(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",Js),vt(["smallmatrix","smallmatrix*"],"[columns:colspec]",Js),vt(["cases","dcases","rcases"],"",Js);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 ct({type:"first"}),new Bs]]):e.map(r=>r.length===0?[[new ct({type:"first"})]]:r.map(a=>a.length===0?[new ct({type:"first"})]:(a[0].type!=="first"&&a.unshift(new ct({type:"first"})),a)))}function Js(e,i=[[[]]],r=[],a=[]){switch(i=Kd(i,["split","align","align*","aligned","eqnarray"].includes(e)?2:1),e){case"math":return new En(e,i,r,{mathstyleName:"textstyle"});case"displaymath":return new En(e,i,r,{mathstyleName:"textstyle"});case"center":return new En(e,i,r,{columns:[{align:"c"}]});case"multline":case"multline*":return new En(e,i,r,{columns:[{align:"m"}],leftDelim:".",rightDelim:"."});case"split":return new En(e,i,r,{columns:[{align:"r"},{align:"l"}],minColumns:2});case"gather":case"gathered":return new En(e,i,r,{columns:[{gap:.25},{align:"c"},{gap:0}]});case"pmatrix":case"pmatrix*":return new En(e,i,r,{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:Ol(a[0])});case"bmatrix":case"bmatrix*":return new En(e,i,r,{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:Ol(a[0])});case"Bmatrix":case"Bmatrix*":return new En(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:Ol(a[0])});case"vmatrix":case"vmatrix*":return new En(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:Ol(a[0])});case"Vmatrix":case"Vmatrix*":return new En(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:Ol(a[0])});case"matrix":case"matrix*":return new En(e,i,r,{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:Ol(a==null?void 0:a[0])});case"smallmatrix":case"smallmatrix*":return new En(e,i,r,{mathstyleName:"scriptstyle",columns:Ol(a==null?void 0:a[0]),colSeparationType:"small",arraystretch:.5});case"cases":case"dcases":return new En(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 En(e,i,r,{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:[{align:"l"},{gap:1},{align:"l"}]});case"lines":return new En(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 En(e,i,r,{arraycolsep:0,columns:d,minColumns:2})}}return new En(e,i,r,{mathstyleName:"textstyle"})}function Ol(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 En);)r=r.parent;if(r&&r.type==="array"&&r.environmentName,!r||!(r.parent instanceof En)){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=Nf()),u.length===0&&(u=Nf());let g;return i.endsWith("column")?(g=Js("split",[[d,u]]),e.root=g,Fl(g,0,0)?Bl(e,g,0,0):Fl(g,0,1)?Bl(e,g,0,1):e.position=e.offsetOf(a)):(g=Js("lines",[[d],[u]]),e.root=g,Fl(g,0,0)?Bl(e,g,0,0):Fl(g,1,0)?Bl(e,g,1,0):e.position=e.offsetOf(a)),[void 0,[0,0]]}if(r.parent instanceof Wn){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=Nf()),d.length===0&&(d=Nf());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=Js(b,i.endsWith("column")?[[g,d]]:[[g],[d]]);return u.parent.addChildBefore(R,u),u.parent.removeChild(u),Fl(R,0,0)?Bl(e,R,0,0):i.endsWith("column")?Fl(R,0,1)?Bl(e,R,0,1):e.position=e.offsetOf(r):Fl(R,1,0)?Bl(e,R,1,0):e.position=e.offsetOf(r),[void 0,[0,0]]}}return r&&r.parent instanceof En?[r.parent,r.parentBranch]:[void 0,[0,0]]}function Fl(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 Bl(e,i,r,a){const u=Um(e,i,r,a);typeof u!="number"&&e.setSelection(u)}function Ff(e,i,r,a,u){const d=i.getCell(r,a);d&&e.setPositionHandlingPlaceholder(e.offsetOf(d[u==="start"?0:d.length-1]))}function Bf(e,i){const[r,[a,u]]=Km(e,i);if(r)switch(i){case"after row":r.addRowAfter(a),Ff(e,r,a+1,0,"end");break;case"after column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnAfter(u),Ff(e,r,a,u+1,"end");break;case"before row":r.addRowBefore(a),Ff(e,r,a,0,"start");break;case"before column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnBefore(u),Ff(e,r,a,u,"start");break}}function R0(e){return e.contentWillChange({inputType:"insertText"})?(Bf(e,"after row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function zm(e){return e.contentWillChange({inputType:"insertText"})?(Bf(e,"before row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function I0(e){return e.contentWillChange({inputType:"insertText"})?(Bf(e,"after column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function Vm(e){return e.contentWillChange({inputType:"insertText"})?(Bf(e,"before column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function P0(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 O0(e,i){let r=e.at(e.position);for(;r&&!(Array.isArray(r.parentBranch)&&r.parent instanceof En);)r=r.parent;if(Array.isArray(r==null?void 0:r.parentBranch)&&(r==null?void 0:r.parent)instanceof En){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"})?(O0(e,"row"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}function Hm(e){return e.contentWillChange({inputType:"deleteContent"})?(O0(e,"column"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}Rs({addRowAfter:R0,addColumnAfter:I0,addRowBefore:zm,addColumnBefore:Vm,removeRow:Gm,removeColumn:Hm,setEnvironment:P0},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});function Nf(){return[new Bs]}var F0=class sm{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>sm.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=i!=null?i:"",!0):!1}};F0.maximumDepth=1e3;var Wm=F0;function Ud(e,i,r){if(e.at(i).mode!=="text")return i;const a=r==="backward"?-1:1;let u;if(Xe.test(e.at(i).value)){let d=i,g;do g=e.at(d).mode==="text"&&Xe.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 Fu(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 bl)Y=Ud(e,Y,i);else if(F instanceof Mr)if(F.isSuggestion)for(console.assert(i==="forward");F&&F instanceof Mr;)F.isSuggestion=!1,Y=e.offsetOf(F),F=F.rightSibling;else if(i==="forward"){if(F=F.rightSibling,!F||!(F instanceof Mr))return e.announce("plonk"),!1;for(;F&&F instanceof Mr&&/[a-zA-Z\*]/.test(F.value);)Y=e.offsetOf(F),F=F.rightSibling}else{if(F=F.leftSibling,!F||!(F instanceof Mr))return e.announce("plonk"),!1;for(;F&&F instanceof Mr&&/[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 $a(e,i,r){var a,u;if(r=r!=null?r:{extend:!1},e.mathfield.adoptStyle=i==="backward"?"right":"left",i!=="forward"){const[b,x]=vo(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=$f(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=$a(e,i);return e.mathfield.stopCoalescingUndo(),b}let d=e.position;const g=d;if(e.collapseSelection(i)?(d=e.position,B0(e,d)||(d=$f(e,d,i))):d=$f(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 $f(e,i,r){return i=i+(r==="forward"?1:-1),i<0||i>e.lastOffset||B0(e,i)?i:$f(e,i,r)}function B0(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=ef(e.getHTMLElement(i[u])).right,g=Math.abs(r-d);if(g<=a)a=g;else break}return i[u-1]}function Kf(e,i,r,a,u){const d=e.mathfield.hasEditablePrompts,g=d?r.filter(E=>E.type==="prompt"&&!E.captureSelection):r,b=ef(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 En);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof En){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();Kf(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();Kf(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 En);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof En){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();Kf(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();Kf(e,g,x,u,"down")}else return d();return!0}function N0(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 $0(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 Ll({style:r.computedStyle}),r),r=r.rightSibling),r.createBranch("superscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(r.superscript[0]))),!0}function K0(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 Ll({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(!C()||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 C()?e(document.body):[]}function fs(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"?fs(e,[i.leftSibling,i]):fs(e,[i,i.leftSibling])}function va(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 Uf(e,i,r=!0){var a,u;const d=i==="forward"?1:-1;e.at(e.anchor).type==="placeholder"&&$a(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 va(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)}Rs({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?K0(e):$0(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=>N0(e),moveToNextChar:e=>$a(e,"forward"),moveToPreviousChar:e=>$a(e,"backward"),moveUp:e=>$a(e,"upward"),moveDown:e=>$a(e,"downward"),moveToNextWord:e=>Fu(e,"forward"),moveToPreviousWord:e=>Fu(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 Uf(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 fs(e,[Y,oe])}if(d.rightSibling.mode==="text"){let Y=d;for(;Y&&Y.mode==="text";)Y=Y.rightSibling;return Y?(va(e,(r=Y.leftSibling)!=null?r:Y),e.mathfield.switchMode("math"),!0):va(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 va(e,E);const R=U0(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 fs(e,[(a=R.leftSibling)!=null?a:R,(u=Y.leftSibling)!=null?u:Y])}return fs(e,R)}const F=d.parent;if(F){if(F.type==="leftright"||F.type==="surd")return fs(e,F);if(d.parentBranch==="superscript"&&F.subscript)return fs(e,F.subscript);if(d.parentBranch==="above"&&F.below)return fs(e,F.below);if(d.parentBranch==="superscript"||d.parentBranch==="subscript")return va(e,F);if(d.parentBranch==="above"||d.parentBranch==="below")return fs(e,F)}return va(e,e.lastOffset)},moveToPreviousGroup:e=>{var i;if(e.position===0&&e.anchor===0)return Uf(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 fs(e,[b,x])}for(;r&&r.mode==="text";)r=r.leftSibling;return r?va(e,r):va(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 va(e,g);if(a==="math"){const b=U0(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 fs(e,[b,E])}return fs(e,b)}const x=r.parent;if(x){if(x.type==="leftright"||x.type==="surd")return fs(e,x);if(r.parentBranch==="subscript"&&x.superscript)return fs(e,x.superscript);if(r.parentBranch==="below"&&x.above)return fs(e,x.above);if(r.parentBranch==="superscript"||r.parentBranch==="subscript")return va(e,x);if(r.parentBranch==="above"||r.parentBranch==="below")return fs(e,x)}return va(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:$0,moveToSubscript:K0},{target:"model",changeSelection:!0}),Rs({moveToNextPlaceholder:e=>Uf(e,"forward"),moveToPreviousPlaceholder:e=>Uf(e,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"});function U0(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 zf(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 Nl(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(ct.serialize([g],{defaultMode:"math"})),g.mode="math"),a-=1,i-=1}Vd(e),e.contentDidChange({data:Qi(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||!kn(r))return!1;const u=Sr(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)&&Nl(a,1),!0;const g={")":"(","}":"{","]":"["}[u],{parent:b}=a.at(a.position);if(g&&b instanceof Wn&&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 Nl(a,1),!1;if(/\D\.[^\d\s]$/.test(d)){Nl(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 Nl(a,1),!0;if(/\([a-z][,;]$/.test(d))return Nl(a,2),!0;if(/[\d+\-=><*|]$/.test(u))return Vd(a),!0}else{if(i==="[Space]")return zf(a,void 0,g=>/[a-z][:,;.]$/.test(g.value)),!0;if(/[a-zA-Z]{3,}$/.test(d)&&!/(dxd|abc|xyz|uvw)$/.test(d))return zf(a,void 0,g=>/[a-zA-Z]/.test(g.value)),!0;if(/(^|\W)(if)$/i.test(d))return zf(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 zf(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=z0(),a=e.element.getBoundingClientRect();r.style.left=`${a.left}px`,r.style.top=`${a.top-64}px`,r.innerHTML=window.MathfieldElement.createHTML("<span>"+(Ni(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=z0();i.innerHTML=""}else{const i=Fa("mathlive-keystroke-caption-panel");i.style.visibility="hidden"}return!1}function z0(){const e=document.getElementById("mathlive-keystroke-caption-panel");return e||(Ys("keystroke-caption"),Ys("core"),Fa("mathlive-keystroke-caption-panel"))}function ng(){document.getElementById("mathlive-keystroke-caption-panel")&&(Cu("mathlive-keystroke-caption-panel"),Ca("core"),Ca("keystroke-caption"))}function V0(e,i){var r,a,u;const{model:d}=e,g=hs(i);if(i.isTrusted){ui(i);const oe=Jt();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(!kn(i))e.flushInlineShortcutBuffer();else{const oe=Sr(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=mu(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=Id(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 Bn.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 Bn.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===","&&Sr(i)===","&&(x="insertDecimalSeparator")}}if(!b&&!x){if(d.mathfield.smartFence){if(Hd(d,Sr(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 Wn&&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:Sr(i),inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1;if(!d.selectionIsCollapsed){const ge=Sr(i);if(ge==="("||ge==="{"||ge==="["){const He={"(":"(","{":"\\lbrace","[":"\\lbrack"}[ge],Ot={"(":")","{":"\\rbrace","[":"\\rbrack"}[ge],[Ve,Et]=Hn(d.selection);return e.snapshot(),d.position=Et,Bn.insert(d,Ot,{format:"latex"}),d.position=Ve,Bn.insert(d,He,{format:"latex"}),d.setSelection(Ve+1,Et+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="",pr(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)Bn.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"},()=>(Bn.insert(d,b,{format:"latex",style:oe}),Vd(e.model),b.endsWith(" ")&&(e.switchMode("text"),Bn.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=ad(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)V0(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(Hn(a.selection)),e.snapshot("delete")),a.mode==="latex")a.deferNotifications({content:!0,selection:!0,data:i,type:"insertText"},()=>{Xs(e);for(const x of u)Bn.insert(a,x);e.snapshot("insert-latex"),Wo(e)});else if(a.mode==="text"){for(const x of u)Bn.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),Bn.insert(u,i,{style:r}),e.snapshot(),N0(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))}Bn.insert(u,i,{style:r}),e.snapshot(`insert-${u.at(u.position).type}`)}function ag(e){e.selectionIsCollapsed||(e.deleteAtoms(Hn(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=kl[d],b=Ko[d];if(!e.selectionIsCollapsed){e.mathfield.snapshot();const[x,E]=Hn(e.selection),R=e.extractAtoms([x,E]),F=u.addChildrenAfter([new Wn("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 Wn?u.leftDelim+u.rightDelim:"";if(x==="\\lbrace\\rbrace"||x==="\\{\\}"||x==="\\lbrace?")return e.mathfield.snapshot(),Bn.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 Wn&&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 Wn)){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 Wn("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 Wn&&(F.leftDelim==="?"||F.leftDelim===".")&&G0(d,F.rightDelim))break}const R=e.at(E);if(E<=x&&R instanceof Wn){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 Wn&&(u.leftDelim==="?"||u.leftDelim===".")&&G0(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 Wn&&u.leftDelim==="|")){if(e.mathfield.snapshot(),Bn.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 Wn("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 Wn&&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 Wn&&(oe.rightDelim==="?"||oe.rightDelim===".")&&Wd(oe.leftDelim,d))break}const F=e.at(R);if(R>=E&&F instanceof Wn)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 Wn&&(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 Wn&&(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):Ko[e]===i:!0}function G0(e,i){return i?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e):kl[i]===e:!0}Rs({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}}),Rs({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"}),Rs({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})&&(Wo(e),e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),pr(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}Rs({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]=Hn(e.selection);if(i=H0(e,i,"backward"),r=H0(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 H0(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"||!Xe.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}Rs({selectGroup:e=>{const i=qd(e);return i||e.announce("plonk"),i},selectAll:e=>e.setSelection(0,e.lastOffset),extendSelectionForward:e=>$a(e,"forward",{extend:!0}),extendSelectionBackward:e=>$a(e,"backward",{extend:!0}),extendToNextWord:e=>Fu(e,"forward",{extend:!0}),extendToPreviousWord:e=>Fu(e,"backward",{extend:!0}),extendSelectionUpward:e=>$a(e,"upward",{extend:!0}),extendSelectionDownward:e=>$a(e,"downward",{extend:!0}),extendToNextBoundary:e=>Fu(e,"forward",{extend:!0}),extendToPreviousBoundary:e=>Fu(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 $l=null,Hc=0,Vf=class ea{static start(i,r,a,u){var d;ea.element=i,(d=ea.controller)==null||d.abort(),ea.controller=new AbortController;const g={signal:ea.controller.signal};"PointerEvent"in window?(i.addEventListener("pointermove",a,g),i.addEventListener("pointerup",u,g),i.addEventListener("pointercancel",u,g),Zd(r)&&(ea.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=ea.controller)==null||i.abort(),ea.controller=void 0,typeof ea.pointerId=="number"&&(ea.element.releasePointerCapture(ea.pointerId),ea.pointerId=void 0)}};function Zd(e){return e!==null&&globalThis.PointerEvent!==void 0&&e instanceof PointerEvent}function W0(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(){Vf.stop(),d=!1,clearInterval(ge),e.element.classList.remove("tracking"),i&&i.preventDefault()}function Ot(Et){if(!a.hasFocus()){He();return}const Kt=Et.clientX,Tt=Et.clientY,ai=Zd(Et)&&Et.pointerType==="touch"?20:5;if(Date.now()<Y+500&&Math.abs(R-Kt)<ai&&Math.abs(F-Tt)<ai){Et.preventDefault(),Et.stopPropagation();return}const bi=oe.getBoundingClientRect();E=Kt>bi.right,x=Kt<bi.left;let hi=u;Zd(Et)&&(Et.isPrimary||(hi=Wc(a,Et.clientX,Et.clientY,{bias:0})));const fn=Wc(a,Kt,Tt,{bias:Kt<=R?Kt===R?0:-1:1});hi>=0&&fn>=0&&(a.model.extendSelectionTo(hi,fn),pr(e)),g&&qd(a.model)}$l&&Math.abs($l.x-R)<5&&Math.abs($l.y-F)<5&&Date.now()<$l.time+500?(Hc+=1,$l.time=Y):($l={x:R,y:F,time:Y},Hc=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=Wc(e,R,F,{bias:0}),u>=0){if(e.element.classList.add("tracking"),i.shiftKey){const Et=e.model.selectionIsCollapsed;e.model.extendSelectionTo(e.model.anchor,u),Ml(e.model)||Et?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,Ml(e.model)?b="all":b="selection");e.defaultStyle={},i.detail===3||Hc>2?(He(),(i.detail===3||Hc===3)&&(e.model.selection={ranges:[[0,e.model.lastOffset]]},b="all")):d||(d=!0,Vf.start(oe,i,Ot,He),(i.detail===2||Hc===2)&&(g=!0,qd(e.model),b="all"))}e.hasFocus()||(b="none",e.focus({preventScroll:!0}))}else $l=null;e.stopCoalescingUndo(),b!=="none"&&(e.model.selectionIsCollapsed&&(b="all"),pr(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 j0(e,i,r,a,u){if(!r.id)return[1/0,null];if(i.has(r.id))return i.get(r.id);const d=El(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=j0(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]=j0(e,new Map,e.model.root,i,r);return a}function Wc(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=El(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 Bn{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=Pa(d),{model:b}=e;b.selectionIsCollapsed||b.deleteAtoms(Hn(b.selection));const x=b.at(b.position);if(x.parent instanceof En){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"}),pr(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]=Ac(r),a==="auto"&&d&&(a="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r,{format:a})&&(e.startRecording(),e.snapshot("paste"),pr(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(Hn(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=Kt=>(R=!0,x[Kt]);let[Y,oe]=q0(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]=q0(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 Wn&&He.leftDelim==="("&&Ot){const Kt=He.parent,Tt=He.parentBranch;Kt.removeChild(He),Kt.setChildren(oe,Tt)}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 Et=oe[oe.length-1];if(r.selectionMode==="placeholder"){const Kt=oe.flatMap(Tt=>[Tt,...Tt.children]).find(Tt=>Tt.type==="placeholder");if(Kt){const Tt=e.offsetOf(Kt);e.setSelection(Tt-1,Tt),e.announce("move")}else Et&&(e.position=e.offsetOf(Et))}else r.selectionMode==="before"||(r.selectionMode==="after"?Et&&(e.position=e.offsetOf(Et)):r.selectionMode==="item"&&e.setSelection(e.anchor,e.offsetOf(Et)));return e.contentDidChange({data:d,inputType:"insertText"}),e.silenceNotifications=g,!0}};function q0(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=Xr(i,{context:e.mathfield.context})}else typeof i=="string"&&a.format==="ascii-math"?([d,i]=Fo(i,{format:"ascii-math",inlineShortcuts:e.mathfield.options.inlineShortcuts}),g=Xr(i,{context:e.mathfield.context}),d!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&Gf(g)):(a.format==="auto"||(u=a.format)!=null&&u.startsWith("latex"))&&(a.format==="auto"&&([d,i]=Fo(i,{format:"auto",inlineShortcuts:e.mathfield.options.inlineShortcuts})),a.format==="latex"&&([,i]=Ac(i)),g=Xr(i,{context:e.mathfield.context,args:r}),a.format!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&Gf(g));return qo(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 Wn&&i.leftDelim==="("&&i.rightDelim===")"?i.removeBranch("body"):null}function Gf(e){if(e){for(let i=0;e[i];i++){const r=e[i];if(r instanceof Wn&&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)){Gf(i.branch(r));const a=hg(i.branch(r));a&&i.setChildren(a,r)}if(i instanceof En)for(const r of i.cells)Gf(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=kl[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||Z0(i));)i=i.leftSibling;else{const u=[];for(;!i.isFirstSibling&&(Z0(i)||u.length>0);)i.type==="mclose"&&u.unshift(i.value),i.type==="mopen"&&u.length>0&&i.value===kl[u[0]]&&u.shift(),i=i.leftSibling}return r===i?-1:e.offsetOf(i)}function Z0(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 Bn{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"),pr(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(Hn(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(qo(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 "),Xr(e,{context:i,parseMode:"text"})}new dg;function Ka(e){return{value:e.model.getValue(),selectionIsCollapsed:e.model.selectionIsCollapsed,canUndo:e.canUndo(),canRedo:e.canRedo(),style:e.selectionStyle,mode:e.model.mode}}var Qn=4,ws=20,Ar=2*(ws+Qn),Hf=(e,i)=>`
|
|
|
<line x1="${e+ws}" y1="${i+ws}"
|
|
|
x2="${e>i?e+ws:7*ws+10*Qn}"
|
|
|
y2="${e<i?i+ws:7*ws+10*Qn}"/>
|
|
|
<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>`,Y0=(e,i)=>`
|
|
|
<line x1="${e+ws}" y1="${i+ws}"
|
|
|
x2="${e>i?e+ws:7*ws+10*Qn}"
|
|
|
y2="${e<i?i+ws:7*ws+10*Qn}"/>
|
|
|
<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>`,Wf=(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*ws+10*Qn+5} ${8*ws+10*Qn+5}">
|
|
|
<rect
|
|
|
class="MLEP__array-insert-background rows"
|
|
|
x="0"
|
|
|
y="${Ar+Qn}"
|
|
|
height="${3*Ar}"
|
|
|
width="${Ar}"
|
|
|
rx="${Ar/2}"/>
|
|
|
<rect
|
|
|
class="MLEP__array-insert-background columns"
|
|
|
x="${Ar+Qn}"
|
|
|
y="0"
|
|
|
height="${Ar}"
|
|
|
width="${3*Ar}"
|
|
|
rx="${Ar/2}"/>
|
|
|
<g data-command='"moveDown"'>
|
|
|
${Wf(2*(Qn+Ar),2*Qn+3*Ar,0)}
|
|
|
</g>
|
|
|
<g data-command='"moveUp"'>
|
|
|
${Wf(2*(Qn+Ar),2*Qn+Ar,180)}
|
|
|
</g>
|
|
|
<g data-command='"moveToNextWord"'>
|
|
|
${Wf(2*Qn+3*Ar,2*(Qn+Ar),-90)}
|
|
|
</g>
|
|
|
<g data-command='"moveToPreviousWord"'>
|
|
|
${Wf(2*Qn+Ar,2*(Qn+Ar),90)}
|
|
|
</g>
|
|
|
<g>
|
|
|
|
|
|
<g data-command='"addColumnBefore"'>
|
|
|
${Hf(2*Qn+Ar,Qn)}
|
|
|
</g>
|
|
|
<g data-command='"removeColumn"'>
|
|
|
${Y0(2*Qn+2*Ar,Qn)}
|
|
|
</g>
|
|
|
<g data-command='"addColumnAfter"'>
|
|
|
${Hf(2*Qn+3*Ar,Qn)}
|
|
|
</g>
|
|
|
<g data-command='"addRowBefore"'>
|
|
|
${Hf(Qn,2*Qn+Ar)}
|
|
|
</g>
|
|
|
<g data-command='"removeRow"'>
|
|
|
${Y0(Qn,2*Qn+2*Ar)}
|
|
|
</g>
|
|
|
<g data-command='"addRowAfter"'>
|
|
|
${Hf(Qn,2*Qn+3*Ar)}
|
|
|
</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>`,X0=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:X0,vmatrix:yg,Vmatrix:bg},Xd={cases:xg,rcases:wg,Bmatrix:X0};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=Fa("mathlive-environment-popover"),Ys("environment-popover"),Ys("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(hf(R)){const ge=kg(R);E=Yd[ge]("active");const He=Yd,{[ge]:Ot}=He,Ve=I(He,[ie(ge)]);x=Object.values(Ve).map(Et=>Et("inactive"))}else if(ff(R)){const ge=Tg(R);E=Xd[ge]("active");const He=Xd,{[ge]:Ot}=He,Ve=I(He,[ie(ge)]);x=Object.values(Ve).map(Et=>Et("inactive"))}else kd(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")&&(Cu("mathlive-environment-popover"),Ca("environment-popover"),Ca("core"))}function jf(e){if(!e.hasFocus())return;let i=!1;if(e.model.mode==="math"){const r=e.model.parentEnvironment;if(r!=null&&r.array&&cf(r.environmentName)){const a=e.options.environmentPopoverPolicy;i=a==="auto"||a==="on"}}i?Sg(e):Jd()}function kg(e){return e.replace("*","")}function Tg(e){return e==="dcases"?"cases":e}function J0(e){const i=getComputedStyle(e).direction;return i==="ltr"||i==="rtl"?i:"ltr"}function Q0(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 Ag(e,i,r,a){return r==="middle"?e-i/2:r==="start"&&a==="ltr"||r==="end"&&a==="rtl"||r==="top"||r==="right"?e:e-i}function Lg(e,i){var r,a,u;const d=(r=J0(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=Ag(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 Bu(e){return"submenu"in e}function Ua(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 ep={};function i0(e){let i=ep[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,ep[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 tp=80,ip=class{constructor(e,i){this._element=null;var r;this.parentMenu=i,this._declaration=e,Bu(e)?(this.type="submenu",this.submenu=new np(e.submenu,{parentMenu:i,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=(r=e.type)!=null?r:"command",this.hasCheck=Ua(e)&&e.checked!==void 0}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var e,i;(e=this._abortController)==null||e.abort(),this._abortController=void 0,(i=this._element)==null||i.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var e;return(e=this._label)!=null?e:""}set label(e){e===void 0&&(e=""),e!==this._label&&(this._label=e,this.dirty=!0)}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.dirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.element&&(e?this.element.removeAttribute("aria-disabled"):this.element.setAttribute("aria-disabled","true")),this.dirty=!0}get checked(){return this._checked}set checked(e){this._checked=e,this.dirty=!0}get tooltip(){return this._tooltip}set tooltip(e){e!==this._tooltip&&(this._tooltip=e,this.dirty=!0)}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){e!==this._ariaLabel&&(this._ariaLabel=e,this.dirty=!0)}get active(){var e,i;return(i=(e=this.element)==null?void 0:e.classList.contains("active"))!=null?i:!1}set active(e){this.element&&this.element.classList.toggle("active",e)}updateState(e){var i,r,a;const u=this._declaration;if(e0(u)){this.enabled=!1,this.checked=!1;return}t0(u)&&(this.enabled=!1,this.checked=!1,this.visible=!0),Ua(u)&&(this.checked=Ua(u)&&((i=Nu(u.checked,e))!=null?i:!1)),(Ua(u)||Bu(u))&&(this.enabled=(r=Nu(u.enabled,e))!=null?r:!0,this.visible=(a=Nu(u.visible,e))!=null?a:!0,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),(Ua(u)||t0(u)||Bu(u))&&(this.label=Nu(u.label,e),this.tooltip=Nu(u.tooltip,e),this.ariaLabel=Nu(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),Ua(this._declaration)&&this._declaration.keyboardShortcut){const r=document.createElement("kbd");r.innerHTML=Ni(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,(Ua(this._declaration)||t0(this._declaration)||Bu(this._declaration))&&this._declaration.class&&(e.className=this._declaration.class),e.setAttribute("part","menu-item"),e.setAttribute("tabindex","-1"),this.hasCheck?e.setAttribute("role","menuitemcheckbox"):e.setAttribute("role","menuitem"),this.type==="submenu"&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"));const i=this.abortController.signal;return e.addEventListener("pointerenter",this,{signal:i}),e.addEventListener("pointerleave",this,{signal:i}),e.addEventListener("pointerup",this,{signal:i}),e.addEventListener("click",this,{signal:i}),this._element}dispatchSelect(){if(!Ua(this._declaration))return;const e=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(e)&&typeof this._declaration.onMenuSelect=="function"&&this._declaration.onMenuSelect({modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(e){var i;if(!(!this.visible||!this.enabled)){if(e.type==="click"){this.rootMenu.state==="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}if(e.type==="pointerenter"){const r=e;this.rootMenu.cancelDelayedOperation(),this.parentMenu.isSubmenuOpen&&((i=this.parentMenu.activeMenuItem)!=null&&i.movingTowardSubmenu(r))?this.rootMenu.scheduleOperation(()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()}):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0}));return}if(e.type==="pointerleave"){this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null);return}if(e.type==="pointerup"){this.rootMenu.state!=="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}}}select(){if(this.rootMenu.cancelDelayedOperation(),this.type==="submenu"){this.openSubmenu();return}this.active=!1,setTimeout(()=>{this.active=!0,setTimeout(()=>{this.rootMenu.hide(),this.dispatchSelect()},tp)},tp)}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=J0(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:Q0(r,"trailing",a),y:r.top-4},alternateLocation:{x:Q0(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 Nu(e,i){return e===void 0||typeof e!="function"?e:(i!=null||(i={alt:!1,control:!1,shift:!1,meta:!1}),e(i))}var np=class Wu{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 ip(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 Wu._collator||(Wu._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Wu._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=>Wu.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}},rp=class am extends np{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(sp),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(i){hn(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=jt(i)),i.stopImmediatePropagation()}handleKeydownEvent(i){var r,a,u;if(i.key==="Tab"||i.key==="Escape"){this.hide();return}this.isDynamic&&(this.modifiers=jt(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(jt(i));break;case"ArrowRight":if((b==null?void 0:b.type)==="submenu")b.select(jt(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(kn(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 Mn.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),Mn.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),Mn.state==="open"&&Mn.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,Mn.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(i){this.cancelDelayedOperation();const r=am.SUBMENU_DELAY;if(r<=0){i();return}this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,i()},r)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};rp.SUBMENU_DELAY=120;var Mg=rp;function sp(e){return e0(e)?!1:typeof e.label=="function"||typeof e.ariaLabel=="function"||typeof e.tooltip=="function"||(Ua(e)||Bu(e))&&(typeof e.enabled=="function"||typeof e.visible=="function")||Ua(e)&&typeof e.checked=="function"?!0:Bu(e)?e.submenu.some(sp):!1}var qf=class{};qf.DELAY=300,qf.MAX_DISTANCE=10;function Rg(e){return new Promise((i,r)=>{const a=ri(e);a||i(!1);let u=a;const d=setTimeout(()=>{g.abort(),i(Dg(u,a)<qf.MAX_DISTANCE)},qf.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=ri(E);R&&(u=R)}},{passive:!0,signal:b})})}function ap(e,i,r){return Xo(this,null,function*(){if(e.type==="contextmenu"){const a=e;if(r.show({target:i,location:ri(a),modifiers:jt(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:jt(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=ri(e);if(yield Rg(e))return r.state!=="closed"?!1:(r.show({target:i,location:u}),!0)}return!1})}var op={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(op),"{body:auto}",{createAtom:e=>new vu(f(P({},e),{body:Ie(e.args[0]),accentChar:op[e.command.slice(1)]}))}),Se(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:e=>{const i=bt(Ie(e.args[0]));return new vu(f(P({},e),{body:Ie(e.args[0]),svgAccent:e.command.slice(1)+(i.length>5?"4":["1","1","2","2","3","3"][i.length])}))}}),Se(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:e=>new vu(f(P({},e),{body:Ie(e.args[0]),svgAccent:"overarc"}))}),Se(["underarc","underparen"],"{body:auto}",{createAtom:e=>new Cs(f(P({},e),{body:Ie(e.args[0]),svgBelow:"underarc"}))}),Se("utilde","{body:auto}",{createAtom:e=>{const i=Ie(e.args[0]),r=bt(i),a="widetilde"+(r.length>5?"4":["1","1","2","2","3","3"][r.length]);return new Cs(f(P({},e),{body:i,svgBelow:a,boxType:gl(i)}))}}),Se("^","{:string}",{createAtom:e=>{var i;return new ct(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 ct(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 ct(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 ct(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 ct(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 ct(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 ct(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 ct(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 zo(e.command,Ie(a[2]),d,u)}}),Se("cancel","{body:auto}",{createAtom:e=>{var i;return new zo(e.command,Ie(e.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),Se("bcancel","{body:auto}",{createAtom:e=>{var i;return new zo(e.command,Ie(e.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),Se("xcancel","{body:auto}",{createAtom:e=>{var i;return new zo(e.command,Ie(e.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),Se(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:e=>{var i;return new Cs(f(P({},e),{body:Ie((i=e.args)==null?void 0:i[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:e.command.slice(1)}))}}),Se("overbrace","{:auto}",{createAtom:e=>new Cs(f(P({},e),{body:Ie(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:e.command.slice(1)}))}),Se(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:e=>new Cs(f(P({},e),{body:Ie(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:e.command.slice(1)}))}),Se(["underbrace"],"{:auto}",{createAtom:e=>new Cs(f(P({},e),{body:Ie(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:e.command.slice(1)}))}),Se(["xrightarrow","longrightarrow","xleftarrow","longleftarrow","xRightarrow","xLeftarrow","xleftharpoonup","xleftharpoondown","xrightharpoonup","xrightharpoondown","xlongequal","xtwoheadleftarrow","xtwoheadrightarrow","xleftrightarrow","longleftrightarrow","xLeftrightarrow","xrightleftharpoons","longrightleftharpoons","xleftrightharpoons","xhookleftarrow","xhookrightarrow","xmapsto","xtofrom","xleftrightarrows","longleftrightarrows","xRightleftharpoons","longRightleftharpoons","xLeftrightharpoons","longLeftrightharpoons"],"[:auto]{:auto}",{createAtom:e=>{var i,r,a,u,d;return new Cs(f(P({},e),{svgBody:e.command.slice(1),above:((r=Ie((i=e.args)==null?void 0:i[1]))==null?void 0:r.length)===0?void 0:Ie((a=e.args)==null?void 0:a[1]),below:(d=Ie((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 Ia(e.command.slice(1),f(P({},e),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),Se(["liminf","limsup"],"",{ifMode:"math",createAtom:e=>new Ia({"\\liminf":"lim inf","\\limsup":"lim sup"}[e.command],f(P({},e),{limits:"over-under",variant:"main"}))}),Se(["lim","mod"],"",{ifMode:"math",createAtom:e=>new Ia(e.command.slice(1),f(P({},e),{limits:"over-under",variant:"main"}))}),Se(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:e=>new Ia(e.command.slice(1),f(P({},e),{limits:"over-under",isFunction:!0,variant:"main"}))}),Se(["ang"],"{:math}",{ifMode:"math",createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`\\ang{${e.bodyToLatex(i)}}`,render:(e,i)=>{const r=e.createBox(i),a=r.caret;r.caret=void 0;const u=new $t("\xB0",{style:f(P({},e.style),{variant:"normal",variantStyle:"up"})});return new $t([r,u],{type:"inner",isSelected:e.isSelected,caret:a})}}),Se("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:e=>new wf(f(P({},e),{body:Ie(e.args[1]),index:e.args[0]?Ie(e.args[0]):void 0}))}),Se(["frac","dfrac","tfrac","cfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:e=>{const i=P({},e),r=e.command,a=e.args;switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":i.hasBarLine=!0;break;case"\\atopfrac":i.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i.hasBarLine=!1,i.leftDelim="(",i.rightDelim=")";break;case"\\cfrac":i.hasBarLine=!0,i.continuousFraction=!0;break;default:}switch(r){case"\\dfrac":case"\\dbinom":i.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":i.mathstyleName="textstyle";break;default:}return new Ma(a[0]?Ie(a[0]):[new Bs],a[1]?Ie(a[1]):[new Bs],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}`:Xn(e.command,r,a)}}),Se(["brace","brack"],"",{infix:!0,createAtom:e=>new Ma(Ie(e.args[0]),Ie(e.args[1]),f(P({},e),{hasBarLine:!1,leftDelim:e.command==="\\brace"?"\\lbrace":"\\lbrack",rightDelim:e.command==="\\brace"?"\\rbrace":"\\rbrack"})),serialize:(e,i)=>Qi([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 Ma(Ie(a[0]),Ie(a[1]),f(P({},e),{hasBarLine:e.command==="\\over",leftDelim:i,rightDelim:r}))},serialize:(e,i)=>Qi([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 Ma(Ie(a[0]),Ie(a[1]),f(P({},e),{leftDelim:(i=a[2])!=null?i:".",rightDelim:(r=a[3])!=null?r:".",hasBarLine:!1}))},serialize:(e,i)=>`${e.aboveToLatex(i)} ${e.command}${e.leftDelim}${e.rightDelim}${e.belowToLatex(i)}`}),Se("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:e=>new Ma(Ie(e.args[0]),Ie(e.args[1]),f(P({},e),{hasBarLine:!0,numerPrefix:"\u2202",denomPrefix:"\u2202"}))}),Se(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:e=>new Oc({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 Ia("\u222B",f(P({},e),{limits:"adjacent",variant:"main"}))});var lp={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(lp),"",{ifMode:"math",createAtom:e=>{const i=e.command,r=lp[i.slice(1)];return new Oc(r,f(P({},e),{limits:"adjacent",variant:{"\u22D2":"ams","\u22D3":"ams"}[r]}))}}),Se(["Re","Im"],"",{ifMode:"math",createAtom:e=>new Ia({"\\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 yf(f(P({},e),{delim:(i=e.args[0])!=null?i:"|",size:1}))}}),Se("the","{:value}",{createAtom:e=>new ct(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 $t(((r=wr(d))!=null?r:"").split("").map(g=>new $t(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=wr(e.args[0]))!=null?i:"\\relax"}`}}),Se("mathtip","{:auto}{:math}",{createAtom:e=>new Lu(f(P({},e),{body:Ie(e.args[0]),tooltip:Ie(e.args[1]),content:"math"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${ct.serialize([e.tooltip],f(P({},i),{defaultMode:"math"}))}}`}),Se("texttip","{:auto}{:text}",{createAtom:e=>new Lu(f(P({},e),{body:Ie(e.args[0]),tooltip:Ie(e.args[1]),content:"text"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${ct.serialize([e.tooltip],f(P({},i),{defaultMode:"text"}))}}`}),Se("error","{:math}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`\\error{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__error"})}),Se("ensuremath","{:math}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(f(P({},i),{defaultMode:"math"}))}}`}),Se("color","{:value}",{applyStyle:(e,i,r)=>{var a,u;return{verbatimColor:(a=wr(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=wr(i[0]))!=null?a:void 0,color:r.toColor((u=i[0])!=null?u:{string:"red"})}}}),Se("boxed","{content:math}",{createAtom:e=>new _a(f(P({},e),{body:Ie(e.args[0]),framecolor:{string:"black"}}))}),Se("colorbox","{:value}{:text*}",{applyStyle:(e,i,r)=>{var a,u;return{verbatimBackgroundColor:(a=wr(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 _a(f(P({},e),{body:Ie(e.args[2]),framecolor:(i=e.args[0])!=null?i:{string:"blue"},backgroundcolor:(r=e.args[1])!=null?r:{string:"yellow"}}))},serialize:(e,i)=>{var r,a;return i.skipStyles?e.bodyToLatex(f(P({},i),{defaultMode:"text"})):Xn(e.command,(r=wr(e.framecolor))!=null?r:"",(a=wr(e.backgroundcolor))!=null?a:"",e.bodyToLatex(f(P({},i),{defaultMode:"text"})))}}),Se("bbox","[:bbox]{body:auto}",{createAtom:e=>{var i;const r=e.args[0],a=Ie(e.args[1]);return r?new _a(f(P({},e),{body:a,padding:r.padding,border:r.border,backgroundcolor:(i=r.backgroundcolor)!=null?i:void 0})):new _a(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=wr(e.padding))!=null?r:""),e.border&&d.push(`border: ${e.border}`),e.backgroundcolor&&d.push((a=wr(e.backgroundcolor))!=null?a:""),u+=`[${d.join(",")}]`}return Xn(u,e.bodyToLatex(i))}}),Se(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[0])})),render:(e,i)=>{const r=new ln({parent:i,mathstyle:e.command.slice(1)},e.style),a=ct.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):`{${Qi([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 ct(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__boldsymbol"})}),Se("bold","{:math*}",{applyMode:"math",applyStyle:()=>({variantStyle:"bold"})}),Se("bfseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),Se("mdseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),Se("upshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),Se("slshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),Se("scshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),Se("textbf","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),Se("textmd","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),Se("textup","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),Se("textnormal","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n",fontSeries:"m"})}),Se("textsl","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),Se("textit","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"it"})}),Se("textsc","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),Se("textrm","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"roman"})}),Se("textsf","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"sans-serif"})}),Se("texttt","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"monospace"})}),Se("mathbf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"bold"})}),Se("mathit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"italic"})}),Se("mathnormal","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"italic"})}),Se("mathbfit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"bolditalic"})}),Se("mathrm","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"up"})}),Se("mathsf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"sans-serif",variantStyle:"up"})}),Se("mathtt","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"monospace",variantStyle:"up"})}),Se("it","{:rest}",{applyStyle:()=>({fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})}),Se("rmfamily","",{applyStyle:()=>({fontFamily:"roman"})}),Se("sffamily","",{applyStyle:()=>({fontFamily:"sans-serif"})}),Se("ttfamily","",{applyStyle:()=>({fontFamily:"monospace"})}),Se(["Bbb","mathbb"],"{:math*}",{applyStyle:()=>({variant:"double-struck",variantStyle:"up"})}),Se(["frak","mathfrak"],"{:math*}",{applyStyle:()=>({variant:"fraktur",variantStyle:"up"})}),Se("mathcal","{:math*}",{applyStyle:()=>({variant:"calligraphic",variantStyle:"up"})}),Se("mathscr","{:math*}",{applyStyle:()=>({variant:"script",variantStyle:"up"})}),Se("mbox","{:text}",{ifMode:"math",createAtom:e=>new ct(f(P({},e),{type:"mord",body:Ie(e.args[0]),mode:"math"})),serialize:(e,i)=>Xn("\\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 ct(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>!e.args[0]||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`,render:(e,i)=>{var r;return e.createBox(i,{classes:(r=e.args[0])!=null?r:""})}}),Se(["cssId","htmlId"],"{id:string}{content:auto}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.cssId=(r=e.args[0])!=null?r:"",a}}),Se("htmlData","{data:string}{content:auto}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`\\htmlData{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.htmlData=(r=e.args[0])!=null?r:"",a}}),Se(["style","htmlStyle"],"{data:string}{content:auto}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.htmlStyle=(r=e.args[0])!=null?r:"",a}}),Se("em","{:rest}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{\\em ${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})}),Se("emph","{:auto}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\emph{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})});var up={"\\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 bf(f(P({},e),{delim:(i=e.args[0])!=null?i:".",size:up[e.command].size,delimType:up[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 ct(e),render:(e,i)=>{let r=0;const a=i.mathstyle.id;(a===fu||a===Aa)&&(r=1),(a===La||a===bs)&&(r=2),(a===fa||a===Fr)&&(r=3);const u=Ie(e.args[r]);return ct.createBox(i,u)},serialize:(e,i)=>`\\mathchoice{${ct.serialize(e.args[0],i)}}{${ct.serialize(e.args[1],i)}}{${ct.serialize(e.args[2],i)}}{${ct.serialize(e.args[3],i)}}`}),Se("mathop","{:auto}",{createAtom:e=>new ct(f(P({},e),{type:"mop",body:Ie(e.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(e,i)=>{var r;let a=ct.createBox(i,e.body);if(e.superscript||e.subscript){const u=(r=e.subsupPlacement)!=null?r:"auto";a=u==="over-under"||u==="auto"&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return new $t(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[Xn(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)),Qi(r)}}),Se(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:e=>new ct(f(P({},e),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[e.command],body:Ie(e.args[0])}))}),Se(["operatorname","operatorname*"],"{operator:math}",{createAtom:e=>{const i=Ie(e.args[0]).map(r=>{var a;return r.type!=="first"&&(r.type="mord",r.value=(a={"\u2217":"*","\u2212":"-"}[r.value])!=null?a:r.value,r.isFunction=!1,!r.style.variant&&!r.style.variantStyle&&(r.style.variant="main",r.style.variantStyle="up")),r});return new ct(f(P({},e),{type:"mop",body:i,isFunction:!0,limits:e.command==="\\operatorname"?"adjacent":"over-under"}))},render:(e,i)=>{var r;let a=ct.createBox(i,e.body);if(e.superscript||e.subscript){const u=(r=e.subsupPlacement)!=null?r:"auto";a=u==="over-under"||u==="auto"&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return e.caret&&(a.caret=e.caret),new $t(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[Xn(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)),Qi(r)}}),Se(["char","unicode"],"{charcode:value}",{createAtom:e=>new ct(f(P({},e),{type:e.mode==="text"?"text":"mord"})),serialize:e=>{var i;return`${e.command}${wr((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 ct(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 $t(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]?`[${wr(e.args[0])}]`:""}{${wr(e.args[1])}}{${wr(e.args[2])}}`}),Se(["overline","underline"],"{:auto}",{createAtom:e=>new ct(f(P({},e),{body:Ie(e.args[0])})),render:(e,i)=>{const r=e.command.substring(1),a=new ln({parent:i,mathstyle:"cramp"},e.style),u=ct.createBox(a,e.body);if(!u)return null;const d=a.metrics.defaultRuleThickness/a.scalingFactor,g=new $t(null,{classes:r+"-line"});g.height=d,g.maxFontSize=d*1.125*a.scalingFactor;let b;return r==="overline"?b=new xr({shift:0,children:[{box:u},3*d,{box:g},d]}):b=new xr({top:u.height,children:[d,{box:g},3*d,{box:u}]}),e.caret&&(b.caret=e.caret),new $t(b,{classes:r,type:"ignore"})}}),Se("overset","{:auto}{base:auto}",{createAtom:e=>{const i=Ie(e.args[1]);return new Cs(f(P({},e),{above:Ie(e.args[0]),body:i,skipBoundary:!1,boxType:gl(i)}))},serialize:(e,i)=>Xn(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),Se("underset","{:auto}{base:auto}",{createAtom:e=>{const i=Ie(e.args[1]);return new Cs(f(P({},e),{below:Ie(e.args[0]),body:i,skipBoundary:!1,boxType:gl(i)}))},serialize:(e,i)=>Xn(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),Se("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:e=>{const i=Ie(e.args[2]);return new Cs(f(P({},e),{above:Ie(e.args[0]),below:Ie(e.args[1]),body:i,skipBoundary:!1,boxType:gl(i)}))},serialize:(e,i)=>Xn(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),Se(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:e=>new Cs(f(P({},e),{body:Ie(e.args[2]),above:Ie(e.args[1]),below:Ie(e.args[0]),skipBoundary:!1,boxType:e.command==="\\stackrel"?"rel":"bin"})),serialize:(e,i)=>Xn(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),Se("smash","[:string]{:auto}",{createAtom:e=>{var i,r,a,u;return new Vo(f(P({},e),{body:Ie(e.args[1]),smashHeight:(r=(i=e.args[0])==null?void 0:i.includes("t"))!=null?r:!0,smashDepth:(u=(a=e.args[0])==null?void 0:a.includes("b"))!=null?u:!0}))}}),Se(["vphantom"],"{:auto}",{createAtom:e=>new Vo(f(P({},e),{body:Ie(e.args[0]),isInvisible:!0,smashWidth:!0}))}),Se(["hphantom"],"{:auto}",{createAtom:e=>new Vo(f(P({},e),{body:Ie(e.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),Se(["phantom"],"{:auto}",{createAtom:e=>new Vo(f(P({},e),{body:Ie(e.args[0]),isInvisible:!0}))}),Se("not","{:math}",{createAtom:e=>{const i=Ie(e.args[0]);return i.length===0?new ct(f(P({},e),{type:"mrel",value:"\uE020"})):new ct(f(P({},e),{body:[new mo(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{${ct.serialize(r.group,i)}}`:`\\not${ct.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":gl(Ie(e.args[0])),u=ct.createBox(i,e.body,{type:a});return e.caret&&(u.caret=e.caret),e.bind(i,u)}}),Se(["ne","neq"],"",{createAtom:e=>new ct(f(P({},e),{type:"mrel",body:[new mo(f(P({},e),{body:"\uE020",align:"right",boxType:"rel"})),new ct(f(P({},e),{value:"="}))],captureSelection:!0})),serialize:e=>e.command}),Se("rlap","{:auto}",{createAtom:e=>new mo(f(P({},e),{body:Ie(e.args[0]),align:"right"}))}),Se("llap","{:auto}",{createAtom:e=>new mo(f(P({},e),{body:Ie(e.args[0]),align:"left"}))}),Se("mathrlap","{:math}",{createAtom:e=>new mo(f(P({},e),{body:Ie(e.args[0]),align:"left"}))}),Se("mathllap","{:math}",{createAtom:e=>new mo(f(P({},e),{body:Ie(e.args[0]),align:"left"}))}),Se("raisebox","{:value}{:text}",{createAtom:e=>{var i;return new _a(f(P({},e),{body:Ie(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return Xn("\\raisebox",(r=wr(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),Se("raise","{:value}{:auto}",{createAtom:e=>{var i;return new _a(f(P({},e),{body:Ie(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return Xn("\\raise",(r=wr(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),Se("lower","{:value}{:auto}",{createAtom:e=>{var i;return new _a(f(P({},e),{body:Ie(e.args[1]),padding:{dimension:0},offset:(i=Zs(e.args[0],-1))!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r,a;return Xn("\\lower",(a=wr(Zs((r=e.offset)!=null?r:{dimension:0},-1)))!=null?a:"0pt",e.bodyToLatex(i))}}),Je("0123456789/@.?!"),q(65,90),q(97,122),Je([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),Je([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),Je([["\\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]]),Je([["\\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"),Je([["\\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"]]),Je([["\\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"]]),Je([["\\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"),Je([["+",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"),Je([["\\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"),Je([["\\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]]),Je([["=",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"),Je([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),Je([["\\wp",8472],["\\aleph",8501]]),Je([["\\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"),Je([["\\ ",160],["~",160]],"space"),Se(["!",",",":",";",">","enskip","enspace","quad","qquad"],"",{createAtom:e=>new Go(e)}),Se("space","",{createAtom:e=>new Go(e)}),Je([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),Je([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\mathellipsis",8230]],"minner"),Je([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var cp="<mo>⁡</mo>",Zf="<mo>⁢</mo>";function Yf(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 Et=(u=(a=Ve.style)==null?void 0:a.variant)!=null?u:"",Kt=(g=(d=Ve.style)==null?void 0:d.variantStyle)!=null?g:"";let Tt="";if(Et||Kt){const bi=ze(Ve.value,(b=Ve.style)==null?void 0:b.variant,(x=Ve.style)==null?void 0:x.variantStyle);if(bi!==Ve.value)return e.index+=1,He=`<mi${zn(Ve.id,r)}>${bi}</mi>`,bo(He,e,r)||(e.mathML+=He,e.lastType="mi"),!0;Tt=(E={upnormal:"normal",boldnormal:"bold",italicmain:"italic",bolditalicmain:"bold-italic","updouble-struck":"double-struck","double-struck":"double-struck",boldfraktur:"bold-fraktur",calligraphic:"script",upcalligraphic:"script",script:"script",boldscript:"bold-script",boldcalligraphic:"bold-script",fraktur:"fraktur","upsans-serif":"sans-serif","boldsans-serif":"bold-sans-serif","italicsans-serif":"sans-serif-italic","bolditalicsans-serif":"sans-serif-bold-italic",monospace:"monospace"}[Kt+Et])!=null?E:"",Tt=` mathvariant="${Tt}"`}const ai={"\\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(ai[Ve.command]){e.index+=1;let bi=`<mi${zn(Ve.id,r)}${Tt}>${ai[Ve.command]}</mi>`;return(e.lastType==="mi"||e.lastType==="mn"||e.lastType==="mtext"||e.lastType==="fence")&&(bi=Zf+bi),bo(bi,e,r)||(e.mathML+=bi,e.lastType="mi"),!0}if(Ve.command==="\\operatorname")Ot=$u(Ve.body),e.index+=1;else if(Et||Kt)for(;e.index<i&&(Ve.type==="mord"||Ve.type==="macro")&&!Ve.isDigit()&&Et===((F=(R=Ve.style)==null?void 0:R.variant)!=null?F:"")&&Kt===((oe=(Y=Ve.style)==null?void 0:Y.variantStyle)!=null?oe:"");)Ot+=$u([Ve]),e.index+=1,Ve=e.atoms[e.index];else(Ve.type==="mord"||Ve.type==="macro")&&!Ve.isDigit()&&(Ot+=$u([Ve]),e.index+=1);if(Ot.length>0){ge=!0,He=`<mi${Tt}>${Ot}</mi>`;const bi=e.lastType;He.endsWith(">f</mi>")||He.endsWith(">g</mi>")?(He+=cp,e.lastType="applyfunction"):e.lastType=/^<mo>(.*)<\/mo>$/.test(He)?"mo":"mi",bo(He,e,r)||((bi==="mi"||bi==="mn"||bi==="mtext"||bi==="fence")&&(He=Zf+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=An(u.superscript,r);i.lastType="";const b=An(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+=Kl(e.atoms[x],r),u+=An(e.atoms,r,x+1,E),u+=Kl(e.atoms[E],r),u+="</mrow>",e.index=E+1,(e.lastType==="mi"||e.lastType==="mn"||e.lastType==="mfrac"||e.lastType==="fence")&&(e.mathML+=Zf),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=Kl(g,r);return g.superscript&&g.subscript?(u+="<munderover>"+x,u+=An(g.subscript,r),u+=An(g.superscript,r),u+="</munderover>"):g.superscript?(u+="<mover>"+x,u+=An(g.superscript,r),u+="</mover>"):g.subscript&&(u+="<munder>"+x,u+=An(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)+">"+$u(x.value)+"</mi>":Kl(x,r);u+=R,!E&&!/^<mo>(.*)<\/mo>$/.test(R)?(u+=cp,d="applyfunction"):d=E?"mi":"mo"}(e.lastType==="mi"||e.lastType==="mn")&&!/^<mo>(.*)<\/mo>$/.test(u)&&(u=Zf+u),e.index+=1}return u.length>0&&(a=!0,bo(u,e,r)||(e.mathML+=u,e.lastType=d)),a}function An(e,i,r,a){i!=null||(i={});const u={atoms:[],index:r!=null?r:0,mathML:"",lastType:""};if(typeof e=="number"||typeof e=="boolean")u.mathML=e.toString();else if(typeof e=="string")u.mathML=e;else if(e instanceof ct)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 Kl(e,i){let r="";const a=$u(e.value);return a&&(r="<mo"+zn(e.id,i)+">"+a+"</mo>"),r}function $u(e){if(!e)return"";if(typeof e=="string")return Yf(e);if(!Array.isArray(e)&&typeof e.body=="string")return Yf(e.body);let i="";for(const r of e)typeof r.value=="string"&&(i+=r.value);return Yf(i)}function n0(e,i){var r,a,u,d,g,b,x,E,R,F,Y,oe,ge,He,Ot,Ve,Et,Kt,Tt,ai,bi,hi;if(e.mode==="text")return`<mi${zn(e.id,i)}>${e.value}</mi>`;const fn={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"},Nn={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let Ht="",$s="",Va,Qs,$r,Ks,Ss,Vn;const{command:vr}=e;if(e.command==="\\error")return`<merror${zn(e.id,i)}>${An(e.body,i)}</merror>`;const Kr={"\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"},Ga={"\\vec":"⃗","\\acute":"´","\\grave":"`","\\dot":"˙","\\ddot":"¨","\\tilde":"~","\\bar":"¯","\\breve":"˘","\\check":"ˇ","\\hat":"^"};switch(e.type){case"first":break;case"group":case"root":Ht=An(e.body,i);break;case"array":if((e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&(Ht+="<mrow>",e.leftDelim&&e.leftDelim!=="."&&(Ht+="<mo>"+(Kr[e.leftDelim]||e.leftDelim)+"</mo>")),Ht+="<mtable",e.colFormat){for(Ht+=' columnalign="',$r=0;$r<e.colFormat.length;$r++)e.colFormat[$r].align&&(Ht+={l:"left",c:"center",r:"right"}[e.colFormat[$r].align]+" ");Ht+='"'}for(Ht+=">",Qs=0;Qs<e.array.length;Qs++){for(Ht+="<mtr>",Va=0;Va<e.array[Qs].length;Va++)Ht+="<mtd>"+An(e.array[Qs][Va],i)+"</mtd>";Ht+="</mtr>"}Ht+="</mtable>",(e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&(e.rightDelim&&e.rightDelim!=="."&&(Ht+="<mo>"+(Kr[e.leftDelim]||e.rightDelim)+"</mo>"),Ht+="</mrow>");break;case"genfrac":(e.leftDelim||e.rightDelim)&&(Ht+="<mrow>"),e.leftDelim&&e.leftDelim!=="."&&(Ht+="<mo"+zn(e.id,i)+">"+(Kr[e.leftDelim]||e.leftDelim)+"</mo>"),e.hasBarLine?(Ht+="<mfrac>",Ht+=An(e.above,i)||"<mi> </mi>",Ht+=An(e.below,i)||"<mi> </mi>",Ht+="</mfrac>"):(Ht+="<mtable"+zn(e.id,i)+">",Ht+="<mtr>"+An(e.above,i)+"</mtr>",Ht+="<mtr>"+An(e.below,i)+"</mtr>",Ht+="</mtable>"),e.rightDelim&&e.rightDelim!=="."&&(Ht+="<mo"+zn(e.id,i)+">"+(Kr[e.rightDelim]||e.rightDelim)+"</mo>"),(e.leftDelim||e.rightDelim)&&(Ht+="</mrow>");break;case"surd":e.hasEmptyBranch("above")?(Ht+="<msqrt"+zn(e.id,i)+">",Ht+=An(e.body,i),Ht+="</msqrt>"):(Ht+="<mroot"+zn(e.id,i)+">",Ht+=An(e.body,i),Ht+=An(e.above,i),Ht+="</mroot>");break;case"leftright":const Ha=e,Wa=Ha.leftDelim;Ht="<mrow>",Wa&&Wa!=="."&&(Ht+=`<mo${zn(e.id,i)}>${(r=Kr[Wa])!=null?r:Wa}</mo>`),e.body&&(Ht+=An(e.body,i));const ja=Ha.matchingRightDelim();ja&&ja!=="."&&(Ht+=`<mo${zn(e.id,i)}>${(a=Kr[ja])!=null?a:ja}</mo>`),Ht+="</mrow>";break;case"sizeddelim":case"delim":Ht+=`<mo${zn(e.id,i)}>${Kr[e.value]||e.value}</mo>`;break;case"accent":Ht+='<mover accent="true"'+zn(e.id,i)+">",Ht+=An(e.body,i),Ht+="<mo>"+(Ga[vr]||e.accent)+"</mo>",Ht+="</mover>";break;case"line":case"overlap":break;case"overunder":Ss=e.above,Ks=e.below,(e.svgAbove||Ss)&&(e.svgBelow||Ks)?Vn=e.body:Ss&&Ss.length>0?(Vn=e.body,(d=(u=e.body)==null?void 0:u[0])!=null&&d.below?(Ks=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)&&(Ks=e.body[1].below,Vn=e.body[1].body)):Ks&&Ks.length>0&&(Vn=e.body,(F=(R=e.body)==null?void 0:R[0])!=null&&F.above?(Ss=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)&&(Ss=e.body[1].overscript,Vn=e.body[1].body)),(e.svgAbove||Ss)&&(e.svgBelow||Ks)?(Ht+=`<munderover ${zn(e.id,i)}>`,Ht+=(Ot=fn[e.svgBody])!=null?Ot:An(Vn,i),Ht+=(Ve=fn[e.svgBelow])!=null?Ve:An(Ks,i),Ht+=(Et=fn[e.svgAbove])!=null?Et:An(Ss,i),Ht+="</munderover>"):e.svgAbove||Ss?(Ht+=`<mover ${zn(e.id,i)}>`+((Kt=fn[e.svgBody])!=null?Kt:An(Vn,i)),Ht+=(Tt=fn[e.svgAbove])!=null?Tt:An(Ss,i),Ht+="</mover>"):(e.svgBelow||Ks)&&(Ht+=`<munder ${zn(e.id,i)}>`+((ai=fn[e.svgBody])!=null?ai:An(Vn,i)),Ht+=(bi=fn[e.svgBelow])!=null?bi:An(Ks,i),Ht+="</munder>");break;case"placeholder":Ht+="?";break;case"mord":{Ht=typeof e.value=="string"?e.value:vr,vr==="\\char"?Ht="&#x"+("000000"+e.args[0].number.toString(16)).slice(-4)+";":Ht.length>0&&Ht.startsWith("\\")&&(typeof e.value=="string"&&e.value.charCodeAt(0)>255?Ht="&#x"+("000000"+e.value.charCodeAt(0).toString(16)).slice(-4)+";":typeof e.value=="string"?Ht=e.value.charAt(0):(console.error("Did not expect this"),Ht=""));const ya=/\d/.test(Ht)?"mn":"mi";Ht=`<${ya}${zn(e.id,i)}>${Yf(Ht)}</${ya}>`;break}case"mbin":case"mrel":case"minner":Ht=Kl(e,i);break;case"mpunct":Ht='<mo separator="true"'+zn(e.id,i)+">"+vr+"</mo>";break;case"mop":case"operator":case"extensible-symbol":e.body!=="\u200B"&&(Ht="<mo"+zn(e.id,i)+">",Ht+=vr==="\\operatorname"?e.body:vr||e.body,Ht+="</mo>");break;case"box":Ht='<menclose notation="box"',e.backgroundcolor&&(Ht+=' mathbackground="'+e.backgroundcolor+'"'),Ht+=zn(e.id,i)+">"+An(e.body,i)+"</menclose>";break;case"spacing":Ht+='<mspace width="'+((hi=Nn[vr])!=null?hi:0)+'em"/>';break;case"enclose":Ht='<menclose notation="';for(const ya in e.notation)Object.prototype.hasOwnProperty.call(e.notation,ya)&&e.notation[ya]&&(Ht+=$s+ya,$s=" ");Ht+=zn(e.id,i)+'">'+An(e.body,i)+"</menclose>";break;case"prompt":Ht='<menclose notation="roundexbox""">'+An(e.body,i)+"</menclose>";break;case"space":Ht+=" ";break;case"subsup":break;case"phantom":break;case"composition":break;case"rule":break;case"chem":break;case"mopen":Ht+=Kl(e,i);break;case"mclose":Ht+=Kl(e,i);break;case"macro":{const ya=e.command+$u(e.macroArgs);ya&&(Ht+=`<mo ${zn(e.id,i)}>${ya}</mo>`)}break;case"latexgroup":Ht+=An(e.body,i);break;case"latex":Ht+="<mtext"+zn(e.id,i)+">"+e.value+"</mtext>";break;case"tooltip":Ht+=An(e.body,i);break;case"text":Ht+=`<mtext ${zn(e.id,i)}x>${e.value}</mtext>`;break;default:if(e.command==="\\displaystyle")return`<mrow ${zn(e.id,i)} displaystyle="true">${An(e.body,i)}</mrow>`;if(e.command==="\\textstyle")return`<mrow ${zn(e.id,i)} displaystyle="false">${An(e.body,i)}</mrow>`;console.info("Unexpected element in conversion to MathML:",e)}return Ht}var Ku={"\\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 hp(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 rn(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(rn(e,i[Y+1])),Y+=2):i[Y].mode==="text"?F?E+=(r=i[Y].value)!=null?r:" ":(F=!0,E+=rn("text",i[Y])):i[Y].isDigit()?R?E+=i[Y].asDigit():(R=!0,E+=rn(e,i[Y])):(R=!1,E+=rn(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 "+rn(e,i.body);case"\\acute":return rn(e,i.body)+" acute";case"\\grave":return rn(e,i.body)+" grave";case"\\dot":return"dot over"+rn(e,i.body);case"\\ddot":return"double dot over"+rn(e,i.body);case"\\mathring":return"ring over"+rn(e,i.body);case"\\tilde":case"\\widetilde":return"tilde over"+rn(e,i.body);case"\\bar":return rn(e,i.body)+" bar";case"\\breve":return rn(e,i.body)+" breve";case"\\check":case"\\widecheck":return"check over "+rn(e,i.body);case"\\hat":case"\\widehat":return"hat over"+rn(e,i.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+rn(e,i.body);case"\\underarc":case"\\underparen":return"arc under "+rn(e,i.body)}switch(i.type){case"prompt":const He=i.body.length>1?'start input . <break time="500ms"/> '+rn(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 Tt=0;Tt<Ot.length;Tt++){Tt>0&&(E+=","),E+=` row ${Tt+1} `;for(let ai=0;ai<Ot[Tt].length;ai++)ai>0&&(E+=","),E+=` column ${ai+1}: `,E+=rn("math",Ot[Tt][ai])}E+=` end ${r0[Ve]} `}break;case"group":ge==="\\ne"?E+=" not equal ":(ge==="\\not"&&(E+=" not "),E+=rn("math",i.body));break;case"root":E+=rn("math",i.body);break;case"genfrac":if(R=rn("math",i.above),F=rn("math",i.below),jc(i.above)&&jc(i.below)){const ai={"1/2":" half ","1/3":" one third ","2/3":" two third","1/4":" one quarter ","3/4":" three quarter ","1/5":" one fifth ","2/5":" two fifths ","3/5":" three fifths ","4/5":" four fifths ","1/6":" one sixth ","5/6":" five sixths ","1/8":" one eight ","3/8":" three eights ","5/8":" five eights ","7/8":" seven eights ","1/9":" one ninth ","2/9":" two ninths ","4/9":" four ninths ","5/9":" five ninths ","7/9":" seven ninths ","8/9":" eight ninths "}[hp(i.above)+"/"+hp(i.below)];ai?E=ai: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=rn("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 Tt=rn("math",i.above);Tt=Tt.trim();const ai=Tt.replace(/<mark([^/]*)\/>/g,"");ai==="3"?E+=' the cube root of <break time="200ms"/>'+Y+'. <break time="200ms"/> End cube root':ai==="n"?E+=' the nth root of <break time="200ms"/>'+Y+'. <break time="200ms"/> End root':E+=' the root with index: <break time="200ms"/>'+Tt+', of <break time="200ms"/>'+Y+'. <break time="200ms"/> End root'}break;case"leftright":{const Tt=i;E+=(u=Tt.leftDelim?Ku[Tt.leftDelim]:void 0)!=null?u:Tt.leftDelim,E+=rn("math",i.body),E+=(d=Tt.rightDelim?Ku[Tt.rightDelim]:void 0)!=null?d:Tt.rightDelim}break;case"rule":break;case"overunder":break;case"overlap":break;case"macro":const Et=ge.replace(/^\\/g,""),Kt=Wt()[Et];Kt&&(Kt!=null&&Kt.expand?E+=rn("math",i.body):E+=`${Et} `);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=rn(e,i.body);break}let Tt=i.isDigit()?i.asDigit():i.value,ai=i.command;if((i.type==="delim"||i.type==="sizeddelim")&&(ai=i.value,Tt=ai),e==="text")E+=Tt;else{if(i.type==="mbin"&&(E+='<break time="150ms"/>'),Tt){const bi=Ku[Tt]||(ai?Ku[ai.trim()]:"");if(bi)E+=" "+bi;else{const hi=ai?Kg(ai.trim()):"";E+=hi||b(Tt)}}else E+=rn("math",i.body);i.type==="mbin"&&(E+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if(i.value!=="\u200B"){const Tt=i.command;if(Tt==="\\sum")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let ai=rn("math",i.superscript);ai=ai.trim();let bi=rn("math",i.subscript);bi=bi.trim(),E+=' the summation from <break time="200ms"/>'+bi+'<break time="200ms"/> to <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(i.hasEmptyBranch("subscript"))E+=" the summation of";else{let ai=rn("math",i.subscript);ai=ai.trim(),E+=' the summation from <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(Tt==="\\prod")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let ai=rn("math",i.superscript);ai=ai.trim();let bi=rn("math",i.subscript);bi=bi.trim(),E+=' the product from <break time="200ms"/>'+bi+'<break time="200ms"/> to <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(i.hasEmptyBranch("subscript"))E+=" the product of ";else{let ai=rn("math",i.subscript);ai=ai.trim(),E+=' the product from <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(Tt==="\\int")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let ai=rn("math",i.superscript);ai=ai.trim();let bi=rn("math",i.subscript);bi=bi.trim(),E+=' the integral from <break time="200ms"/>'+x(bi)+'<break time="200ms"/> to <break time="200ms"/>'+x(ai)+' <break time="200ms"/> of ',oe=!0}else E+=' the integral of <break time="200ms"/> ';else if(typeof i.value=="string"){const ai=(g=Ku[i.value])!=null?g:i.command?Ku[i.command]:void 0;E+=ai||" "+i.value}else i.command&&(i.command==="\\mathop"?E+=rn("math",i.body):i.command==="\\operatorname"?E+=zg(i.body):E+=i.command.startsWith("\\")?" "+i.command.slice(1):" "+i.command)}break;case"enclose":Y=rn("math",i.body),E+=" crossed out "+Y+". End crossed out.";break;case"space":case"spacing":break}if(!oe&&!i.hasEmptyBranch("superscript")){let He=rn(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=rn("math",i.subscript);He=He.trim(),E+=jc(i.subscript)?" sub "+He:" subscript "+He+". End subscript. "}}return E}function Uu(e){var i,r;if(window.MathfieldElement.textToSpeechRules==="sre"&&("sre"in window||"SRE"in window)){const u=An(e);if(u){window.MathfieldElement.textToSpeechMarkup&&(window.MathfieldElement.textToSpeechRulesOptions=(i=window.MathfieldElement.textToSpeechRulesOptions)!=null?i:{},window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{markup:window.MathfieldElement.textToSpeechMarkup}),window.MathfieldElement.textToSpeechRulesOptions.markup==="ssml"&&(window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{markup:"ssml_step"})),window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{rate:window.MathfieldElement.speechEngineRate}));const 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=rn("math",e);if(window.MathfieldElement.textToSpeechMarkup==="ssml"){let u="";window.MathfieldElement.speechEngineRate&&(u='<prosody rate="'+window.MathfieldElement.speechEngineRate+'">'),a='<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>'+u+"<p><s>"+a+"</s></p>"+(u?"</prosody>":"")+"</amazon:auto-breaths></speak>"}else window.MathfieldElement.textToSpeechMarkup==="mac"&&H()==="macos"?a=a.replace(/<mark([^/]*)\/>/g,"").replace(/<emphasis>/g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(/<break time="(\d*)ms"\/>/g,"[[slc $1]]").replace(/<say-as[^>]*>/g,"").replace(/<\/say-as>/g,""):a=a.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return a}var 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"},Zc={"\\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 _r(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(_r).join("");if(e[0].mode==="text"){let Kt=0,Tt="";for(;((i=e[Kt])==null?void 0:i.mode)==="text";)Tt+=e[Kt].body?_r(e[Kt].body):e[Kt].value,Kt++;return`"${Tt}" ${_r(e.slice(Kt))}`}let Ve=0;const Et=[];for(;e[Ve]&&e[Ve].mode==="math";){let Kt="";for(;e[Ve]&&e[Ve].type==="mord"&&/\d/.test(e[Ve].value);)Kt+=e[Ve++].value;Kt?Et.push(Kt):Et.push(_r(e[Ve++]))}return Et.push(_r(e.slice(Ve))),Vg(Et)}if(e.mode==="text")return`"${e.value}"`;let ge="";const{command:He}=e;let Ot;if(He==="\\placeholder")return`(${_r(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:""} ${_r(e.body)} `;break;case"first":return"";case"latexgroup":return e.body.map(hi=>hi.value).join("");case"group":case"root":ge=(r=qc[He])!=null?r:_r(e.body);break;case"genfrac":{const hi=e;(hi.leftDelim||hi.rightDelim)&&(ge=hi.leftDelim==="."||!hi.leftDelim?"{:":hi.leftDelim),hi.hasBarLine?(ge+="(",ge+=_r(hi.above),ge+=")/(",ge+=_r(hi.below),ge+=")"):(ge+="("+_r(hi.above)+"),",ge+="("+_r(hi.below)+")"),(hi.leftDelim||hi.rightDelim)&&(ge+=hi.rightDelim==="."||!hi.rightDelim?"{:":hi.rightDelim)}break;case"surd":ge+=e.hasEmptyBranch("above")?"sqrt("+_r(e.body)+")":"root("+_r(e.above)+")("+_r(e.body)+")";break;case"latex":ge=e.value;break;case"leftright":{const hi=e,fn=hi.leftDelim;ge+=fn==="."||!fn?"{:":fn,ge+=_r(hi.body);const Nn=hi.matchingRightDelim();ge+=Nn==="."||!Nn?":}":Nn}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:Zc[He])!=null?g:e.value;break;case"mopen":case"mclose":ge=e.value;break;case"mpunct":ge=(b=Zc[He])!=null?b:He;break;case"mop":case"operator":case"extensible-symbol":e.value!=="\u200B"&&(Zc[He]?ge=Zc[He]:ge=He==="\\operatorname"?_r(e.body):(x=e.value)!=null?x:He,ge+=" ");break;case"array":const Et=e.array,Kt=e.environmentName,Tt=(E={bmatrix:["[","]"],"bmatrix*":["[","]"]}[Kt])!=null?E:["(",")"],ai=[];for(const hi of Et){const fn=[];for(const Nn of hi)fn.push(Tt[0]+_r(Nn)+Tt[1]);ai.push(fn.join(","))}const bi=(R={bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]}[Kt])!=null?R:["(",")"];ge=bi[0]+ai.join(",")+bi[1];break;case"box":break;case"spacing":ge=(F=qc[He])!=null?F:" ";break;case"enclose":ge="("+_r(e.body)+")";break;case"space":ge=" ";break;case"subsup":ge="";break;case"macro":ge=(oe=(Y=qc[He])!=null?Y:Zc[He])!=null?oe:_r(e.body);break}if(!e.hasEmptyBranch("subscript")){ge+="_";const Ve=_r(e.subscript);ge+=Ve.length!==1?`(${Ve})`:Ve}if(!e.hasEmptyBranch("superscript")){ge+="^";const Ve=_r(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 Nr(e,i){var r,a;i!=null||(i={}),i.mathstyle=(r=i.mathstyle)!=null?r:"displaystyle";const u=new ln({from:f(P({},kc()),{renderPlaceholder:()=>new $t(160,{maxFontSize:1}),letterShapeStyle:(a=i==null?void 0:i.letterShapeStyle)!=null?a:"tex"}),mathstyle:i.mathstyle}),g=new ct({mode:"math",type:"root",body:Xr(e,{context:u,parseMode:"math",mathstyle:i.mathstyle})}).render(u);return g?(uu(Cl(g,u)),vl(g,{classes:"ML__latex"}).toMarkup()):""}function P1(e){return vf(e,{context:kc()})}function Hg(e,i={}){return An(Xr(e,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),i)}function Wg(e){const i=Xr(e,{parseMode:"math",mathstyle:"displaystyle"});return Uu(i)}var Xf;function jg(e){var i,r;if(!Xf){const a=(i=globalThis[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:i.ComputeEngine;a?Xf=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=Xf==null?void 0:Xf.box(e).latex)!=null?r:""}function O1(e,i="math"){return _r(new ct({type:"root",body:Xr(e,{parseMode:i})}))}function F1(e){return Fo(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?fp(e):e}function zu(e){return e<0?0:e>255?255:Math.round(e)}function qg(e){if(!e||e[0]!=="#")return;e=e.slice(1);let i;return e.length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},e.length===4&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},e.length===8&&(i.a=parseInt(e[6]+e[7],16)/255)),i&&typeof i.a=="undefined"&&(i.a=1),i}function 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=zu(r*255),a=zu(a*255),u=zu(u*255),i!==void 0?{r,g:a,b:u,alpha:i}:{r,g:a,b:u}}function fp(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 fp(a0(e))}function dp(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(hi){return hi>=x?hi:hi+ba(x-hi,E)}function Ve(hi){return(hi<0?-1:1)*Math.pow(Math.abs(hi),2.4)}const Et=Ot(Ve(a.r/255)*.2126729+Ve(a.g/255)*.7151522+Ve(a.b/255)*.072175),Kt=Ot(Ve(r.r/255)*.2126729+Ve(r.g/255)*.7151522+Ve(r.b/255)*.072175);let Tt,ai,bi;return Math.abs(Kt-Et)<F?ai=0:Kt>Et?(Tt=ba(Kt,u)-ba(Et,d),ai=Tt*Y):(Tt=ba(Kt,b)-ba(Et,g),ai=Tt*ge),Math.abs(ai)<R?bi=0:ai>0?bi=ai-He:bi=ai+oe,bi*100}function pp(e,i,r){r!=null||(r="#fff"),i!=null||(i="#000");const a=dp(e,r),u=dp(e,i);return Math.abs(a)>Math.abs(u)?r:i}function Xg(e){const i=s0(e);let r=((1<<24)+(zu(i.r)<<16)+(zu(i.g)<<8)+zu(i.b)).toString(16).slice(1);return i.alpha!==void 0&&i.alpha<1&&(r+=("00"+Math.round(i.alpha*255).toString(16)).slice(-2)),r[0]===r[1]&&r[2]===r[3]&&r[4]===r[5]&&r[6]===r[7]&&(r=r[0]+r[2]+r[4]+(i.alpha!==void 0&&i.alpha<1?r[6]:"")),"#"+r}function rr(e){const i=mp(e);let r="";for(const a of i){if(typeof a.value!="string")return"";r+=a.value}return r}function mp(e){const r=e.model.selection.ranges;return r.length!==1?[]:e.model.getAtoms(r[0])}function Jg(e,i){const r=mp(e);if(r.length!==1)return!1;const a=Bc[i];return a?!!a.test(r[0].value):!1}function Qg(e,i){return rr(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:()=>Nr(`\\vec{${rr(e)}}`),visible:()=>rr(e).length===1,onMenuSelect:()=>e.insert("\\vec{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overrightarrow{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overleftarrow{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\dot{${rr(e)}}`),visible:()=>rr(e).length===1,onMenuSelect:()=>e.insert("\\dot{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\ddot{${rr(e)}}`),visible:()=>rr(e).length===1,onMenuSelect:()=>e.insert("\\ddot{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\bar{${rr(e)}}`),visible:()=>rr(e).length===1,onMenuSelect:()=>e.insert("\\bar{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overline{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\overline{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overgroup{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\overgroup{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\overbrace{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\overbrace{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\underline{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\underline{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\undergroup{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\undergroup{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\underbrace{${rr(e)}}`),visible:()=>rr(e).length>0,onMenuSelect:()=>e.insert("\\underbrace{#@}",{selectionMode:"item"})}]}function i1(e){return[{label:()=>Nr(`\\boxed{${e.getValue(e.model.selection)}}}`),onMenuSelect:()=>e.insert("\\boxed{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\bbox[5px, border: 2px solid red]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{label:()=>Nr(`\\bbox[5px, border: 2px dashed black]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}]}function n1(e){const i=[];for(const r of Object.keys(Te))i.push({class:(Xg(pp(Te[r]))==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${Te[r]} "></span>`,ariaLabel:()=>{var a;return(a=V(r))!=null?a:r},checked:()=>{var a;return{some:"mixed",all:!0}[(a=e.queryStyle({backgroundColor:r}))!=null?a:!1]},onMenuSelect:()=>{e.applyStyle({backgroundColor:r},{operation:"toggle"}),e.adoptStyle="none"}});return i}function r1(e){const i=[];for(const r of Object.keys(se))i.push({class:(pp(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 ip{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:()=>Ul(e)},{label:()=>V("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>e.executeCommand("addRowAfter"),visible:()=>Ul(e)},{label:()=>V("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>e.executeCommand("addColumnBefore"),visible:()=>Ul(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:()=>Ul(e)},{type:"divider"},{label:()=>V("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>e.executeCommand("removeRow"),visible:()=>Ul(e)},{label:()=>V("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>e.executeCommand("removeColumn"),visible:()=>Ul(e)},{type:"divider"},{label:()=>V("menu.borders"),visible:()=>(l1(e)||Ul(e))&&e.isSelectionEditable,submenu:[{label:" \u22F1 ",id:"environment-no-border",onMenuSelect:()=>Yc(e,"matrix")},{label:"(\u22F1)",id:"environment-parentheses",onMenuSelect:()=>Yc(e,"pmatrix")},{label:"[\u22F1]",id:"environment-brackets",onMenuSelect:()=>Yc(e,"bmatrix")},{label:"|\u22F1|",id:"environment-bar",onMenuSelect:()=>Yc(e,"vmatrix")},{label:"{\u22F1}",id:"environment-braces",onMenuSelect:()=>Yc(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:()=>{yo(e,"accept-all"),e.executeCommand(["switchMode","math"])},checked:()=>e.model.mode==="math"},{label:()=>V("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{yo(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&&rr(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",Nr(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:()=>Bn.copyToClipboard(e,"latex"),keyboardShortcut:"meta+C"},{label:()=>V("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>Bn.copyToClipboard(e,"ascii-math")},{label:()=>V("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>Bn.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 Ul(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 Yc(e,i){Xs(e),e.flushInlineShortcutBuffer(),P0(e.model,i),pr(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:()=>Nr(`\\${r}{${rr(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:()=>Nr(`\\${r}{${rr(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 Vu(e,i){return e+Uu(i)}Rs({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=Uu(x);return C()&&r.withHighlighting?(Yo().readAloudMathfield=e,Rl(e,{forHighlighting:!0}),window.MathfieldElement.readAloudHook&&window.MathfieldElement.readAloudHook(e.field,E)):window.MathfieldElement.speakHook&&window.MathfieldElement.speakHook(E),!1}function f1(e){var i,r;if(!C()){console.log("Speak:",e);return}if(!window.MathfieldElement.speechEngine||window.MathfieldElement.speechEngine==="local"){const a=new SpeechSynthesisUtterance(e);window.speechSynthesis.speak(a)}else if(window.MathfieldElement.speechEngine==="amazon")if(!("AWS"in window))console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else{const a=new window.AWS.Polly({apiVersion:"2016-06-10"}),u={OutputFormat:"mp3",VoiceId:(i=window.MathfieldElement.speechEngineVoice)!=null?i:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes((r=window.MathfieldElement.speechEngineVoice)!=null?r:"Joanna")?"neural":"standard",Text:e,TextType:"ssml"};a.synthesizeSpeech(u,(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 gp(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=Vu("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=Vu("",e.model.at(e.model.position));else if(i==="line"){const d=Vu("",e.model.root);e.keyboardDelegate.setAriaLabel(d)}else u=a?Vu(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 ${gp(u)};`,u=u.parent;return a}function m1(e){if(!e.selectionIsCollapsed)return Vu("",e.getAtoms(e.selection));let i="";const r=e.at(e.position),a=gp(r);return r.isFirstSibling&&(i=(a?"start of "+a:"unknown")+": "),r.isLastSibling?r.isFirstSibling||(i+=a?"end of "+a:"unknown"):i+=Vu("",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=Pa(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=Hn(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=ct.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 Mr&&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(ns(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(Br(e)){if(u=e,!Br(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];_p(this,R,g,b)&&x.push(R)}return a.includeChildren||(x=x.filter(E=>{let R=!1,{parent:F}=E;for(;F&&!R;)R=_p(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 ct({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 ct.serialize([e],{expandMacro:r==="latex-expanded",skipStyles:r==="latex-unstyled",skipPlaceholders:r==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode});if(r==="math-ml")return An(e);if(r==="spoken")return Uu(e);if(r==="spoken-text"){const a=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="";const u=Uu(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=Uu(e);return window.MathfieldElement.textToSpeechMarkup=a,u}return r==="ascii-math"?_r(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(Br(e)&&Br(i)?(a=[this.normalizeRange([e,i])],u=r):pa(e)?(a=[this.normalizeRange(e)],u=i):ns(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 Qi(a.map(g=>ct.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||Gh(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(Br(e)){const u=this.normalizeOffset(e);if(Br(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(pa(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 ns(e)&&(a={ranges:e.ranges.map(u=>this.normalizeRange(u)),direction:(r=e.direction)!=null?r:"none"});return console.assert(a!==void 0),a}get parentEnvironment(){let e=this.at(this.position).parent;if(e){for(;e.parent&&e.type!=="array";)e=e.parent;if(e.type==="array")return e}}get cell(){var e;let i=this.at(this.position);if(i){for(;i&&((e=i.parent)==null?void 0:e.type)!=="array";)i=i.parent;if(!(!(i!=null&&i.parent)||i.parent.type!=="array"))return i.parentBranch}}contentWillChange(e={}){if(this.silenceNotifications||!this.mathfield)return!0;const i=this.silenceNotifications;this.silenceNotifications=!0;const r=this.mathfield.onContentWillChange(e);return this.silenceNotifications=i,r}contentDidChange(e){var i;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this.mathfield)),this.silenceNotifications||!this.mathfield.host||!this.mathfield)return;const r=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.host.dispatchEvent(new InputEvent("input",f(P({},e),{data:e.data?e.data:(i=e.inputType)!=null?i:"",bubbles:!0,composed:!0}))),this.silenceNotifications=r}selectionDidChange(){if(!this.mathfield||(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this.mathfield)),this.silenceNotifications))return;const e=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.onSelectionDidChange(),this.silenceNotifications=e}};function _p(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 Xc(e,i,r,a){var u,d,g,b,x,E;const R=r.parent;if(R&&r instanceof Wn){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=Jc.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&&Xc(e,"backward",i))){if(i!=null&&i.isFirstSibling){if(Xc(e,"backward",i.parent,i.parentBranch))return;i=null}if(!i){e.announce("plonk");return}e.position=e.offsetOf(i.leftSibling),i.parent.removeChild(i),e.announce("delete",void 0,[i])}}):za(e,Hn(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&&Xc(e,"forward",a))return;if(a){if(e.at(e.position).isLastSibling&&Xc(e,"forward",a.parent,a.parentBranch))return}else{if(a=e.at(e.position),a.isLastSibling&&Xc(e,"forward",a.parent,a.parentBranch))return;a=void 0}if(e.position===e.lastOffset||!a){e.announce("plonk");return}a.parent.removeChild(a);let u=(i=e.at(e.position))==null?void 0:i.rightSibling;for(;(u==null?void 0:u.type)==="subsup";)u.parent.removeChild(u),u=(r=e.at(e.position))==null?void 0:r.rightSibling;e.announce("delete",void 0,[a])}):za(e,Hn(e.selection),"deleteContentForward")}function za(e,i,r){const a=e.getAtoms(i);if(a.length>0&&a[0].parent){let u=a[0].parent.firstChild;u.type==="first"&&(u=u.rightSibling);const 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))}Rs({deleteAll:e=>e.contentWillChange({inputType:"deleteContent"})&&za(e,[0,-1],"deleteContent"),deleteForward:e=>v1(e),deleteBackward:e=>_1(e),deleteNextWord:e=>e.contentWillChange({inputType:"deleteWordForward"})&&za(e,[e.anchor,Ud(e,e.position,"forward")],"deleteWordForward"),deletePreviousWord:e=>e.contentWillChange({inputType:"deleteWordBackward"})&&za(e,[e.anchor,Ud(e,e.position,"backward")],"deleteWordBackward"),deleteToGroupStart:e=>e.contentWillChange({inputType:"deleteSoftLineBackward"})&&za(e,[e.anchor,e.offsetOf(e.at(e.position).firstSibling)],"deleteSoftLineBackward"),deleteToGroupEnd:e=>e.contentWillChange({inputType:"deleteSoftLineForward"})&&za(e,[e.anchor,e.offsetOf(e.at(e.position).lastSibling)],"deleteSoftLineForward"),deleteToMathFieldStart:e=>e.contentWillChange({inputType:"deleteHardLineBackward"})&&za(e,[e.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:e=>e.contentWillChange({inputType:"deleteHardLineForward"})&&za(e,[e.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var y1=`<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${V("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`,b1=`<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${V("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,x1=class{constructor(e,i){this.focusBlurInProgress=!1;var r,a,u;this.options=P(f(P({},Of()),{macros:Wt(),registers:zh()}),Pf(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=M0(this.options),x=new ct({type:"root",mode:b,body:Xr(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(S0(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=B.subscribe(()=>B.update(this.element)),B.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(Ka(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=jt(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=xs(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(()=>pr(this)),this.resizeObserver.observe(this.field),window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle",this,{signal:d}),Rt&&!B.locale.startsWith(Rt.locale)&&Ui(B.locale),Ns!=="ready"&&document.fonts.ready.then(()=>Df(this)),e.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value")}get defaultStyle(){return this._defaultStyle}set defaultStyle(e){this._defaultStyle=e}get effectiveStyle(){if(this.adoptStyle==="none")return this.defaultStyle;const e=this.model.at(this.model.position),i=this.adoptStyle==="right"?e.rightSibling:e;if(!i)return this.defaultStyle;if(i.type==="group"){const r=i.branch("body");return!r||r.length<2?{}:this.adoptStyle==="right"?r[1].computedStyle:r[r.length-1].computedStyle}return i.computedStyle}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),jf(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:Sl(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:Ke(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:It(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=ct.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]=Jr(this.options.keybindings,(e=Jt())!=null?e:Hi());return((i=Jt())==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),Pf(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=ct.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==a)&&Bn.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)&&pr(this)}getOptions(e){return Pl(this.options,e)}getOption(e){return Pl(this.options,e)}handleEvent(e){return Xo(this,null,function*(){var i;if(uo(this)){if(Bd(e)){if(!_u(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(Iu(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"&&W0(this,e);break;case"pointerdown":this.userSelect!=="none"&&(W0(this,e),e.shiftKey===!1&&(yield ap(e,this.element.querySelector("[part=container]"),this._menu))&&Vf.stop());break;case"contextmenu":this.userSelect!=="none"&&e.shiftKey===!1&&(yield ap(e,this.element.querySelector("[part=container]"),this._menu))&&Vf.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&jf(this);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>uo(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>uo(this)&&this.onGeometryChange());break;case"wheel":this.onWheel(e);break;default:console.warn("Unexpected event type",e.type)}}})}dispose(){if(!uo(this))return;B.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 Iu(e)==="virtual-keyboard"?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame(()=>window.mathVirtualKeyboard.update(Ka(this))),!1):mm(this,e)}get errors(){return vf(this.model.getValue(),{context:this.context})}getValue(e,i,r){return this.model.getValue(e,i,r)}setValue(e,i){var r;i=i!=null?i:{mode:"math"},i.insertionMode===void 0&&(i.insertionMode="replaceAll"),(i.format===void 0||i.format==="auto")&&(i.format="latex"),(i.mode===void 0||i.mode==="auto")&&(i.mode=(r=pd(this.model,this.model.position))!=null?r:"math");const a=this.undoManager.canUndo();Bn.insert(this.model,e,i)&&(pr(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&&Rl(this,{interactive:!0});const i=this.field.getBoundingClientRect();let r=null;if(this.model.selectionIsCollapsed)r=Sl(this.field);else{const a=Qh(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&&J()&&navigator.vibrate(E0),window.MathfieldElement.playSound("keypress")),e==="\\\\"?R0(this.model):e==="&"?I0(this.model):this.model.selectionIsCollapsed?Bn.insert(this.model,e,P({style:this.model.at(this.model.position).computedStyle},i)):Bn.insert(this.model,e,i),this.snapshot(`insert-${this.model.at(this.model.position).type}`),pr(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=Xr(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;yo(this,"accept");let E,R=g.at(g.position);if(x)E="\\";else{const Y=Hn(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 Ra(E);R.parent.addChildAfter(F,R),x?g.position=g.offsetOf(F.lastChild):g.setSelection(g.offsetOf(F.firstChild),g.offsetOf(F.lastChild))}else as(g).forEach(x=>{x.isError=!1});if(r){const x=Xr(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 pr(this),this.undoManager.snapshot(e==="latex"?"insert-latex":"insert"),b}),this.model.mode=e,window.mathVirtualKeyboard.update(Ka(this))}hasFocus(){return!this.blurred}focus(e){var i;this.hasFocus()||(this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),this.onFocus(),this.model.announce("line")),(i=e==null?void 0:e.preventScroll)!=null&&i||this.scrollIntoView()}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(e,i={}){var r,a;const u={operation:"set",silenceNotifications:!1};pa(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})}),pr(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=Sl(this.field);return e?{x:e.x,y:e.y}:null}setCaretPoint(e,i){const r=Wc(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),pr(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()),pr(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),pr(this)}getPromptState(e){const i=this.getPrompt(e);return i?[i.correctness,i.locked]:(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[void 0,!0])}getPromptRange(e){const i=this.getPrompt(e);return i?this.model.getBranchRange(this.model.offsetOf(i),"body"):(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[0,0])}canUndo(){return this.undoManager.canUndo()}canRedo(){return this.undoManager.canRedo()}popUndoStack(){this.undoManager.pop()}snapshot(e){var i;this.undoManager.snapshot(e)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),(i=this.host)==null||i.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"snapshot"}})))}stopCoalescingUndo(){this.undoManager.stopCoalescing(this.model.selection)}stopRecording(){this.undoManager.stopRecording()}startRecording(){this.undoManager.startRecording()}undo(){var e;this.undoManager.undo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),(e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var e;this.undoManager.redo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),(e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}resetUndo(){var e;(e=this.undoManager)==null||e.reset()}onSelectionDidChange(){var e,i;const r=this.model;this.keyboardDelegate.setValue(r.getValue(this.model.selection,"latex-expanded"));{const a=r.at(r.position),u=(e=a.mode)!=null?e:M0(this.options);this.model.mode!==u&&(this.model.mode==="latex"?(yo(this,"accept",{mode:u}),r.position=r.offsetOf(a)):this.switchMode(u))}(i=this.host)==null||i.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),jf(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(),Rl(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="",Ru(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})),pr(this),this.focusBlurInProgress=!1,Jd();const a=new AbortController,u=a.signal;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&document.addEventListener("visibilitychange",()=>{uo(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 V0(this,e)}onCompositionStart(e){this.model.deleteAtoms(Hn(this.model.selection));const i=Sl(this.field);i&&requestAnimationFrame(()=>{Rl(this),this.keyboardDelegate.moveTo(i.x,i.y-i.height)})}onCompositionUpdate(e){Bm(this.model,e),pr(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(),Bn.onCopy(this,e),za(this.model,Hn(this.model.selection),"deleteByCut"),this.snapshot("cut"),pr(this))}onCopy(e){Bn.onCopy(this,e)}onPaste(e){let i=this.isSelectionEditable;return i&&(i=Bn.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(),Ba(this),jf(this)}onWheel(e){const i=5*e.deltaX;if(!Number.isFinite(i)||i===0)return;const r=this.field;i<0&&r.scrollLeft===0||i>0&&r.offsetWidth+r.scrollLeft>=r.scrollWidth||(r.scrollBy({top:0,left:i}),e.preventDefault(),e.stopPropagation())}getHTMLElement(e){let i=e;for(;!i.id&&i.hasChildren;)i=e.children[0];return this.field.querySelector(`[data-atom-id="${i.id}"]`)}get context(){var e,i;return{registers:(e=this.options.registers)!=null?e:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,placeholderSymbol:(i=this.options.placeholderSymbol)!=null?i:"\u25A2",colorMap:r=>this.colorMap(r),backgroundColorMap:r=>this.backgroundColorMap(r),getMacro:r=>rt(r,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};function vp(e){if(e&&(e.classList.remove("ML__highlight"),e.children))for(const i of e.children)vp(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(!C())return;if(window.MathfieldElement.speechEngine!=="amazon"){console.error("MathLive 0.98.5: Use Amazon TTS Engine for synchronized highlighting"),typeof window.MathfieldElement.speakHook=="function"&&window.MathfieldElement.speakHook(i);return}if(!window.AWS){console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");return}const a=new window.AWS.Polly({apiVersion:"2016-06-10"}),u={OutputFormat:"json",VoiceId:(r=window.MathfieldElement.speechEngineVoice)!=null?r:"Joanna",Engine:"standard",Text:i,TextType:"ssml",SpeechMarkTypes:["ssml"]};Yo().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));Yo().readAloudMarks=b.split(`
|
|
|
`).map(x=>x?JSON.parse(x):{}),Yo().readAloudTokens=[];for(const x of Yo().readAloudMarks)x.value&&Yo().readAloudTokens.push(x.value);Yo().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=Yo();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?(Rl(ge),oe.readAloudElement=null,oe.readAloudMathfield=null,oe.readAloudTokens=[],oe.readAloudMarks=[],oe.readAloudCurrentMark=""):vp(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()})})}C()||console.error('MathLive 0.98.5: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');var _n=new WeakMap,S1=.5,Zo={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 = ..."},Gr=class zl extends HTMLElement{static get formAssociated(){return Gu()}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 B.locale}static set locale(i){i==="auto"&&(i=navigator.language.slice(0,5)),B.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 B.strings}static set strings(i){B.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 Xo(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 w0(`${a}/${r}`))).arrayBuffer(),g=yield this.audioContext.decodeAudioData(d);this.audioBuffers[i]=g}catch(u){}})}static playSound(i){return Xo(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(Zo[a])if(Zo[a].startsWith("mf."))if(Zo[a].startsWith(`mf.${a}`))r.push(`Option \`${a}\` cannot be used as a constructor option. Use ${Zo[a]}`);else{const u=Zo[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 ${Zo[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(Gu()&&(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=[$o("core"),$o("mathfield"),$o("mathfield-element"),$o("ui"),$o("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>"+co("core")+co("mathfield")+co("mathfield-element")+co("ui")+co("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=zl.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?Pl(this._mathfield.options,i):_n.has(this)?P({},Pl(P(P({},Of()),Pf(_n.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?Pl(this._mathfield.options,i):_n.has(this)?Pl(P(P({},Of()),Pf(_n.get(this).options)),i):null}reflectAttributes(){const i=Of(),r=this._getOptions();Object.keys(zl.optionsAttributes).forEach(a=>{const u=xo(a);zl.optionsAttributes[a]==="on/off"?i[u]!==r[u]?this.setAttribute(a,r[u]?"on":"off"):this.removeAttribute(a):i[u]!==r[u]&&(zl.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(_n.has(this)){const r=P(P({},_n.get(this).options),i);_n.set(this,f(P({},_n.get(this)),{selection:{ranges:r.readOnly?[[0,0]]:[[0,-1]]},options:r}))}else _n.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))Zo[r]&&console.warn(`\`mf.setOptions({${r}:...})\` -> ${Zo[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(_n.has(this)){let g,b,x;if(ns(i)?([g,b]=i.ranges[0],x=r):pa(i)?([g,b]=i,x=r):Br(i)&&Br(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=_n.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(_n.has(this)){const u=_n.get(this).options;_n.set(this,{value:i,selection:{ranges:[[-1,-1]],direction:"forward"},options:u,menuItems:void 0});return}const a=Qc(this);_n.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?Wc(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=El(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;Mn.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),Gu()||(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=_n.get(this))==null?void 0:r.options)!=null?a:Qc(this)),{eventSink:this,value:E})),!_n.has(this)){this.upgradeProperty("disabled"),this.upgradeProperty("readonly");for(const R of Object.keys(zl.optionsAttributes))this.upgradeProperty(xo(R))}if(!((u=this._mathfield)!=null&&u.model)){this._mathfield=null;return}if(_n.has(this)){const R=this._mathfield,F=_n.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,_n.delete(this)}),Y&&(this.menuItems=Y)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),Lf()}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=Pl(this._mathfield.options,Object.keys(zl.optionsAttributes).map(u=>xo(u)));_n.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":pr(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",""),Gu()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(Gu()?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"),Gu()?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=_n.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}_n.has(this)?_n.set(this,f(P({},_n.get(this)),{menuItems:i})):_n.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:Qc(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:_n.has(this)?_n.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,pr(this._mathfield);return}if(_n.has(this)){_n.set(this,f(P({},_n.get(this)),{selection:i}));return}_n.set(this,{value:void 0,selection:i,options:Qc(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:_n.has(this)?_n.get(this).selection.ranges[0][0]:0}set position(i){if(this._mathfield&&(this._mathfield.model.position=i,pr(this._mathfield)),_n.has(this)){_n.set(this,f(P({},_n.get(this)),{selection:{ranges:[[i,i]]}}));return}_n.set(this,{value:void 0,selection:{ranges:[[i,i]]},options:Qc(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}};Gr.version="0.98.5",Gr._fontsDirectory="./fonts",Gr._soundsDirectory="./sounds",Gr.keypressVibration=!0,Gr._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},Gr._plonkSound="plonk.wav",Gr.audioBuffers={},Gr.createHTML=e=>e,Gr._speechEngineRate="100%",Gr._speechEngineVoice="Joanna",Gr._textToSpeechMarkup="",Gr._textToSpeechRules="mathlive",Gr._textToSpeechRulesOptions={},Gr.speakHook=f1,Gr.readAloudHook=w1,Gr._decimalSeparator=".",Gr.fractionNavigationOrder="numerator-denominator",Gr._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 Jc=Gr;function xo(e){return e.replace(/[^a-zA-Z\d]+(.)/g,(i,r)=>r.toUpperCase())}function Qc(e){const i={readOnly:!1},r=Jc.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 Gu(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var yp=Jc,bp,xp,wp,Sp;if(C()&&!((bp=window.customElements)!=null&&bp.get("math-field"))){(wp=window[xp=Symbol.for("io.cortexjs.mathlive")])!=null||(window[xp]={});const e=window[Symbol.for("io.cortexjs.mathlive")];e.version="0.98.5",window.MathfieldElement=Jc,(Sp=window.customElements)==null||Sp.define("math-field",Jc)}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 Jf(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]=Fo(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 Ep(e,i,r){let a=[{type:"text",data:e}];return i!=null&&i.inline&&i.inline.forEach(([u,d])=>{a=Jf(a,u,d,"textstyle")}),i!=null&&i.display&&i.display.forEach(([u,d])=>{a=Jf(a,u,d,"displaystyle")}),r!=null&&r.inline&&r.inline.forEach(([u,d])=>{a=Jf(a,u,d,"textstyle","ascii-math")}),r!=null&&r.display&&r.display.forEach(([u,d])=>{a=Jf(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 T1(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 Hu(e,i,r,a){var u;const d=T1(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 A1(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=Hu(e,"",i,!0);g&&d.appendChild(g)}else{if(!e.trim())return null;const g=Ep(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=Hu(b.data,b.mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);x&&d.appendChild(x)}}return d}function kp(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 Et=(r=e.childNodes[0].textContent)!=null?r:"";if((a=i.TeX)!=null&&a.processEnvironments&&/^\s*\\begin/.test(Et)){e.textContent="";const Tt=Hu(Et,"",i,!0);Tt&&e.append(Tt);return}const Kt=Ep(Et,(u=i.TeX)==null?void 0:u.delimiters,(d=i.asciiMath)==null?void 0:d.delimiters);if(Kt.length===1&&Kt[0].type==="math"){e.textContent="";const Tt=Hu(Kt[0].data,Kt[0].mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);Tt&&e.append(Tt);return}if(Kt.length===1&&Kt[0].type==="text")return}for(let Et=e.childNodes.length-1;Et>=0;Et--){const Kt=e.childNodes[Et];if(Kt.nodeType===3){const Tt=A1((g=Kt.textContent)!=null?g:"",i);Tt&&(Et+=Tt.childNodes.length-1,Kt.replaceWith(Tt))}else if(Kt.nodeType===1){const Tt=Kt,ai=Kt.nodeName.toLowerCase();if(ai==="script"){const bi=Kt;let hi;if((b=i.processScriptTypePattern)!=null&&b.test(bi.type))hi=(x=bi.textContent)!=null?x:"";else if((E=i.processMathJSONScriptTypePattern)!=null&&E.test(bi.type))try{hi=(F=i.serializeToLatex)==null?void 0:F.call(i,JSON.parse((R=bi.textContent)!=null?R:""))}catch(fn){console.error(fn)}if(hi){let fn="textstyle";for(const Ht of bi.type.split(";")){const[$s,Va]=Ht.toLowerCase().split("=");$s.trim()==="mode"&&(fn=Va.trim()==="display"?"displaystyle":"textstyle")}const Nn=Hu(hi,fn,i,!0);Nn&&bi.parentNode.replaceChild(Nn,bi)}}else if(((oe=(Y=i.processClassPattern)==null?void 0:Y.test(Tt.className))!=null?oe:!1)||!((He=(ge=i.skipTags)==null?void 0:ge.includes(ai))!=null&&He||(Ve=(Ot=i.ignoreClassPattern)==null?void 0:Ot.test(Tt.className))!=null&&Ve))if(e.childNodes.length===1&&e.childNodes[0].nodeType===3){const hi=e.textContent;e.textContent="";const fn=Hu(hi!=null?hi:"","displaystyle",i,!0);fn&&e.append(fn)}else kp(Tt,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:""),Lf(),Ys("core"),kp(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=jo.singleton;return r?(r.show(),Uc(),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}Rs({switchKeyboardLayer:C1,toggleVirtualKeyboard:M1,hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});function Yo(){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=Nr),(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"}}}]);
|
|
|
}()); |