@skillpet/circuit 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var Circuit=(()=>{var G1=Object.create;var sa=Object.defineProperty;var W1=Object.getOwnPropertyDescriptor;var V1=Object.getOwnPropertyNames;var U1=Object.getPrototypeOf,J1=Object.prototype.hasOwnProperty;var K1=(r,e,t)=>e in r?sa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Z1=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Q1=(r,e)=>()=>(r&&(e=r(r=0)),e);var $a=(r,e)=>{for(var t in e)sa(r,t,{get:e[t],enumerable:!0})},au=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of V1(e))!J1.call(r,s)&&s!==t&&sa(r,s,{get:()=>e[s],enumerable:!(n=W1(e,s))||n.enumerable});return r};var ed=(r,e,t)=>(t=r!=null?G1(U1(r)):{},au(e||!r||!r.__esModule?sa(t,"default",{value:r,enumerable:!0}):t,r)),td=r=>au(sa({},"__esModule",{value:!0}),r);var z=(r,e,t)=>K1(r,typeof e!="symbol"?e+"":e,t);var Vm={};$a(Vm,{ParseError:()=>J,SETTINGS_SCHEMA:()=>hl,__defineFunction:()=>ie,__defineMacro:()=>y,__defineSymbol:()=>u,__domTree:()=>Wm,__parse:()=>Hm,__renderToDomTree:()=>Al,__renderToHTMLTree:()=>Xm,__setFontMetrics:()=>Qu,default:()=>$p,render:()=>uc,renderToString:()=>qm,version:()=>Gm});function md(r){if("default"in r)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function xd(r){for(var e=0;e<Dh.length;e++)for(var t=Dh[e],n=0;n<t.blocks.length;n++){var s=t.blocks[n];if(r>=s[0]&&r<=s[1])return t.name}return null}function Vu(r){for(var e=0;e<ll.length;e+=2)if(r>=ll[e]&&r<=ll[e+1])return!0;return!1}function Cd(r){if(r instanceof Pt)return r;throw new Error("Expected symbolNode but got "+String(r)+".")}function Id(r){if(r instanceof kn)return r;throw new Error("Expected span<HtmlDomNode> but got "+String(r)+".")}function Qu(r,e){Pr[r]=e}function Qh(r,e,t){if(!Pr[e])throw new Error("Font metrics not found for font: "+e+".");var n=r.charCodeAt(0),s=Pr[e][n];if(!s&&r[0]in vu&&(n=vu[r[0]].charCodeAt(0),s=Pr[e][n]),!s&&t==="text"&&Vu(n)&&(s=Pr[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}function Dd(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Sh[e]){var t=Sh[e]={cssEmPerMu:Ja.quad[e]/18};for(var n in Ja)Ja.hasOwnProperty(n)&&(t[n]=Ja[n][e])}return Sh[e]}function u(r,e,t,n,s,i){Ge[r][s]={font:e,group:t,replace:n},i&&n&&(Ge[r][n]=Ge[r][s])}function ie(r){for(var{type:e,names:t,props:n,handler:s,htmlBuilder:i,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:s},l=0;l<t.length;++l)im[t[l]]=a;e&&(i&&(ml[e]=i),o&&(dl[e]=o))}function t0(r){var{type:e,htmlBuilder:t,mathmlBuilder:n}=r;ie({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:n})}function nl(r,e){var t=V(["base"],r,e),n=V(["strut"]);return n.style.height=Q(t.height+t.depth),t.depth&&(n.style.verticalAlign=Q(-t.depth)),t.children.unshift(n),t}function Yh(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var n=ct(r,e,"root"),s;n.length===2&&n[1].hasClass("tag")&&(s=n.pop());for(var i=[],o=[],a=0;a<n.length;a++)if(o.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("newline");)a++,o.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(i.push(nl(o,e)),o=[])}else n[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(nl(o,e)),o=[]),i.push(n[a]));o.length>0&&i.push(nl(o,e));var h;t?(h=nl(ct(t,e,!0),e),h.classes=["tag"],i.push(h)):s&&i.push(s);var c=V(["katex-html"],i);if(c.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=Q(c.height+c.depth),c.depth&&(m.style.verticalAlign=Q(-c.depth))}return c}function am(r){return new yn(r)}function zh(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof Qe&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof Qe&&t.text===","}else return!1}function Mu(r,e,t,n,s){var i=Ft(r,t),o;i.length===1&&i[0]instanceof K&&Kd.has(i[0].type)?o=i[0]:o=new K("mrow",i);var a=new K("annotation",[new Qe(e)]);a.setAttribute("encoding","application/x-tex");var l=new K("semantics",[o,a]),h=new K("math",[l]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&h.setAttribute("display","block");var c=s?"katex":"katex-mathml";return V([c],[h])}function Ee(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function kl(r){var e=Ml(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function Ml(r){return r&&(r.type==="atom"||Od.hasOwnProperty(r.type))?r:null}function mm(r,e){var t=ct(r.body,e,!0);return V([r.mclass],t,e)}function dm(r,e){var t,n=Ft(r.body,e);return r.mclass==="minner"?t=new K("mpadded",n):r.mclass==="mord"?r.isCharacterBox?(t=n[0],t.type="mi"):t=new K("mi",n):(r.isCharacterBox?(t=n[0],t.type="mo"):t=new K("mo",n),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}function lp(r,e,t){var n=op[r];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=t.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:n,mode:"math",family:"rel"},o=t.callFunction("\\Big",[i],[]),a=t.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[s,o,a]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function hp(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new J("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var n=[],s=[n],i=0;i<e.length;i++){for(var o=e[i],a=Pu(),l=0;l<o.length;l++)if(!Tu(o[l]))a.body.push(o[l]);else{n.push(a),l+=1;var h=kl(o[l]).text,c=new Array(2);if(c[0]={type:"ordgroup",mode:"math",body:[]},c[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(h))if("<>AV".includes(h))for(var m=0;m<2;m++){for(var f=!0,g=l+1;g<o.length;g++){if(ap(o[g],h)){f=!1,l=g;break}if(Tu(o[g]))throw new J("Missing a "+h+" character to complete a CD arrow.",o[g]);c[m].body.push(o[g])}if(f)throw new J("Missing a "+h+" character to complete a CD arrow.",o[l])}else throw new J('Expected one of "<>AV=|." after @',o[l]);var b=lp(h,c,r),x={type:"styling",body:[b],mode:"math",style:"display"};n.push(x),a=Pu()}i%2===0?n.push(a):n.shift(),n=[],s.push(n)}r.gullet.endGroup(),r.gullet.endGroup();var v=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}function El(r,e){var t=Ml(r);if(t&&vp.has(t.text))return t;throw t?new J("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new J("Invalid delimiter type '"+r.type+"'",r)}function Au(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}function Rr(r){for(var{type:e,names:t,props:n,handler:s,htmlBuilder:i,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l<t.length;++l)Em[t[l]]=a;i&&(ml[e]=i),o&&(dl[e]=o)}function y(r,e){Pm[r]=e}function _u(r){var e=[];r.consumeSpaces();var t=r.fetch().text;for(t==="\\relax"&&(r.consume(),r.consumeSpaces(),t=r.fetch().text);t==="\\hline"||t==="\\hdashline";)r.consume(),e.push(t==="\\hdashline"),r.consumeSpaces(),t=r.fetch().text;return e}function oc(r){if(!r.includes("ed"))return!r.includes("*")}function En(r,e,t){var{hskipBeforeAndAfter:n,addJot:s,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:h,emptySingleRow:c,maxNumCols:m,leqno:f}=e;if(r.gullet.beginGroup(),h||r.gullet.macros.set("\\cr","\\\\\\relax"),!o){var g=r.gullet.expandMacroAsText("\\arraystretch");if(g==null)o=1;else if(o=parseFloat(g),!o||o<0)throw new J("Invalid \\arraystretch: "+g)}r.gullet.beginGroup();var b=[],x=[b],v=[],S=[],k=l!=null?[]:void 0;function M(){l&&r.gullet.macros.set("\\@eqnsw","1",!0)}function _(){k&&(r.gullet.macros.get("\\df@tag")?(k.push(r.subparse([new Nt("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):k.push(!!l&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(M(),S.push(_u(r));;){var B=r.parseExpression(!1,h?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup();var $={type:"ordgroup",mode:r.mode,body:B};t&&($={type:"styling",mode:r.mode,style:t,body:[$]}),b.push($);var Y=r.fetch().text;if(Y==="&"){if(m&&b.length===m){if(h||a)throw new J("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(Y==="\\end"){_(),b.length===1&&$.type==="styling"&&$.body.length===1&&$.body[0].type==="ordgroup"&&$.body[0].body.length===0&&(x.length>1||!c)&&x.pop(),S.length<x.length+1&&S.push([]);break}else if(Y==="\\\\"){r.consume();var Z=void 0;r.gullet.future().text!==" "&&(Z=r.parseSizeGroup(!0)),v.push(Z?Z.value:null),_(),S.push(_u(r)),b=[],x.push(b),M()}else throw new J("Expected & or \\\\ or \\cr or \\end",r.nextToken)}return r.gullet.endGroup(),r.gullet.endGroup(),{type:"array",mode:r.mode,addJot:s,arraystretch:o,body:x,cols:i,rowGaps:v,hskipBeforeAndAfter:n,hLinesBeforeRow:S,colSeparationType:a,tags:k,leqno:f}}function ac(r){return r.slice(0,1)==="d"?"display":"text"}function Dm(r,e,t){for(var n=ct(r,e,!1),s=e.sizeMultiplier/t.sizeMultiplier,i=0;i<n.length;i++){var o=n[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(n[i].classes,e.sizingClasses(t)):n[i].classes[o+1]==="reset-size"+e.size&&(n[i].classes[o+1]="reset-size"+t.size),n[i].height*=s,n[i].depth*=s}return tn(n)}var J,ad,Kh,ld,hd,bt,al,cd,Qr,ud,hl,pa,zr,Zh,cl,x0,Zr,fa,Wt,v0,Et,Er,dd,pd,fd,gd,bd,wd,Se,Dh,ll,w0,vd,yd,Sd,kd,Md,zd,Ed,Pd,Td,xu,Rd,yn,Nh,Ad,Uu,Ke,Q,Sn,Ju,Ku,_d,Zu,kn,y0,Oh,Bd,Pt,ar,Tr,ga,Ld,Pr,Ja,vu,Sh,Nd,Od,Ge,d,G,w,E,We,oe,Tt,M0,ce,at,Ot,wa,P,en,R,em,yu,kh,Ka,Su,Mh,Za,ul,ca,Qa,we,Ue,gt,Jr,xn,Fh,ua,el,tl,ku,Fd,xl,zt,ec,$d,vl,jd,tm,tc,V,Mn,S0,qd,tn,k0,Hd,Ne,rm,rl,$h,nm,sm,Je,e0,Kr,Yd,Xd,im,ml,dl,pl,ot,Gd,Wd,Vd,Ud,ct,jh,om,qh,Hh,ba,Oe,K,Qe,fl,Jd,Kd,Vt,rc,nc,Ft,zn,je,Zd,zu,Eu,gl,lm,hm,Qd,ep,tp,yl,rp,np,Sl,sp,cm,sc,um,ip,sl,zl,op,Pu,Tu,ap,pm,fm,Xh,gm,cp,bm,ma,ic,wm,up,mp,xm,Eh,Ph,Gh,il,dp,pp,vm,Th,Rh,Ah,fp,ym,gp,Sm,da,km,bp,wp,Mm,xp,zm,Wh,_h,Ru,vp,Pl,Tl,Em,Pm,_t,Nt,Rl,yp,Ar,Sp,_r,Tm,Bu,Rm,Am,Cu,kp,Mp,_m,Iu,Lu,Bm,zp,Bh,Du,Cm,Im,z0,xa,Ep,Pp,Lm,Tp,Nu,Rp,Ou,Ap,Nm,Ch,Ih,Fu,$u,ju,_p,qu,Hu,vn,Om,Bp,Cp,Ip,Lp,Vh,Dp,Np,bl,Uh,Op,Yu,lc,Xu,Fp,hc,Fm,$m,jm,Jh,Gu,ol,Lh,Wu,wl,cc,uc,qm,Hm,Ym,Al,Xm,Gm,Wm,$p,Um=Q1(()=>{J=class r extends Error{constructor(e,t){var n="KaTeX parse error: "+e,s,i,o=t&&t.loc;if(o&&o.start<=o.end){var a=o.lexer.input;s=o.start,i=o.end,s===a.length?n+=" at end of input: ":n+=" at position "+(s+1)+": ";var l=a.slice(s,i).replace(/[^]/g,"$&\u0332"),h;s>15?h="\u2026"+a.slice(s-15,s):h=a.slice(0,s);var c;i+15<a.length?c=a.slice(i,i+15)+"\u2026":c=a.slice(i),n+=h+l+c}super(n),this.name="ParseError",Object.setPrototypeOf(this,r.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=e}},ad=/([A-Z])/g,Kh=r=>r.replace(ad,"-$1").toLowerCase(),ld={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},hd=/[&><"']/g,bt=r=>String(r).replace(hd,e=>ld[e]),al=r=>r.type==="ordgroup"||r.type==="color"?r.body.length===1?al(r.body[0]):r:r.type==="font"?al(r.body):r,cd=new Set(["mathord","textord","atom"]),Qr=r=>cd.has(al(r).type),ud=r=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(r);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},hl={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};pa=class{constructor(e){e===void 0&&(e={}),e=e||{};for(var t of Object.keys(hl)){var n=hl[t],s=e[t];this[t]=s!==void 0?n.processor?n.processor(s):s:md(n)}}reportNonstrict(e,t,n){var s=this.strict;if(typeof s=="function"&&(s=s(e,t,n)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new J("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),n);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,n){var s=this.strict;if(typeof s=="function")try{s=s(e,t,n)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=ud(e.url);if(t==null)return!1;e.protocol=t}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}},zr=class{constructor(e,t,n){this.id=e,this.size=t,this.cramped=n}sup(){return Er[dd[this.id]]}sub(){return Er[pd[this.id]]}fracNum(){return Er[fd[this.id]]}fracDen(){return Er[gd[this.id]]}cramp(){return Er[bd[this.id]]}text(){return Er[wd[this.id]]}isTight(){return this.size>=2}},Zh=0,cl=1,x0=2,Zr=3,fa=4,Wt=5,v0=6,Et=7,Er=[new zr(Zh,0,!1),new zr(cl,0,!0),new zr(x0,1,!1),new zr(Zr,1,!0),new zr(fa,2,!1),new zr(Wt,2,!0),new zr(v0,3,!1),new zr(Et,3,!0)],dd=[fa,Wt,fa,Wt,v0,Et,v0,Et],pd=[Wt,Wt,Wt,Wt,Et,Et,Et,Et],fd=[x0,Zr,fa,Wt,v0,Et,v0,Et],gd=[Zr,Zr,Wt,Wt,Et,Et,Et,Et],bd=[cl,cl,Zr,Zr,Wt,Wt,Et,Et],wd=[Zh,cl,x0,Zr,x0,Zr,x0,Zr],Se={DISPLAY:Er[Zh],TEXT:Er[x0],SCRIPT:Er[fa],SCRIPTSCRIPT:Er[v0]},Dh=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];ll=[];Dh.forEach(r=>r.blocks.forEach(e=>ll.push(...e)));w0=80,vd=function(e,t){return"M95,"+(622+e+t)+`
1
+ "use strict";var Circuit=(()=>{var V1=Object.create;var sa=Object.defineProperty;var U1=Object.getOwnPropertyDescriptor;var J1=Object.getOwnPropertyNames;var K1=Object.getPrototypeOf,Z1=Object.prototype.hasOwnProperty;var Q1=(r,e,t)=>e in r?sa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ed=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var td=(r,e)=>()=>(r&&(e=r(r=0)),e);var $a=(r,e)=>{for(var t in e)sa(r,t,{get:e[t],enumerable:!0})},ou=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of J1(e))!Z1.call(r,s)&&s!==t&&sa(r,s,{get:()=>e[s],enumerable:!(n=U1(e,s))||n.enumerable});return r};var rd=(r,e,t)=>(t=r!=null?V1(K1(r)):{},ou(e||!r||!r.__esModule?sa(t,"default",{value:r,enumerable:!0}):t,r)),nd=r=>ou(sa({},"__esModule",{value:!0}),r);var z=(r,e,t)=>Q1(r,typeof e!="symbol"?e+"":e,t);var Wm={};$a(Wm,{ParseError:()=>J,SETTINGS_SCHEMA:()=>hl,__defineFunction:()=>ie,__defineMacro:()=>y,__defineSymbol:()=>u,__domTree:()=>Gm,__parse:()=>qm,__renderToDomTree:()=>Al,__renderToHTMLTree:()=>Ym,__setFontMetrics:()=>Zu,default:()=>qp,render:()=>uc,renderToString:()=>jm,version:()=>Xm});function pd(r){if("default"in r)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function yd(r){for(var e=0;e<Dh.length;e++)for(var t=Dh[e],n=0;n<t.blocks.length;n++){var s=t.blocks[n];if(r>=s[0]&&r<=s[1])return t.name}return null}function Wu(r){for(var e=0;e<ll.length;e+=2)if(r>=ll[e]&&r<=ll[e+1])return!0;return!1}function Ld(r){if(r instanceof Pt)return r;throw new Error("Expected symbolNode but got "+String(r)+".")}function Dd(r){if(r instanceof kn)return r;throw new Error("Expected span<HtmlDomNode> but got "+String(r)+".")}function Zu(r,e){Pr[r]=e}function Qh(r,e,t){if(!Pr[e])throw new Error("Font metrics not found for font: "+e+".");var n=r.charCodeAt(0),s=Pr[e][n];if(!s&&r[0]in xu&&(n=xu[r[0]].charCodeAt(0),s=Pr[e][n]),!s&&t==="text"&&Wu(n)&&(s=Pr[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}function Od(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Sh[e]){var t=Sh[e]={cssEmPerMu:Ja.quad[e]/18};for(var n in Ja)Ja.hasOwnProperty(n)&&(t[n]=Ja[n][e])}return Sh[e]}function u(r,e,t,n,s,i){Ge[r][s]={font:e,group:t,replace:n},i&&n&&(Ge[r][n]=Ge[r][s])}function ie(r){for(var{type:e,names:t,props:n,handler:s,htmlBuilder:i,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:s},l=0;l<t.length;++l)sm[t[l]]=a;e&&(i&&(ml[e]=i),o&&(dl[e]=o))}function t0(r){var{type:e,htmlBuilder:t,mathmlBuilder:n}=r;ie({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:n})}function nl(r,e){var t=V(["base"],r,e),n=V(["strut"]);return n.style.height=Q(t.height+t.depth),t.depth&&(n.style.verticalAlign=Q(-t.depth)),t.children.unshift(n),t}function Yh(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var n=ct(r,e,"root"),s;n.length===2&&n[1].hasClass("tag")&&(s=n.pop());for(var i=[],o=[],a=0;a<n.length;a++)if(o.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("newline");)a++,o.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(i.push(nl(o,e)),o=[])}else n[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(nl(o,e)),o=[]),i.push(n[a]));o.length>0&&i.push(nl(o,e));var h;t?(h=nl(ct(t,e,!0),e),h.classes=["tag"],i.push(h)):s&&i.push(s);var c=V(["katex-html"],i);if(c.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=Q(c.height+c.depth),c.depth&&(m.style.verticalAlign=Q(-c.depth))}return c}function om(r){return new yn(r)}function zh(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof Qe&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof Qe&&t.text===","}else return!1}function ku(r,e,t,n,s){var i=Ft(r,t),o;i.length===1&&i[0]instanceof K&&Qd.has(i[0].type)?o=i[0]:o=new K("mrow",i);var a=new K("annotation",[new Qe(e)]);a.setAttribute("encoding","application/x-tex");var l=new K("semantics",[o,a]),h=new K("math",[l]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&h.setAttribute("display","block");var c=s?"katex":"katex-mathml";return V([c],[h])}function Ee(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function kl(r){var e=Ml(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function Ml(r){return r&&(r.type==="atom"||$d.hasOwnProperty(r.type))?r:null}function um(r,e){var t=ct(r.body,e,!0);return V([r.mclass],t,e)}function mm(r,e){var t,n=Ft(r.body,e);return r.mclass==="minner"?t=new K("mpadded",n):r.mclass==="mord"?r.isCharacterBox?(t=n[0],t.type="mi"):t=new K("mi",n):(r.isCharacterBox?(t=n[0],t.type="mo"):t=new K("mo",n),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}function cp(r,e,t){var n=lp[r];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=t.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:n,mode:"math",family:"rel"},o=t.callFunction("\\Big",[i],[]),a=t.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[s,o,a]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function up(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new J("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var n=[],s=[n],i=0;i<e.length;i++){for(var o=e[i],a=Eu(),l=0;l<o.length;l++)if(!Pu(o[l]))a.body.push(o[l]);else{n.push(a),l+=1;var h=kl(o[l]).text,c=new Array(2);if(c[0]={type:"ordgroup",mode:"math",body:[]},c[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(h))if("<>AV".includes(h))for(var m=0;m<2;m++){for(var f=!0,g=l+1;g<o.length;g++){if(hp(o[g],h)){f=!1,l=g;break}if(Pu(o[g]))throw new J("Missing a "+h+" character to complete a CD arrow.",o[g]);c[m].body.push(o[g])}if(f)throw new J("Missing a "+h+" character to complete a CD arrow.",o[l])}else throw new J('Expected one of "<>AV=|." after @',o[l]);var b=cp(h,c,r),v={type:"styling",body:[b],mode:"math",style:"display"};n.push(v),a=Eu()}i%2===0?n.push(a):n.shift(),n=[],s.push(n)}r.gullet.endGroup(),r.gullet.endGroup();var x=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:x,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}function El(r,e){var t=Ml(r);if(t&&Sp.has(t.text))return t;throw t?new J("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new J("Invalid delimiter type '"+r.type+"'",r)}function Ru(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}function Rr(r){for(var{type:e,names:t,props:n,handler:s,htmlBuilder:i,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l<t.length;++l)zm[t[l]]=a;i&&(ml[e]=i),o&&(dl[e]=o)}function y(r,e){Em[r]=e}function Au(r){var e=[];r.consumeSpaces();var t=r.fetch().text;for(t==="\\relax"&&(r.consume(),r.consumeSpaces(),t=r.fetch().text);t==="\\hline"||t==="\\hdashline";)r.consume(),e.push(t==="\\hdashline"),r.consumeSpaces(),t=r.fetch().text;return e}function oc(r){if(!r.includes("ed"))return!r.includes("*")}function En(r,e,t){var{hskipBeforeAndAfter:n,addJot:s,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:h,emptySingleRow:c,maxNumCols:m,leqno:f}=e;if(r.gullet.beginGroup(),h||r.gullet.macros.set("\\cr","\\\\\\relax"),!o){var g=r.gullet.expandMacroAsText("\\arraystretch");if(g==null)o=1;else if(o=parseFloat(g),!o||o<0)throw new J("Invalid \\arraystretch: "+g)}r.gullet.beginGroup();var b=[],v=[b],x=[],S=[],k=l!=null?[]:void 0;function M(){l&&r.gullet.macros.set("\\@eqnsw","1",!0)}function _(){k&&(r.gullet.macros.get("\\df@tag")?(k.push(r.subparse([new Nt("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):k.push(!!l&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(M(),S.push(Au(r));;){var B=r.parseExpression(!1,h?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup();var $={type:"ordgroup",mode:r.mode,body:B};t&&($={type:"styling",mode:r.mode,style:t,body:[$]}),b.push($);var Y=r.fetch().text;if(Y==="&"){if(m&&b.length===m){if(h||a)throw new J("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(Y==="\\end"){_(),b.length===1&&$.type==="styling"&&$.body.length===1&&$.body[0].type==="ordgroup"&&$.body[0].body.length===0&&(v.length>1||!c)&&v.pop(),S.length<v.length+1&&S.push([]);break}else if(Y==="\\\\"){r.consume();var Z=void 0;r.gullet.future().text!==" "&&(Z=r.parseSizeGroup(!0)),x.push(Z?Z.value:null),_(),S.push(Au(r)),b=[],v.push(b),M()}else throw new J("Expected & or \\\\ or \\cr or \\end",r.nextToken)}return r.gullet.endGroup(),r.gullet.endGroup(),{type:"array",mode:r.mode,addJot:s,arraystretch:o,body:v,cols:i,rowGaps:x,hskipBeforeAndAfter:n,hLinesBeforeRow:S,colSeparationType:a,tags:k,leqno:f}}function ac(r){return r.slice(0,1)==="d"?"display":"text"}function Lm(r,e,t){for(var n=ct(r,e,!1),s=e.sizeMultiplier/t.sizeMultiplier,i=0;i<n.length;i++){var o=n[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(n[i].classes,e.sizingClasses(t)):n[i].classes[o+1]==="reset-size"+e.size&&(n[i].classes[o+1]="reset-size"+t.size),n[i].height*=s,n[i].depth*=s}return tn(n)}var J,hd,Kh,cd,ud,bt,al,md,Qr,dd,hl,pa,zr,Zh,cl,x0,Zr,fa,Wt,v0,Et,Er,fd,gd,bd,wd,xd,vd,Se,Dh,ll,w0,Sd,kd,Md,zd,Ed,Pd,Td,Rd,Ad,wu,_d,yn,Nh,Bd,Vu,Ke,Q,Sn,Uu,Ju,Cd,Ku,kn,y0,Oh,Id,Pt,ar,Tr,ga,Nd,Pr,Ja,xu,Sh,Fd,$d,Ge,d,G,w,E,We,oe,Tt,M0,ce,at,Ot,wa,P,en,R,Qu,vu,kh,Ka,yu,Mh,Za,ul,ca,Qa,we,Ue,gt,Jr,xn,Fh,ua,el,tl,Su,jd,xl,zt,ec,qd,vl,Hd,em,tc,V,Mn,S0,Yd,tn,k0,Xd,Ne,tm,rl,$h,rm,nm,Je,e0,Kr,Gd,Wd,sm,ml,dl,pl,ot,Vd,Ud,Jd,Kd,ct,jh,im,qh,Hh,ba,Oe,K,Qe,fl,Zd,Qd,Vt,rc,nc,Ft,zn,je,ep,Mu,zu,gl,am,lm,tp,rp,np,yl,sp,ip,Sl,op,hm,sc,cm,ap,sl,zl,lp,Eu,Pu,hp,dm,pm,Xh,fm,mp,gm,ma,ic,bm,dp,pp,wm,Eh,Ph,Gh,il,fp,gp,xm,Th,Rh,Ah,bp,vm,wp,ym,da,Sm,xp,vp,km,yp,Mm,Wh,_h,Tu,Sp,Pl,Tl,zm,Em,_t,Nt,Rl,kp,Ar,Mp,_r,Pm,_u,Tm,Rm,Bu,zp,Ep,Am,Cu,Iu,_m,Pp,Bh,Lu,Bm,Cm,z0,xa,Tp,Rp,Im,Ap,Du,_p,Nu,Bp,Dm,Ch,Ih,Ou,Fu,$u,Cp,ju,qu,vn,Nm,Ip,Lp,Dp,Np,Vh,Op,Fp,bl,Uh,$p,Hu,lc,Yu,jp,hc,Om,Fm,$m,Jh,Xu,ol,Lh,Gu,wl,cc,uc,jm,qm,Hm,Al,Ym,Xm,Gm,qp,Vm=td(()=>{J=class r extends Error{constructor(e,t){var n="KaTeX parse error: "+e,s,i,o=t&&t.loc;if(o&&o.start<=o.end){var a=o.lexer.input;s=o.start,i=o.end,s===a.length?n+=" at end of input: ":n+=" at position "+(s+1)+": ";var l=a.slice(s,i).replace(/[^]/g,"$&\u0332"),h;s>15?h="\u2026"+a.slice(s-15,s):h=a.slice(0,s);var c;i+15<a.length?c=a.slice(i,i+15)+"\u2026":c=a.slice(i),n+=h+l+c}super(n),this.name="ParseError",Object.setPrototypeOf(this,r.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=e}},hd=/([A-Z])/g,Kh=r=>r.replace(hd,"-$1").toLowerCase(),cd={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},ud=/[&><"']/g,bt=r=>String(r).replace(ud,e=>cd[e]),al=r=>r.type==="ordgroup"||r.type==="color"?r.body.length===1?al(r.body[0]):r:r.type==="font"?al(r.body):r,md=new Set(["mathord","textord","atom"]),Qr=r=>md.has(al(r).type),dd=r=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(r);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},hl={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};pa=class{constructor(e){e===void 0&&(e={}),e=e||{};for(var t of Object.keys(hl)){var n=hl[t],s=e[t];this[t]=s!==void 0?n.processor?n.processor(s):s:pd(n)}}reportNonstrict(e,t,n){var s=this.strict;if(typeof s=="function"&&(s=s(e,t,n)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new J("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),n);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,n){var s=this.strict;if(typeof s=="function")try{s=s(e,t,n)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=dd(e.url);if(t==null)return!1;e.protocol=t}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}},zr=class{constructor(e,t,n){this.id=e,this.size=t,this.cramped=n}sup(){return Er[fd[this.id]]}sub(){return Er[gd[this.id]]}fracNum(){return Er[bd[this.id]]}fracDen(){return Er[wd[this.id]]}cramp(){return Er[xd[this.id]]}text(){return Er[vd[this.id]]}isTight(){return this.size>=2}},Zh=0,cl=1,x0=2,Zr=3,fa=4,Wt=5,v0=6,Et=7,Er=[new zr(Zh,0,!1),new zr(cl,0,!0),new zr(x0,1,!1),new zr(Zr,1,!0),new zr(fa,2,!1),new zr(Wt,2,!0),new zr(v0,3,!1),new zr(Et,3,!0)],fd=[fa,Wt,fa,Wt,v0,Et,v0,Et],gd=[Wt,Wt,Wt,Wt,Et,Et,Et,Et],bd=[x0,Zr,fa,Wt,v0,Et,v0,Et],wd=[Zr,Zr,Wt,Wt,Et,Et,Et,Et],xd=[cl,cl,Zr,Zr,Wt,Wt,Et,Et],vd=[Zh,cl,x0,Zr,x0,Zr,x0,Zr],Se={DISPLAY:Er[Zh],TEXT:Er[x0],SCRIPT:Er[fa],SCRIPTSCRIPT:Er[v0]},Dh=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];ll=[];Dh.forEach(r=>r.blocks.forEach(e=>ll.push(...e)));w0=80,Sd=function(e,t){return"M95,"+(622+e+t)+`
2
2
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
3
3
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
4
4
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -9,7 +9,7 @@ c5.3,-9.3,12,-14,20,-14
9
9
  H400000v`+(40+e)+`H845.2724
10
10
  s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
11
11
  c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
12
- M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},yd=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
12
+ M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},kd=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
13
13
  c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
14
14
  c340,-704.7,510.7,-1060.3,512,-1067
15
15
  l`+e/2.084+" -"+e+`
@@ -19,7 +19,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,
19
19
  c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
20
20
  s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
21
21
  c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
22
- M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},Sd=function(e,t){return"M983 "+(10+e+t)+`
22
+ M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},Md=function(e,t){return"M983 "+(10+e+t)+`
23
23
  l`+e/3.13+" -"+e+`
24
24
  c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
25
25
  H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
@@ -28,7 +28,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
28
28
  c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
29
29
  c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
30
30
  c53.7,-170.3,84.5,-266.8,92.5,-289.5z
31
- M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},kd=function(e,t){return"M424,"+(2398+e+t)+`
31
+ M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},zd=function(e,t){return"M424,"+(2398+e+t)+`
32
32
  c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
33
33
  c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
34
34
  s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
@@ -38,18 +38,18 @@ v`+(40+e)+`H1014.6
38
38
  s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
39
39
  c-2,6,-10,9,-24,9
40
40
  c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+t+`
41
- h400000v`+(40+e)+"h-400000z"},Md=function(e,t){return"M473,"+(2713+e+t)+`
41
+ h400000v`+(40+e)+"h-400000z"},Ed=function(e,t){return"M473,"+(2713+e+t)+`
42
42
  c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
43
43
  c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
44
44
  s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
45
45
  c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
46
46
  c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
47
47
  s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
48
- 606zM`+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"},zd=function(e){var t=e/2;return"M400000 "+e+" H0 L"+t+" 0 l65 45 L145 "+(e-80)+" H400000z"},Ed=function(e,t,n){var s=n-54-t-e;return"M702 "+(e+t)+"H400000"+(40+e)+`
48
+ 606zM`+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"},Pd=function(e){var t=e/2;return"M400000 "+e+" H0 L"+t+" 0 l65 45 L145 "+(e-80)+" H400000z"},Td=function(e,t,n){var s=n-54-t-e;return"M702 "+(e+t)+"H400000"+(40+e)+`
49
49
  H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
50
50
  h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
51
51
  c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
52
- 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},Pd=function(e,t,n){t=1e3*t;var s="";switch(e){case"sqrtMain":s=vd(t,w0);break;case"sqrtSize1":s=yd(t,w0);break;case"sqrtSize2":s=Sd(t,w0);break;case"sqrtSize3":s=kd(t,w0);break;case"sqrtSize4":s=Md(t,w0);break;case"sqrtTall":s=Ed(t,w0,n)}return s},Td=function(e,t){switch(e){case"\u239C":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"\u2223":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"\u2225":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"\u239F":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"\u23A2":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"\u23A5":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"\u23AA":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"\u23D0":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"\u2016":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},xu={doubleleftarrow:`M262 157
52
+ 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},Rd=function(e,t,n){t=1e3*t;var s="";switch(e){case"sqrtMain":s=Sd(t,w0);break;case"sqrtSize1":s=kd(t,w0);break;case"sqrtSize2":s=Md(t,w0);break;case"sqrtSize3":s=zd(t,w0);break;case"sqrtSize4":s=Ed(t,w0);break;case"sqrtTall":s=Td(t,w0,n)}return s},Ad=function(e,t){switch(e){case"\u239C":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"\u2223":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"\u2225":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"\u239F":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"\u23A2":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"\u23A5":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"\u23AA":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"\u23D0":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"\u2016":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},wu={doubleleftarrow:`M262 157
53
53
  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
54
54
  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
55
55
  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
@@ -228,7 +228,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`
228
228
  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,
229
229
  -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
230
230
  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
231
- M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Rd=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v1759 h347 v-84
231
+ M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},_d=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v1759 h347 v-84
232
232
  H403z M403 1759 V0 H319 V1759 v`+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v1759 H0 v84 H347z
233
233
  M347 1759 V0 H263 V1759 v`+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
234
234
  c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
@@ -256,17 +256,17 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6
256
256
  c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
257
257
  c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
258
258
  l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
259
- -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}},yn=class{constructor(e){this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}},Nh={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Ad={ex:!0,em:!0,mu:!0},Uu=function(e){return typeof e!="string"&&(e=e.unit),e in Nh||e in Ad||e==="ex"},Ke=function(e,t){var n;if(e.unit in Nh)n=Nh[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")n=t.fontMetrics().cssEmPerMu;else{var s;if(t.style.isTight()?s=t.havingStyle(t.style.text()):s=t,e.unit==="ex")n=s.fontMetrics().xHeight;else if(e.unit==="em")n=s.fontMetrics().quad;else throw new J("Invalid unit: '"+e.unit+"'");s!==t&&(n*=s.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},Q=function(e){return+e.toFixed(4)+"em"},Sn=function(e){return e.filter(t=>t).join(" ")},Ju=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var s=t.getColor();s&&(this.style.color=s)}},Ku=function(e){var t=document.createElement(e);t.className=Sn(this.classes);for(var n of Object.keys(this.style))t.style[n]=this.style[n];for(var s of Object.keys(this.attributes))t.setAttribute(s,this.attributes[s]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t},_d=/[\s"'>/=\x00-\x1f]/,Zu=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+bt(Sn(this.classes))+'"');var n="";for(var s of Object.keys(this.style))n+=Kh(s)+":"+this.style[s]+";";n&&(t+=' style="'+bt(n)+'"');for(var i of Object.keys(this.attributes)){if(_d.test(i))throw new J("Invalid attribute name '"+i+"'");t+=" "+i+'="'+bt(this.attributes[i])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t},kn=class{constructor(e,t,n,s){Ju.call(this,e,n,s),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ku.call(this,"span")}toMarkup(){return Zu.call(this,"span")}},y0=class{constructor(e,t,n,s){Ju.call(this,t,s),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ku.call(this,"a")}toMarkup(){return Zu.call(this,"a")}},Oh=class{constructor(e,t,n){this.alt=t,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t of Object.keys(this.style))e.style[t]=this.style[t];return e}toMarkup(){var e='<img src="'+bt(this.src)+'"'+(' alt="'+bt(this.alt)+'"'),t="";for(var n of Object.keys(this.style))t+=Kh(n)+":"+this.style[n]+";";return t&&(e+=' style="'+bt(t)+'"'),e+="'/>",e}},Bd={\u00EE:"\u0131\u0302",\u00EF:"\u0131\u0308",\u00ED:"\u0131\u0301",\u00EC:"\u0131\u0300"},Pt=class{constructor(e,t,n,s,i,o,a,l){this.text=e,this.height=t||0,this.depth=n||0,this.italic=s||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var h=xd(this.text.charCodeAt(0));h&&this.classes.push(h+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Bd[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=Q(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=Sn(this.classes));for(var n of Object.keys(this.style))t=t||document.createElement("span"),t.style[n]=this.style[n];return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=bt(Sn(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+Q(this.italic)+";");for(var s of Object.keys(this.style))n+=Kh(s)+":"+this.style[s]+";";n&&(e=!0,t+=' style="'+bt(n)+'"');var i=bt(this.text);return e?(t+=">",t+=i,t+="</span>",t):i}},ar=class{constructor(e,t){this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t of Object.keys(this.attributes))e+=" "+t+'="'+bt(this.attributes[t])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}},Tr=class{constructor(e,t){this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",xu[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+bt(this.alternate)+'"/>':'<path d="'+bt(xu[this.pathName])+'"/>'}},ga=class{constructor(e){this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);return t}toMarkup(){var e="<line";for(var t of Object.keys(this.attributes))e+=" "+t+'="'+bt(this.attributes[t])+'"';return e+="/>",e}};Ld=r=>r instanceof kn||r instanceof y0||r instanceof yn,Pr={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],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:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],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:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],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:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],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:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],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:[0,.44444,0,0,.63889],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:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],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:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],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:[0,.68611,.17208,0,.8961],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:[0,.69444,.06709,0,.59111],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:[.19444,.44444,.105,0,.53222],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:[.19444,.44444,.105,0,.53222],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:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],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:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],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:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],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:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],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:[0,.68333,.16389,0,.74333],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:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],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:[0,.68333,.16389,0,.74333],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:[0,.69444,.06646,0,.51111],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:[.19444,.43056,.08847,0,.46],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:[.19444,.43056,.08847,0,.46],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:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],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:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],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:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],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:[0,.43056,0,0,.55556],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:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],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:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],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:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],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:[0,.69444,0,0,.66759],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:[0,.44444,0,0,.58472],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:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],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:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],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:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],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:[0,.68333,.08125,.05556,.83125],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:[0,.68333,.02778,.08334,.76278],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:[0,.43056,0,.05556,.48472],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:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],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:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],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:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],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:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],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:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],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:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],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:[0,.69444,.07816,0,.27778],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:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],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:[0,.69444,0,0,.66667],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:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],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:[0,.69444,.0799,0,.5],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:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],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:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],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:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],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:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],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:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Ja={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],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:[.25,.25,.25],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],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},vu={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\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"};Sh={};Nd={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Od={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ge={math:{},text:{}};d="math",G="text",w="main",E="ams",We="accent-token",oe="bin",Tt="close",M0="inner",ce="mathord",at="op-token",Ot="open",wa="punct",P="rel",en="spacing",R="textord";u(d,w,P,"\u2261","\\equiv",!0);u(d,w,P,"\u227A","\\prec",!0);u(d,w,P,"\u227B","\\succ",!0);u(d,w,P,"\u223C","\\sim",!0);u(d,w,P,"\u22A5","\\perp");u(d,w,P,"\u2AAF","\\preceq",!0);u(d,w,P,"\u2AB0","\\succeq",!0);u(d,w,P,"\u2243","\\simeq",!0);u(d,w,P,"\u2223","\\mid",!0);u(d,w,P,"\u226A","\\ll",!0);u(d,w,P,"\u226B","\\gg",!0);u(d,w,P,"\u224D","\\asymp",!0);u(d,w,P,"\u2225","\\parallel");u(d,w,P,"\u22C8","\\bowtie",!0);u(d,w,P,"\u2323","\\smile",!0);u(d,w,P,"\u2291","\\sqsubseteq",!0);u(d,w,P,"\u2292","\\sqsupseteq",!0);u(d,w,P,"\u2250","\\doteq",!0);u(d,w,P,"\u2322","\\frown",!0);u(d,w,P,"\u220B","\\ni",!0);u(d,w,P,"\u221D","\\propto",!0);u(d,w,P,"\u22A2","\\vdash",!0);u(d,w,P,"\u22A3","\\dashv",!0);u(d,w,P,"\u220B","\\owns");u(d,w,wa,".","\\ldotp");u(d,w,wa,"\u22C5","\\cdotp");u(d,w,wa,"\u22C5","\xB7");u(G,w,R,"\u22C5","\xB7");u(d,w,R,"#","\\#");u(G,w,R,"#","\\#");u(d,w,R,"&","\\&");u(G,w,R,"&","\\&");u(d,w,R,"\u2135","\\aleph",!0);u(d,w,R,"\u2200","\\forall",!0);u(d,w,R,"\u210F","\\hbar",!0);u(d,w,R,"\u2203","\\exists",!0);u(d,w,R,"\u2207","\\nabla",!0);u(d,w,R,"\u266D","\\flat",!0);u(d,w,R,"\u2113","\\ell",!0);u(d,w,R,"\u266E","\\natural",!0);u(d,w,R,"\u2663","\\clubsuit",!0);u(d,w,R,"\u2118","\\wp",!0);u(d,w,R,"\u266F","\\sharp",!0);u(d,w,R,"\u2662","\\diamondsuit",!0);u(d,w,R,"\u211C","\\Re",!0);u(d,w,R,"\u2661","\\heartsuit",!0);u(d,w,R,"\u2111","\\Im",!0);u(d,w,R,"\u2660","\\spadesuit",!0);u(d,w,R,"\xA7","\\S",!0);u(G,w,R,"\xA7","\\S");u(d,w,R,"\xB6","\\P",!0);u(G,w,R,"\xB6","\\P");u(d,w,R,"\u2020","\\dag");u(G,w,R,"\u2020","\\dag");u(G,w,R,"\u2020","\\textdagger");u(d,w,R,"\u2021","\\ddag");u(G,w,R,"\u2021","\\ddag");u(G,w,R,"\u2021","\\textdaggerdbl");u(d,w,Tt,"\u23B1","\\rmoustache",!0);u(d,w,Ot,"\u23B0","\\lmoustache",!0);u(d,w,Tt,"\u27EF","\\rgroup",!0);u(d,w,Ot,"\u27EE","\\lgroup",!0);u(d,w,oe,"\u2213","\\mp",!0);u(d,w,oe,"\u2296","\\ominus",!0);u(d,w,oe,"\u228E","\\uplus",!0);u(d,w,oe,"\u2293","\\sqcap",!0);u(d,w,oe,"\u2217","\\ast");u(d,w,oe,"\u2294","\\sqcup",!0);u(d,w,oe,"\u25EF","\\bigcirc",!0);u(d,w,oe,"\u2219","\\bullet",!0);u(d,w,oe,"\u2021","\\ddagger");u(d,w,oe,"\u2240","\\wr",!0);u(d,w,oe,"\u2A3F","\\amalg");u(d,w,oe,"&","\\And");u(d,w,P,"\u27F5","\\longleftarrow",!0);u(d,w,P,"\u21D0","\\Leftarrow",!0);u(d,w,P,"\u27F8","\\Longleftarrow",!0);u(d,w,P,"\u27F6","\\longrightarrow",!0);u(d,w,P,"\u21D2","\\Rightarrow",!0);u(d,w,P,"\u27F9","\\Longrightarrow",!0);u(d,w,P,"\u2194","\\leftrightarrow",!0);u(d,w,P,"\u27F7","\\longleftrightarrow",!0);u(d,w,P,"\u21D4","\\Leftrightarrow",!0);u(d,w,P,"\u27FA","\\Longleftrightarrow",!0);u(d,w,P,"\u21A6","\\mapsto",!0);u(d,w,P,"\u27FC","\\longmapsto",!0);u(d,w,P,"\u2197","\\nearrow",!0);u(d,w,P,"\u21A9","\\hookleftarrow",!0);u(d,w,P,"\u21AA","\\hookrightarrow",!0);u(d,w,P,"\u2198","\\searrow",!0);u(d,w,P,"\u21BC","\\leftharpoonup",!0);u(d,w,P,"\u21C0","\\rightharpoonup",!0);u(d,w,P,"\u2199","\\swarrow",!0);u(d,w,P,"\u21BD","\\leftharpoondown",!0);u(d,w,P,"\u21C1","\\rightharpoondown",!0);u(d,w,P,"\u2196","\\nwarrow",!0);u(d,w,P,"\u21CC","\\rightleftharpoons",!0);u(d,E,P,"\u226E","\\nless",!0);u(d,E,P,"\uE010","\\@nleqslant");u(d,E,P,"\uE011","\\@nleqq");u(d,E,P,"\u2A87","\\lneq",!0);u(d,E,P,"\u2268","\\lneqq",!0);u(d,E,P,"\uE00C","\\@lvertneqq");u(d,E,P,"\u22E6","\\lnsim",!0);u(d,E,P,"\u2A89","\\lnapprox",!0);u(d,E,P,"\u2280","\\nprec",!0);u(d,E,P,"\u22E0","\\npreceq",!0);u(d,E,P,"\u22E8","\\precnsim",!0);u(d,E,P,"\u2AB9","\\precnapprox",!0);u(d,E,P,"\u2241","\\nsim",!0);u(d,E,P,"\uE006","\\@nshortmid");u(d,E,P,"\u2224","\\nmid",!0);u(d,E,P,"\u22AC","\\nvdash",!0);u(d,E,P,"\u22AD","\\nvDash",!0);u(d,E,P,"\u22EA","\\ntriangleleft");u(d,E,P,"\u22EC","\\ntrianglelefteq",!0);u(d,E,P,"\u228A","\\subsetneq",!0);u(d,E,P,"\uE01A","\\@varsubsetneq");u(d,E,P,"\u2ACB","\\subsetneqq",!0);u(d,E,P,"\uE017","\\@varsubsetneqq");u(d,E,P,"\u226F","\\ngtr",!0);u(d,E,P,"\uE00F","\\@ngeqslant");u(d,E,P,"\uE00E","\\@ngeqq");u(d,E,P,"\u2A88","\\gneq",!0);u(d,E,P,"\u2269","\\gneqq",!0);u(d,E,P,"\uE00D","\\@gvertneqq");u(d,E,P,"\u22E7","\\gnsim",!0);u(d,E,P,"\u2A8A","\\gnapprox",!0);u(d,E,P,"\u2281","\\nsucc",!0);u(d,E,P,"\u22E1","\\nsucceq",!0);u(d,E,P,"\u22E9","\\succnsim",!0);u(d,E,P,"\u2ABA","\\succnapprox",!0);u(d,E,P,"\u2246","\\ncong",!0);u(d,E,P,"\uE007","\\@nshortparallel");u(d,E,P,"\u2226","\\nparallel",!0);u(d,E,P,"\u22AF","\\nVDash",!0);u(d,E,P,"\u22EB","\\ntriangleright");u(d,E,P,"\u22ED","\\ntrianglerighteq",!0);u(d,E,P,"\uE018","\\@nsupseteqq");u(d,E,P,"\u228B","\\supsetneq",!0);u(d,E,P,"\uE01B","\\@varsupsetneq");u(d,E,P,"\u2ACC","\\supsetneqq",!0);u(d,E,P,"\uE019","\\@varsupsetneqq");u(d,E,P,"\u22AE","\\nVdash",!0);u(d,E,P,"\u2AB5","\\precneqq",!0);u(d,E,P,"\u2AB6","\\succneqq",!0);u(d,E,P,"\uE016","\\@nsubseteqq");u(d,E,oe,"\u22B4","\\unlhd");u(d,E,oe,"\u22B5","\\unrhd");u(d,E,P,"\u219A","\\nleftarrow",!0);u(d,E,P,"\u219B","\\nrightarrow",!0);u(d,E,P,"\u21CD","\\nLeftarrow",!0);u(d,E,P,"\u21CF","\\nRightarrow",!0);u(d,E,P,"\u21AE","\\nleftrightarrow",!0);u(d,E,P,"\u21CE","\\nLeftrightarrow",!0);u(d,E,P,"\u25B3","\\vartriangle");u(d,E,R,"\u210F","\\hslash");u(d,E,R,"\u25BD","\\triangledown");u(d,E,R,"\u25CA","\\lozenge");u(d,E,R,"\u24C8","\\circledS");u(d,E,R,"\xAE","\\circledR");u(G,E,R,"\xAE","\\circledR");u(d,E,R,"\u2221","\\measuredangle",!0);u(d,E,R,"\u2204","\\nexists");u(d,E,R,"\u2127","\\mho");u(d,E,R,"\u2132","\\Finv",!0);u(d,E,R,"\u2141","\\Game",!0);u(d,E,R,"\u2035","\\backprime");u(d,E,R,"\u25B2","\\blacktriangle");u(d,E,R,"\u25BC","\\blacktriangledown");u(d,E,R,"\u25A0","\\blacksquare");u(d,E,R,"\u29EB","\\blacklozenge");u(d,E,R,"\u2605","\\bigstar");u(d,E,R,"\u2222","\\sphericalangle",!0);u(d,E,R,"\u2201","\\complement",!0);u(d,E,R,"\xF0","\\eth",!0);u(G,w,R,"\xF0","\xF0");u(d,E,R,"\u2571","\\diagup");u(d,E,R,"\u2572","\\diagdown");u(d,E,R,"\u25A1","\\square");u(d,E,R,"\u25A1","\\Box");u(d,E,R,"\u25CA","\\Diamond");u(d,E,R,"\xA5","\\yen",!0);u(G,E,R,"\xA5","\\yen",!0);u(d,E,R,"\u2713","\\checkmark",!0);u(G,E,R,"\u2713","\\checkmark");u(d,E,R,"\u2136","\\beth",!0);u(d,E,R,"\u2138","\\daleth",!0);u(d,E,R,"\u2137","\\gimel",!0);u(d,E,R,"\u03DD","\\digamma",!0);u(d,E,R,"\u03F0","\\varkappa");u(d,E,Ot,"\u250C","\\@ulcorner",!0);u(d,E,Tt,"\u2510","\\@urcorner",!0);u(d,E,Ot,"\u2514","\\@llcorner",!0);u(d,E,Tt,"\u2518","\\@lrcorner",!0);u(d,E,P,"\u2266","\\leqq",!0);u(d,E,P,"\u2A7D","\\leqslant",!0);u(d,E,P,"\u2A95","\\eqslantless",!0);u(d,E,P,"\u2272","\\lesssim",!0);u(d,E,P,"\u2A85","\\lessapprox",!0);u(d,E,P,"\u224A","\\approxeq",!0);u(d,E,oe,"\u22D6","\\lessdot");u(d,E,P,"\u22D8","\\lll",!0);u(d,E,P,"\u2276","\\lessgtr",!0);u(d,E,P,"\u22DA","\\lesseqgtr",!0);u(d,E,P,"\u2A8B","\\lesseqqgtr",!0);u(d,E,P,"\u2251","\\doteqdot");u(d,E,P,"\u2253","\\risingdotseq",!0);u(d,E,P,"\u2252","\\fallingdotseq",!0);u(d,E,P,"\u223D","\\backsim",!0);u(d,E,P,"\u22CD","\\backsimeq",!0);u(d,E,P,"\u2AC5","\\subseteqq",!0);u(d,E,P,"\u22D0","\\Subset",!0);u(d,E,P,"\u228F","\\sqsubset",!0);u(d,E,P,"\u227C","\\preccurlyeq",!0);u(d,E,P,"\u22DE","\\curlyeqprec",!0);u(d,E,P,"\u227E","\\precsim",!0);u(d,E,P,"\u2AB7","\\precapprox",!0);u(d,E,P,"\u22B2","\\vartriangleleft");u(d,E,P,"\u22B4","\\trianglelefteq");u(d,E,P,"\u22A8","\\vDash",!0);u(d,E,P,"\u22AA","\\Vvdash",!0);u(d,E,P,"\u2323","\\smallsmile");u(d,E,P,"\u2322","\\smallfrown");u(d,E,P,"\u224F","\\bumpeq",!0);u(d,E,P,"\u224E","\\Bumpeq",!0);u(d,E,P,"\u2267","\\geqq",!0);u(d,E,P,"\u2A7E","\\geqslant",!0);u(d,E,P,"\u2A96","\\eqslantgtr",!0);u(d,E,P,"\u2273","\\gtrsim",!0);u(d,E,P,"\u2A86","\\gtrapprox",!0);u(d,E,oe,"\u22D7","\\gtrdot");u(d,E,P,"\u22D9","\\ggg",!0);u(d,E,P,"\u2277","\\gtrless",!0);u(d,E,P,"\u22DB","\\gtreqless",!0);u(d,E,P,"\u2A8C","\\gtreqqless",!0);u(d,E,P,"\u2256","\\eqcirc",!0);u(d,E,P,"\u2257","\\circeq",!0);u(d,E,P,"\u225C","\\triangleq",!0);u(d,E,P,"\u223C","\\thicksim");u(d,E,P,"\u2248","\\thickapprox");u(d,E,P,"\u2AC6","\\supseteqq",!0);u(d,E,P,"\u22D1","\\Supset",!0);u(d,E,P,"\u2290","\\sqsupset",!0);u(d,E,P,"\u227D","\\succcurlyeq",!0);u(d,E,P,"\u22DF","\\curlyeqsucc",!0);u(d,E,P,"\u227F","\\succsim",!0);u(d,E,P,"\u2AB8","\\succapprox",!0);u(d,E,P,"\u22B3","\\vartriangleright");u(d,E,P,"\u22B5","\\trianglerighteq");u(d,E,P,"\u22A9","\\Vdash",!0);u(d,E,P,"\u2223","\\shortmid");u(d,E,P,"\u2225","\\shortparallel");u(d,E,P,"\u226C","\\between",!0);u(d,E,P,"\u22D4","\\pitchfork",!0);u(d,E,P,"\u221D","\\varpropto");u(d,E,P,"\u25C0","\\blacktriangleleft");u(d,E,P,"\u2234","\\therefore",!0);u(d,E,P,"\u220D","\\backepsilon");u(d,E,P,"\u25B6","\\blacktriangleright");u(d,E,P,"\u2235","\\because",!0);u(d,E,P,"\u22D8","\\llless");u(d,E,P,"\u22D9","\\gggtr");u(d,E,oe,"\u22B2","\\lhd");u(d,E,oe,"\u22B3","\\rhd");u(d,E,P,"\u2242","\\eqsim",!0);u(d,w,P,"\u22C8","\\Join");u(d,E,P,"\u2251","\\Doteq",!0);u(d,E,oe,"\u2214","\\dotplus",!0);u(d,E,oe,"\u2216","\\smallsetminus");u(d,E,oe,"\u22D2","\\Cap",!0);u(d,E,oe,"\u22D3","\\Cup",!0);u(d,E,oe,"\u2A5E","\\doublebarwedge",!0);u(d,E,oe,"\u229F","\\boxminus",!0);u(d,E,oe,"\u229E","\\boxplus",!0);u(d,E,oe,"\u22C7","\\divideontimes",!0);u(d,E,oe,"\u22C9","\\ltimes",!0);u(d,E,oe,"\u22CA","\\rtimes",!0);u(d,E,oe,"\u22CB","\\leftthreetimes",!0);u(d,E,oe,"\u22CC","\\rightthreetimes",!0);u(d,E,oe,"\u22CF","\\curlywedge",!0);u(d,E,oe,"\u22CE","\\curlyvee",!0);u(d,E,oe,"\u229D","\\circleddash",!0);u(d,E,oe,"\u229B","\\circledast",!0);u(d,E,oe,"\u22C5","\\centerdot");u(d,E,oe,"\u22BA","\\intercal",!0);u(d,E,oe,"\u22D2","\\doublecap");u(d,E,oe,"\u22D3","\\doublecup");u(d,E,oe,"\u22A0","\\boxtimes",!0);u(d,E,P,"\u21E2","\\dashrightarrow",!0);u(d,E,P,"\u21E0","\\dashleftarrow",!0);u(d,E,P,"\u21C7","\\leftleftarrows",!0);u(d,E,P,"\u21C6","\\leftrightarrows",!0);u(d,E,P,"\u21DA","\\Lleftarrow",!0);u(d,E,P,"\u219E","\\twoheadleftarrow",!0);u(d,E,P,"\u21A2","\\leftarrowtail",!0);u(d,E,P,"\u21AB","\\looparrowleft",!0);u(d,E,P,"\u21CB","\\leftrightharpoons",!0);u(d,E,P,"\u21B6","\\curvearrowleft",!0);u(d,E,P,"\u21BA","\\circlearrowleft",!0);u(d,E,P,"\u21B0","\\Lsh",!0);u(d,E,P,"\u21C8","\\upuparrows",!0);u(d,E,P,"\u21BF","\\upharpoonleft",!0);u(d,E,P,"\u21C3","\\downharpoonleft",!0);u(d,w,P,"\u22B6","\\origof",!0);u(d,w,P,"\u22B7","\\imageof",!0);u(d,E,P,"\u22B8","\\multimap",!0);u(d,E,P,"\u21AD","\\leftrightsquigarrow",!0);u(d,E,P,"\u21C9","\\rightrightarrows",!0);u(d,E,P,"\u21C4","\\rightleftarrows",!0);u(d,E,P,"\u21A0","\\twoheadrightarrow",!0);u(d,E,P,"\u21A3","\\rightarrowtail",!0);u(d,E,P,"\u21AC","\\looparrowright",!0);u(d,E,P,"\u21B7","\\curvearrowright",!0);u(d,E,P,"\u21BB","\\circlearrowright",!0);u(d,E,P,"\u21B1","\\Rsh",!0);u(d,E,P,"\u21CA","\\downdownarrows",!0);u(d,E,P,"\u21BE","\\upharpoonright",!0);u(d,E,P,"\u21C2","\\downharpoonright",!0);u(d,E,P,"\u21DD","\\rightsquigarrow",!0);u(d,E,P,"\u21DD","\\leadsto");u(d,E,P,"\u21DB","\\Rrightarrow",!0);u(d,E,P,"\u21BE","\\restriction");u(d,w,R,"\u2018","`");u(d,w,R,"$","\\$");u(G,w,R,"$","\\$");u(G,w,R,"$","\\textdollar");u(d,w,R,"%","\\%");u(G,w,R,"%","\\%");u(d,w,R,"_","\\_");u(G,w,R,"_","\\_");u(G,w,R,"_","\\textunderscore");u(d,w,R,"\u2220","\\angle",!0);u(d,w,R,"\u221E","\\infty",!0);u(d,w,R,"\u2032","\\prime");u(d,w,R,"\u25B3","\\triangle");u(d,w,R,"\u0393","\\Gamma",!0);u(d,w,R,"\u0394","\\Delta",!0);u(d,w,R,"\u0398","\\Theta",!0);u(d,w,R,"\u039B","\\Lambda",!0);u(d,w,R,"\u039E","\\Xi",!0);u(d,w,R,"\u03A0","\\Pi",!0);u(d,w,R,"\u03A3","\\Sigma",!0);u(d,w,R,"\u03A5","\\Upsilon",!0);u(d,w,R,"\u03A6","\\Phi",!0);u(d,w,R,"\u03A8","\\Psi",!0);u(d,w,R,"\u03A9","\\Omega",!0);u(d,w,R,"A","\u0391");u(d,w,R,"B","\u0392");u(d,w,R,"E","\u0395");u(d,w,R,"Z","\u0396");u(d,w,R,"H","\u0397");u(d,w,R,"I","\u0399");u(d,w,R,"K","\u039A");u(d,w,R,"M","\u039C");u(d,w,R,"N","\u039D");u(d,w,R,"O","\u039F");u(d,w,R,"P","\u03A1");u(d,w,R,"T","\u03A4");u(d,w,R,"X","\u03A7");u(d,w,R,"\xAC","\\neg",!0);u(d,w,R,"\xAC","\\lnot");u(d,w,R,"\u22A4","\\top");u(d,w,R,"\u22A5","\\bot");u(d,w,R,"\u2205","\\emptyset");u(d,E,R,"\u2205","\\varnothing");u(d,w,ce,"\u03B1","\\alpha",!0);u(d,w,ce,"\u03B2","\\beta",!0);u(d,w,ce,"\u03B3","\\gamma",!0);u(d,w,ce,"\u03B4","\\delta",!0);u(d,w,ce,"\u03F5","\\epsilon",!0);u(d,w,ce,"\u03B6","\\zeta",!0);u(d,w,ce,"\u03B7","\\eta",!0);u(d,w,ce,"\u03B8","\\theta",!0);u(d,w,ce,"\u03B9","\\iota",!0);u(d,w,ce,"\u03BA","\\kappa",!0);u(d,w,ce,"\u03BB","\\lambda",!0);u(d,w,ce,"\u03BC","\\mu",!0);u(d,w,ce,"\u03BD","\\nu",!0);u(d,w,ce,"\u03BE","\\xi",!0);u(d,w,ce,"\u03BF","\\omicron",!0);u(d,w,ce,"\u03C0","\\pi",!0);u(d,w,ce,"\u03C1","\\rho",!0);u(d,w,ce,"\u03C3","\\sigma",!0);u(d,w,ce,"\u03C4","\\tau",!0);u(d,w,ce,"\u03C5","\\upsilon",!0);u(d,w,ce,"\u03D5","\\phi",!0);u(d,w,ce,"\u03C7","\\chi",!0);u(d,w,ce,"\u03C8","\\psi",!0);u(d,w,ce,"\u03C9","\\omega",!0);u(d,w,ce,"\u03B5","\\varepsilon",!0);u(d,w,ce,"\u03D1","\\vartheta",!0);u(d,w,ce,"\u03D6","\\varpi",!0);u(d,w,ce,"\u03F1","\\varrho",!0);u(d,w,ce,"\u03C2","\\varsigma",!0);u(d,w,ce,"\u03C6","\\varphi",!0);u(d,w,oe,"\u2217","*",!0);u(d,w,oe,"+","+");u(d,w,oe,"\u2212","-",!0);u(d,w,oe,"\u22C5","\\cdot",!0);u(d,w,oe,"\u2218","\\circ",!0);u(d,w,oe,"\xF7","\\div",!0);u(d,w,oe,"\xB1","\\pm",!0);u(d,w,oe,"\xD7","\\times",!0);u(d,w,oe,"\u2229","\\cap",!0);u(d,w,oe,"\u222A","\\cup",!0);u(d,w,oe,"\u2216","\\setminus",!0);u(d,w,oe,"\u2227","\\land");u(d,w,oe,"\u2228","\\lor");u(d,w,oe,"\u2227","\\wedge",!0);u(d,w,oe,"\u2228","\\vee",!0);u(d,w,R,"\u221A","\\surd");u(d,w,Ot,"\u27E8","\\langle",!0);u(d,w,Ot,"\u2223","\\lvert");u(d,w,Ot,"\u2225","\\lVert");u(d,w,Tt,"?","?");u(d,w,Tt,"!","!");u(d,w,Tt,"\u27E9","\\rangle",!0);u(d,w,Tt,"\u2223","\\rvert");u(d,w,Tt,"\u2225","\\rVert");u(d,w,P,"=","=");u(d,w,P,":",":");u(d,w,P,"\u2248","\\approx",!0);u(d,w,P,"\u2245","\\cong",!0);u(d,w,P,"\u2265","\\ge");u(d,w,P,"\u2265","\\geq",!0);u(d,w,P,"\u2190","\\gets");u(d,w,P,">","\\gt",!0);u(d,w,P,"\u2208","\\in",!0);u(d,w,P,"\uE020","\\@not");u(d,w,P,"\u2282","\\subset",!0);u(d,w,P,"\u2283","\\supset",!0);u(d,w,P,"\u2286","\\subseteq",!0);u(d,w,P,"\u2287","\\supseteq",!0);u(d,E,P,"\u2288","\\nsubseteq",!0);u(d,E,P,"\u2289","\\nsupseteq",!0);u(d,w,P,"\u22A8","\\models");u(d,w,P,"\u2190","\\leftarrow",!0);u(d,w,P,"\u2264","\\le");u(d,w,P,"\u2264","\\leq",!0);u(d,w,P,"<","\\lt",!0);u(d,w,P,"\u2192","\\rightarrow",!0);u(d,w,P,"\u2192","\\to");u(d,E,P,"\u2271","\\ngeq",!0);u(d,E,P,"\u2270","\\nleq",!0);u(d,w,en,"\xA0","\\ ");u(d,w,en,"\xA0","\\space");u(d,w,en,"\xA0","\\nobreakspace");u(G,w,en,"\xA0","\\ ");u(G,w,en,"\xA0"," ");u(G,w,en,"\xA0","\\space");u(G,w,en,"\xA0","\\nobreakspace");u(d,w,en,null,"\\nobreak");u(d,w,en,null,"\\allowbreak");u(d,w,wa,",",",");u(d,w,wa,";",";");u(d,E,oe,"\u22BC","\\barwedge",!0);u(d,E,oe,"\u22BB","\\veebar",!0);u(d,w,oe,"\u2299","\\odot",!0);u(d,w,oe,"\u2295","\\oplus",!0);u(d,w,oe,"\u2297","\\otimes",!0);u(d,w,R,"\u2202","\\partial",!0);u(d,w,oe,"\u2298","\\oslash",!0);u(d,E,oe,"\u229A","\\circledcirc",!0);u(d,E,oe,"\u22A1","\\boxdot",!0);u(d,w,oe,"\u25B3","\\bigtriangleup");u(d,w,oe,"\u25BD","\\bigtriangledown");u(d,w,oe,"\u2020","\\dagger");u(d,w,oe,"\u22C4","\\diamond");u(d,w,oe,"\u22C6","\\star");u(d,w,oe,"\u25C3","\\triangleleft");u(d,w,oe,"\u25B9","\\triangleright");u(d,w,Ot,"{","\\{");u(G,w,R,"{","\\{");u(G,w,R,"{","\\textbraceleft");u(d,w,Tt,"}","\\}");u(G,w,R,"}","\\}");u(G,w,R,"}","\\textbraceright");u(d,w,Ot,"{","\\lbrace");u(d,w,Tt,"}","\\rbrace");u(d,w,Ot,"[","\\lbrack",!0);u(G,w,R,"[","\\lbrack",!0);u(d,w,Tt,"]","\\rbrack",!0);u(G,w,R,"]","\\rbrack",!0);u(d,w,Ot,"(","\\lparen",!0);u(d,w,Tt,")","\\rparen",!0);u(G,w,R,"<","\\textless",!0);u(G,w,R,">","\\textgreater",!0);u(d,w,Ot,"\u230A","\\lfloor",!0);u(d,w,Tt,"\u230B","\\rfloor",!0);u(d,w,Ot,"\u2308","\\lceil",!0);u(d,w,Tt,"\u2309","\\rceil",!0);u(d,w,R,"\\","\\backslash");u(d,w,R,"\u2223","|");u(d,w,R,"\u2223","\\vert");u(G,w,R,"|","\\textbar",!0);u(d,w,R,"\u2225","\\|");u(d,w,R,"\u2225","\\Vert");u(G,w,R,"\u2225","\\textbardbl");u(G,w,R,"~","\\textasciitilde");u(G,w,R,"\\","\\textbackslash");u(G,w,R,"^","\\textasciicircum");u(d,w,P,"\u2191","\\uparrow",!0);u(d,w,P,"\u21D1","\\Uparrow",!0);u(d,w,P,"\u2193","\\downarrow",!0);u(d,w,P,"\u21D3","\\Downarrow",!0);u(d,w,P,"\u2195","\\updownarrow",!0);u(d,w,P,"\u21D5","\\Updownarrow",!0);u(d,w,at,"\u2210","\\coprod");u(d,w,at,"\u22C1","\\bigvee");u(d,w,at,"\u22C0","\\bigwedge");u(d,w,at,"\u2A04","\\biguplus");u(d,w,at,"\u22C2","\\bigcap");u(d,w,at,"\u22C3","\\bigcup");u(d,w,at,"\u222B","\\int");u(d,w,at,"\u222B","\\intop");u(d,w,at,"\u222C","\\iint");u(d,w,at,"\u222D","\\iiint");u(d,w,at,"\u220F","\\prod");u(d,w,at,"\u2211","\\sum");u(d,w,at,"\u2A02","\\bigotimes");u(d,w,at,"\u2A01","\\bigoplus");u(d,w,at,"\u2A00","\\bigodot");u(d,w,at,"\u222E","\\oint");u(d,w,at,"\u222F","\\oiint");u(d,w,at,"\u2230","\\oiiint");u(d,w,at,"\u2A06","\\bigsqcup");u(d,w,at,"\u222B","\\smallint");u(G,w,M0,"\u2026","\\textellipsis");u(d,w,M0,"\u2026","\\mathellipsis");u(G,w,M0,"\u2026","\\ldots",!0);u(d,w,M0,"\u2026","\\ldots",!0);u(d,w,M0,"\u22EF","\\@cdots",!0);u(d,w,M0,"\u22F1","\\ddots",!0);u(d,w,R,"\u22EE","\\varvdots");u(G,w,R,"\u22EE","\\varvdots");u(d,w,We,"\u02CA","\\acute");u(d,w,We,"\u02CB","\\grave");u(d,w,We,"\xA8","\\ddot");u(d,w,We,"~","\\tilde");u(d,w,We,"\u02C9","\\bar");u(d,w,We,"\u02D8","\\breve");u(d,w,We,"\u02C7","\\check");u(d,w,We,"^","\\hat");u(d,w,We,"\u20D7","\\vec");u(d,w,We,"\u02D9","\\dot");u(d,w,We,"\u02DA","\\mathring");u(d,w,ce,"\uE131","\\@imath");u(d,w,ce,"\uE237","\\@jmath");u(d,w,R,"\u0131","\u0131");u(d,w,R,"\u0237","\u0237");u(G,w,R,"\u0131","\\i",!0);u(G,w,R,"\u0237","\\j",!0);u(G,w,R,"\xDF","\\ss",!0);u(G,w,R,"\xE6","\\ae",!0);u(G,w,R,"\u0153","\\oe",!0);u(G,w,R,"\xF8","\\o",!0);u(G,w,R,"\xC6","\\AE",!0);u(G,w,R,"\u0152","\\OE",!0);u(G,w,R,"\xD8","\\O",!0);u(G,w,We,"\u02CA","\\'");u(G,w,We,"\u02CB","\\`");u(G,w,We,"\u02C6","\\^");u(G,w,We,"\u02DC","\\~");u(G,w,We,"\u02C9","\\=");u(G,w,We,"\u02D8","\\u");u(G,w,We,"\u02D9","\\.");u(G,w,We,"\xB8","\\c");u(G,w,We,"\u02DA","\\r");u(G,w,We,"\u02C7","\\v");u(G,w,We,"\xA8",'\\"');u(G,w,We,"\u02DD","\\H");u(G,w,We,"\u25EF","\\textcircled");em={"--":!0,"---":!0,"``":!0,"''":!0};u(G,w,R,"\u2013","--",!0);u(G,w,R,"\u2013","\\textendash");u(G,w,R,"\u2014","---",!0);u(G,w,R,"\u2014","\\textemdash");u(G,w,R,"\u2018","`",!0);u(G,w,R,"\u2018","\\textquoteleft");u(G,w,R,"\u2019","'",!0);u(G,w,R,"\u2019","\\textquoteright");u(G,w,R,"\u201C","``",!0);u(G,w,R,"\u201C","\\textquotedblleft");u(G,w,R,"\u201D","''",!0);u(G,w,R,"\u201D","\\textquotedblright");u(d,w,R,"\xB0","\\degree",!0);u(G,w,R,"\xB0","\\degree");u(G,w,R,"\xB0","\\textdegree",!0);u(d,w,R,"\xA3","\\pounds");u(d,w,R,"\xA3","\\mathsterling",!0);u(G,w,R,"\xA3","\\pounds");u(G,w,R,"\xA3","\\textsterling",!0);u(d,E,R,"\u2720","\\maltese");u(G,E,R,"\u2720","\\maltese");yu='0123456789/@."';for(Ka=0;Ka<yu.length;Ka++)kh=yu.charAt(Ka),u(d,w,R,kh,kh);Su='0123456789!@*()-=+";:?/.,';for(Za=0;Za<Su.length;Za++)Mh=Su.charAt(Za),u(G,w,R,Mh,Mh);ul="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(Qa=0;Qa<ul.length;Qa++)ca=ul.charAt(Qa),u(d,w,ce,ca,ca),u(G,w,R,ca,ca);u(d,E,R,"C","\u2102");u(G,E,R,"C","\u2102");u(d,E,R,"H","\u210D");u(G,E,R,"H","\u210D");u(d,E,R,"N","\u2115");u(G,E,R,"N","\u2115");u(d,E,R,"P","\u2119");u(G,E,R,"P","\u2119");u(d,E,R,"Q","\u211A");u(G,E,R,"Q","\u211A");u(d,E,R,"R","\u211D");u(G,E,R,"R","\u211D");u(d,E,R,"Z","\u2124");u(G,E,R,"Z","\u2124");u(d,w,ce,"h","\u210E");u(G,w,ce,"h","\u210E");we="";for(gt=0;gt<ul.length;gt++)Ue=ul.charAt(gt),we=String.fromCharCode(55349,56320+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56372+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56424+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56580+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56684+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56736+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56788+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56840+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56944+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),gt<26&&(we=String.fromCharCode(55349,56632+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56476+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we));we="\u{1D55C}";u(d,w,ce,"k",we);u(G,w,R,"k",we);for(xn=0;xn<10;xn++)Jr=xn.toString(),we=String.fromCharCode(55349,57294+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we),we=String.fromCharCode(55349,57314+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we),we=String.fromCharCode(55349,57324+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we),we=String.fromCharCode(55349,57334+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we);Fh="\xD0\xDE\xFE";for(el=0;el<Fh.length;el++)ua=Fh.charAt(el),u(d,w,ce,ua,ua),u(G,w,R,ua,ua);tl=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],ku=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],Fd=(r,e)=>{var t=r.charCodeAt(0),n=r.charCodeAt(1),s=(t-55296)*1024+(n-56320)+65536,i=e==="math"?0:1;if(119808<=s&&s<120484){var o=Math.floor((s-119808)/26);return[tl[o][2],tl[o][i]]}else if(120782<=s&&s<=120831){var a=Math.floor((s-120782)/10);return[ku[a][2],ku[a][i]]}else{if(s===120485||s===120486)return[tl[0][2],tl[0][i]];if(120486<s&&s<120782)return["",""];throw new J("Unsupported character: "+r)}},xl=function(e,t,n){if(Ge[n][e]){var s=Ge[n][e].replace;s&&(e=s)}return{value:e,metrics:Qh(e,t,n)}},zt=function(e,t,n,s,i){var o=xl(e,t,n),a=o.metrics;e=o.value;var l;if(a){var h=a.italic;(n==="text"||s&&s.font==="mathit")&&(h=0),l=new Pt(e,a.height,a.depth,h,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+n+"'")),l=new Pt(e,0,0,0,0,0,i);if(s){l.maxFontSize=s.sizeMultiplier,s.style.isTight()&&l.classes.push("mtight");var c=s.getColor();c&&(l.style.color=c)}return l},ec=function(e,t,n,s){return s===void 0&&(s=[]),n.font==="boldsymbol"&&xl(e,"Main-Bold",t).metrics?zt(e,"Main-Bold",t,n,s.concat(["mathbf"])):e==="\\"||Ge[t][e].font==="main"?zt(e,"Main-Regular",t,n,s):zt(e,"AMS-Regular",t,n,s.concat(["amsrm"]))},$d=function(e,t,n,s,i){return i!=="textord"&&xl(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},vl=function(e,t,n){var s=e.mode,i=e.text,o=["mord"],a=s==="math"||s==="text"&&t.font,l=a?t.font:t.fontFamily,h="",c="";if(i.charCodeAt(0)===55349&&([h,c]=Fd(i,s)),h.length>0)return zt(i,h,s,t,o.concat(c));if(l){var m,f;if(l==="boldsymbol"){var g=$d(i,s,t,o,n);m=g.fontName,f=[g.fontClass]}else a?(m=$h[l].fontName,f=[l]):(m=rl(l,t.fontWeight,t.fontShape),f=[l,t.fontWeight,t.fontShape]);if(xl(i,m,s).metrics)return zt(i,m,s,t,o.concat(f));if(em.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var b=[],x=0;x<i.length;x++)b.push(zt(i[x],m,s,t,o.concat(f)));return tn(b)}}if(n==="mathord")return zt(i,"Math-Italic",s,t,o.concat(["mathnormal"]));if(n==="textord"){var v=Ge[s][i]&&Ge[s][i].font;if(v==="ams"){var S=rl("amsrm",t.fontWeight,t.fontShape);return zt(i,S,s,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(v==="main"||!v){var k=rl("textrm",t.fontWeight,t.fontShape);return zt(i,k,s,t,o.concat(t.fontWeight,t.fontShape))}else{var M=rl(v,t.fontWeight,t.fontShape);return zt(i,M,s,t,o.concat(M,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},jd=(r,e)=>{if(Sn(r.classes)!==Sn(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize||r.italic!==0&&r.hasClass("mathnormal"))return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var n of Object.keys(r.style))if(r.style[n]!==e.style[n])return!1;for(var s of Object.keys(e.style))if(r.style[s]!==e.style[s])return!1;return!0},tm=r=>{for(var e=0;e<r.length-1;e++){var t=r[e],n=r[e+1];t instanceof Pt&&n instanceof Pt&&jd(t,n)&&(t.text+=n.text,t.height=Math.max(t.height,n.height),t.depth=Math.max(t.depth,n.depth),t.italic=n.italic,r.splice(e+1,1),e--)}return r},tc=function(e){for(var t=0,n=0,s=0,i=0;i<e.children.length;i++){var o=e.children[i];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=s},V=function(e,t,n,s){var i=new kn(e,t,n,s);return tc(i),i},Mn=(r,e,t,n)=>new kn(r,e,t,n),S0=function(e,t,n){var s=V([e],[],t);return s.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),s.style.borderBottomWidth=Q(s.height),s.maxFontSize=1,s},qd=function(e,t,n,s){var i=new y0(e,t,n,s);return tc(i),i},tn=function(e){var t=new yn(e);return tc(t),t},k0=function(e,t){return e instanceof yn?V([],[e],t):e},Hd=function(e){if(e.positionType==="individualShift"){for(var t=e.children,n=[t[0]],s=-t[0].shift-t[0].elem.depth,i=s,o=1;o<t.length;o++){var a=-t[o].shift-i-t[o].elem.depth,l=a-(t[o-1].elem.height+t[o-1].elem.depth);i=i+a,n.push({type:"kern",size:l}),n.push(t[o])}return{children:n,depth:s}}var h;if(e.positionType==="top"){for(var c=e.positionData,m=0;m<e.children.length;m++){var f=e.children[m];c-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}h=c}else if(e.positionType==="bottom")h=-e.positionData;else{var g=e.children[0];if(g.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")h=-g.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")h=-g.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:h}},Ne=function(e,t){for(var{children:n,depth:s}=Hd(e),i=0,o=0;o<n.length;o++){var a=n[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var h=V(["pstrut"],[]);h.style.height=Q(i);for(var c=[],m=s,f=s,g=s,b=0;b<n.length;b++){var x=n[b];if(x.type==="kern")g+=x.size;else{var v=x.elem,S=x.wrapperClasses||[],k=x.wrapperStyle||{},M=V(S,[h,v],void 0,k);M.style.top=Q(-i-g-v.depth),x.marginLeft&&(M.style.marginLeft=x.marginLeft),x.marginRight&&(M.style.marginRight=x.marginRight),c.push(M),g+=v.height+v.depth}m=Math.min(m,g),f=Math.max(f,g)}var _=V(["vlist"],c);_.style.height=Q(f);var B;if(m<0){var $=V([],[]),Y=V(["vlist"],[$]);Y.style.height=Q(-m);var Z=V(["vlist-s"],[new Pt("\u200B")]);B=[V(["vlist-r"],[_,Z]),V(["vlist-r"],[Y])]}else B=[V(["vlist-r"],[_])];var L=V(["vlist-t"],B);return B.length===2&&L.classes.push("vlist-t2"),L.height=f,L.depth=-m,L},rm=(r,e)=>{var t=V(["mspace"],[],e),n=Ke(r,e);return t.style.marginRight=Q(n),t},rl=function(e,t,n){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return t==="textbf"&&n==="textit"?i="BoldItalic":t==="textbf"?i="Bold":t==="textit"?i="Italic":i="Regular",s+"-"+i},$h={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},nm={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},sm=function(e,t){var[n,s,i]=nm[e],o=new Tr(n),a=new ar([o],{width:Q(s),height:Q(i),style:"width:"+Q(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=Mn(["overlay"],[a],t);return l.height=i,l.style.height=Q(i),l.style.width=Q(s),l},Je={number:3,unit:"mu"},e0={number:4,unit:"mu"},Kr={number:5,unit:"mu"},Yd={mord:{mop:Je,mbin:e0,mrel:Kr,minner:Je},mop:{mord:Je,mop:Je,mrel:Kr,minner:Je},mbin:{mord:e0,mop:e0,mopen:e0,minner:e0},mrel:{mord:Kr,mop:Kr,mopen:Kr,minner:Kr},mopen:{},mclose:{mop:Je,mbin:e0,mrel:Kr,minner:Je},mpunct:{mord:Je,mop:Je,mrel:Kr,mopen:Je,mclose:Je,mpunct:Je,minner:Je},minner:{mord:Je,mop:Je,mbin:e0,mrel:Kr,mopen:Je,mpunct:Je,minner:Je}},Xd={mord:{mop:Je},mop:{mord:Je,mop:Je},mbin:{},mrel:{},mopen:{},mclose:{mop:Je},mpunct:{},minner:{mop:Je}},im={},ml={},dl={};pl=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},ot=function(e){return e.type==="ordgroup"?e.body:[e]},Gd=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Wd=new Set(["rightmost","mrel","mclose","mpunct"]),Vd={display:Se.DISPLAY,text:Se.TEXT,script:Se.SCRIPT,scriptscript:Se.SCRIPTSCRIPT},Ud={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ct=function(e,t,n,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<e.length;o++){var a=Oe(e[o],t);if(a instanceof yn){var l=a.children;i.push(...l)}else i.push(a)}if(tm(i),!n)return i;var h=t;if(e.length===1){var c=e[0];c.type==="sizing"?h=t.havingSize(c.size):c.type==="styling"&&(h=t.havingStyle(Vd[c.style]))}var m=V([s[0]||"leftmost"],[],t),f=V([s[1]||"rightmost"],[],t),g=n==="root";return jh(i,(b,x)=>{var v=x.classes[0],S=b.classes[0];v==="mbin"&&Wd.has(S)?x.classes[0]="mord":S==="mbin"&&Gd.has(v)&&(b.classes[0]="mord")},{node:m},f,g),jh(i,(b,x)=>{var v,S,k=Hh(x),M=Hh(b),_=k&&M?b.hasClass("mtight")?(v=Xd[k])==null?void 0:v[M]:(S=Yd[k])==null?void 0:S[M]:null;if(_)return rm(_,h)},{node:m},f,g),i},jh=function(e,t,n,s,i){s&&e.push(s);for(var o=0;o<e.length;o++){var a=e[o],l=om(a);if(l){jh(l.children,t,n,null,i);continue}var h=!a.hasClass("mspace");if(h){var c=t(a,n.node);c&&(n.insertAfter?n.insertAfter(c):(e.unshift(c),o++))}h?n.node=a:i&&a.hasClass("newline")&&(n.node=V(["leftmost"])),n.insertAfter=(m=>f=>{e.splice(m+1,0,f),o++})(o)}s&&e.pop()},om=function(e){return e instanceof yn||e instanceof y0||e instanceof kn&&e.hasClass("enclosing")?e:null},qh=function(e,t){var n=om(e);if(n){var s=n.children;if(s.length){if(t==="right")return qh(s[s.length-1],"right");if(t==="left")return qh(s[0],"left")}}return e},Hh=function(e,t){if(!e)return null;t&&(e=qh(e,t));var n=e.classes[0];return Ud[n]||null},ba=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return V(t.concat(n))},Oe=function(e,t,n){if(!e)return V();if(ml[e.type]){var s=ml[e.type](e,t);if(n&&t.size!==n.size){s=V(t.sizingClasses(n),[s],t);var i=t.sizeMultiplier/n.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new J("Got group of unknown type: '"+e.type+"'")};K=class{constructor(e,t,n){this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=Sn(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Qe&&this.children[n+1]instanceof Qe){for(var s=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Qe;)s+=this.children[++n].toText();e.appendChild(new Qe(s).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=bt(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+bt(Sn(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}},Qe=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return bt(this.toText())}toText(){return this.text}},fl=class{constructor(e){this.width=e,e>=.05555&&e<=.05556?this.character="\u200A":e>=.1666&&e<=.1667?this.character="\u2009":e>=.2222&&e<=.2223?this.character="\u2005":e>=.2777&&e<=.2778?this.character="\u2005\u200A":e>=-.05556&&e<=-.05555?this.character="\u200A\u2063":e>=-.1667&&e<=-.1666?this.character="\u2009\u2063":e>=-.2223&&e<=-.2222?this.character="\u205F\u2063":e>=-.2778&&e<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Q(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Q(this.width)+'"/>'}toText(){return this.character?this.character:" "}},Jd=new Set(["\\imath","\\jmath"]),Kd=new Set(["mrow","mtable"]),Vt=function(e,t,n){return Ge[t][e]&&Ge[t][e].replace&&e.charCodeAt(0)!==55349&&!(em.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Ge[t][e].replace),new Qe(e)},rc=function(e){return e.length===1?e[0]:new K("mrow",e)},nc=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var n=t.font;if(!n||n==="mathnormal")return null;var s=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var i=e.text;if(Jd.has(i))return null;if(Ge[s][i]){var o=Ge[s][i].replace;o&&(i=o)}var a=$h[n].fontName;return Qh(i,a,s)?$h[n].variant:null};Ft=function(e,t,n){if(e.length===1){var s=je(e[0],t);return n&&s instanceof K&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,a=0;a<e.length;a++){var l=je(e[a],t);if(l instanceof K&&o instanceof K){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(zh(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&zh(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||zh(o))){var h=l.children[0];h instanceof K&&h.type==="mn"&&(h.children=[...o.children,...h.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var c=o.children[0];if(c instanceof Qe&&c.text==="\u0338"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var m=l.children[0];m instanceof Qe&&m.text.length>0&&(m.text=m.text.slice(0,1)+"\u0338"+m.text.slice(1),i.pop())}}}i.push(l),o=l}return i},zn=function(e,t,n){return rc(Ft(e,t,n))},je=function(e,t){if(!e)return new K("mrow");if(dl[e.type]){var n=dl[e.type](e,t);return n}else throw new J("Got group of unknown type: '"+e.type+"'")};Zd=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],zu=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Eu=function(e,t){return t.size<2?e:Zd[e-1][t.size-1]},gl=class r{constructor(e){this.style=e.style,this.color=e.color,this.size=e.size||r.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=zu[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(t,e),new r(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Eu(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:zu[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=Eu(r.BASESIZE,e);return this.size===t&&this.textSize===r.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==r.BASESIZE?["sizing","reset-size"+this.size,"size"+r.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Dd(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};gl.BASESIZE=6;lm=function(e){return new gl({style:e.displayMode?Se.DISPLAY:Se.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},hm=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=V(n,[e])}return e},Qd=function(e,t,n){var s=lm(n),i;if(n.output==="mathml")return Mu(e,t,s,n.displayMode,!0);if(n.output==="html"){var o=Yh(e,s);i=V(["katex"],[o])}else{var a=Mu(e,t,s,n.displayMode,!1),l=Yh(e,s);i=V(["katex"],[a,l])}return hm(i,n)},ep=function(e,t,n){var s=lm(n),i=Yh(e,s),o=V(["katex"],[i]);return hm(o,n)},tp={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",underbracket:"\u23B5",overbracket:"\u23B4",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",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},yl=function(e){var t=new K("mo",[new Qe(tp[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},rp={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"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,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"],"\\cdlongequal":[["longequal"],3,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],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["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],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},np=new Set(["widehat","widecheck","widetilde","utilde"]),Sl=function(e,t){function n(){var a=4e5,l=e.label.slice(1);if(np.has(l)){var h=e,c=h.base.type==="ordgroup"?h.base.body.length:1,m,f,g;if(c>5)l==="widehat"||l==="widecheck"?(m=420,a=2364,g=.42,f=l+"4"):(m=312,a=2340,g=.34,f="tilde4");else{var b=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][b],m=[0,239,300,360,420][b],g=[0,.24,.3,.3,.36,.42][b],f=l+b):(a=[0,600,1033,2339,2340][b],m=[0,260,286,306,312][b],g=[0,.26,.286,.3,.306,.34][b],f="tilde"+b)}var x=new Tr(f),v=new ar([x],{width:"100%",height:Q(g),viewBox:"0 0 "+a+" "+m,preserveAspectRatio:"none"});return{span:Mn([],[v],t),minWidth:0,height:g}}else{var S=[],k=rp[l],[M,_,B]=k,$=B/1e3,Y=M.length,Z,L;if(Y===1){var I=k[3];Z=["hide-tail"],L=[I]}else if(Y===2)Z=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(Y===3)Z=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
260
- `+Y+" children.");for(var X=0;X<Y;X++){var j=new Tr(M[X]),re=new ar([j],{width:"400em",height:Q($),viewBox:"0 0 "+a+" "+B,preserveAspectRatio:L[X]+" slice"}),te=Mn([Z[X]],[re],t);if(Y===1)return{span:te,minWidth:_,height:$};te.style.height=Q($),S.push(te)}return{span:V(["stretchy"],S,t),minWidth:_,height:$}}}var{span:s,minWidth:i,height:o}=n();return s.height=o,s.style.height=Q(o),i>0&&(s.style.minWidth=Q(i)),s},sp=function(e,t,n,s,i){var o,a=e.height+e.depth+n+s;if(/fbox|color|angl/.test(t)){if(o=V(["stretchy",t],[],i),t==="fbox"){var l=i.color&&i.getColor();l&&(o.style.borderColor=l)}}else{var h=[];/^[bx]cancel$/.test(t)&&h.push(new ga({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&h.push(new ga({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new ar(h,{width:"100%",height:Q(a)});o=Mn([],[c],i)}return o.height=a,o.style.height=Q(a),o};cm=r=>{if(r instanceof Pt)return r;if(Ld(r)&&r.children.length===1)return cm(r.children[0])},sc=(r,e)=>{var t,n,s;r&&r.type==="supsub"?(n=Ee(r.base,"accent"),t=n.base,r.base=t,s=Id(Oe(r,e)),r.base=n):(n=Ee(r,"accent"),t=n.base);var i=Oe(t,e.havingCrampedStyle()),o=n.isShifty&&Qr(t),a=0;if(o){var l,h;a=(l=(h=cm(i))==null?void 0:h.skew)!=null?l:0}var c=n.label==="\\c",m=c?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),f;if(n.isStretchy)f=Sl(n,e),f=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Q(2*a)+")",marginLeft:Q(2*a)}:void 0}]});else{var g,b;n.label==="\\vec"?(g=sm("vec",e),b=nm.vec[1]):(g=vl({type:"textord",mode:n.mode,text:n.label},e,"textord"),g=Cd(g),g.italic=0,b=g.width,c&&(m+=g.depth)),f=V(["accent-body"],[g]);var x=n.label==="\\textcircled";x&&(f.classes.push("accent-full"),m=i.height);var v=a;x||(v-=b/2),f.style.left=Q(v),n.label==="\\textcircled"&&(f.style.top=".2em"),f=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:f}]})}var S=V(["mord","accent"],[f],e);return s?(s.children[0]=S,s.height=Math.max(S.height,s.height),s.classes[0]="mord",s):S},um=(r,e)=>{var t=r.isStretchy?yl(r.label):new K("mo",[Vt(r.label,r.mode)]),n=new K("mover",[je(r.base,e),t]);return n.setAttribute("accent","true"),n},ip=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));ie({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(r,e)=>{var t=pl(e[0]),n=!ip.test(r.funcName),s=!n||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:n,isShifty:s,base:t}},htmlBuilder:sc,mathmlBuilder:um});ie({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],n=r.parser.mode;return n==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:sc,mathmlBuilder:um});ie({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0];return{type:"accentUnder",mode:t.mode,label:n,base:s}},htmlBuilder:(r,e)=>{var t=Oe(r.base,e),n=Sl(r,e),s=r.label==="\\utilde"?.12:0,i=Ne({positionType:"top",positionData:t.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:t}]});return V(["mord","accentunder"],[i],e)},mathmlBuilder:(r,e)=>{var t=yl(r.label),n=new K("munder",[je(r.base,e),t]);return n.setAttribute("accentunder","true"),n}});sl=r=>{var e=new K("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};ie({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n,funcName:s}=r;return{type:"xArrow",mode:n.mode,label:s,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,n=e.havingStyle(t.sup()),s=k0(Oe(r.body,n,e),e),i=r.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var o;r.below&&(n=e.havingStyle(t.sub()),o=k0(Oe(r.below,n,e),e),o.classes.push(i+"-arrow-pad"));var a=Sl(r,e),l=-e.fontMetrics().axisHeight+.5*a.height,h=-e.fontMetrics().axisHeight-.5*a.height-.111;(s.depth>.25||r.label==="\\xleftequilibrium")&&(h-=s.depth);var c;if(o){var m=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;c=Ne({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:m}]})}else c=Ne({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:a,shift:l}]});return c.children[0].children[0].children[1].classes.push("svg-align"),V(["mrel","x-arrow"],[c],e)},mathmlBuilder(r,e){var t=yl(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(r.body){var s=sl(je(r.body,e));if(r.below){var i=sl(je(r.below,e));n=new K("munderover",[t,i,s])}else n=new K("mover",[t,s])}else if(r.below){var o=sl(je(r.below,e));n=new K("munder",[t,o])}else n=sl(),n=new K("mover",[t,n]);return n}});ie({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+n.slice(5),body:ot(s),isCharacterBox:Qr(s)}},htmlBuilder:mm,mathmlBuilder:dm});zl=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};ie({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:zl(e[0]),body:ot(e[1]),isCharacterBox:Qr(e[1])}}});ie({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:n}=r,s=e[1],i=e[0],o;n!=="\\stackrel"?o=zl(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:ot(s)},l={type:"supsub",mode:i.mode,base:a,sup:n==="\\underset"?null:i,sub:n==="\\underset"?i:null};return{type:"mclass",mode:t.mode,mclass:o,body:[l],isCharacterBox:Qr(l)}},htmlBuilder:mm,mathmlBuilder:dm});ie({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:zl(e[0]),body:ot(e[0])}},htmlBuilder(r,e){var t=ct(r.body,e,!0),n=V([r.mclass],t,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(r,e){var t=Ft(r.body,e),n=new K("mstyle",t);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});op={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Pu=()=>({type:"styling",body:[],mode:"math",style:"display"}),Tu=r=>r.type==="textord"&&r.text==="@",ap=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;ie({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"cdlabel",mode:t.mode,side:n.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),n=k0(Oe(r.label,t,e),e);return n.classes.push("cd-label-"+r.side),n.style.bottom=Q(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(r,e){var t=new K("mrow",[je(r.label,e)]);return t=new K("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new K("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});ie({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=k0(Oe(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new K("mrow",[je(r.fragment,e)])}});ie({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,n=Ee(e[0],"ordgroup"),s=n.body,i="",o=0;o<s.length;o++){var a=Ee(s[o],"textord");i+=a.text}var l=parseInt(i),h;if(isNaN(l))throw new J("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new J("\\@char with invalid code point "+i);return l<=65535?h=String.fromCharCode(l):(l-=65536,h=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:h}}});pm=(r,e)=>{var t=ct(r.body,e.withColor(r.color),!1);return tn(t)},fm=(r,e)=>{var t=Ft(r.body,e.withColor(r.color)),n=new K("mstyle",t);return n.setAttribute("mathcolor",r.color),n};ie({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,n=Ee(e[0],"color-token").color,s=e[1];return{type:"color",mode:t.mode,color:n,body:ot(s)}},htmlBuilder:pm,mathmlBuilder:fm});ie({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:n}=r,s=Ee(e[0],"color-token").color;t.gullet.macros.set("\\current@color",s);var i=t.parseExpression(!0,n);return{type:"color",mode:t.mode,color:s,body:i}},htmlBuilder:pm,mathmlBuilder:fm});ie({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:n}=r,s=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,i=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:i,size:s&&Ee(s,"size").value}},htmlBuilder(r,e){var t=V(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=Q(Ke(r.size,e)))),t},mathmlBuilder(r,e){var t=new K("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",Q(Ke(r.size,e)))),t}});Xh={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},gm=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new J("Expected a control sequence",r);return e},cp=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},bm=(r,e,t,n)=>{var s=r.gullet.macros.get(t.text);s==null&&(t.noexpand=!0,s={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,s,n)};ie({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var n=e.fetch();if(Xh[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=Xh[n.text]),Ee(e.parseFunction(),"internal");throw new J("Invalid token after macro prefix",n)}});ie({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=e.gullet.popToken(),s=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new J("Expected a control sequence",n);for(var i=0,o,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[i].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new J('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==i+1)throw new J('Argument number "'+n.text+'" out of order');i++,a.push([])}else{if(n.text==="EOF")throw new J("Expected a macro definition");a[i].push(n.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(t==="\\edef"||t==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(s,{tokens:l,numArgs:i,delimiters:a},t===Xh[t]),{type:"internal",mode:e.mode}}});ie({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=gm(e.gullet.popToken());e.gullet.consumeSpaces();var s=cp(e);return bm(e,n,s,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});ie({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=gm(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return bm(e,n,i,t==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});ma=function(e,t,n){var s=Ge.math[e]&&Ge.math[e].replace,i=Qh(s||e,t,n);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return i},ic=function(e,t,n,s){var i=n.havingBaseStyle(t),o=V(s.concat(i.sizingClasses(n)),[e],n),a=i.sizeMultiplier/n.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},wm=function(e,t,n){var s=t.havingBaseStyle(n),i=(1-t.sizeMultiplier/s.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Q(i),e.height-=i,e.depth+=i},up=function(e,t,n,s,i,o){var a=zt(e,"Main-Regular",i,s),l=ic(a,t,s,o);return n&&wm(l,s,t),l},mp=function(e,t,n,s){return zt(e,"Size"+t+"-Regular",n,s)},xm=function(e,t,n,s,i,o){var a=mp(e,t,i,s),l=ic(V(["delimsizing","size"+t],[a],s),Se.TEXT,s,o);return n&&wm(l,s,Se.TEXT),l},Eh=function(e,t,n){var s;t==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=V(["delimsizinginner",s],[V([],[zt(e,t,n)])]);return{type:"elem",elem:i}},Ph=function(e,t,n){var s=Pr["Size4-Regular"][e.charCodeAt(0)]?Pr["Size4-Regular"][e.charCodeAt(0)][4]:Pr["Size1-Regular"][e.charCodeAt(0)][4],i=new Tr("inner",Td(e,Math.round(1e3*t))),o=new ar([i],{width:Q(s),height:Q(t),style:"width:"+Q(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=Mn([],[o],n);return a.height=t,a.style.height=Q(t),a.style.width=Q(s),{type:"elem",elem:a}},Gh=.008,il={type:"kern",size:-1*Gh},dp=new Set(["|","\\lvert","\\rvert","\\vert"]),pp=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),vm=function(e,t,n,s,i,o){var a,l,h,c,m="",f=0;a=h=c=e,l=null;var g="Size1-Regular";e==="\\uparrow"?h=c="\u23D0":e==="\\Uparrow"?h=c="\u2016":e==="\\downarrow"?a=h="\u23D0":e==="\\Downarrow"?a=h="\u2016":e==="\\updownarrow"?(a="\\uparrow",h="\u23D0",c="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",h="\u2016",c="\\Downarrow"):dp.has(e)?(h="\u2223",m="vert",f=333):pp.has(e)?(h="\u2225",m="doublevert",f=556):e==="["||e==="\\lbrack"?(a="\u23A1",h="\u23A2",c="\u23A3",g="Size4-Regular",m="lbrack",f=667):e==="]"||e==="\\rbrack"?(a="\u23A4",h="\u23A5",c="\u23A6",g="Size4-Regular",m="rbrack",f=667):e==="\\lfloor"||e==="\u230A"?(h=a="\u23A2",c="\u23A3",g="Size4-Regular",m="lfloor",f=667):e==="\\lceil"||e==="\u2308"?(a="\u23A1",h=c="\u23A2",g="Size4-Regular",m="lceil",f=667):e==="\\rfloor"||e==="\u230B"?(h=a="\u23A5",c="\u23A6",g="Size4-Regular",m="rfloor",f=667):e==="\\rceil"||e==="\u2309"?(a="\u23A4",h=c="\u23A5",g="Size4-Regular",m="rceil",f=667):e==="("||e==="\\lparen"?(a="\u239B",h="\u239C",c="\u239D",g="Size4-Regular",m="lparen",f=875):e===")"||e==="\\rparen"?(a="\u239E",h="\u239F",c="\u23A0",g="Size4-Regular",m="rparen",f=875):e==="\\{"||e==="\\lbrace"?(a="\u23A7",l="\u23A8",c="\u23A9",h="\u23AA",g="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="\u23AB",l="\u23AC",c="\u23AD",h="\u23AA",g="Size4-Regular"):e==="\\lgroup"||e==="\u27EE"?(a="\u23A7",c="\u23A9",h="\u23AA",g="Size4-Regular"):e==="\\rgroup"||e==="\u27EF"?(a="\u23AB",c="\u23AD",h="\u23AA",g="Size4-Regular"):e==="\\lmoustache"||e==="\u23B0"?(a="\u23A7",c="\u23AD",h="\u23AA",g="Size4-Regular"):(e==="\\rmoustache"||e==="\u23B1")&&(a="\u23AB",c="\u23A9",h="\u23AA",g="Size4-Regular");var b=ma(a,g,i),x=b.height+b.depth,v=ma(h,g,i),S=v.height+v.depth,k=ma(c,g,i),M=k.height+k.depth,_=0,B=1;if(l!==null){var $=ma(l,g,i);_=$.height+$.depth,B=2}var Y=x+M+_,Z=Math.max(0,Math.ceil((t-Y)/(B*S))),L=Y+Z*B*S,I=s.fontMetrics().axisHeight;n&&(I*=s.sizeMultiplier);var X=L/2-I,j=[];if(m.length>0){var re=L-x-M,te=Math.round(L*1e3),ke=Rd(m,Math.round(re*1e3)),he=new Tr(m,ke),ve=Q(f/1e3),de=Q(te/1e3),Fe=new ar([he],{width:ve,height:de,viewBox:"0 0 "+f+" "+te}),qe=Mn([],[Fe],s);qe.height=te/1e3,qe.style.width=ve,qe.style.height=de,j.push({type:"elem",elem:qe})}else{if(j.push(Eh(c,g,i)),j.push(il),l===null){var Ie=L-x-M+2*Gh;j.push(Ph(h,Ie,s))}else{var ge=(L-x-M-_)/2+2*Gh;j.push(Ph(h,ge,s)),j.push(il),j.push(Eh(l,g,i)),j.push(il),j.push(Ph(h,ge,s))}j.push(il),j.push(Eh(a,g,i))}var Me=s.havingBaseStyle(Se.TEXT),be=Ne({positionType:"bottom",positionData:X,children:j});return ic(V(["delimsizing","mult"],[be],Me),Se.TEXT,s,o)},Th=80,Rh=.08,Ah=function(e,t,n,s,i){var o=Pd(e,s,n),a=new Tr(e,o),l=new ar([a],{width:"400em",height:Q(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return Mn(["hide-tail"],[l],i)},fp=function(e,t){var n=t.havingBaseSizing(),s=zm("\\surd",e*n.sizeMultiplier,Mm,n),i=n.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),a,l=0,h=0,c=0,m;return s.type==="small"?(c=1e3+1e3*o+Th,e<1?i=1:e<1.4&&(i=.7),l=(1+o+Rh)/i,h=(1+o)/i,a=Ah("sqrtMain",l,c,o,t),a.style.minWidth="0.853em",m=.833/i):s.type==="large"?(c=(1e3+Th)*da[s.size],h=(da[s.size]+o)/i,l=(da[s.size]+o+Rh)/i,a=Ah("sqrtSize"+s.size,l,c,o,t),a.style.minWidth="1.02em",m=1/i):(l=e+o+Rh,h=e+o,c=Math.floor(1e3*e+o)+Th,a=Ah("sqrtTall",l,c,o,t),a.style.minWidth="0.742em",m=1.056),a.height=h,a.style.height=Q(l),{span:a,advanceWidth:m,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*i}},ym=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"]),gp=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"]),Sm=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),da=[0,1.2,1.8,2.4,3],km=function(e,t,n,s,i){if(e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle"),ym.has(e)||Sm.has(e))return xm(e,t,!1,n,s,i);if(gp.has(e))return vm(e,da[t],!1,n,s,i);throw new J("Illegal delimiter: '"+e+"'")},bp=[{type:"small",style:Se.SCRIPTSCRIPT},{type:"small",style:Se.SCRIPT},{type:"small",style:Se.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],wp=[{type:"small",style:Se.SCRIPTSCRIPT},{type:"small",style:Se.SCRIPT},{type:"small",style:Se.TEXT},{type:"stack"}],Mm=[{type:"small",style:Se.SCRIPTSCRIPT},{type:"small",style:Se.SCRIPT},{type:"small",style:Se.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],xp=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var t=e.type;throw new Error("Add support for delim type '"+t+"' here.")},zm=function(e,t,n,s){for(var i=Math.min(2,3-s.style.size),o=i;o<n.length;o++){var a=n[o];if(a.type==="stack")break;var l=ma(e,xp(a),"math"),h=l.height+l.depth;if(a.type==="small"){var c=s.havingBaseStyle(a.style);h*=c.sizeMultiplier}if(h>t)return a}return n[n.length-1]},Wh=function(e,t,n,s,i,o){e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle");var a;Sm.has(e)?a=bp:ym.has(e)?a=Mm:a=wp;var l=zm(e,t,a,s);return l.type==="small"?up(e,l.style,n,s,i,o):l.type==="large"?xm(e,l.size,n,s,i,o):vm(e,t,n,s,i,o)},_h=function(e,t,n,s,i,o){var a=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,h=5/s.fontMetrics().ptPerEm,c=Math.max(t-a,n+a),m=Math.max(c/500*l,2*c-h);return Wh(e,m,!0,s,i,o)},Ru={"\\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}},vp=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);ie({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(r,e)=>{var t=El(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:Ru[r.funcName].size,mclass:Ru[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?V([r.mclass]):km(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(Vt(r.delim,r.mode));var t=new K("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var n=Q(da[r.size]);return t.setAttribute("minsize",n),t.setAttribute("maxsize",n),t}});ie({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new J("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:El(e[0],r).text,color:t}}});ie({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=El(e[0],r),n=r.parser;++n.leftrightDepth;var s=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var i=Ee(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:s,left:t.text,right:i.delim,rightColor:i.color}},htmlBuilder:(r,e)=>{Au(r);for(var t=ct(r.body,e,!0,["mopen","mclose"]),n=0,s=0,i=!1,o=0;o<t.length;o++)t[o].isMiddle?i=!0:(n=Math.max(t[o].height,n),s=Math.max(t[o].depth,s));n*=e.sizeMultiplier,s*=e.sizeMultiplier;var a;if(r.left==="."?a=ba(e,["mopen"]):a=_h(r.left,n,s,e,r.mode,["mopen"]),t.unshift(a),i)for(var l=1;l<t.length;l++){var h=t[l],c=h.isMiddle;c&&(t[l]=_h(c.delim,n,s,c.options,r.mode,[]))}var m;if(r.right===".")m=ba(e,["mclose"]);else{var f=r.rightColor?e.withColor(r.rightColor):e;m=_h(r.right,n,s,f,r.mode,["mclose"])}return t.push(m),V(["minner"],t,e)},mathmlBuilder:(r,e)=>{Au(r);var t=Ft(r.body,e);if(r.left!=="."){var n=new K("mo",[Vt(r.left,r.mode)]);n.setAttribute("fence","true"),t.unshift(n)}if(r.right!=="."){var s=new K("mo",[Vt(r.right,r.mode)]);s.setAttribute("fence","true"),r.rightColor&&s.setAttribute("mathcolor",r.rightColor),t.push(s)}return rc(t)}});ie({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=El(e[0],r);if(!r.parser.leftrightDepth)throw new J("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=ba(e,[]);else{t=km(r.delim,1,e,r.mode,[]);var n={delim:r.delim,options:e};t.isMiddle=n}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?Vt("|","text"):Vt(r.delim,r.mode),n=new K("mo",[t]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});Pl=(r,e)=>{var t=k0(Oe(r.body,e),e),n=r.label.slice(1),s=e.sizeMultiplier,i,o=0,a=Qr(r.body);if(n==="sout")i=V(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,o=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=Ke({number:.6,unit:"pt"},e),h=Ke({number:.35,unit:"ex"},e),c=e.havingBaseSizing();s=s/c.sizeMultiplier;var m=t.height+t.depth+l+h;t.style.paddingLeft=Q(m/2+l);var f=Math.floor(1e3*m*s),g=zd(f),b=new ar([new Tr("phase",g)],{width:"400em",height:Q(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=Mn(["hide-tail"],[b],e),i.style.height=Q(m),o=t.depth+l+h}else{/cancel/.test(n)?a||t.classes.push("cancel-pad"):n==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var x=0,v=0,S=0;/box/.test(n)?(S=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),x=e.fontMetrics().fboxsep+(n==="colorbox"?0:S),v=x):n==="angl"?(S=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),x=4*S,v=Math.max(0,.25-t.depth)):(x=a?.2:0,v=x),i=sp(t,n,x,v,e),/fbox|boxed|fcolorbox/.test(n)?(i.style.borderStyle="solid",i.style.borderWidth=Q(S)):n==="angl"&&S!==.049&&(i.style.borderTopWidth=Q(S),i.style.borderRightWidth=Q(S)),o=t.depth+v,r.backgroundColor&&(i.style.backgroundColor=r.backgroundColor,r.borderColor&&(i.style.borderColor=r.borderColor))}var k;if(r.backgroundColor)k=Ne({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:t,shift:0}]});else{var M=/cancel|phase/.test(n)?["svg-align"]:[];k=Ne({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:M}]})}return/cancel/.test(n)&&(k.height=t.height,k.depth=t.depth),/cancel/.test(n)&&!a?V(["mord","cancel-lap"],[k],e):V(["mord"],[k],e)},Tl=(r,e)=>{var t=0,n=new K(r.label.includes("colorbox")?"mpadded":"menclose",[je(r.body,e)]);switch(r.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*t+"pt"),n.setAttribute("height","+"+2*t+"pt"),n.setAttribute("lspace",t+"pt"),n.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+Q(s)+" solid "+r.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&n.setAttribute("mathbackground",r.backgroundColor),n};ie({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:n,funcName:s}=r,i=Ee(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:n.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:n,funcName:s}=r,i=Ee(e[0],"color-token").color,o=Ee(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:s,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}});ie({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];return{type:"enclose",mode:t.mode,label:n,body:s}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r;t.mode==="math"&&t.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=e[0];return{type:"enclose",mode:t.mode,label:n,body:s}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});Em={};Pm={};_t=class r{constructor(e,t,n){this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new r(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}},Nt=class r{constructor(e,t){this.text=e,this.loc=t}range(e,t){return new r(t,_t.range(this,e))}};Rl=r=>{var e=r.parser.settings;if(!e.displayMode)throw new J("{"+r.envName+"} can be used only in display mode.")},yp=new Set(["gather","gather*"]);Ar=function(e,t){var n,s,i=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(i),h=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),m=1/t.fontMetrics().ptPerEm,f=5*m;if(e.colSeparationType&&e.colSeparationType==="small"){var g=t.havingStyle(Se.SCRIPT).sizeMultiplier;f=.2778*(g/t.sizeMultiplier)}var b=e.colSeparationType==="CD"?Ke({number:3,unit:"ex"},t):12*m,x=3*m,v=e.arraystretch*b,S=.7*v,k=.3*v,M=0;function _(Oa){for(var Fa=0;Fa<Oa.length;++Fa)Fa>0&&(M+=.25),h.push({pos:M,isDashed:Oa[Fa]})}for(_(o[0]),n=0;n<e.body.length;++n){var B=e.body[n],$=S,Y=k;a<B.length&&(a=B.length);var Z=new Array(B.length);for(s=0;s<B.length;++s){var L=Oe(B[s],t);Y<L.depth&&(Y=L.depth),$<L.height&&($=L.height),Z[s]=L}var I=e.rowGaps[n],X=0;I&&(X=Ke(I,t),X>0&&(X+=k,Y<X&&(Y=X),X=0)),e.addJot&&n<e.body.length-1&&(Y+=x),Z.height=$,Z.depth=Y,M+=$,Z.pos=M,M+=Y+X,l[n]=Z,_(o[n+1])}var j=M/2+t.fontMetrics().axisHeight,re=e.cols||[],te=[],ke,he,ve=[];if(e.tags&&e.tags.some(Oa=>Oa))for(n=0;n<i;++n){var de=l[n],Fe=de.pos-j,qe=e.tags[n],Ie=void 0;qe===!0?Ie=V(["eqn-num"],[],t):qe===!1?Ie=V([],[],t):Ie=V([],ct(qe,t,!0),t),Ie.depth=de.depth,Ie.height=de.height,ve.push({type:"elem",elem:Ie,shift:Fe})}for(s=0,he=0;s<a||he<re.length;++s,++he){for(var ge,Me=re[he],be=!0;((Be=Me)==null?void 0:Be.type)==="separator";){var Be;if(be||(ke=V(["arraycolsep"],[]),ke.style.width=Q(t.fontMetrics().doubleRuleSep),te.push(ke)),Me.separator==="|"||Me.separator===":"){var De=Me.separator==="|"?"solid":"dashed",ye=V(["vertical-separator"],[],t);ye.style.height=Q(M),ye.style.borderRightWidth=Q(c),ye.style.borderRightStyle=De,ye.style.margin="0 "+Q(-c/2);var _e=M-j;_e&&(ye.style.verticalAlign=Q(-_e)),te.push(ye)}else throw new J("Invalid separator type: "+Me.separator);he++,Me=re[he],be=!1}if(!(s>=a)){var Ae=void 0;if(s>0||e.hskipBeforeAndAfter){var Ze,bn;Ae=(Ze=(bn=Me)==null?void 0:bn.pregap)!=null?Ze:f,Ae!==0&&(ke=V(["arraycolsep"],[]),ke.style.width=Q(Ae),te.push(ke))}var ft=[];for(n=0;n<i;++n){var Rt=l[n],Te=Rt[s];if(Te){var nt=Rt.pos-j;Te.depth=Rt.depth,Te.height=Rt.height,ft.push({type:"elem",elem:Te,shift:nt})}}var ch=Ne({positionType:"individualShift",children:ft}),uh=V(["col-align-"+(((ge=Me)==null?void 0:ge.align)||"c")],[ch]);if(te.push(uh),s<a-1||e.hskipBeforeAndAfter){var Da,su;Ae=(Da=(su=Me)==null?void 0:su.postgap)!=null?Da:f,Ae!==0&&(ke=V(["arraycolsep"],[]),ke.style.width=Q(Ae),te.push(ke))}}}var Na=V(["mtable"],te);if(h.length>0){for(var q1=S0("hline",t,c),H1=S0("hdashline",t,c),mh=[{type:"elem",elem:Na,shift:0}];h.length>0;){var iu=h.pop(),ou=iu.pos-j;iu.isDashed?mh.push({type:"elem",elem:H1,shift:ou}):mh.push({type:"elem",elem:q1,shift:ou})}Na=Ne({positionType:"individualShift",children:mh})}if(ve.length===0)return V(["mord"],[Na],t);var Y1=Ne({positionType:"individualShift",children:ve}),X1=V(["tag"],[Y1],t);return tn([Na,X1])},Sp={c:"center ",l:"left ",r:"right "},_r=function(e,t){for(var n=[],s=new K("mtd",[],["mtr-glue"]),i=new K("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],h=0;h<a.length;h++)l.push(new K("mtd",[je(a[h],t)]));e.tags&&e.tags[o]&&(l.unshift(s),l.push(s),e.leqno?l.unshift(i):l.push(i)),n.push(new K("mtr",l))}var c=new K("mtable",n),m=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",Q(m));var f="",g="";if(e.cols&&e.cols.length>0){var b=e.cols,x="",v=!1,S=0,k=b.length;b[0].type==="separator"&&(f+="top ",S=1),b[b.length-1].type==="separator"&&(f+="bottom ",k-=1);for(var M=S;M<k;M++){var _=b[M];_.type==="align"?(g+=Sp[_.align],v&&(x+="none "),v=!0):_.type==="separator"&&v&&(x+=_.separator==="|"?"solid ":"dashed ",v=!1)}c.setAttribute("columnalign",g.trim()),/[sd]/.test(x)&&c.setAttribute("columnlines",x.trim())}if(e.colSeparationType==="align"){for(var B=e.cols||[],$="",Y=1;Y<B.length;Y++)$+=Y%2?"0em ":"1em ";c.setAttribute("columnspacing",$.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?c.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?c.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var Z="",L=e.hLinesBeforeRow;f+=L[0].length>0?"left ":"",f+=L[L.length-1].length>0?"right ":"";for(var I=1;I<L.length-1;I++)Z+=L[I].length===0?"none ":L[I][0]?"dashed ":"solid ";return/[sd]/.test(Z)&&c.setAttribute("rowlines",Z.trim()),f!==""&&(c=new K("menclose",[c]),c.setAttribute("notation",f.trim())),e.arraystretch&&e.arraystretch<1&&(c=new K("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},Tm=function(e,t){e.envName.includes("ed")||Rl(e);var n=[],s=e.envName.includes("at")?"alignat":"align",i=e.envName==="split",o=En(e.parser,{cols:n,addJot:!0,autoTag:i?void 0:oc(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),a=0,l=0,h={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var c="",m=0;m<t[0].body.length;m++){var f=Ee(t[0].body[m],"textord");c+=f.text}a=Number(c),l=a*2}var g=!l;o.body.forEach(function(S){for(var k=1;k<S.length;k+=2){var M=Ee(S[k],"styling"),_=Ee(M.body[0],"ordgroup");_.body.unshift(h)}if(g)l<S.length&&(l=S.length);else{var B=S.length/2;if(a<B)throw new J("Too many math in a row: "+("expected "+a+", but got "+B),S[0])}});for(var b=0;b<l;++b){var x="r",v=0;b%2===1?x="l":b>0&&g&&(v=1),n[b]={type:"align",align:x,pregap:v,postgap:0}}return o.colSeparationType=g?"align":"alignat",o};Rr({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=Ml(e[0]),n=t?[e[0]]:Ee(e[0],"ordgroup").body,s=n.map(function(o){var a=kl(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new J("Unknown column alignment: "+l,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return En(r.parser,i,ac(r.envName))},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var s=r.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),t=s.fetch().text,!"lcr".includes(t))throw new J("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),n.cols=[{type:"align",align:t}]}}var i=En(r.parser,n,ac(r.envName)),o=Math.max(0,...i.body.map(a=>a.length));return i.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=En(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=Ml(e[0]),n=t?[e[0]]:Ee(e[0],"ordgroup").body,s=n.map(function(a){var l=kl(a),h=l.text;if("lc".includes(h))return{type:"align",align:h};throw new J("Unknown column alignment: "+h,a)});if(s.length>1)throw new J("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=En(r.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new J("{subarray} can contain only one column");return o},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=En(r.parser,e,ac(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.includes("r")?".":"\\{",right:r.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Tm,htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){yp.has(r.envName)&&Rl(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:oc(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return En(r.parser,e,"display")},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Tm,htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){Rl(r);var e={autoTag:oc(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return En(r.parser,e,"display")},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["CD"],props:{numArgs:0},handler(r){return Rl(r),hp(r.parser)},htmlBuilder:Ar,mathmlBuilder:_r});y("\\nonumber","\\gdef\\@eqnsw{0}");y("\\notag","\\nonumber");ie({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new J(r.funcName+" valid only within array environment")}});Bu=Em;ie({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];if(s.type!=="ordgroup")throw new J("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=Ee(s.body[o],"textord").text;if(n==="\\begin"){if(!Bu.hasOwnProperty(i))throw new J("No such environment: "+i,s);var a=Bu[i],{args:l,optArgs:h}=t.parseArguments("\\begin{"+i+"}",a),c={mode:t.mode,envName:i,parser:t},m=a.handler(c,l,h);t.expect("\\end",!1);var f=t.nextToken,g=Ee(t.parseFunction(),"environment");if(g.name!==i)throw new J("Mismatch: \\begin{"+i+"} matched by \\end{"+g.name+"}",f);return m}return{type:"environment",mode:t.mode,name:i,nameGroup:s}}});Rm=(r,e)=>{var t=r.font,n=e.withFont(t);return Oe(r.body,n)},Am=(r,e)=>{var t=r.font,n=e.withFont(t);return je(r.body,n)},Cu={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};ie({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=pl(e[0]),i=n;return i in Cu&&(i=Cu[i]),{type:"font",mode:t.mode,font:i.slice(1),body:s}},htmlBuilder:Rm,mathmlBuilder:Am});ie({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"mclass",mode:t.mode,mclass:zl(n),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:n}],isCharacterBox:Qr(n)}}});ie({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,breakOnTokenText:s}=r,{mode:i}=t,o=t.parseExpression(!0,s),a="math"+n.slice(1);return{type:"font",mode:i,font:a,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:Rm,mathmlBuilder:Am});kp=(r,e)=>{var t=e.style,n=t.fracNum(),s=t.fracDen(),i;i=e.havingStyle(n);var o=Oe(r.numer,i,e);if(r.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}i=e.havingStyle(s);var h=Oe(r.denom,i,e),c,m,f;r.hasBarLine?(r.barSize?(m=Ke(r.barSize,e),c=S0("frac-line",e,m)):c=S0("frac-line",e),m=c.height,f=c.height):(c=null,m=0,f=e.fontMetrics().defaultRuleThickness);var g,b,x;t.size===Se.DISPLAY.size?(g=e.fontMetrics().num1,m>0?b=3*f:b=7*f,x=e.fontMetrics().denom1):(m>0?(g=e.fontMetrics().num2,b=f):(g=e.fontMetrics().num3,b=3*f),x=e.fontMetrics().denom2);var v;if(c){var k=e.fontMetrics().axisHeight;g-o.depth-(k+.5*m)<b&&(g+=b-(g-o.depth-(k+.5*m))),k-.5*m-(h.height-x)<b&&(x+=b-(k-.5*m-(h.height-x)));var M=-(k-.5*m);v=Ne({positionType:"individualShift",children:[{type:"elem",elem:h,shift:x},{type:"elem",elem:c,shift:M},{type:"elem",elem:o,shift:-g}]})}else{var S=g-o.depth-(h.height-x);S<b&&(g+=.5*(b-S),x+=.5*(b-S)),v=Ne({positionType:"individualShift",children:[{type:"elem",elem:h,shift:x},{type:"elem",elem:o,shift:-g}]})}i=e.havingStyle(t),v.height*=i.sizeMultiplier/e.sizeMultiplier,v.depth*=i.sizeMultiplier/e.sizeMultiplier;var _;t.size===Se.DISPLAY.size?_=e.fontMetrics().delim1:t.size===Se.SCRIPTSCRIPT.size?_=e.havingStyle(Se.SCRIPT).fontMetrics().delim2:_=e.fontMetrics().delim2;var B,$;return r.leftDelim==null?B=ba(e,["mopen"]):B=Wh(r.leftDelim,_,!0,e.havingStyle(t),r.mode,["mopen"]),r.continued?$=V([]):r.rightDelim==null?$=ba(e,["mclose"]):$=Wh(r.rightDelim,_,!0,e.havingStyle(t),r.mode,["mclose"]),V(["mord"].concat(i.sizingClasses(e)),[B,V(["mfrac"],[v]),$],e)},Mp=(r,e)=>{var t=new K("mfrac",[je(r.numer,e),je(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var n=Ke(r.barSize,e);t.setAttribute("linethickness",Q(n))}if(r.leftDelim!=null||r.rightDelim!=null){var s=[];if(r.leftDelim!=null){var i=new K("mo",[new Qe(r.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(t),r.rightDelim!=null){var o=new K("mo",[new Qe(r.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return rc(s)}return t},_m=(r,e)=>{if(!e)return r;var t={type:"styling",mode:r.mode,style:e,body:[r]};return t};ie({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0],i=e[1],o,a=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var h=n==="\\cfrac",c=null;return h||n.startsWith("\\d")?c="display":n.startsWith("\\t")&&(c="text"),_m({type:"genfrac",mode:t.mode,numer:s,denom:i,continued:h,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},c)},htmlBuilder:kp,mathmlBuilder:Mp});ie({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:n}=r,s;switch(t){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:n}}});Iu=["display","text","script","scriptscript"],Lu=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};ie({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,n=e[4],s=e[5],i=pl(e[0]),o=i.type==="atom"&&i.family==="open"?Lu(i.text):null,a=pl(e[1]),l=a.type==="atom"&&a.family==="close"?Lu(a.text):null,h=Ee(e[2],"size"),c,m=null;h.isBlank?c=!0:(m=h.value,c=m.number>0);var f=null,g=e[3];if(g.type==="ordgroup"){if(g.body.length>0){var b=Ee(g.body[0],"textord");f=Iu[Number(b.text)]}}else g=Ee(g,"textord"),f=Iu[Number(g.text)];return _m({type:"genfrac",mode:t.mode,numer:n,denom:s,continued:!1,hasBarLine:c,barSize:m,leftDelim:o,rightDelim:l},f)}});ie({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:n,token:s}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:Ee(e[0],"size").value,token:s}}});ie({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0],i=Ee(e[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=e[2],a=i.number>0;return{type:"genfrac",mode:t.mode,numer:s,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});Bm=(r,e)=>{var t=e.style,n,s;r.type==="supsub"?(n=r.sup?Oe(r.sup,e.havingStyle(t.sup()),e):Oe(r.sub,e.havingStyle(t.sub()),e),s=Ee(r.base,"horizBrace")):s=Ee(r,"horizBrace");var i=Oe(s.base,e.havingBaseStyle(Se.DISPLAY)),o=Sl(s,e),a;if(s.isOver?(a=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o}]}),a.children[0].children[0].children[1].classes.push("svg-align")):(a=Ne({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:i}]}),a.children[0].children[0].children[0].classes.push("svg-align")),n){var l=V(["minner",s.isOver?"mover":"munder"],[a],e);s.isOver?a=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):a=Ne({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return V(["minner",s.isOver?"mover":"munder"],[a],e)},zp=(r,e)=>{var t=yl(r.label);return new K(r.isOver?"mover":"munder",[je(r.base,e),t])};ie({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"horizBrace",mode:t.mode,label:n,isOver:n.includes("\\over"),base:e[0]}},htmlBuilder:Bm,mathmlBuilder:zp});ie({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[1],s=Ee(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:t.mode,href:s,body:ot(n)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=ct(r.body,e,!1);return qd(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=zn(r.body,e);return t instanceof K||(t=new K("mrow",[t])),t.setAttribute("href",r.href),t}});ie({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=Ee(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:n}))return t.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:t.mode,font:"\\texttt",body:s};return{type:"href",mode:t.mode,href:n,body:ot(a)}}});ie({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(r,e){var{parser:t}=r;return{type:"hbox",mode:t.mode,body:ot(e[0])}},htmlBuilder(r,e){var t=ct(r.body,e,!1);return tn(t)},mathmlBuilder(r,e){return new K("mrow",Ft(r.body,e))}});ie({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,token:s}=r,i=Ee(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(n){case"\\htmlClass":l.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),c=0;c<h.length;c++){var m=h[c],f=m.indexOf("=");if(f<0)throw new J("\\htmlData key/value '"+m+"' missing equals sign");var g=m.slice(0,f),b=m.slice(f+1);l["data-"+g.trim()]=b}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(a)?{type:"html",mode:t.mode,attributes:l,body:ot(o)}:t.formatUnsupportedCmd(n)},htmlBuilder:(r,e)=>{var t=ct(r.body,e,!1),n=["enclosing"];r.attributes.class&&n.push(...r.attributes.class.trim().split(/\s+/));var s=V(n,t,e);for(var i in r.attributes)i!=="class"&&r.attributes.hasOwnProperty(i)&&s.setAttribute(i,r.attributes[i]);return s},mathmlBuilder:(r,e)=>zn(r.body,e)});ie({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:ot(e[0]),mathml:ot(e[1])}},htmlBuilder:(r,e)=>{var t=ct(r.html,e,!1);return tn(t)},mathmlBuilder:(r,e)=>zn(r.mathml,e)});Bh=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new J("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!Uu(n))throw new J("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};ie({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:n}=r,s={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(t[0])for(var l=Ee(t[0],"raw").string,h=l.split(","),c=0;c<h.length;c++){var m=h[c].split("=");if(m.length===2){var f=m[1].trim();switch(m[0].trim()){case"alt":a=f;break;case"width":s=Bh(f);break;case"height":i=Bh(f);break;case"totalheight":o=Bh(f);break;default:throw new J("Invalid key: '"+m[0]+"' in \\includegraphics.")}}}var g=Ee(e[0],"url").url;return a===""&&(a=g,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:g})?{type:"includegraphics",mode:n.mode,alt:a,width:s,height:i,totalheight:o,src:g}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(r,e)=>{var t=Ke(r.height,e),n=0;r.totalheight.number>0&&(n=Ke(r.totalheight,e)-t);var s=0;r.width.number>0&&(s=Ke(r.width,e));var i={height:Q(t+n)};s>0&&(i.width=Q(s)),n>0&&(i.verticalAlign=Q(-n));var o=new Oh(r.src,r.alt,i);return o.height=t,o.depth=n,o},mathmlBuilder:(r,e)=>{var t=new K("mglyph",[]);t.setAttribute("alt",r.alt);var n=Ke(r.height,e),s=0;if(r.totalheight.number>0&&(s=Ke(r.totalheight,e)-n,t.setAttribute("valign",Q(-s))),t.setAttribute("height",Q(n+s)),r.width.number>0){var i=Ke(r.width,e);t.setAttribute("width",Q(i))}return t.setAttribute("src",r.src),t}});ie({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,s=Ee(e[0],"size");if(t.settings.strict){var i=n[1]==="m",o=s.value.unit==="mu";i?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+s.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:s.value}},htmlBuilder(r,e){return rm(r.dimension,e)},mathmlBuilder(r,e){var t=Ke(r.dimension,e);return new fl(t)}});ie({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0];return{type:"lap",mode:t.mode,alignment:n.slice(5),body:s}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=V([],[Oe(r.body,e)]),t=V(["inner"],[t],e)):t=V(["inner"],[Oe(r.body,e)]);var n=V(["fix"],[]),s=V([r.alignment],[t,n],e),i=V(["strut"]);return i.style.height=Q(s.height+s.depth),s.depth&&(i.style.verticalAlign=Q(-s.depth)),s.children.unshift(i),s=V(["thinbox"],[s],e),V(["mord","vbox"],[s],e)},mathmlBuilder:(r,e)=>{var t=new K("mpadded",[je(r.body,e)]);if(r.alignment!=="rlap"){var n=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",n+"width")}return t.setAttribute("width","0px"),t}});ie({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:n}=r,s=n.mode;n.switchMode("math");var i=t==="\\("?"\\)":"$",o=n.parseExpression(!1,i);return n.expect(i),n.switchMode(s),{type:"styling",mode:n.mode,style:"text",body:o}}});ie({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new J("Mismatched "+r.funcName)}});Du=(r,e)=>{switch(e.style.size){case Se.DISPLAY.size:return r.display;case Se.TEXT.size:return r.text;case Se.SCRIPT.size:return r.script;case Se.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};ie({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:ot(e[0]),text:ot(e[1]),script:ot(e[2]),scriptscript:ot(e[3])}},htmlBuilder:(r,e)=>{var t=Du(r,e),n=ct(t,e,!1);return tn(n)},mathmlBuilder:(r,e)=>{var t=Du(r,e);return zn(t,e)}});Cm=(r,e,t,n,s,i,o)=>{r=V([],[r]);var a=t&&Qr(t),l,h;if(e){var c=Oe(e,n.havingStyle(s.sup()),n);h={elem:c,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-c.depth)}}if(t){var m=Oe(t,n.havingStyle(s.sub()),n);l={elem:m,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-m.height)}}var f;if(h&&l){var g=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+r.depth+o;f=Ne({positionType:"bottom",positionData:g,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Q(-i)},{type:"kern",size:l.kern},{type:"elem",elem:r},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Q(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var b=r.height-o;f=Ne({positionType:"top",positionData:b,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Q(-i)},{type:"kern",size:l.kern},{type:"elem",elem:r}]})}else if(h){var x=r.depth+o;f=Ne({positionType:"bottom",positionData:x,children:[{type:"elem",elem:r},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Q(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return r;var v=[f];if(l&&i!==0&&!a){var S=V(["mspace"],[],n);S.style.marginRight=Q(i),v.unshift(S)}return V(["mop","op-limits"],v,n)},Im=new Set(["\\smallint"]),z0=(r,e)=>{var t,n,s=!1,i;r.type==="supsub"?(t=r.sup,n=r.sub,i=Ee(r.base,"op"),s=!0):i=Ee(r,"op");var o=e.style,a=!1;o.size===Se.DISPLAY.size&&i.symbol&&!Im.has(i.name)&&(a=!0);var l;if(i.symbol){var h=a?"Size2-Regular":"Size1-Regular",c="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(c=i.name.slice(1),i.name=c==="oiint"?"\\iint":"\\iiint"),l=zt(i.name,h,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),c.length>0){var m=l.italic,f=sm(c+"Size"+(a?"2":"1"),e);l=Ne({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+c,l.classes.unshift("mop"),l.italic=m}}else if(i.body){var g=ct(i.body,e,!0);g.length===1&&g[0]instanceof Pt?(l=g[0],l.classes[0]="mop"):l=V(["mop"],g,e)}else{for(var b=[],x=1;x<i.name.length;x++)b.push(ec(i.name[x],i.mode,e));l=V(["mop"],b,e)}var v=0,S=0;return(l instanceof Pt||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift&&(v=(l.height-l.depth)/2-e.fontMetrics().axisHeight,S=l.italic||0),s?Cm(l,t,n,e,o,S,v):(v&&(l.style.position="relative",l.style.top=Q(v)),l)},xa=(r,e)=>{var t;if(r.symbol)t=new K("mo",[Vt(r.name,r.mode)]),Im.has(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new K("mo",Ft(r.body,e));else{t=new K("mi",[new Qe(r.name.slice(1))]);var n=new K("mo",[Vt("\u2061","text")]);r.parentIsSupSub?t=new K("mrow",[t,n]):t=am([t,n])}return t},Ep={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};ie({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=n;return s.length===1&&(s=Ep[s]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:z0,mathmlBuilder:xa});ie({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ot(n)}},htmlBuilder:z0,mathmlBuilder:xa});Pp={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};ie({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:z0,mathmlBuilder:xa});ie({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:z0,mathmlBuilder:xa});ie({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,n=t;return n.length===1&&(n=Pp[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:z0,mathmlBuilder:xa});Lm=(r,e)=>{var t,n,s=!1,i;r.type==="supsub"?(t=r.sup,n=r.sub,i=Ee(r.base,"operatorname"),s=!0):i=Ee(r,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(m=>{var f="text"in m?m.text:void 0;return typeof f=="string"?{type:"textord",mode:m.mode,text:f}:m}),l=ct(a,e.withFont("mathrm"),!0),h=0;h<l.length;h++){var c=l[h];c instanceof Pt&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=V(["mop"],l,e)}else o=V(["mop"],[],e);return s?Cm(o,t,n,e,e.style,0,0):o},Tp=(r,e)=>{for(var t=Ft(r.body,e.withFont("mathrm")),n=!0,s=0;s<t.length;s++){var i=t[s];if(!(i instanceof fl))if(i instanceof K)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=i.children[0];i.children.length===1&&o instanceof Qe?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=t.map(c=>c.toText()).join("");t=[new Qe(a)]}var l=new K("mi",t);l.setAttribute("mathvariant","normal");var h=new K("mo",[Vt("\u2061","text")]);return r.parentIsSupSub?new K("mrow",[l,h]):am([l,h])};ie({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0];return{type:"operatorname",mode:t.mode,body:ot(s),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Lm,mathmlBuilder:Tp});y("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");t0({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?tn(ct(r.body,e,!1)):V(["mord"],ct(r.body,e,!0),e)},mathmlBuilder(r,e){return zn(r.body,e,!0)}});ie({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,n=e[0];return{type:"overline",mode:t.mode,body:n}},htmlBuilder(r,e){var t=Oe(r.body,e.havingCrampedStyle()),n=S0("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*s},{type:"elem",elem:n},{type:"kern",size:s}]});return V(["mord","overline"],[i],e)},mathmlBuilder(r,e){var t=new K("mo",[new Qe("\u203E")]);t.setAttribute("stretchy","true");var n=new K("mover",[je(r.body,e),t]);return n.setAttribute("accent","true"),n}});ie({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"phantom",mode:t.mode,body:ot(n)}},htmlBuilder:(r,e)=>{var t=ct(r.body,e.withPhantom(),!1);return tn(t)},mathmlBuilder:(r,e)=>{var t=Ft(r.body,e);return new K("mphantom",t)}});y("\\hphantom","\\smash{\\phantom{#1}}");ie({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"vphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=V(["inner"],[Oe(r.body,e.withPhantom())]),n=V(["fix"],[]);return V(["mord","rlap"],[t,n],e)},mathmlBuilder:(r,e)=>{var t=Ft(ot(r.body),e),n=new K("mphantom",t),s=new K("mpadded",[n]);return s.setAttribute("width","0px"),s}});ie({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,n=Ee(e[0],"size").value,s=e[1];return{type:"raisebox",mode:t.mode,dy:n,body:s}},htmlBuilder(r,e){var t=Oe(r.body,e),n=Ke(r.dy,e);return Ne({positionType:"shift",positionData:-n,children:[{type:"elem",elem:t}]})},mathmlBuilder(r,e){var t=new K("mpadded",[je(r.body,e)]),n=r.dy.number+r.dy.unit;return t.setAttribute("voffset",n),t}});ie({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}});ie({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:n}=r,s=t[0],i=Ee(e[0],"size"),o=Ee(e[1],"size");return{type:"rule",mode:n.mode,shift:s&&Ee(s,"size").value,width:i.value,height:o.value}},htmlBuilder(r,e){var t=V(["mord","rule"],[],e),n=Ke(r.width,e),s=Ke(r.height,e),i=r.shift?Ke(r.shift,e):0;return t.style.borderRightWidth=Q(n),t.style.borderTopWidth=Q(s),t.style.bottom=Q(i),t.width=n,t.height=s+i,t.depth=-i,t.maxFontSize=s*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=Ke(r.width,e),n=Ke(r.height,e),s=r.shift?Ke(r.shift,e):0,i=e.color&&e.getColor()||"black",o=new K("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Q(t)),o.setAttribute("height",Q(n));var a=new K("mpadded",[o]);return s>=0?a.setAttribute("height",Q(s)):(a.setAttribute("height",Q(s)),a.setAttribute("depth",Q(-s))),a.setAttribute("voffset",Q(s)),a}});Nu=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Rp=(r,e)=>{var t=e.havingSize(r.size);return Dm(r.body,t,e)};ie({type:"sizing",names:Nu,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:n,parser:s}=r,i=s.parseExpression(!1,t);return{type:"sizing",mode:s.mode,size:Nu.indexOf(n)+1,body:i}},htmlBuilder:Rp,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),n=Ft(r.body,t),s=new K("mstyle",n);return s.setAttribute("mathsize",Q(t.sizeMultiplier)),s}});ie({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:n}=r,s=!1,i=!1,o=t[0]&&Ee(t[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var h=o.body[l];if(a=kl(h).text,a==="t")s=!0;else if(a==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var c=e[0];return{type:"smash",mode:n.mode,body:c,smashHeight:s,smashDepth:i}},htmlBuilder:(r,e)=>{var t=V([],[Oe(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0),r.smashDepth&&(t.depth=0),r.smashHeight&&r.smashDepth)return V(["mord","smash"],[t],e);if(t.children)for(var n=0;n<t.children.length;n++)r.smashHeight&&(t.children[n].height=0),r.smashDepth&&(t.children[n].depth=0);var s=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:t}]});return V(["mord"],[s],e)},mathmlBuilder:(r,e)=>{var t=new K("mpadded",[je(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}});ie({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n}=r,s=t[0],i=e[0];return{type:"sqrt",mode:n.mode,body:i,index:s}},htmlBuilder(r,e){var t=Oe(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=k0(t,e);var n=e.fontMetrics(),s=n.defaultRuleThickness,i=s;e.style.id<Se.TEXT.id&&(i=e.fontMetrics().xHeight);var o=s+i/4,a=t.height+t.depth+o+s,{span:l,ruleWidth:h,advanceWidth:c}=fp(a,e),m=l.height-h;m>t.height+t.depth+o&&(o=(o+m-t.height-t.depth)/2);var f=l.height-t.height-o-h;t.style.paddingLeft=Q(c);var g=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+f)},{type:"elem",elem:l},{type:"kern",size:h}]});if(r.index){var b=e.havingStyle(Se.SCRIPTSCRIPT),x=Oe(r.index,b,e),v=.6*(g.height-g.depth),S=Ne({positionType:"shift",positionData:-v,children:[{type:"elem",elem:x}]}),k=V(["root"],[S]);return V(["mord","sqrt"],[k,g],e)}else return V(["mord","sqrt"],[g],e)},mathmlBuilder(r,e){var{body:t,index:n}=r;return n?new K("mroot",[je(t,e),je(n,e)]):new K("msqrt",[je(t,e)])}});Ou={display:Se.DISPLAY,text:Se.TEXT,script:Se.SCRIPT,scriptscript:Se.SCRIPTSCRIPT};ie({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:n,parser:s}=r,i=s.parseExpression(!0,t),o=n.slice(1,n.length-5);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(r,e){var t=Ou[r.style],n=e.havingStyle(t).withFont("");return Dm(r.body,n,e)},mathmlBuilder(r,e){var t=Ou[r.style],n=e.havingStyle(t),s=Ft(r.body,n),i=new K("mstyle",s),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[r.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});Ap=function(e,t){var n=e.base;if(n)if(n.type==="op"){var s=n.limits&&(t.style.size===Se.DISPLAY.size||n.alwaysHandleSupSub);return s?z0:null}else if(n.type==="operatorname"){var i=n.alwaysHandleSupSub&&(t.style.size===Se.DISPLAY.size||n.limits);return i?Lm:null}else{if(n.type==="accent")return Qr(n.base)?sc:null;if(n.type==="horizBrace"){var o=!e.sub;return o===n.isOver?Bm:null}else return null}else return null};t0({type:"supsub",htmlBuilder(r,e){var t=Ap(r,e);if(t)return t(r,e);var{base:n,sup:s,sub:i}=r,o=Oe(n,e),a,l,h=e.fontMetrics(),c=0,m=0,f=n&&Qr(n);if(s){var g=e.havingStyle(e.style.sup());a=Oe(s,g,e),f||(c=o.height-g.fontMetrics().supDrop*g.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());l=Oe(i,b,e),f||(m=o.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var x;e.style===Se.DISPLAY?x=h.sup1:e.style.cramped?x=h.sup3:x=h.sup2;var v=e.sizeMultiplier,S=Q(.5/h.ptPerEm/v),k=null;if(l){var M=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(o instanceof Pt||M)&&(k=Q(-o.italic))}var _;if(a&&l){c=Math.max(c,x,a.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var B=h.defaultRuleThickness,$=4*B;if(c-a.depth-(l.height-m)<$){m=$-(c-a.depth)+l.height;var Y=.8*h.xHeight-(c-a.depth);Y>0&&(c+=Y,m-=Y)}var Z=[{type:"elem",elem:l,shift:m,marginRight:S,marginLeft:k},{type:"elem",elem:a,shift:-c,marginRight:S}];_=Ne({positionType:"individualShift",children:Z})}else if(l){m=Math.max(m,h.sub1,l.height-.8*h.xHeight);var L=[{type:"elem",elem:l,marginLeft:k,marginRight:S}];_=Ne({positionType:"shift",positionData:m,children:L})}else if(a)c=Math.max(c,x,a.depth+.25*h.xHeight),_=Ne({positionType:"shift",positionData:-c,children:[{type:"elem",elem:a,marginRight:S}]});else throw new Error("supsub must have either sup or sub.");var I=Hh(o,"right")||"mord";return V([I],[o,V(["msupsub"],[_])],e)},mathmlBuilder(r,e){var t=!1,n,s;r.base&&r.base.type==="horizBrace"&&(s=!!r.sup,s===r.base.isOver&&(t=!0,n=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var i=[je(r.base,e)];r.sub&&i.push(je(r.sub,e)),r.sup&&i.push(je(r.sup,e));var o;if(t)o=n?"mover":"munder";else if(r.sub)if(r.sup){var h=r.base;h&&h.type==="op"&&h.limits&&e.style===Se.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===Se.DISPLAY||h.limits)?o="munderover":o="msubsup"}else{var l=r.base;l&&l.type==="op"&&l.limits&&(e.style===Se.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Se.DISPLAY)?o="munder":o="msub"}else{var a=r.base;a&&a.type==="op"&&a.limits&&(e.style===Se.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===Se.DISPLAY)?o="mover":o="msup"}return new K(o,i)}});t0({type:"atom",htmlBuilder(r,e){return ec(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new K("mo",[Vt(r.text,r.mode)]);if(r.family==="bin"){var n=nc(r,e);n==="bold-italic"&&t.setAttribute("mathvariant",n)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});Nm={mi:"italic",mn:"normal",mtext:"normal"};t0({type:"mathord",htmlBuilder(r,e){return vl(r,e,"mathord")},mathmlBuilder(r,e){var t=new K("mi",[Vt(r.text,r.mode,e)]),n=nc(r,e)||"italic";return n!==Nm[t.type]&&t.setAttribute("mathvariant",n),t}});t0({type:"textord",htmlBuilder(r,e){return vl(r,e,"textord")},mathmlBuilder(r,e){var t=Vt(r.text,r.mode,e),n=nc(r,e)||"normal",s;return r.mode==="text"?s=new K("mtext",[t]):/[0-9]/.test(r.text)?s=new K("mn",[t]):r.text==="\\prime"?s=new K("mo",[t]):s=new K("mi",[t]),n!==Nm[s.type]&&s.setAttribute("mathvariant",n),s}});Ch={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Ih={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};t0({type:"spacing",htmlBuilder(r,e){if(Ih.hasOwnProperty(r.text)){var t=Ih[r.text].className||"";if(r.mode==="text"){var n=vl(r,e,"textord");return n.classes.push(t),n}else return V(["mspace",t],[ec(r.text,r.mode,e)],e)}else{if(Ch.hasOwnProperty(r.text))return V(["mspace",Ch[r.text]],[],e);throw new J('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(Ih.hasOwnProperty(r.text))t=new K("mtext",[new Qe("\xA0")]);else{if(Ch.hasOwnProperty(r.text))return new K("mspace");throw new J('Unknown type of space "'+r.text+'"')}return t}});Fu=()=>{var r=new K("mtd",[]);return r.setAttribute("width","50%"),r};t0({type:"tag",mathmlBuilder(r,e){var t=new K("mtable",[new K("mtr",[Fu(),new K("mtd",[zn(r.body,e)]),Fu(),new K("mtd",[zn(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});$u={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},ju={"\\textbf":"textbf","\\textmd":"textmd"},_p={"\\textit":"textit","\\textup":"textup"},qu=(r,e)=>{var t=r.font;if(t){if($u[t])return e.withTextFontFamily($u[t]);if(ju[t])return e.withTextFontWeight(ju[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(_p[t])};ie({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];return{type:"text",mode:t.mode,body:ot(s),font:n}},htmlBuilder(r,e){var t=qu(r,e),n=ct(r.body,t,!0);return V(["mord","text"],n,t)},mathmlBuilder(r,e){var t=qu(r,e);return zn(r.body,t)}});ie({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=Oe(r.body,e),n=S0("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=Ne({positionType:"top",positionData:t.height,children:[{type:"kern",size:s},{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:t}]});return V(["mord","underline"],[i],e)},mathmlBuilder(r,e){var t=new K("mo",[new Qe("\u203E")]);t.setAttribute("stretchy","true");var n=new K("munder",[je(r.body,e),t]);return n.setAttribute("accentunder","true"),n}});ie({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=Oe(r.body,e),n=e.fontMetrics().axisHeight,s=.5*(t.height-n-(t.depth+n));return Ne({positionType:"shift",positionData:s,children:[{type:"elem",elem:t}]})},mathmlBuilder(r,e){return new K("mpadded",[je(r.body,e)],["vcenter"])}});ie({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new J("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=Hu(r),n=[],s=e.havingStyle(e.style.text()),i=0;i<t.length;i++){var o=t[i];o==="~"&&(o="\\textasciitilde"),n.push(zt(o,"Typewriter-Regular",r.mode,s,["mord","texttt"]))}return V(["mord","text"].concat(s.sizingClasses(e)),tm(n),s)},mathmlBuilder(r,e){var t=new Qe(Hu(r)),n=new K("mtext",[t]);return n.setAttribute("mathvariant","monospace"),n}});Hu=r=>r.body.replace(/ /g,r.star?"\u2423":"\xA0"),vn=im,Om=`[ \r
261
- ]`,Bp="\\\\[a-zA-Z@]+",Cp="\\\\[^\uD800-\uDFFF]",Ip="("+Bp+")"+Om+"*",Lp=`\\\\(
259
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}},yn=class{constructor(e){this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}},Nh={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Bd={ex:!0,em:!0,mu:!0},Vu=function(e){return typeof e!="string"&&(e=e.unit),e in Nh||e in Bd||e==="ex"},Ke=function(e,t){var n;if(e.unit in Nh)n=Nh[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")n=t.fontMetrics().cssEmPerMu;else{var s;if(t.style.isTight()?s=t.havingStyle(t.style.text()):s=t,e.unit==="ex")n=s.fontMetrics().xHeight;else if(e.unit==="em")n=s.fontMetrics().quad;else throw new J("Invalid unit: '"+e.unit+"'");s!==t&&(n*=s.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},Q=function(e){return+e.toFixed(4)+"em"},Sn=function(e){return e.filter(t=>t).join(" ")},Uu=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var s=t.getColor();s&&(this.style.color=s)}},Ju=function(e){var t=document.createElement(e);t.className=Sn(this.classes);for(var n of Object.keys(this.style))t.style[n]=this.style[n];for(var s of Object.keys(this.attributes))t.setAttribute(s,this.attributes[s]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t},Cd=/[\s"'>/=\x00-\x1f]/,Ku=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+bt(Sn(this.classes))+'"');var n="";for(var s of Object.keys(this.style))n+=Kh(s)+":"+this.style[s]+";";n&&(t+=' style="'+bt(n)+'"');for(var i of Object.keys(this.attributes)){if(Cd.test(i))throw new J("Invalid attribute name '"+i+"'");t+=" "+i+'="'+bt(this.attributes[i])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t},kn=class{constructor(e,t,n,s){Uu.call(this,e,n,s),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ju.call(this,"span")}toMarkup(){return Ku.call(this,"span")}},y0=class{constructor(e,t,n,s){Uu.call(this,t,s),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ju.call(this,"a")}toMarkup(){return Ku.call(this,"a")}},Oh=class{constructor(e,t,n){this.alt=t,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t of Object.keys(this.style))e.style[t]=this.style[t];return e}toMarkup(){var e='<img src="'+bt(this.src)+'"'+(' alt="'+bt(this.alt)+'"'),t="";for(var n of Object.keys(this.style))t+=Kh(n)+":"+this.style[n]+";";return t&&(e+=' style="'+bt(t)+'"'),e+="'/>",e}},Id={\u00EE:"\u0131\u0302",\u00EF:"\u0131\u0308",\u00ED:"\u0131\u0301",\u00EC:"\u0131\u0300"},Pt=class{constructor(e,t,n,s,i,o,a,l){this.text=e,this.height=t||0,this.depth=n||0,this.italic=s||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var h=yd(this.text.charCodeAt(0));h&&this.classes.push(h+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Id[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=Q(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=Sn(this.classes));for(var n of Object.keys(this.style))t=t||document.createElement("span"),t.style[n]=this.style[n];return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=bt(Sn(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+Q(this.italic)+";");for(var s of Object.keys(this.style))n+=Kh(s)+":"+this.style[s]+";";n&&(e=!0,t+=' style="'+bt(n)+'"');var i=bt(this.text);return e?(t+=">",t+=i,t+="</span>",t):i}},ar=class{constructor(e,t){this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t of Object.keys(this.attributes))e+=" "+t+'="'+bt(this.attributes[t])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}},Tr=class{constructor(e,t){this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",wu[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+bt(this.alternate)+'"/>':'<path d="'+bt(wu[this.pathName])+'"/>'}},ga=class{constructor(e){this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);return t}toMarkup(){var e="<line";for(var t of Object.keys(this.attributes))e+=" "+t+'="'+bt(this.attributes[t])+'"';return e+="/>",e}};Nd=r=>r instanceof kn||r instanceof y0||r instanceof yn,Pr={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],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:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],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:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],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:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],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:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],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:[0,.44444,0,0,.63889],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:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],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:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],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:[0,.68611,.17208,0,.8961],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:[0,.69444,.06709,0,.59111],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:[.19444,.44444,.105,0,.53222],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:[.19444,.44444,.105,0,.53222],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:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],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:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],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:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],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:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],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:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],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:[0,.68333,.16389,0,.74333],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:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],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:[0,.68333,.16389,0,.74333],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:[0,.69444,.06646,0,.51111],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:[.19444,.43056,.08847,0,.46],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:[.19444,.43056,.08847,0,.46],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:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],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:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],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:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],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:[0,.43056,0,0,.55556],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:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],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:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],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:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],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:[0,.69444,0,0,.66759],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:[0,.44444,0,0,.58472],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:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],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:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],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:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],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:[0,.68333,.08125,.05556,.83125],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:[0,.68333,.02778,.08334,.76278],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:[0,.43056,0,.05556,.48472],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:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],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:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],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:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],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:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],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:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],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:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],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:[0,.69444,.07816,0,.27778],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:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],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:[0,.69444,0,0,.66667],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:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],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:[0,.69444,.0799,0,.5],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:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],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:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],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:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],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:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],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:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],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:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Ja={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],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:[.25,.25,.25],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],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},xu={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\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"};Sh={};Fd={bin:1,close:1,inner:1,open:1,punct:1,rel:1},$d={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ge={math:{},text:{}};d="math",G="text",w="main",E="ams",We="accent-token",oe="bin",Tt="close",M0="inner",ce="mathord",at="op-token",Ot="open",wa="punct",P="rel",en="spacing",R="textord";u(d,w,P,"\u2261","\\equiv",!0);u(d,w,P,"\u227A","\\prec",!0);u(d,w,P,"\u227B","\\succ",!0);u(d,w,P,"\u223C","\\sim",!0);u(d,w,P,"\u22A5","\\perp");u(d,w,P,"\u2AAF","\\preceq",!0);u(d,w,P,"\u2AB0","\\succeq",!0);u(d,w,P,"\u2243","\\simeq",!0);u(d,w,P,"\u2223","\\mid",!0);u(d,w,P,"\u226A","\\ll",!0);u(d,w,P,"\u226B","\\gg",!0);u(d,w,P,"\u224D","\\asymp",!0);u(d,w,P,"\u2225","\\parallel");u(d,w,P,"\u22C8","\\bowtie",!0);u(d,w,P,"\u2323","\\smile",!0);u(d,w,P,"\u2291","\\sqsubseteq",!0);u(d,w,P,"\u2292","\\sqsupseteq",!0);u(d,w,P,"\u2250","\\doteq",!0);u(d,w,P,"\u2322","\\frown",!0);u(d,w,P,"\u220B","\\ni",!0);u(d,w,P,"\u221D","\\propto",!0);u(d,w,P,"\u22A2","\\vdash",!0);u(d,w,P,"\u22A3","\\dashv",!0);u(d,w,P,"\u220B","\\owns");u(d,w,wa,".","\\ldotp");u(d,w,wa,"\u22C5","\\cdotp");u(d,w,wa,"\u22C5","\xB7");u(G,w,R,"\u22C5","\xB7");u(d,w,R,"#","\\#");u(G,w,R,"#","\\#");u(d,w,R,"&","\\&");u(G,w,R,"&","\\&");u(d,w,R,"\u2135","\\aleph",!0);u(d,w,R,"\u2200","\\forall",!0);u(d,w,R,"\u210F","\\hbar",!0);u(d,w,R,"\u2203","\\exists",!0);u(d,w,R,"\u2207","\\nabla",!0);u(d,w,R,"\u266D","\\flat",!0);u(d,w,R,"\u2113","\\ell",!0);u(d,w,R,"\u266E","\\natural",!0);u(d,w,R,"\u2663","\\clubsuit",!0);u(d,w,R,"\u2118","\\wp",!0);u(d,w,R,"\u266F","\\sharp",!0);u(d,w,R,"\u2662","\\diamondsuit",!0);u(d,w,R,"\u211C","\\Re",!0);u(d,w,R,"\u2661","\\heartsuit",!0);u(d,w,R,"\u2111","\\Im",!0);u(d,w,R,"\u2660","\\spadesuit",!0);u(d,w,R,"\xA7","\\S",!0);u(G,w,R,"\xA7","\\S");u(d,w,R,"\xB6","\\P",!0);u(G,w,R,"\xB6","\\P");u(d,w,R,"\u2020","\\dag");u(G,w,R,"\u2020","\\dag");u(G,w,R,"\u2020","\\textdagger");u(d,w,R,"\u2021","\\ddag");u(G,w,R,"\u2021","\\ddag");u(G,w,R,"\u2021","\\textdaggerdbl");u(d,w,Tt,"\u23B1","\\rmoustache",!0);u(d,w,Ot,"\u23B0","\\lmoustache",!0);u(d,w,Tt,"\u27EF","\\rgroup",!0);u(d,w,Ot,"\u27EE","\\lgroup",!0);u(d,w,oe,"\u2213","\\mp",!0);u(d,w,oe,"\u2296","\\ominus",!0);u(d,w,oe,"\u228E","\\uplus",!0);u(d,w,oe,"\u2293","\\sqcap",!0);u(d,w,oe,"\u2217","\\ast");u(d,w,oe,"\u2294","\\sqcup",!0);u(d,w,oe,"\u25EF","\\bigcirc",!0);u(d,w,oe,"\u2219","\\bullet",!0);u(d,w,oe,"\u2021","\\ddagger");u(d,w,oe,"\u2240","\\wr",!0);u(d,w,oe,"\u2A3F","\\amalg");u(d,w,oe,"&","\\And");u(d,w,P,"\u27F5","\\longleftarrow",!0);u(d,w,P,"\u21D0","\\Leftarrow",!0);u(d,w,P,"\u27F8","\\Longleftarrow",!0);u(d,w,P,"\u27F6","\\longrightarrow",!0);u(d,w,P,"\u21D2","\\Rightarrow",!0);u(d,w,P,"\u27F9","\\Longrightarrow",!0);u(d,w,P,"\u2194","\\leftrightarrow",!0);u(d,w,P,"\u27F7","\\longleftrightarrow",!0);u(d,w,P,"\u21D4","\\Leftrightarrow",!0);u(d,w,P,"\u27FA","\\Longleftrightarrow",!0);u(d,w,P,"\u21A6","\\mapsto",!0);u(d,w,P,"\u27FC","\\longmapsto",!0);u(d,w,P,"\u2197","\\nearrow",!0);u(d,w,P,"\u21A9","\\hookleftarrow",!0);u(d,w,P,"\u21AA","\\hookrightarrow",!0);u(d,w,P,"\u2198","\\searrow",!0);u(d,w,P,"\u21BC","\\leftharpoonup",!0);u(d,w,P,"\u21C0","\\rightharpoonup",!0);u(d,w,P,"\u2199","\\swarrow",!0);u(d,w,P,"\u21BD","\\leftharpoondown",!0);u(d,w,P,"\u21C1","\\rightharpoondown",!0);u(d,w,P,"\u2196","\\nwarrow",!0);u(d,w,P,"\u21CC","\\rightleftharpoons",!0);u(d,E,P,"\u226E","\\nless",!0);u(d,E,P,"\uE010","\\@nleqslant");u(d,E,P,"\uE011","\\@nleqq");u(d,E,P,"\u2A87","\\lneq",!0);u(d,E,P,"\u2268","\\lneqq",!0);u(d,E,P,"\uE00C","\\@lvertneqq");u(d,E,P,"\u22E6","\\lnsim",!0);u(d,E,P,"\u2A89","\\lnapprox",!0);u(d,E,P,"\u2280","\\nprec",!0);u(d,E,P,"\u22E0","\\npreceq",!0);u(d,E,P,"\u22E8","\\precnsim",!0);u(d,E,P,"\u2AB9","\\precnapprox",!0);u(d,E,P,"\u2241","\\nsim",!0);u(d,E,P,"\uE006","\\@nshortmid");u(d,E,P,"\u2224","\\nmid",!0);u(d,E,P,"\u22AC","\\nvdash",!0);u(d,E,P,"\u22AD","\\nvDash",!0);u(d,E,P,"\u22EA","\\ntriangleleft");u(d,E,P,"\u22EC","\\ntrianglelefteq",!0);u(d,E,P,"\u228A","\\subsetneq",!0);u(d,E,P,"\uE01A","\\@varsubsetneq");u(d,E,P,"\u2ACB","\\subsetneqq",!0);u(d,E,P,"\uE017","\\@varsubsetneqq");u(d,E,P,"\u226F","\\ngtr",!0);u(d,E,P,"\uE00F","\\@ngeqslant");u(d,E,P,"\uE00E","\\@ngeqq");u(d,E,P,"\u2A88","\\gneq",!0);u(d,E,P,"\u2269","\\gneqq",!0);u(d,E,P,"\uE00D","\\@gvertneqq");u(d,E,P,"\u22E7","\\gnsim",!0);u(d,E,P,"\u2A8A","\\gnapprox",!0);u(d,E,P,"\u2281","\\nsucc",!0);u(d,E,P,"\u22E1","\\nsucceq",!0);u(d,E,P,"\u22E9","\\succnsim",!0);u(d,E,P,"\u2ABA","\\succnapprox",!0);u(d,E,P,"\u2246","\\ncong",!0);u(d,E,P,"\uE007","\\@nshortparallel");u(d,E,P,"\u2226","\\nparallel",!0);u(d,E,P,"\u22AF","\\nVDash",!0);u(d,E,P,"\u22EB","\\ntriangleright");u(d,E,P,"\u22ED","\\ntrianglerighteq",!0);u(d,E,P,"\uE018","\\@nsupseteqq");u(d,E,P,"\u228B","\\supsetneq",!0);u(d,E,P,"\uE01B","\\@varsupsetneq");u(d,E,P,"\u2ACC","\\supsetneqq",!0);u(d,E,P,"\uE019","\\@varsupsetneqq");u(d,E,P,"\u22AE","\\nVdash",!0);u(d,E,P,"\u2AB5","\\precneqq",!0);u(d,E,P,"\u2AB6","\\succneqq",!0);u(d,E,P,"\uE016","\\@nsubseteqq");u(d,E,oe,"\u22B4","\\unlhd");u(d,E,oe,"\u22B5","\\unrhd");u(d,E,P,"\u219A","\\nleftarrow",!0);u(d,E,P,"\u219B","\\nrightarrow",!0);u(d,E,P,"\u21CD","\\nLeftarrow",!0);u(d,E,P,"\u21CF","\\nRightarrow",!0);u(d,E,P,"\u21AE","\\nleftrightarrow",!0);u(d,E,P,"\u21CE","\\nLeftrightarrow",!0);u(d,E,P,"\u25B3","\\vartriangle");u(d,E,R,"\u210F","\\hslash");u(d,E,R,"\u25BD","\\triangledown");u(d,E,R,"\u25CA","\\lozenge");u(d,E,R,"\u24C8","\\circledS");u(d,E,R,"\xAE","\\circledR");u(G,E,R,"\xAE","\\circledR");u(d,E,R,"\u2221","\\measuredangle",!0);u(d,E,R,"\u2204","\\nexists");u(d,E,R,"\u2127","\\mho");u(d,E,R,"\u2132","\\Finv",!0);u(d,E,R,"\u2141","\\Game",!0);u(d,E,R,"\u2035","\\backprime");u(d,E,R,"\u25B2","\\blacktriangle");u(d,E,R,"\u25BC","\\blacktriangledown");u(d,E,R,"\u25A0","\\blacksquare");u(d,E,R,"\u29EB","\\blacklozenge");u(d,E,R,"\u2605","\\bigstar");u(d,E,R,"\u2222","\\sphericalangle",!0);u(d,E,R,"\u2201","\\complement",!0);u(d,E,R,"\xF0","\\eth",!0);u(G,w,R,"\xF0","\xF0");u(d,E,R,"\u2571","\\diagup");u(d,E,R,"\u2572","\\diagdown");u(d,E,R,"\u25A1","\\square");u(d,E,R,"\u25A1","\\Box");u(d,E,R,"\u25CA","\\Diamond");u(d,E,R,"\xA5","\\yen",!0);u(G,E,R,"\xA5","\\yen",!0);u(d,E,R,"\u2713","\\checkmark",!0);u(G,E,R,"\u2713","\\checkmark");u(d,E,R,"\u2136","\\beth",!0);u(d,E,R,"\u2138","\\daleth",!0);u(d,E,R,"\u2137","\\gimel",!0);u(d,E,R,"\u03DD","\\digamma",!0);u(d,E,R,"\u03F0","\\varkappa");u(d,E,Ot,"\u250C","\\@ulcorner",!0);u(d,E,Tt,"\u2510","\\@urcorner",!0);u(d,E,Ot,"\u2514","\\@llcorner",!0);u(d,E,Tt,"\u2518","\\@lrcorner",!0);u(d,E,P,"\u2266","\\leqq",!0);u(d,E,P,"\u2A7D","\\leqslant",!0);u(d,E,P,"\u2A95","\\eqslantless",!0);u(d,E,P,"\u2272","\\lesssim",!0);u(d,E,P,"\u2A85","\\lessapprox",!0);u(d,E,P,"\u224A","\\approxeq",!0);u(d,E,oe,"\u22D6","\\lessdot");u(d,E,P,"\u22D8","\\lll",!0);u(d,E,P,"\u2276","\\lessgtr",!0);u(d,E,P,"\u22DA","\\lesseqgtr",!0);u(d,E,P,"\u2A8B","\\lesseqqgtr",!0);u(d,E,P,"\u2251","\\doteqdot");u(d,E,P,"\u2253","\\risingdotseq",!0);u(d,E,P,"\u2252","\\fallingdotseq",!0);u(d,E,P,"\u223D","\\backsim",!0);u(d,E,P,"\u22CD","\\backsimeq",!0);u(d,E,P,"\u2AC5","\\subseteqq",!0);u(d,E,P,"\u22D0","\\Subset",!0);u(d,E,P,"\u228F","\\sqsubset",!0);u(d,E,P,"\u227C","\\preccurlyeq",!0);u(d,E,P,"\u22DE","\\curlyeqprec",!0);u(d,E,P,"\u227E","\\precsim",!0);u(d,E,P,"\u2AB7","\\precapprox",!0);u(d,E,P,"\u22B2","\\vartriangleleft");u(d,E,P,"\u22B4","\\trianglelefteq");u(d,E,P,"\u22A8","\\vDash",!0);u(d,E,P,"\u22AA","\\Vvdash",!0);u(d,E,P,"\u2323","\\smallsmile");u(d,E,P,"\u2322","\\smallfrown");u(d,E,P,"\u224F","\\bumpeq",!0);u(d,E,P,"\u224E","\\Bumpeq",!0);u(d,E,P,"\u2267","\\geqq",!0);u(d,E,P,"\u2A7E","\\geqslant",!0);u(d,E,P,"\u2A96","\\eqslantgtr",!0);u(d,E,P,"\u2273","\\gtrsim",!0);u(d,E,P,"\u2A86","\\gtrapprox",!0);u(d,E,oe,"\u22D7","\\gtrdot");u(d,E,P,"\u22D9","\\ggg",!0);u(d,E,P,"\u2277","\\gtrless",!0);u(d,E,P,"\u22DB","\\gtreqless",!0);u(d,E,P,"\u2A8C","\\gtreqqless",!0);u(d,E,P,"\u2256","\\eqcirc",!0);u(d,E,P,"\u2257","\\circeq",!0);u(d,E,P,"\u225C","\\triangleq",!0);u(d,E,P,"\u223C","\\thicksim");u(d,E,P,"\u2248","\\thickapprox");u(d,E,P,"\u2AC6","\\supseteqq",!0);u(d,E,P,"\u22D1","\\Supset",!0);u(d,E,P,"\u2290","\\sqsupset",!0);u(d,E,P,"\u227D","\\succcurlyeq",!0);u(d,E,P,"\u22DF","\\curlyeqsucc",!0);u(d,E,P,"\u227F","\\succsim",!0);u(d,E,P,"\u2AB8","\\succapprox",!0);u(d,E,P,"\u22B3","\\vartriangleright");u(d,E,P,"\u22B5","\\trianglerighteq");u(d,E,P,"\u22A9","\\Vdash",!0);u(d,E,P,"\u2223","\\shortmid");u(d,E,P,"\u2225","\\shortparallel");u(d,E,P,"\u226C","\\between",!0);u(d,E,P,"\u22D4","\\pitchfork",!0);u(d,E,P,"\u221D","\\varpropto");u(d,E,P,"\u25C0","\\blacktriangleleft");u(d,E,P,"\u2234","\\therefore",!0);u(d,E,P,"\u220D","\\backepsilon");u(d,E,P,"\u25B6","\\blacktriangleright");u(d,E,P,"\u2235","\\because",!0);u(d,E,P,"\u22D8","\\llless");u(d,E,P,"\u22D9","\\gggtr");u(d,E,oe,"\u22B2","\\lhd");u(d,E,oe,"\u22B3","\\rhd");u(d,E,P,"\u2242","\\eqsim",!0);u(d,w,P,"\u22C8","\\Join");u(d,E,P,"\u2251","\\Doteq",!0);u(d,E,oe,"\u2214","\\dotplus",!0);u(d,E,oe,"\u2216","\\smallsetminus");u(d,E,oe,"\u22D2","\\Cap",!0);u(d,E,oe,"\u22D3","\\Cup",!0);u(d,E,oe,"\u2A5E","\\doublebarwedge",!0);u(d,E,oe,"\u229F","\\boxminus",!0);u(d,E,oe,"\u229E","\\boxplus",!0);u(d,E,oe,"\u22C7","\\divideontimes",!0);u(d,E,oe,"\u22C9","\\ltimes",!0);u(d,E,oe,"\u22CA","\\rtimes",!0);u(d,E,oe,"\u22CB","\\leftthreetimes",!0);u(d,E,oe,"\u22CC","\\rightthreetimes",!0);u(d,E,oe,"\u22CF","\\curlywedge",!0);u(d,E,oe,"\u22CE","\\curlyvee",!0);u(d,E,oe,"\u229D","\\circleddash",!0);u(d,E,oe,"\u229B","\\circledast",!0);u(d,E,oe,"\u22C5","\\centerdot");u(d,E,oe,"\u22BA","\\intercal",!0);u(d,E,oe,"\u22D2","\\doublecap");u(d,E,oe,"\u22D3","\\doublecup");u(d,E,oe,"\u22A0","\\boxtimes",!0);u(d,E,P,"\u21E2","\\dashrightarrow",!0);u(d,E,P,"\u21E0","\\dashleftarrow",!0);u(d,E,P,"\u21C7","\\leftleftarrows",!0);u(d,E,P,"\u21C6","\\leftrightarrows",!0);u(d,E,P,"\u21DA","\\Lleftarrow",!0);u(d,E,P,"\u219E","\\twoheadleftarrow",!0);u(d,E,P,"\u21A2","\\leftarrowtail",!0);u(d,E,P,"\u21AB","\\looparrowleft",!0);u(d,E,P,"\u21CB","\\leftrightharpoons",!0);u(d,E,P,"\u21B6","\\curvearrowleft",!0);u(d,E,P,"\u21BA","\\circlearrowleft",!0);u(d,E,P,"\u21B0","\\Lsh",!0);u(d,E,P,"\u21C8","\\upuparrows",!0);u(d,E,P,"\u21BF","\\upharpoonleft",!0);u(d,E,P,"\u21C3","\\downharpoonleft",!0);u(d,w,P,"\u22B6","\\origof",!0);u(d,w,P,"\u22B7","\\imageof",!0);u(d,E,P,"\u22B8","\\multimap",!0);u(d,E,P,"\u21AD","\\leftrightsquigarrow",!0);u(d,E,P,"\u21C9","\\rightrightarrows",!0);u(d,E,P,"\u21C4","\\rightleftarrows",!0);u(d,E,P,"\u21A0","\\twoheadrightarrow",!0);u(d,E,P,"\u21A3","\\rightarrowtail",!0);u(d,E,P,"\u21AC","\\looparrowright",!0);u(d,E,P,"\u21B7","\\curvearrowright",!0);u(d,E,P,"\u21BB","\\circlearrowright",!0);u(d,E,P,"\u21B1","\\Rsh",!0);u(d,E,P,"\u21CA","\\downdownarrows",!0);u(d,E,P,"\u21BE","\\upharpoonright",!0);u(d,E,P,"\u21C2","\\downharpoonright",!0);u(d,E,P,"\u21DD","\\rightsquigarrow",!0);u(d,E,P,"\u21DD","\\leadsto");u(d,E,P,"\u21DB","\\Rrightarrow",!0);u(d,E,P,"\u21BE","\\restriction");u(d,w,R,"\u2018","`");u(d,w,R,"$","\\$");u(G,w,R,"$","\\$");u(G,w,R,"$","\\textdollar");u(d,w,R,"%","\\%");u(G,w,R,"%","\\%");u(d,w,R,"_","\\_");u(G,w,R,"_","\\_");u(G,w,R,"_","\\textunderscore");u(d,w,R,"\u2220","\\angle",!0);u(d,w,R,"\u221E","\\infty",!0);u(d,w,R,"\u2032","\\prime");u(d,w,R,"\u25B3","\\triangle");u(d,w,R,"\u0393","\\Gamma",!0);u(d,w,R,"\u0394","\\Delta",!0);u(d,w,R,"\u0398","\\Theta",!0);u(d,w,R,"\u039B","\\Lambda",!0);u(d,w,R,"\u039E","\\Xi",!0);u(d,w,R,"\u03A0","\\Pi",!0);u(d,w,R,"\u03A3","\\Sigma",!0);u(d,w,R,"\u03A5","\\Upsilon",!0);u(d,w,R,"\u03A6","\\Phi",!0);u(d,w,R,"\u03A8","\\Psi",!0);u(d,w,R,"\u03A9","\\Omega",!0);u(d,w,R,"A","\u0391");u(d,w,R,"B","\u0392");u(d,w,R,"E","\u0395");u(d,w,R,"Z","\u0396");u(d,w,R,"H","\u0397");u(d,w,R,"I","\u0399");u(d,w,R,"K","\u039A");u(d,w,R,"M","\u039C");u(d,w,R,"N","\u039D");u(d,w,R,"O","\u039F");u(d,w,R,"P","\u03A1");u(d,w,R,"T","\u03A4");u(d,w,R,"X","\u03A7");u(d,w,R,"\xAC","\\neg",!0);u(d,w,R,"\xAC","\\lnot");u(d,w,R,"\u22A4","\\top");u(d,w,R,"\u22A5","\\bot");u(d,w,R,"\u2205","\\emptyset");u(d,E,R,"\u2205","\\varnothing");u(d,w,ce,"\u03B1","\\alpha",!0);u(d,w,ce,"\u03B2","\\beta",!0);u(d,w,ce,"\u03B3","\\gamma",!0);u(d,w,ce,"\u03B4","\\delta",!0);u(d,w,ce,"\u03F5","\\epsilon",!0);u(d,w,ce,"\u03B6","\\zeta",!0);u(d,w,ce,"\u03B7","\\eta",!0);u(d,w,ce,"\u03B8","\\theta",!0);u(d,w,ce,"\u03B9","\\iota",!0);u(d,w,ce,"\u03BA","\\kappa",!0);u(d,w,ce,"\u03BB","\\lambda",!0);u(d,w,ce,"\u03BC","\\mu",!0);u(d,w,ce,"\u03BD","\\nu",!0);u(d,w,ce,"\u03BE","\\xi",!0);u(d,w,ce,"\u03BF","\\omicron",!0);u(d,w,ce,"\u03C0","\\pi",!0);u(d,w,ce,"\u03C1","\\rho",!0);u(d,w,ce,"\u03C3","\\sigma",!0);u(d,w,ce,"\u03C4","\\tau",!0);u(d,w,ce,"\u03C5","\\upsilon",!0);u(d,w,ce,"\u03D5","\\phi",!0);u(d,w,ce,"\u03C7","\\chi",!0);u(d,w,ce,"\u03C8","\\psi",!0);u(d,w,ce,"\u03C9","\\omega",!0);u(d,w,ce,"\u03B5","\\varepsilon",!0);u(d,w,ce,"\u03D1","\\vartheta",!0);u(d,w,ce,"\u03D6","\\varpi",!0);u(d,w,ce,"\u03F1","\\varrho",!0);u(d,w,ce,"\u03C2","\\varsigma",!0);u(d,w,ce,"\u03C6","\\varphi",!0);u(d,w,oe,"\u2217","*",!0);u(d,w,oe,"+","+");u(d,w,oe,"\u2212","-",!0);u(d,w,oe,"\u22C5","\\cdot",!0);u(d,w,oe,"\u2218","\\circ",!0);u(d,w,oe,"\xF7","\\div",!0);u(d,w,oe,"\xB1","\\pm",!0);u(d,w,oe,"\xD7","\\times",!0);u(d,w,oe,"\u2229","\\cap",!0);u(d,w,oe,"\u222A","\\cup",!0);u(d,w,oe,"\u2216","\\setminus",!0);u(d,w,oe,"\u2227","\\land");u(d,w,oe,"\u2228","\\lor");u(d,w,oe,"\u2227","\\wedge",!0);u(d,w,oe,"\u2228","\\vee",!0);u(d,w,R,"\u221A","\\surd");u(d,w,Ot,"\u27E8","\\langle",!0);u(d,w,Ot,"\u2223","\\lvert");u(d,w,Ot,"\u2225","\\lVert");u(d,w,Tt,"?","?");u(d,w,Tt,"!","!");u(d,w,Tt,"\u27E9","\\rangle",!0);u(d,w,Tt,"\u2223","\\rvert");u(d,w,Tt,"\u2225","\\rVert");u(d,w,P,"=","=");u(d,w,P,":",":");u(d,w,P,"\u2248","\\approx",!0);u(d,w,P,"\u2245","\\cong",!0);u(d,w,P,"\u2265","\\ge");u(d,w,P,"\u2265","\\geq",!0);u(d,w,P,"\u2190","\\gets");u(d,w,P,">","\\gt",!0);u(d,w,P,"\u2208","\\in",!0);u(d,w,P,"\uE020","\\@not");u(d,w,P,"\u2282","\\subset",!0);u(d,w,P,"\u2283","\\supset",!0);u(d,w,P,"\u2286","\\subseteq",!0);u(d,w,P,"\u2287","\\supseteq",!0);u(d,E,P,"\u2288","\\nsubseteq",!0);u(d,E,P,"\u2289","\\nsupseteq",!0);u(d,w,P,"\u22A8","\\models");u(d,w,P,"\u2190","\\leftarrow",!0);u(d,w,P,"\u2264","\\le");u(d,w,P,"\u2264","\\leq",!0);u(d,w,P,"<","\\lt",!0);u(d,w,P,"\u2192","\\rightarrow",!0);u(d,w,P,"\u2192","\\to");u(d,E,P,"\u2271","\\ngeq",!0);u(d,E,P,"\u2270","\\nleq",!0);u(d,w,en,"\xA0","\\ ");u(d,w,en,"\xA0","\\space");u(d,w,en,"\xA0","\\nobreakspace");u(G,w,en,"\xA0","\\ ");u(G,w,en,"\xA0"," ");u(G,w,en,"\xA0","\\space");u(G,w,en,"\xA0","\\nobreakspace");u(d,w,en,null,"\\nobreak");u(d,w,en,null,"\\allowbreak");u(d,w,wa,",",",");u(d,w,wa,";",";");u(d,E,oe,"\u22BC","\\barwedge",!0);u(d,E,oe,"\u22BB","\\veebar",!0);u(d,w,oe,"\u2299","\\odot",!0);u(d,w,oe,"\u2295","\\oplus",!0);u(d,w,oe,"\u2297","\\otimes",!0);u(d,w,R,"\u2202","\\partial",!0);u(d,w,oe,"\u2298","\\oslash",!0);u(d,E,oe,"\u229A","\\circledcirc",!0);u(d,E,oe,"\u22A1","\\boxdot",!0);u(d,w,oe,"\u25B3","\\bigtriangleup");u(d,w,oe,"\u25BD","\\bigtriangledown");u(d,w,oe,"\u2020","\\dagger");u(d,w,oe,"\u22C4","\\diamond");u(d,w,oe,"\u22C6","\\star");u(d,w,oe,"\u25C3","\\triangleleft");u(d,w,oe,"\u25B9","\\triangleright");u(d,w,Ot,"{","\\{");u(G,w,R,"{","\\{");u(G,w,R,"{","\\textbraceleft");u(d,w,Tt,"}","\\}");u(G,w,R,"}","\\}");u(G,w,R,"}","\\textbraceright");u(d,w,Ot,"{","\\lbrace");u(d,w,Tt,"}","\\rbrace");u(d,w,Ot,"[","\\lbrack",!0);u(G,w,R,"[","\\lbrack",!0);u(d,w,Tt,"]","\\rbrack",!0);u(G,w,R,"]","\\rbrack",!0);u(d,w,Ot,"(","\\lparen",!0);u(d,w,Tt,")","\\rparen",!0);u(G,w,R,"<","\\textless",!0);u(G,w,R,">","\\textgreater",!0);u(d,w,Ot,"\u230A","\\lfloor",!0);u(d,w,Tt,"\u230B","\\rfloor",!0);u(d,w,Ot,"\u2308","\\lceil",!0);u(d,w,Tt,"\u2309","\\rceil",!0);u(d,w,R,"\\","\\backslash");u(d,w,R,"\u2223","|");u(d,w,R,"\u2223","\\vert");u(G,w,R,"|","\\textbar",!0);u(d,w,R,"\u2225","\\|");u(d,w,R,"\u2225","\\Vert");u(G,w,R,"\u2225","\\textbardbl");u(G,w,R,"~","\\textasciitilde");u(G,w,R,"\\","\\textbackslash");u(G,w,R,"^","\\textasciicircum");u(d,w,P,"\u2191","\\uparrow",!0);u(d,w,P,"\u21D1","\\Uparrow",!0);u(d,w,P,"\u2193","\\downarrow",!0);u(d,w,P,"\u21D3","\\Downarrow",!0);u(d,w,P,"\u2195","\\updownarrow",!0);u(d,w,P,"\u21D5","\\Updownarrow",!0);u(d,w,at,"\u2210","\\coprod");u(d,w,at,"\u22C1","\\bigvee");u(d,w,at,"\u22C0","\\bigwedge");u(d,w,at,"\u2A04","\\biguplus");u(d,w,at,"\u22C2","\\bigcap");u(d,w,at,"\u22C3","\\bigcup");u(d,w,at,"\u222B","\\int");u(d,w,at,"\u222B","\\intop");u(d,w,at,"\u222C","\\iint");u(d,w,at,"\u222D","\\iiint");u(d,w,at,"\u220F","\\prod");u(d,w,at,"\u2211","\\sum");u(d,w,at,"\u2A02","\\bigotimes");u(d,w,at,"\u2A01","\\bigoplus");u(d,w,at,"\u2A00","\\bigodot");u(d,w,at,"\u222E","\\oint");u(d,w,at,"\u222F","\\oiint");u(d,w,at,"\u2230","\\oiiint");u(d,w,at,"\u2A06","\\bigsqcup");u(d,w,at,"\u222B","\\smallint");u(G,w,M0,"\u2026","\\textellipsis");u(d,w,M0,"\u2026","\\mathellipsis");u(G,w,M0,"\u2026","\\ldots",!0);u(d,w,M0,"\u2026","\\ldots",!0);u(d,w,M0,"\u22EF","\\@cdots",!0);u(d,w,M0,"\u22F1","\\ddots",!0);u(d,w,R,"\u22EE","\\varvdots");u(G,w,R,"\u22EE","\\varvdots");u(d,w,We,"\u02CA","\\acute");u(d,w,We,"\u02CB","\\grave");u(d,w,We,"\xA8","\\ddot");u(d,w,We,"~","\\tilde");u(d,w,We,"\u02C9","\\bar");u(d,w,We,"\u02D8","\\breve");u(d,w,We,"\u02C7","\\check");u(d,w,We,"^","\\hat");u(d,w,We,"\u20D7","\\vec");u(d,w,We,"\u02D9","\\dot");u(d,w,We,"\u02DA","\\mathring");u(d,w,ce,"\uE131","\\@imath");u(d,w,ce,"\uE237","\\@jmath");u(d,w,R,"\u0131","\u0131");u(d,w,R,"\u0237","\u0237");u(G,w,R,"\u0131","\\i",!0);u(G,w,R,"\u0237","\\j",!0);u(G,w,R,"\xDF","\\ss",!0);u(G,w,R,"\xE6","\\ae",!0);u(G,w,R,"\u0153","\\oe",!0);u(G,w,R,"\xF8","\\o",!0);u(G,w,R,"\xC6","\\AE",!0);u(G,w,R,"\u0152","\\OE",!0);u(G,w,R,"\xD8","\\O",!0);u(G,w,We,"\u02CA","\\'");u(G,w,We,"\u02CB","\\`");u(G,w,We,"\u02C6","\\^");u(G,w,We,"\u02DC","\\~");u(G,w,We,"\u02C9","\\=");u(G,w,We,"\u02D8","\\u");u(G,w,We,"\u02D9","\\.");u(G,w,We,"\xB8","\\c");u(G,w,We,"\u02DA","\\r");u(G,w,We,"\u02C7","\\v");u(G,w,We,"\xA8",'\\"');u(G,w,We,"\u02DD","\\H");u(G,w,We,"\u25EF","\\textcircled");Qu={"--":!0,"---":!0,"``":!0,"''":!0};u(G,w,R,"\u2013","--",!0);u(G,w,R,"\u2013","\\textendash");u(G,w,R,"\u2014","---",!0);u(G,w,R,"\u2014","\\textemdash");u(G,w,R,"\u2018","`",!0);u(G,w,R,"\u2018","\\textquoteleft");u(G,w,R,"\u2019","'",!0);u(G,w,R,"\u2019","\\textquoteright");u(G,w,R,"\u201C","``",!0);u(G,w,R,"\u201C","\\textquotedblleft");u(G,w,R,"\u201D","''",!0);u(G,w,R,"\u201D","\\textquotedblright");u(d,w,R,"\xB0","\\degree",!0);u(G,w,R,"\xB0","\\degree");u(G,w,R,"\xB0","\\textdegree",!0);u(d,w,R,"\xA3","\\pounds");u(d,w,R,"\xA3","\\mathsterling",!0);u(G,w,R,"\xA3","\\pounds");u(G,w,R,"\xA3","\\textsterling",!0);u(d,E,R,"\u2720","\\maltese");u(G,E,R,"\u2720","\\maltese");vu='0123456789/@."';for(Ka=0;Ka<vu.length;Ka++)kh=vu.charAt(Ka),u(d,w,R,kh,kh);yu='0123456789!@*()-=+";:?/.,';for(Za=0;Za<yu.length;Za++)Mh=yu.charAt(Za),u(G,w,R,Mh,Mh);ul="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(Qa=0;Qa<ul.length;Qa++)ca=ul.charAt(Qa),u(d,w,ce,ca,ca),u(G,w,R,ca,ca);u(d,E,R,"C","\u2102");u(G,E,R,"C","\u2102");u(d,E,R,"H","\u210D");u(G,E,R,"H","\u210D");u(d,E,R,"N","\u2115");u(G,E,R,"N","\u2115");u(d,E,R,"P","\u2119");u(G,E,R,"P","\u2119");u(d,E,R,"Q","\u211A");u(G,E,R,"Q","\u211A");u(d,E,R,"R","\u211D");u(G,E,R,"R","\u211D");u(d,E,R,"Z","\u2124");u(G,E,R,"Z","\u2124");u(d,w,ce,"h","\u210E");u(G,w,ce,"h","\u210E");we="";for(gt=0;gt<ul.length;gt++)Ue=ul.charAt(gt),we=String.fromCharCode(55349,56320+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56372+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56424+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56580+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56684+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56736+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56788+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56840+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56944+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),gt<26&&(we=String.fromCharCode(55349,56632+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we),we=String.fromCharCode(55349,56476+gt),u(d,w,ce,Ue,we),u(G,w,R,Ue,we));we="\u{1D55C}";u(d,w,ce,"k",we);u(G,w,R,"k",we);for(xn=0;xn<10;xn++)Jr=xn.toString(),we=String.fromCharCode(55349,57294+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we),we=String.fromCharCode(55349,57314+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we),we=String.fromCharCode(55349,57324+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we),we=String.fromCharCode(55349,57334+xn),u(d,w,ce,Jr,we),u(G,w,R,Jr,we);Fh="\xD0\xDE\xFE";for(el=0;el<Fh.length;el++)ua=Fh.charAt(el),u(d,w,ce,ua,ua),u(G,w,R,ua,ua);tl=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Su=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],jd=(r,e)=>{var t=r.charCodeAt(0),n=r.charCodeAt(1),s=(t-55296)*1024+(n-56320)+65536,i=e==="math"?0:1;if(119808<=s&&s<120484){var o=Math.floor((s-119808)/26);return[tl[o][2],tl[o][i]]}else if(120782<=s&&s<=120831){var a=Math.floor((s-120782)/10);return[Su[a][2],Su[a][i]]}else{if(s===120485||s===120486)return[tl[0][2],tl[0][i]];if(120486<s&&s<120782)return["",""];throw new J("Unsupported character: "+r)}},xl=function(e,t,n){if(Ge[n][e]){var s=Ge[n][e].replace;s&&(e=s)}return{value:e,metrics:Qh(e,t,n)}},zt=function(e,t,n,s,i){var o=xl(e,t,n),a=o.metrics;e=o.value;var l;if(a){var h=a.italic;(n==="text"||s&&s.font==="mathit")&&(h=0),l=new Pt(e,a.height,a.depth,h,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+n+"'")),l=new Pt(e,0,0,0,0,0,i);if(s){l.maxFontSize=s.sizeMultiplier,s.style.isTight()&&l.classes.push("mtight");var c=s.getColor();c&&(l.style.color=c)}return l},ec=function(e,t,n,s){return s===void 0&&(s=[]),n.font==="boldsymbol"&&xl(e,"Main-Bold",t).metrics?zt(e,"Main-Bold",t,n,s.concat(["mathbf"])):e==="\\"||Ge[t][e].font==="main"?zt(e,"Main-Regular",t,n,s):zt(e,"AMS-Regular",t,n,s.concat(["amsrm"]))},qd=function(e,t,n,s,i){return i!=="textord"&&xl(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},vl=function(e,t,n){var s=e.mode,i=e.text,o=["mord"],a=s==="math"||s==="text"&&t.font,l=a?t.font:t.fontFamily,h="",c="";if(i.charCodeAt(0)===55349&&([h,c]=jd(i,s)),h.length>0)return zt(i,h,s,t,o.concat(c));if(l){var m,f;if(l==="boldsymbol"){var g=qd(i,s,t,o,n);m=g.fontName,f=[g.fontClass]}else a?(m=$h[l].fontName,f=[l]):(m=rl(l,t.fontWeight,t.fontShape),f=[l,t.fontWeight,t.fontShape]);if(xl(i,m,s).metrics)return zt(i,m,s,t,o.concat(f));if(Qu.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var b=[],v=0;v<i.length;v++)b.push(zt(i[v],m,s,t,o.concat(f)));return tn(b)}}if(n==="mathord")return zt(i,"Math-Italic",s,t,o.concat(["mathnormal"]));if(n==="textord"){var x=Ge[s][i]&&Ge[s][i].font;if(x==="ams"){var S=rl("amsrm",t.fontWeight,t.fontShape);return zt(i,S,s,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(x==="main"||!x){var k=rl("textrm",t.fontWeight,t.fontShape);return zt(i,k,s,t,o.concat(t.fontWeight,t.fontShape))}else{var M=rl(x,t.fontWeight,t.fontShape);return zt(i,M,s,t,o.concat(M,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},Hd=(r,e)=>{if(Sn(r.classes)!==Sn(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize||r.italic!==0&&r.hasClass("mathnormal"))return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var n of Object.keys(r.style))if(r.style[n]!==e.style[n])return!1;for(var s of Object.keys(e.style))if(r.style[s]!==e.style[s])return!1;return!0},em=r=>{for(var e=0;e<r.length-1;e++){var t=r[e],n=r[e+1];t instanceof Pt&&n instanceof Pt&&Hd(t,n)&&(t.text+=n.text,t.height=Math.max(t.height,n.height),t.depth=Math.max(t.depth,n.depth),t.italic=n.italic,r.splice(e+1,1),e--)}return r},tc=function(e){for(var t=0,n=0,s=0,i=0;i<e.children.length;i++){var o=e.children[i];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=s},V=function(e,t,n,s){var i=new kn(e,t,n,s);return tc(i),i},Mn=(r,e,t,n)=>new kn(r,e,t,n),S0=function(e,t,n){var s=V([e],[],t);return s.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),s.style.borderBottomWidth=Q(s.height),s.maxFontSize=1,s},Yd=function(e,t,n,s){var i=new y0(e,t,n,s);return tc(i),i},tn=function(e){var t=new yn(e);return tc(t),t},k0=function(e,t){return e instanceof yn?V([],[e],t):e},Xd=function(e){if(e.positionType==="individualShift"){for(var t=e.children,n=[t[0]],s=-t[0].shift-t[0].elem.depth,i=s,o=1;o<t.length;o++){var a=-t[o].shift-i-t[o].elem.depth,l=a-(t[o-1].elem.height+t[o-1].elem.depth);i=i+a,n.push({type:"kern",size:l}),n.push(t[o])}return{children:n,depth:s}}var h;if(e.positionType==="top"){for(var c=e.positionData,m=0;m<e.children.length;m++){var f=e.children[m];c-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}h=c}else if(e.positionType==="bottom")h=-e.positionData;else{var g=e.children[0];if(g.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")h=-g.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")h=-g.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:h}},Ne=function(e,t){for(var{children:n,depth:s}=Xd(e),i=0,o=0;o<n.length;o++){var a=n[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var h=V(["pstrut"],[]);h.style.height=Q(i);for(var c=[],m=s,f=s,g=s,b=0;b<n.length;b++){var v=n[b];if(v.type==="kern")g+=v.size;else{var x=v.elem,S=v.wrapperClasses||[],k=v.wrapperStyle||{},M=V(S,[h,x],void 0,k);M.style.top=Q(-i-g-x.depth),v.marginLeft&&(M.style.marginLeft=v.marginLeft),v.marginRight&&(M.style.marginRight=v.marginRight),c.push(M),g+=x.height+x.depth}m=Math.min(m,g),f=Math.max(f,g)}var _=V(["vlist"],c);_.style.height=Q(f);var B;if(m<0){var $=V([],[]),Y=V(["vlist"],[$]);Y.style.height=Q(-m);var Z=V(["vlist-s"],[new Pt("\u200B")]);B=[V(["vlist-r"],[_,Z]),V(["vlist-r"],[Y])]}else B=[V(["vlist-r"],[_])];var L=V(["vlist-t"],B);return B.length===2&&L.classes.push("vlist-t2"),L.height=f,L.depth=-m,L},tm=(r,e)=>{var t=V(["mspace"],[],e),n=Ke(r,e);return t.style.marginRight=Q(n),t},rl=function(e,t,n){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return t==="textbf"&&n==="textit"?i="BoldItalic":t==="textbf"?i="Bold":t==="textit"?i="Italic":i="Regular",s+"-"+i},$h={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},rm={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},nm=function(e,t){var[n,s,i]=rm[e],o=new Tr(n),a=new ar([o],{width:Q(s),height:Q(i),style:"width:"+Q(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=Mn(["overlay"],[a],t);return l.height=i,l.style.height=Q(i),l.style.width=Q(s),l},Je={number:3,unit:"mu"},e0={number:4,unit:"mu"},Kr={number:5,unit:"mu"},Gd={mord:{mop:Je,mbin:e0,mrel:Kr,minner:Je},mop:{mord:Je,mop:Je,mrel:Kr,minner:Je},mbin:{mord:e0,mop:e0,mopen:e0,minner:e0},mrel:{mord:Kr,mop:Kr,mopen:Kr,minner:Kr},mopen:{},mclose:{mop:Je,mbin:e0,mrel:Kr,minner:Je},mpunct:{mord:Je,mop:Je,mrel:Kr,mopen:Je,mclose:Je,mpunct:Je,minner:Je},minner:{mord:Je,mop:Je,mbin:e0,mrel:Kr,mopen:Je,mpunct:Je,minner:Je}},Wd={mord:{mop:Je},mop:{mord:Je,mop:Je},mbin:{},mrel:{},mopen:{},mclose:{mop:Je},mpunct:{},minner:{mop:Je}},sm={},ml={},dl={};pl=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},ot=function(e){return e.type==="ordgroup"?e.body:[e]},Vd=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Ud=new Set(["rightmost","mrel","mclose","mpunct"]),Jd={display:Se.DISPLAY,text:Se.TEXT,script:Se.SCRIPT,scriptscript:Se.SCRIPTSCRIPT},Kd={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ct=function(e,t,n,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<e.length;o++){var a=Oe(e[o],t);if(a instanceof yn){var l=a.children;i.push(...l)}else i.push(a)}if(em(i),!n)return i;var h=t;if(e.length===1){var c=e[0];c.type==="sizing"?h=t.havingSize(c.size):c.type==="styling"&&(h=t.havingStyle(Jd[c.style]))}var m=V([s[0]||"leftmost"],[],t),f=V([s[1]||"rightmost"],[],t),g=n==="root";return jh(i,(b,v)=>{var x=v.classes[0],S=b.classes[0];x==="mbin"&&Ud.has(S)?v.classes[0]="mord":S==="mbin"&&Vd.has(x)&&(b.classes[0]="mord")},{node:m},f,g),jh(i,(b,v)=>{var x,S,k=Hh(v),M=Hh(b),_=k&&M?b.hasClass("mtight")?(x=Wd[k])==null?void 0:x[M]:(S=Gd[k])==null?void 0:S[M]:null;if(_)return tm(_,h)},{node:m},f,g),i},jh=function(e,t,n,s,i){s&&e.push(s);for(var o=0;o<e.length;o++){var a=e[o],l=im(a);if(l){jh(l.children,t,n,null,i);continue}var h=!a.hasClass("mspace");if(h){var c=t(a,n.node);c&&(n.insertAfter?n.insertAfter(c):(e.unshift(c),o++))}h?n.node=a:i&&a.hasClass("newline")&&(n.node=V(["leftmost"])),n.insertAfter=(m=>f=>{e.splice(m+1,0,f),o++})(o)}s&&e.pop()},im=function(e){return e instanceof yn||e instanceof y0||e instanceof kn&&e.hasClass("enclosing")?e:null},qh=function(e,t){var n=im(e);if(n){var s=n.children;if(s.length){if(t==="right")return qh(s[s.length-1],"right");if(t==="left")return qh(s[0],"left")}}return e},Hh=function(e,t){if(!e)return null;t&&(e=qh(e,t));var n=e.classes[0];return Kd[n]||null},ba=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return V(t.concat(n))},Oe=function(e,t,n){if(!e)return V();if(ml[e.type]){var s=ml[e.type](e,t);if(n&&t.size!==n.size){s=V(t.sizingClasses(n),[s],t);var i=t.sizeMultiplier/n.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new J("Got group of unknown type: '"+e.type+"'")};K=class{constructor(e,t,n){this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=Sn(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Qe&&this.children[n+1]instanceof Qe){for(var s=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Qe;)s+=this.children[++n].toText();e.appendChild(new Qe(s).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=bt(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+bt(Sn(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}},Qe=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return bt(this.toText())}toText(){return this.text}},fl=class{constructor(e){this.width=e,e>=.05555&&e<=.05556?this.character="\u200A":e>=.1666&&e<=.1667?this.character="\u2009":e>=.2222&&e<=.2223?this.character="\u2005":e>=.2777&&e<=.2778?this.character="\u2005\u200A":e>=-.05556&&e<=-.05555?this.character="\u200A\u2063":e>=-.1667&&e<=-.1666?this.character="\u2009\u2063":e>=-.2223&&e<=-.2222?this.character="\u205F\u2063":e>=-.2778&&e<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Q(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Q(this.width)+'"/>'}toText(){return this.character?this.character:" "}},Zd=new Set(["\\imath","\\jmath"]),Qd=new Set(["mrow","mtable"]),Vt=function(e,t,n){return Ge[t][e]&&Ge[t][e].replace&&e.charCodeAt(0)!==55349&&!(Qu.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Ge[t][e].replace),new Qe(e)},rc=function(e){return e.length===1?e[0]:new K("mrow",e)},nc=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var n=t.font;if(!n||n==="mathnormal")return null;var s=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var i=e.text;if(Zd.has(i))return null;if(Ge[s][i]){var o=Ge[s][i].replace;o&&(i=o)}var a=$h[n].fontName;return Qh(i,a,s)?$h[n].variant:null};Ft=function(e,t,n){if(e.length===1){var s=je(e[0],t);return n&&s instanceof K&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,a=0;a<e.length;a++){var l=je(e[a],t);if(l instanceof K&&o instanceof K){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(zh(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&zh(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||zh(o))){var h=l.children[0];h instanceof K&&h.type==="mn"&&(h.children=[...o.children,...h.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var c=o.children[0];if(c instanceof Qe&&c.text==="\u0338"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var m=l.children[0];m instanceof Qe&&m.text.length>0&&(m.text=m.text.slice(0,1)+"\u0338"+m.text.slice(1),i.pop())}}}i.push(l),o=l}return i},zn=function(e,t,n){return rc(Ft(e,t,n))},je=function(e,t){if(!e)return new K("mrow");if(dl[e.type]){var n=dl[e.type](e,t);return n}else throw new J("Got group of unknown type: '"+e.type+"'")};ep=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Mu=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],zu=function(e,t){return t.size<2?e:ep[e-1][t.size-1]},gl=class r{constructor(e){this.style=e.style,this.color=e.color,this.size=e.size||r.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Mu[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(t,e),new r(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:zu(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Mu[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=zu(r.BASESIZE,e);return this.size===t&&this.textSize===r.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==r.BASESIZE?["sizing","reset-size"+this.size,"size"+r.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Od(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};gl.BASESIZE=6;am=function(e){return new gl({style:e.displayMode?Se.DISPLAY:Se.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},lm=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=V(n,[e])}return e},tp=function(e,t,n){var s=am(n),i;if(n.output==="mathml")return ku(e,t,s,n.displayMode,!0);if(n.output==="html"){var o=Yh(e,s);i=V(["katex"],[o])}else{var a=ku(e,t,s,n.displayMode,!1),l=Yh(e,s);i=V(["katex"],[a,l])}return lm(i,n)},rp=function(e,t,n){var s=am(n),i=Yh(e,s),o=V(["katex"],[i]);return lm(o,n)},np={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",underbracket:"\u23B5",overbracket:"\u23B4",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",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},yl=function(e){var t=new K("mo",[new Qe(np[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},sp={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"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,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"],"\\cdlongequal":[["longequal"],3,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],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["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],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},ip=new Set(["widehat","widecheck","widetilde","utilde"]),Sl=function(e,t){function n(){var a=4e5,l=e.label.slice(1);if(ip.has(l)){var h=e,c=h.base.type==="ordgroup"?h.base.body.length:1,m,f,g;if(c>5)l==="widehat"||l==="widecheck"?(m=420,a=2364,g=.42,f=l+"4"):(m=312,a=2340,g=.34,f="tilde4");else{var b=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][b],m=[0,239,300,360,420][b],g=[0,.24,.3,.3,.36,.42][b],f=l+b):(a=[0,600,1033,2339,2340][b],m=[0,260,286,306,312][b],g=[0,.26,.286,.3,.306,.34][b],f="tilde"+b)}var v=new Tr(f),x=new ar([v],{width:"100%",height:Q(g),viewBox:"0 0 "+a+" "+m,preserveAspectRatio:"none"});return{span:Mn([],[x],t),minWidth:0,height:g}}else{var S=[],k=sp[l],[M,_,B]=k,$=B/1e3,Y=M.length,Z,L;if(Y===1){var I=k[3];Z=["hide-tail"],L=[I]}else if(Y===2)Z=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(Y===3)Z=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
260
+ `+Y+" children.");for(var X=0;X<Y;X++){var j=new Tr(M[X]),re=new ar([j],{width:"400em",height:Q($),viewBox:"0 0 "+a+" "+B,preserveAspectRatio:L[X]+" slice"}),te=Mn([Z[X]],[re],t);if(Y===1)return{span:te,minWidth:_,height:$};te.style.height=Q($),S.push(te)}return{span:V(["stretchy"],S,t),minWidth:_,height:$}}}var{span:s,minWidth:i,height:o}=n();return s.height=o,s.style.height=Q(o),i>0&&(s.style.minWidth=Q(i)),s},op=function(e,t,n,s,i){var o,a=e.height+e.depth+n+s;if(/fbox|color|angl/.test(t)){if(o=V(["stretchy",t],[],i),t==="fbox"){var l=i.color&&i.getColor();l&&(o.style.borderColor=l)}}else{var h=[];/^[bx]cancel$/.test(t)&&h.push(new ga({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&h.push(new ga({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new ar(h,{width:"100%",height:Q(a)});o=Mn([],[c],i)}return o.height=a,o.style.height=Q(a),o};hm=r=>{if(r instanceof Pt)return r;if(Nd(r)&&r.children.length===1)return hm(r.children[0])},sc=(r,e)=>{var t,n,s;r&&r.type==="supsub"?(n=Ee(r.base,"accent"),t=n.base,r.base=t,s=Dd(Oe(r,e)),r.base=n):(n=Ee(r,"accent"),t=n.base);var i=Oe(t,e.havingCrampedStyle()),o=n.isShifty&&Qr(t),a=0;if(o){var l,h;a=(l=(h=hm(i))==null?void 0:h.skew)!=null?l:0}var c=n.label==="\\c",m=c?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),f;if(n.isStretchy)f=Sl(n,e),f=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Q(2*a)+")",marginLeft:Q(2*a)}:void 0}]});else{var g,b;n.label==="\\vec"?(g=nm("vec",e),b=rm.vec[1]):(g=vl({type:"textord",mode:n.mode,text:n.label},e,"textord"),g=Ld(g),g.italic=0,b=g.width,c&&(m+=g.depth)),f=V(["accent-body"],[g]);var v=n.label==="\\textcircled";v&&(f.classes.push("accent-full"),m=i.height);var x=a;v||(x-=b/2),f.style.left=Q(x),n.label==="\\textcircled"&&(f.style.top=".2em"),f=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:f}]})}var S=V(["mord","accent"],[f],e);return s?(s.children[0]=S,s.height=Math.max(S.height,s.height),s.classes[0]="mord",s):S},cm=(r,e)=>{var t=r.isStretchy?yl(r.label):new K("mo",[Vt(r.label,r.mode)]),n=new K("mover",[je(r.base,e),t]);return n.setAttribute("accent","true"),n},ap=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));ie({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(r,e)=>{var t=pl(e[0]),n=!ap.test(r.funcName),s=!n||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:n,isShifty:s,base:t}},htmlBuilder:sc,mathmlBuilder:cm});ie({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],n=r.parser.mode;return n==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:sc,mathmlBuilder:cm});ie({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0];return{type:"accentUnder",mode:t.mode,label:n,base:s}},htmlBuilder:(r,e)=>{var t=Oe(r.base,e),n=Sl(r,e),s=r.label==="\\utilde"?.12:0,i=Ne({positionType:"top",positionData:t.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:t}]});return V(["mord","accentunder"],[i],e)},mathmlBuilder:(r,e)=>{var t=yl(r.label),n=new K("munder",[je(r.base,e),t]);return n.setAttribute("accentunder","true"),n}});sl=r=>{var e=new K("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};ie({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n,funcName:s}=r;return{type:"xArrow",mode:n.mode,label:s,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,n=e.havingStyle(t.sup()),s=k0(Oe(r.body,n,e),e),i=r.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var o;r.below&&(n=e.havingStyle(t.sub()),o=k0(Oe(r.below,n,e),e),o.classes.push(i+"-arrow-pad"));var a=Sl(r,e),l=-e.fontMetrics().axisHeight+.5*a.height,h=-e.fontMetrics().axisHeight-.5*a.height-.111;(s.depth>.25||r.label==="\\xleftequilibrium")&&(h-=s.depth);var c;if(o){var m=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;c=Ne({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:m}]})}else c=Ne({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:a,shift:l}]});return c.children[0].children[0].children[1].classes.push("svg-align"),V(["mrel","x-arrow"],[c],e)},mathmlBuilder(r,e){var t=yl(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(r.body){var s=sl(je(r.body,e));if(r.below){var i=sl(je(r.below,e));n=new K("munderover",[t,i,s])}else n=new K("mover",[t,s])}else if(r.below){var o=sl(je(r.below,e));n=new K("munder",[t,o])}else n=sl(),n=new K("mover",[t,n]);return n}});ie({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+n.slice(5),body:ot(s),isCharacterBox:Qr(s)}},htmlBuilder:um,mathmlBuilder:mm});zl=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};ie({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:zl(e[0]),body:ot(e[1]),isCharacterBox:Qr(e[1])}}});ie({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:n}=r,s=e[1],i=e[0],o;n!=="\\stackrel"?o=zl(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:ot(s)},l={type:"supsub",mode:i.mode,base:a,sup:n==="\\underset"?null:i,sub:n==="\\underset"?i:null};return{type:"mclass",mode:t.mode,mclass:o,body:[l],isCharacterBox:Qr(l)}},htmlBuilder:um,mathmlBuilder:mm});ie({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:zl(e[0]),body:ot(e[0])}},htmlBuilder(r,e){var t=ct(r.body,e,!0),n=V([r.mclass],t,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(r,e){var t=Ft(r.body,e),n=new K("mstyle",t);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});lp={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Eu=()=>({type:"styling",body:[],mode:"math",style:"display"}),Pu=r=>r.type==="textord"&&r.text==="@",hp=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;ie({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"cdlabel",mode:t.mode,side:n.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),n=k0(Oe(r.label,t,e),e);return n.classes.push("cd-label-"+r.side),n.style.bottom=Q(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(r,e){var t=new K("mrow",[je(r.label,e)]);return t=new K("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new K("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});ie({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=k0(Oe(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new K("mrow",[je(r.fragment,e)])}});ie({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,n=Ee(e[0],"ordgroup"),s=n.body,i="",o=0;o<s.length;o++){var a=Ee(s[o],"textord");i+=a.text}var l=parseInt(i),h;if(isNaN(l))throw new J("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new J("\\@char with invalid code point "+i);return l<=65535?h=String.fromCharCode(l):(l-=65536,h=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:h}}});dm=(r,e)=>{var t=ct(r.body,e.withColor(r.color),!1);return tn(t)},pm=(r,e)=>{var t=Ft(r.body,e.withColor(r.color)),n=new K("mstyle",t);return n.setAttribute("mathcolor",r.color),n};ie({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,n=Ee(e[0],"color-token").color,s=e[1];return{type:"color",mode:t.mode,color:n,body:ot(s)}},htmlBuilder:dm,mathmlBuilder:pm});ie({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:n}=r,s=Ee(e[0],"color-token").color;t.gullet.macros.set("\\current@color",s);var i=t.parseExpression(!0,n);return{type:"color",mode:t.mode,color:s,body:i}},htmlBuilder:dm,mathmlBuilder:pm});ie({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:n}=r,s=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,i=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:i,size:s&&Ee(s,"size").value}},htmlBuilder(r,e){var t=V(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=Q(Ke(r.size,e)))),t},mathmlBuilder(r,e){var t=new K("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",Q(Ke(r.size,e)))),t}});Xh={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},fm=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new J("Expected a control sequence",r);return e},mp=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},gm=(r,e,t,n)=>{var s=r.gullet.macros.get(t.text);s==null&&(t.noexpand=!0,s={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,s,n)};ie({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var n=e.fetch();if(Xh[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=Xh[n.text]),Ee(e.parseFunction(),"internal");throw new J("Invalid token after macro prefix",n)}});ie({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=e.gullet.popToken(),s=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new J("Expected a control sequence",n);for(var i=0,o,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[i].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new J('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==i+1)throw new J('Argument number "'+n.text+'" out of order');i++,a.push([])}else{if(n.text==="EOF")throw new J("Expected a macro definition");a[i].push(n.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(t==="\\edef"||t==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(s,{tokens:l,numArgs:i,delimiters:a},t===Xh[t]),{type:"internal",mode:e.mode}}});ie({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=fm(e.gullet.popToken());e.gullet.consumeSpaces();var s=mp(e);return gm(e,n,s,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});ie({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=fm(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return gm(e,n,i,t==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});ma=function(e,t,n){var s=Ge.math[e]&&Ge.math[e].replace,i=Qh(s||e,t,n);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return i},ic=function(e,t,n,s){var i=n.havingBaseStyle(t),o=V(s.concat(i.sizingClasses(n)),[e],n),a=i.sizeMultiplier/n.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},bm=function(e,t,n){var s=t.havingBaseStyle(n),i=(1-t.sizeMultiplier/s.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Q(i),e.height-=i,e.depth+=i},dp=function(e,t,n,s,i,o){var a=zt(e,"Main-Regular",i,s),l=ic(a,t,s,o);return n&&bm(l,s,t),l},pp=function(e,t,n,s){return zt(e,"Size"+t+"-Regular",n,s)},wm=function(e,t,n,s,i,o){var a=pp(e,t,i,s),l=ic(V(["delimsizing","size"+t],[a],s),Se.TEXT,s,o);return n&&bm(l,s,Se.TEXT),l},Eh=function(e,t,n){var s;t==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=V(["delimsizinginner",s],[V([],[zt(e,t,n)])]);return{type:"elem",elem:i}},Ph=function(e,t,n){var s=Pr["Size4-Regular"][e.charCodeAt(0)]?Pr["Size4-Regular"][e.charCodeAt(0)][4]:Pr["Size1-Regular"][e.charCodeAt(0)][4],i=new Tr("inner",Ad(e,Math.round(1e3*t))),o=new ar([i],{width:Q(s),height:Q(t),style:"width:"+Q(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=Mn([],[o],n);return a.height=t,a.style.height=Q(t),a.style.width=Q(s),{type:"elem",elem:a}},Gh=.008,il={type:"kern",size:-1*Gh},fp=new Set(["|","\\lvert","\\rvert","\\vert"]),gp=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),xm=function(e,t,n,s,i,o){var a,l,h,c,m="",f=0;a=h=c=e,l=null;var g="Size1-Regular";e==="\\uparrow"?h=c="\u23D0":e==="\\Uparrow"?h=c="\u2016":e==="\\downarrow"?a=h="\u23D0":e==="\\Downarrow"?a=h="\u2016":e==="\\updownarrow"?(a="\\uparrow",h="\u23D0",c="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",h="\u2016",c="\\Downarrow"):fp.has(e)?(h="\u2223",m="vert",f=333):gp.has(e)?(h="\u2225",m="doublevert",f=556):e==="["||e==="\\lbrack"?(a="\u23A1",h="\u23A2",c="\u23A3",g="Size4-Regular",m="lbrack",f=667):e==="]"||e==="\\rbrack"?(a="\u23A4",h="\u23A5",c="\u23A6",g="Size4-Regular",m="rbrack",f=667):e==="\\lfloor"||e==="\u230A"?(h=a="\u23A2",c="\u23A3",g="Size4-Regular",m="lfloor",f=667):e==="\\lceil"||e==="\u2308"?(a="\u23A1",h=c="\u23A2",g="Size4-Regular",m="lceil",f=667):e==="\\rfloor"||e==="\u230B"?(h=a="\u23A5",c="\u23A6",g="Size4-Regular",m="rfloor",f=667):e==="\\rceil"||e==="\u2309"?(a="\u23A4",h=c="\u23A5",g="Size4-Regular",m="rceil",f=667):e==="("||e==="\\lparen"?(a="\u239B",h="\u239C",c="\u239D",g="Size4-Regular",m="lparen",f=875):e===")"||e==="\\rparen"?(a="\u239E",h="\u239F",c="\u23A0",g="Size4-Regular",m="rparen",f=875):e==="\\{"||e==="\\lbrace"?(a="\u23A7",l="\u23A8",c="\u23A9",h="\u23AA",g="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="\u23AB",l="\u23AC",c="\u23AD",h="\u23AA",g="Size4-Regular"):e==="\\lgroup"||e==="\u27EE"?(a="\u23A7",c="\u23A9",h="\u23AA",g="Size4-Regular"):e==="\\rgroup"||e==="\u27EF"?(a="\u23AB",c="\u23AD",h="\u23AA",g="Size4-Regular"):e==="\\lmoustache"||e==="\u23B0"?(a="\u23A7",c="\u23AD",h="\u23AA",g="Size4-Regular"):(e==="\\rmoustache"||e==="\u23B1")&&(a="\u23AB",c="\u23A9",h="\u23AA",g="Size4-Regular");var b=ma(a,g,i),v=b.height+b.depth,x=ma(h,g,i),S=x.height+x.depth,k=ma(c,g,i),M=k.height+k.depth,_=0,B=1;if(l!==null){var $=ma(l,g,i);_=$.height+$.depth,B=2}var Y=v+M+_,Z=Math.max(0,Math.ceil((t-Y)/(B*S))),L=Y+Z*B*S,I=s.fontMetrics().axisHeight;n&&(I*=s.sizeMultiplier);var X=L/2-I,j=[];if(m.length>0){var re=L-v-M,te=Math.round(L*1e3),ke=_d(m,Math.round(re*1e3)),he=new Tr(m,ke),ve=Q(f/1e3),de=Q(te/1e3),Fe=new ar([he],{width:ve,height:de,viewBox:"0 0 "+f+" "+te}),qe=Mn([],[Fe],s);qe.height=te/1e3,qe.style.width=ve,qe.style.height=de,j.push({type:"elem",elem:qe})}else{if(j.push(Eh(c,g,i)),j.push(il),l===null){var Ie=L-v-M+2*Gh;j.push(Ph(h,Ie,s))}else{var ge=(L-v-M-_)/2+2*Gh;j.push(Ph(h,ge,s)),j.push(il),j.push(Eh(l,g,i)),j.push(il),j.push(Ph(h,ge,s))}j.push(il),j.push(Eh(a,g,i))}var Me=s.havingBaseStyle(Se.TEXT),be=Ne({positionType:"bottom",positionData:X,children:j});return ic(V(["delimsizing","mult"],[be],Me),Se.TEXT,s,o)},Th=80,Rh=.08,Ah=function(e,t,n,s,i){var o=Rd(e,s,n),a=new Tr(e,o),l=new ar([a],{width:"400em",height:Q(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return Mn(["hide-tail"],[l],i)},bp=function(e,t){var n=t.havingBaseSizing(),s=Mm("\\surd",e*n.sizeMultiplier,km,n),i=n.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),a,l=0,h=0,c=0,m;return s.type==="small"?(c=1e3+1e3*o+Th,e<1?i=1:e<1.4&&(i=.7),l=(1+o+Rh)/i,h=(1+o)/i,a=Ah("sqrtMain",l,c,o,t),a.style.minWidth="0.853em",m=.833/i):s.type==="large"?(c=(1e3+Th)*da[s.size],h=(da[s.size]+o)/i,l=(da[s.size]+o+Rh)/i,a=Ah("sqrtSize"+s.size,l,c,o,t),a.style.minWidth="1.02em",m=1/i):(l=e+o+Rh,h=e+o,c=Math.floor(1e3*e+o)+Th,a=Ah("sqrtTall",l,c,o,t),a.style.minWidth="0.742em",m=1.056),a.height=h,a.style.height=Q(l),{span:a,advanceWidth:m,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*i}},vm=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"]),wp=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"]),ym=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),da=[0,1.2,1.8,2.4,3],Sm=function(e,t,n,s,i){if(e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle"),vm.has(e)||ym.has(e))return wm(e,t,!1,n,s,i);if(wp.has(e))return xm(e,da[t],!1,n,s,i);throw new J("Illegal delimiter: '"+e+"'")},xp=[{type:"small",style:Se.SCRIPTSCRIPT},{type:"small",style:Se.SCRIPT},{type:"small",style:Se.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],vp=[{type:"small",style:Se.SCRIPTSCRIPT},{type:"small",style:Se.SCRIPT},{type:"small",style:Se.TEXT},{type:"stack"}],km=[{type:"small",style:Se.SCRIPTSCRIPT},{type:"small",style:Se.SCRIPT},{type:"small",style:Se.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],yp=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var t=e.type;throw new Error("Add support for delim type '"+t+"' here.")},Mm=function(e,t,n,s){for(var i=Math.min(2,3-s.style.size),o=i;o<n.length;o++){var a=n[o];if(a.type==="stack")break;var l=ma(e,yp(a),"math"),h=l.height+l.depth;if(a.type==="small"){var c=s.havingBaseStyle(a.style);h*=c.sizeMultiplier}if(h>t)return a}return n[n.length-1]},Wh=function(e,t,n,s,i,o){e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle");var a;ym.has(e)?a=xp:vm.has(e)?a=km:a=vp;var l=Mm(e,t,a,s);return l.type==="small"?dp(e,l.style,n,s,i,o):l.type==="large"?wm(e,l.size,n,s,i,o):xm(e,t,n,s,i,o)},_h=function(e,t,n,s,i,o){var a=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,h=5/s.fontMetrics().ptPerEm,c=Math.max(t-a,n+a),m=Math.max(c/500*l,2*c-h);return Wh(e,m,!0,s,i,o)},Tu={"\\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}},Sp=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);ie({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(r,e)=>{var t=El(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:Tu[r.funcName].size,mclass:Tu[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?V([r.mclass]):Sm(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(Vt(r.delim,r.mode));var t=new K("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var n=Q(da[r.size]);return t.setAttribute("minsize",n),t.setAttribute("maxsize",n),t}});ie({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new J("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:El(e[0],r).text,color:t}}});ie({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=El(e[0],r),n=r.parser;++n.leftrightDepth;var s=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var i=Ee(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:s,left:t.text,right:i.delim,rightColor:i.color}},htmlBuilder:(r,e)=>{Ru(r);for(var t=ct(r.body,e,!0,["mopen","mclose"]),n=0,s=0,i=!1,o=0;o<t.length;o++)t[o].isMiddle?i=!0:(n=Math.max(t[o].height,n),s=Math.max(t[o].depth,s));n*=e.sizeMultiplier,s*=e.sizeMultiplier;var a;if(r.left==="."?a=ba(e,["mopen"]):a=_h(r.left,n,s,e,r.mode,["mopen"]),t.unshift(a),i)for(var l=1;l<t.length;l++){var h=t[l],c=h.isMiddle;c&&(t[l]=_h(c.delim,n,s,c.options,r.mode,[]))}var m;if(r.right===".")m=ba(e,["mclose"]);else{var f=r.rightColor?e.withColor(r.rightColor):e;m=_h(r.right,n,s,f,r.mode,["mclose"])}return t.push(m),V(["minner"],t,e)},mathmlBuilder:(r,e)=>{Ru(r);var t=Ft(r.body,e);if(r.left!=="."){var n=new K("mo",[Vt(r.left,r.mode)]);n.setAttribute("fence","true"),t.unshift(n)}if(r.right!=="."){var s=new K("mo",[Vt(r.right,r.mode)]);s.setAttribute("fence","true"),r.rightColor&&s.setAttribute("mathcolor",r.rightColor),t.push(s)}return rc(t)}});ie({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=El(e[0],r);if(!r.parser.leftrightDepth)throw new J("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=ba(e,[]);else{t=Sm(r.delim,1,e,r.mode,[]);var n={delim:r.delim,options:e};t.isMiddle=n}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?Vt("|","text"):Vt(r.delim,r.mode),n=new K("mo",[t]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});Pl=(r,e)=>{var t=k0(Oe(r.body,e),e),n=r.label.slice(1),s=e.sizeMultiplier,i,o=0,a=Qr(r.body);if(n==="sout")i=V(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,o=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=Ke({number:.6,unit:"pt"},e),h=Ke({number:.35,unit:"ex"},e),c=e.havingBaseSizing();s=s/c.sizeMultiplier;var m=t.height+t.depth+l+h;t.style.paddingLeft=Q(m/2+l);var f=Math.floor(1e3*m*s),g=Pd(f),b=new ar([new Tr("phase",g)],{width:"400em",height:Q(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=Mn(["hide-tail"],[b],e),i.style.height=Q(m),o=t.depth+l+h}else{/cancel/.test(n)?a||t.classes.push("cancel-pad"):n==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var v=0,x=0,S=0;/box/.test(n)?(S=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),v=e.fontMetrics().fboxsep+(n==="colorbox"?0:S),x=v):n==="angl"?(S=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),v=4*S,x=Math.max(0,.25-t.depth)):(v=a?.2:0,x=v),i=op(t,n,v,x,e),/fbox|boxed|fcolorbox/.test(n)?(i.style.borderStyle="solid",i.style.borderWidth=Q(S)):n==="angl"&&S!==.049&&(i.style.borderTopWidth=Q(S),i.style.borderRightWidth=Q(S)),o=t.depth+x,r.backgroundColor&&(i.style.backgroundColor=r.backgroundColor,r.borderColor&&(i.style.borderColor=r.borderColor))}var k;if(r.backgroundColor)k=Ne({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:t,shift:0}]});else{var M=/cancel|phase/.test(n)?["svg-align"]:[];k=Ne({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:M}]})}return/cancel/.test(n)&&(k.height=t.height,k.depth=t.depth),/cancel/.test(n)&&!a?V(["mord","cancel-lap"],[k],e):V(["mord"],[k],e)},Tl=(r,e)=>{var t=0,n=new K(r.label.includes("colorbox")?"mpadded":"menclose",[je(r.body,e)]);switch(r.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*t+"pt"),n.setAttribute("height","+"+2*t+"pt"),n.setAttribute("lspace",t+"pt"),n.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+Q(s)+" solid "+r.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&n.setAttribute("mathbackground",r.backgroundColor),n};ie({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:n,funcName:s}=r,i=Ee(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:n.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:n,funcName:s}=r,i=Ee(e[0],"color-token").color,o=Ee(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:s,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}});ie({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];return{type:"enclose",mode:t.mode,label:n,body:s}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r;t.mode==="math"&&t.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=e[0];return{type:"enclose",mode:t.mode,label:n,body:s}},htmlBuilder:Pl,mathmlBuilder:Tl});ie({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});zm={};Em={};_t=class r{constructor(e,t,n){this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new r(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}},Nt=class r{constructor(e,t){this.text=e,this.loc=t}range(e,t){return new r(t,_t.range(this,e))}};Rl=r=>{var e=r.parser.settings;if(!e.displayMode)throw new J("{"+r.envName+"} can be used only in display mode.")},kp=new Set(["gather","gather*"]);Ar=function(e,t){var n,s,i=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(i),h=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),m=1/t.fontMetrics().ptPerEm,f=5*m;if(e.colSeparationType&&e.colSeparationType==="small"){var g=t.havingStyle(Se.SCRIPT).sizeMultiplier;f=.2778*(g/t.sizeMultiplier)}var b=e.colSeparationType==="CD"?Ke({number:3,unit:"ex"},t):12*m,v=3*m,x=e.arraystretch*b,S=.7*x,k=.3*x,M=0;function _(Oa){for(var Fa=0;Fa<Oa.length;++Fa)Fa>0&&(M+=.25),h.push({pos:M,isDashed:Oa[Fa]})}for(_(o[0]),n=0;n<e.body.length;++n){var B=e.body[n],$=S,Y=k;a<B.length&&(a=B.length);var Z=new Array(B.length);for(s=0;s<B.length;++s){var L=Oe(B[s],t);Y<L.depth&&(Y=L.depth),$<L.height&&($=L.height),Z[s]=L}var I=e.rowGaps[n],X=0;I&&(X=Ke(I,t),X>0&&(X+=k,Y<X&&(Y=X),X=0)),e.addJot&&n<e.body.length-1&&(Y+=v),Z.height=$,Z.depth=Y,M+=$,Z.pos=M,M+=Y+X,l[n]=Z,_(o[n+1])}var j=M/2+t.fontMetrics().axisHeight,re=e.cols||[],te=[],ke,he,ve=[];if(e.tags&&e.tags.some(Oa=>Oa))for(n=0;n<i;++n){var de=l[n],Fe=de.pos-j,qe=e.tags[n],Ie=void 0;qe===!0?Ie=V(["eqn-num"],[],t):qe===!1?Ie=V([],[],t):Ie=V([],ct(qe,t,!0),t),Ie.depth=de.depth,Ie.height=de.height,ve.push({type:"elem",elem:Ie,shift:Fe})}for(s=0,he=0;s<a||he<re.length;++s,++he){for(var ge,Me=re[he],be=!0;((Be=Me)==null?void 0:Be.type)==="separator";){var Be;if(be||(ke=V(["arraycolsep"],[]),ke.style.width=Q(t.fontMetrics().doubleRuleSep),te.push(ke)),Me.separator==="|"||Me.separator===":"){var De=Me.separator==="|"?"solid":"dashed",ye=V(["vertical-separator"],[],t);ye.style.height=Q(M),ye.style.borderRightWidth=Q(c),ye.style.borderRightStyle=De,ye.style.margin="0 "+Q(-c/2);var _e=M-j;_e&&(ye.style.verticalAlign=Q(-_e)),te.push(ye)}else throw new J("Invalid separator type: "+Me.separator);he++,Me=re[he],be=!1}if(!(s>=a)){var Ae=void 0;if(s>0||e.hskipBeforeAndAfter){var Ze,bn;Ae=(Ze=(bn=Me)==null?void 0:bn.pregap)!=null?Ze:f,Ae!==0&&(ke=V(["arraycolsep"],[]),ke.style.width=Q(Ae),te.push(ke))}var ft=[];for(n=0;n<i;++n){var Rt=l[n],Te=Rt[s];if(Te){var nt=Rt.pos-j;Te.depth=Rt.depth,Te.height=Rt.height,ft.push({type:"elem",elem:Te,shift:nt})}}var ch=Ne({positionType:"individualShift",children:ft}),uh=V(["col-align-"+(((ge=Me)==null?void 0:ge.align)||"c")],[ch]);if(te.push(uh),s<a-1||e.hskipBeforeAndAfter){var Da,nu;Ae=(Da=(nu=Me)==null?void 0:nu.postgap)!=null?Da:f,Ae!==0&&(ke=V(["arraycolsep"],[]),ke.style.width=Q(Ae),te.push(ke))}}}var Na=V(["mtable"],te);if(h.length>0){for(var Y1=S0("hline",t,c),X1=S0("hdashline",t,c),mh=[{type:"elem",elem:Na,shift:0}];h.length>0;){var su=h.pop(),iu=su.pos-j;su.isDashed?mh.push({type:"elem",elem:X1,shift:iu}):mh.push({type:"elem",elem:Y1,shift:iu})}Na=Ne({positionType:"individualShift",children:mh})}if(ve.length===0)return V(["mord"],[Na],t);var G1=Ne({positionType:"individualShift",children:ve}),W1=V(["tag"],[G1],t);return tn([Na,W1])},Mp={c:"center ",l:"left ",r:"right "},_r=function(e,t){for(var n=[],s=new K("mtd",[],["mtr-glue"]),i=new K("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],h=0;h<a.length;h++)l.push(new K("mtd",[je(a[h],t)]));e.tags&&e.tags[o]&&(l.unshift(s),l.push(s),e.leqno?l.unshift(i):l.push(i)),n.push(new K("mtr",l))}var c=new K("mtable",n),m=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",Q(m));var f="",g="";if(e.cols&&e.cols.length>0){var b=e.cols,v="",x=!1,S=0,k=b.length;b[0].type==="separator"&&(f+="top ",S=1),b[b.length-1].type==="separator"&&(f+="bottom ",k-=1);for(var M=S;M<k;M++){var _=b[M];_.type==="align"?(g+=Mp[_.align],x&&(v+="none "),x=!0):_.type==="separator"&&x&&(v+=_.separator==="|"?"solid ":"dashed ",x=!1)}c.setAttribute("columnalign",g.trim()),/[sd]/.test(v)&&c.setAttribute("columnlines",v.trim())}if(e.colSeparationType==="align"){for(var B=e.cols||[],$="",Y=1;Y<B.length;Y++)$+=Y%2?"0em ":"1em ";c.setAttribute("columnspacing",$.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?c.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?c.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var Z="",L=e.hLinesBeforeRow;f+=L[0].length>0?"left ":"",f+=L[L.length-1].length>0?"right ":"";for(var I=1;I<L.length-1;I++)Z+=L[I].length===0?"none ":L[I][0]?"dashed ":"solid ";return/[sd]/.test(Z)&&c.setAttribute("rowlines",Z.trim()),f!==""&&(c=new K("menclose",[c]),c.setAttribute("notation",f.trim())),e.arraystretch&&e.arraystretch<1&&(c=new K("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},Pm=function(e,t){e.envName.includes("ed")||Rl(e);var n=[],s=e.envName.includes("at")?"alignat":"align",i=e.envName==="split",o=En(e.parser,{cols:n,addJot:!0,autoTag:i?void 0:oc(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),a=0,l=0,h={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var c="",m=0;m<t[0].body.length;m++){var f=Ee(t[0].body[m],"textord");c+=f.text}a=Number(c),l=a*2}var g=!l;o.body.forEach(function(S){for(var k=1;k<S.length;k+=2){var M=Ee(S[k],"styling"),_=Ee(M.body[0],"ordgroup");_.body.unshift(h)}if(g)l<S.length&&(l=S.length);else{var B=S.length/2;if(a<B)throw new J("Too many math in a row: "+("expected "+a+", but got "+B),S[0])}});for(var b=0;b<l;++b){var v="r",x=0;b%2===1?v="l":b>0&&g&&(x=1),n[b]={type:"align",align:v,pregap:x,postgap:0}}return o.colSeparationType=g?"align":"alignat",o};Rr({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=Ml(e[0]),n=t?[e[0]]:Ee(e[0],"ordgroup").body,s=n.map(function(o){var a=kl(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new J("Unknown column alignment: "+l,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return En(r.parser,i,ac(r.envName))},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var s=r.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),t=s.fetch().text,!"lcr".includes(t))throw new J("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),n.cols=[{type:"align",align:t}]}}var i=En(r.parser,n,ac(r.envName)),o=Math.max(0,...i.body.map(a=>a.length));return i.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=En(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=Ml(e[0]),n=t?[e[0]]:Ee(e[0],"ordgroup").body,s=n.map(function(a){var l=kl(a),h=l.text;if("lc".includes(h))return{type:"align",align:h};throw new J("Unknown column alignment: "+h,a)});if(s.length>1)throw new J("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=En(r.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new J("{subarray} can contain only one column");return o},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=En(r.parser,e,ac(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.includes("r")?".":"\\{",right:r.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Pm,htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){kp.has(r.envName)&&Rl(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:oc(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return En(r.parser,e,"display")},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Pm,htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){Rl(r);var e={autoTag:oc(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return En(r.parser,e,"display")},htmlBuilder:Ar,mathmlBuilder:_r});Rr({type:"array",names:["CD"],props:{numArgs:0},handler(r){return Rl(r),up(r.parser)},htmlBuilder:Ar,mathmlBuilder:_r});y("\\nonumber","\\gdef\\@eqnsw{0}");y("\\notag","\\nonumber");ie({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new J(r.funcName+" valid only within array environment")}});_u=zm;ie({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];if(s.type!=="ordgroup")throw new J("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=Ee(s.body[o],"textord").text;if(n==="\\begin"){if(!_u.hasOwnProperty(i))throw new J("No such environment: "+i,s);var a=_u[i],{args:l,optArgs:h}=t.parseArguments("\\begin{"+i+"}",a),c={mode:t.mode,envName:i,parser:t},m=a.handler(c,l,h);t.expect("\\end",!1);var f=t.nextToken,g=Ee(t.parseFunction(),"environment");if(g.name!==i)throw new J("Mismatch: \\begin{"+i+"} matched by \\end{"+g.name+"}",f);return m}return{type:"environment",mode:t.mode,name:i,nameGroup:s}}});Tm=(r,e)=>{var t=r.font,n=e.withFont(t);return Oe(r.body,n)},Rm=(r,e)=>{var t=r.font,n=e.withFont(t);return je(r.body,n)},Bu={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};ie({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=pl(e[0]),i=n;return i in Bu&&(i=Bu[i]),{type:"font",mode:t.mode,font:i.slice(1),body:s}},htmlBuilder:Tm,mathmlBuilder:Rm});ie({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"mclass",mode:t.mode,mclass:zl(n),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:n}],isCharacterBox:Qr(n)}}});ie({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,breakOnTokenText:s}=r,{mode:i}=t,o=t.parseExpression(!0,s),a="math"+n.slice(1);return{type:"font",mode:i,font:a,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:Tm,mathmlBuilder:Rm});zp=(r,e)=>{var t=e.style,n=t.fracNum(),s=t.fracDen(),i;i=e.havingStyle(n);var o=Oe(r.numer,i,e);if(r.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}i=e.havingStyle(s);var h=Oe(r.denom,i,e),c,m,f;r.hasBarLine?(r.barSize?(m=Ke(r.barSize,e),c=S0("frac-line",e,m)):c=S0("frac-line",e),m=c.height,f=c.height):(c=null,m=0,f=e.fontMetrics().defaultRuleThickness);var g,b,v;t.size===Se.DISPLAY.size?(g=e.fontMetrics().num1,m>0?b=3*f:b=7*f,v=e.fontMetrics().denom1):(m>0?(g=e.fontMetrics().num2,b=f):(g=e.fontMetrics().num3,b=3*f),v=e.fontMetrics().denom2);var x;if(c){var k=e.fontMetrics().axisHeight;g-o.depth-(k+.5*m)<b&&(g+=b-(g-o.depth-(k+.5*m))),k-.5*m-(h.height-v)<b&&(v+=b-(k-.5*m-(h.height-v)));var M=-(k-.5*m);x=Ne({positionType:"individualShift",children:[{type:"elem",elem:h,shift:v},{type:"elem",elem:c,shift:M},{type:"elem",elem:o,shift:-g}]})}else{var S=g-o.depth-(h.height-v);S<b&&(g+=.5*(b-S),v+=.5*(b-S)),x=Ne({positionType:"individualShift",children:[{type:"elem",elem:h,shift:v},{type:"elem",elem:o,shift:-g}]})}i=e.havingStyle(t),x.height*=i.sizeMultiplier/e.sizeMultiplier,x.depth*=i.sizeMultiplier/e.sizeMultiplier;var _;t.size===Se.DISPLAY.size?_=e.fontMetrics().delim1:t.size===Se.SCRIPTSCRIPT.size?_=e.havingStyle(Se.SCRIPT).fontMetrics().delim2:_=e.fontMetrics().delim2;var B,$;return r.leftDelim==null?B=ba(e,["mopen"]):B=Wh(r.leftDelim,_,!0,e.havingStyle(t),r.mode,["mopen"]),r.continued?$=V([]):r.rightDelim==null?$=ba(e,["mclose"]):$=Wh(r.rightDelim,_,!0,e.havingStyle(t),r.mode,["mclose"]),V(["mord"].concat(i.sizingClasses(e)),[B,V(["mfrac"],[x]),$],e)},Ep=(r,e)=>{var t=new K("mfrac",[je(r.numer,e),je(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var n=Ke(r.barSize,e);t.setAttribute("linethickness",Q(n))}if(r.leftDelim!=null||r.rightDelim!=null){var s=[];if(r.leftDelim!=null){var i=new K("mo",[new Qe(r.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(t),r.rightDelim!=null){var o=new K("mo",[new Qe(r.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return rc(s)}return t},Am=(r,e)=>{if(!e)return r;var t={type:"styling",mode:r.mode,style:e,body:[r]};return t};ie({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0],i=e[1],o,a=null,l=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var h=n==="\\cfrac",c=null;return h||n.startsWith("\\d")?c="display":n.startsWith("\\t")&&(c="text"),Am({type:"genfrac",mode:t.mode,numer:s,denom:i,continued:h,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},c)},htmlBuilder:zp,mathmlBuilder:Ep});ie({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:n}=r,s;switch(t){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:n}}});Cu=["display","text","script","scriptscript"],Iu=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};ie({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,n=e[4],s=e[5],i=pl(e[0]),o=i.type==="atom"&&i.family==="open"?Iu(i.text):null,a=pl(e[1]),l=a.type==="atom"&&a.family==="close"?Iu(a.text):null,h=Ee(e[2],"size"),c,m=null;h.isBlank?c=!0:(m=h.value,c=m.number>0);var f=null,g=e[3];if(g.type==="ordgroup"){if(g.body.length>0){var b=Ee(g.body[0],"textord");f=Cu[Number(b.text)]}}else g=Ee(g,"textord"),f=Cu[Number(g.text)];return Am({type:"genfrac",mode:t.mode,numer:n,denom:s,continued:!1,hasBarLine:c,barSize:m,leftDelim:o,rightDelim:l},f)}});ie({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:n,token:s}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:Ee(e[0],"size").value,token:s}}});ie({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0],i=Ee(e[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=e[2],a=i.number>0;return{type:"genfrac",mode:t.mode,numer:s,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});_m=(r,e)=>{var t=e.style,n,s;r.type==="supsub"?(n=r.sup?Oe(r.sup,e.havingStyle(t.sup()),e):Oe(r.sub,e.havingStyle(t.sub()),e),s=Ee(r.base,"horizBrace")):s=Ee(r,"horizBrace");var i=Oe(s.base,e.havingBaseStyle(Se.DISPLAY)),o=Sl(s,e),a;if(s.isOver?(a=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o}]}),a.children[0].children[0].children[1].classes.push("svg-align")):(a=Ne({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:i}]}),a.children[0].children[0].children[0].classes.push("svg-align")),n){var l=V(["minner",s.isOver?"mover":"munder"],[a],e);s.isOver?a=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]}):a=Ne({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]})}return V(["minner",s.isOver?"mover":"munder"],[a],e)},Pp=(r,e)=>{var t=yl(r.label);return new K(r.isOver?"mover":"munder",[je(r.base,e),t])};ie({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"horizBrace",mode:t.mode,label:n,isOver:n.includes("\\over"),base:e[0]}},htmlBuilder:_m,mathmlBuilder:Pp});ie({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[1],s=Ee(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:t.mode,href:s,body:ot(n)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=ct(r.body,e,!1);return Yd(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=zn(r.body,e);return t instanceof K||(t=new K("mrow",[t])),t.setAttribute("href",r.href),t}});ie({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=Ee(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:n}))return t.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:t.mode,font:"\\texttt",body:s};return{type:"href",mode:t.mode,href:n,body:ot(a)}}});ie({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(r,e){var{parser:t}=r;return{type:"hbox",mode:t.mode,body:ot(e[0])}},htmlBuilder(r,e){var t=ct(r.body,e,!1);return tn(t)},mathmlBuilder(r,e){return new K("mrow",Ft(r.body,e))}});ie({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,token:s}=r,i=Ee(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(n){case"\\htmlClass":l.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),c=0;c<h.length;c++){var m=h[c],f=m.indexOf("=");if(f<0)throw new J("\\htmlData key/value '"+m+"' missing equals sign");var g=m.slice(0,f),b=m.slice(f+1);l["data-"+g.trim()]=b}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(a)?{type:"html",mode:t.mode,attributes:l,body:ot(o)}:t.formatUnsupportedCmd(n)},htmlBuilder:(r,e)=>{var t=ct(r.body,e,!1),n=["enclosing"];r.attributes.class&&n.push(...r.attributes.class.trim().split(/\s+/));var s=V(n,t,e);for(var i in r.attributes)i!=="class"&&r.attributes.hasOwnProperty(i)&&s.setAttribute(i,r.attributes[i]);return s},mathmlBuilder:(r,e)=>zn(r.body,e)});ie({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:ot(e[0]),mathml:ot(e[1])}},htmlBuilder:(r,e)=>{var t=ct(r.html,e,!1);return tn(t)},mathmlBuilder:(r,e)=>zn(r.mathml,e)});Bh=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new J("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!Vu(n))throw new J("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};ie({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:n}=r,s={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(t[0])for(var l=Ee(t[0],"raw").string,h=l.split(","),c=0;c<h.length;c++){var m=h[c].split("=");if(m.length===2){var f=m[1].trim();switch(m[0].trim()){case"alt":a=f;break;case"width":s=Bh(f);break;case"height":i=Bh(f);break;case"totalheight":o=Bh(f);break;default:throw new J("Invalid key: '"+m[0]+"' in \\includegraphics.")}}}var g=Ee(e[0],"url").url;return a===""&&(a=g,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:g})?{type:"includegraphics",mode:n.mode,alt:a,width:s,height:i,totalheight:o,src:g}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(r,e)=>{var t=Ke(r.height,e),n=0;r.totalheight.number>0&&(n=Ke(r.totalheight,e)-t);var s=0;r.width.number>0&&(s=Ke(r.width,e));var i={height:Q(t+n)};s>0&&(i.width=Q(s)),n>0&&(i.verticalAlign=Q(-n));var o=new Oh(r.src,r.alt,i);return o.height=t,o.depth=n,o},mathmlBuilder:(r,e)=>{var t=new K("mglyph",[]);t.setAttribute("alt",r.alt);var n=Ke(r.height,e),s=0;if(r.totalheight.number>0&&(s=Ke(r.totalheight,e)-n,t.setAttribute("valign",Q(-s))),t.setAttribute("height",Q(n+s)),r.width.number>0){var i=Ke(r.width,e);t.setAttribute("width",Q(i))}return t.setAttribute("src",r.src),t}});ie({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,s=Ee(e[0],"size");if(t.settings.strict){var i=n[1]==="m",o=s.value.unit==="mu";i?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+s.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:s.value}},htmlBuilder(r,e){return tm(r.dimension,e)},mathmlBuilder(r,e){var t=Ke(r.dimension,e);return new fl(t)}});ie({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0];return{type:"lap",mode:t.mode,alignment:n.slice(5),body:s}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=V([],[Oe(r.body,e)]),t=V(["inner"],[t],e)):t=V(["inner"],[Oe(r.body,e)]);var n=V(["fix"],[]),s=V([r.alignment],[t,n],e),i=V(["strut"]);return i.style.height=Q(s.height+s.depth),s.depth&&(i.style.verticalAlign=Q(-s.depth)),s.children.unshift(i),s=V(["thinbox"],[s],e),V(["mord","vbox"],[s],e)},mathmlBuilder:(r,e)=>{var t=new K("mpadded",[je(r.body,e)]);if(r.alignment!=="rlap"){var n=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",n+"width")}return t.setAttribute("width","0px"),t}});ie({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:n}=r,s=n.mode;n.switchMode("math");var i=t==="\\("?"\\)":"$",o=n.parseExpression(!1,i);return n.expect(i),n.switchMode(s),{type:"styling",mode:n.mode,style:"text",body:o}}});ie({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new J("Mismatched "+r.funcName)}});Lu=(r,e)=>{switch(e.style.size){case Se.DISPLAY.size:return r.display;case Se.TEXT.size:return r.text;case Se.SCRIPT.size:return r.script;case Se.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};ie({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:ot(e[0]),text:ot(e[1]),script:ot(e[2]),scriptscript:ot(e[3])}},htmlBuilder:(r,e)=>{var t=Lu(r,e),n=ct(t,e,!1);return tn(n)},mathmlBuilder:(r,e)=>{var t=Lu(r,e);return zn(t,e)}});Bm=(r,e,t,n,s,i,o)=>{r=V([],[r]);var a=t&&Qr(t),l,h;if(e){var c=Oe(e,n.havingStyle(s.sup()),n);h={elem:c,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-c.depth)}}if(t){var m=Oe(t,n.havingStyle(s.sub()),n);l={elem:m,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-m.height)}}var f;if(h&&l){var g=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+r.depth+o;f=Ne({positionType:"bottom",positionData:g,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Q(-i)},{type:"kern",size:l.kern},{type:"elem",elem:r},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Q(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(l){var b=r.height-o;f=Ne({positionType:"top",positionData:b,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Q(-i)},{type:"kern",size:l.kern},{type:"elem",elem:r}]})}else if(h){var v=r.depth+o;f=Ne({positionType:"bottom",positionData:v,children:[{type:"elem",elem:r},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Q(i)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return r;var x=[f];if(l&&i!==0&&!a){var S=V(["mspace"],[],n);S.style.marginRight=Q(i),x.unshift(S)}return V(["mop","op-limits"],x,n)},Cm=new Set(["\\smallint"]),z0=(r,e)=>{var t,n,s=!1,i;r.type==="supsub"?(t=r.sup,n=r.sub,i=Ee(r.base,"op"),s=!0):i=Ee(r,"op");var o=e.style,a=!1;o.size===Se.DISPLAY.size&&i.symbol&&!Cm.has(i.name)&&(a=!0);var l;if(i.symbol){var h=a?"Size2-Regular":"Size1-Regular",c="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(c=i.name.slice(1),i.name=c==="oiint"?"\\iint":"\\iiint"),l=zt(i.name,h,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),c.length>0){var m=l.italic,f=nm(c+"Size"+(a?"2":"1"),e);l=Ne({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+c,l.classes.unshift("mop"),l.italic=m}}else if(i.body){var g=ct(i.body,e,!0);g.length===1&&g[0]instanceof Pt?(l=g[0],l.classes[0]="mop"):l=V(["mop"],g,e)}else{for(var b=[],v=1;v<i.name.length;v++)b.push(ec(i.name[v],i.mode,e));l=V(["mop"],b,e)}var x=0,S=0;return(l instanceof Pt||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift&&(x=(l.height-l.depth)/2-e.fontMetrics().axisHeight,S=l.italic||0),s?Bm(l,t,n,e,o,S,x):(x&&(l.style.position="relative",l.style.top=Q(x)),l)},xa=(r,e)=>{var t;if(r.symbol)t=new K("mo",[Vt(r.name,r.mode)]),Cm.has(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new K("mo",Ft(r.body,e));else{t=new K("mi",[new Qe(r.name.slice(1))]);var n=new K("mo",[Vt("\u2061","text")]);r.parentIsSupSub?t=new K("mrow",[t,n]):t=om([t,n])}return t},Tp={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};ie({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=n;return s.length===1&&(s=Tp[s]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:z0,mathmlBuilder:xa});ie({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ot(n)}},htmlBuilder:z0,mathmlBuilder:xa});Rp={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};ie({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:z0,mathmlBuilder:xa});ie({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:z0,mathmlBuilder:xa});ie({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,n=t;return n.length===1&&(n=Rp[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:z0,mathmlBuilder:xa});Im=(r,e)=>{var t,n,s=!1,i;r.type==="supsub"?(t=r.sup,n=r.sub,i=Ee(r.base,"operatorname"),s=!0):i=Ee(r,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(m=>{var f="text"in m?m.text:void 0;return typeof f=="string"?{type:"textord",mode:m.mode,text:f}:m}),l=ct(a,e.withFont("mathrm"),!0),h=0;h<l.length;h++){var c=l[h];c instanceof Pt&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=V(["mop"],l,e)}else o=V(["mop"],[],e);return s?Bm(o,t,n,e,e.style,0,0):o},Ap=(r,e)=>{for(var t=Ft(r.body,e.withFont("mathrm")),n=!0,s=0;s<t.length;s++){var i=t[s];if(!(i instanceof fl))if(i instanceof K)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=i.children[0];i.children.length===1&&o instanceof Qe?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=t.map(c=>c.toText()).join("");t=[new Qe(a)]}var l=new K("mi",t);l.setAttribute("mathvariant","normal");var h=new K("mo",[Vt("\u2061","text")]);return r.parentIsSupSub?new K("mrow",[l,h]):om([l,h])};ie({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,s=e[0];return{type:"operatorname",mode:t.mode,body:ot(s),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Im,mathmlBuilder:Ap});y("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");t0({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?tn(ct(r.body,e,!1)):V(["mord"],ct(r.body,e,!0),e)},mathmlBuilder(r,e){return zn(r.body,e,!0)}});ie({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,n=e[0];return{type:"overline",mode:t.mode,body:n}},htmlBuilder(r,e){var t=Oe(r.body,e.havingCrampedStyle()),n=S0("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*s},{type:"elem",elem:n},{type:"kern",size:s}]});return V(["mord","overline"],[i],e)},mathmlBuilder(r,e){var t=new K("mo",[new Qe("\u203E")]);t.setAttribute("stretchy","true");var n=new K("mover",[je(r.body,e),t]);return n.setAttribute("accent","true"),n}});ie({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"phantom",mode:t.mode,body:ot(n)}},htmlBuilder:(r,e)=>{var t=ct(r.body,e.withPhantom(),!1);return tn(t)},mathmlBuilder:(r,e)=>{var t=Ft(r.body,e);return new K("mphantom",t)}});y("\\hphantom","\\smash{\\phantom{#1}}");ie({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"vphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=V(["inner"],[Oe(r.body,e.withPhantom())]),n=V(["fix"],[]);return V(["mord","rlap"],[t,n],e)},mathmlBuilder:(r,e)=>{var t=Ft(ot(r.body),e),n=new K("mphantom",t),s=new K("mpadded",[n]);return s.setAttribute("width","0px"),s}});ie({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,n=Ee(e[0],"size").value,s=e[1];return{type:"raisebox",mode:t.mode,dy:n,body:s}},htmlBuilder(r,e){var t=Oe(r.body,e),n=Ke(r.dy,e);return Ne({positionType:"shift",positionData:-n,children:[{type:"elem",elem:t}]})},mathmlBuilder(r,e){var t=new K("mpadded",[je(r.body,e)]),n=r.dy.number+r.dy.unit;return t.setAttribute("voffset",n),t}});ie({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}});ie({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:n}=r,s=t[0],i=Ee(e[0],"size"),o=Ee(e[1],"size");return{type:"rule",mode:n.mode,shift:s&&Ee(s,"size").value,width:i.value,height:o.value}},htmlBuilder(r,e){var t=V(["mord","rule"],[],e),n=Ke(r.width,e),s=Ke(r.height,e),i=r.shift?Ke(r.shift,e):0;return t.style.borderRightWidth=Q(n),t.style.borderTopWidth=Q(s),t.style.bottom=Q(i),t.width=n,t.height=s+i,t.depth=-i,t.maxFontSize=s*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=Ke(r.width,e),n=Ke(r.height,e),s=r.shift?Ke(r.shift,e):0,i=e.color&&e.getColor()||"black",o=new K("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Q(t)),o.setAttribute("height",Q(n));var a=new K("mpadded",[o]);return s>=0?a.setAttribute("height",Q(s)):(a.setAttribute("height",Q(s)),a.setAttribute("depth",Q(-s))),a.setAttribute("voffset",Q(s)),a}});Du=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],_p=(r,e)=>{var t=e.havingSize(r.size);return Lm(r.body,t,e)};ie({type:"sizing",names:Du,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:n,parser:s}=r,i=s.parseExpression(!1,t);return{type:"sizing",mode:s.mode,size:Du.indexOf(n)+1,body:i}},htmlBuilder:_p,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),n=Ft(r.body,t),s=new K("mstyle",n);return s.setAttribute("mathsize",Q(t.sizeMultiplier)),s}});ie({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:n}=r,s=!1,i=!1,o=t[0]&&Ee(t[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var h=o.body[l];if(a=kl(h).text,a==="t")s=!0;else if(a==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var c=e[0];return{type:"smash",mode:n.mode,body:c,smashHeight:s,smashDepth:i}},htmlBuilder:(r,e)=>{var t=V([],[Oe(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0),r.smashDepth&&(t.depth=0),r.smashHeight&&r.smashDepth)return V(["mord","smash"],[t],e);if(t.children)for(var n=0;n<t.children.length;n++)r.smashHeight&&(t.children[n].height=0),r.smashDepth&&(t.children[n].depth=0);var s=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:t}]});return V(["mord"],[s],e)},mathmlBuilder:(r,e)=>{var t=new K("mpadded",[je(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}});ie({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n}=r,s=t[0],i=e[0];return{type:"sqrt",mode:n.mode,body:i,index:s}},htmlBuilder(r,e){var t=Oe(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=k0(t,e);var n=e.fontMetrics(),s=n.defaultRuleThickness,i=s;e.style.id<Se.TEXT.id&&(i=e.fontMetrics().xHeight);var o=s+i/4,a=t.height+t.depth+o+s,{span:l,ruleWidth:h,advanceWidth:c}=bp(a,e),m=l.height-h;m>t.height+t.depth+o&&(o=(o+m-t.height-t.depth)/2);var f=l.height-t.height-o-h;t.style.paddingLeft=Q(c);var g=Ne({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+f)},{type:"elem",elem:l},{type:"kern",size:h}]});if(r.index){var b=e.havingStyle(Se.SCRIPTSCRIPT),v=Oe(r.index,b,e),x=.6*(g.height-g.depth),S=Ne({positionType:"shift",positionData:-x,children:[{type:"elem",elem:v}]}),k=V(["root"],[S]);return V(["mord","sqrt"],[k,g],e)}else return V(["mord","sqrt"],[g],e)},mathmlBuilder(r,e){var{body:t,index:n}=r;return n?new K("mroot",[je(t,e),je(n,e)]):new K("msqrt",[je(t,e)])}});Nu={display:Se.DISPLAY,text:Se.TEXT,script:Se.SCRIPT,scriptscript:Se.SCRIPTSCRIPT};ie({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:n,parser:s}=r,i=s.parseExpression(!0,t),o=n.slice(1,n.length-5);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(r,e){var t=Nu[r.style],n=e.havingStyle(t).withFont("");return Lm(r.body,n,e)},mathmlBuilder(r,e){var t=Nu[r.style],n=e.havingStyle(t),s=Ft(r.body,n),i=new K("mstyle",s),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[r.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});Bp=function(e,t){var n=e.base;if(n)if(n.type==="op"){var s=n.limits&&(t.style.size===Se.DISPLAY.size||n.alwaysHandleSupSub);return s?z0:null}else if(n.type==="operatorname"){var i=n.alwaysHandleSupSub&&(t.style.size===Se.DISPLAY.size||n.limits);return i?Im:null}else{if(n.type==="accent")return Qr(n.base)?sc:null;if(n.type==="horizBrace"){var o=!e.sub;return o===n.isOver?_m:null}else return null}else return null};t0({type:"supsub",htmlBuilder(r,e){var t=Bp(r,e);if(t)return t(r,e);var{base:n,sup:s,sub:i}=r,o=Oe(n,e),a,l,h=e.fontMetrics(),c=0,m=0,f=n&&Qr(n);if(s){var g=e.havingStyle(e.style.sup());a=Oe(s,g,e),f||(c=o.height-g.fontMetrics().supDrop*g.sizeMultiplier/e.sizeMultiplier)}if(i){var b=e.havingStyle(e.style.sub());l=Oe(i,b,e),f||(m=o.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var v;e.style===Se.DISPLAY?v=h.sup1:e.style.cramped?v=h.sup3:v=h.sup2;var x=e.sizeMultiplier,S=Q(.5/h.ptPerEm/x),k=null;if(l){var M=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(o instanceof Pt||M)&&(k=Q(-o.italic))}var _;if(a&&l){c=Math.max(c,v,a.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var B=h.defaultRuleThickness,$=4*B;if(c-a.depth-(l.height-m)<$){m=$-(c-a.depth)+l.height;var Y=.8*h.xHeight-(c-a.depth);Y>0&&(c+=Y,m-=Y)}var Z=[{type:"elem",elem:l,shift:m,marginRight:S,marginLeft:k},{type:"elem",elem:a,shift:-c,marginRight:S}];_=Ne({positionType:"individualShift",children:Z})}else if(l){m=Math.max(m,h.sub1,l.height-.8*h.xHeight);var L=[{type:"elem",elem:l,marginLeft:k,marginRight:S}];_=Ne({positionType:"shift",positionData:m,children:L})}else if(a)c=Math.max(c,v,a.depth+.25*h.xHeight),_=Ne({positionType:"shift",positionData:-c,children:[{type:"elem",elem:a,marginRight:S}]});else throw new Error("supsub must have either sup or sub.");var I=Hh(o,"right")||"mord";return V([I],[o,V(["msupsub"],[_])],e)},mathmlBuilder(r,e){var t=!1,n,s;r.base&&r.base.type==="horizBrace"&&(s=!!r.sup,s===r.base.isOver&&(t=!0,n=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var i=[je(r.base,e)];r.sub&&i.push(je(r.sub,e)),r.sup&&i.push(je(r.sup,e));var o;if(t)o=n?"mover":"munder";else if(r.sub)if(r.sup){var h=r.base;h&&h.type==="op"&&h.limits&&e.style===Se.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===Se.DISPLAY||h.limits)?o="munderover":o="msubsup"}else{var l=r.base;l&&l.type==="op"&&l.limits&&(e.style===Se.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Se.DISPLAY)?o="munder":o="msub"}else{var a=r.base;a&&a.type==="op"&&a.limits&&(e.style===Se.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===Se.DISPLAY)?o="mover":o="msup"}return new K(o,i)}});t0({type:"atom",htmlBuilder(r,e){return ec(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new K("mo",[Vt(r.text,r.mode)]);if(r.family==="bin"){var n=nc(r,e);n==="bold-italic"&&t.setAttribute("mathvariant",n)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});Dm={mi:"italic",mn:"normal",mtext:"normal"};t0({type:"mathord",htmlBuilder(r,e){return vl(r,e,"mathord")},mathmlBuilder(r,e){var t=new K("mi",[Vt(r.text,r.mode,e)]),n=nc(r,e)||"italic";return n!==Dm[t.type]&&t.setAttribute("mathvariant",n),t}});t0({type:"textord",htmlBuilder(r,e){return vl(r,e,"textord")},mathmlBuilder(r,e){var t=Vt(r.text,r.mode,e),n=nc(r,e)||"normal",s;return r.mode==="text"?s=new K("mtext",[t]):/[0-9]/.test(r.text)?s=new K("mn",[t]):r.text==="\\prime"?s=new K("mo",[t]):s=new K("mi",[t]),n!==Dm[s.type]&&s.setAttribute("mathvariant",n),s}});Ch={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Ih={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};t0({type:"spacing",htmlBuilder(r,e){if(Ih.hasOwnProperty(r.text)){var t=Ih[r.text].className||"";if(r.mode==="text"){var n=vl(r,e,"textord");return n.classes.push(t),n}else return V(["mspace",t],[ec(r.text,r.mode,e)],e)}else{if(Ch.hasOwnProperty(r.text))return V(["mspace",Ch[r.text]],[],e);throw new J('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(Ih.hasOwnProperty(r.text))t=new K("mtext",[new Qe("\xA0")]);else{if(Ch.hasOwnProperty(r.text))return new K("mspace");throw new J('Unknown type of space "'+r.text+'"')}return t}});Ou=()=>{var r=new K("mtd",[]);return r.setAttribute("width","50%"),r};t0({type:"tag",mathmlBuilder(r,e){var t=new K("mtable",[new K("mtr",[Ou(),new K("mtd",[zn(r.body,e)]),Ou(),new K("mtd",[zn(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});Fu={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},$u={"\\textbf":"textbf","\\textmd":"textmd"},Cp={"\\textit":"textit","\\textup":"textup"},ju=(r,e)=>{var t=r.font;if(t){if(Fu[t])return e.withTextFontFamily(Fu[t]);if($u[t])return e.withTextFontWeight($u[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Cp[t])};ie({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,s=e[0];return{type:"text",mode:t.mode,body:ot(s),font:n}},htmlBuilder(r,e){var t=ju(r,e),n=ct(r.body,t,!0);return V(["mord","text"],n,t)},mathmlBuilder(r,e){var t=ju(r,e);return zn(r.body,t)}});ie({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=Oe(r.body,e),n=S0("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=Ne({positionType:"top",positionData:t.height,children:[{type:"kern",size:s},{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:t}]});return V(["mord","underline"],[i],e)},mathmlBuilder(r,e){var t=new K("mo",[new Qe("\u203E")]);t.setAttribute("stretchy","true");var n=new K("munder",[je(r.body,e),t]);return n.setAttribute("accentunder","true"),n}});ie({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=Oe(r.body,e),n=e.fontMetrics().axisHeight,s=.5*(t.height-n-(t.depth+n));return Ne({positionType:"shift",positionData:s,children:[{type:"elem",elem:t}]})},mathmlBuilder(r,e){return new K("mpadded",[je(r.body,e)],["vcenter"])}});ie({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new J("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=qu(r),n=[],s=e.havingStyle(e.style.text()),i=0;i<t.length;i++){var o=t[i];o==="~"&&(o="\\textasciitilde"),n.push(zt(o,"Typewriter-Regular",r.mode,s,["mord","texttt"]))}return V(["mord","text"].concat(s.sizingClasses(e)),em(n),s)},mathmlBuilder(r,e){var t=new Qe(qu(r)),n=new K("mtext",[t]);return n.setAttribute("mathvariant","monospace"),n}});qu=r=>r.body.replace(/ /g,r.star?"\u2423":"\xA0"),vn=sm,Nm=`[ \r
261
+ ]`,Ip="\\\\[a-zA-Z@]+",Lp="\\\\[^\uD800-\uDFFF]",Dp="("+Ip+")"+Nm+"*",Np=`\\\\(
262
262
  |[ \r ]+
263
- ?)[ \r ]*`,Vh="[\u0300-\u036F]",Dp=new RegExp(Vh+"+$"),Np="("+Om+"+)|"+(Lp+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(Vh+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(Vh+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Ip)+("|"+Cp+")"),bl=class{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(Np,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Nt("EOF",new _t(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new J("Unexpected character: '"+e[t]+"'",new Nt(e[t],new _t(this,t,t+1)));var s=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(`
264
- `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Nt(s,new _t(this,t,this.tokenRegex.lastIndex))}},Uh=class{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new J("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var s=0;s<this.undefStack.length;s++)delete this.undefStack[s][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}},Op=Pm;y("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});y("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}});y("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}});y("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}});y("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});y("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");y("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});Yu={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};y("\\char",function(r){var e=r.popToken(),t,n=0;if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new J("\\char` missing argument");n=e.text.charCodeAt(0)}else t=10;if(t){if(n=Yu[e.text],n==null||n>=t)throw new J("Invalid base-"+t+" digit "+e.text);for(var s;(s=Yu[r.future().text])!=null&&s<t;)n*=t,n+=s,r.popToken()}return"\\@char{"+n+"}"});lc=(r,e,t,n)=>{var s=r.consumeArg().tokens;if(s.length!==1)throw new J("\\newcommand's first argument must be a macro name");var i=s[0].text,o=r.isDefined(i);if(o&&!e)throw new J("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!t)throw new J("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(s=r.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var l="",h=r.expandNextToken();h.text!=="]"&&h.text!=="EOF";)l+=h.text,h=r.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new J("Invalid number of arguments: "+l);a=parseInt(l),s=r.consumeArg().tokens}return o&&n||r.macros.set(i,{tokens:s,numArgs:a}),""};y("\\newcommand",r=>lc(r,!1,!0,!1));y("\\renewcommand",r=>lc(r,!0,!1,!1));y("\\providecommand",r=>lc(r,!0,!0,!0));y("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});y("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});y("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),vn[t],Ge.math[t],Ge.text[t]),""});y("\\bgroup","{");y("\\egroup","}");y("~","\\nobreakspace");y("\\lq","`");y("\\rq","'");y("\\aa","\\r a");y("\\AA","\\r A");y("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");y("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");y("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");y("\u212C","\\mathscr{B}");y("\u2130","\\mathscr{E}");y("\u2131","\\mathscr{F}");y("\u210B","\\mathscr{H}");y("\u2110","\\mathscr{I}");y("\u2112","\\mathscr{L}");y("\u2133","\\mathscr{M}");y("\u211B","\\mathscr{R}");y("\u212D","\\mathfrak{C}");y("\u210C","\\mathfrak{H}");y("\u2128","\\mathfrak{Z}");y("\\Bbbk","\\Bbb{k}");y("\\llap","\\mathllap{\\textrm{#1}}");y("\\rlap","\\mathrlap{\\textrm{#1}}");y("\\clap","\\mathclap{\\textrm{#1}}");y("\\mathstrut","\\vphantom{(}");y("\\underbar","\\underline{\\text{#1}}");y("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');y("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");y("\\ne","\\neq");y("\u2260","\\neq");y("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");y("\u2209","\\notin");y("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");y("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");y("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");y("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");y("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");y("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");y("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");y("\u27C2","\\perp");y("\u203C","\\mathclose{!\\mkern-0.8mu!}");y("\u220C","\\notni");y("\u231C","\\ulcorner");y("\u231D","\\urcorner");y("\u231E","\\llcorner");y("\u231F","\\lrcorner");y("\xA9","\\copyright");y("\xAE","\\textregistered");y("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');y("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');y("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');y("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');y("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");y("\u22EE","\\vdots");y("\\varGamma","\\mathit{\\Gamma}");y("\\varDelta","\\mathit{\\Delta}");y("\\varTheta","\\mathit{\\Theta}");y("\\varLambda","\\mathit{\\Lambda}");y("\\varXi","\\mathit{\\Xi}");y("\\varPi","\\mathit{\\Pi}");y("\\varSigma","\\mathit{\\Sigma}");y("\\varUpsilon","\\mathit{\\Upsilon}");y("\\varPhi","\\mathit{\\Phi}");y("\\varPsi","\\mathit{\\Psi}");y("\\varOmega","\\mathit{\\Omega}");y("\\substack","\\begin{subarray}{c}#1\\end{subarray}");y("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");y("\\boxed","\\fbox{$\\displaystyle{#1}$}");y("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");y("\\implies","\\DOTSB\\;\\Longrightarrow\\;");y("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");y("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");y("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");Xu={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Fp=new Set(["bin","rel"]);y("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in Xu?e=Xu[t]:(t.slice(0,4)==="\\not"||t in Ge.math&&Fp.has(Ge.math[t].group))&&(e="\\dotsb"),e});hc={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};y("\\dotso",function(r){var e=r.future().text;return e in hc?"\\ldots\\,":"\\ldots"});y("\\dotsc",function(r){var e=r.future().text;return e in hc&&e!==","?"\\ldots\\,":"\\ldots"});y("\\cdots",function(r){var e=r.future().text;return e in hc?"\\@cdots\\,":"\\@cdots"});y("\\dotsb","\\cdots");y("\\dotsm","\\cdots");y("\\dotsi","\\!\\cdots");y("\\dotsx","\\ldots\\,");y("\\DOTSI","\\relax");y("\\DOTSB","\\relax");y("\\DOTSX","\\relax");y("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");y("\\,","\\tmspace+{3mu}{.1667em}");y("\\thinspace","\\,");y("\\>","\\mskip{4mu}");y("\\:","\\tmspace+{4mu}{.2222em}");y("\\medspace","\\:");y("\\;","\\tmspace+{5mu}{.2777em}");y("\\thickspace","\\;");y("\\!","\\tmspace-{3mu}{.1667em}");y("\\negthinspace","\\!");y("\\negmedspace","\\tmspace-{4mu}{.2222em}");y("\\negthickspace","\\tmspace-{5mu}{.277em}");y("\\enspace","\\kern.5em ");y("\\enskip","\\hskip.5em\\relax");y("\\quad","\\hskip1em\\relax");y("\\qquad","\\hskip2em\\relax");y("\\tag","\\@ifstar\\tag@literal\\tag@paren");y("\\tag@paren","\\tag@literal{({#1})}");y("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new J("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});y("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");y("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");y("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");y("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");y("\\newline","\\\\\\relax");y("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");Fm=Q(Pr["Main-Regular"][84][1]-.7*Pr["Main-Regular"][65][1]);y("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Fm+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");y("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Fm+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");y("\\hspace","\\@ifstar\\@hspacer\\@hspace");y("\\@hspace","\\hskip #1\\relax");y("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");y("\\ordinarycolon",":");y("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");y("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');y("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');y("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');y("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');y("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');y("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');y("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');y("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');y("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');y("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');y("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');y("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');y("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');y("\u2237","\\dblcolon");y("\u2239","\\eqcolon");y("\u2254","\\coloneqq");y("\u2255","\\eqqcolon");y("\u2A74","\\Coloneqq");y("\\ratio","\\vcentcolon");y("\\coloncolon","\\dblcolon");y("\\colonequals","\\coloneqq");y("\\coloncolonequals","\\Coloneqq");y("\\equalscolon","\\eqqcolon");y("\\equalscoloncolon","\\Eqqcolon");y("\\colonminus","\\coloneq");y("\\coloncolonminus","\\Coloneq");y("\\minuscolon","\\eqcolon");y("\\minuscoloncolon","\\Eqcolon");y("\\coloncolonapprox","\\Colonapprox");y("\\coloncolonsim","\\Colonsim");y("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");y("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");y("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");y("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");y("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");y("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");y("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");y("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");y("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");y("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");y("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");y("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");y("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");y("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");y("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");y("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");y("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");y("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");y("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");y("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");y("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");y("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");y("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");y("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");y("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");y("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");y("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");y("\\imath","\\html@mathml{\\@imath}{\u0131}");y("\\jmath","\\html@mathml{\\@jmath}{\u0237}");y("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");y("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");y("\u27E6","\\llbracket");y("\u27E7","\\rrbracket");y("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");y("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");y("\u2983","\\lBrace");y("\u2984","\\rBrace");y("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");y("\u29B5","\\minuso");y("\\darr","\\downarrow");y("\\dArr","\\Downarrow");y("\\Darr","\\Downarrow");y("\\lang","\\langle");y("\\rang","\\rangle");y("\\uarr","\\uparrow");y("\\uArr","\\Uparrow");y("\\Uarr","\\Uparrow");y("\\N","\\mathbb{N}");y("\\R","\\mathbb{R}");y("\\Z","\\mathbb{Z}");y("\\alef","\\aleph");y("\\alefsym","\\aleph");y("\\Alpha","\\mathrm{A}");y("\\Beta","\\mathrm{B}");y("\\bull","\\bullet");y("\\Chi","\\mathrm{X}");y("\\clubs","\\clubsuit");y("\\cnums","\\mathbb{C}");y("\\Complex","\\mathbb{C}");y("\\Dagger","\\ddagger");y("\\diamonds","\\diamondsuit");y("\\empty","\\emptyset");y("\\Epsilon","\\mathrm{E}");y("\\Eta","\\mathrm{H}");y("\\exist","\\exists");y("\\harr","\\leftrightarrow");y("\\hArr","\\Leftrightarrow");y("\\Harr","\\Leftrightarrow");y("\\hearts","\\heartsuit");y("\\image","\\Im");y("\\infin","\\infty");y("\\Iota","\\mathrm{I}");y("\\isin","\\in");y("\\Kappa","\\mathrm{K}");y("\\larr","\\leftarrow");y("\\lArr","\\Leftarrow");y("\\Larr","\\Leftarrow");y("\\lrarr","\\leftrightarrow");y("\\lrArr","\\Leftrightarrow");y("\\Lrarr","\\Leftrightarrow");y("\\Mu","\\mathrm{M}");y("\\natnums","\\mathbb{N}");y("\\Nu","\\mathrm{N}");y("\\Omicron","\\mathrm{O}");y("\\plusmn","\\pm");y("\\rarr","\\rightarrow");y("\\rArr","\\Rightarrow");y("\\Rarr","\\Rightarrow");y("\\real","\\Re");y("\\reals","\\mathbb{R}");y("\\Reals","\\mathbb{R}");y("\\Rho","\\mathrm{P}");y("\\sdot","\\cdot");y("\\sect","\\S");y("\\spades","\\spadesuit");y("\\sub","\\subset");y("\\sube","\\subseteq");y("\\supe","\\supseteq");y("\\Tau","\\mathrm{T}");y("\\thetasym","\\vartheta");y("\\weierp","\\wp");y("\\Zeta","\\mathrm{Z}");y("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");y("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");y("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");y("\\bra","\\mathinner{\\langle{#1}|}");y("\\ket","\\mathinner{|{#1}\\rangle}");y("\\braket","\\mathinner{\\langle{#1}\\rangle}");y("\\Bra","\\left\\langle#1\\right|");y("\\Ket","\\left|#1\\right\\rangle");$m=r=>e=>{var t=e.consumeArg().tokens,n=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=m=>f=>{r&&(f.macros.set("|",o),s.length&&f.macros.set("\\|",a));var g=m;if(!m&&s.length){var b=f.future();b.text==="|"&&(f.popToken(),g=!0)}return{tokens:g?s:n,numArgs:0}};e.macros.set("|",l(!1)),s.length&&e.macros.set("\\|",l(!0));var h=e.consumeArg().tokens,c=e.expandTokens([...i,...h,...t]);return e.macros.endGroup(),{tokens:c.reverse(),numArgs:0}};y("\\bra@ket",$m(!1));y("\\bra@set",$m(!0));y("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");y("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");y("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");y("\\angln","{\\angl n}");y("\\blue","\\textcolor{##6495ed}{#1}");y("\\orange","\\textcolor{##ffa500}{#1}");y("\\pink","\\textcolor{##ff00af}{#1}");y("\\red","\\textcolor{##df0030}{#1}");y("\\green","\\textcolor{##28ae7b}{#1}");y("\\gray","\\textcolor{gray}{#1}");y("\\purple","\\textcolor{##9d38bd}{#1}");y("\\blueA","\\textcolor{##ccfaff}{#1}");y("\\blueB","\\textcolor{##80f6ff}{#1}");y("\\blueC","\\textcolor{##63d9ea}{#1}");y("\\blueD","\\textcolor{##11accd}{#1}");y("\\blueE","\\textcolor{##0c7f99}{#1}");y("\\tealA","\\textcolor{##94fff5}{#1}");y("\\tealB","\\textcolor{##26edd5}{#1}");y("\\tealC","\\textcolor{##01d1c1}{#1}");y("\\tealD","\\textcolor{##01a995}{#1}");y("\\tealE","\\textcolor{##208170}{#1}");y("\\greenA","\\textcolor{##b6ffb0}{#1}");y("\\greenB","\\textcolor{##8af281}{#1}");y("\\greenC","\\textcolor{##74cf70}{#1}");y("\\greenD","\\textcolor{##1fab54}{#1}");y("\\greenE","\\textcolor{##0d923f}{#1}");y("\\goldA","\\textcolor{##ffd0a9}{#1}");y("\\goldB","\\textcolor{##ffbb71}{#1}");y("\\goldC","\\textcolor{##ff9c39}{#1}");y("\\goldD","\\textcolor{##e07d10}{#1}");y("\\goldE","\\textcolor{##a75a05}{#1}");y("\\redA","\\textcolor{##fca9a9}{#1}");y("\\redB","\\textcolor{##ff8482}{#1}");y("\\redC","\\textcolor{##f9685d}{#1}");y("\\redD","\\textcolor{##e84d39}{#1}");y("\\redE","\\textcolor{##bc2612}{#1}");y("\\maroonA","\\textcolor{##ffbde0}{#1}");y("\\maroonB","\\textcolor{##ff92c6}{#1}");y("\\maroonC","\\textcolor{##ed5fa6}{#1}");y("\\maroonD","\\textcolor{##ca337c}{#1}");y("\\maroonE","\\textcolor{##9e034e}{#1}");y("\\purpleA","\\textcolor{##ddd7ff}{#1}");y("\\purpleB","\\textcolor{##c6b9fc}{#1}");y("\\purpleC","\\textcolor{##aa87ff}{#1}");y("\\purpleD","\\textcolor{##7854ab}{#1}");y("\\purpleE","\\textcolor{##543b78}{#1}");y("\\mintA","\\textcolor{##f5f9e8}{#1}");y("\\mintB","\\textcolor{##edf2df}{#1}");y("\\mintC","\\textcolor{##e0e5cc}{#1}");y("\\grayA","\\textcolor{##f6f7f7}{#1}");y("\\grayB","\\textcolor{##f0f1f2}{#1}");y("\\grayC","\\textcolor{##e3e5e6}{#1}");y("\\grayD","\\textcolor{##d6d8da}{#1}");y("\\grayE","\\textcolor{##babec2}{#1}");y("\\grayF","\\textcolor{##888d93}{#1}");y("\\grayG","\\textcolor{##626569}{#1}");y("\\grayH","\\textcolor{##3b3e40}{#1}");y("\\grayI","\\textcolor{##21242c}{#1}");y("\\kaBlue","\\textcolor{##314453}{#1}");y("\\kaGreen","\\textcolor{##71B307}{#1}");jm={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Jh=class{constructor(e,t,n){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Uh(Op,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new bl(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:s,end:n}=this.consumeArg(["]"])}else({tokens:s,start:t,end:n}=this.consumeArg());return this.pushToken(new Nt("EOF",n.loc)),this.pushTokens(s),new Nt("",_t.range(t,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var s=this.future(),i,o=0,a=0;do{if(i=this.popToken(),t.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new J("Extra }",i)}else if(i.text==="EOF")throw new J("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",i);if(e&&n)if((o===0||o===1&&e[a]==="{")&&i.text===e[a]){if(++a,a===e.length){t.splice(-a,a);break}}else a=0}while(o!==0||n);return s.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:s,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new J("The length of delimiters doesn't match the number of args!");for(var n=t[0],s=0;s<n.length;s++){var i=this.popToken();if(n[s]!==i.text)throw new J("Use of the macro doesn't match its definition",i)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(t&&t[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new J("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,s=t.noexpand?null:this._getExpansion(n);if(s==null||e&&s.unexpandable){if(e&&s==null&&n[0]==="\\"&&!this.isDefined(n))throw new J("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var i=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new J("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...o[+l.text-1]);else throw new J("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Nt(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),t.push(s)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(n=>n.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var s=typeof t=="function"?t(this):t;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var o=s.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new bl(s,this.settings),l=[],h=a.lex();h.text!=="EOF";)l.push(h),h=a.lex();l.reverse();var c={tokens:l,numArgs:i};return c}return s}isDefined(e){return this.macros.has(e)||vn.hasOwnProperty(e)||Ge.math.hasOwnProperty(e)||Ge.text.hasOwnProperty(e)||jm.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:vn.hasOwnProperty(e)&&!vn[e].primitive}},Gu=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,ol=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),Lh={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Wu={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},wl=class r{constructor(e,t){this.mode="math",this.gullet=new Jh(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new J("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Nt("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(r.endOfExpression.has(s.text)||t&&s.text===t||e&&vn[s.text]&&vn[s.text].infix)break;var i=this.parseAtom(t);if(i){if(i.type==="internal")continue}else break;n.push(i)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t=-1,n,s=0;s<e.length;s++){var i=e[s];if(i.type==="infix"){if(t!==-1)throw new J("only one infix operator per group",i.token);t=s,n=i.replaceWith}}if(t!==-1&&n){var o,a,l=e.slice(0,t),h=e.slice(t+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},h.length===1&&h[0].type==="ordgroup"?a=h[0]:a={type:"ordgroup",mode:this.mode,body:h};var c;return n==="\\\\abovefrac"?c=this.callFunction(n,[o,e[t],a],[]):c=this.callFunction(n,[o,a],[]),[c]}else return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(e)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new J("Expected group after '"+n+"'",t);return s}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var s={type:"text",mode:this.mode,body:t},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(e){var t=this.parseGroup("atom",e);if(t?.type==="internal"||this.mode==="text")return t;for(var n,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(t&&t.type==="op"){var o=i.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=i.text==="\\limits");else throw new J("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(n)throw new J("Double superscript",i);n=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new J("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(n)throw new J("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(ol[i.text]){var h=Gu.test(i.text),c=[];for(c.push(new Nt(ol[i.text])),this.consume();;){var m=this.fetch().text;if(!ol[m]||Gu.test(m)!==h)break;c.unshift(new Nt(ol[m])),this.consume()}var f=this.subparse(c);h?s={type:"ordgroup",mode:"math",body:f}:n={type:"ordgroup",mode:"math",body:f}}else break}return n||s?{type:"supsub",mode:this.mode,base:t,sup:n,sub:s}:t}parseFunction(e,t){var n=this.fetch(),s=n.text,i=vn[s];if(!i)return null;if(this.consume(),t&&t!=="atom"&&!i.allowedInArgument)throw new J("Got function '"+s+"' with no arguments"+(t?" as "+t:""),n);if(this.mode==="text"&&!i.allowedInText)throw new J("Can't use function '"+s+"' in text mode",n);if(this.mode==="math"&&i.allowedInMath===!1)throw new J("Can't use function '"+s+"' in math mode",n);var{args:o,optArgs:a}=this.parseArguments(s,i);return this.callFunction(s,o,a,n,e)}callFunction(e,t,n,s,i){var o={funcName:e,parser:this,token:s,breakOnTokenText:i},a=vn[e];if(a&&a.handler)return a.handler(o,t,n);throw new J("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var s=[],i=[],o=0;o<n;o++){var a=t.argTypes&&t.argTypes[o],l=o<t.numOptionalArgs;("primitive"in t&&t.primitive&&a==null||t.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var h=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)i.push(h);else if(h!=null)s.push(h);else throw new J("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":{var s=this.parseArgumentGroup(n,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text"}:null}case"raw":{var i=this.parseStringGroup("raw",n);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(n)throw new J("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new J("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new J("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),n.text=s,n}parseRegexGroup(e,t){for(var n=this.fetch(),s=n,i="",o;(o=this.fetch()).text!=="EOF"&&e.test(i+o.text);)s=o,i+=s.text,this.consume();if(i==="")throw new J("Invalid "+t+": '"+n.text+"'",n);return n.range(s,i)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new J("Invalid color: '"+t.text+"'",t);var s=n[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",n=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!s)throw new J("Invalid size: '"+t.text+"'",t);var i={number:+(s[1]+s[2]),unit:s[3]};if(!Uu(i))throw new J("Invalid unit: '"+i.unit+"'",t);return{type:"size",mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var s=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:i};return t&&this.switchMode(s),o}parseGroup(e,t){var n=this.fetch(),s=n.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:_t.range(n,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(t,e)||this.parseSymbol(),i==null&&s[0]==="\\"&&!jm.hasOwnProperty(s)){if(this.settings.throwOnError)throw new J("Undefined control sequence: "+s,n);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var s=e[n];if(s.type==="textord"){var i=s.text,o=e[n+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=e[n+2];n+1<t&&a&&a.type==="textord"&&a.text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:_t.range(s,a),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:_t.range(s,o),text:"--"}),t-=1)}(i==="'"||i==="`")&&o.text===i&&(e.splice(n,2,{type:"textord",mode:"text",loc:_t.range(s,o),text:i+i}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),s=n.charAt(0)==="*";if(s&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new J(`\\verb assertion failed --
265
- please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:s}}Wu.hasOwnProperty(t[0])&&!Ge[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Wu[t[0]]+t.slice(1));var i=Dp.exec(t);i&&(t=t.substring(0,i.index),t==="i"?t="\u0131":t==="j"&&(t="\u0237"));var o;if(Ge[this.mode][t]){this.settings.strict&&this.mode==="math"&&Fh.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a=Ge[this.mode][t].group,l=_t.range(e),h;if(Nd.hasOwnProperty(a)){var c=a;h={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else h={type:a,mode:this.mode,loc:l,text:t};o=h}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Vu(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:_t.range(e),text:t};else return null;if(this.consume(),i)for(var m=0;m<i[0].length;m++){var f=i[0][m];if(!Lh[f])throw new J("Unknown accent ' "+f+"'",e);var g=Lh[f][this.mode]||Lh[f].text;if(!g)throw new J("Accent "+f+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:_t.range(e),label:g,isStretchy:!1,isShifty:!0,base:o}}return o}};wl.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);cc=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new wl(e,t);delete n.gullet.macros.current["\\df@tag"];var s=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new J("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:n.subparse([new Nt("\\df@tag")])}]}return s},uc=function(e,t,n){t.textContent="";var s=Al(e,n).toNode();t.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),uc=function(){throw new J("KaTeX doesn't work in quirks mode.")});qm=function(e,t){var n=Al(e,t).toMarkup();return n},Hm=function(e,t){var n=new pa(t);return cc(e,n)},Ym=function(e,t,n){if(n.throwOnError||!(e instanceof J))throw e;var s=V(["katex-error"],[new Pt(t)]);return s.setAttribute("title",e.toString()),s.setAttribute("style","color:"+n.errorColor),s},Al=function(e,t){var n=new pa(t);try{var s=cc(e,n);return Qd(s,e,n)}catch(i){return Ym(i,e,n)}},Xm=function(e,t){var n=new pa(t);try{var s=cc(e,n);return ep(s,e,n)}catch(i){return Ym(i,e,n)}},Gm="0.16.44",Wm={Span:kn,Anchor:y0,SymbolNode:Pt,SvgNode:ar,PathNode:Tr,LineNode:ga},$p={version:Gm,render:uc,renderToString:qm,ParseError:J,SETTINGS_SCHEMA:hl,__parse:Hm,__renderToDomTree:Al,__renderToHTMLTree:Xm,__setFontMetrics:Qu,__defineSymbol:u,__defineFunction:ie,__defineMacro:y,__domTree:Wm}});var C2={};$a(C2,{Adc:()=>Ls,Amp:()=>un,AnalogBiasedFet:()=>j0,AnalogNFet:()=>F0,AnalogPFet:()=>$0,And:()=>Bt,Annotate:()=>zo,Antenna:()=>Qi,AntennaLoop:()=>eo,AntennaLoop2:()=>to,Arc2:()=>Mo,Arc3:()=>fn,ArcLoop:()=>To,ArcN:()=>Po,ArcZ:()=>Eo,Arrow:()=>dn,Arrowhead:()=>xo,AudioJack:()=>po,BUILTIN_THEMES:()=>yr,Battery:()=>Ni,BatteryCell:()=>Di,BatteryDouble:()=>Oi,BitField:()=>s0,Bjt:()=>qr,Bjt2:()=>Hr,BjtNpn:()=>Ht,BjtNpn2:()=>Ss,BjtPnp:()=>rr,BjtPnp2:()=>ln,BjtPnp2c:()=>W0,BjtPnp2c2:()=>ei,Breaker:()=>as,Buf:()=>Jt,BusConnect:()=>gi,BusLine:()=>bi,Button:()=>oo,CPE:()=>ls,CSS_VARS:()=>Ks,Capacitor:()=>Cr,Capacitor2:()=>Cn,CapacitorTrim:()=>Ln,CapacitorVar:()=>In,Circle:()=>ui,Circulator:()=>Os,Coax:()=>fo,CoaxConnect:()=>ki,Connect:()=>pr,ConnectorTerminal:()=>Ei,Container:()=>P0,Crystal:()=>Un,CurrentLabel:()=>h0,CurrentLabelInline:()=>gn,CurrentMirror:()=>Fr,CurrentTransactor:()=>Oo,DA15:()=>vi,DB25:()=>xi,DB9:()=>wi,DC37:()=>yi,DD50:()=>Si,DE9:()=>a0,DFlipFlop:()=>ri,Dac:()=>Ds,Data:()=>Ms,DataBusLine:()=>wo,Decision:()=>Es,Demod:()=>Ns,Diac:()=>on,Diode:()=>et,DiodeShockley:()=>$n,DiodeTVS:()=>Fn,DiodeTunnel:()=>On,Dot:()=>pn,DotDotDot:()=>vo,DrawTree:()=>l0,Drawing:()=>lr,DspBox:()=>sr,DspCircle:()=>Yt,DspSpeaker:()=>_s,DualVacuumTube:()=>Ko,ELEMENT_GETATTR_ANCHOR_NAMES:()=>gc,ELEMENT_REGISTRY:()=>Js,Element:()=>N,Element2Term:()=>se,ElementCompound:()=>ir,ElementDrawing:()=>Ol,ElementImage:()=>js,ElementTwoport:()=>vr,Ellipse:()=>zs,Encircle:()=>sh,EncircleBox:()=>ih,Filter:()=>Is,FlowBox:()=>cn,Fuse:()=>rs,FuseIEC:()=>Dr,FuseIEEE:()=>dr,FuseUS:()=>os,GAP:()=>H,Gap:()=>Xt,Ground:()=>Ti,GroundChassis:()=>Zi,GroundSignal:()=>Ki,Header:()=>pi,Hemt:()=>G0,Ic:()=>nr,Ic555:()=>ii,IcDIP:()=>ai,IcPin:()=>Kl,IgbtN:()=>Z0,IgbtP:()=>Q0,ImageFormat:()=>ja,Inductor:()=>Ir,Inductor2:()=>Lr,Isolator:()=>Fs,JFet:()=>vs,JFet2:()=>ys,JFetN:()=>q0,JFetN2:()=>Y0,JFetP:()=>H0,JFetP2:()=>X0,JKFlipFlop:()=>ni,Jack:()=>zi,Josephson:()=>is,Jumper:()=>fi,Kmap:()=>A0,LED:()=>qn,LED2:()=>Hn,Label:()=>So,Lamp:()=>Xi,Lamp2:()=>Gi,Line:()=>Pe,LogicTree:()=>gr,LoopArrow:()=>c0,LoopCurrent:()=>nh,Memristor:()=>ns,Memristor2:()=>ss,MeterA:()=>qi,MeterAnalog:()=>Vi,MeterArrow:()=>Yi,MeterBox:()=>mn,MeterDigital:()=>Ji,MeterI:()=>ji,MeterOhm:()=>Hi,MeterV:()=>$i,Mic:()=>uo,Mixer:()=>As,Motor:()=>mo,Multiplexer:()=>ti,NAMED_COLORS:()=>fh,NFet:()=>gs,NFet2:()=>ws,NMos:()=>ms,NMos2:()=>ps,Neon:()=>Wi,NixieTube:()=>Zo,NoConnect:()=>so,Norator:()=>Or,Not:()=>Kt,NotNot:()=>C0,NpnPhoto:()=>J0,NpnSchottky:()=>V0,Nullator:()=>Nr,Nullor:()=>$o,Opamp:()=>cs,Optocoupler:()=>_o,Or:()=>$t,OrthoLines:()=>di,Oscillator:()=>Cs,OscillatorBox:()=>Bs,Oscilloscope:()=>Ui,OutletA:()=>u0,OutletB:()=>qo,OutletC:()=>m0,OutletD:()=>Ho,OutletE:()=>Yo,OutletF:()=>Xo,OutletG:()=>Go,OutletH:()=>d0,OutletI:()=>Wo,OutletJ:()=>Vo,OutletK:()=>Uo,OutletL:()=>Jo,PFet:()=>bs,PFet2:()=>xs,PMos:()=>ds,PMos2:()=>fs,Pentode:()=>ra,Photodiode:()=>Yn,Photoresistor:()=>ts,PhotoresistorBox:()=>Qt,PhotoresistorIEC:()=>Qt,PhotoresistorIEEE:()=>ur,Plug:()=>Mi,PnpPhoto:()=>K0,PnpSchottky:()=>U0,Point:()=>A,PotBox:()=>er,Potentiometer:()=>es,PotentiometerIEC:()=>er,PotentiometerIEEE:()=>mr,Process:()=>hi,RBox:()=>mt,RBoxVar:()=>Zt,Rect:()=>xr,Rectifier:()=>Bo,Relay:()=>Io,Resistor:()=>Zn,ResistorIEC:()=>mt,ResistorIEEE:()=>dt,ResistorVar:()=>Qn,ResistorVarIEC:()=>Zt,ResistorVarIEEE:()=>cr,RightLines:()=>Hs,RoundBox:()=>Yr,RoundProcess:()=>li,Rshunt:()=>Kn,SCR:()=>Xn,STYLE_IEC:()=>Xl,STYLE_IEEE:()=>an,SchemdrawController:()=>La,Schmitt:()=>L0,SchmittAnd:()=>o0,SchmittNand:()=>Yl,SchmittNot:()=>D0,Schottky:()=>Dn,Segment:()=>p,SegmentArc:()=>xe,SegmentBezier:()=>Ut,SegmentCircle:()=>D,SegmentImage:()=>Br,SegmentPath:()=>ut,SegmentPoly:()=>U,SegmentText:()=>W,SevenSegment:()=>oi,Solar:()=>Fi,Source:()=>rt,SourceControlled:()=>Ys,SourceControlledI:()=>wr,SourceControlledV:()=>br,SourceI:()=>Ai,SourcePulse:()=>Bi,SourceRamp:()=>Ii,SourceSin:()=>_i,SourceSquare:()=>Li,SourceTriangle:()=>Ci,SourceV:()=>Ri,SparkGap:()=>hs,Speaker:()=>co,Start:()=>ci,State:()=>mi,StateEnd:()=>Ps,Subroutine:()=>ks,Sum:()=>Ts,SumSigma:()=>Rs,SvgBackendConfig:()=>Aa,SvgFigure:()=>g0,Switch:()=>Xr,SwitchDIP:()=>ho,SwitchDpdt:()=>Ws,SwitchDpst:()=>Gs,SwitchReed:()=>ao,SwitchRotary:()=>lo,SwitchSpdt:()=>io,SwitchSpdt2:()=>Xs,Table:()=>B0,Tag:()=>ko,Terminal:()=>hn,Tetrode:()=>ta,Tgate:()=>I0,Thermistor:()=>Jn,TimingDiagram:()=>n0,TransadmittanceTransactor:()=>Fo,Transform:()=>p0,Transformer:()=>bo,TransimpedanceTransactor:()=>No,Triac:()=>Gn,Triax:()=>go,Triode:()=>ea,Tristate:()=>Bn,TubeDiode:()=>Qo,TwoPort:()=>Lo,VERSION:()=>lu,VGA:()=>$s,VMCMPair:()=>jo,VacuumTube:()=>Gr,Varactor:()=>jn,Vdd:()=>no,VoltageLabelArc:()=>Ro,VoltageMirror:()=>$r,VoltageRegulator:()=>si,VoltageTransactor:()=>Do,Vss:()=>ro,Wheatstone:()=>Co,Wire:()=>yo,ZLabel:()=>Ao,Zener:()=>Nn,alignLabelForPlace:()=>pc,angle:()=>ia,bbox:()=>He,buchheim:()=>Ra,buildLabelSpecsFromParams:()=>Ll,colorHex:()=>gh,colorHsl:()=>xh,colorHsla:()=>vh,colorRgb:()=>bh,colorRgba:()=>wh,config:()=>kt,cycloid:()=>Vn,dasharray:()=>yh,debug:()=>T1,delta:()=>qa,dist:()=>Qs,ensureKatex:()=>Qm,estimateMathSize:()=>ya,flip:()=>pu,getAnchors:()=>D1,getAvailableTypes:()=>L1,getGlobalStyle:()=>f0,getParam:()=>T,getRegisteredTypes:()=>tu,hasMath:()=>va,isKatexAvailable:()=>Bl,linspace:()=>ze,logicparse:()=>Ql,mergeParams:()=>oa,mergeParamsFirstWins:()=>Mr,mirrorx:()=>du,mountFromJson:()=>j1,nand:()=>Tn,nor:()=>Rn,placeElementLabels:()=>Il,point:()=>mu,renderFromJson:()=>hh,renderMathHtml:()=>Cl,resetConfigForTests:()=>gu,resetElementStyleForTests:()=>Wl,resheight:()=>F,resolveLabelRotateDeg:()=>dc,resolvePosition:()=>Ia,resolvePositionX:()=>ah,resolvePositionY:()=>lh,resolveTheme:()=>Zs,reswidth:()=>Ye,rotate:()=>Wr,setBoxAnchors16:()=>fr,setElementStyle:()=>Gl,sevensegdigit:()=>Ic,subsystems:()=>Qc,svgconfig:()=>A1,swapLabelLocForTheta:()=>mc,swapPause:()=>la,textSize:()=>b0,theme:()=>R1,use:()=>P1,validateCircuitJson:()=>F1,validateColor:()=>Vr,validateLinestyle:()=>Wa,withDrawing:()=>a1,xnor:()=>_n,xor:()=>An});var lu="0.5.0";function He(r,e,t,n){return{xmin:r,ymin:e,xmax:t,ymax:n}}var ja=(c=>(c.EPS="eps",c.JPG="jpg",c.PDF="pdf",c.PGF="pgf",c.PNG="png",c.PS="ps",c.RAW="raw",c.RGBA="rgba",c.SVG="svg",c.TIF="tif",c))(ja||{});function ze(r,e,t=50){if(t<2)return[r];let n=(e-r)/(t-1);return Array.from({length:t},(s,i)=>r+n*i)}function dh(r,e,t,n,s){let i=Math.cos(t*Math.PI/180),o=Math.sin(t*Math.PI/180),a=r-n,l=e-s,h=a*i-l*o,c=a*o+l*i;return[h+n,c+s]}function Sr(r,e,t){return[-(r-t)+t,e]}function kr(r,e){return[r,-e]}function hu(r,e,t,n){return[t-r,n-e]}function cu(r,e,t,n){return Math.atan2(n-e,t-r)*180/Math.PI}function uu(r,e,t,n){return Math.hypot(t-r,n-e)}function Dt(r){return r instanceof A?r:{x:r[0],y:r[1]}}var A=class r{constructor(e,t){z(this,"x");z(this,"y");this.x=e,this.y=t}static fromXY(e){return new r(e[0],e[1])}add(e){let t=Dt(e);return new r(this.x+t.x,this.y+t.y)}sub(e){let t=Dt(e);return new r(this.x-t.x,this.y-t.y)}subFromScalar(e){return new r(e-this.x,e-this.y)}mul(e){return typeof e=="number"?new r(this.x*e,this.y*e):new r(this.x*e.x,this.y*e.y)}div(e){return typeof e=="number"?new r(this.x/e,this.y/e):new r(this.x/e.x,this.y/e.y)}neg(){return new r(-this.x,-this.y)}rotate(e,t=[0,0]){let n=Dt(t),[s,i]=dh(this.x,this.y,e,n.x,n.y);return new r(s,i)}mirrorx(e=0){let[t,n]=Sr(this.x,this.y,e);return new r(t,n)}flip(){let[e,t]=kr(this.x,this.y);return new r(e,t)}toTuple(){return[this.x,this.y]}};function mu(r,e){return new A(r,e)}function Wr(r,e,t=[0,0]){let n=Dt(r),s=Dt(t),[i,o]=dh(n.x,n.y,e,s.x,s.y);return new A(i,o)}function du(r,e=0){let t=Dt(r),[n,s]=Sr(t.x,t.y,e);return new A(n,s)}function pu(r){let e=Dt(r),[t,n]=kr(e.x,e.y);return new A(t,n)}function qa(r,e){let t=Dt(r),n=Dt(e),[s,i]=hu(t.x,t.y,n.x,n.y);return new A(s,i)}function ia(r,e){let t=Dt(r),n=Dt(e);return cu(t.x,t.y,n.x,n.y)}function Qs(r,e){let t=Dt(r),n=Dt(e);return uu(t.x,t.y,n.x,n.y)}function Ha(r){return r instanceof A?r:A.fromXY([r[0],r[1]])}function rd(r){return typeof r=="number"?new A(r,r):Ha(r)}var p0=class{constructor(e,t,n=[0,0],s=[1,1]){z(this,"theta");z(this,"shift");z(this,"localshift");z(this,"zoom");this.theta=e,this.shift=Ha(t),this.localshift=Ha(n),this.zoom=rd(s)}transform(e){return Ha(e).add(this.localshift).mul(this.zoom).rotate(this.theta).add(this.shift)}transformArray(e){return e.map(t=>this.transform(t))}};var fu={unit:3,inches_per_unit:.5,lblofst:.1,fontsize:14,font:"sans-serif",color:"black",lw:2,ls:"-",fill:null,margin:.1},Ya={...fu};function kt(r){Ya={...Ya,...r}}function f0(){return Ya}function gu(){Ya={...fu}}function oa(...r){let e={};for(let t of r)if(t)for(let[n,s]of Object.entries(t))s!==void 0&&(e[n]=s);return e}function Mr(...r){let e={};for(let t of r)if(t)for(let[n,s]of Object.entries(t))s!==void 0&&!(n in e)&&(e[n]=s);return e}function T(r,e,t){let n=r[e];return n!==void 0?n:t}var aa=new Map,ph=!1;function la(r){let e=ph;return ph=r,e}function nd(){return[...aa.entries()]}function Xa(r){aa.set(r,null)}function Ga(r){aa.delete(r)}function At(r){if(ph||aa.size===0)return;let e=nd().at(-1);if(!e)return;let[t,n]=e;n!==null&&!t.containsElement(n)&&t.add(n),aa.set(t,r)}var fh=["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],sd=new Set(fh);function gh(r){return/^#[A-Fa-f\d]{3}(?:[A-Fa-f\d]{3}|(?:[A-Fa-f\d]{5})?)$/i.test(r)}function bh(r){return/^rgb(\s*)\((\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*)\)$/i.test(r)}function wh(r){return/^rgba(\s*)\((\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*)\)$/i.test(r)}function xh(r){return/^hsl(\s*)\((\s*)(?:-?\d*\.?\d*)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*)\)$/i.test(r)}function vh(r){return/^hsla(\s*)\((\s*)(?:-?\d*\.?\d*)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*),(\s*)(?:-?\d*\.?\d*%?)(\s*)\)$/i.test(r)}function yh(r){return/^(\d+\.?\d*)(,\s*\d+\.?\d*)*$/i.test(r)}function Vr(r){if(r==null||r===!0||r===!1)return;if(Array.isArray(r)){let t=r;if(t.length!==3||typeof t[0]!="number"||typeof t[1]!="number"||typeof t[2]!="number")throw new Error(`Invalid color tuple ${String(r)}`);return}if(typeof r!="string")throw new Error(`Invalid color ${String(r)}`);let e=r;if(!(sd.has(e)||e==="bg"||gh(e)||bh(e)||wh(e)||xh(e)||vh(e)||e.startsWith("url(")))throw new Error(`Invalid color name ${e}`)}function Wa(r){if(![null,""," ","-","--",":","-.","dashed","dotted","dashdot"].includes(r)&&!yh(r))throw new Error(`Invalid line style ${r}`)}function Va(r){return r instanceof A?r:{x:r[0],y:r[1]}}function bu(r,e){let t=r.length;if(t<3||e<=0)return r.map(s=>{let i=Va(s);return new A(i.x,i.y)});let n=[];for(let s=t-1;s>=0;s--){let i=Va(r[s]),o=Va(r[(s-1+t)%t]),a=Va(r[(s-2+t)%t]),l=o.x-i.x,h=o.y-i.y,c=o.x-a.x,m=o.y-a.y,f=(Math.atan2(h,l)-Math.atan2(m,c))/2,g=Math.abs(Math.tan(f)),b=e/g,x=(te,ke)=>Math.hypot(te,ke),v=(te,ke,he,ve,de)=>{let Fe=ke/he;return[te.x-ve*Fe,te.y-de*Fe]},S=x(l,h),k=x(c,m),M=Math.min(S,k);b>M&&(b=M,e=M*g);let _=v(o,b,S,l,h),B=v(o,b,k,c,m),$=o.x*2-_[0]-B[0],Y=o.y*2-_[1]-B[1],Z=x($,Y),L=x(b,e),I=v(o,L,Z,$,Y),X=Math.atan2(_[1]-I[1],_[0]-I[0]),j=Math.atan2(B[1]-I[1],B[0]-I[0]);for(;j<X;)j+=2*Math.PI;let re=ze(X,j,100);for(let te of re)n.push(new A(I[0]+Math.cos(te)*e,I[1]+Math.sin(te)*e))}return n.length>0&&n.push(n[0]),n}function ae(r){return r.toFixed(3).replace(/\.?0+$/,"")||"0"}function wn(r){let e="",{color:t,ls:n,lw:s,capstyle:i,joinstyle:o,fill:a,hatch:l}=r;if(t!==void 0&&(Array.isArray(t)?e+=`stroke:rgb(${Math.round(t[0]*255)},${Math.round(t[1]*255)},${Math.round(t[2]*255)});`:t&&(e+=`stroke:${t};`)),l?e+="fill:url(#hatch);":a===!1?e+="fill:none;":a!=null&&(e+=`fill:${String(a).toLowerCase()};`),s!==void 0&&s>0&&(e+=`stroke-width:${s};`),n){let h={"--":"7.4,3.2",dashed:"7.4,3.2",":":"2,3.3",dotted:"2,3.3","-.":"12.8,3.2,2,3.2",dashdot:"12.8,3.2,2,3.2"};n in h&&(e+=`stroke-dasharray:${h[n]};`)}return i&&(e+=`stroke-linecap:${i==="projecting"?"square":i};`),o&&(e+=`stroke-linejoin:${o};`),e}var Ur={};for(let r of"lij|' ")Ur[r]=37;for(let r of"![]fI.,:;/\\t")Ur[r]=50;for(let r of'`-(){}r"')Ur[r]=60;for(let r of"*^zcsJkvxy\u03BC\xB0")Ur[r]=85;for(let r of"aebdhnopqug#$L+<>=?_~FZT\u03B10123456789")Ur[r]=95;for(let r of"BSPEAKVXY&UwNRCHD")Ur[r]=112;for(let r of"QGOMm%@\u03A9")Ur[r]=140;for(let r of"W\u2220")Ur[r]=155;var Mt={};for(let r of"lij:.,;t")Mt[r]=47;for(let r of"|")Mt[r]=37;for(let r of"![]fI/\\")Mt[r]=55;for(let r of"`-(){}r")Mt[r]=60;for(let r of"sJ\xB0")Mt[r]=68;for(let r of'"zcae?1')Mt[r]=74;for(let r of"*^kvxy\u03BCbdhnopqug#$_\u03B10123456789")Mt[r]=85;for(let r of"#$+<>=~FSP")Mt[r]=95;for(let r of"ELZT")Mt[r]=105;for(let r of"BRC")Mt[r]=112;for(let r of"DAwHUKVXYNQGO")Mt[r]=122;for(let r of"&m\u03A9")Mt[r]=130;for(let r of"%")Mt[r]=140;for(let r of"MW@\u2220")Mt[r]=155;function wu(r){if(!r)return!1;let e=r.toLowerCase();return e.includes("times")||e.includes("serif")&&!e.includes("sans")}function od(r,e,t){let n=wu(t)?Mt:Ur,s=wu(t)?60:75,i=0;for(let o of r)i+=n[o]??s;return i*72/1e3*(e/12)}function b0(r,e,t){if(r==="")return{width:0,height:0};let n=r.split(`
266
- `),s=0;for(let i of n)s=Math.max(s,od(i,e,t));return{width:s,height:n.length*e}}function it(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var Ua=class Ua{constructor(e,t={}){z(this,"bbox");z(this,"scale");z(this,"pxwidth");z(this,"pxheight");z(this,"elements",[]);z(this,"backgroundColor");z(this,"showbbox");z(this,"extraDefs");z(this,"svgDefs",[]);z(this,"clips",new Map);z(this,"_groupStack",[]);z(this,"_hasGroups",!1);let n=t.inchesPerUnit??.5,s=(t.margin??.1)+2/72;this.scale=72*n,this.showbbox=t.showbbox??!1,this.bbox={xmin:e.xmin-s,ymin:e.ymin-s,xmax:e.xmax+s,ymax:e.ymax+s};let i=this.bbox.xmax-this.bbox.xmin,o=this.bbox.ymax-this.bbox.ymin;this.pxwidth=Math.max(5,i*this.scale),this.pxheight=Math.max(5,o*this.scale),this.extraDefs=t.extraDefs??""}setBbox(e){let t=.1+2/72;this.bbox={xmin:e.xmin-t,ymin:e.ymin-t,xmax:e.xmax+t,ymax:e.ymax+t};let n=this.bbox.xmax-this.bbox.xmin,s=this.bbox.ymax-this.bbox.ymin;this.pxwidth=Math.max(5,n*this.scale),this.pxheight=Math.max(5,s*this.scale)}xform(e,t){return[e*this.scale,-t*this.scale]}bgcolor(e){this.backgroundColor=e}hatchpattern(e="hatch",t="black",n=.5){let s=`<pattern id="${e}" patternUnits="userSpaceOnUse" width="4" height="4"><path d="M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2" style="stroke:${t}; stroke-width:${n}" /></pattern>`;return this.svgDefs.push(s),e}addclip(e,t){let n=`<clipPath id="${e}"><path d="${t}" /></clipPath>`;this.svgDefs.push(n)}addclipBbox(e){let t=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,n;if(this.clips.has(t))n=this.clips.get(t);else{n=Ua.totalClips++,this.clips.set(t,n);let[s,i]=this.xform(e.xmin,e.ymin),[o,a]=this.xform(e.xmax,e.ymax),l=Math.min(s,o)-1,h=Math.min(i,a)-1,c=Math.abs(o-s)+2,m=Math.abs(a-i)+2;this.svgDefs.push(`<clipPath id="clip${n}"><rect x="${ae(l)}" y="${ae(h)}" width="${ae(c)}" height="${ae(m)}" /></clipPath>`)}return`url(#clip${n})`}plot(e,t,n={}){let s=n.zorder??2,i=n.color??"black",o=n.ls??"-",a=n.lw??2,l=n.capstyle??"round",h=n.joinstyle??"round",c=typeof n.fill=="string"||n.fill===void 0?n.fill??"none":"none",m="",[f,g]=this.xform(e[0],t[0]);m+=`M ${ae(f)} ${ae(g)} `;for(let x=1;x<e.length;x++){if(Number.isNaN(e[x])||Number.isNaN(t[x])){m+="M ";continue}m.endsWith("M ")||(m+="L ");let[v,S]=this.xform(e[x],t[x]);m+=`${ae(v)},${ae(S)} `}m=m.trim();let b=wn({color:i,ls:o,lw:a,capstyle:l,joinstyle:h,fill:c});this.elements.push({z:s,xml:`<path d="${m}" style="${it(b)}"/>`})}circle(e,t,n,s={}){let i=s.zorder??1,[o,a]=this.xform(e,t),l=n*this.scale,h=s.fill,c=h??"none",m=wn({color:s.color??"black",ls:s.ls??"-",lw:s.lw??2,fill:c});this.elements.push({z:i,xml:`<circle cx="${ae(o)}" cy="${ae(a)}" r="${ae(l)}" style="${it(m)}"/>`})}arrow(e,t,n={}){let s=n.arrowwidth??.15,i=n.arrowlength??.25,o=n.color??"black",a=n.lw??1,l=n.zorder??1,[h,c]=this.xform(e[0],e[1]),m=i/2*Math.cos(t*Math.PI/180)*this.scale,f=i/2*Math.sin(t*Math.PI/180)*this.scale,g=s*this.scale,b=i*this.scale,x=Math.hypot(m,f),v=-Math.atan2(f,m)*180/Math.PI,S=new A(h-m,c+f),k=new A(x-b,g/2).rotate(v,[0,0]).add(S),M=new A(x-b,-g/2).rotate(v,[0,0]).add(S),_=new A(h-a*2*Math.cos(v*Math.PI/180),c-a*2*Math.sin(v*Math.PI/180)),B=wn({color:o,lw:0,capstyle:"butt",joinstyle:"miter",fill:o}),$=`M ${ae(_.x)} ${ae(_.y)} L ${ae(k.x)} ${ae(k.y)} L ${ae(M.x)} ${ae(M.y)} Z`;this.elements.push({z:l,xml:`<path d="${$}" style="${it(B)}"/>`})}text(e,t,n,s={}){if(e==="")return;let i=s.zorder??3,[o,a]=this.xform(t,n),l=s.fontsize??14,h=s.fontfamily??"sans-serif";(h.toLowerCase()==="sans-serif"||h.toLowerCase()==="arial")&&(h="sans");let c=s.valign??"center";if(c==="base"){let M=e.split(`
267
- `).length;a-=(M-1)*l}let m=s.halign==="left"?"start":s.halign==="right"?"end":"middle",f=c==="top"?"hanging":c==="bottom"?"ideographic":"central",g=s.rotation??0,b=g!==0?` transform="rotate(${ae(g)} ${ae(o)} ${ae(a)})"`:"",x=s.color??"black",v=a-l,S;s.textDecoration?S=`<tspan text-decoration="${s.textDecoration}">${it(e)}</tspan>`:S=it(e);let k=`<text x="${ae(o)}" y="${ae(v)}" dominant-baseline="${f}" fill="${it(x)}" font-size="${ae(l)}" font-family="${it(h)}" text-anchor="${m}"${b}><tspan x="${ae(o)}" dy="${ae(l)}" dominant-baseline="${f}">${S}</tspan></text>`;s.href&&(k=`<a href="${it(s.href)}">${k}</a>`),this.elements.push({z:i,xml:k})}poly(e,t={}){let n=t.closed??!0,s=t.zorder??1,i=t.color??"black",o=t.lw??2,a=t.ls??"-",l=t.capstyle??"round",h=t.joinstyle??"round",c=typeof t.fill=="string"?t.fill:"none",m=e.map(b=>{let[x,v]=this.xform(b.x,b.y);return`${ae(x)},${ae(v)}`}).join(" "),f=n?"polygon":"polyline",g=wn({color:i,ls:a,lw:o,capstyle:l,joinstyle:h,fill:c,hatch:t.hatch});this.elements.push({z:s,xml:`<${f} points="${m}" style="${it(g)}"/>`})}bezier(e,t={}){if(e.length!==3&&e.length!==4)throw new Error("bezier expects 3 (quadratic) or 4 (cubic) control points");let n=t.zorder??1,s=t.color??"black",i=t.lw??2,o=t.ls??"-",a=t.capstyle??"round",l=e.length===4?"C":"Q",h=t.arrow,c=t.arrowlength??.25,m=t.arrowwidth??.15,f=e.map(v=>({x:v.x,y:v.y}));if(h!=null){if(h.includes("<")){let v=Math.atan2(e[0].y-e[1].y,e[0].x-e[1].x);f[0]={x:e[0].x-Math.cos(v)*c/2,y:e[0].y-Math.sin(v)*c/2}}if(h.includes(">")){let v=e.length-1,S=e.length-2,k=Math.atan2(e[v].y-e[S].y,e[v].x-e[S].x);f[v]={x:e[v].x-Math.cos(k)*c/2,y:e[v].y-Math.sin(k)*c/2}}}let g=f.map(v=>{let[S,k]=this.xform(v.x,v.y);return{x:S,y:k}}),b=`M ${ae(g[0].x)} ${ae(g[0].y)} ${l}`;for(let v=1;v<g.length;v++)b+=` ${ae(g[v].x)} ${ae(g[v].y)}`;let x=wn({color:s,ls:o,lw:i,capstyle:a,fill:"none"});if(this.elements.push({z:n,xml:`<path d="${b}" style="${it(x)}"/>`}),h!=null){if(h.includes("<")){let v=e[0].x-e[1].x,S=e[0].y-e[1].y,k=Math.atan2(S,v)*180/Math.PI;this.arrow([e[0].x,e[0].y],k,{color:s,lw:1,zorder:n,arrowlength:c,arrowwidth:m})}else h.startsWith("o")&&this.circle(e[0].x,e[0].y,m/2,{color:s,fill:s,lw:0,zorder:n});if(h.includes(">")){let v=e.length-1,S=e.length-2,k=e[v].x-e[S].x,M=e[v].y-e[S].y,_=Math.atan2(M,k)*180/Math.PI;this.arrow([e[v].x,e[v].y],_,{color:s,lw:1,zorder:n,arrowlength:c,arrowwidth:m})}else if(h.endsWith("o")){let v=e.length-1;this.circle(e[v].x,e[v].y,m/2,{color:s,fill:s,lw:0,zorder:n})}}}arc(e,t,n,s={}){let i=s.zorder??1,o=s.color??"black",a=s.lw??2,l=s.ls??"-",h=s.fill??void 0;h==null&&(h="none");let c=s.theta1??0,m=s.theta2??90,f=s.angle??0,[g,b]=this.xform(e[0],e[1]),x=t*this.scale,v=n*this.scale;f=-f;let S=-c*Math.PI/180,k=-m*Math.PI/180,M=f*Math.PI/180;for(S=Math.atan2(x*Math.sin(S),v*Math.cos(S)),k=Math.atan2(x*Math.sin(k),v*Math.cos(k));S<k;)S+=2*Math.PI;let _=g+x/2*Math.cos(k)*Math.cos(M)-v/2*Math.sin(k)*Math.sin(M),B=b+x/2*Math.cos(k)*Math.sin(M)+v/2*Math.sin(k)*Math.cos(M),$=g+x/2*Math.cos(S)*Math.cos(M)-v/2*Math.sin(S)*Math.sin(M),Y=b+x/2*Math.cos(S)*Math.sin(M)+v/2*Math.sin(S)*Math.cos(M),Z=$-_,L=Y-B,I=wn({color:o,ls:l,lw:a,fill:h});if(Math.abs(Z)<.1&&Math.abs(L)<.1){let X=-(s.angle??0),j=X!==0?` transform="rotate(${ae(X)} ${ae(g)} ${ae(b)})"`:"";this.elements.push({z:i,xml:`<ellipse cx="${ae(g)}" cy="${ae(b)}" rx="${ae(x/2)}" ry="${ae(v/2)}"${j} style="${it(I)}"/>`})}else{let X=Math.abs(k-S)>=Math.PI?"1 1":"0 1",j=`M ${ae(_)} ${ae(B)} a ${ae(x/2)} ${ae(v/2)} ${ae(f)} ${X} ${ae(Z)} ${ae(L)}`;this.elements.push({z:i,xml:`<path d="${j}" style="${it(I)}"/>`})}if(s.arrow){let X=s.arrowwidth??.15,j=s.arrowlength??.25,re=s.angle??0,te=s.theta1??0,ke=s.theta2??90,he=re*Math.PI/180,ve=Math.cos(ke*Math.PI/180),de=Math.sin(ke*Math.PI/180),Fe=Math.atan2(t/n*de,ve)*180/Math.PI,qe=Math.cos(te*Math.PI/180),Ie=Math.sin(te*Math.PI/180),ge=Math.atan2(t/n*Ie,qe)*180/Math.PI,Me=(De,ye)=>{if(re===0)return[De,ye];let _e=De-e[0],Ae=ye-e[1];return[e[0]+_e*Math.cos(he)-Ae*Math.sin(he),e[1]+_e*Math.sin(he)+Ae*Math.cos(he)]},be=(De,ye)=>re===0?[De,ye]:[De*Math.cos(he)-ye*Math.sin(he),De*Math.sin(he)+ye*Math.cos(he)],Be=s.arrow;if(Be==="ccw"||Be==="end"||Be==="both"){let De=Math.cos((Fe+90)*Math.PI/180)*j,ye=Math.sin((Fe+90)*Math.PI/180)*j,_e=Me(e[0]+t/2*Math.cos(Fe*Math.PI/180),e[1]+n/2*Math.sin(Fe*Math.PI/180)),Ae=be(De,ye),Ze=Math.atan2(Ae[1],Ae[0])*180/Math.PI;this.arrow([_e[0]+Ae[0],_e[1]+Ae[1]],Ze,{arrowwidth:X,arrowlength:j,color:o,lw:1,zorder:i})}if(Be==="cw"||Be==="start"||Be==="both"){let De=-Math.cos((ge+90)*Math.PI/180)*j,ye=-Math.sin((ge+90)*Math.PI/180)*j,_e=Me(e[0]+t/2*Math.cos(ge*Math.PI/180),e[1]+n/2*Math.sin(ge*Math.PI/180)),Ae=be(De,ye),Ze=Math.atan2(Ae[1],Ae[0])*180/Math.PI;this.arrow([_e[0]+Ae[0],_e[1]+Ae[1]],Ze,{arrowwidth:X,arrowlength:j,color:o,lw:1,zorder:i})}}}path(e,t={}){let n=t.zorder??1,s=t.color??"black",i=t.lw??2,o=t.ls??"-",a=t.capstyle??"round",l=t.joinstyle??"round",h=t.fill??"none",c=[];for(let f of e)if(typeof f=="string")c.push(f);else{let[g,b]=this.xform(f.x,f.y);c.push(ae(g),ae(b))}let m=wn({color:s,ls:o,lw:i,capstyle:a,joinstyle:l,fill:h});this.elements.push({z:n,xml:`<path d="${c.join(" ")}" style="${it(m)}"/>`})}image(e,t,n,s,i={}){let o=i.zorder??1,a=i.rotate??0,l=n*this.scale,h=s*this.scale,[c,m]=this.xform(t[0],t[1]),f=m-h,g=e.startsWith("data:")?e:`data:image/${i.imgfmt??"png"};base64,${e}`,b=a!==0?` transform="rotate(${ae(-a)} ${ae(c)} ${ae(f+h)})"`:"";this.elements.push({z:o,xml:`<image x="${ae(c)}" y="${ae(f)}" width="${ae(l)}" height="${ae(h)}" href="${it(g)}"${b}/>`})}mathText(e,t,n,s){let i=s.zorder??3,[o,a]=this.xform(t,n),l=s.fontsize??14,h=s.color??"black",c=s.width,m=s.height,f=s.halign??"center",g=s.valign??"center",b=o,x=a;f==="center"?b-=c/2:f==="right"&&(b-=c),g==="center"?x-=m/2:g==="bottom"&&(x-=m);let v=s.rotation??0,S=v!==0?` transform="rotate(${ae(v)} ${ae(o)} ${ae(a)})"`:"",k=f==="left"?"flex-start":f==="right"?"flex-end":"center",M=g==="top"?"flex-start":g==="bottom"?"flex-end":"center",_=`<foreignObject x="${ae(b)}" y="${ae(x)}" width="${ae(c)}" height="${ae(m)}"${S}><div xmlns="http://www.w3.org/1999/xhtml" style="color:${it(h)};font-size:${l}px;display:flex;align-items:${M};justify-content:${k};width:100%;height:100%;">`+e+"</div></foreignObject>";this.elements.push({z:i,xml:_})}beginGroup(e,t){this._hasGroups=!0,this._groupStack.push({startIndex:this.elements.length,attrs:e,title:t})}endGroup(){let e=this._groupStack.pop();if(!e)throw new Error("endGroup called without matching beginGroup");let t=this.elements.splice(e.startIndex);if(t.length===0){let a=Object.entries(e.attrs).map(([h,c])=>`${h}="${it(c)}"`).join(" "),l=e.title?`<title>${it(e.title)}</title>`:"";this.elements.push({z:0,xml:`<g ${a}>${l}</g>`});return}let n=t[0].z;for(let a=1;a<t.length;a++)t[a].z<n&&(n=t[a].z);let s=t.map(a=>a.xml).join(""),i=Object.entries(e.attrs).map(([a,l])=>`${a}="${it(l)}"`).join(" "),o=e.title?`<title>${it(e.title)}</title>`:"";this.elements.push({z:n,xml:`<g ${i}>${o}${s}</g>`})}toSvgInnerXml(){return[...this.elements].sort((e,t)=>e.z-t.z).map(e=>e.xml).join("")}toSvgString(){let e=this.bbox.xmin*this.scale,t=-this.bbox.ymax*this.scale,n=this.pxwidth,s=this.pxheight,i=this.backgroundColor?` style="background-color:${it(this.backgroundColor)}"`:"",o=this.extraDefs+this.svgDefs.join("");this._hasGroups&&(o+="<style>.sd-el{cursor:pointer;transition:filter .15s ease}.sd-el:hover path,.sd-el:hover polyline,.sd-el:hover polygon,.sd-el:hover circle,.sd-el:hover ellipse{filter:drop-shadow(0 0 3px rgba(66,133,244,.6))}.sd-el.sd-selected path,.sd-el.sd-selected polyline,.sd-el.sd-selected polygon,.sd-el.sd-selected circle,.sd-el.sd-selected ellipse{stroke:#4285f4;filter:drop-shadow(0 0 4px rgba(66,133,244,.8))}</style>");let a=o?`<defs>${o}</defs>`:"",l=this.toSvgInnerXml();return`<?xml version="1.0" encoding="UTF-8"?>
268
- <svg xmlns="http://www.w3.org/2000/svg" width="${ae(n)}pt" height="${ae(s)}pt" viewBox="${ae(e)} ${ae(t)} ${ae(n)} ${ae(s)}"${i}>${a}${l}</svg>`}};z(Ua,"totalClips",0);var g0=Ua;var E0=null,Jm=!1,_l=null;function Km(){return _l||(_l=Promise.resolve().then(()=>(Um(),Vm)).then(r=>{E0=r.default??r}).catch(()=>{E0=null}).finally(()=>{Jm=!0}),_l)}Km();var Zm=/\$([^$]+)\$/g;function va(r){return/\$[^$]+\$/.test(r)}function Bl(){return E0!==null}async function Qm(){return Jm||await Km(),E0!==null}function Cl(r,e){return E0?r.replace(Zm,(t,n)=>{try{return E0.renderToString(n,{throwOnError:!1})}catch{return t}}):r}function ya(r,e){let t=r.replace(Zm,(a,l)=>l),n=e*.65,s=Math.max(e*2,t.length*n+e),o=/\\frac|\\sum|\\int|\\prod|\\sqrt/.test(r)?e*2.8:e*1.8;return{width:s,height:o}}var H=[Number.NaN,Number.NaN];function Sa(r,e){return typeof r=="string"&&r.toLowerCase()==="bg"?e.bgcolor??"white":r}function jp(r){return Array.isArray(r)?Number.isNaN(r[0])&&Number.isNaN(r[1]):!1}function qp(r){return jp(r)?[Number.NaN,Number.NaN]:r instanceof A?[r.x,r.y]:[r[0],r[1]]}var p=class r{constructor(e,t={}){z(this,"path");z(this,"color");z(this,"lw");z(this,"ls");z(this,"capstyle");z(this,"joinstyle");z(this,"fill");z(this,"arrow");z(this,"arrowwidth",.15);z(this,"arrowlength",.25);z(this,"zorder");z(this,"visible",!0);z(this,"clip");z(this,"role");z(this,"gradientStrokeId");this.path=e.map(qp),Object.assign(this,t)}xform(e,t){let s=e.transformArray(this.path.map(([i,o])=>[i,o])).map(i=>[i.x,i.y]);return new r(s,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,capstyle:this.capstyle??t.capstyle,joinstyle:this.joinstyle??t.joinstyle,fill:this.fill??t.fill,arrow:this.arrow,arrowwidth:this.arrowwidth,arrowlength:this.arrowlength,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=this.path.map(s=>s[0]).filter(s=>!Number.isNaN(s)),t=this.path.map(s=>s[1]).filter(s=>!Number.isNaN(s)),n=this.arrow?this.arrowwidth??0:0;return He(Math.min(...e),Math.min(...t)-n,Math.max(...e),Math.max(...t)+n)}doreverse(e){let t=[...this.path].reverse();this.path=t.map(([n,s])=>Number.isNaN(n)&&Number.isNaN(s)?[n,s]:Sr(n,s,e)),this.arrow&&(this.arrow=this.arrow.split("").map(n=>n==="<"?">":n===">"?"<":n).join(""))}doflip(){this.path=this.path.map(([e,t])=>Number.isNaN(e)&&Number.isNaN(t)?[e,t]:kr(e,t))}draw(e,t,n){if(!this.visible)return;let s=t.transformArray(this.path.map(([S,k])=>[S,k])),i=s.map(S=>new A(S.x,S.y)),o=this.color??n.color??"black",a=this.ls??n.ls??"-",l=this.lw??n.lw??2,h=this.capstyle??n.capstyle??"round",c=this.joinstyle??n.joinstyle??"round",m=Sa(this.fill??n.fill,n),f=this.zorder??n.zorder??2,g=n._svgGradientFillId;if(m){let S=i.map(_=>`${_.x},${_.y}`),k=new Set(S);S.length!==k.size?m===!0&&(m=o):m=void 0}if(g&&m&&(m=`url(#${g})`),this.arrow?.includes("<")){let S=i[1].sub(i[0]),k=Math.atan2(S.y,S.x);i=[...i],i[0]=new A(i[0].x+this.arrowlength*Math.cos(k),i[0].y+this.arrowlength*Math.sin(k))}if(this.arrow?.includes(">")){let S=i[i.length-1].sub(i[i.length-2]),k=Math.atan2(S.y,S.x);i=[...i];let M=i.length-1;i[M]=new A(i[M].x-this.arrowlength*Math.cos(k),i[M].y-this.arrowlength*Math.sin(k))}let b=this.gradientStrokeId?`url(#${this.gradientStrokeId})`:o,x=i.map(S=>S.x),v=i.map(S=>S.y);if(e.plot(x,v,{color:b,ls:a,lw:l,capstyle:h,joinstyle:c,fill:m??"none",zorder:f}),this.arrow){let S=s.map(k=>new A(k.x,k.y));if(this.arrow.includes("<")){let k=Math.atan2(S[0].y-S[1].y,S[0].x-S[1].x)*180/Math.PI;e.arrow([S[0].x,S[0].y],k,{color:o,zorder:f,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth,lw:1})}if(this.arrow.includes(">")){let k=Math.atan2(S[S.length-1].y-S[S.length-2].y,S[S.length-1].x-S[S.length-2].x)*180/Math.PI;e.arrow([S[S.length-1].x,S[S.length-1].y],k,{color:o,zorder:f,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth,lw:1})}}}},D=class r{constructor(e,t,n={}){z(this,"center");z(this,"radius");z(this,"color");z(this,"lw");z(this,"ls");z(this,"fill");z(this,"zorder");z(this,"visible",!0);this.center=e,this.radius=t,Object.assign(this,n)}xform(e,t){let n=e.transform(this.center),s=e.zoom;if(!(s.x===s.y))throw new Error("SegmentCircle xform with non-uniform zoom not implemented in TS subset");return new r([n.x,n.y],this.radius*s.x,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,fill:this.fill??t.fill,zorder:this.zorder??t.zorder})}getBBox(){let[e,t]=this.center,n=this.radius;return He(e-n,t-n,e+n,t+n)}doreverse(e){this.center=Sr(this.center[0],this.center[1],e)}doflip(){this.center=kr(this.center[0],this.center[1])}draw(e,t,n){if(!this.visible)return;let s=n._svgGradientFillId,i=t.transform(this.center),o=this.radius*t.zoom.x,a=this.color??n.color??"black",l=this.lw??n.lw??2,h=Sa(this.fill??n.fill,n);s?h=`url(#${s})`:h===!0?h=a:h===!1&&(h="none"),h==null&&(h="none"),e.circle(i.x,i.y,o,{color:a,lw:l,ls:this.ls??n.ls,fill:h,zorder:this.zorder??n.zorder??1})}},W=class r{constructor(e,t,n={}){z(this,"xy");z(this,"text");z(this,"color");z(this,"fontsize");z(this,"fontfamily");z(this,"mathfont");z(this,"zorder");z(this,"visible",!0);z(this,"halign");z(this,"valign");z(this,"href");z(this,"decoration");z(this,"rotation");let s=e instanceof A?e:A.fromXY(e);this.xy=[s.x,s.y],this.text=t;let i=n.align;i&&(this.halign=i[0],this.valign=i[1]),Object.assign(this,n)}xform(e,t){let n=e.transform(this.xy);return new r([n.x,n.y],this.text,{color:this.color??t.color,fontsize:this.fontsize??t.fontsize,fontfamily:this.fontfamily??t.font,mathfont:this.mathfont??t.mathfont,zorder:this.zorder??t.zorder,visible:this.visible,halign:this.halign,valign:this.valign,href:this.href,decoration:this.decoration,rotation:this.rotation})}getBBox(){let e=this.fontsize??14,t=72*.5,n,s;if(va(this.text)){let c=ya(this.text,e);n=c.width/t,s=c.height/t}else{let{width:c,height:m}=b0(this.text,e,this.fontfamily);n=c/t,s=m/t}let i=this.halign??"center",o,a;i==="left"?(o=this.xy[0],a=this.xy[0]+n):i==="right"?(o=this.xy[0]-n,a=this.xy[0]):(o=this.xy[0]-n/2,a=this.xy[0]+n/2);let l=this.valign??"center",h=this.xy[1];if(l==="center")h-=s/2;else if(l==="top")h-=s;else if(l!=="bottom"){let c=this.text.split(`
269
- `).length;h+=e*(2/72)*(c-1)}return He(o,h,a,h+s)}doreverse(e){this.xy=Sr(this.xy[0],this.xy[1],e),this.halign==="left"?this.halign="right":this.halign==="right"&&(this.halign="left")}doflip(){this.xy=kr(this.xy[0],this.xy[1]),this.valign==="top"?this.valign="bottom":this.valign==="bottom"&&(this.valign="top")}draw(e,t,n){if(!this.visible)return;let s=t.transform(this.xy),i=this.color??n.color??"black",o=this.fontsize??n.fontsize??14,a=this.fontfamily??n.font??"sans-serif",l=this.mathfont??n.mathfont,h=this.text,c=t.theta*180/Math.PI,m=this.rotation!==void 0?c+this.rotation:void 0;if(va(h)&&Bl()){let x=Cl(h,o),{width:v,height:S}=ya(h,o);e.mathText(x,s.x,s.y,{width:v,height:S,color:i,fontsize:o,halign:this.halign??"center",valign:this.valign??"center",zorder:this.zorder??n.zorder??3,rotation:m});return}let f=l!==void 0&&l!==""&&h.includes("$")?l:a,g=this.decoration?.toLowerCase(),b=g==="underline"||g==="overline"?g:void 0;e.text(this.text,s.x,s.y,{color:i,fontsize:o,fontfamily:f,halign:this.halign??"center",valign:this.valign??"center",zorder:this.zorder??n.zorder??3,href:this.href??void 0,textDecoration:b,rotation:m})}},U=class r{constructor(e,t={}){z(this,"verts");z(this,"closed",!0);z(this,"cornerradius",0);z(this,"color");z(this,"fill");z(this,"lw");z(this,"ls");z(this,"hatch");z(this,"joinstyle");z(this,"capstyle");z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.verts=e,Object.assign(this,t)}xform(e,t){let s=e.transformArray(this.verts.map(([i,o])=>[i,o])).map(i=>[i.x,i.y]);return new r(s,{closed:this.closed,cornerradius:this.cornerradius,color:this.color??t.color,fill:this.fill??t.fill,lw:this.lw??t.lw,ls:this.ls??t.ls,hatch:this.hatch,joinstyle:this.joinstyle??t.joinstyle,capstyle:this.capstyle??t.capstyle,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=this.verts.map(n=>n[0]),t=this.verts.map(n=>n[1]);return He(Math.min(...e),Math.min(...t),Math.max(...e),Math.max(...t))}doreverse(e){this.verts=[...this.verts].reverse().map(([t,n])=>Sr(t,n,e))}doflip(){this.verts=this.verts.map(([e,t])=>kr(e,t))}draw(e,t,n){if(!this.visible)return;let s=n._svgGradientFillId,i=this.fill!==void 0?this.fill:n.fill;i=Sa(i,n);let o=i===!0?n.color??"black":typeof i=="string"?i:void 0;s&&this.closed&&(o=`url(#${s})`);let a=this.color??n.color??"black",h=t.transformArray(this.verts.map(([c,m])=>[c,m])).map(c=>({x:c.x,y:c.y}));if(this.cornerradius>0){let c=bu(this.verts.map(([m,f])=>[m,f]),this.cornerradius);h=t.transformArray(c.map(m=>[m.x,m.y])).map(m=>({x:m.x,y:m.y}))}e.poly(h,{closed:this.closed,color:a,fill:o===void 0?"none":o,lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",hatch:this.hatch,capstyle:this.capstyle??n.capstyle??"round",joinstyle:this.joinstyle??n.joinstyle??"round",zorder:this.zorder??n.zorder??1})}},xe=class r{constructor(e,t,n,s={}){z(this,"center");z(this,"width");z(this,"height");z(this,"theta1");z(this,"theta2");z(this,"arrow");z(this,"arrowwidth",.15);z(this,"arrowlength",.25);z(this,"angle",0);z(this,"color");z(this,"lw");z(this,"ls");z(this,"fill");z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.center=e,this.width=t,this.height=n,this.theta1=s.theta1??35,this.theta2=s.theta2??-35,this.arrow=s.arrow,s.arrowwidth!==void 0&&(this.arrowwidth=s.arrowwidth),s.arrowlength!==void 0&&(this.arrowlength=s.arrowlength),this.angle=s.angle??0,this.color=s.color,this.lw=s.lw,this.ls=s.ls,this.fill=s.fill,this.zorder=s.zorder,this.visible=s.visible??!0,this.clip=s.clip}xform(e,t){let n=e.transform(this.center),s=this.angle+e.theta;return new r([n.x,n.y],this.width*e.zoom.x,this.height*e.zoom.y,{theta1:this.theta1,theta2:this.theta2,angle:s,arrow:this.arrow,arrowwidth:this.arrowwidth,arrowlength:this.arrowlength,color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,fill:this.fill??t.fill,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=this.theta1*Math.PI/180,t=this.theta2*Math.PI/180,n=Math.atan2(this.width*Math.sin(e),this.height*Math.cos(e)),s=Math.atan2(this.width*Math.sin(t),this.height*Math.cos(t));for(;s<n;)s+=2*Math.PI;let i=this.angle*Math.PI/180,o=this.width/2,a=this.height/2,l=50,h=[],c=[];for(let m=0;m<=l;m++){let f=n+(s-n)*m/l,g=Math.sin(f),b=Math.cos(f);h.push(this.center[0]+o*b*Math.cos(i)-a*g*Math.sin(i)),c.push(this.center[1]+o*b*Math.sin(i)+a*g*Math.cos(i))}return He(Math.min(...h),Math.min(...c),Math.max(...h),Math.max(...c))}doreverse(e){this.center=Sr(this.center[0],this.center[1],e);let t=this.theta1,n=this.theta2;this.theta1=180-n,this.theta2=180-t,this.arrow==="cw"?this.arrow="ccw":this.arrow==="ccw"&&(this.arrow="cw")}doflip(){this.center=kr(this.center[0],this.center[1]);let e=this.theta1,t=this.theta2;this.theta1=-t,this.theta2=-e,this.arrow==="cw"?this.arrow="ccw":this.arrow==="ccw"&&(this.arrow="cw")}draw(e,t,n){if(!this.visible)return;let s=t.transform(this.center),i=this.width*t.zoom.x,o=this.height*t.zoom.y;e.arc([s.x,s.y],i,o,{theta1:this.theta1,theta2:this.theta2,angle:this.angle+t.theta,color:this.color??n.color??"black",lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",fill:Sa(this.fill??n.fill,n),zorder:this.zorder??n.zorder??1,arrow:this.arrow??void 0,arrowwidth:this.arrowwidth,arrowlength:this.arrowlength})}},Ut=class r{constructor(e,t={}){z(this,"p");z(this,"color");z(this,"lw");z(this,"ls");z(this,"capstyle");z(this,"arrow");z(this,"arrowlength",.25);z(this,"arrowwidth",.15);z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.p=e,Object.assign(this,t)}xform(e,t){let s=e.transformArray(this.p.map(([i,o])=>[i,o])).map(i=>[i.x,i.y]);return new r(s,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,capstyle:this.capstyle??t.capstyle,arrow:this.arrow,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=Hp(0,1,50),t=this.p.map(o=>o[0]),n=this.p.map(o=>o[1]),s,i;return this.p.length===3?(s=e.map(o=>(1-o)**2*t[0]+2*(1-o)*o*t[1]+o**2*t[2]),i=e.map(o=>(1-o)**2*n[0]+2*(1-o)*o*n[1]+o**2*n[2])):(s=e.map(o=>(1-o)**3*t[0]+3*(1-o)**2*o*t[1]+3*(1-o)*o**2*t[2]+o**3*t[3]),i=e.map(o=>(1-o)**3*n[0]+3*(1-o)**2*o*n[1]+3*(1-o)*o**2*n[2]+o**3*n[3])),He(Math.min(...s),Math.min(...i),Math.max(...s),Math.max(...i))}doreverse(e){if(this.p=this.p.map(([t,n])=>Sr(t,n,e)),this.arrow){let t=[...this.arrow].reverse().join("");this.arrow=t.split("").map(n=>n==="<"?">":n===">"?"<":n).join("")}}doflip(){this.p=this.p.map(([e,t])=>kr(e,t))}draw(e,t,n){if(!this.visible)return;let i=t.transformArray(this.p.map(([o,a])=>[o,a])).map(o=>({x:o.x,y:o.y}));e.bezier(i,{color:this.color??n.color??"black",lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",capstyle:this.capstyle??n.capstyle??"round",zorder:this.zorder??n.zorder??1,arrow:this.arrow,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth})}};function Hp(r,e,t){if(t<2)return[r];let n=(e-r)/(t-1);return Array.from({length:t},(s,i)=>r+n*i)}var ut=class r{constructor(e,t={}){z(this,"path");z(this,"color");z(this,"lw");z(this,"ls");z(this,"capstyle");z(this,"joinstyle");z(this,"fill");z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.path=e,Object.assign(this,t)}xform(e,t){let n=[];for(let s of this.path)if(typeof s=="string")n.push(s);else{let i=e.transform(s);n.push([i.x,i.y])}return new r(n,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,capstyle:this.capstyle??t.capstyle,joinstyle:this.joinstyle??t.joinstyle,fill:this.fill??t.fill,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=[],t=[];for(let n of this.path)typeof n!="string"&&(e.push(n[0]),t.push(n[1]));return e.length===0?He(0,0,0,0):He(Math.min(...e),Math.min(...t),Math.max(...e),Math.max(...t))}doreverse(e){}doflip(){}draw(e,t,n){if(!this.visible)return;let s=[];for(let i of this.path)if(typeof i=="string")s.push(i);else{let o=t.transform(i);s.push({x:o.x,y:o.y})}e.path(s,{color:this.color??n.color??"black",lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",capstyle:this.capstyle??n.capstyle??"round",joinstyle:this.joinstyle??n.joinstyle??"round",fill:this.fill===!0?n.color:Sa(this.fill,n),zorder:this.zorder??n.zorder??1})}},Br=class r{constructor(e,t={}){z(this,"image");z(this,"xy");z(this,"width");z(this,"height");z(this,"rotate");z(this,"imgfmt");z(this,"zorder");z(this,"visible",!0);this.image=e,this.xy=t.xy??[0,0],this.width=t.width??3,this.height=t.height??1,this.rotate=t.rotate??0,this.imgfmt=t.imgfmt,this.zorder=t.zorder}getBBox(){if(this.rotate%360===0)return He(this.xy[0],this.xy[1],this.xy[0]+this.width,this.xy[1]+this.height);let e=new A(this.xy[0],this.xy[1]).rotate(this.rotate),t=new A(this.xy[0]+this.width,this.xy[1]).rotate(this.rotate),n=new A(this.xy[0]+this.width,this.xy[1]+this.height).rotate(this.rotate),s=new A(this.xy[0],this.xy[1]+this.height).rotate(this.rotate),i=[e,t,n,s];return He(Math.min(...i.map(o=>o.x)),Math.min(...i.map(o=>o.y)),Math.max(...i.map(o=>o.x)),Math.max(...i.map(o=>o.y)))}xform(e,t){let n=e.transform(this.xy);return new r(this.image,{xy:[n.x,n.y],width:this.width*e.zoom.x,height:this.height*e.zoom.y,rotate:this.rotate+e.theta,imgfmt:this.imgfmt,zorder:this.zorder??t.zorder})}doreverse(e){}doflip(){}draw(e,t,n){if(!this.visible)return;let s=t.transform(this.xy);e.image(this.image,[s.x,s.y],this.width*t.zoom.x,this.height*t.zoom.y,{rotate:this.rotate+t.theta,zorder:this.zorder??n.zorder??1,imgfmt:this.imgfmt})}};function Yp(r,e){let t=r==null||r===""?e:r;return{bot:"bottom",lft:"left",rgt:"right",T:"top"}[t]??t}var Xp=new Set(["top","bottom","left","right","center"]);function mc(r,e){let t=(e%360+360)%360;return t<=90||t>270?r:r==="top"?"bottom":r==="bottom"?"top":r==="left"?"right":r==="right"?"left":r}function dc(r,e){if(r.rotate===!0){let t=e%360;return t<0&&(t+=360),t>90&&t<270&&(t-=180),(t%360+360)%360}return typeof r.rotate=="number"?(r.rotate%360+360)%360:0}var Gp=[["center","bottom"],["right","bottom"],["right","center"],["right","top"],["center","top"],["left","top"],["left","center"],["left","bottom"]];function pc(r,e,t,n,s,i){let o=i.xmin,a=i.ymin,l=i.xmax,h=i.ymax,c;if(typeof s=="number"?c=new A(s,s):c=s instanceof A?s:A.fromXY(s),e==="center")return{halign:"center",valign:"center",ofst:c};if(e in r.anchors){let x=r.anchors[e],v=x instanceof A?x.x:x[0],S=x instanceof A?x.y:x[1],k=.15,M="center",_="center";if(Math.abs(v-o)<k?M="right":Math.abs(v-l)<k&&(M="left"),Math.abs(S-a)<k?_="top":Math.abs(S-h)<k&&(_="bottom"),typeof s=="number"){let B=s,$=`${M},${_}`,Z={"center,bottom":[0,B],"right,bottom":[-B,B],"right,center":[-B,0],"right,top":[-B,-B],"center,top":[0,-B],"left,top":[B,-B],"left,center":[B,0],"left,bottom":[B,B]}[$]??[0,B];c=new A(Z[0],Z[1])}return{halign:M,valign:_,ofst:c}}let m=t-n;e==="left"?m+=90:e==="bottom"?m+=180:e==="right"&&(m+=270),m=(m%360+360)%360;let f=Math.round(m/360*8)%8,[g,b]=Gp[f];if(typeof s=="number"){let x=s,v,S;e==="bottom"?(v=0,S=-x):e==="left"?(v=-x,S=0):e==="right"?(v=x,S=0):(v=0,S=x),c=new A(v,S)}return{halign:g,valign:b,ofst:c}}function Wp(r,e,t){if(r===void 0||typeof r=="number")return r;let n=r instanceof A?r:A.fromXY(r);return e&&(n=n.flip()),t&&(n=n.mirrorx(0)),[n.x,n.y]}function Il(r,e,t){let n=r.getBBox(!1,!1),s=n.xmin,i=n.xmax,o=n.ymin,a=n.ymax;Number.isFinite(i+s+a+o)||(s=i=o=a=.1);let l={xmin:s,xmax:i,ymin:o,ymax:a},h=(i+s)/2,c=(a+o)/2,m=r.params,f=T(m,"lblloc","top"),g=T(m,"lblofst",.1),b=T(m,"lblalign",[void 0,void 0]),x=m.flip===!0,v=m.reverse===!0,S=m.ignore_hints===!0;for(let k of t){let M=mc(Yp(k.loc,f),e),_=Array.isArray(k.text)?k.text:[k.text];if(_.length===0)continue;let B=S?void 0:r.getLabelHint(M),$=k.valign??B?.valign,Y=k.halign??B?.halign;x&&($==="top"?$="bottom":$==="bottom"&&($="top")),v&&(Y==="left"?Y="right":Y==="right"&&(Y="left"));let Z=Wp(k.ofst??B?.ofst,x,v);Z===void 0&&(Z=g);let L=Y??b[0],I=$??b[1],X=dc(k,e),re=pc(r,M,e,X,Z,l),te=L??re.halign,ke=I??re.valign,he=re.ofst,ve=m._shift_magnitude;ve!==void 0&&(M==="top"||M==="bottom")&&(he=he.add(new A(ve,0)));let de;k.rotate===!0?de=0:typeof k.rotate=="number"&&(de=k.rotate);let Fe=k.fontsize??B?.fontsize??T(m,"fontsize",14),qe=k.color??T(m,"color","black"),Ie=k.font??T(m,"font","sans-serif"),ge=k.mathfont??T(m,"mathfont",void 0),Me={fontsize:Fe,color:qe,fontfamily:Ie,align:[te,ke],href:k.href??void 0,decoration:k.decoration??void 0};if(ge!==void 0&&ge!==""&&(Me.mathfont=ge),de!==void 0&&(Me.rotation=de),Array.isArray(k.text)){if(!Xp.has(M))throw new Error(`Array element labels require loc top|bottom|left|right|center (after lblloc), got ${M}`);let Be=_.length,De=(i-s)/(Be+1),ye=(a-o)/(Be+1);for(let _e=0;_e<Be;_e++){let Ae;M==="top"?Ae=new A(s+De*(_e+1),a):M==="bottom"?Ae=new A(s+De*(_e+1),o):M==="left"?Ae=new A(s,o+ye*(_e+1)):M==="right"?Ae=new A(i,o+ye*(_e+1)):Ae=new A(s+De*(_e+1),0),Ae=Ae.add(he),r.segments.push(new W([Ae.x,Ae.y],_[_e],Me))}continue}let be;if(M in r.anchors){let Be=r.anchors[M];be=new A(Be instanceof A?Be.x:Be[0],Be instanceof A?Be.y:Be[1])}else if(M==="top")be=new A(h,a);else if(M==="bottom")be=new A(h,o);else if(M==="left")be=new A(s,c);else if(M==="right")be=new A(i,c);else if(M==="center")be=new A(h,c);else throw new Error(`Unknown label location ${M}`);be=be.add(he),r.segments.push(new W([be.x,be.y],_[0],Me))}}function Ll(r,e){let t=[],n=T(r,"lblloc","top"),s=T(r,"fontsize",14),i=r.color??"black",o=r.lblrotate===!0,a=r.mathfont!=null&&r.mathfont!==""?String(r.mathfont):void 0,l=(h,c)=>{if(h!=null)if(Array.isArray(h)){if(h.length===0)return;t.push({text:h.map(String),loc:c,fontsize:s,color:i,rotate:o?!0:void 0,mathfont:a})}else h!==""&&t.push({text:String(h),loc:c,fontsize:s,color:i,rotate:o?!0:void 0,mathfont:a})};return r.toplabel!=null&&l(r.toplabel,"top"),r.botlabel!=null&&l(r.botlabel,"bottom"),r.lftlabel!=null&&l(r.lftlabel,"left"),r.rgtlabel!=null&&l(r.rgtlabel,"right"),r.clabel!=null&&l(r.clabel,"center"),r.label!=null&&l(r.label,n),t}function Vp(r){(r instanceof p||r instanceof D||r instanceof W||r instanceof U||r instanceof xe||r instanceof Ut||r instanceof ut||r instanceof Br)&&r.doflip()}function Up(r,e){(r instanceof p||r instanceof D||r instanceof W||r instanceof U||r instanceof xe||r instanceof Ut||r instanceof ut||r instanceof Br)&&r.doreverse(e)}function fc(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}var gc=["start","end","center","istart","iend","N","S","E","W","NE","NW","SE","SW","NNE","NNW","ENE","WNW","SSE","SSW","ESE","WSW"],N=class r{constructor(e={}){z(this,"userParams",{});z(this,"elmParams",{});z(this,"dwgParams",{});z(this,"defaults",{});z(this,"segments",[]);z(this,"anchors",{});z(this,"absanchors",{});z(this,"transform");z(this,"absdrop");z(this,"_positioned",!1);z(this,"_localshift",new A(0,0));z(this,"bbox",He(0,0,0,0));z(this,"userLabels",[]);z(this,"_labelhints",{});z(this,"_segmentCountBeforeLabels",0);Object.assign(this.userParams,e),At(this)}get params(){let e=f0();return Mr(this.userParams,this.elmParams,this.defaults,this.dwgParams,e)}getAbsAnchor(e){return this.absanchors[e]}getAnchorNamesForGetattr(){let e=new Set(gc);for(let t of Object.keys(this.anchors))e.add(t);return[...e]}touchAnchorAccess(e){e in this.absanchors||this.getAnchorNamesForGetattr().includes(e)&&At(this)}resolveAnchor(e){return this.touchAnchorAccess(e),this.getAbsAnchor(e)}_position(){let e=this.userParams.at;if(Array.isArray(e)&&e.length===2&&typeof e[1]=="string"&&e[0]instanceof r){let t=e[0],n=e[1];if(!(n in t.absanchors))throw new Error(`Unknown anchor name ${n}`);let s=t.absanchors[n];this.userParams.at=[s.x,s.y]}this._flipreverse(),this._positioned=!0}_flipreverse(){if(this.userParams.flip===!0){for(let e of this.segments)Vp(e);for(let e of Object.keys(this.anchors)){let t=A.fromXY(fc(this.anchors[e]));this.anchors[e]=t.flip().toTuple()}}if(this.userParams.reverse===!0){let e;if(this.anchors.center!==void 0)e=fc(this.anchors.center)[0];else{let t=this.getBBox(!1,!1);e=(t.xmin+t.xmax)/2}for(let t of this.segments)Up(t,e);for(let t of Object.keys(this.anchors)){let n=A.fromXY(fc(this.anchors[t]));this.anchors[t]=n.mirrorx(e).toTuple()}}}up(){return this.userParams.d="up",this}down(){return this.userParams.d="down",this}left(){return this.userParams.d="left",this}right(){return this.userParams.d="right",this}theta(e){return this.userParams.theta=e,this}drop(e){return this.userParams.drop=e,this}at(e,t=0,n=0){if(Array.isArray(e)&&e.length===2&&typeof e[1]=="string"&&e[0]instanceof r){if(t!==0||n!==0)throw new Error("dx and dy must be zero when at is [Element, anchorName]");this.userParams.at=e}else{let s=A.fromXY(e);this.userParams.at=[s.x+t,s.y+n]}return this}scale(e=1){return this.userParams.zoom=new A(e,e),this}scalex(e=1){let t=this.userParams.zoom,n=new A(1,1);return typeof t=="number"?n=new A(t,t):t instanceof A?n=t:Array.isArray(t)&&t.length>=2&&(n=new A(Number(t[0]),Number(t[1]))),this.userParams.zoom=new A(e,n.y),this}scaley(e=1){let t=this.userParams.zoom,n=new A(1,1);return typeof t=="number"?n=new A(t,t):t instanceof A?n=t:Array.isArray(t)&&t.length>=2&&(n=new A(Number(t[0]),Number(t[1]))),this.userParams.zoom=new A(n.x,e),this}flip(){return this.userParams.flip=!0,this}reverse(){return this.userParams.reverse!==void 0?this.userParams.reverse=!this.userParams.reverse:this.userParams.reverse=!0,this}anchor(e){return this.userParams.anchor=e,this}color(e){return Vr(e),this.userParams.color=e,this}linestyle(e){return Wa(e),this.userParams.ls=e,this}linewidth(e){return this.userParams.lw=e,this}fill(e=!0){return Vr(e),this.userParams.fill=e,this}zorder(e){return this.userParams.zorder=e,this}hold(){return this.userParams.move_cur=!1,this}style(e){return e.color!==void 0&&this.color(e.color),e.fill!==void 0&&this.fill(e.fill),e.ls!==void 0&&this.linestyle(e.ls),e.lw!==void 0&&(this.userParams.lw=e.lw),this}fontsize(e){return this.userParams.fontsize=e,this}font(e){return this.userParams.font=e,this}mathfont(e){return this.userParams.mathfont=e,this}gradientFill(e,t,n=!0){return this.userParams.gradient=[e,t,n],this}label(e,t={}){return this.userLabels.push({text:e,...t}),this}getLabelHint(e){return this._labelhints[e]}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this._segmentCountBeforeLabels===0&&(this._segmentCountBeforeLabels=this.segments.length),this.segments.splice(this._segmentCountBeforeLabels);let s=T(this.params,"anchor",void 0),i=this.params.zoom??this.params.scale??1,o=typeof i=="number"?new A(i,i):Array.isArray(i)?new A(i[0],i[1]):i,a=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),l;if(this.params.endpts!==void 0)l=t;else if(this.params.d!==void 0){let f=this.params.d;if(/^-?\d+(\.\d+)?$/.test(String(f).replace("-","")))l=Number(f);else{let g=String(f).toLowerCase()[0];l={u:90,r:0,l:180,d:270}[g]??0}}else l=this.params.theta??t;if(s!==void 0){let f=this.anchors[s];if(f===void 0)throw new Error(`Unknown anchor ${s}`);let g=f instanceof A?f.x:f[0],b=f instanceof A?f.y:f[1];this._localshift=new A(-g,-b)}this.transform=new p0(l,[a.x,a.y],this._localshift.toTuple(),o);let h=[...Ll(this.params,l),...this.userLabels];h.length>0&&Il(this,l,h);for(let[f,g]of Object.entries(this.anchors)){let b=g instanceof A?g.x:g[0],x=g instanceof A?g.y:g[1];this.absanchors[f]=this.transform.transform([b,x])}this.absanchors.xy=this.transform.transform([0,0]);let c=this.params.drop,m=f=>{if(f instanceof A)return[f.x,f.y];if(Array.isArray(f)&&f.length>=2)return[Number(f[0]),Number(f[1])];throw new Error("invalid drop")};if(c!==void 0&&typeof c=="string"&&c in this.anchors){let f=this.anchors[c],g=f instanceof A?f.x:f[0],b=f instanceof A?f.y:f[1];this.absdrop={point:this.transform.transform([g,b]),theta:l}}else c!=null&&this.params.move_cur!==!1?this.params.droptheta!==void 0?this.absdrop={point:this.transform.transform(m(c)),theta:this.params.droptheta}:this.params.theta===0?this.absdrop={point:this.transform.transform(m(c)),theta:t}:this.absdrop={point:this.transform.transform(m(c)),theta:l}:this.absdrop={point:A.fromXY(e),theta:t};return this.bbox=this.getBBox(!1,!1),this.absdrop}getBBox(e,t=!0){let n=1/0,s=1/0,i=-1/0,o=-1/0;for(let a of this.segments){if(!t&&a instanceof W)continue;let l;e?l=a.xform(this.transform,this.params).getBBox():l=a.getBBox(),n=Math.min(n,l.xmin),s=Math.min(s,l.ymin),i=Math.max(i,l.xmax),o=Math.max(o,l.ymax)}return He(n,s,i,o)}_draw(e){this.segments.length===0&&this._place([0,0],0,{});for(let t of this.segments)t instanceof p?t.draw(e,this.transform,this.params):t instanceof D?t.draw(e,this.transform,this.params):t instanceof W?t.draw(e,this.transform,this.params):t instanceof U?t.draw(e,this.transform,this.params):t instanceof xe?t.draw(e,this.transform,this.params):t instanceof Ut?t.draw(e,this.transform,this.params):t instanceof ut?t.draw(e,this.transform,this.params):t instanceof Br&&t.draw(e,this.transform,this.params)}};var P0=class r extends N{constructor(t,n={}){super(n);this.parent=t;z(this,"inner",[]);Object.assign(this.defaults,{cornerradius:.3,padx:.75,pady:.75,theta:0,anchor:"boxNW"})}container(t={}){return new r(this,{...t})}add(t){return this.inner.push(t),this.parent.add(t),t}containsElement(t){return this.inner.includes(t)}enter(){Xa(this)}exit(){At(this),Ga(this)}containerBBox(t=!0){let n=1/0,s=1/0,i=-1/0,o=-1/0;for(let a of this.inner){let l=a.getBBox(t,!1);n=Math.min(n,l.xmin),s=Math.min(s,l.ymin),i=Math.max(i,l.xmax),o=Math.max(o,l.ymax)}return Number.isFinite(n)?He(n,s,i,o):He(0,0,0,0)}getBBox(t,n=!0){let s=this.containerBBox(t),i=T(this.params,"padx",.75),o=T(this.params,"pady",.75);return He(s.xmin-i,s.ymin-o,s.xmax+i,s.ymax+o)}_place(t,n,s){this.dwgParams={...s};let i=this.containerBBox(!1),o=T(this.params,"padx",.75),a=T(this.params,"pady",.75),l=i.xmax-i.xmin+o*2,h=i.ymax-i.ymin+a*2,c=T(this.params,"cornerradius",0);return this.elmParams.at=[i.xmin-o,i.ymax+a],this.segments=[],c>0?this.segments.push(new U([[0,h/2],[l,h/2],[l,-h/2],[0,-h/2]],{closed:!0,cornerradius:c})):this.segments.push(new p([[0,0],[0,h/2],[l,h/2],[l,-h/2],[0,-h/2],[0,0]])),this.anchors.center=[l/2,0],this.anchors.boxNW=[0,h/2],this.anchors.N=[l/2,h/2],this.anchors.E=[l,0],this.anchors.S=[l/2,-h/2],this.anchors.W=[0,0],super._place(t,n,s)}};function bc(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Jp(r,e,t,n){let s=n?"0%":"100%",i=n?"100%":"0%";return`<linearGradient id="${bc(r)}" x1="0%" y1="0%" x2="${s}" y2="${i}"><stop offset="0%" stop-color="${bc(e)}"/><stop offset="100%" stop-color="${bc(t)}"/></linearGradient>`}function e1(r){let e=[],t=0,n=[];for(let s of r){let o=Mr(s.userParams,s.elmParams,s.defaults,s.dwgParams).gradient;if(o&&Array.isArray(o)&&o.length>=2){let a=`sdg${t++}`;e.push(Jp(a,String(o[0]),String(o[1]),o[2]!==!1)),s.elmParams._svgGradientFillId=a,n.push(()=>{delete s.elmParams._svgGradientFillId})}}return{defsXml:e.join(""),cleanup:()=>{for(let s of n)s()}}}function wc(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var t1={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",gray:"#808080",grey:"#808080",silver:"#c0c0c0",maroon:"#800000",navy:"#000080"};function r1(r){let e=r.trim().toLowerCase();if(t1[e])return t1[e];if(e.startsWith("#"))return e.length===4&&e[1]&&e[2]&&e[3]?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:(e.length===7,e);let t=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);if(t){let n=Number(t[1]).toString(16).padStart(2,"0"),s=Number(t[2]).toString(16).padStart(2,"0"),i=Number(t[3]).toString(16).padStart(2,"0");return`#${n}${s}${i}`}return e}function Kp(r,e){return r1(r)===r1(e)}function n1(r){return Mr(r.userParams,r.elmParams,r.defaults,r.dwgParams).color??"black"}function Zp(r){let e=[],t=r.absanchors;return t.end&&e.push(t.end),t.out&&(!t.end||!xc(t.out,t.end,.01))&&e.push(t.out),e}function Qp(r){let e=[],t=r.absanchors;t.start&&e.push(t.start);for(let[n,s]of Object.entries(t))n.startsWith("in")&&/^in\d+$/.test(n)&&(!t.start||!xc(s,t.start,.01))&&e.push(s);return e}function xc(r,e,t){return Math.hypot(r.x-e.x,r.y-e.y)<=t}function i1(r){let e=[],t=new Set,n=.5;for(let s=0;s<r.length;s++){let i=r[s],o=Zp(i);if(o.length===0)continue;let a=n1(i);for(let l=0;l<r.length;l++){if(s===l)continue;let h=r[l],c=Qp(h);if(c.length===0)continue;let m=n1(h);if(!Kp(a,m))for(let f of o)for(let g of c){if(!xc(f,g,n))continue;let b=`${s}|${l}`;t.has(b)||(t.add(b),e.push({fromEl:i,toEl:h,fromColor:a,toColor:m,junctionPt:f}))}}}return e}function Dl(r){return Number.isInteger(r)?String(r):r.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}function o1(r,e,t){if(e.length===0)return{defsXml:"",cleanup:()=>{}};let n=[],s=[],i=0;for(let o of e){let a=s1(o.fromEl,"out",o.junctionPt),l=s1(o.toEl,"in",o.junctionPt);if(!a&&!l||a?.gradientStrokeId&&l?.gradientStrokeId)continue;let h,c,m,f;if(a&&l){let b=Nl(o.fromEl,a,t),x=Nl(o.toEl,l,t);h=b.x1,c=b.y1,m=x.x2,f=x.y2}else if(a){let b=Nl(o.fromEl,a,t);h=b.x1,c=b.y1,m=b.x2,f=b.y2}else{let b=Nl(o.toEl,l,t);h=b.x1,c=b.y1,m=b.x2,f=b.y2}if(t2({x1:h,y1:c,x2:m,y2:f})<1e-6)continue;let g=`sd-trans-${i++}`;n.push(r2(g,h,c,m,f,o.fromColor,o.toColor)),a&&!a.gradientStrokeId&&(a.gradientStrokeId=g,s.push(()=>{a.gradientStrokeId=void 0})),l&&!l.gradientStrokeId&&(l.gradientStrokeId=g,s.push(()=>{l.gradientStrokeId=void 0}))}return{defsXml:n.join(""),cleanup:()=>{for(let o of s)o()}}}function s1(r,e,t){let n=e==="in"?"lead1":"lead2";for(let s of r.segments)if(s instanceof p&&s.role===n)return s;return e2(r,t)}function e2(r,e){let t,n=1/0,s=.6;for(let i of r.segments){if(!(i instanceof p)||i.path.length<2||i.role==="body")continue;let o=r.transform.transform(i.path[0]),a=r.transform.transform(i.path[i.path.length-1]),l=Math.hypot(o.x-e.x,o.y-e.y),h=Math.hypot(a.x-e.x,a.y-e.y),c=Math.min(l,h);c<n&&c<s&&(n=c,t=i)}return t}function Nl(r,e,t){let n=r.transform.transform(e.path[0]),s=r.transform.transform(e.path[e.path.length-1]);return{x1:n.x*t,y1:-n.y*t,x2:s.x*t,y2:-s.y*t}}function t2(r){return Math.hypot(r.x2-r.x1,r.y2-r.y1)}function r2(r,e,t,n,s,i,o){return`<linearGradient id="${wc(r)}" gradientUnits="userSpaceOnUse" x1="${Dl(e)}" y1="${Dl(t)}" x2="${Dl(n)}" y2="${Dl(s)}"><stop offset="0%" stop-color="${wc(i)}"/><stop offset="100%" stop-color="${wc(o)}"/></linearGradient>`}function n2(r,e){let t=r;for(;t;){if(Object.prototype.hasOwnProperty.call(t,e)||Object.getOwnPropertyDescriptor(t,e)!==void 0)return!0;t=Object.getPrototypeOf(t)}return!1}var lr=class{constructor(e={}){z(this,"elements",[]);z(this,"anchors",{});z(this,"svgdefs",[]);z(this,"dwgparams",{});z(this,"_here",new A(0,0));z(this,"_theta",0);z(this,"_state",[]);z(this,"outfile");z(this,"_elementMeta",new Map);let t=f0();return this.dwgparams=oa(t,e),e.file!==void 0&&(this.outfile=e.file),s2(this)}setElementMeta(e,t){this._elementMeta.set(e,t)}getElementMeta(e){return this._elementMeta.get(e)}get here(){return At(null),this._here}set here(e){At(null),this._here=e instanceof A?e:A.fromXY(e)}get theta(){return At(null),this._theta}set theta(e){this._theta=e}get unit(){return this.dwgparams.unit??3}set unit(e){this.dwgparams.unit=e}getAnchor(e){let t=this.anchors[e];return t===void 0?void 0:new A(t[0],t[1])}enter(){Xa(this)}exit(){At(null),Ga(this)}containsElement(e){return this.elements.includes(e)}add(e){let t=e._place(this._here.toTuple(),this._theta,this.dwgparams);return this.elements.push(e),this._here=t.point,this._theta=t.theta,e}undo(){if(this.elements.pop(),this.elements.length>0){let e=this.elements[this.elements.length-1];this._here=e.absdrop.point,this._theta=e.absdrop.theta}else this._here=new A(0,0),this._theta=0}config(e){this.dwgparams=oa(this.dwgparams,e)}addElements(...e){for(let t of e)this.add(t)}container(e){return new P0(this,{...e??{}})}move(e=0,t=0){this._here=this._here.add([e,t])}moveFrom(e,t=0,n=0,s){this._here=e.add([t,n]),s!==void 0&&(this._theta=s)}push(){this._state.push([new A(this._here.x,this._here.y),this._theta])}pop(){let e=this._state.pop();e!==void 0&&(this._here=e[0],this._theta=e[1])}withHold(e){this.push();try{return e()}finally{this.pop()}}hold(){this.push();let e=this;return{close:()=>{e.pop()}}}addSvgDef(e){this.svgdefs.push(e)}setAnchor(e){this.anchors[e]=this._here.toTuple()}getSegments(){let e=[];for(let t of this.elements){let n=Mr(t.userParams,t.elmParams,t.defaults);for(let s of t.segments)e.push(s.xform(t.transform,n))}return e}async save(e){try{let{writeFileSync:t}=await import("node:fs");t(e,this.toSvgString(),"utf8")}catch(t){throw t instanceof Error&&/Cannot find module|not supported|Failed to resolve|dynamically imported module|Module not found/.test(t.message)?new Error("Drawing.save() requires Node.js. In the browser, use drawing.toSvgString() instead."):t}}getBBox(){let e=1/0,t=1/0,n=-1/0,s=-1/0;for(let i of this.elements){let o=i.getBBox(!0,!0);e=Math.min(e,o.xmin),t=Math.min(t,o.ymin),n=Math.max(n,o.xmax),s=Math.max(s,o.ymax)}return Number.isFinite(e)?He(e,t,n,s):He(0,0,0,0)}toSvgString(){let e=this.getBBox(),{defsXml:t,cleanup:n}=e1(this.elements),s="",i=()=>{};if(this.dwgparams.colorTransition){let o=this.dwgparams.inches_per_unit??.5,a=72*o,l=i1(this.elements),h=o1(this.elements,l,a);s=h.defsXml,i=h.cleanup}try{let o=[this.svgdefs.join(""),t,s].filter(h=>h.length>0),a=new g0(e,{inchesPerUnit:this.dwgparams.inches_per_unit,margin:this.dwgparams.margin,extraDefs:o.length>0?o.join(""):void 0}),l=this.dwgparams.bgcolor;l&&a.bgcolor(l);for(let h of this.elements){let c=this._elementMeta.get(h);if(this.dwgparams.interactive&&c){let m={"data-id":c.id,"data-type":c.type,class:"sd-el"};c.tooltip&&(m["data-tooltip"]=c.tooltip);let f=c.tooltip||`${c.id} \u2014 ${c.type}`;a.beginGroup(m,f)}h._draw(a),this.dwgparams.interactive&&c&&a.endGroup()}return a.toSvgString()}finally{n(),i()}}getImageData(e="svg"){if((typeof e=="string"?e.toLowerCase():String(e).toLowerCase())!=="svg")throw new Error(`@skillpet/circuit: getImageData('${e}') is not supported; only SVG bytes are available in this build.`);return new TextEncoder().encode(this.toSvgString())}};function s2(r){return new Proxy(r,{get(e,t,n){if(typeof t=="symbol")return Reflect.get(e,t,n);if(!n2(e,t)&&t in e.anchors){let s=e.anchors[t];return new A(s[0],s[1])}return Reflect.get(e,t,n)}})}function a1(r,e){let t=new lr(e??{});t.enter();try{r(t)}finally{t.exit()}return t}function vc(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}var se=class extends N{_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=T(this.params,"unit",3),i=T(this.params,"l",s),o=this.params.endpts,a=this.params.to,l=this.params.tox,h=this.params.toy,c=this.params.anchor,m=this.params.zoom??this.params.scale??1,f=typeof m=="number"?m:Array.isArray(m)?m[0]:m.x,g=A.fromXY(this.params.at!==void 0?this.params.at:e),b=this.params.theta!==void 0?this.params.theta:t;if(o!==void 0)b=ia(o[0],o[1]);else if(a!==void 0)b=ia(g,a);else if(this.params.d!==void 0){let M=String(this.params.d);if(/^-?\d+(\.\d+)?$/.test(M.replace("-","")))b=Number(M);else{let _=M.toLowerCase()[0];b={u:90,r:0,l:180,d:270}[_]??0}}if(this.elmParams.theta=b,o!==void 0&&(g=A.fromXY(o[0])),o!==void 0)i=Qs(o[0],o[1]);else if(a!==void 0)i=Qs(g,a);else if(l!==void 0){let M=typeof l=="number"?l:l[0],_=this.params.theta;if(_!==void 0){let B=g.x-M,$=Math.tan(_*Math.PI/180)*B;i=Math.hypot(B,$)}else{let B=new A(M,g.y);i=Qs(g,B),b=g.x>M?180:0,this.elmParams.theta=b}}else if(h!==void 0){let M=typeof h=="number"?h:h[1],_=this.params.theta;if(_!==void 0){let B=g.y-M,$=B/Math.tan(_*Math.PI/180);i=Math.hypot($,B)}else{let B=new A(g.x,M);i=Qs(g,B),b=g.y>M?-90:90,this.elmParams.theta=b}}let x=this.segments[0];if(!(x instanceof p))throw new Error("Element2Term requires first segment to be Segment");this.anchors.istart=x.path[0],this.anchors.iend=x.path[x.path.length-1];let v,S;if(T(this.params,"extend",!0)){let M=x.path,_=qa(M[M.length-1],M[0]),B=Math.hypot(_.x,_.y),$;try{let Y=m,Z=typeof Y=="number"?Y:Y.x;$=(i-B*Z)/2/Z}catch{$=(i-B*f)/2/f}if($>0){let Z=T(this.params,"shift",0)*$;this.elmParams._shift_magnitude=Z;let L=A.fromXY(M[0]),I=A.fromXY(M[M.length-1]);v=L.sub([$+Z,0]),S=I.add([$-Z,0]),this._localshift=v.neg();let X={color:x.color,lw:x.lw,ls:x.ls,capstyle:x.capstyle,joinstyle:x.joinstyle,fill:x.fill,zorder:x.zorder},j=new p([[v.x,v.y],[L.x,L.y]],{...X});j.role="lead1";let re=M.map(de=>[de[0],de[1]]),te=new p(re,{...X});te.role="body";let ke=new p([[I.x,I.y],[S.x,S.y]],{...X});ke.role="lead2";let he=this.params.leadcolor;B>0&&he&&(j.color=he,ke.color=he);let ve=this.segments.indexOf(x);this.segments.splice(ve,1,j,te,ke)}else v=A.fromXY(M[0]),S=A.fromXY(M[M.length-1]),this._localshift=new A(0,0)}else v=A.fromXY(x.path[0]),S=A.fromXY(x.path[x.path.length-1]);let k=T(this.params,"dotradius",.075);if(this.params.dot){let _=this.params.dot==="open"?"bg":!0;this.segments.push(new D([S.x,S.y],k,{fill:_,zorder:3}))}if(this.params.idot){let _=this.params.idot==="open"?"bg":!0;this.segments.push(new D([v.x,v.y],k,{fill:_,zorder:3}))}if(this.placeAnchors(v,S),c!==void 0){let M=this.anchors[c];if(M===void 0)throw new Error(`Unknown anchor ${c}`);let _=M instanceof A?M.x:M[0],B=M instanceof A?M.y:M[1];this._localshift=this._localshift.sub([_,B])}return this.elmParams.drop=[S.x,S.y],super._place(e,t,n)}placeAnchors(e,t){this.anchors.start=[e.x,e.y],this.anchors.end=[t.x,t.y],this.anchors.center=[(e.x+t.x)/2,(e.y+t.y)/2]}to(e,t=0,n=0){let s=A.fromXY(vc(e));return this.userParams.to=[s.x+t,s.y+n],this}tox(e){return this.userParams.tox=e,this}toy(e){return this.userParams.toy=e,this}length(e){return this.userParams.l=e,this}endpoints(e,t){return this.userParams.endpts=[vc(e),vc(t)],this}dot(e=!1){return this.userParams.dot=e?"open":!0,this}idot(e=!1){return this.userParams.idot=e?"open":!0,this}shift(e){return this.userParams.shift=e,this}up(e){return this.userParams.d="up",e!==void 0&&(this.userParams.l=e),this}down(e){return this.userParams.d="down",e!==void 0&&(this.userParams.l=e),this}left(e){return this.userParams.d="left",e!==void 0&&(this.userParams.l=e),this}right(e){return this.userParams.d="right",e!==void 0&&(this.userParams.l=e),this}};var Ol=class extends N{constructor(t,n={}){super(n);z(this,"drawing");this.drawing=t,this.segments=t.getSegments();for(let[i,o]of Object.entries(t.anchors))this.anchors[i]=[o[0],o[1]];let s=t.here;this.elmParams.drop=[s.x,s.y],this.elmParams.d="right"}};var rn=1,Pn=.65,yc=.12,Bt=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{leadin:.35,leadout:.35});let t=e.inputs??2,n=e.nand??!1,s=T(this.params,"leadin",.35),i=T(this.params,"leadout",.35),o=rn/2,a=ze(-Math.PI/2,Math.PI/2,50),l=a.map(b=>o*Math.cos(b)+Pn+s),h=a.map(b=>o*Math.sin(b)),c=l.map((b,x)=>[b,h[x]]);c.push([Pn+s,o],[s,o],[s,0],[s,-o],[Pn+s,-o]),this.segments.push(new p(c)),this.anchors.out=[Pn+rn/2+s+i,0],this.anchors.end=this.anchors.out,n&&this.segments.push(new D([s+Pn+rn/2+yc,0],yc));let m;t===2?m=rn*.5:t===3?m=rn*.33:m=rn*.4;for(let b=0;b<t;b++){let x=(b+1-(t/2+.5))*m,v=t-b;this.anchors[`in${v}`]=[0,x],this.segments.push(new p([[0,x],[s,x]]))}let f=n?Pn+rn/2+s+yc*2:Pn+rn/2+s;this.segments.push(new p([[f,0],[Pn+rn/2+s+i,0]]));let g=this.segments[this.segments.length-1];if(g instanceof p){let b=g.path[g.path.length-1];this.elmParams.drop=[b[0],b[1]]}}};function Tn(r){return new Bt({...r,nand:!0})}var Sc=1,i2=.65,kc=.12,o2=.5,l1=.15,$t=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{leadin:.35,leadout:.35});let t=e.inputs??2,n=e.nor??!1,s=e.xor??!1,i=T(this.params,"leadin",.35),o=T(this.params,"leadout",.35),a=i-(s?l1:0),l=ze(0,i2+.05,50),h=l.map(L=>L*L),c=Math.max(...h);h=h.map(L=>L-c),h=[Math.min(...h),...h];let m=[0,...l.map(L=>L+o2)],f=Math.min(...h),g=ze(f,-f,50),b=g.map(L=>-L*L),x=Math.min(...b);b=b.map(L=>L-x);let v=m.map(L=>L+i),S=b.map(L=>L+i),k=Math.max(...v),M=Math.abs(f),_=h.map(L=>-L),B=[...v.map((L,I)=>[L,h[I]]),...[...v].reverse().map((L,I)=>{let X=_.length-1-I;return[L,_[X]]}),...[...S].reverse().map((L,I)=>[L,g[g.length-1-I]])];if(this.segments.push(new p(B)),this.anchors.out=[k+o,0],this.anchors.end=this.anchors.out,s){let L=S.map(I=>I-l1);this.segments.push(new p(L.map((I,X)=>[I,g[X]])))}n&&this.segments.push(new D([k+kc,0],kc));let $,Y=0;t===2?$=Sc*.5:t===3?$=Sc*.33:($=Sc*.4,Y=$*(t-1));for(let L=0;L<t;L++){let I=(L+1-(t/2+.5))*$,X=a-I*I-x;t>3&&(I>M||I<-M)&&(X=a);let j=t-L;this.anchors[`in${j}`]=[0,I],this.segments.push(new p([[0,I],[X,I]]))}t>3&&(this.segments.push(new p([[a,Y/2+$/2],[a,M]])),this.segments.push(new p([[a,-Y/2-$/2],[a,-M]]))),n?this.segments.push(new p([[k+kc*2,0],[k+o,0]])):this.segments.push(new p([[k,0],[k+o,0]]));let Z=this.segments[this.segments.length-1];if(Z instanceof p){let L=Z.path[Z.path.length-1];this.elmParams.drop=[L[0],L[1]]}}};function Rn(r){return new $t({...r,nor:!0})}function An(r){return new $t({...r,xor:!0})}function _n(r){return new $t({...r,nor:!0,xor:!0})}var T0=1,r0=.65,Fl=.12,Jt=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[r0,0]])),this.segments.push(new p([[0,T0/2],[r0,0],[0,-T0/2],[0,T0/2]])),this.anchors.out=[r0,0],this.anchors.in1=[0,0]}},Kt=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[r0+Fl*2,0]])),this.segments.push(new p([[0,T0/2],[r0,0],[0,-T0/2],[0,T0/2]])),this.segments.push(new D([r0+Fl,0],Fl)),this.anchors.out=[r0+Fl*2,0],this.anchors.in1=[0,0]}};var Mc=1,hr=.65,R0=.12,Bn=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{outputnot:!0,control:!1});let t=T(this.params,"outputnot",!0),n=T(this.params,"control",!1);t?(this.segments.push(new p([[0,0],H,[hr+R0*2,0]])),this.segments.push(new D([hr+R0,0],R0))):this.segments.push(new p([[0,0],H,[hr,0]])),this.segments.push(new p([[0,Mc/2],[hr,0],[0,-Mc/2],[0,Mc/2]])),n?(this.segments.push(new D([hr/2,.42],R0)),this.segments.push(new p([[hr/2,.42+R0],[hr/2,.7]]))):this.segments.push(new p([[hr/2,.28],[hr/2,.7]])),this.anchors.out=[hr+R0*2,0],this.anchors.in1=[0,0],this.anchors.c=[hr/2,.7]}};var A0=class extends N{constructor(e={}){let{names:t,truthtable:n,groups:s,default:i,...o}=e;super(o);let a=t??"ABCD",l=n??[],h=s??{},c=i??"0",m=o.lw??1.25,f,g;if(a.length===4)f=4,g=4;else if(a.length===3)f=2,g=4;else if(a.length===2)f=2,g=2;else throw new Error("Kmap requires 2 to 4 variable names");let b=1,x=g*b,v=f*b,S=[0,1,3,2],k={lw:m};this.segments.push(new p([[0,0],[x,0],[x,v],[0,v],[0,0]],k));for(let j=0;j<f;j++)this.segments.push(new p([[0,j*b],[x,j*b]],k));for(let j=0;j<g;j++)this.segments.push(new p([[j*b,0],[j*b,v]],k));let M=b/Math.SQRT2;this.segments.push(new p([[0,v],[-M,v+M]],k));let _=f>2?2:1,B=g>2?2:1,$=a.length>2?a.slice(0,2):a[0],Y=a.length>2?a.slice(2):a[1];this.segments.push(new W([0,v+3*M/4],$,{align:["right","bottom"],fontsize:12})),this.segments.push(new W([-(3*M)/4,v],Y,{align:["right","bottom"],fontsize:12}));for(let j=0;j<g;j++){let re=S[j];this.segments.push(new W([re*b+b/2,v+b/20],$l(j,B),{align:["center","bottom"],fontsize:10}))}for(let j=0;j<f;j++){let re=S[j];this.segments.push(new W([-b/10,v-re*b-b/2],$l(j,_),{align:["right","center"],fontsize:10}))}let Z=l.map(j=>j[0]),L=l.map(j=>j[1]);for(let j=0;j<g;j++){let re=S[j];for(let te=0;te<f;te++){let ke=S[te],he=$l(j,B)+$l(te,_),ve=Z.indexOf(he),de=ve===-1?c:String(L[ve]);this.segments.push(new W([re*b+b/2,v-ke*b-b/2],de,{align:["center","center"],fontsize:12})),this.anchors[`cell${he}`]=[re*b+b/2,v-ke*b-b/2]}}let I=.1,X={0:0,1:1,".":0,"..":0,"00":0,"01":1,10:3,11:2,".0":3,".1":1,"0.":0,"1.":2};for(let[j,re]of Object.entries(h)){let te=$.length,ke=Y.length,he=j.slice(0,te),ve=j.slice(te),de=Math.pow(2,te-h1(he)),Fe=Math.pow(2,ke-h1(ve)),qe=X[he]??0,Ie=X[ve]??0,ge=qe*b,Me=ge+de*b,be=v-Ie*b,Be=be-Fe*b,De=[];qe+de<=g&&Ie+Fe<=f?De=[[[ge+I,be-I],[Me-I,be-I],[Me-I,Be+I],[ge+I,Be+I]]]:Ie+Fe<=f?De=[[[ge+I,be-I],[ge+b+I,be-I],[ge+b+I,Be+I],[ge+I,Be+I]],[[-I,be-I],[b-I,be-I],[b-I,Be+I],[-I,Be+I]]]:qe+de<=g?De=[[[ge+I,be-I],[Me-I,be-I],[Me-I,be-b-I],[ge+I,be-b-I]],[[ge+I,v+I],[Me-I,v+I],[Me-I,v-b+I],[ge+I,v-b+I]]]:De=[[[ge+I,be-I],[ge+b+I,be-I],[ge+b+I,be-b-I],[ge+I,be-b-I]],[[-I,be-I],[b-I,be-I],[b-I,be-b-I],[-I,be-b-I]],[[-I,v+I],[b-I,v+I],[b-I,v-b+I],[-I,v-b+I]],[[ge+I,v+I],[ge+b+I,v+I],[ge+b+I,v-b+I],[ge+I,v-b+I]]];let ye=re.lw??1;for(let _e of De)this.segments.push(new U(_e,{cornerradius:.25,color:re.color,fill:re.fill,lw:ye,ls:re.ls}))}}};function $l(r,e){return r.toString(2).padStart(e,"0")}function h1(r){let e=0;for(let t of r)(t==="0"||t==="1")&&e++;return e}function c1(r){return r.replace(/[2-9]|=|x/g,"V").replace(/u/g,"1").replace(/d/g,"0").replace(/[nN]/g,"1").replace(/[pP]/g,"0").replace(/[lL]/g,"0").replace(/[hH]/g,"1")}function u1(r){let e=[];for(let t of r)typeof t!="string"&&(Array.isArray(t)?e.push(...u1(t)):typeof t=="object"&&t!==null&&e.push(t));return e}function Ac(r){let e=ze(0,1,10),t=e.map(n=>r*Math.exp(-n*6));return{xs:e,ys:t}}var zc=class{constructor(e,t,n,s=.1,i=.2){z(this,"y0");z(this,"height");z(this,"curve1x");z(this,"curve2x");z(this,"extend");z(this,"rate",25);this.y0=t,this.extend=s,this.height=n-t,this.curve1x=e-i*this.height/2,this.curve2x=e+i*this.height/2}curve(e){let t=this.height*(1+this.extend*2),n=this.height*this.extend,s=ze(-.15,.15),i=s.map(a=>1/(1+Math.exp(-a*this.rate))*t-n),o=e==="left"?this.curve1x:this.curve2x;return{xs:s.map(a=>a+o),ys:i.map(a=>a+this.y0)}}};function a2(r,e,t){let n=new zc(r,e,t),s=n.curve("left"),i=n.curve("right"),o=s.xs.map((l,h)=>[l,s.ys[h]]),a=i.xs.map((l,h)=>[l,i.ys[h]]);return[new p(o,{lw:1,zorder:3}),new p(a,{lw:1,zorder:3}),new U([...o,...[...a].reverse()],{zorder:3,color:"none",fill:"white",lw:1,closed:!1})]}var nn=class{constructor(e){z(this,"params");z(this,"x0");z(this,"xend");z(this,"y0");z(this,"y1");z(this,"y1_prev");z(this,"pstate");z(this,"nstate");z(this,"plevel");z(this,"rise");z(this,"xrise");z(this,"xrisehalf");z(this,"yhalf");z(this,"xcenter");z(this,"xtext");z(this,"kwargs");this.params=e,this.x0=e.x0,this.xend=e.xend,this.y0=e.y0,this.y1=e.y1,this.y1_prev=e.y1_prev,this.pstate=e.pstate,this.nstate=e.nstate,this.plevel=e.plevel,this.rise=e.rise,this.xrise=this.x0+this.rise,this.xrisehalf=this.x0+this.rise/2,this.yhalf=(this.y0+this.y1)/2,this.xcenter=(this.x0+this.xend)/2,this.xtext=this.xcenter+this.rise/2,this.kwargs=e.kwargs}vertsIn(){return{"-":[[this.x0,this.y0]],"|":[[this.x0,this.y0]],0:[[this.x0,this.y0],[this.xrisehalf,this.yhalf],[this.xrise,this.y0]],1:[[this.x0,this.y1],[this.xrise,this.y0]],z:[[this.x0,this.yhalf],[this.xrisehalf,this.y0]],V:[[this.xrise,this.y0]]}[this.plevel]??[]}vertsOut(){return[[this.xend,this.y0]]}segments(){let e=[...this.vertsIn(),...this.vertsOut()];return[new p(e,this.kwargs)]}},jl=class extends nn{vertsIn(){return"pP".includes(this.params.pstate)?[[this.x0,this.y0]]:[[this.x0,this.y1],[this.x0,this.y0]]}segments(){let e=super.segments();return this.params.state==="L"&&e.push(new p([[this.x0,this.yhalf+.25/2],[this.x0,this.yhalf-.25/2]],{arrow:"->",arrowwidth:.12,arrowlength:.25})),e}},ka=class extends nn{vertsIn(){return{"-":[[this.x0,this.y1]],h:[[this.x0,this.y1]],H:[[this.x0,this.y1]],l:[[this.x0,this.y1]],L:[[this.x0,this.y1]],0:[[this.x0,this.y0],[this.xrise,this.y1]],1:this.y1_prev!==this.y1?[[this.x0,this.y1_prev],[this.xrise,this.y1]]:[[this.x0,this.y1],[this.xrisehalf,this.yhalf],[this.xrise,this.y1]],z:[[this.x0,this.yhalf],[this.xrisehalf,this.y1]],V:[[this.xrise,this.y1]]}[this.plevel]??[]}vertsOut(){return[[this.xend,this.y1]]}},ql=class extends ka{vertsIn(){return"nN".includes(this.params.pstate)?[[this.x0,this.y1]]:[[this.x0,this.y0],[this.x0,this.y1]]}segments(){let e=super.segments();return this.params.state==="H"&&e.push(new p([[this.x0,this.yhalf-.25/2],[this.x0,this.yhalf+.25/2]],{arrow:"->",arrowwidth:.12,arrowlength:.25})),e}},Ec=class extends nn{vertsIn(){let{xs:e,ys:t}=Ac((this.y1-this.y0)/2),n=t.map(a=>this.yhalf+a),s=t.map(a=>this.yhalf-a),i=e.map(a=>this.x0+a*this.rise*6);return{"-":[[this.x0,this.yhalf]],0:i.map((a,l)=>[a,s[l]]),1:i.map((a,l)=>[a,n[l]]),z:[[this.x0,this.yhalf]],V:[[this.xrise+this.rise,this.yhalf]]}[this.plevel]??[]}vertsOut(){return[[this.xend,this.yhalf]]}},Pc=class extends nn{vertsIn(){return{"-":[[this.x0,this.y1],[this.x0,this.y0]],"|":[[this.x0,this.y1],[this.x0,this.y0]],0:[[this.xrise,this.y1],[this.x0,this.y0]],1:[[this.x0,this.y1],[this.xrise,this.y0]],z:[[this.xrise,this.y1],[this.xrisehalf,this.yhalf],[this.xrise,this.y0]],V:[[this.xrise,this.y1],[this.xrisehalf,this.yhalf],[this.xrise,this.y0]]}[this.plevel]??[]}vertsOut(){let e="=23456789x".includes(this.nstate)?"V":this.nstate;return{0:[[this.xend+this.rise,this.y0],[this.xend,this.y1]],L:[[this.xend,this.y0],[this.xend,this.y1]],l:[[this.xend,this.y0],[this.xend,this.y1]],1:[[this.xend,this.y0],[this.xend+this.rise,this.y1]],H:[[this.xend,this.y0],[this.xend,this.y1]],h:[[this.xend,this.y0],[this.xend,this.y1]],z:[[this.xend,this.y0],[this.xend,this.y1]],V:[[this.xend,this.y0],[this.xend+this.rise/2,this.yhalf],[this.xend,this.y1]],"-":[[this.xend,this.y0],[this.xend,this.y1]],n:[[this.xend,this.y0],[this.xend,this.y1]],p:[[this.xend,this.y0],[this.xend,this.y1]],N:[[this.xend,this.y0],[this.xend,this.y1]],P:[[this.xend,this.y0],[this.xend,this.y1]]}[e]??[]}fillOpts(){return{fill:{3:"#feffc2",4:"#ffe2ba",5:"#abd9ff",6:"#bdfbff",7:"#bdffcb",8:"#e3a5fa",9:"#f7b7bd"}[this.params.state],hatch:this.params.state==="x"}}segments(){let{fill:e,hatch:t}=this.fillOpts(),n=[],s="-|".includes(this.pstate),i="-|".includes(this.nstate);return s&&i?(n.push(new p([[this.x0,this.y0],[this.xend,this.y0]],this.kwargs)),n.push(new p([[this.x0,this.y1],[this.xend,this.y1]],this.kwargs)),n.push(new U([[this.x0,this.y0],[this.xend,this.y0],[this.xend,this.y1],[this.x0,this.y1]],{color:"none",fill:e,hatch:t}))):s?n.push(new U([[this.x0,this.y0],...this.vertsOut(),[this.x0,this.y1]],{closed:!1,fill:e,hatch:t,...this.kwargs})):i?n.push(new U([[this.xend,this.y1],...this.vertsIn(),[this.xend,this.y0]],{closed:!1,fill:e,hatch:t,...this.kwargs})):n.push(new U([...this.vertsIn(),...this.vertsOut()],{fill:e,hatch:t,...this.kwargs})),this.params.data.length>0&&this.params.state!=="x"&&(n.push(new W([this.xtext,this.yhalf],this.params.data[0],{color:this.params.datacolor,fontsize:11,align:["center","center"]})),this.params.data.shift()),n}},Tc=class extends ka{vertsIn(){let{xs:e,ys:t}=Ac(this.y1-this.y0),n=e.map(a=>this.x0+a*this.rise*6),s=t.map(a=>this.y1-a),i=t.map(a=>this.y1-a/2);return{"-":[[this.x0,this.y1]],0:n.map((a,l)=>[a,s[l]]),1:[[this.x0,this.y1]],z:n.map((a,l)=>[a,i[l]]),V:[[this.xrise,this.y1]]}[this.plevel]??[]}segments(){let e=this.vertsIn();return[new p(e,this.kwargs),new p([e[e.length-1],[this.xend,this.y1]],{...this.kwargs,ls:":"})]}},Rc=class extends nn{vertsIn(){let{xs:e,ys:t}=Ac(this.y1-this.y0),n=e.map(a=>this.x0+a*this.rise*6),s=t.map(a=>this.y0+a),i=t.map(a=>this.y0+a/2);return{"-":[[this.x0,this.y0]],0:[[this.x0,this.y0]],1:n.map((a,l)=>[a,s[l]]),z:n.map((a,l)=>[a,i[l]]),V:[[this.x0,this.y0]]}[this.plevel]??[]}segments(){let e=this.vertsIn();return[new p(e,this.kwargs),new p([e[e.length-1],[this.xend,this.y0]],{...this.kwargs,ls:":"})]}},_0=class extends nn{vertsIn(){let e=this.params.state,t=this.params.period,n=this.y1,s=this.y0;"nN".includes(e)&&([n,s]=[s,n]);let i=[];for(let o=0;o<this.params.periods;o++)i.push([this.x0+t*o,s],[this.x0+t*o,n],[this.x0+t*o+t/2,n],[this.x0+t*o+t/2,s]);return"nN".includes(e)&&"lL".includes(this.params.pstate)||"pP".includes(e)&&"hH".includes(this.params.pstate)?i.slice(1):i}vertsOut(){let e="nN".includes(this.params.state)?this.y1:this.y0;return[[this.xend,e]]}segments(){let e=super.segments();if("NP".includes(this.params.state)){let t=this.params.period,n=.25,s=.12,i=this.yhalf-n/2,o=this.yhalf+n/2;this.params.state==="P"&&([i,o]=[o,i]);for(let a=0;a<this.params.periods;a++){let l=this.x0+t*a;e.push(new p([[l,o],[l,i]],{arrow:"->",arrowwidth:s,arrowlength:n,...this.kwargs}))}}return e}},l2={0:nn,1:ka,H:ql,h:ql,L:jl,l:jl,z:Ec,u:Tc,d:Rc,n:_0,p:_0,N:_0,P:_0},n0=class extends N{constructor(t,n={}){super(n);z(this,"waveData");z(this,"yheight");z(this,"ygap");z(this,"risetime");z(this,"_fontSize");z(this,"namecolor");z(this,"datacolor");z(this,"gridcolor");z(this,"tickcolor");z(this,"edgecolor");z(this,"hscale");z(this,"showGrid");this.waveData=t,this.yheight=n.yheight??.5,this.ygap=n.ygap??.3,this.risetime=n.risetime??.15,this._fontSize=n.fontsize??12,this.namecolor=n.namecolor??"blue",this.datacolor=n.datacolor,this.gridcolor=n.gridcolor??"#DDDDDD",this.tickcolor=n.tickcolor??"#888888",this.edgecolor=n.edgecolor??"blue",this.showGrid=n.grid??!0;let s=this.waveData.signal??[],i=u1(s),o=this.waveData.config??{};this.hscale=o.hscale??1;let a=this.waveData.head??{},l=this.waveData.foot??{},h=(this.yheight+this.ygap)*i.length,c=0;for(let g of i)c=Math.max(c,(g.wave??"").length);this.showGrid&&this._drawGrid(c,h);let m=He(0,this.yheight+.05,c*this.yheight*2*this.hscale,-h),f=0;for(let g of i)this._drawName(g.name??"",f),this._drawWave(g,f,m),f-=this.yheight+this.ygap;this._drawEdges(i),this._drawHeadFoot(a,l,c,f),this.anchors.topleft=[0,0]}_drawGrid(t,n){for(let s=0;s<=t;s++){let i=s*2*this.yheight*this.hscale;this.segments.push(new p([[i,this.yheight+this.ygap/2],[i,this.yheight-n]],{ls:":",lw:1,color:this.gridcolor,zorder:0}))}}_drawName(t,n){if(!t)return;let s=.2;this.segments.push(new W([-s,n],t,{align:["right","bottom"],fontsize:this._fontSize,color:this.namecolor}))}_drawWave(t,n,s){let i=t.wave??"";if(!i)return;let o=t.phase??0,a=t.level??"0",l=t.risetime??this.risetime,h={color:t.color??void 0,lw:t.lw??1,clip:s},c=t.data?Array.isArray(t.data)?[...t.data]:t.data.split(" "):[];a.length===1?a=a.repeat(i.length):a.length<i.length&&(a+=a[a.length-1].repeat(i.length-a.length));let m=2*this.yheight*(t.period??1)*this.hscale,f=this.yheight,g=0,b="-",x=n+f,v=-m*o;for(;g<i.length;){let S=i[g],k=[],M=1,_=parseInt(a[g],10);!isNaN(_)&&_>0&&(f=_/10*this.yheight),f===0&&(f=this.yheight);let B=g+1;for(;B<i.length&&(i[B]==="|"||i[B]===".");)i[B]==="|"&&k.push(M),M++,B++;let $=B<i.length?i[B]:"-",Y=n+f,Z=v+M*m,L={state:S,pstate:b,nstate:$,plevel:c1(b),nlevel:c1($),periods:M,period:m,x0:v,xend:Z,y0:n,y1:Y,y1_prev:x,rise:l,data:c,datacolor:this.datacolor,kwargs:h},I=l2[S]??Pc;this.segments.push(...new I(L).segments());for(let X of k)this.segments.push(...a2(v+(X+1)*m-m/2,n,Y));b=S,x=Y,v+=M*m,g=B}}_drawEdges(t){let n=this.waveData.edge??[];if(n.length===0)return;let s=2*this.yheight*this.hscale;for(let i of n){let o="";if(i.includes(" ")){let m=i.indexOf(" ");o=i.slice(m+1),i=i.slice(0,m)}let a=i.match(/\{(.*?)\}/),l=this.edgecolor;a&&(l=a[1].split(",")[0]||l,i=i.replace(/\{.*?\}/,""));let h;i.includes("<")&&i.includes(">")?h="<>":i.includes("<")?h="<":i.includes(">")&&(h=">");let c=i.match(/\[(.+?)\]/g);if(c&&c.length===2){let m=[];for(let f of c){let g=f.slice(1,-1),b=g.indexOf(":"),x=g.slice(0,b),v=g.slice(b+1),S=parseInt(x.replace(/[^0-9]/g,""),10),k=parseFloat(v),M=this.yheight/2;x.includes("^")?M=this.yheight+.2:x.includes("v")&&(M=-.2);let _=t[S]?.phase??0,B=k*s-s*_,$=-S*(this.yheight+this.ygap)+M;m.push([B,$])}if(m.length===2&&(this.segments.push(new p(m,{lw:1,color:l,arrow:h,zorder:3})),o)){let f=(m[0][0]+m[1][0])/2,g=(m[0][1]+m[1][1])/2;this.segments.push(new W([f,g],o,{fontsize:8,color:l,align:["center","center"],zorder:4}))}}else if(i.length>=3){let m=i[0],f=i[i.length-1],g=this.anchors[`node_${m}`],b=this.anchors[`node_${f}`];if(g&&b){let x=k=>k instanceof A?[k.x,k.y]:[k[0],k[1]],v=x(g),S=x(b);if(this.segments.push(new p([v,S],{lw:1,color:l,arrow:h,zorder:3})),o){let k=(v[0]+S[0])/2,M=(v[1]+S[1])/2;this.segments.push(new W([k,M],o,{fontsize:8,color:l,align:["center","center"],zorder:4}))}}}}}_drawHeadFoot(t,n,s,i){if(t.tick!==void 0||t.tock!==void 0){let o=t.tick??t.tock??0,a=t.every??1,l=t.tick!==void 0?0:this.hscale/2;for(let h=0;h<s;h+=a){let c=(l+h*this.hscale)*2*this.yheight;this.segments.push(new W([c,this.yheight+this.ygap],String(o+h),{color:this.tickcolor,fontsize:this._fontSize,align:["center","bottom"]}))}}if(n.tick!==void 0||n.tock!==void 0){let o=n.tick??n.tock??0,a=n.every??1,l=n.tick!==void 0?0:this.hscale/2;for(let h=0;h<s;h+=a){let c=(l+h*this.hscale)*2*this.yheight;this.segments.push(new W([c,i+this.yheight],String(o+h),{color:this.tickcolor,fontsize:this._fontSize,align:["center","top"]}))}}}};var _c=2/72*(3/4),h2={1:"#dadada",2:"#f2dbdc",3:"#ecf2da",4:"#e2f2ee",5:"#f2eddb",6:"#e2f2db",7:"#dee5f2",8:"#f2d6ff",9:"#feffdb"};function Hl(r){return r===!0||r===1||r==="true"||r==="True"}var s0=class extends N{constructor(e,t={}){super(t),this.defaults={bitheight:.625,width:15,fontsize:12,lw:1,ygap:null,vflip:!1,hflip:!1,compact:!1},this.anchors.origin=[0,0];let n=e.reg??[],s=e.config??{},i=s.fontsize??this.params.fontsize??12,o=Hl(s.hflip??this.params.hflip),a=Hl(s.vflip??this.params.vflip),l=Hl(s.compact??this.params.compact),h=n.reduce((X,j)=>X+(j.bits??0),0),c=this.params.lblofst??.1,m;s.vspace!==void 0?m=(s.vspace??30)*_c:m=this.params.bitheight??.625;let f;s.hspace!==void 0?f=(s.hspace??800)*_c:f=this.params.width??15;let g=s.lanes??1,b=this.params.ygap;if(b==null){b=0;for(let X of n){let j=X.attr??[];(typeof j=="number"||typeof j=="string")&&(j=[j]);let re=(j.length+1.5)*_c*1.5*i;b=Math.max(b,re)}}let x;s.bits!==void 0?(h=s.bits,x=h/g):g>1?(h%2!==0&&(h+=1),x=s.bits??h/g):x=h;let v=null,S=null,k=s.label;if(k){if(k.left!==void 0)if(typeof k.left=="number")v=Array.from({length:g},(X,j)=>String(j+k.left));else if(typeof k.left=="string")v=Array(g).fill(k.left);else{let X=k.left,j=X.length;v=[...X,...Array.from({length:g-j},(re,te)=>String(te+j))]}if(k.right!==void 0)if(typeof k.right=="number")S=Array.from({length:g},(X,j)=>String(j+k.right));else if(typeof k.right=="string")S=Array(g).fill(k.right);else{let X=k.right,j=X.length;S=[...X,...Array.from({length:g-j},(re,te)=>String(te+j))]}}let M=f/x,_=m,B=0,$=_/8,Y=0,Z=a?-1:1,L=0,I=this.params.lw??1;for(let X=0;X<g;X++){v&&this.segments.push(new W([-c,L+_/2],v[X],{fontsize:i,align:["right","center"]})),S&&this.segments.push(new W([f+c,L+_/2],S[X],{fontsize:i,align:["left","center"]}));let j=a?0:f,re=L+_/2,te=0;for(;te<x&&Y<n.length;){let he=n[Y],ve=he.bits??1,de=B||ve,Fe=he.attr,qe=he.rotate??0,Ie=he.name??"",ge=he.type,Me=he.scale??1,be=Hl(he.number??!0);if(de+te>x){let ye=x-te;B=de-ye,de=ye}else B=0;let Be=j-Z*de*M/2*Me,De=j;if(j-=de*M*Z*Me,this.segments.push(new U([[j,L+_],[j,L],[De,L],[De,L+_]],{lw:I})),ge!==void 0||!Ie){let ye;ge==null||String(ge).length===1?ye=h2[String(ge)]??"#dadada":ye=String(ge),this.segments.push(new U([[j,L+_],[j,L],[De,L],[De,L+_]],{lw:0,color:"none",fill:ye,zorder:0}))}for(let ye=0;ye<de-1;ye++){let _e=j+(ye+1)*Z*M*Me;this.segments.push(new p([[_e,L+_],[_e,L+_-$]],{lw:I})),this.segments.push(new p([[_e,L],[_e,L+$]],{lw:I}))}if(Ie){this.segments.push(new W([Be,re],Ie,{fontsize:i,align:["center","center"],rotation:-qe}));let ye=Ie.replace(/[^a-zA-Z0-9_]/g,"_");this.anchors[`field_${ye}`]=[Be,re]}if(be&&(o&&X===0||!o&&X===g-1||!l))if(de>1){let ye=X*x+te,_e=X*x+te+de-1,Ae=ye<100&&M/2*Me>.22,Ze=_e<100&&M/2*Me>.22,bn=Ae?Z*M/2*Me:.12;this.segments.push(new W([De-bn,L+_+c],String(ye),{fontsize:i,align:[Ae?"center":"right","bottom"]}));let ft=Ze?Z*M/2*Me:.12;this.segments.push(new W([j+ft,L+_+c],String(_e),{fontsize:i,align:[Ze?"center":"left","bottom"]}))}else this.segments.push(new W([Be,L+_+c],String(X*x+te+de-1),{fontsize:i,align:["center","bottom"]}));if(Fe!=null){let ye;if(typeof Fe=="string"||typeof Fe=="number"?ye=[Fe]:ye=Fe,typeof ye[0]=="string"){let _e=ye.join(`
263
+ ?)[ \r ]*`,Vh="[\u0300-\u036F]",Op=new RegExp(Vh+"+$"),Fp="("+Nm+"+)|"+(Np+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(Vh+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(Vh+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Dp)+("|"+Lp+")"),bl=class{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(Fp,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Nt("EOF",new _t(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new J("Unexpected character: '"+e[t]+"'",new Nt(e[t],new _t(this,t,t+1)));var s=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(`
264
+ `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Nt(s,new _t(this,t,this.tokenRegex.lastIndex))}},Uh=class{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new J("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var s=0;s<this.undefStack.length;s++)delete this.undefStack[s][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}},$p=Em;y("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});y("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}});y("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}});y("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}});y("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});y("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");y("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});Hu={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};y("\\char",function(r){var e=r.popToken(),t,n=0;if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new J("\\char` missing argument");n=e.text.charCodeAt(0)}else t=10;if(t){if(n=Hu[e.text],n==null||n>=t)throw new J("Invalid base-"+t+" digit "+e.text);for(var s;(s=Hu[r.future().text])!=null&&s<t;)n*=t,n+=s,r.popToken()}return"\\@char{"+n+"}"});lc=(r,e,t,n)=>{var s=r.consumeArg().tokens;if(s.length!==1)throw new J("\\newcommand's first argument must be a macro name");var i=s[0].text,o=r.isDefined(i);if(o&&!e)throw new J("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!t)throw new J("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(s=r.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var l="",h=r.expandNextToken();h.text!=="]"&&h.text!=="EOF";)l+=h.text,h=r.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new J("Invalid number of arguments: "+l);a=parseInt(l),s=r.consumeArg().tokens}return o&&n||r.macros.set(i,{tokens:s,numArgs:a}),""};y("\\newcommand",r=>lc(r,!1,!0,!1));y("\\renewcommand",r=>lc(r,!0,!1,!1));y("\\providecommand",r=>lc(r,!0,!0,!0));y("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});y("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});y("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),vn[t],Ge.math[t],Ge.text[t]),""});y("\\bgroup","{");y("\\egroup","}");y("~","\\nobreakspace");y("\\lq","`");y("\\rq","'");y("\\aa","\\r a");y("\\AA","\\r A");y("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");y("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");y("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");y("\u212C","\\mathscr{B}");y("\u2130","\\mathscr{E}");y("\u2131","\\mathscr{F}");y("\u210B","\\mathscr{H}");y("\u2110","\\mathscr{I}");y("\u2112","\\mathscr{L}");y("\u2133","\\mathscr{M}");y("\u211B","\\mathscr{R}");y("\u212D","\\mathfrak{C}");y("\u210C","\\mathfrak{H}");y("\u2128","\\mathfrak{Z}");y("\\Bbbk","\\Bbb{k}");y("\\llap","\\mathllap{\\textrm{#1}}");y("\\rlap","\\mathrlap{\\textrm{#1}}");y("\\clap","\\mathclap{\\textrm{#1}}");y("\\mathstrut","\\vphantom{(}");y("\\underbar","\\underline{\\text{#1}}");y("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');y("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");y("\\ne","\\neq");y("\u2260","\\neq");y("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");y("\u2209","\\notin");y("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");y("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");y("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");y("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");y("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");y("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");y("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");y("\u27C2","\\perp");y("\u203C","\\mathclose{!\\mkern-0.8mu!}");y("\u220C","\\notni");y("\u231C","\\ulcorner");y("\u231D","\\urcorner");y("\u231E","\\llcorner");y("\u231F","\\lrcorner");y("\xA9","\\copyright");y("\xAE","\\textregistered");y("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');y("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');y("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');y("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');y("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");y("\u22EE","\\vdots");y("\\varGamma","\\mathit{\\Gamma}");y("\\varDelta","\\mathit{\\Delta}");y("\\varTheta","\\mathit{\\Theta}");y("\\varLambda","\\mathit{\\Lambda}");y("\\varXi","\\mathit{\\Xi}");y("\\varPi","\\mathit{\\Pi}");y("\\varSigma","\\mathit{\\Sigma}");y("\\varUpsilon","\\mathit{\\Upsilon}");y("\\varPhi","\\mathit{\\Phi}");y("\\varPsi","\\mathit{\\Psi}");y("\\varOmega","\\mathit{\\Omega}");y("\\substack","\\begin{subarray}{c}#1\\end{subarray}");y("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");y("\\boxed","\\fbox{$\\displaystyle{#1}$}");y("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");y("\\implies","\\DOTSB\\;\\Longrightarrow\\;");y("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");y("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");y("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");Yu={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},jp=new Set(["bin","rel"]);y("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in Yu?e=Yu[t]:(t.slice(0,4)==="\\not"||t in Ge.math&&jp.has(Ge.math[t].group))&&(e="\\dotsb"),e});hc={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};y("\\dotso",function(r){var e=r.future().text;return e in hc?"\\ldots\\,":"\\ldots"});y("\\dotsc",function(r){var e=r.future().text;return e in hc&&e!==","?"\\ldots\\,":"\\ldots"});y("\\cdots",function(r){var e=r.future().text;return e in hc?"\\@cdots\\,":"\\@cdots"});y("\\dotsb","\\cdots");y("\\dotsm","\\cdots");y("\\dotsi","\\!\\cdots");y("\\dotsx","\\ldots\\,");y("\\DOTSI","\\relax");y("\\DOTSB","\\relax");y("\\DOTSX","\\relax");y("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");y("\\,","\\tmspace+{3mu}{.1667em}");y("\\thinspace","\\,");y("\\>","\\mskip{4mu}");y("\\:","\\tmspace+{4mu}{.2222em}");y("\\medspace","\\:");y("\\;","\\tmspace+{5mu}{.2777em}");y("\\thickspace","\\;");y("\\!","\\tmspace-{3mu}{.1667em}");y("\\negthinspace","\\!");y("\\negmedspace","\\tmspace-{4mu}{.2222em}");y("\\negthickspace","\\tmspace-{5mu}{.277em}");y("\\enspace","\\kern.5em ");y("\\enskip","\\hskip.5em\\relax");y("\\quad","\\hskip1em\\relax");y("\\qquad","\\hskip2em\\relax");y("\\tag","\\@ifstar\\tag@literal\\tag@paren");y("\\tag@paren","\\tag@literal{({#1})}");y("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new J("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});y("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");y("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");y("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");y("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");y("\\newline","\\\\\\relax");y("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");Om=Q(Pr["Main-Regular"][84][1]-.7*Pr["Main-Regular"][65][1]);y("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Om+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");y("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Om+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");y("\\hspace","\\@ifstar\\@hspacer\\@hspace");y("\\@hspace","\\hskip #1\\relax");y("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");y("\\ordinarycolon",":");y("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");y("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');y("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');y("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');y("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');y("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');y("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');y("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');y("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');y("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');y("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');y("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');y("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');y("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');y("\u2237","\\dblcolon");y("\u2239","\\eqcolon");y("\u2254","\\coloneqq");y("\u2255","\\eqqcolon");y("\u2A74","\\Coloneqq");y("\\ratio","\\vcentcolon");y("\\coloncolon","\\dblcolon");y("\\colonequals","\\coloneqq");y("\\coloncolonequals","\\Coloneqq");y("\\equalscolon","\\eqqcolon");y("\\equalscoloncolon","\\Eqqcolon");y("\\colonminus","\\coloneq");y("\\coloncolonminus","\\Coloneq");y("\\minuscolon","\\eqcolon");y("\\minuscoloncolon","\\Eqcolon");y("\\coloncolonapprox","\\Colonapprox");y("\\coloncolonsim","\\Colonsim");y("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");y("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");y("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");y("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");y("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");y("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");y("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");y("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");y("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");y("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");y("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");y("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");y("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");y("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");y("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");y("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");y("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");y("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");y("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");y("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");y("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");y("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");y("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");y("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");y("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");y("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");y("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");y("\\imath","\\html@mathml{\\@imath}{\u0131}");y("\\jmath","\\html@mathml{\\@jmath}{\u0237}");y("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");y("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");y("\u27E6","\\llbracket");y("\u27E7","\\rrbracket");y("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");y("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");y("\u2983","\\lBrace");y("\u2984","\\rBrace");y("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");y("\u29B5","\\minuso");y("\\darr","\\downarrow");y("\\dArr","\\Downarrow");y("\\Darr","\\Downarrow");y("\\lang","\\langle");y("\\rang","\\rangle");y("\\uarr","\\uparrow");y("\\uArr","\\Uparrow");y("\\Uarr","\\Uparrow");y("\\N","\\mathbb{N}");y("\\R","\\mathbb{R}");y("\\Z","\\mathbb{Z}");y("\\alef","\\aleph");y("\\alefsym","\\aleph");y("\\Alpha","\\mathrm{A}");y("\\Beta","\\mathrm{B}");y("\\bull","\\bullet");y("\\Chi","\\mathrm{X}");y("\\clubs","\\clubsuit");y("\\cnums","\\mathbb{C}");y("\\Complex","\\mathbb{C}");y("\\Dagger","\\ddagger");y("\\diamonds","\\diamondsuit");y("\\empty","\\emptyset");y("\\Epsilon","\\mathrm{E}");y("\\Eta","\\mathrm{H}");y("\\exist","\\exists");y("\\harr","\\leftrightarrow");y("\\hArr","\\Leftrightarrow");y("\\Harr","\\Leftrightarrow");y("\\hearts","\\heartsuit");y("\\image","\\Im");y("\\infin","\\infty");y("\\Iota","\\mathrm{I}");y("\\isin","\\in");y("\\Kappa","\\mathrm{K}");y("\\larr","\\leftarrow");y("\\lArr","\\Leftarrow");y("\\Larr","\\Leftarrow");y("\\lrarr","\\leftrightarrow");y("\\lrArr","\\Leftrightarrow");y("\\Lrarr","\\Leftrightarrow");y("\\Mu","\\mathrm{M}");y("\\natnums","\\mathbb{N}");y("\\Nu","\\mathrm{N}");y("\\Omicron","\\mathrm{O}");y("\\plusmn","\\pm");y("\\rarr","\\rightarrow");y("\\rArr","\\Rightarrow");y("\\Rarr","\\Rightarrow");y("\\real","\\Re");y("\\reals","\\mathbb{R}");y("\\Reals","\\mathbb{R}");y("\\Rho","\\mathrm{P}");y("\\sdot","\\cdot");y("\\sect","\\S");y("\\spades","\\spadesuit");y("\\sub","\\subset");y("\\sube","\\subseteq");y("\\supe","\\supseteq");y("\\Tau","\\mathrm{T}");y("\\thetasym","\\vartheta");y("\\weierp","\\wp");y("\\Zeta","\\mathrm{Z}");y("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");y("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");y("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");y("\\bra","\\mathinner{\\langle{#1}|}");y("\\ket","\\mathinner{|{#1}\\rangle}");y("\\braket","\\mathinner{\\langle{#1}\\rangle}");y("\\Bra","\\left\\langle#1\\right|");y("\\Ket","\\left|#1\\right\\rangle");Fm=r=>e=>{var t=e.consumeArg().tokens,n=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=m=>f=>{r&&(f.macros.set("|",o),s.length&&f.macros.set("\\|",a));var g=m;if(!m&&s.length){var b=f.future();b.text==="|"&&(f.popToken(),g=!0)}return{tokens:g?s:n,numArgs:0}};e.macros.set("|",l(!1)),s.length&&e.macros.set("\\|",l(!0));var h=e.consumeArg().tokens,c=e.expandTokens([...i,...h,...t]);return e.macros.endGroup(),{tokens:c.reverse(),numArgs:0}};y("\\bra@ket",Fm(!1));y("\\bra@set",Fm(!0));y("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");y("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");y("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");y("\\angln","{\\angl n}");y("\\blue","\\textcolor{##6495ed}{#1}");y("\\orange","\\textcolor{##ffa500}{#1}");y("\\pink","\\textcolor{##ff00af}{#1}");y("\\red","\\textcolor{##df0030}{#1}");y("\\green","\\textcolor{##28ae7b}{#1}");y("\\gray","\\textcolor{gray}{#1}");y("\\purple","\\textcolor{##9d38bd}{#1}");y("\\blueA","\\textcolor{##ccfaff}{#1}");y("\\blueB","\\textcolor{##80f6ff}{#1}");y("\\blueC","\\textcolor{##63d9ea}{#1}");y("\\blueD","\\textcolor{##11accd}{#1}");y("\\blueE","\\textcolor{##0c7f99}{#1}");y("\\tealA","\\textcolor{##94fff5}{#1}");y("\\tealB","\\textcolor{##26edd5}{#1}");y("\\tealC","\\textcolor{##01d1c1}{#1}");y("\\tealD","\\textcolor{##01a995}{#1}");y("\\tealE","\\textcolor{##208170}{#1}");y("\\greenA","\\textcolor{##b6ffb0}{#1}");y("\\greenB","\\textcolor{##8af281}{#1}");y("\\greenC","\\textcolor{##74cf70}{#1}");y("\\greenD","\\textcolor{##1fab54}{#1}");y("\\greenE","\\textcolor{##0d923f}{#1}");y("\\goldA","\\textcolor{##ffd0a9}{#1}");y("\\goldB","\\textcolor{##ffbb71}{#1}");y("\\goldC","\\textcolor{##ff9c39}{#1}");y("\\goldD","\\textcolor{##e07d10}{#1}");y("\\goldE","\\textcolor{##a75a05}{#1}");y("\\redA","\\textcolor{##fca9a9}{#1}");y("\\redB","\\textcolor{##ff8482}{#1}");y("\\redC","\\textcolor{##f9685d}{#1}");y("\\redD","\\textcolor{##e84d39}{#1}");y("\\redE","\\textcolor{##bc2612}{#1}");y("\\maroonA","\\textcolor{##ffbde0}{#1}");y("\\maroonB","\\textcolor{##ff92c6}{#1}");y("\\maroonC","\\textcolor{##ed5fa6}{#1}");y("\\maroonD","\\textcolor{##ca337c}{#1}");y("\\maroonE","\\textcolor{##9e034e}{#1}");y("\\purpleA","\\textcolor{##ddd7ff}{#1}");y("\\purpleB","\\textcolor{##c6b9fc}{#1}");y("\\purpleC","\\textcolor{##aa87ff}{#1}");y("\\purpleD","\\textcolor{##7854ab}{#1}");y("\\purpleE","\\textcolor{##543b78}{#1}");y("\\mintA","\\textcolor{##f5f9e8}{#1}");y("\\mintB","\\textcolor{##edf2df}{#1}");y("\\mintC","\\textcolor{##e0e5cc}{#1}");y("\\grayA","\\textcolor{##f6f7f7}{#1}");y("\\grayB","\\textcolor{##f0f1f2}{#1}");y("\\grayC","\\textcolor{##e3e5e6}{#1}");y("\\grayD","\\textcolor{##d6d8da}{#1}");y("\\grayE","\\textcolor{##babec2}{#1}");y("\\grayF","\\textcolor{##888d93}{#1}");y("\\grayG","\\textcolor{##626569}{#1}");y("\\grayH","\\textcolor{##3b3e40}{#1}");y("\\grayI","\\textcolor{##21242c}{#1}");y("\\kaBlue","\\textcolor{##314453}{#1}");y("\\kaGreen","\\textcolor{##71B307}{#1}");$m={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Jh=class{constructor(e,t,n){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Uh($p,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new bl(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:s,end:n}=this.consumeArg(["]"])}else({tokens:s,start:t,end:n}=this.consumeArg());return this.pushToken(new Nt("EOF",n.loc)),this.pushTokens(s),new Nt("",_t.range(t,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var s=this.future(),i,o=0,a=0;do{if(i=this.popToken(),t.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new J("Extra }",i)}else if(i.text==="EOF")throw new J("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",i);if(e&&n)if((o===0||o===1&&e[a]==="{")&&i.text===e[a]){if(++a,a===e.length){t.splice(-a,a);break}}else a=0}while(o!==0||n);return s.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:s,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new J("The length of delimiters doesn't match the number of args!");for(var n=t[0],s=0;s<n.length;s++){var i=this.popToken();if(n[s]!==i.text)throw new J("Use of the macro doesn't match its definition",i)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(t&&t[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new J("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,s=t.noexpand?null:this._getExpansion(n);if(s==null||e&&s.unexpandable){if(e&&s==null&&n[0]==="\\"&&!this.isDefined(n))throw new J("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var i=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new J("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...o[+l.text-1]);else throw new J("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Nt(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),t.push(s)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(n=>n.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var s=typeof t=="function"?t(this):t;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var o=s.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new bl(s,this.settings),l=[],h=a.lex();h.text!=="EOF";)l.push(h),h=a.lex();l.reverse();var c={tokens:l,numArgs:i};return c}return s}isDefined(e){return this.macros.has(e)||vn.hasOwnProperty(e)||Ge.math.hasOwnProperty(e)||Ge.text.hasOwnProperty(e)||$m.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:vn.hasOwnProperty(e)&&!vn[e].primitive}},Xu=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,ol=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),Lh={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Gu={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},wl=class r{constructor(e,t){this.mode="math",this.gullet=new Jh(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new J("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Nt("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(r.endOfExpression.has(s.text)||t&&s.text===t||e&&vn[s.text]&&vn[s.text].infix)break;var i=this.parseAtom(t);if(i){if(i.type==="internal")continue}else break;n.push(i)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t=-1,n,s=0;s<e.length;s++){var i=e[s];if(i.type==="infix"){if(t!==-1)throw new J("only one infix operator per group",i.token);t=s,n=i.replaceWith}}if(t!==-1&&n){var o,a,l=e.slice(0,t),h=e.slice(t+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},h.length===1&&h[0].type==="ordgroup"?a=h[0]:a={type:"ordgroup",mode:this.mode,body:h};var c;return n==="\\\\abovefrac"?c=this.callFunction(n,[o,e[t],a],[]):c=this.callFunction(n,[o,a],[]),[c]}else return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(e)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new J("Expected group after '"+n+"'",t);return s}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var s={type:"text",mode:this.mode,body:t},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(e){var t=this.parseGroup("atom",e);if(t?.type==="internal"||this.mode==="text")return t;for(var n,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(t&&t.type==="op"){var o=i.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=i.text==="\\limits");else throw new J("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(n)throw new J("Double superscript",i);n=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new J("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(n)throw new J("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(ol[i.text]){var h=Xu.test(i.text),c=[];for(c.push(new Nt(ol[i.text])),this.consume();;){var m=this.fetch().text;if(!ol[m]||Xu.test(m)!==h)break;c.unshift(new Nt(ol[m])),this.consume()}var f=this.subparse(c);h?s={type:"ordgroup",mode:"math",body:f}:n={type:"ordgroup",mode:"math",body:f}}else break}return n||s?{type:"supsub",mode:this.mode,base:t,sup:n,sub:s}:t}parseFunction(e,t){var n=this.fetch(),s=n.text,i=vn[s];if(!i)return null;if(this.consume(),t&&t!=="atom"&&!i.allowedInArgument)throw new J("Got function '"+s+"' with no arguments"+(t?" as "+t:""),n);if(this.mode==="text"&&!i.allowedInText)throw new J("Can't use function '"+s+"' in text mode",n);if(this.mode==="math"&&i.allowedInMath===!1)throw new J("Can't use function '"+s+"' in math mode",n);var{args:o,optArgs:a}=this.parseArguments(s,i);return this.callFunction(s,o,a,n,e)}callFunction(e,t,n,s,i){var o={funcName:e,parser:this,token:s,breakOnTokenText:i},a=vn[e];if(a&&a.handler)return a.handler(o,t,n);throw new J("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var s=[],i=[],o=0;o<n;o++){var a=t.argTypes&&t.argTypes[o],l=o<t.numOptionalArgs;("primitive"in t&&t.primitive&&a==null||t.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var h=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)i.push(h);else if(h!=null)s.push(h);else throw new J("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":{var s=this.parseArgumentGroup(n,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text"}:null}case"raw":{var i=this.parseStringGroup("raw",n);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(n)throw new J("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new J("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new J("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),n.text=s,n}parseRegexGroup(e,t){for(var n=this.fetch(),s=n,i="",o;(o=this.fetch()).text!=="EOF"&&e.test(i+o.text);)s=o,i+=s.text,this.consume();if(i==="")throw new J("Invalid "+t+": '"+n.text+"'",n);return n.range(s,i)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new J("Invalid color: '"+t.text+"'",t);var s=n[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",n=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!s)throw new J("Invalid size: '"+t.text+"'",t);var i={number:+(s[1]+s[2]),unit:s[3]};if(!Vu(i))throw new J("Invalid unit: '"+i.unit+"'",t);return{type:"size",mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var s=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:i};return t&&this.switchMode(s),o}parseGroup(e,t){var n=this.fetch(),s=n.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:_t.range(n,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(t,e)||this.parseSymbol(),i==null&&s[0]==="\\"&&!$m.hasOwnProperty(s)){if(this.settings.throwOnError)throw new J("Undefined control sequence: "+s,n);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var s=e[n];if(s.type==="textord"){var i=s.text,o=e[n+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=e[n+2];n+1<t&&a&&a.type==="textord"&&a.text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:_t.range(s,a),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:_t.range(s,o),text:"--"}),t-=1)}(i==="'"||i==="`")&&o.text===i&&(e.splice(n,2,{type:"textord",mode:"text",loc:_t.range(s,o),text:i+i}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),s=n.charAt(0)==="*";if(s&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new J(`\\verb assertion failed --
265
+ please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:s}}Gu.hasOwnProperty(t[0])&&!Ge[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Gu[t[0]]+t.slice(1));var i=Op.exec(t);i&&(t=t.substring(0,i.index),t==="i"?t="\u0131":t==="j"&&(t="\u0237"));var o;if(Ge[this.mode][t]){this.settings.strict&&this.mode==="math"&&Fh.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a=Ge[this.mode][t].group,l=_t.range(e),h;if(Fd.hasOwnProperty(a)){var c=a;h={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else h={type:a,mode:this.mode,loc:l,text:t};o=h}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Wu(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:_t.range(e),text:t};else return null;if(this.consume(),i)for(var m=0;m<i[0].length;m++){var f=i[0][m];if(!Lh[f])throw new J("Unknown accent ' "+f+"'",e);var g=Lh[f][this.mode]||Lh[f].text;if(!g)throw new J("Accent "+f+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:_t.range(e),label:g,isStretchy:!1,isShifty:!0,base:o}}return o}};wl.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);cc=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new wl(e,t);delete n.gullet.macros.current["\\df@tag"];var s=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new J("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:n.subparse([new Nt("\\df@tag")])}]}return s},uc=function(e,t,n){t.textContent="";var s=Al(e,n).toNode();t.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),uc=function(){throw new J("KaTeX doesn't work in quirks mode.")});jm=function(e,t){var n=Al(e,t).toMarkup();return n},qm=function(e,t){var n=new pa(t);return cc(e,n)},Hm=function(e,t,n){if(n.throwOnError||!(e instanceof J))throw e;var s=V(["katex-error"],[new Pt(t)]);return s.setAttribute("title",e.toString()),s.setAttribute("style","color:"+n.errorColor),s},Al=function(e,t){var n=new pa(t);try{var s=cc(e,n);return tp(s,e,n)}catch(i){return Hm(i,e,n)}},Ym=function(e,t){var n=new pa(t);try{var s=cc(e,n);return rp(s,e,n)}catch(i){return Hm(i,e,n)}},Xm="0.16.44",Gm={Span:kn,Anchor:y0,SymbolNode:Pt,SvgNode:ar,PathNode:Tr,LineNode:ga},qp={version:Xm,render:uc,renderToString:jm,ParseError:J,SETTINGS_SCHEMA:hl,__parse:qm,__renderToDomTree:Al,__renderToHTMLTree:Ym,__setFontMetrics:Zu,__defineSymbol:u,__defineFunction:ie,__defineMacro:y,__domTree:Gm}});var L2={};$a(L2,{Adc:()=>Ls,Amp:()=>un,AnalogBiasedFet:()=>j0,AnalogNFet:()=>F0,AnalogPFet:()=>$0,And:()=>Bt,Annotate:()=>zo,Antenna:()=>Qi,AntennaLoop:()=>eo,AntennaLoop2:()=>to,Arc2:()=>Mo,Arc3:()=>fn,ArcLoop:()=>To,ArcN:()=>Po,ArcZ:()=>Eo,Arrow:()=>dn,Arrowhead:()=>xo,AudioJack:()=>po,BUILTIN_THEMES:()=>yr,Battery:()=>Ni,BatteryCell:()=>Di,BatteryDouble:()=>Oi,BitField:()=>s0,Bjt:()=>qr,Bjt2:()=>Hr,BjtNpn:()=>Ht,BjtNpn2:()=>Ss,BjtPnp:()=>rr,BjtPnp2:()=>ln,BjtPnp2c:()=>W0,BjtPnp2c2:()=>ei,Breaker:()=>as,Buf:()=>Jt,BusConnect:()=>gi,BusLine:()=>bi,Button:()=>oo,CPE:()=>ls,CSS_VARS:()=>Ks,Capacitor:()=>Cr,Capacitor2:()=>Cn,CapacitorTrim:()=>Ln,CapacitorVar:()=>In,Circle:()=>ui,Circulator:()=>Os,Coax:()=>fo,CoaxConnect:()=>ki,Connect:()=>pr,ConnectorTerminal:()=>Ei,Container:()=>P0,Crystal:()=>Un,CurrentLabel:()=>h0,CurrentLabelInline:()=>gn,CurrentMirror:()=>Fr,CurrentTransactor:()=>Oo,DA15:()=>vi,DB25:()=>xi,DB9:()=>wi,DC37:()=>yi,DD50:()=>Si,DE9:()=>a0,DFlipFlop:()=>ri,Dac:()=>Ds,Data:()=>Ms,DataBusLine:()=>wo,Decision:()=>Es,Demod:()=>Ns,Diac:()=>on,Diode:()=>et,DiodeShockley:()=>$n,DiodeTVS:()=>Fn,DiodeTunnel:()=>On,Dot:()=>pn,DotDotDot:()=>vo,DrawTree:()=>l0,Drawing:()=>lr,DspBox:()=>sr,DspCircle:()=>Yt,DspSpeaker:()=>_s,DualVacuumTube:()=>Ko,ELEMENT_GETATTR_ANCHOR_NAMES:()=>gc,ELEMENT_REGISTRY:()=>Js,Element:()=>N,Element2Term:()=>se,ElementCompound:()=>ir,ElementDrawing:()=>Ol,ElementImage:()=>js,ElementTwoport:()=>vr,Ellipse:()=>zs,Encircle:()=>sh,EncircleBox:()=>ih,Filter:()=>Is,FlowBox:()=>cn,Fuse:()=>rs,FuseIEC:()=>Dr,FuseIEEE:()=>dr,FuseUS:()=>os,GAP:()=>H,Gap:()=>Xt,Ground:()=>Ti,GroundChassis:()=>Zi,GroundSignal:()=>Ki,Header:()=>pi,Hemt:()=>G0,Ic:()=>nr,Ic555:()=>ii,IcDIP:()=>ai,IcPin:()=>Kl,IgbtN:()=>Z0,IgbtP:()=>Q0,ImageFormat:()=>ja,Inductor:()=>Ir,Inductor2:()=>Lr,Isolator:()=>Fs,JFet:()=>vs,JFet2:()=>ys,JFetN:()=>q0,JFetN2:()=>Y0,JFetP:()=>H0,JFetP2:()=>X0,JKFlipFlop:()=>ni,Jack:()=>zi,Josephson:()=>is,Jumper:()=>fi,Kmap:()=>A0,LED:()=>qn,LED2:()=>Hn,Label:()=>So,Lamp:()=>Xi,Lamp2:()=>Gi,Line:()=>Pe,LogicTree:()=>gr,LoopArrow:()=>c0,LoopCurrent:()=>nh,Memristor:()=>ns,Memristor2:()=>ss,MeterA:()=>qi,MeterAnalog:()=>Vi,MeterArrow:()=>Yi,MeterBox:()=>mn,MeterDigital:()=>Ji,MeterI:()=>ji,MeterOhm:()=>Hi,MeterV:()=>$i,Mic:()=>uo,Mixer:()=>As,Motor:()=>mo,Multiplexer:()=>ti,NAMED_COLORS:()=>fh,NFet:()=>gs,NFet2:()=>ws,NMos:()=>ms,NMos2:()=>ps,Neon:()=>Wi,NixieTube:()=>Zo,NoConnect:()=>so,Norator:()=>Or,Not:()=>Kt,NotNot:()=>C0,NpnPhoto:()=>J0,NpnSchottky:()=>V0,Nullator:()=>Nr,Nullor:()=>$o,Opamp:()=>cs,Optocoupler:()=>_o,Or:()=>$t,OrthoLines:()=>di,Oscillator:()=>Cs,OscillatorBox:()=>Bs,Oscilloscope:()=>Ui,OutletA:()=>u0,OutletB:()=>qo,OutletC:()=>m0,OutletD:()=>Ho,OutletE:()=>Yo,OutletF:()=>Xo,OutletG:()=>Go,OutletH:()=>d0,OutletI:()=>Wo,OutletJ:()=>Vo,OutletK:()=>Uo,OutletL:()=>Jo,PFet:()=>bs,PFet2:()=>xs,PMos:()=>ds,PMos2:()=>fs,Pentode:()=>ra,Photodiode:()=>Yn,Photoresistor:()=>ts,PhotoresistorBox:()=>Qt,PhotoresistorIEC:()=>Qt,PhotoresistorIEEE:()=>ur,Plug:()=>Mi,PnpPhoto:()=>K0,PnpSchottky:()=>U0,Point:()=>A,PotBox:()=>er,Potentiometer:()=>es,PotentiometerIEC:()=>er,PotentiometerIEEE:()=>mr,Process:()=>hi,RBox:()=>mt,RBoxVar:()=>Zt,Rect:()=>xr,Rectifier:()=>Bo,Relay:()=>Io,Resistor:()=>Zn,ResistorIEC:()=>mt,ResistorIEEE:()=>dt,ResistorVar:()=>Qn,ResistorVarIEC:()=>Zt,ResistorVarIEEE:()=>cr,RightLines:()=>Hs,RoundBox:()=>Yr,RoundProcess:()=>li,Rshunt:()=>Kn,SCR:()=>Xn,STYLE_IEC:()=>Xl,STYLE_IEEE:()=>an,SchemdrawController:()=>La,Schmitt:()=>L0,SchmittAnd:()=>o0,SchmittNand:()=>Yl,SchmittNot:()=>D0,Schottky:()=>Dn,Segment:()=>p,SegmentArc:()=>xe,SegmentBezier:()=>Ut,SegmentCircle:()=>D,SegmentImage:()=>Br,SegmentPath:()=>ut,SegmentPoly:()=>U,SegmentText:()=>W,SevenSegment:()=>oi,Solar:()=>Fi,Source:()=>rt,SourceControlled:()=>Ys,SourceControlledI:()=>wr,SourceControlledV:()=>br,SourceI:()=>Ai,SourcePulse:()=>Bi,SourceRamp:()=>Ii,SourceSin:()=>_i,SourceSquare:()=>Li,SourceTriangle:()=>Ci,SourceV:()=>Ri,SparkGap:()=>hs,Speaker:()=>co,Start:()=>ci,State:()=>mi,StateEnd:()=>Ps,Subroutine:()=>ks,Sum:()=>Ts,SumSigma:()=>Rs,SvgBackendConfig:()=>Aa,SvgFigure:()=>g0,Switch:()=>Xr,SwitchDIP:()=>ho,SwitchDpdt:()=>Ws,SwitchDpst:()=>Gs,SwitchReed:()=>ao,SwitchRotary:()=>lo,SwitchSpdt:()=>io,SwitchSpdt2:()=>Xs,Table:()=>B0,Tag:()=>ko,Terminal:()=>hn,Tetrode:()=>ta,Tgate:()=>I0,Thermistor:()=>Jn,TimingDiagram:()=>n0,TransadmittanceTransactor:()=>Fo,Transform:()=>p0,Transformer:()=>bo,TransimpedanceTransactor:()=>No,Triac:()=>Gn,Triax:()=>go,Triode:()=>ea,Tristate:()=>Bn,TubeDiode:()=>Qo,TwoPort:()=>Lo,VERSION:()=>au,VGA:()=>$s,VMCMPair:()=>jo,VacuumTube:()=>Gr,Varactor:()=>jn,Vdd:()=>no,VoltageLabelArc:()=>Ro,VoltageMirror:()=>$r,VoltageRegulator:()=>si,VoltageTransactor:()=>Do,Vss:()=>ro,Wheatstone:()=>Co,Wire:()=>yo,ZLabel:()=>Ao,Zener:()=>Nn,alignLabelForPlace:()=>pc,angle:()=>ia,bbox:()=>He,buchheim:()=>Ra,buildLabelSpecsFromParams:()=>Ll,colorHex:()=>gh,colorHsl:()=>xh,colorHsla:()=>vh,colorRgb:()=>bh,colorRgba:()=>wh,config:()=>kt,cycloid:()=>Vn,dasharray:()=>yh,debug:()=>A1,delta:()=>qa,dist:()=>Qs,ensureKatex:()=>Zm,estimateMathSize:()=>ya,flip:()=>du,getAnchors:()=>O1,getAvailableTypes:()=>N1,getGlobalStyle:()=>f0,getParam:()=>T,getRegisteredTypes:()=>eu,hasMath:()=>va,isKatexAvailable:()=>Bl,linspace:()=>ze,logicparse:()=>Ql,mergeParams:()=>oa,mergeParamsFirstWins:()=>Mr,mirrorx:()=>mu,mountFromJson:()=>H1,nand:()=>Tn,nor:()=>Rn,placeElementLabels:()=>Il,point:()=>uu,renderFromJson:()=>hh,renderMathHtml:()=>Cl,resetConfigForTests:()=>fu,resetElementStyleForTests:()=>Wl,resheight:()=>F,resolveLabelRotateDeg:()=>dc,resolvePosition:()=>Ia,resolvePositionX:()=>ah,resolvePositionY:()=>lh,resolveTheme:()=>Zs,reswidth:()=>Ye,rotate:()=>Wr,setBoxAnchors16:()=>fr,setElementStyle:()=>Gl,sevensegdigit:()=>Cc,subsystems:()=>Zc,svgconfig:()=>B1,swapLabelLocForTheta:()=>mc,swapPause:()=>la,textSize:()=>b0,theme:()=>_1,use:()=>R1,validateCircuitJson:()=>j1,validateColor:()=>Vr,validateLinestyle:()=>Wa,withDrawing:()=>h1,xnor:()=>_n,xor:()=>An});var au="0.5.0";function He(r,e,t,n){return{xmin:r,ymin:e,xmax:t,ymax:n}}var ja=(c=>(c.EPS="eps",c.JPG="jpg",c.PDF="pdf",c.PGF="pgf",c.PNG="png",c.PS="ps",c.RAW="raw",c.RGBA="rgba",c.SVG="svg",c.TIF="tif",c))(ja||{});function ze(r,e,t=50){if(t<2)return[r];let n=(e-r)/(t-1);return Array.from({length:t},(s,i)=>r+n*i)}function dh(r,e,t,n,s){let i=Math.cos(t*Math.PI/180),o=Math.sin(t*Math.PI/180),a=r-n,l=e-s,h=a*i-l*o,c=a*o+l*i;return[h+n,c+s]}function Sr(r,e,t){return[-(r-t)+t,e]}function kr(r,e){return[r,-e]}function lu(r,e,t,n){return[t-r,n-e]}function hu(r,e,t,n){return Math.atan2(n-e,t-r)*180/Math.PI}function cu(r,e,t,n){return Math.hypot(t-r,n-e)}function Dt(r){return r instanceof A?r:{x:r[0],y:r[1]}}var A=class r{constructor(e,t){z(this,"x");z(this,"y");this.x=e,this.y=t}static fromXY(e){return new r(e[0],e[1])}add(e){let t=Dt(e);return new r(this.x+t.x,this.y+t.y)}sub(e){let t=Dt(e);return new r(this.x-t.x,this.y-t.y)}subFromScalar(e){return new r(e-this.x,e-this.y)}mul(e){return typeof e=="number"?new r(this.x*e,this.y*e):new r(this.x*e.x,this.y*e.y)}div(e){return typeof e=="number"?new r(this.x/e,this.y/e):new r(this.x/e.x,this.y/e.y)}neg(){return new r(-this.x,-this.y)}rotate(e,t=[0,0]){let n=Dt(t),[s,i]=dh(this.x,this.y,e,n.x,n.y);return new r(s,i)}mirrorx(e=0){let[t,n]=Sr(this.x,this.y,e);return new r(t,n)}flip(){let[e,t]=kr(this.x,this.y);return new r(e,t)}toTuple(){return[this.x,this.y]}};function uu(r,e){return new A(r,e)}function Wr(r,e,t=[0,0]){let n=Dt(r),s=Dt(t),[i,o]=dh(n.x,n.y,e,s.x,s.y);return new A(i,o)}function mu(r,e=0){let t=Dt(r),[n,s]=Sr(t.x,t.y,e);return new A(n,s)}function du(r){let e=Dt(r),[t,n]=kr(e.x,e.y);return new A(t,n)}function qa(r,e){let t=Dt(r),n=Dt(e),[s,i]=lu(t.x,t.y,n.x,n.y);return new A(s,i)}function ia(r,e){let t=Dt(r),n=Dt(e);return hu(t.x,t.y,n.x,n.y)}function Qs(r,e){let t=Dt(r),n=Dt(e);return cu(t.x,t.y,n.x,n.y)}function Ha(r){return r instanceof A?r:A.fromXY([r[0],r[1]])}function sd(r){return typeof r=="number"?new A(r,r):Ha(r)}var p0=class{constructor(e,t,n=[0,0],s=[1,1]){z(this,"theta");z(this,"shift");z(this,"localshift");z(this,"zoom");this.theta=e,this.shift=Ha(t),this.localshift=Ha(n),this.zoom=sd(s)}transform(e){return Ha(e).add(this.localshift).mul(this.zoom).rotate(this.theta).add(this.shift)}transformArray(e){return e.map(t=>this.transform(t))}};var pu={unit:3,inches_per_unit:.5,lblofst:.1,fontsize:14,font:"sans-serif",color:"black",lw:2,ls:"-",fill:null,margin:.1},Ya={...pu};function kt(r){Ya={...Ya,...r}}function f0(){return Ya}function fu(){Ya={...pu}}function oa(...r){let e={};for(let t of r)if(t)for(let[n,s]of Object.entries(t))s!==void 0&&(e[n]=s);return e}function Mr(...r){let e={};for(let t of r)if(t)for(let[n,s]of Object.entries(t))s!==void 0&&!(n in e)&&(e[n]=s);return e}function T(r,e,t){let n=r[e];return n!==void 0?n:t}var aa=new Map,ph=!1;function la(r){let e=ph;return ph=r,e}function id(){return[...aa.entries()]}function Xa(r){aa.set(r,null)}function Ga(r){aa.delete(r)}function At(r){if(ph||aa.size===0)return;let e=id().at(-1);if(!e)return;let[t,n]=e;n!==null&&!t.containsElement(n)&&t.add(n),aa.set(t,r)}var fh=["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],od=new Set(fh);function gh(r){return/^#[A-Fa-f\d]{3}(?:[A-Fa-f\d]{3}|(?:[A-Fa-f\d]{5})?)$/i.test(r)}function bh(r){return/^rgb(\s*)\((\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*)\)$/i.test(r)}function wh(r){return/^rgba(\s*)\((\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*),(\s*)(?:\d*\.?\d*%?)(\s*)\)$/i.test(r)}function xh(r){return/^hsl(\s*)\((\s*)(?:-?\d*\.?\d*)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*)\)$/i.test(r)}function vh(r){return/^hsla(\s*)\((\s*)(?:-?\d*\.?\d*)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*),(\s*)(?:-?\d*\.?\d*%)(\s*),(\s*)(?:-?\d*\.?\d*%?)(\s*)\)$/i.test(r)}function yh(r){return/^(\d+\.?\d*)(,\s*\d+\.?\d*)*$/i.test(r)}function Vr(r){if(r==null||r===!0||r===!1)return;if(Array.isArray(r)){let t=r;if(t.length!==3||typeof t[0]!="number"||typeof t[1]!="number"||typeof t[2]!="number")throw new Error(`Invalid color tuple ${String(r)}`);return}if(typeof r!="string")throw new Error(`Invalid color ${String(r)}`);let e=r;if(!(od.has(e)||e==="bg"||gh(e)||bh(e)||wh(e)||xh(e)||vh(e)||e.startsWith("url(")))throw new Error(`Invalid color name ${e}`)}function Wa(r){if(![null,""," ","-","--",":","-.","dashed","dotted","dashdot"].includes(r)&&!yh(r))throw new Error(`Invalid line style ${r}`)}function Va(r){return r instanceof A?r:{x:r[0],y:r[1]}}function gu(r,e){let t=r.length;if(t<3||e<=0)return r.map(s=>{let i=Va(s);return new A(i.x,i.y)});let n=[];for(let s=t-1;s>=0;s--){let i=Va(r[s]),o=Va(r[(s-1+t)%t]),a=Va(r[(s-2+t)%t]),l=o.x-i.x,h=o.y-i.y,c=o.x-a.x,m=o.y-a.y,f=(Math.atan2(h,l)-Math.atan2(m,c))/2,g=Math.abs(Math.tan(f)),b=e/g,v=(te,ke)=>Math.hypot(te,ke),x=(te,ke,he,ve,de)=>{let Fe=ke/he;return[te.x-ve*Fe,te.y-de*Fe]},S=v(l,h),k=v(c,m),M=Math.min(S,k);b>M&&(b=M,e=M*g);let _=x(o,b,S,l,h),B=x(o,b,k,c,m),$=o.x*2-_[0]-B[0],Y=o.y*2-_[1]-B[1],Z=v($,Y),L=v(b,e),I=x(o,L,Z,$,Y),X=Math.atan2(_[1]-I[1],_[0]-I[0]),j=Math.atan2(B[1]-I[1],B[0]-I[0]);for(;j<X;)j+=2*Math.PI;let re=ze(X,j,100);for(let te of re)n.push(new A(I[0]+Math.cos(te)*e,I[1]+Math.sin(te)*e))}return n.length>0&&n.push(n[0]),n}function ae(r){return r.toFixed(3).replace(/\.?0+$/,"")||"0"}function wn(r){let e="",{color:t,ls:n,lw:s,capstyle:i,joinstyle:o,fill:a,hatch:l}=r;if(t!==void 0&&(Array.isArray(t)?e+=`stroke:rgb(${Math.round(t[0]*255)},${Math.round(t[1]*255)},${Math.round(t[2]*255)});`:t&&(e+=`stroke:${t};`)),l?e+="fill:url(#hatch);":a===!1?e+="fill:none;":a!=null&&(e+=`fill:${String(a).toLowerCase()};`),s!==void 0&&s>0&&(e+=`stroke-width:${s};`),n){let h={"--":"7.4,3.2",dashed:"7.4,3.2",":":"2,3.3",dotted:"2,3.3","-.":"12.8,3.2,2,3.2",dashdot:"12.8,3.2,2,3.2"};n in h&&(e+=`stroke-dasharray:${h[n]};`)}return i&&(e+=`stroke-linecap:${i==="projecting"?"square":i};`),o&&(e+=`stroke-linejoin:${o};`),e}var Ur={};for(let r of"lij|' ")Ur[r]=37;for(let r of"![]fI.,:;/\\t")Ur[r]=50;for(let r of'`-(){}r"')Ur[r]=60;for(let r of"*^zcsJkvxy\u03BC\xB0")Ur[r]=85;for(let r of"aebdhnopqug#$L+<>=?_~FZT\u03B10123456789")Ur[r]=95;for(let r of"BSPEAKVXY&UwNRCHD")Ur[r]=112;for(let r of"QGOMm%@\u03A9")Ur[r]=140;for(let r of"W\u2220")Ur[r]=155;var Mt={};for(let r of"lij:.,;t")Mt[r]=47;for(let r of"|")Mt[r]=37;for(let r of"![]fI/\\")Mt[r]=55;for(let r of"`-(){}r")Mt[r]=60;for(let r of"sJ\xB0")Mt[r]=68;for(let r of'"zcae?1')Mt[r]=74;for(let r of"*^kvxy\u03BCbdhnopqug#$_\u03B10123456789")Mt[r]=85;for(let r of"#$+<>=~FSP")Mt[r]=95;for(let r of"ELZT")Mt[r]=105;for(let r of"BRC")Mt[r]=112;for(let r of"DAwHUKVXYNQGO")Mt[r]=122;for(let r of"&m\u03A9")Mt[r]=130;for(let r of"%")Mt[r]=140;for(let r of"MW@\u2220")Mt[r]=155;function bu(r){if(!r)return!1;let e=r.toLowerCase();return e.includes("times")||e.includes("serif")&&!e.includes("sans")}function ld(r,e,t){let n=bu(t)?Mt:Ur,s=bu(t)?60:75,i=0;for(let o of r)i+=n[o]??s;return i*72/1e3*(e/12)}function b0(r,e,t){if(r==="")return{width:0,height:0};let n=r.split(`
266
+ `),s=0;for(let i of n)s=Math.max(s,ld(i,e,t));return{width:s,height:n.length*e}}function it(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var Ua=class Ua{constructor(e,t={}){z(this,"bbox");z(this,"scale");z(this,"pxwidth");z(this,"pxheight");z(this,"elements",[]);z(this,"backgroundColor");z(this,"showbbox");z(this,"extraDefs");z(this,"svgDefs",[]);z(this,"clips",new Map);z(this,"_groupStack",[]);z(this,"_hasGroups",!1);let n=t.inchesPerUnit??.5,s=(t.margin??.1)+2/72;this.scale=72*n,this.showbbox=t.showbbox??!1,this.bbox={xmin:e.xmin-s,ymin:e.ymin-s,xmax:e.xmax+s,ymax:e.ymax+s};let i=this.bbox.xmax-this.bbox.xmin,o=this.bbox.ymax-this.bbox.ymin;this.pxwidth=Math.max(5,i*this.scale),this.pxheight=Math.max(5,o*this.scale),this.extraDefs=t.extraDefs??""}setBbox(e){let t=.1+2/72;this.bbox={xmin:e.xmin-t,ymin:e.ymin-t,xmax:e.xmax+t,ymax:e.ymax+t};let n=this.bbox.xmax-this.bbox.xmin,s=this.bbox.ymax-this.bbox.ymin;this.pxwidth=Math.max(5,n*this.scale),this.pxheight=Math.max(5,s*this.scale)}xform(e,t){return[e*this.scale,-t*this.scale]}bgcolor(e){this.backgroundColor=e}hatchpattern(e="hatch",t="black",n=.5){let s=`<pattern id="${e}" patternUnits="userSpaceOnUse" width="4" height="4"><path d="M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2" style="stroke:${t}; stroke-width:${n}" /></pattern>`;return this.svgDefs.push(s),e}addclip(e,t){let n=`<clipPath id="${e}"><path d="${t}" /></clipPath>`;this.svgDefs.push(n)}addclipBbox(e){let t=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,n;if(this.clips.has(t))n=this.clips.get(t);else{n=Ua.totalClips++,this.clips.set(t,n);let[s,i]=this.xform(e.xmin,e.ymin),[o,a]=this.xform(e.xmax,e.ymax),l=Math.min(s,o)-1,h=Math.min(i,a)-1,c=Math.abs(o-s)+2,m=Math.abs(a-i)+2;this.svgDefs.push(`<clipPath id="clip${n}"><rect x="${ae(l)}" y="${ae(h)}" width="${ae(c)}" height="${ae(m)}" /></clipPath>`)}return`url(#clip${n})`}plot(e,t,n={}){let s=n.zorder??2,i=n.color??"black",o=n.ls??"-",a=n.lw??2,l=n.capstyle??"round",h=n.joinstyle??"round",c=typeof n.fill=="string"||n.fill===void 0?n.fill??"none":"none",m="",[f,g]=this.xform(e[0],t[0]);m+=`M ${ae(f)} ${ae(g)} `;for(let v=1;v<e.length;v++){if(Number.isNaN(e[v])||Number.isNaN(t[v])){m+="M ";continue}m.endsWith("M ")||(m+="L ");let[x,S]=this.xform(e[v],t[v]);m+=`${ae(x)},${ae(S)} `}m=m.trim();let b=wn({color:i,ls:o,lw:a,capstyle:l,joinstyle:h,fill:c});this.elements.push({z:s,xml:`<path d="${m}" style="${it(b)}"/>`})}circle(e,t,n,s={}){let i=s.zorder??1,[o,a]=this.xform(e,t),l=n*this.scale,h=s.fill,c=h??"none",m=wn({color:s.color??"black",ls:s.ls??"-",lw:s.lw??2,fill:c});this.elements.push({z:i,xml:`<circle cx="${ae(o)}" cy="${ae(a)}" r="${ae(l)}" style="${it(m)}"/>`})}arrow(e,t,n={}){let s=n.arrowwidth??.15,i=n.arrowlength??.25,o=n.color??"black",a=n.lw??1,l=n.zorder??1,[h,c]=this.xform(e[0],e[1]),m=i/2*Math.cos(t*Math.PI/180)*this.scale,f=i/2*Math.sin(t*Math.PI/180)*this.scale,g=s*this.scale,b=i*this.scale,v=Math.hypot(m,f),x=-Math.atan2(f,m)*180/Math.PI,S=new A(h-m,c+f),k=new A(v-b,g/2).rotate(x,[0,0]).add(S),M=new A(v-b,-g/2).rotate(x,[0,0]).add(S),_=new A(h-a*2*Math.cos(x*Math.PI/180),c-a*2*Math.sin(x*Math.PI/180)),B=wn({color:o,lw:0,capstyle:"butt",joinstyle:"miter",fill:o}),$=`M ${ae(_.x)} ${ae(_.y)} L ${ae(k.x)} ${ae(k.y)} L ${ae(M.x)} ${ae(M.y)} Z`;this.elements.push({z:l,xml:`<path d="${$}" style="${it(B)}"/>`})}text(e,t,n,s={}){if(e==="")return;let i=s.zorder??3,[o,a]=this.xform(t,n),l=s.fontsize??14,h=s.fontfamily??"sans-serif";(h.toLowerCase()==="sans-serif"||h.toLowerCase()==="arial")&&(h="sans");let c=s.valign??"center";if(c==="base"){let M=e.split(`
267
+ `).length;a-=(M-1)*l}let m=s.halign==="left"?"start":s.halign==="right"?"end":"middle",f=c==="top"?"hanging":c==="bottom"?"ideographic":"central",g=s.rotation??0,b=g!==0?` transform="rotate(${ae(g)} ${ae(o)} ${ae(a)})"`:"",v=s.color??"black",x=a-l,S;s.textDecoration?S=`<tspan text-decoration="${s.textDecoration}">${it(e)}</tspan>`:S=it(e);let k=`<text x="${ae(o)}" y="${ae(x)}" dominant-baseline="${f}" fill="${it(v)}" font-size="${ae(l)}" font-family="${it(h)}" text-anchor="${m}"${b}><tspan x="${ae(o)}" dy="${ae(l)}" dominant-baseline="${f}">${S}</tspan></text>`;s.href&&(k=`<a href="${it(s.href)}">${k}</a>`),this.elements.push({z:i,xml:k})}poly(e,t={}){let n=t.closed??!0,s=t.zorder??1,i=t.color??"black",o=t.lw??2,a=t.ls??"-",l=t.capstyle??"round",h=t.joinstyle??"round",c=typeof t.fill=="string"?t.fill:"none",m=e.map(b=>{let[v,x]=this.xform(b.x,b.y);return`${ae(v)},${ae(x)}`}).join(" "),f=n?"polygon":"polyline",g=wn({color:i,ls:a,lw:o,capstyle:l,joinstyle:h,fill:c,hatch:t.hatch});this.elements.push({z:s,xml:`<${f} points="${m}" style="${it(g)}"/>`})}bezier(e,t={}){if(e.length!==3&&e.length!==4)throw new Error("bezier expects 3 (quadratic) or 4 (cubic) control points");let n=t.zorder??1,s=t.color??"black",i=t.lw??2,o=t.ls??"-",a=t.capstyle??"round",l=e.length===4?"C":"Q",h=t.arrow,c=t.arrowlength??.25,m=t.arrowwidth??.15,f=e.map(x=>({x:x.x,y:x.y}));if(h!=null){if(h.includes("<")){let x=Math.atan2(e[0].y-e[1].y,e[0].x-e[1].x);f[0]={x:e[0].x-Math.cos(x)*c/2,y:e[0].y-Math.sin(x)*c/2}}if(h.includes(">")){let x=e.length-1,S=e.length-2,k=Math.atan2(e[x].y-e[S].y,e[x].x-e[S].x);f[x]={x:e[x].x-Math.cos(k)*c/2,y:e[x].y-Math.sin(k)*c/2}}}let g=f.map(x=>{let[S,k]=this.xform(x.x,x.y);return{x:S,y:k}}),b=`M ${ae(g[0].x)} ${ae(g[0].y)} ${l}`;for(let x=1;x<g.length;x++)b+=` ${ae(g[x].x)} ${ae(g[x].y)}`;let v=wn({color:s,ls:o,lw:i,capstyle:a,fill:"none"});if(this.elements.push({z:n,xml:`<path d="${b}" style="${it(v)}"/>`}),h!=null){if(h.includes("<")){let x=e[0].x-e[1].x,S=e[0].y-e[1].y,k=Math.atan2(S,x)*180/Math.PI;this.arrow([e[0].x,e[0].y],k,{color:s,lw:1,zorder:n,arrowlength:c,arrowwidth:m})}else h.startsWith("o")&&this.circle(e[0].x,e[0].y,m/2,{color:s,fill:s,lw:0,zorder:n});if(h.includes(">")){let x=e.length-1,S=e.length-2,k=e[x].x-e[S].x,M=e[x].y-e[S].y,_=Math.atan2(M,k)*180/Math.PI;this.arrow([e[x].x,e[x].y],_,{color:s,lw:1,zorder:n,arrowlength:c,arrowwidth:m})}else if(h.endsWith("o")){let x=e.length-1;this.circle(e[x].x,e[x].y,m/2,{color:s,fill:s,lw:0,zorder:n})}}}arc(e,t,n,s={}){let i=s.zorder??1,o=s.color??"black",a=s.lw??2,l=s.ls??"-",h=s.fill??void 0;h==null&&(h="none");let c=s.theta1??0,m=s.theta2??90,f=s.angle??0,[g,b]=this.xform(e[0],e[1]),v=t*this.scale,x=n*this.scale;f=-f;let S=-c*Math.PI/180,k=-m*Math.PI/180,M=f*Math.PI/180;for(S=Math.atan2(v*Math.sin(S),x*Math.cos(S)),k=Math.atan2(v*Math.sin(k),x*Math.cos(k));S<k;)S+=2*Math.PI;let _=g+v/2*Math.cos(k)*Math.cos(M)-x/2*Math.sin(k)*Math.sin(M),B=b+v/2*Math.cos(k)*Math.sin(M)+x/2*Math.sin(k)*Math.cos(M),$=g+v/2*Math.cos(S)*Math.cos(M)-x/2*Math.sin(S)*Math.sin(M),Y=b+v/2*Math.cos(S)*Math.sin(M)+x/2*Math.sin(S)*Math.cos(M),Z=$-_,L=Y-B,I=wn({color:o,ls:l,lw:a,fill:h});if(Math.abs(Z)<.1&&Math.abs(L)<.1){let X=-(s.angle??0),j=X!==0?` transform="rotate(${ae(X)} ${ae(g)} ${ae(b)})"`:"";this.elements.push({z:i,xml:`<ellipse cx="${ae(g)}" cy="${ae(b)}" rx="${ae(v/2)}" ry="${ae(x/2)}"${j} style="${it(I)}"/>`})}else{let X=Math.abs(k-S)>=Math.PI?"1 1":"0 1",j=`M ${ae(_)} ${ae(B)} a ${ae(v/2)} ${ae(x/2)} ${ae(f)} ${X} ${ae(Z)} ${ae(L)}`;this.elements.push({z:i,xml:`<path d="${j}" style="${it(I)}"/>`})}if(s.arrow){let X=s.arrowwidth??.15,j=s.arrowlength??.25,re=s.angle??0,te=s.theta1??0,ke=s.theta2??90,he=re*Math.PI/180,ve=Math.cos(ke*Math.PI/180),de=Math.sin(ke*Math.PI/180),Fe=Math.atan2(t/n*de,ve)*180/Math.PI,qe=Math.cos(te*Math.PI/180),Ie=Math.sin(te*Math.PI/180),ge=Math.atan2(t/n*Ie,qe)*180/Math.PI,Me=(De,ye)=>{if(re===0)return[De,ye];let _e=De-e[0],Ae=ye-e[1];return[e[0]+_e*Math.cos(he)-Ae*Math.sin(he),e[1]+_e*Math.sin(he)+Ae*Math.cos(he)]},be=(De,ye)=>re===0?[De,ye]:[De*Math.cos(he)-ye*Math.sin(he),De*Math.sin(he)+ye*Math.cos(he)],Be=s.arrow;if(Be==="ccw"||Be==="end"||Be==="both"){let De=Math.cos((Fe+90)*Math.PI/180)*j,ye=Math.sin((Fe+90)*Math.PI/180)*j,_e=Me(e[0]+t/2*Math.cos(Fe*Math.PI/180),e[1]+n/2*Math.sin(Fe*Math.PI/180)),Ae=be(De,ye),Ze=Math.atan2(Ae[1],Ae[0])*180/Math.PI;this.arrow([_e[0]+Ae[0],_e[1]+Ae[1]],Ze,{arrowwidth:X,arrowlength:j,color:o,lw:1,zorder:i})}if(Be==="cw"||Be==="start"||Be==="both"){let De=-Math.cos((ge+90)*Math.PI/180)*j,ye=-Math.sin((ge+90)*Math.PI/180)*j,_e=Me(e[0]+t/2*Math.cos(ge*Math.PI/180),e[1]+n/2*Math.sin(ge*Math.PI/180)),Ae=be(De,ye),Ze=Math.atan2(Ae[1],Ae[0])*180/Math.PI;this.arrow([_e[0]+Ae[0],_e[1]+Ae[1]],Ze,{arrowwidth:X,arrowlength:j,color:o,lw:1,zorder:i})}}}path(e,t={}){let n=t.zorder??1,s=t.color??"black",i=t.lw??2,o=t.ls??"-",a=t.capstyle??"round",l=t.joinstyle??"round",h=t.fill??"none",c=[];for(let f of e)if(typeof f=="string")c.push(f);else{let[g,b]=this.xform(f.x,f.y);c.push(ae(g),ae(b))}let m=wn({color:s,ls:o,lw:i,capstyle:a,joinstyle:l,fill:h});this.elements.push({z:n,xml:`<path d="${c.join(" ")}" style="${it(m)}"/>`})}image(e,t,n,s,i={}){let o=i.zorder??1,a=i.rotate??0,l=n*this.scale,h=s*this.scale,[c,m]=this.xform(t[0],t[1]),f=m-h,g=e.startsWith("data:")?e:`data:image/${i.imgfmt??"png"};base64,${e}`,b=a!==0?` transform="rotate(${ae(-a)} ${ae(c)} ${ae(f+h)})"`:"";this.elements.push({z:o,xml:`<image x="${ae(c)}" y="${ae(f)}" width="${ae(l)}" height="${ae(h)}" href="${it(g)}"${b}/>`})}mathText(e,t,n,s){let i=s.zorder??3,[o,a]=this.xform(t,n),l=s.fontsize??14,h=s.color??"black",c=s.width,m=s.height,f=s.halign??"center",g=s.valign??"center",b=o,v=a;f==="center"?b-=c/2:f==="right"&&(b-=c),g==="center"?v-=m/2:g==="bottom"&&(v-=m);let x=s.rotation??0,S=x!==0?` transform="rotate(${ae(x)} ${ae(o)} ${ae(a)})"`:"",k=f==="left"?"flex-start":f==="right"?"flex-end":"center",M=g==="top"?"flex-start":g==="bottom"?"flex-end":"center",_=`<foreignObject x="${ae(b)}" y="${ae(v)}" width="${ae(c)}" height="${ae(m)}"${S}><div xmlns="http://www.w3.org/1999/xhtml" style="color:${it(h)};font-size:${l}px;display:flex;align-items:${M};justify-content:${k};width:100%;height:100%;">`+e+"</div></foreignObject>";this.elements.push({z:i,xml:_})}beginGroup(e,t){this._hasGroups=!0,this._groupStack.push({startIndex:this.elements.length,attrs:e,title:t})}endGroup(){let e=this._groupStack.pop();if(!e)throw new Error("endGroup called without matching beginGroup");let t=this.elements.splice(e.startIndex);if(t.length===0){let a=Object.entries(e.attrs).map(([h,c])=>`${h}="${it(c)}"`).join(" "),l=e.title?`<title>${it(e.title)}</title>`:"";this.elements.push({z:0,xml:`<g ${a}>${l}</g>`});return}let n=t[0].z;for(let a=1;a<t.length;a++)t[a].z<n&&(n=t[a].z);let s=t.map(a=>a.xml).join(""),i=Object.entries(e.attrs).map(([a,l])=>`${a}="${it(l)}"`).join(" "),o=e.title?`<title>${it(e.title)}</title>`:"";this.elements.push({z:n,xml:`<g ${i}>${o}${s}</g>`})}toSvgInnerXml(){return[...this.elements].sort((e,t)=>e.z-t.z).map(e=>e.xml).join("")}toSvgString(){let e=this.bbox.xmin*this.scale,t=-this.bbox.ymax*this.scale,n=this.pxwidth,s=this.pxheight,i=this.backgroundColor?` style="background-color:${it(this.backgroundColor)}"`:"",o=this.extraDefs+this.svgDefs.join("");this._hasGroups&&(o+="<style>.sd-el{cursor:pointer;transition:filter .15s ease}.sd-el:hover path,.sd-el:hover polyline,.sd-el:hover polygon,.sd-el:hover circle,.sd-el:hover ellipse{filter:drop-shadow(0 0 3px rgba(66,133,244,.6))}.sd-el.sd-selected path,.sd-el.sd-selected polyline,.sd-el.sd-selected polygon,.sd-el.sd-selected circle,.sd-el.sd-selected ellipse{stroke:#4285f4;filter:drop-shadow(0 0 4px rgba(66,133,244,.8))}</style>");let a=o?`<defs>${o}</defs>`:"",l=this.toSvgInnerXml();return`<?xml version="1.0" encoding="UTF-8"?>
268
+ <svg xmlns="http://www.w3.org/2000/svg" width="${ae(n)}pt" height="${ae(s)}pt" viewBox="${ae(e)} ${ae(t)} ${ae(n)} ${ae(s)}"${i}>${a}${l}</svg>`}};z(Ua,"totalClips",0);var g0=Ua;var E0=null,Um=!1,_l=null;function Jm(){return _l||(_l=Promise.resolve().then(()=>(Vm(),Wm)).then(r=>{E0=r.default??r}).catch(()=>{E0=null}).finally(()=>{Um=!0}),_l)}Jm();var Km=/\$([^$]+)\$/g;function va(r){return/\$[^$]+\$/.test(r)}function Bl(){return E0!==null}async function Zm(){return Um||await Jm(),E0!==null}function Cl(r,e){return E0?r.replace(Km,(t,n)=>{try{return E0.renderToString(n,{throwOnError:!1})}catch{return t}}):r}function ya(r,e){let t=r.replace(Km,(a,l)=>l),n=e*.65,s=Math.max(e*2,t.length*n+e),o=/\\frac|\\sum|\\int|\\prod|\\sqrt/.test(r)?e*2.8:e*1.8;return{width:s,height:o}}var H=[Number.NaN,Number.NaN];function Sa(r,e){return typeof r=="string"&&r.toLowerCase()==="bg"?e.bgcolor??"white":r}function Hp(r){return Array.isArray(r)?Number.isNaN(r[0])&&Number.isNaN(r[1]):!1}function Yp(r){return Hp(r)?[Number.NaN,Number.NaN]:r instanceof A?[r.x,r.y]:[r[0],r[1]]}var p=class r{constructor(e,t={}){z(this,"path");z(this,"color");z(this,"lw");z(this,"ls");z(this,"capstyle");z(this,"joinstyle");z(this,"fill");z(this,"arrow");z(this,"arrowwidth",.15);z(this,"arrowlength",.25);z(this,"zorder");z(this,"visible",!0);z(this,"clip");z(this,"role");z(this,"gradientStrokeId");this.path=e.map(Yp),Object.assign(this,t)}xform(e,t){let s=e.transformArray(this.path.map(([i,o])=>[i,o])).map(i=>[i.x,i.y]);return new r(s,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,capstyle:this.capstyle??t.capstyle,joinstyle:this.joinstyle??t.joinstyle,fill:this.fill??t.fill,arrow:this.arrow,arrowwidth:this.arrowwidth,arrowlength:this.arrowlength,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=this.path.map(s=>s[0]).filter(s=>!Number.isNaN(s)),t=this.path.map(s=>s[1]).filter(s=>!Number.isNaN(s)),n=this.arrow?this.arrowwidth??0:0;return He(Math.min(...e),Math.min(...t)-n,Math.max(...e),Math.max(...t)+n)}doreverse(e){let t=[...this.path].reverse();this.path=t.map(([n,s])=>Number.isNaN(n)&&Number.isNaN(s)?[n,s]:Sr(n,s,e)),this.arrow&&(this.arrow=this.arrow.split("").map(n=>n==="<"?">":n===">"?"<":n).join(""))}doflip(){this.path=this.path.map(([e,t])=>Number.isNaN(e)&&Number.isNaN(t)?[e,t]:kr(e,t))}draw(e,t,n){if(!this.visible)return;let s=t.transformArray(this.path.map(([S,k])=>[S,k])),i=s.map(S=>new A(S.x,S.y)),o=this.color??n.color??"black",a=this.ls??n.ls??"-",l=this.lw??n.lw??2,h=this.capstyle??n.capstyle??"round",c=this.joinstyle??n.joinstyle??"round",m=Sa(this.fill??n.fill,n),f=this.zorder??n.zorder??2,g=n._svgGradientFillId;if(m){let S=i.map(_=>`${_.x},${_.y}`),k=new Set(S);S.length!==k.size?m===!0&&(m=o):m=void 0}if(g&&m&&(m=`url(#${g})`),this.arrow?.includes("<")){let S=i[1].sub(i[0]),k=Math.atan2(S.y,S.x);i=[...i],i[0]=new A(i[0].x+this.arrowlength*Math.cos(k),i[0].y+this.arrowlength*Math.sin(k))}if(this.arrow?.includes(">")){let S=i[i.length-1].sub(i[i.length-2]),k=Math.atan2(S.y,S.x);i=[...i];let M=i.length-1;i[M]=new A(i[M].x-this.arrowlength*Math.cos(k),i[M].y-this.arrowlength*Math.sin(k))}let b=this.gradientStrokeId?`url(#${this.gradientStrokeId})`:o,v=i.map(S=>S.x),x=i.map(S=>S.y);if(e.plot(v,x,{color:b,ls:a,lw:l,capstyle:h,joinstyle:c,fill:m??"none",zorder:f}),this.arrow){let S=s.map(k=>new A(k.x,k.y));if(this.arrow.includes("<")){let k=Math.atan2(S[0].y-S[1].y,S[0].x-S[1].x)*180/Math.PI;e.arrow([S[0].x,S[0].y],k,{color:o,zorder:f,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth,lw:1})}if(this.arrow.includes(">")){let k=Math.atan2(S[S.length-1].y-S[S.length-2].y,S[S.length-1].x-S[S.length-2].x)*180/Math.PI;e.arrow([S[S.length-1].x,S[S.length-1].y],k,{color:o,zorder:f,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth,lw:1})}}}},D=class r{constructor(e,t,n={}){z(this,"center");z(this,"radius");z(this,"color");z(this,"lw");z(this,"ls");z(this,"fill");z(this,"zorder");z(this,"visible",!0);this.center=e,this.radius=t,Object.assign(this,n)}xform(e,t){let n=e.transform(this.center),s=e.zoom;if(!(s.x===s.y))throw new Error("SegmentCircle xform with non-uniform zoom not implemented in TS subset");return new r([n.x,n.y],this.radius*s.x,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,fill:this.fill??t.fill,zorder:this.zorder??t.zorder})}getBBox(){let[e,t]=this.center,n=this.radius;return He(e-n,t-n,e+n,t+n)}doreverse(e){this.center=Sr(this.center[0],this.center[1],e)}doflip(){this.center=kr(this.center[0],this.center[1])}draw(e,t,n){if(!this.visible)return;let s=n._svgGradientFillId,i=t.transform(this.center),o=this.radius*t.zoom.x,a=this.color??n.color??"black",l=this.lw??n.lw??2,h=Sa(this.fill??n.fill,n);s?h=`url(#${s})`:h===!0?h=a:h===!1&&(h="none"),h==null&&(h="none"),e.circle(i.x,i.y,o,{color:a,lw:l,ls:this.ls??n.ls,fill:h,zorder:this.zorder??n.zorder??1})}},W=class r{constructor(e,t,n={}){z(this,"xy");z(this,"text");z(this,"color");z(this,"fontsize");z(this,"fontfamily");z(this,"mathfont");z(this,"zorder");z(this,"visible",!0);z(this,"halign");z(this,"valign");z(this,"href");z(this,"decoration");z(this,"rotation");let s=e instanceof A?e:A.fromXY(e);this.xy=[s.x,s.y],this.text=t;let i=n.align;i&&(this.halign=i[0],this.valign=i[1]),Object.assign(this,n)}xform(e,t){let n=e.transform(this.xy);return new r([n.x,n.y],this.text,{color:this.color??t.color,fontsize:this.fontsize??t.fontsize,fontfamily:this.fontfamily??t.font,mathfont:this.mathfont??t.mathfont,zorder:this.zorder??t.zorder,visible:this.visible,halign:this.halign,valign:this.valign,href:this.href,decoration:this.decoration,rotation:this.rotation})}getBBox(){let e=this.fontsize??14,t=72*.5,n,s;if(va(this.text)){let c=ya(this.text,e);n=c.width/t,s=c.height/t}else{let{width:c,height:m}=b0(this.text,e,this.fontfamily);n=c/t,s=m/t}let i=this.halign??"center",o,a;i==="left"?(o=this.xy[0],a=this.xy[0]+n):i==="right"?(o=this.xy[0]-n,a=this.xy[0]):(o=this.xy[0]-n/2,a=this.xy[0]+n/2);let l=this.valign??"center",h=this.xy[1];if(l==="center")h-=s/2;else if(l==="top")h-=s;else if(l!=="bottom"){let c=this.text.split(`
269
+ `).length;h+=e*(2/72)*(c-1)}return He(o,h,a,h+s)}doreverse(e){this.xy=Sr(this.xy[0],this.xy[1],e),this.halign==="left"?this.halign="right":this.halign==="right"&&(this.halign="left")}doflip(){this.xy=kr(this.xy[0],this.xy[1]),this.valign==="top"?this.valign="bottom":this.valign==="bottom"&&(this.valign="top")}draw(e,t,n){if(!this.visible)return;let s=t.transform(this.xy),i=this.color??n.color??"black",o=this.fontsize??n.fontsize??14,a=this.fontfamily??n.font??"sans-serif",l=this.mathfont??n.mathfont,h=this.text,c=t.theta*180/Math.PI,m=this.rotation!==void 0?c+this.rotation:void 0;if(va(h)&&Bl()){let v=Cl(h,o),{width:x,height:S}=ya(h,o);e.mathText(v,s.x,s.y,{width:x,height:S,color:i,fontsize:o,halign:this.halign??"center",valign:this.valign??"center",zorder:this.zorder??n.zorder??3,rotation:m});return}let f=l!==void 0&&l!==""&&h.includes("$")?l:a,g=this.decoration?.toLowerCase(),b=g==="underline"||g==="overline"?g:void 0;e.text(this.text,s.x,s.y,{color:i,fontsize:o,fontfamily:f,halign:this.halign??"center",valign:this.valign??"center",zorder:this.zorder??n.zorder??3,href:this.href??void 0,textDecoration:b,rotation:m})}},U=class r{constructor(e,t={}){z(this,"verts");z(this,"closed",!0);z(this,"cornerradius",0);z(this,"color");z(this,"fill");z(this,"lw");z(this,"ls");z(this,"hatch");z(this,"joinstyle");z(this,"capstyle");z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.verts=e,Object.assign(this,t)}xform(e,t){let s=e.transformArray(this.verts.map(([i,o])=>[i,o])).map(i=>[i.x,i.y]);return new r(s,{closed:this.closed,cornerradius:this.cornerradius,color:this.color??t.color,fill:this.fill??t.fill,lw:this.lw??t.lw,ls:this.ls??t.ls,hatch:this.hatch,joinstyle:this.joinstyle??t.joinstyle,capstyle:this.capstyle??t.capstyle,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=this.verts.map(n=>n[0]),t=this.verts.map(n=>n[1]);return He(Math.min(...e),Math.min(...t),Math.max(...e),Math.max(...t))}doreverse(e){this.verts=[...this.verts].reverse().map(([t,n])=>Sr(t,n,e))}doflip(){this.verts=this.verts.map(([e,t])=>kr(e,t))}draw(e,t,n){if(!this.visible)return;let s=n._svgGradientFillId,i=this.fill!==void 0?this.fill:n.fill;i=Sa(i,n);let o=i===!0?n.color??"black":typeof i=="string"?i:void 0;s&&this.closed&&(o=`url(#${s})`);let a=this.color??n.color??"black",h=t.transformArray(this.verts.map(([c,m])=>[c,m])).map(c=>({x:c.x,y:c.y}));if(this.cornerradius>0){let c=gu(this.verts.map(([m,f])=>[m,f]),this.cornerradius);h=t.transformArray(c.map(m=>[m.x,m.y])).map(m=>({x:m.x,y:m.y}))}e.poly(h,{closed:this.closed,color:a,fill:o===void 0?"none":o,lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",hatch:this.hatch,capstyle:this.capstyle??n.capstyle??"round",joinstyle:this.joinstyle??n.joinstyle??"round",zorder:this.zorder??n.zorder??1})}},xe=class r{constructor(e,t,n,s={}){z(this,"center");z(this,"width");z(this,"height");z(this,"theta1");z(this,"theta2");z(this,"arrow");z(this,"arrowwidth",.15);z(this,"arrowlength",.25);z(this,"angle",0);z(this,"color");z(this,"lw");z(this,"ls");z(this,"fill");z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.center=e,this.width=t,this.height=n,this.theta1=s.theta1??35,this.theta2=s.theta2??-35,this.arrow=s.arrow,s.arrowwidth!==void 0&&(this.arrowwidth=s.arrowwidth),s.arrowlength!==void 0&&(this.arrowlength=s.arrowlength),this.angle=s.angle??0,this.color=s.color,this.lw=s.lw,this.ls=s.ls,this.fill=s.fill,this.zorder=s.zorder,this.visible=s.visible??!0,this.clip=s.clip}xform(e,t){let n=e.transform(this.center),s=this.angle+e.theta;return new r([n.x,n.y],this.width*e.zoom.x,this.height*e.zoom.y,{theta1:this.theta1,theta2:this.theta2,angle:s,arrow:this.arrow,arrowwidth:this.arrowwidth,arrowlength:this.arrowlength,color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,fill:this.fill??t.fill,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=this.theta1*Math.PI/180,t=this.theta2*Math.PI/180,n=Math.atan2(this.width*Math.sin(e),this.height*Math.cos(e)),s=Math.atan2(this.width*Math.sin(t),this.height*Math.cos(t));for(;s<n;)s+=2*Math.PI;let i=this.angle*Math.PI/180,o=this.width/2,a=this.height/2,l=50,h=[],c=[];for(let m=0;m<=l;m++){let f=n+(s-n)*m/l,g=Math.sin(f),b=Math.cos(f);h.push(this.center[0]+o*b*Math.cos(i)-a*g*Math.sin(i)),c.push(this.center[1]+o*b*Math.sin(i)+a*g*Math.cos(i))}return He(Math.min(...h),Math.min(...c),Math.max(...h),Math.max(...c))}doreverse(e){this.center=Sr(this.center[0],this.center[1],e);let t=this.theta1,n=this.theta2;this.theta1=180-n,this.theta2=180-t,this.arrow==="cw"?this.arrow="ccw":this.arrow==="ccw"&&(this.arrow="cw")}doflip(){this.center=kr(this.center[0],this.center[1]);let e=this.theta1,t=this.theta2;this.theta1=-t,this.theta2=-e,this.arrow==="cw"?this.arrow="ccw":this.arrow==="ccw"&&(this.arrow="cw")}draw(e,t,n){if(!this.visible)return;let s=t.transform(this.center),i=this.width*t.zoom.x,o=this.height*t.zoom.y;e.arc([s.x,s.y],i,o,{theta1:this.theta1,theta2:this.theta2,angle:this.angle+t.theta,color:this.color??n.color??"black",lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",fill:Sa(this.fill??n.fill,n),zorder:this.zorder??n.zorder??1,arrow:this.arrow??void 0,arrowwidth:this.arrowwidth,arrowlength:this.arrowlength})}},Ut=class r{constructor(e,t={}){z(this,"p");z(this,"color");z(this,"lw");z(this,"ls");z(this,"capstyle");z(this,"arrow");z(this,"arrowlength",.25);z(this,"arrowwidth",.15);z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.p=e,Object.assign(this,t)}xform(e,t){let s=e.transformArray(this.p.map(([i,o])=>[i,o])).map(i=>[i.x,i.y]);return new r(s,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,capstyle:this.capstyle??t.capstyle,arrow:this.arrow,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=Xp(0,1,50),t=this.p.map(o=>o[0]),n=this.p.map(o=>o[1]),s,i;return this.p.length===3?(s=e.map(o=>(1-o)**2*t[0]+2*(1-o)*o*t[1]+o**2*t[2]),i=e.map(o=>(1-o)**2*n[0]+2*(1-o)*o*n[1]+o**2*n[2])):(s=e.map(o=>(1-o)**3*t[0]+3*(1-o)**2*o*t[1]+3*(1-o)*o**2*t[2]+o**3*t[3]),i=e.map(o=>(1-o)**3*n[0]+3*(1-o)**2*o*n[1]+3*(1-o)*o**2*n[2]+o**3*n[3])),He(Math.min(...s),Math.min(...i),Math.max(...s),Math.max(...i))}doreverse(e){if(this.p=this.p.map(([t,n])=>Sr(t,n,e)),this.arrow){let t=[...this.arrow].reverse().join("");this.arrow=t.split("").map(n=>n==="<"?">":n===">"?"<":n).join("")}}doflip(){this.p=this.p.map(([e,t])=>kr(e,t))}draw(e,t,n){if(!this.visible)return;let i=t.transformArray(this.p.map(([o,a])=>[o,a])).map(o=>({x:o.x,y:o.y}));e.bezier(i,{color:this.color??n.color??"black",lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",capstyle:this.capstyle??n.capstyle??"round",zorder:this.zorder??n.zorder??1,arrow:this.arrow,arrowlength:this.arrowlength,arrowwidth:this.arrowwidth})}};function Xp(r,e,t){if(t<2)return[r];let n=(e-r)/(t-1);return Array.from({length:t},(s,i)=>r+n*i)}var ut=class r{constructor(e,t={}){z(this,"path");z(this,"color");z(this,"lw");z(this,"ls");z(this,"capstyle");z(this,"joinstyle");z(this,"fill");z(this,"zorder");z(this,"visible",!0);z(this,"clip");this.path=e,Object.assign(this,t)}xform(e,t){let n=[];for(let s of this.path)if(typeof s=="string")n.push(s);else{let i=e.transform(s);n.push([i.x,i.y])}return new r(n,{color:this.color??t.color,lw:this.lw??t.lw,ls:this.ls??t.ls,capstyle:this.capstyle??t.capstyle,joinstyle:this.joinstyle??t.joinstyle,fill:this.fill??t.fill,zorder:this.zorder??t.zorder,visible:this.visible,clip:this.clip})}getBBox(){let e=[],t=[];for(let n of this.path)typeof n!="string"&&(e.push(n[0]),t.push(n[1]));return e.length===0?He(0,0,0,0):He(Math.min(...e),Math.min(...t),Math.max(...e),Math.max(...t))}doreverse(e){}doflip(){}draw(e,t,n){if(!this.visible)return;let s=[];for(let i of this.path)if(typeof i=="string")s.push(i);else{let o=t.transform(i);s.push({x:o.x,y:o.y})}e.path(s,{color:this.color??n.color??"black",lw:this.lw??n.lw??2,ls:this.ls??n.ls??"-",capstyle:this.capstyle??n.capstyle??"round",joinstyle:this.joinstyle??n.joinstyle??"round",fill:this.fill===!0?n.color:Sa(this.fill,n),zorder:this.zorder??n.zorder??1})}},Br=class r{constructor(e,t={}){z(this,"image");z(this,"xy");z(this,"width");z(this,"height");z(this,"rotate");z(this,"imgfmt");z(this,"zorder");z(this,"visible",!0);this.image=e,this.xy=t.xy??[0,0],this.width=t.width??3,this.height=t.height??1,this.rotate=t.rotate??0,this.imgfmt=t.imgfmt,this.zorder=t.zorder}getBBox(){if(this.rotate%360===0)return He(this.xy[0],this.xy[1],this.xy[0]+this.width,this.xy[1]+this.height);let e=new A(this.xy[0],this.xy[1]).rotate(this.rotate),t=new A(this.xy[0]+this.width,this.xy[1]).rotate(this.rotate),n=new A(this.xy[0]+this.width,this.xy[1]+this.height).rotate(this.rotate),s=new A(this.xy[0],this.xy[1]+this.height).rotate(this.rotate),i=[e,t,n,s];return He(Math.min(...i.map(o=>o.x)),Math.min(...i.map(o=>o.y)),Math.max(...i.map(o=>o.x)),Math.max(...i.map(o=>o.y)))}xform(e,t){let n=e.transform(this.xy);return new r(this.image,{xy:[n.x,n.y],width:this.width*e.zoom.x,height:this.height*e.zoom.y,rotate:this.rotate+e.theta,imgfmt:this.imgfmt,zorder:this.zorder??t.zorder})}doreverse(e){}doflip(){}draw(e,t,n){if(!this.visible)return;let s=t.transform(this.xy);e.image(this.image,[s.x,s.y],this.width*t.zoom.x,this.height*t.zoom.y,{rotate:this.rotate+t.theta,zorder:this.zorder??n.zorder??1,imgfmt:this.imgfmt})}};function Gp(r,e){let t=r==null||r===""?e:r;return{bot:"bottom",lft:"left",rgt:"right",T:"top"}[t]??t}var Wp=new Set(["top","bottom","left","right","center"]);function mc(r,e){let t=(e%360+360)%360;return t<=90||t>270?r:r==="top"?"bottom":r==="bottom"?"top":r==="left"?"right":r==="right"?"left":r}function dc(r,e){if(r.rotate===!0){let t=e%360;return t<0&&(t+=360),t>90&&t<270&&(t-=180),(t%360+360)%360}return typeof r.rotate=="number"?(r.rotate%360+360)%360:0}var Vp=[["center","bottom"],["right","bottom"],["right","center"],["right","top"],["center","top"],["left","top"],["left","center"],["left","bottom"]];function pc(r,e,t,n,s,i){let o=i.xmin,a=i.ymin,l=i.xmax,h=i.ymax,c;if(typeof s=="number"?c=new A(s,s):c=s instanceof A?s:A.fromXY(s),e==="center")return{halign:"center",valign:"center",ofst:c};if(e in r.anchors){let v=r.anchors[e],x=v instanceof A?v.x:v[0],S=v instanceof A?v.y:v[1],k=.15,M="center",_="center";if(Math.abs(x-o)<k?M="right":Math.abs(x-l)<k&&(M="left"),Math.abs(S-a)<k?_="top":Math.abs(S-h)<k&&(_="bottom"),typeof s=="number"){let B=s,$=`${M},${_}`,Z={"center,bottom":[0,B],"right,bottom":[-B,B],"right,center":[-B,0],"right,top":[-B,-B],"center,top":[0,-B],"left,top":[B,-B],"left,center":[B,0],"left,bottom":[B,B]}[$]??[0,B];c=new A(Z[0],Z[1])}return{halign:M,valign:_,ofst:c}}let m=t-n;e==="left"?m+=90:e==="bottom"?m+=180:e==="right"&&(m+=270),m=(m%360+360)%360;let f=Math.round(m/360*8)%8,[g,b]=Vp[f];if(typeof s=="number"){let v=s,x,S;e==="bottom"?(x=0,S=-v):e==="left"?(x=-v,S=0):e==="right"?(x=v,S=0):(x=0,S=v),c=new A(x,S)}return{halign:g,valign:b,ofst:c}}function Up(r,e,t){if(r===void 0||typeof r=="number")return r;let n=r instanceof A?r:A.fromXY(r);return e&&(n=n.flip()),t&&(n=n.mirrorx(0)),[n.x,n.y]}function Il(r,e,t){let n=r.getBBox(!1,!1),s=n.xmin,i=n.xmax,o=n.ymin,a=n.ymax;Number.isFinite(i+s+a+o)||(s=i=o=a=.1);let l={xmin:s,xmax:i,ymin:o,ymax:a},h=(i+s)/2,c=(a+o)/2,m=r.params,f=T(m,"lblloc","top"),g=T(m,"lblofst",.1),b=T(m,"lblalign",[void 0,void 0]),v=m.flip===!0,x=m.reverse===!0,S=m.ignore_hints===!0;for(let k of t){let M=mc(Gp(k.loc,f),e),_=Array.isArray(k.text)?k.text:[k.text];if(_.length===0)continue;let B=S?void 0:r.getLabelHint(M),$=k.valign??B?.valign,Y=k.halign??B?.halign;v&&($==="top"?$="bottom":$==="bottom"&&($="top")),x&&(Y==="left"?Y="right":Y==="right"&&(Y="left"));let Z=Up(k.ofst??B?.ofst,v,x);Z===void 0&&(Z=g);let L=Y??b[0],I=$??b[1],X=dc(k,e),re=pc(r,M,e,X,Z,l),te=L??re.halign,ke=I??re.valign,he=re.ofst,ve=m._shift_magnitude;ve!==void 0&&(M==="top"||M==="bottom")&&(he=he.add(new A(ve,0)));let de;k.rotate===!0?de=0:typeof k.rotate=="number"&&(de=k.rotate);let Fe=k.fontsize??B?.fontsize??T(m,"fontsize",14),qe=k.color??T(m,"color","black"),Ie=k.font??T(m,"font","sans-serif"),ge=k.mathfont??T(m,"mathfont",void 0),Me={fontsize:Fe,color:qe,fontfamily:Ie,align:[te,ke],href:k.href??void 0,decoration:k.decoration??void 0};if(ge!==void 0&&ge!==""&&(Me.mathfont=ge),de!==void 0&&(Me.rotation=de),Array.isArray(k.text)){if(!Wp.has(M))throw new Error(`Array element labels require loc top|bottom|left|right|center (after lblloc), got ${M}`);let Be=_.length,De=(i-s)/(Be+1),ye=(a-o)/(Be+1);for(let _e=0;_e<Be;_e++){let Ae;M==="top"?Ae=new A(s+De*(_e+1),a):M==="bottom"?Ae=new A(s+De*(_e+1),o):M==="left"?Ae=new A(s,o+ye*(_e+1)):M==="right"?Ae=new A(i,o+ye*(_e+1)):Ae=new A(s+De*(_e+1),0),Ae=Ae.add(he),r.segments.push(new W([Ae.x,Ae.y],_[_e],Me))}continue}let be;if(M in r.anchors){let Be=r.anchors[M];be=new A(Be instanceof A?Be.x:Be[0],Be instanceof A?Be.y:Be[1])}else if(M==="top")be=new A(h,a);else if(M==="bottom")be=new A(h,o);else if(M==="left")be=new A(s,c);else if(M==="right")be=new A(i,c);else if(M==="center")be=new A(h,c);else throw new Error(`Unknown label location ${M}`);be=be.add(he),r.segments.push(new W([be.x,be.y],_[0],Me))}}function Ll(r,e){let t=[],n=T(r,"lblloc","top"),s=T(r,"fontsize",14),i=r.color??"black",o=r.lblrotate===!0,a=r.mathfont!=null&&r.mathfont!==""?String(r.mathfont):void 0,l=(h,c)=>{if(h!=null)if(Array.isArray(h)){if(h.length===0)return;t.push({text:h.map(String),loc:c,fontsize:s,color:i,rotate:o?!0:void 0,mathfont:a})}else h!==""&&t.push({text:String(h),loc:c,fontsize:s,color:i,rotate:o?!0:void 0,mathfont:a})};return r.toplabel!=null&&l(r.toplabel,"top"),r.botlabel!=null&&l(r.botlabel,"bottom"),r.lftlabel!=null&&l(r.lftlabel,"left"),r.rgtlabel!=null&&l(r.rgtlabel,"right"),r.clabel!=null&&l(r.clabel,"center"),r.label!=null&&l(r.label,n),t}function Jp(r){(r instanceof p||r instanceof D||r instanceof W||r instanceof U||r instanceof xe||r instanceof Ut||r instanceof ut||r instanceof Br)&&r.doflip()}function Kp(r,e){(r instanceof p||r instanceof D||r instanceof W||r instanceof U||r instanceof xe||r instanceof Ut||r instanceof ut||r instanceof Br)&&r.doreverse(e)}function fc(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}var gc=["start","end","center","istart","iend","N","S","E","W","NE","NW","SE","SW","NNE","NNW","ENE","WNW","SSE","SSW","ESE","WSW"],N=class r{constructor(e={}){z(this,"userParams",{});z(this,"elmParams",{});z(this,"dwgParams",{});z(this,"defaults",{});z(this,"segments",[]);z(this,"anchors",{});z(this,"absanchors",{});z(this,"transform");z(this,"absdrop");z(this,"_positioned",!1);z(this,"_localshift",new A(0,0));z(this,"bbox",He(0,0,0,0));z(this,"userLabels",[]);z(this,"_labelhints",{});z(this,"_segmentCountBeforeLabels",0);Object.assign(this.userParams,e),At(this)}get params(){let e=f0();return Mr(this.userParams,this.elmParams,this.defaults,this.dwgParams,e)}getAbsAnchor(e){return this.absanchors[e]}getAnchorNamesForGetattr(){let e=new Set(gc);for(let t of Object.keys(this.anchors))e.add(t);return[...e]}touchAnchorAccess(e){e in this.absanchors||this.getAnchorNamesForGetattr().includes(e)&&At(this)}resolveAnchor(e){return this.touchAnchorAccess(e),this.getAbsAnchor(e)}_position(){let e=this.userParams.at;if(Array.isArray(e)&&e.length===2&&typeof e[1]=="string"&&e[0]instanceof r){let t=e[0],n=e[1];if(!(n in t.absanchors))throw new Error(`Unknown anchor name ${n}`);let s=t.absanchors[n];this.userParams.at=[s.x,s.y]}this._flipreverse(),this._positioned=!0}_flipreverse(){if(this.userParams.flip===!0){for(let e of this.segments)Jp(e);for(let e of Object.keys(this.anchors)){let t=A.fromXY(fc(this.anchors[e]));this.anchors[e]=t.flip().toTuple()}}if(this.userParams.reverse===!0){let e;if(this.anchors.center!==void 0)e=fc(this.anchors.center)[0];else{let t=this.getBBox(!1,!1);e=(t.xmin+t.xmax)/2}for(let t of this.segments)Kp(t,e);for(let t of Object.keys(this.anchors)){let n=A.fromXY(fc(this.anchors[t]));this.anchors[t]=n.mirrorx(e).toTuple()}}}up(){return this.userParams.d="up",this}down(){return this.userParams.d="down",this}left(){return this.userParams.d="left",this}right(){return this.userParams.d="right",this}theta(e){return this.userParams.theta=e,this}drop(e){return this.userParams.drop=e,this}at(e,t=0,n=0){if(Array.isArray(e)&&e.length===2&&typeof e[1]=="string"&&e[0]instanceof r){if(t!==0||n!==0)throw new Error("dx and dy must be zero when at is [Element, anchorName]");this.userParams.at=e}else{let s=A.fromXY(e);this.userParams.at=[s.x+t,s.y+n]}return this}scale(e=1){return this.userParams.zoom=new A(e,e),this}scalex(e=1){let t=this.userParams.zoom,n=new A(1,1);return typeof t=="number"?n=new A(t,t):t instanceof A?n=t:Array.isArray(t)&&t.length>=2&&(n=new A(Number(t[0]),Number(t[1]))),this.userParams.zoom=new A(e,n.y),this}scaley(e=1){let t=this.userParams.zoom,n=new A(1,1);return typeof t=="number"?n=new A(t,t):t instanceof A?n=t:Array.isArray(t)&&t.length>=2&&(n=new A(Number(t[0]),Number(t[1]))),this.userParams.zoom=new A(n.x,e),this}flip(){return this.userParams.flip=!0,this}reverse(){return this.userParams.reverse!==void 0?this.userParams.reverse=!this.userParams.reverse:this.userParams.reverse=!0,this}anchor(e){return this.userParams.anchor=e,this}color(e){return Vr(e),this.userParams.color=e,this}linestyle(e){return Wa(e),this.userParams.ls=e,this}linewidth(e){return this.userParams.lw=e,this}fill(e=!0){return Vr(e),this.userParams.fill=e,this}zorder(e){return this.userParams.zorder=e,this}hold(){return this.userParams.move_cur=!1,this}style(e){return e.color!==void 0&&this.color(e.color),e.fill!==void 0&&this.fill(e.fill),e.ls!==void 0&&this.linestyle(e.ls),e.lw!==void 0&&(this.userParams.lw=e.lw),this}fontsize(e){return this.userParams.fontsize=e,this}font(e){return this.userParams.font=e,this}mathfont(e){return this.userParams.mathfont=e,this}gradientFill(e,t,n=!0){return this.userParams.gradient=[e,t,n],this}label(e,t={}){return this.userLabels.push({text:e,...t}),this}getLabelHint(e){return this._labelhints[e]}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this._segmentCountBeforeLabels===0&&(this._segmentCountBeforeLabels=this.segments.length),this.segments.splice(this._segmentCountBeforeLabels);let s=T(this.params,"anchor",void 0),i=this.params.zoom??this.params.scale??1,o=typeof i=="number"?new A(i,i):Array.isArray(i)?new A(i[0],i[1]):i,a=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),l;if(this.params.endpts!==void 0)l=t;else if(this.params.d!==void 0){let f=this.params.d;if(/^-?\d+(\.\d+)?$/.test(String(f).replace("-","")))l=Number(f);else{let g=String(f).toLowerCase()[0];l={u:90,r:0,l:180,d:270}[g]??0}}else l=this.params.theta??t;if(s!==void 0){let f=this.anchors[s];if(f===void 0)throw new Error(`Unknown anchor ${s}`);let g=f instanceof A?f.x:f[0],b=f instanceof A?f.y:f[1];this._localshift=new A(-g,-b)}this.transform=new p0(l,[a.x,a.y],this._localshift.toTuple(),o);let h=[...Ll(this.params,l),...this.userLabels];h.length>0&&Il(this,l,h);for(let[f,g]of Object.entries(this.anchors)){let b=g instanceof A?g.x:g[0],v=g instanceof A?g.y:g[1];this.absanchors[f]=this.transform.transform([b,v])}this.absanchors.xy=this.transform.transform([0,0]);let c=this.params.drop,m=f=>{if(f instanceof A)return[f.x,f.y];if(Array.isArray(f)&&f.length>=2)return[Number(f[0]),Number(f[1])];throw new Error("invalid drop")};if(c!==void 0&&typeof c=="string"&&c in this.anchors){let f=this.anchors[c],g=f instanceof A?f.x:f[0],b=f instanceof A?f.y:f[1];this.absdrop={point:this.transform.transform([g,b]),theta:l}}else c!=null&&this.params.move_cur!==!1?this.params.droptheta!==void 0?this.absdrop={point:this.transform.transform(m(c)),theta:this.params.droptheta}:this.params.theta===0?this.absdrop={point:this.transform.transform(m(c)),theta:t}:this.absdrop={point:this.transform.transform(m(c)),theta:l}:this.absdrop={point:A.fromXY(e),theta:t};return this.bbox=this.getBBox(!1,!1),this.absdrop}getBBox(e,t=!0){let n=1/0,s=1/0,i=-1/0,o=-1/0;for(let a of this.segments){if(!t&&a instanceof W)continue;let l;e?l=a.xform(this.transform,this.params).getBBox():l=a.getBBox(),n=Math.min(n,l.xmin),s=Math.min(s,l.ymin),i=Math.max(i,l.xmax),o=Math.max(o,l.ymax)}return He(n,s,i,o)}_draw(e){this.segments.length===0&&this._place([0,0],0,{});for(let t of this.segments)t instanceof p?t.draw(e,this.transform,this.params):t instanceof D?t.draw(e,this.transform,this.params):t instanceof W?t.draw(e,this.transform,this.params):t instanceof U?t.draw(e,this.transform,this.params):t instanceof xe?t.draw(e,this.transform,this.params):t instanceof Ut?t.draw(e,this.transform,this.params):t instanceof ut?t.draw(e,this.transform,this.params):t instanceof Br&&t.draw(e,this.transform,this.params)}};var P0=class r extends N{constructor(t,n={}){super(n);this.parent=t;z(this,"inner",[]);Object.assign(this.defaults,{cornerradius:.3,padx:.75,pady:.75,theta:0,anchor:"boxNW"})}container(t={}){return new r(this,{...t})}add(t){return this.inner.push(t),this.parent.add(t),t}containsElement(t){return this.inner.includes(t)}enter(){Xa(this)}exit(){At(this),Ga(this)}containerBBox(t=!0){let n=1/0,s=1/0,i=-1/0,o=-1/0;for(let a of this.inner){let l=a.getBBox(t,!1);n=Math.min(n,l.xmin),s=Math.min(s,l.ymin),i=Math.max(i,l.xmax),o=Math.max(o,l.ymax)}return Number.isFinite(n)?He(n,s,i,o):He(0,0,0,0)}getBBox(t,n=!0){let s=this.containerBBox(t),i=T(this.params,"padx",.75),o=T(this.params,"pady",.75);return He(s.xmin-i,s.ymin-o,s.xmax+i,s.ymax+o)}_place(t,n,s){this.dwgParams={...s};let i=this.containerBBox(!1),o=T(this.params,"padx",.75),a=T(this.params,"pady",.75),l=i.xmax-i.xmin+o*2,h=i.ymax-i.ymin+a*2,c=T(this.params,"cornerradius",0);return this.elmParams.at=[i.xmin-o,i.ymax+a],this.segments=[],c>0?this.segments.push(new U([[0,h/2],[l,h/2],[l,-h/2],[0,-h/2]],{closed:!0,cornerradius:c})):this.segments.push(new p([[0,0],[0,h/2],[l,h/2],[l,-h/2],[0,-h/2],[0,0]])),this.anchors.center=[l/2,0],this.anchors.boxNW=[0,h/2],this.anchors.N=[l/2,h/2],this.anchors.E=[l,0],this.anchors.S=[l/2,-h/2],this.anchors.W=[0,0],super._place(t,n,s)}};function bc(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Zp(r,e,t,n){let s=n?"0%":"100%",i=n?"100%":"0%";return`<linearGradient id="${bc(r)}" x1="0%" y1="0%" x2="${s}" y2="${i}"><stop offset="0%" stop-color="${bc(e)}"/><stop offset="100%" stop-color="${bc(t)}"/></linearGradient>`}function Qm(r){let e=[],t=0,n=[];for(let s of r){let o=Mr(s.userParams,s.elmParams,s.defaults,s.dwgParams).gradient;if(o&&Array.isArray(o)&&o.length>=2){let a=`sdg${t++}`;e.push(Zp(a,String(o[0]),String(o[1]),o[2]!==!1)),s.elmParams._svgGradientFillId=a,n.push(()=>{delete s.elmParams._svgGradientFillId})}}return{defsXml:e.join(""),cleanup:()=>{for(let s of n)s()}}}function wc(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}var e1={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",gray:"#808080",grey:"#808080",silver:"#c0c0c0",maroon:"#800000",navy:"#000080"};function t1(r){let e=r.trim().toLowerCase();if(e1[e])return e1[e];if(e.startsWith("#"))return e.length===4&&e[1]&&e[2]&&e[3]?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:(e.length===7,e);let t=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);if(t){let n=Number(t[1]).toString(16).padStart(2,"0"),s=Number(t[2]).toString(16).padStart(2,"0"),i=Number(t[3]).toString(16).padStart(2,"0");return`#${n}${s}${i}`}return e}function Qp(r,e){return t1(r)===t1(e)}function r1(r){return Mr(r.userParams,r.elmParams,r.defaults,r.dwgParams).color??"black"}var e2=new Set(["xy","center","istart","iend","mid","label","vd","vs","n1","n2","n1a","n2a"]);function t2(r){return!e2.has(r)}function n1(r){let e=[];for(let[t,n]of Object.entries(r.absanchors))t2(t)&&e.push(n);return e}function o1(r){let e=[],t=new Set,n=.5;for(let s=0;s<r.length;s++){let i=r[s],o=r1(i),a=n1(i);if(a.length!==0)for(let l=s+1;l<r.length;l++){let h=r[l],c=r1(h);if(Qp(o,c))continue;let m=n1(h);if(m.length!==0)for(let f of a){for(let g of m){if(Math.hypot(f.x-g.x,f.y-g.y)>n)continue;let b=`${s}|${l}`;if(!t.has(b)){t.add(b),e.push({elA:i,elB:h,colorA:o,colorB:c,junctionPt:f});break}}if(t.has(`${s}|${l}`))break}}}return e}function Dl(r){return Number.isInteger(r)?String(r):r.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}function a1(r,e,t){if(e.length===0)return{defsXml:"",cleanup:()=>{}};let n=[],s=[],i=0;for(let o of e){let a=s1(o.elA,o.junctionPt),l=s1(o.elB,o.junctionPt);if(!a&&!l||a?.gradientStrokeId&&l?.gradientStrokeId)continue;let h,c,m,f;if(a&&l){let b=Nl(o.elA,a,t),v=Nl(o.elB,l,t),x=i1(o.elA,a,o.junctionPt,t),S=i1(o.elB,l,o.junctionPt,t);h=x.farX,c=x.farY,m=S.farX,f=S.farY}else if(a){let b=Nl(o.elA,a,t);h=b.x1,c=b.y1,m=b.x2,f=b.y2}else{let b=Nl(o.elB,l,t);h=b.x1,c=b.y1,m=b.x2,f=b.y2}if(n2({x1:h,y1:c,x2:m,y2:f})<1e-6)continue;let g=`sd-trans-${i++}`;n.push(s2(g,h,c,m,f,o.colorA,o.colorB)),a&&!a.gradientStrokeId&&(a.gradientStrokeId=g,s.push(()=>{a.gradientStrokeId=void 0})),l&&!l.gradientStrokeId&&(l.gradientStrokeId=g,s.push(()=>{l.gradientStrokeId=void 0}))}return{defsXml:n.join(""),cleanup:()=>{for(let o of s)o()}}}function s1(r,e){for(let i of r.segments)if(i instanceof p&&!(i.role!=="lead1"&&i.role!=="lead2")&&r2(r,i,e,.6))return i;let n,s=1/0;for(let i of r.segments){if(!(i instanceof p)||i.path.length<2||i.role==="body"||i.path.length>6)continue;let o=l1(r,i,e);o<s&&o<.6&&(s=o,n=i)}return n}function r2(r,e,t,n){return l1(r,e,t)<n}function l1(r,e,t){let n=r.transform.transform(e.path[0]),s=r.transform.transform(e.path[e.path.length-1]);return Math.min(Math.hypot(n.x-t.x,n.y-t.y),Math.hypot(s.x-t.x,s.y-t.y))}function i1(r,e,t,n){let s=r.transform.transform(e.path[0]),i=r.transform.transform(e.path[e.path.length-1]),o=Math.hypot(s.x-t.x,s.y-t.y),a=Math.hypot(i.x-t.x,i.y-t.y),l=o>a?s:i;return{farX:l.x*n,farY:-l.y*n}}function Nl(r,e,t){let n=r.transform.transform(e.path[0]),s=r.transform.transform(e.path[e.path.length-1]);return{x1:n.x*t,y1:-n.y*t,x2:s.x*t,y2:-s.y*t}}function n2(r){return Math.hypot(r.x2-r.x1,r.y2-r.y1)}function s2(r,e,t,n,s,i,o){return`<linearGradient id="${wc(r)}" gradientUnits="userSpaceOnUse" x1="${Dl(e)}" y1="${Dl(t)}" x2="${Dl(n)}" y2="${Dl(s)}"><stop offset="0%" stop-color="${wc(i)}"/><stop offset="100%" stop-color="${wc(o)}"/></linearGradient>`}function i2(r,e){let t=r;for(;t;){if(Object.prototype.hasOwnProperty.call(t,e)||Object.getOwnPropertyDescriptor(t,e)!==void 0)return!0;t=Object.getPrototypeOf(t)}return!1}var lr=class{constructor(e={}){z(this,"elements",[]);z(this,"anchors",{});z(this,"svgdefs",[]);z(this,"dwgparams",{});z(this,"_here",new A(0,0));z(this,"_theta",0);z(this,"_state",[]);z(this,"outfile");z(this,"_elementMeta",new Map);let t=f0();return this.dwgparams=oa(t,e),e.file!==void 0&&(this.outfile=e.file),o2(this)}setElementMeta(e,t){this._elementMeta.set(e,t)}getElementMeta(e){return this._elementMeta.get(e)}get here(){return At(null),this._here}set here(e){At(null),this._here=e instanceof A?e:A.fromXY(e)}get theta(){return At(null),this._theta}set theta(e){this._theta=e}get unit(){return this.dwgparams.unit??3}set unit(e){this.dwgparams.unit=e}getAnchor(e){let t=this.anchors[e];return t===void 0?void 0:new A(t[0],t[1])}enter(){Xa(this)}exit(){At(null),Ga(this)}containsElement(e){return this.elements.includes(e)}add(e){let t=e._place(this._here.toTuple(),this._theta,this.dwgparams);return this.elements.push(e),this._here=t.point,this._theta=t.theta,e}undo(){if(this.elements.pop(),this.elements.length>0){let e=this.elements[this.elements.length-1];this._here=e.absdrop.point,this._theta=e.absdrop.theta}else this._here=new A(0,0),this._theta=0}config(e){this.dwgparams=oa(this.dwgparams,e)}addElements(...e){for(let t of e)this.add(t)}container(e){return new P0(this,{...e??{}})}move(e=0,t=0){this._here=this._here.add([e,t])}moveFrom(e,t=0,n=0,s){this._here=e.add([t,n]),s!==void 0&&(this._theta=s)}push(){this._state.push([new A(this._here.x,this._here.y),this._theta])}pop(){let e=this._state.pop();e!==void 0&&(this._here=e[0],this._theta=e[1])}withHold(e){this.push();try{return e()}finally{this.pop()}}hold(){this.push();let e=this;return{close:()=>{e.pop()}}}addSvgDef(e){this.svgdefs.push(e)}setAnchor(e){this.anchors[e]=this._here.toTuple()}getSegments(){let e=[];for(let t of this.elements){let n=Mr(t.userParams,t.elmParams,t.defaults);for(let s of t.segments)e.push(s.xform(t.transform,n))}return e}async save(e){try{let{writeFileSync:t}=await import("node:fs");t(e,this.toSvgString(),"utf8")}catch(t){throw t instanceof Error&&/Cannot find module|not supported|Failed to resolve|dynamically imported module|Module not found/.test(t.message)?new Error("Drawing.save() requires Node.js. In the browser, use drawing.toSvgString() instead."):t}}getBBox(){let e=1/0,t=1/0,n=-1/0,s=-1/0;for(let i of this.elements){let o=i.getBBox(!0,!0);e=Math.min(e,o.xmin),t=Math.min(t,o.ymin),n=Math.max(n,o.xmax),s=Math.max(s,o.ymax)}return Number.isFinite(e)?He(e,t,n,s):He(0,0,0,0)}toSvgString(){let e=this.getBBox(),{defsXml:t,cleanup:n}=Qm(this.elements),s="",i=()=>{};if(this.dwgparams.colorTransition){let o=this.dwgparams.inches_per_unit??.5,a=72*o,l=o1(this.elements),h=a1(this.elements,l,a);s=h.defsXml,i=h.cleanup}try{let o=[this.svgdefs.join(""),t,s].filter(h=>h.length>0),a=new g0(e,{inchesPerUnit:this.dwgparams.inches_per_unit,margin:this.dwgparams.margin,extraDefs:o.length>0?o.join(""):void 0}),l=this.dwgparams.bgcolor;l&&a.bgcolor(l);for(let h of this.elements){let c=this._elementMeta.get(h);if(this.dwgparams.interactive&&c){let m={"data-id":c.id,"data-type":c.type,class:"sd-el"};c.tooltip&&(m["data-tooltip"]=c.tooltip);let f=c.tooltip||`${c.id} \u2014 ${c.type}`;a.beginGroup(m,f)}h._draw(a),this.dwgparams.interactive&&c&&a.endGroup()}return a.toSvgString()}finally{n(),i()}}getImageData(e="svg"){if((typeof e=="string"?e.toLowerCase():String(e).toLowerCase())!=="svg")throw new Error(`@skillpet/circuit: getImageData('${e}') is not supported; only SVG bytes are available in this build.`);return new TextEncoder().encode(this.toSvgString())}};function o2(r){return new Proxy(r,{get(e,t,n){if(typeof t=="symbol")return Reflect.get(e,t,n);if(!i2(e,t)&&t in e.anchors){let s=e.anchors[t];return new A(s[0],s[1])}return Reflect.get(e,t,n)}})}function h1(r,e){let t=new lr(e??{});t.enter();try{r(t)}finally{t.exit()}return t}function xc(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}var se=class extends N{_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=T(this.params,"unit",3),i=T(this.params,"l",s),o=this.params.endpts,a=this.params.to,l=this.params.tox,h=this.params.toy,c=this.params.anchor,m=this.params.zoom??this.params.scale??1,f=typeof m=="number"?m:Array.isArray(m)?m[0]:m.x,g=A.fromXY(this.params.at!==void 0?this.params.at:e),b=this.params.theta!==void 0?this.params.theta:t;if(o!==void 0)b=ia(o[0],o[1]);else if(a!==void 0)b=ia(g,a);else if(this.params.d!==void 0){let M=String(this.params.d);if(/^-?\d+(\.\d+)?$/.test(M.replace("-","")))b=Number(M);else{let _=M.toLowerCase()[0];b={u:90,r:0,l:180,d:270}[_]??0}}if(this.elmParams.theta=b,o!==void 0&&(g=A.fromXY(o[0])),o!==void 0)i=Qs(o[0],o[1]);else if(a!==void 0)i=Qs(g,a);else if(l!==void 0){let M=typeof l=="number"?l:l[0],_=this.params.theta;if(_!==void 0){let B=g.x-M,$=Math.tan(_*Math.PI/180)*B;i=Math.hypot(B,$)}else{let B=new A(M,g.y);i=Qs(g,B),b=g.x>M?180:0,this.elmParams.theta=b}}else if(h!==void 0){let M=typeof h=="number"?h:h[1],_=this.params.theta;if(_!==void 0){let B=g.y-M,$=B/Math.tan(_*Math.PI/180);i=Math.hypot($,B)}else{let B=new A(g.x,M);i=Qs(g,B),b=g.y>M?-90:90,this.elmParams.theta=b}}let v=this.segments[0];if(!(v instanceof p))throw new Error("Element2Term requires first segment to be Segment");this.anchors.istart=v.path[0],this.anchors.iend=v.path[v.path.length-1];let x,S;if(T(this.params,"extend",!0)){let M=v.path,_=qa(M[M.length-1],M[0]),B=Math.hypot(_.x,_.y),$;try{let Y=m,Z=typeof Y=="number"?Y:Y.x;$=(i-B*Z)/2/Z}catch{$=(i-B*f)/2/f}if($>0){let Z=T(this.params,"shift",0)*$;this.elmParams._shift_magnitude=Z;let L=A.fromXY(M[0]),I=A.fromXY(M[M.length-1]);x=L.sub([$+Z,0]),S=I.add([$-Z,0]),this._localshift=x.neg();let X={color:v.color,lw:v.lw,ls:v.ls,capstyle:v.capstyle,joinstyle:v.joinstyle,fill:v.fill,zorder:v.zorder},j=new p([[x.x,x.y],[L.x,L.y]],{...X});j.role="lead1";let re=M.map(de=>[de[0],de[1]]),te=new p(re,{...X});te.role="body";let ke=new p([[I.x,I.y],[S.x,S.y]],{...X});ke.role="lead2";let he=this.params.leadcolor;B>0&&he&&(j.color=he,ke.color=he);let ve=this.segments.indexOf(v);this.segments.splice(ve,1,j,te,ke)}else x=A.fromXY(M[0]),S=A.fromXY(M[M.length-1]),this._localshift=new A(0,0)}else x=A.fromXY(v.path[0]),S=A.fromXY(v.path[v.path.length-1]);let k=T(this.params,"dotradius",.075);if(this.params.dot){let _=this.params.dot==="open"?"bg":!0;this.segments.push(new D([S.x,S.y],k,{fill:_,zorder:3}))}if(this.params.idot){let _=this.params.idot==="open"?"bg":!0;this.segments.push(new D([x.x,x.y],k,{fill:_,zorder:3}))}if(this.placeAnchors(x,S),c!==void 0){let M=this.anchors[c];if(M===void 0)throw new Error(`Unknown anchor ${c}`);let _=M instanceof A?M.x:M[0],B=M instanceof A?M.y:M[1];this._localshift=this._localshift.sub([_,B])}return this.elmParams.drop=[S.x,S.y],super._place(e,t,n)}placeAnchors(e,t){this.anchors.start=[e.x,e.y],this.anchors.end=[t.x,t.y],this.anchors.center=[(e.x+t.x)/2,(e.y+t.y)/2]}to(e,t=0,n=0){let s=A.fromXY(xc(e));return this.userParams.to=[s.x+t,s.y+n],this}tox(e){return this.userParams.tox=e,this}toy(e){return this.userParams.toy=e,this}length(e){return this.userParams.l=e,this}endpoints(e,t){return this.userParams.endpts=[xc(e),xc(t)],this}dot(e=!1){return this.userParams.dot=e?"open":!0,this}idot(e=!1){return this.userParams.idot=e?"open":!0,this}shift(e){return this.userParams.shift=e,this}up(e){return this.userParams.d="up",e!==void 0&&(this.userParams.l=e),this}down(e){return this.userParams.d="down",e!==void 0&&(this.userParams.l=e),this}left(e){return this.userParams.d="left",e!==void 0&&(this.userParams.l=e),this}right(e){return this.userParams.d="right",e!==void 0&&(this.userParams.l=e),this}};var Ol=class extends N{constructor(t,n={}){super(n);z(this,"drawing");this.drawing=t,this.segments=t.getSegments();for(let[i,o]of Object.entries(t.anchors))this.anchors[i]=[o[0],o[1]];let s=t.here;this.elmParams.drop=[s.x,s.y],this.elmParams.d="right"}};var rn=1,Pn=.65,vc=.12,Bt=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{leadin:.35,leadout:.35});let t=e.inputs??2,n=e.nand??!1,s=T(this.params,"leadin",.35),i=T(this.params,"leadout",.35),o=rn/2,a=ze(-Math.PI/2,Math.PI/2,50),l=a.map(b=>o*Math.cos(b)+Pn+s),h=a.map(b=>o*Math.sin(b)),c=l.map((b,v)=>[b,h[v]]);c.push([Pn+s,o],[s,o],[s,0],[s,-o],[Pn+s,-o]),this.segments.push(new p(c)),this.anchors.out=[Pn+rn/2+s+i,0],this.anchors.end=this.anchors.out,n&&this.segments.push(new D([s+Pn+rn/2+vc,0],vc));let m;t===2?m=rn*.5:t===3?m=rn*.33:m=rn*.4;for(let b=0;b<t;b++){let v=(b+1-(t/2+.5))*m,x=t-b;this.anchors[`in${x}`]=[0,v],this.segments.push(new p([[0,v],[s,v]]))}let f=n?Pn+rn/2+s+vc*2:Pn+rn/2+s;this.segments.push(new p([[f,0],[Pn+rn/2+s+i,0]]));let g=this.segments[this.segments.length-1];if(g instanceof p){let b=g.path[g.path.length-1];this.elmParams.drop=[b[0],b[1]]}}};function Tn(r){return new Bt({...r,nand:!0})}var yc=1,a2=.65,Sc=.12,l2=.5,c1=.15,$t=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{leadin:.35,leadout:.35});let t=e.inputs??2,n=e.nor??!1,s=e.xor??!1,i=T(this.params,"leadin",.35),o=T(this.params,"leadout",.35),a=i-(s?c1:0),l=ze(0,a2+.05,50),h=l.map(L=>L*L),c=Math.max(...h);h=h.map(L=>L-c),h=[Math.min(...h),...h];let m=[0,...l.map(L=>L+l2)],f=Math.min(...h),g=ze(f,-f,50),b=g.map(L=>-L*L),v=Math.min(...b);b=b.map(L=>L-v);let x=m.map(L=>L+i),S=b.map(L=>L+i),k=Math.max(...x),M=Math.abs(f),_=h.map(L=>-L),B=[...x.map((L,I)=>[L,h[I]]),...[...x].reverse().map((L,I)=>{let X=_.length-1-I;return[L,_[X]]}),...[...S].reverse().map((L,I)=>[L,g[g.length-1-I]])];if(this.segments.push(new p(B)),this.anchors.out=[k+o,0],this.anchors.end=this.anchors.out,s){let L=S.map(I=>I-c1);this.segments.push(new p(L.map((I,X)=>[I,g[X]])))}n&&this.segments.push(new D([k+Sc,0],Sc));let $,Y=0;t===2?$=yc*.5:t===3?$=yc*.33:($=yc*.4,Y=$*(t-1));for(let L=0;L<t;L++){let I=(L+1-(t/2+.5))*$,X=a-I*I-v;t>3&&(I>M||I<-M)&&(X=a);let j=t-L;this.anchors[`in${j}`]=[0,I],this.segments.push(new p([[0,I],[X,I]]))}t>3&&(this.segments.push(new p([[a,Y/2+$/2],[a,M]])),this.segments.push(new p([[a,-Y/2-$/2],[a,-M]]))),n?this.segments.push(new p([[k+Sc*2,0],[k+o,0]])):this.segments.push(new p([[k,0],[k+o,0]]));let Z=this.segments[this.segments.length-1];if(Z instanceof p){let L=Z.path[Z.path.length-1];this.elmParams.drop=[L[0],L[1]]}}};function Rn(r){return new $t({...r,nor:!0})}function An(r){return new $t({...r,xor:!0})}function _n(r){return new $t({...r,nor:!0,xor:!0})}var T0=1,r0=.65,Fl=.12,Jt=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[r0,0]])),this.segments.push(new p([[0,T0/2],[r0,0],[0,-T0/2],[0,T0/2]])),this.anchors.out=[r0,0],this.anchors.in1=[0,0]}},Kt=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[r0+Fl*2,0]])),this.segments.push(new p([[0,T0/2],[r0,0],[0,-T0/2],[0,T0/2]])),this.segments.push(new D([r0+Fl,0],Fl)),this.anchors.out=[r0+Fl*2,0],this.anchors.in1=[0,0]}};var kc=1,hr=.65,R0=.12,Bn=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{outputnot:!0,control:!1});let t=T(this.params,"outputnot",!0),n=T(this.params,"control",!1);t?(this.segments.push(new p([[0,0],H,[hr+R0*2,0]])),this.segments.push(new D([hr+R0,0],R0))):this.segments.push(new p([[0,0],H,[hr,0]])),this.segments.push(new p([[0,kc/2],[hr,0],[0,-kc/2],[0,kc/2]])),n?(this.segments.push(new D([hr/2,.42],R0)),this.segments.push(new p([[hr/2,.42+R0],[hr/2,.7]]))):this.segments.push(new p([[hr/2,.28],[hr/2,.7]])),this.anchors.out=[hr+R0*2,0],this.anchors.in1=[0,0],this.anchors.c=[hr/2,.7]}};var A0=class extends N{constructor(e={}){let{names:t,truthtable:n,groups:s,default:i,...o}=e;super(o);let a=t??"ABCD",l=n??[],h=s??{},c=i??"0",m=o.lw??1.25,f,g;if(a.length===4)f=4,g=4;else if(a.length===3)f=2,g=4;else if(a.length===2)f=2,g=2;else throw new Error("Kmap requires 2 to 4 variable names");let b=1,v=g*b,x=f*b,S=[0,1,3,2],k={lw:m};this.segments.push(new p([[0,0],[v,0],[v,x],[0,x],[0,0]],k));for(let j=0;j<f;j++)this.segments.push(new p([[0,j*b],[v,j*b]],k));for(let j=0;j<g;j++)this.segments.push(new p([[j*b,0],[j*b,x]],k));let M=b/Math.SQRT2;this.segments.push(new p([[0,x],[-M,x+M]],k));let _=f>2?2:1,B=g>2?2:1,$=a.length>2?a.slice(0,2):a[0],Y=a.length>2?a.slice(2):a[1];this.segments.push(new W([0,x+3*M/4],$,{align:["right","bottom"],fontsize:12})),this.segments.push(new W([-(3*M)/4,x],Y,{align:["right","bottom"],fontsize:12}));for(let j=0;j<g;j++){let re=S[j];this.segments.push(new W([re*b+b/2,x+b/20],$l(j,B),{align:["center","bottom"],fontsize:10}))}for(let j=0;j<f;j++){let re=S[j];this.segments.push(new W([-b/10,x-re*b-b/2],$l(j,_),{align:["right","center"],fontsize:10}))}let Z=l.map(j=>j[0]),L=l.map(j=>j[1]);for(let j=0;j<g;j++){let re=S[j];for(let te=0;te<f;te++){let ke=S[te],he=$l(j,B)+$l(te,_),ve=Z.indexOf(he),de=ve===-1?c:String(L[ve]);this.segments.push(new W([re*b+b/2,x-ke*b-b/2],de,{align:["center","center"],fontsize:12})),this.anchors[`cell${he}`]=[re*b+b/2,x-ke*b-b/2]}}let I=.1,X={0:0,1:1,".":0,"..":0,"00":0,"01":1,10:3,11:2,".0":3,".1":1,"0.":0,"1.":2};for(let[j,re]of Object.entries(h)){let te=$.length,ke=Y.length,he=j.slice(0,te),ve=j.slice(te),de=Math.pow(2,te-u1(he)),Fe=Math.pow(2,ke-u1(ve)),qe=X[he]??0,Ie=X[ve]??0,ge=qe*b,Me=ge+de*b,be=x-Ie*b,Be=be-Fe*b,De=[];qe+de<=g&&Ie+Fe<=f?De=[[[ge+I,be-I],[Me-I,be-I],[Me-I,Be+I],[ge+I,Be+I]]]:Ie+Fe<=f?De=[[[ge+I,be-I],[ge+b+I,be-I],[ge+b+I,Be+I],[ge+I,Be+I]],[[-I,be-I],[b-I,be-I],[b-I,Be+I],[-I,Be+I]]]:qe+de<=g?De=[[[ge+I,be-I],[Me-I,be-I],[Me-I,be-b-I],[ge+I,be-b-I]],[[ge+I,x+I],[Me-I,x+I],[Me-I,x-b+I],[ge+I,x-b+I]]]:De=[[[ge+I,be-I],[ge+b+I,be-I],[ge+b+I,be-b-I],[ge+I,be-b-I]],[[-I,be-I],[b-I,be-I],[b-I,be-b-I],[-I,be-b-I]],[[-I,x+I],[b-I,x+I],[b-I,x-b+I],[-I,x-b+I]],[[ge+I,x+I],[ge+b+I,x+I],[ge+b+I,x-b+I],[ge+I,x-b+I]]];let ye=re.lw??1;for(let _e of De)this.segments.push(new U(_e,{cornerradius:.25,color:re.color,fill:re.fill,lw:ye,ls:re.ls}))}}};function $l(r,e){return r.toString(2).padStart(e,"0")}function u1(r){let e=0;for(let t of r)(t==="0"||t==="1")&&e++;return e}function m1(r){return r.replace(/[2-9]|=|x/g,"V").replace(/u/g,"1").replace(/d/g,"0").replace(/[nN]/g,"1").replace(/[pP]/g,"0").replace(/[lL]/g,"0").replace(/[hH]/g,"1")}function d1(r){let e=[];for(let t of r)typeof t!="string"&&(Array.isArray(t)?e.push(...d1(t)):typeof t=="object"&&t!==null&&e.push(t));return e}function Rc(r){let e=ze(0,1,10),t=e.map(n=>r*Math.exp(-n*6));return{xs:e,ys:t}}var Mc=class{constructor(e,t,n,s=.1,i=.2){z(this,"y0");z(this,"height");z(this,"curve1x");z(this,"curve2x");z(this,"extend");z(this,"rate",25);this.y0=t,this.extend=s,this.height=n-t,this.curve1x=e-i*this.height/2,this.curve2x=e+i*this.height/2}curve(e){let t=this.height*(1+this.extend*2),n=this.height*this.extend,s=ze(-.15,.15),i=s.map(a=>1/(1+Math.exp(-a*this.rate))*t-n),o=e==="left"?this.curve1x:this.curve2x;return{xs:s.map(a=>a+o),ys:i.map(a=>a+this.y0)}}};function h2(r,e,t){let n=new Mc(r,e,t),s=n.curve("left"),i=n.curve("right"),o=s.xs.map((l,h)=>[l,s.ys[h]]),a=i.xs.map((l,h)=>[l,i.ys[h]]);return[new p(o,{lw:1,zorder:3}),new p(a,{lw:1,zorder:3}),new U([...o,...[...a].reverse()],{zorder:3,color:"none",fill:"white",lw:1,closed:!1})]}var nn=class{constructor(e){z(this,"params");z(this,"x0");z(this,"xend");z(this,"y0");z(this,"y1");z(this,"y1_prev");z(this,"pstate");z(this,"nstate");z(this,"plevel");z(this,"rise");z(this,"xrise");z(this,"xrisehalf");z(this,"yhalf");z(this,"xcenter");z(this,"xtext");z(this,"kwargs");this.params=e,this.x0=e.x0,this.xend=e.xend,this.y0=e.y0,this.y1=e.y1,this.y1_prev=e.y1_prev,this.pstate=e.pstate,this.nstate=e.nstate,this.plevel=e.plevel,this.rise=e.rise,this.xrise=this.x0+this.rise,this.xrisehalf=this.x0+this.rise/2,this.yhalf=(this.y0+this.y1)/2,this.xcenter=(this.x0+this.xend)/2,this.xtext=this.xcenter+this.rise/2,this.kwargs=e.kwargs}vertsIn(){return{"-":[[this.x0,this.y0]],"|":[[this.x0,this.y0]],0:[[this.x0,this.y0],[this.xrisehalf,this.yhalf],[this.xrise,this.y0]],1:[[this.x0,this.y1],[this.xrise,this.y0]],z:[[this.x0,this.yhalf],[this.xrisehalf,this.y0]],V:[[this.xrise,this.y0]]}[this.plevel]??[]}vertsOut(){return[[this.xend,this.y0]]}segments(){let e=[...this.vertsIn(),...this.vertsOut()];return[new p(e,this.kwargs)]}},jl=class extends nn{vertsIn(){return"pP".includes(this.params.pstate)?[[this.x0,this.y0]]:[[this.x0,this.y1],[this.x0,this.y0]]}segments(){let e=super.segments();return this.params.state==="L"&&e.push(new p([[this.x0,this.yhalf+.25/2],[this.x0,this.yhalf-.25/2]],{arrow:"->",arrowwidth:.12,arrowlength:.25})),e}},ka=class extends nn{vertsIn(){return{"-":[[this.x0,this.y1]],h:[[this.x0,this.y1]],H:[[this.x0,this.y1]],l:[[this.x0,this.y1]],L:[[this.x0,this.y1]],0:[[this.x0,this.y0],[this.xrise,this.y1]],1:this.y1_prev!==this.y1?[[this.x0,this.y1_prev],[this.xrise,this.y1]]:[[this.x0,this.y1],[this.xrisehalf,this.yhalf],[this.xrise,this.y1]],z:[[this.x0,this.yhalf],[this.xrisehalf,this.y1]],V:[[this.xrise,this.y1]]}[this.plevel]??[]}vertsOut(){return[[this.xend,this.y1]]}},ql=class extends ka{vertsIn(){return"nN".includes(this.params.pstate)?[[this.x0,this.y1]]:[[this.x0,this.y0],[this.x0,this.y1]]}segments(){let e=super.segments();return this.params.state==="H"&&e.push(new p([[this.x0,this.yhalf-.25/2],[this.x0,this.yhalf+.25/2]],{arrow:"->",arrowwidth:.12,arrowlength:.25})),e}},zc=class extends nn{vertsIn(){let{xs:e,ys:t}=Rc((this.y1-this.y0)/2),n=t.map(a=>this.yhalf+a),s=t.map(a=>this.yhalf-a),i=e.map(a=>this.x0+a*this.rise*6);return{"-":[[this.x0,this.yhalf]],0:i.map((a,l)=>[a,s[l]]),1:i.map((a,l)=>[a,n[l]]),z:[[this.x0,this.yhalf]],V:[[this.xrise+this.rise,this.yhalf]]}[this.plevel]??[]}vertsOut(){return[[this.xend,this.yhalf]]}},Ec=class extends nn{vertsIn(){return{"-":[[this.x0,this.y1],[this.x0,this.y0]],"|":[[this.x0,this.y1],[this.x0,this.y0]],0:[[this.xrise,this.y1],[this.x0,this.y0]],1:[[this.x0,this.y1],[this.xrise,this.y0]],z:[[this.xrise,this.y1],[this.xrisehalf,this.yhalf],[this.xrise,this.y0]],V:[[this.xrise,this.y1],[this.xrisehalf,this.yhalf],[this.xrise,this.y0]]}[this.plevel]??[]}vertsOut(){let e="=23456789x".includes(this.nstate)?"V":this.nstate;return{0:[[this.xend+this.rise,this.y0],[this.xend,this.y1]],L:[[this.xend,this.y0],[this.xend,this.y1]],l:[[this.xend,this.y0],[this.xend,this.y1]],1:[[this.xend,this.y0],[this.xend+this.rise,this.y1]],H:[[this.xend,this.y0],[this.xend,this.y1]],h:[[this.xend,this.y0],[this.xend,this.y1]],z:[[this.xend,this.y0],[this.xend,this.y1]],V:[[this.xend,this.y0],[this.xend+this.rise/2,this.yhalf],[this.xend,this.y1]],"-":[[this.xend,this.y0],[this.xend,this.y1]],n:[[this.xend,this.y0],[this.xend,this.y1]],p:[[this.xend,this.y0],[this.xend,this.y1]],N:[[this.xend,this.y0],[this.xend,this.y1]],P:[[this.xend,this.y0],[this.xend,this.y1]]}[e]??[]}fillOpts(){return{fill:{3:"#feffc2",4:"#ffe2ba",5:"#abd9ff",6:"#bdfbff",7:"#bdffcb",8:"#e3a5fa",9:"#f7b7bd"}[this.params.state],hatch:this.params.state==="x"}}segments(){let{fill:e,hatch:t}=this.fillOpts(),n=[],s="-|".includes(this.pstate),i="-|".includes(this.nstate);return s&&i?(n.push(new p([[this.x0,this.y0],[this.xend,this.y0]],this.kwargs)),n.push(new p([[this.x0,this.y1],[this.xend,this.y1]],this.kwargs)),n.push(new U([[this.x0,this.y0],[this.xend,this.y0],[this.xend,this.y1],[this.x0,this.y1]],{color:"none",fill:e,hatch:t}))):s?n.push(new U([[this.x0,this.y0],...this.vertsOut(),[this.x0,this.y1]],{closed:!1,fill:e,hatch:t,...this.kwargs})):i?n.push(new U([[this.xend,this.y1],...this.vertsIn(),[this.xend,this.y0]],{closed:!1,fill:e,hatch:t,...this.kwargs})):n.push(new U([...this.vertsIn(),...this.vertsOut()],{fill:e,hatch:t,...this.kwargs})),this.params.data.length>0&&this.params.state!=="x"&&(n.push(new W([this.xtext,this.yhalf],this.params.data[0],{color:this.params.datacolor,fontsize:11,align:["center","center"]})),this.params.data.shift()),n}},Pc=class extends ka{vertsIn(){let{xs:e,ys:t}=Rc(this.y1-this.y0),n=e.map(a=>this.x0+a*this.rise*6),s=t.map(a=>this.y1-a),i=t.map(a=>this.y1-a/2);return{"-":[[this.x0,this.y1]],0:n.map((a,l)=>[a,s[l]]),1:[[this.x0,this.y1]],z:n.map((a,l)=>[a,i[l]]),V:[[this.xrise,this.y1]]}[this.plevel]??[]}segments(){let e=this.vertsIn();return[new p(e,this.kwargs),new p([e[e.length-1],[this.xend,this.y1]],{...this.kwargs,ls:":"})]}},Tc=class extends nn{vertsIn(){let{xs:e,ys:t}=Rc(this.y1-this.y0),n=e.map(a=>this.x0+a*this.rise*6),s=t.map(a=>this.y0+a),i=t.map(a=>this.y0+a/2);return{"-":[[this.x0,this.y0]],0:[[this.x0,this.y0]],1:n.map((a,l)=>[a,s[l]]),z:n.map((a,l)=>[a,i[l]]),V:[[this.x0,this.y0]]}[this.plevel]??[]}segments(){let e=this.vertsIn();return[new p(e,this.kwargs),new p([e[e.length-1],[this.xend,this.y0]],{...this.kwargs,ls:":"})]}},_0=class extends nn{vertsIn(){let e=this.params.state,t=this.params.period,n=this.y1,s=this.y0;"nN".includes(e)&&([n,s]=[s,n]);let i=[];for(let o=0;o<this.params.periods;o++)i.push([this.x0+t*o,s],[this.x0+t*o,n],[this.x0+t*o+t/2,n],[this.x0+t*o+t/2,s]);return"nN".includes(e)&&"lL".includes(this.params.pstate)||"pP".includes(e)&&"hH".includes(this.params.pstate)?i.slice(1):i}vertsOut(){let e="nN".includes(this.params.state)?this.y1:this.y0;return[[this.xend,e]]}segments(){let e=super.segments();if("NP".includes(this.params.state)){let t=this.params.period,n=.25,s=.12,i=this.yhalf-n/2,o=this.yhalf+n/2;this.params.state==="P"&&([i,o]=[o,i]);for(let a=0;a<this.params.periods;a++){let l=this.x0+t*a;e.push(new p([[l,o],[l,i]],{arrow:"->",arrowwidth:s,arrowlength:n,...this.kwargs}))}}return e}},c2={0:nn,1:ka,H:ql,h:ql,L:jl,l:jl,z:zc,u:Pc,d:Tc,n:_0,p:_0,N:_0,P:_0},n0=class extends N{constructor(t,n={}){super(n);z(this,"waveData");z(this,"yheight");z(this,"ygap");z(this,"risetime");z(this,"_fontSize");z(this,"namecolor");z(this,"datacolor");z(this,"gridcolor");z(this,"tickcolor");z(this,"edgecolor");z(this,"hscale");z(this,"showGrid");this.waveData=t,this.yheight=n.yheight??.5,this.ygap=n.ygap??.3,this.risetime=n.risetime??.15,this._fontSize=n.fontsize??12,this.namecolor=n.namecolor??"blue",this.datacolor=n.datacolor,this.gridcolor=n.gridcolor??"#DDDDDD",this.tickcolor=n.tickcolor??"#888888",this.edgecolor=n.edgecolor??"blue",this.showGrid=n.grid??!0;let s=this.waveData.signal??[],i=d1(s),o=this.waveData.config??{};this.hscale=o.hscale??1;let a=this.waveData.head??{},l=this.waveData.foot??{},h=(this.yheight+this.ygap)*i.length,c=0;for(let g of i)c=Math.max(c,(g.wave??"").length);this.showGrid&&this._drawGrid(c,h);let m=He(0,this.yheight+.05,c*this.yheight*2*this.hscale,-h),f=0;for(let g of i)this._drawName(g.name??"",f),this._drawWave(g,f,m),f-=this.yheight+this.ygap;this._drawEdges(i),this._drawHeadFoot(a,l,c,f),this.anchors.topleft=[0,0]}_drawGrid(t,n){for(let s=0;s<=t;s++){let i=s*2*this.yheight*this.hscale;this.segments.push(new p([[i,this.yheight+this.ygap/2],[i,this.yheight-n]],{ls:":",lw:1,color:this.gridcolor,zorder:0}))}}_drawName(t,n){if(!t)return;let s=.2;this.segments.push(new W([-s,n],t,{align:["right","bottom"],fontsize:this._fontSize,color:this.namecolor}))}_drawWave(t,n,s){let i=t.wave??"";if(!i)return;let o=t.phase??0,a=t.level??"0",l=t.risetime??this.risetime,h={color:t.color??void 0,lw:t.lw??1,clip:s},c=t.data?Array.isArray(t.data)?[...t.data]:t.data.split(" "):[];a.length===1?a=a.repeat(i.length):a.length<i.length&&(a+=a[a.length-1].repeat(i.length-a.length));let m=2*this.yheight*(t.period??1)*this.hscale,f=this.yheight,g=0,b="-",v=n+f,x=-m*o;for(;g<i.length;){let S=i[g],k=[],M=1,_=parseInt(a[g],10);!isNaN(_)&&_>0&&(f=_/10*this.yheight),f===0&&(f=this.yheight);let B=g+1;for(;B<i.length&&(i[B]==="|"||i[B]===".");)i[B]==="|"&&k.push(M),M++,B++;let $=B<i.length?i[B]:"-",Y=n+f,Z=x+M*m,L={state:S,pstate:b,nstate:$,plevel:m1(b),nlevel:m1($),periods:M,period:m,x0:x,xend:Z,y0:n,y1:Y,y1_prev:v,rise:l,data:c,datacolor:this.datacolor,kwargs:h},I=c2[S]??Ec;this.segments.push(...new I(L).segments());for(let X of k)this.segments.push(...h2(x+(X+1)*m-m/2,n,Y));b=S,v=Y,x+=M*m,g=B}}_drawEdges(t){let n=this.waveData.edge??[];if(n.length===0)return;let s=2*this.yheight*this.hscale;for(let i of n){let o="";if(i.includes(" ")){let m=i.indexOf(" ");o=i.slice(m+1),i=i.slice(0,m)}let a=i.match(/\{(.*?)\}/),l=this.edgecolor;a&&(l=a[1].split(",")[0]||l,i=i.replace(/\{.*?\}/,""));let h;i.includes("<")&&i.includes(">")?h="<>":i.includes("<")?h="<":i.includes(">")&&(h=">");let c=i.match(/\[(.+?)\]/g);if(c&&c.length===2){let m=[];for(let f of c){let g=f.slice(1,-1),b=g.indexOf(":"),v=g.slice(0,b),x=g.slice(b+1),S=parseInt(v.replace(/[^0-9]/g,""),10),k=parseFloat(x),M=this.yheight/2;v.includes("^")?M=this.yheight+.2:v.includes("v")&&(M=-.2);let _=t[S]?.phase??0,B=k*s-s*_,$=-S*(this.yheight+this.ygap)+M;m.push([B,$])}if(m.length===2&&(this.segments.push(new p(m,{lw:1,color:l,arrow:h,zorder:3})),o)){let f=(m[0][0]+m[1][0])/2,g=(m[0][1]+m[1][1])/2;this.segments.push(new W([f,g],o,{fontsize:8,color:l,align:["center","center"],zorder:4}))}}else if(i.length>=3){let m=i[0],f=i[i.length-1],g=this.anchors[`node_${m}`],b=this.anchors[`node_${f}`];if(g&&b){let v=k=>k instanceof A?[k.x,k.y]:[k[0],k[1]],x=v(g),S=v(b);if(this.segments.push(new p([x,S],{lw:1,color:l,arrow:h,zorder:3})),o){let k=(x[0]+S[0])/2,M=(x[1]+S[1])/2;this.segments.push(new W([k,M],o,{fontsize:8,color:l,align:["center","center"],zorder:4}))}}}}}_drawHeadFoot(t,n,s,i){if(t.tick!==void 0||t.tock!==void 0){let o=t.tick??t.tock??0,a=t.every??1,l=t.tick!==void 0?0:this.hscale/2;for(let h=0;h<s;h+=a){let c=(l+h*this.hscale)*2*this.yheight;this.segments.push(new W([c,this.yheight+this.ygap],String(o+h),{color:this.tickcolor,fontsize:this._fontSize,align:["center","bottom"]}))}}if(n.tick!==void 0||n.tock!==void 0){let o=n.tick??n.tock??0,a=n.every??1,l=n.tick!==void 0?0:this.hscale/2;for(let h=0;h<s;h+=a){let c=(l+h*this.hscale)*2*this.yheight;this.segments.push(new W([c,i+this.yheight],String(o+h),{color:this.tickcolor,fontsize:this._fontSize,align:["center","top"]}))}}}};var Ac=2/72*(3/4),u2={1:"#dadada",2:"#f2dbdc",3:"#ecf2da",4:"#e2f2ee",5:"#f2eddb",6:"#e2f2db",7:"#dee5f2",8:"#f2d6ff",9:"#feffdb"};function Hl(r){return r===!0||r===1||r==="true"||r==="True"}var s0=class extends N{constructor(e,t={}){super(t),this.defaults={bitheight:.625,width:15,fontsize:12,lw:1,ygap:null,vflip:!1,hflip:!1,compact:!1},this.anchors.origin=[0,0];let n=e.reg??[],s=e.config??{},i=s.fontsize??this.params.fontsize??12,o=Hl(s.hflip??this.params.hflip),a=Hl(s.vflip??this.params.vflip),l=Hl(s.compact??this.params.compact),h=n.reduce((X,j)=>X+(j.bits??0),0),c=this.params.lblofst??.1,m;s.vspace!==void 0?m=(s.vspace??30)*Ac:m=this.params.bitheight??.625;let f;s.hspace!==void 0?f=(s.hspace??800)*Ac:f=this.params.width??15;let g=s.lanes??1,b=this.params.ygap;if(b==null){b=0;for(let X of n){let j=X.attr??[];(typeof j=="number"||typeof j=="string")&&(j=[j]);let re=(j.length+1.5)*Ac*1.5*i;b=Math.max(b,re)}}let v;s.bits!==void 0?(h=s.bits,v=h/g):g>1?(h%2!==0&&(h+=1),v=s.bits??h/g):v=h;let x=null,S=null,k=s.label;if(k){if(k.left!==void 0)if(typeof k.left=="number")x=Array.from({length:g},(X,j)=>String(j+k.left));else if(typeof k.left=="string")x=Array(g).fill(k.left);else{let X=k.left,j=X.length;x=[...X,...Array.from({length:g-j},(re,te)=>String(te+j))]}if(k.right!==void 0)if(typeof k.right=="number")S=Array.from({length:g},(X,j)=>String(j+k.right));else if(typeof k.right=="string")S=Array(g).fill(k.right);else{let X=k.right,j=X.length;S=[...X,...Array.from({length:g-j},(re,te)=>String(te+j))]}}let M=f/v,_=m,B=0,$=_/8,Y=0,Z=a?-1:1,L=0,I=this.params.lw??1;for(let X=0;X<g;X++){x&&this.segments.push(new W([-c,L+_/2],x[X],{fontsize:i,align:["right","center"]})),S&&this.segments.push(new W([f+c,L+_/2],S[X],{fontsize:i,align:["left","center"]}));let j=a?0:f,re=L+_/2,te=0;for(;te<v&&Y<n.length;){let he=n[Y],ve=he.bits??1,de=B||ve,Fe=he.attr,qe=he.rotate??0,Ie=he.name??"",ge=he.type,Me=he.scale??1,be=Hl(he.number??!0);if(de+te>v){let ye=v-te;B=de-ye,de=ye}else B=0;let Be=j-Z*de*M/2*Me,De=j;if(j-=de*M*Z*Me,this.segments.push(new U([[j,L+_],[j,L],[De,L],[De,L+_]],{lw:I})),ge!==void 0||!Ie){let ye;ge==null||String(ge).length===1?ye=u2[String(ge)]??"#dadada":ye=String(ge),this.segments.push(new U([[j,L+_],[j,L],[De,L],[De,L+_]],{lw:0,color:"none",fill:ye,zorder:0}))}for(let ye=0;ye<de-1;ye++){let _e=j+(ye+1)*Z*M*Me;this.segments.push(new p([[_e,L+_],[_e,L+_-$]],{lw:I})),this.segments.push(new p([[_e,L],[_e,L+$]],{lw:I}))}if(Ie){this.segments.push(new W([Be,re],Ie,{fontsize:i,align:["center","center"],rotation:-qe}));let ye=Ie.replace(/[^a-zA-Z0-9_]/g,"_");this.anchors[`field_${ye}`]=[Be,re]}if(be&&(o&&X===0||!o&&X===g-1||!l))if(de>1){let ye=X*v+te,_e=X*v+te+de-1,Ae=ye<100&&M/2*Me>.22,Ze=_e<100&&M/2*Me>.22,bn=Ae?Z*M/2*Me:.12;this.segments.push(new W([De-bn,L+_+c],String(ye),{fontsize:i,align:[Ae?"center":"right","bottom"]}));let ft=Ze?Z*M/2*Me:.12;this.segments.push(new W([j+ft,L+_+c],String(_e),{fontsize:i,align:[Ze?"center":"left","bottom"]}))}else this.segments.push(new W([Be,L+_+c],String(X*v+te+de-1),{fontsize:i,align:["center","bottom"]}));if(Fe!=null){let ye;if(typeof Fe=="string"||typeof Fe=="number"?ye=[Fe]:ye=Fe,typeof ye[0]=="string"){let _e=ye.join(`
270
270
  `);this.segments.push(new W([Be,L-c],_e,{fontsize:i,align:["center","top"]}))}else{let Ae=ye.map(Ze=>Ze<0?Ze+(1<<ve):Ze).map(Ze=>Ze.toString(2).padStart(ve,"0"));for(let Ze=0;Ze<de;Ze++){let bn=de+B-Ze-1,Rt=Ae.map(Te=>Te[bn]).join(`
271
- `);this.segments.push(new W([De-Z*M*Ze-Z*M/2,L-c],Rt,{fontsize:i,align:["center","top"]}))}}}te+=de,B||(Y+=1)}let ke=l?_:_+b;o?L-=ke:L+=ke}}};var i0=1,lt=.65,sn=.12;function m1(r){let e=r.replace(/\|\|/g,"\u01C1");for(;;){let s=e.replace(/([lcr])([lcr])/g,"$1.$2");if(s===e)break;e=s}!e.startsWith("|")&&!e.startsWith("\u01C1")&&(e="."+e),!e.endsWith("|")&&!e.endsWith("\u01C1")&&(e+=".");let t="",n="";for(let s=0;s<e.length;s++)s%2===0?t+=e[s]:n+=e[s];return{justs:n,bars:t}}var B0=class extends N{constructor(e){super(e);let t=e.table,n=e.fontsize??12,s=e.font??"sans",i=.03,o=.3,a=.4,l=t.trim().split(`
272
- `),h="";for(let L of l)L.includes("---")?h+="|":L.includes("===")?h+="\u01C1":h+="l";let{justs:c,bars:m}=m1(h),f=L=>L.replace(/^\|?\s*|\s*\|?$/g,""),g=l.filter(L=>!L.includes("---")&&!L.includes("===")),b=f(g[0]).split("|").length,x=e.colfmt;(x==null||x==="")&&(x="c".repeat(b));let{justs:v,bars:S}=m1(x),k=v.length,M=c.length;if(f(g[0]).split("|").length!==k)throw new Error("Number of columns in table does not match colfmt string.");let _=new Array(k).fill(0),B=new Array(M).fill(0);for(let L=0;L<g.length;L++){let I=f(g[L]).split("|").map(X=>X.trim());for(let X=0;X<I.length;X++){let{width:j,height:re}=b0(I[X],n,s);_[X]=Math.max(_[X],j/72*2+a),B[L]=Math.max(B[L],re/72*2+o)}}let $=B.reduce((L,I)=>L+I,0),Y=_.reduce((L,I)=>L+I,0),Z=(L,I)=>L.slice(0,I).reduce((X,j)=>X+j,0);for(let L=0;L<S.length;L++){let I=Z(_,L);S[L]==="|"?this.segments.push(new p([[I,0],[I,-$]],{lw:1})):S[L]==="\u01C1"&&(this.segments.push(new p([[I-i,0],[I-i,-$]],{lw:1})),this.segments.push(new p([[I+i,0],[I+i,-$]],{lw:1})))}for(let L=0;L<m.length;L++){let I=-Z(B,L);m[L]==="|"?this.segments.push(new p([[0,I],[Y,I]],{lw:1})):m[L]==="\u01C1"&&(this.segments.push(new p([[0,I-i],[Y,I-i]],{lw:1})),this.segments.push(new p([[0,I+i],[Y,I+i]],{lw:1})))}for(let L=0;L<g.length;L++){let I=f(g[L]).split("|").map(X=>X.trim());for(let X=0;X<I.length;X++){let j=Z(_,X),re=-Z(B,L)-B[L],te={c:"center",l:"left",r:"right"}[v[X]]??"center";te==="center"?j+=_[X]/2:te==="right"?j+=_[X]-a/2:j+=a/2,this.segments.push(new W([j,re+o/3],I[X],{fontfamily:s,fontsize:n,align:[te,"bottom"]})),this.anchors[`cell${L}_${X}`]=[j,re+B[L]/2]}}}},C0=class extends se{constructor(e={}){super(e),this.segments.push(new p([[-sn*2,0],H,[lt+sn*2,0]])),this.segments.push(new p([[0,i0/2],[lt,0],[0,-i0/2],[0,i0/2]])),this.segments.push(new D([lt+sn,0],sn)),this.segments.push(new D([lt+sn,0],sn)),this.segments.push(new D([-sn,0],sn)),this.anchors.out=[lt+sn*2,0],this.anchors.in1=[0,0]}},I0=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[lt,0]])),this.segments.push(new p([[0,0],[0,-i0/2],[lt,0],[0,i0/2],[0,0]])),this.segments.push(new p([[lt,0],[lt,-i0/2],[0,0],[lt,i0/2],[lt,0]])),this.segments.push(new D([lt/2,.28+.08],.08)),this.segments.push(new p([[lt/2,.28+.16],[lt/2,.7]])),this.segments.push(new p([[lt/2,-.28],[lt/2,-.7]])),this.anchors.out=[lt,0],this.anchors.in1=[0,0],this.anchors.c=[lt/2,-.7],this.anchors.cbar=[lt/2,.7]}},Bc=(r=0)=>new p([[r+.07,-.15],[r+.25,-.15],[r+.25,.15],H,[r+.33,.15],[r+.15,.15],[r+.15,-.15]],{lw:1}),L0=class extends Jt{constructor(e={}){super(e),this.segments.push(Bc())}},D0=class extends Kt{constructor(e={}){super(e),this.segments.push(Bc())}},o0=class extends Bt{constructor(e={}){super(e);let n=T(this.params,"leadin",.35)+lt/2;this.segments.push(Bc(n))}};function Yl(r){return new o0({...r,nand:!0})}var F=.25,Ye=.16666666666666666;var Cr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{polar:!1});let t=.18;this.segments.push(new p([[0,0],H,[0,.25],[0,-.25],H,[t,.25],[t,-.25],H,[t,0]])),T(this.params,"polar",!1)&&this.segments.push(new W([-t*1.2,t],"+"))}},Cn=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{polar:!1});let t=.18;this.segments.push(new p([[0,0],H,[0,.25],[0,-.25],H,[t,0]])),this.segments.push(new xe([t*1.5,0],t*1.5,.25*2.5,{theta1:105,theta2:-105})),T(this.params,"polar",!1)&&this.segments.push(new W([-t*1.2,t],"+"))}},In=class extends Cr{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=T(this.params,"arrowwidth",.16),i=T(this.params,"arrowlength",.2),o=T(this.params,"arrow_lw",void 0),a=T(this.params,"arrow_color",void 0);this.segments.push(new p([[-2*t,-n],[3*t,t*2]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Ln=class extends Cr{constructor(e={}){super(e),Object.assign(this.defaults,{trim_lw:void 0,trim_color:void 0});let t=.18,n=Ye,s=.25,i=[-1.8*n,-s],o=[1.8*n+t,s],a=o[0]-i[0],l=o[1]-i[1],h=.14,c=Math.atan2(l,a)+Math.PI/2,m=[o[0]+h*Math.cos(c),o[1]+h*Math.sin(c)],f=[o[0]+h*Math.cos(c-Math.PI),o[1]+h*Math.sin(c-Math.PI)],g=T(this.params,"trim_lw",void 0),b=T(this.params,"trim_color",void 0);this.segments.push(new p([i,o],{lw:g,color:b})),this.segments.push(new p([m,f],{lw:g,color:b}))}};var et=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],H,[t,.25],[t,-.25],H,[t,0]])),this.segments.push(new U([[0,.25],[t,0],[0,-.25]],{closed:!0,fill:!1}))}},Dn=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t-n,.25],[t-n,.25-n]])),this.segments.push(new p([[t,-.25],[t+n,-.25],[t+n,-.25+n]]))}},Nn=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t+n,.25+n]])),this.segments.push(new p([[t,-.25],[t-n,-.25-n]]))}};var On=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t-n,.25]])),this.segments.push(new p([[t,-.25],[t-n,-.25]]))}},Fn=class extends se{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[0,0],H,[2*t,0]])),this.segments.push(new U([[0,.25],[t,0],[0,-.25]],{closed:!0,fill:!1})),this.segments.push(new U([[t,0],[t*2,.25],[t*2,-.25]],{closed:!0,fill:!1})),this.segments.push(new p([[t+n,.25],[t,.25],[t,-.25],[t-n,-.25]]))}},$n=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],[t,0],[t,.25],[t,-.25],H,[t,0]])),this.segments.push(new p([[0,-.25],[0,.25],[t,0]]))}},jn=class extends se{constructor(e={}){super(e);let t=.13,n=.25*1.4;this.segments.push(new p([[0,0],H,[n,.25],[n,-.25],H,[n+t,.25],[n+t,-.25],H,[n+t,0]])),this.segments.push(new U([[0,.25],[n,0],[0,-.25]],{closed:!0,fill:!1}))}},qn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=T(this.params,"arrowwidth",.16),s=T(this.params,"arrowlength",.2),i=T(this.params,"arrow_color",void 0);this.segments.push(new p([[t,t*1.5],[t*2,t*3.25]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[t*.1,t*1.5],[t*1.1,t*3.25]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Hn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=T(this.params,"arrowwidth",.16),s=T(this.params,"arrowlength",.2),i=T(this.params,"arrow_color",void 0),o=T(this.params,"arrow_lw",void 0),a=ze(-1,1),l=a.map(x=>-x*(x-.7)*(x+.7)/2+t*2.5),h=ze(t*.75,t*1.25,a.length),c=20,m=h.map((x,v)=>{let S=A.fromXY([x,l[v]]).rotate(c,[0,0]);return[S.x,S.y]}),f=h.map((x,v)=>{let S=A.fromXY([x-.2,l[v]]).rotate(c,[0,0]);return[S.x,S.y]});this.segments.push(new p(m,{lw:o,color:i})),this.segments.push(new p(f,{lw:o,color:i}));let g=A.fromXY([h[0],l[0]+.1]).rotate(c,[0,0]),b=A.fromXY([h[0]-.2,l[0]+.1]).rotate(c,[0,0]);this.segments.push(new p([[m[1][0],m[1][1]],[g.x,g.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[f[1][0],f[1][1]],[b.x,b.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Yn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=T(this.params,"arrowwidth",.16),s=T(this.params,"arrowlength",.2),i=T(this.params,"arrow_color",void 0),o=T(this.params,"arrow_lw",void 0),a=ze(-1,1),l=a.map(v=>-v*(v-.7)*(v+.7)/2+t*2.5),h=ze(t*.75,t*1.25,a.length),c=20,m=h.map((v,S)=>{let k=A.fromXY([v,l[S]]).rotate(c,[0,0]);return[k.x,k.y]}),f=h.map((v,S)=>{let k=A.fromXY([v-.2,l[S]]).rotate(c,[0,0]);return[k.x,k.y]});this.segments.push(new p(m,{lw:o,color:i})),this.segments.push(new p(f,{lw:o,color:i}));let g=A.fromXY([h[h.length-1],l[l.length-1]-.1]).rotate(c,[0,0]),b=A.fromXY([h[h.length-1]-.2,l[l.length-1]-.1]).rotate(c,[0,0]),x=m.length;this.segments.push(new p([[m[x-2][0],m[x-2][1]],[g.x,g.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[f[x-2][0],f[x-2][1]],[b.x,b.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Xn=class extends et{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[t,0],[t+.3,-.3],[t+.3,-.5]])),this.anchors.gate=[t+.3,-.5]}},on=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],H,[t,.25*1.8],[t,-.25*1.8],H,[0,.25*1.8],[0,-.25*1.8],H,[t,0]])),this.segments.push(new U([[0,-.25-.25],[t,-.25],[0,-.25+.25]],{closed:!0,fill:!1})),this.segments.push(new U([[t,.25+.25],[0,.25],[t,.25-.25]],{closed:!0,fill:!1}))}},Gn=class extends on{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[t,.25],[t+.5,.5]])),this.anchors.gate=[t+.5,.5]}};var Wn=.25;function Vn(r=4,e=[0,0],t=.06,n=.19,s=!0,i=!1,o=!1){let a=Math.acos(t/n),l=ze(a,2*(r+1)*Math.PI-a,r*50),h=l.map(v=>t*v-n*Math.sin(v)),c=l.map(v=>t-n*Math.cos(v)),m=h[0];if(h=h.map(v=>v-m),s){let v=h[h.length-1]-h[0];v!==0&&(h=h.map(S=>S/v))}o&&(c=c.map(v=>-v));let g=Math.max(...c)-Math.min(...c);c=c.map(v=>v*g/.25);let b=h,x=c;return i&&(b=c,x=h),b.map((v,S)=>[v+e[0],x[S]+e[1]])}var Ir=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{core:0});let t=T(this.params,"core",0),n=T(this.params,"core_ls",void 0),s=T(this.params,"core_lw",void 0),i=T(this.params,"core_color",void 0);this.segments.push(new p([[0,0],H,[1,0]]));for(let a=0;a<4;a++)this.segments.push(new xe([(a*2+1)*Wn/2,0],Wn,Wn,{theta1:0,theta2:180}));let o=.12;if(t>0)for(let a=0;a<t;a++){let l=Wn+o*a,h={};n!==void 0&&(h.ls=n),s!==void 0&&(h.lw=s),i!==void 0&&(h.color=i),this.segments.push(new p([[0,l],[1,l]],h))}this.anchors.NE=[1,Wn+o],this.anchors.NW=[0,Wn+o],this.anchors.SE=[1,-Wn],this.anchors.SW=[0,-Wn]}},Lr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{loops:4,core:0});let t=T(this.params,"loops",4),n=T(this.params,"core",0),s=T(this.params,"core_ls",void 0),i=T(this.params,"core_lw",void 0),o=T(this.params,"core_color",void 0);this.segments.push(new p(Vn(t)));let a=.12,l=.5;if(n>0)for(let h=0;h<n;h++){let c=l+a*h,m={};s!==void 0&&(m.ls=s),i!==void 0&&(m.lw=i),o!==void 0&&(m.color=o),this.segments.push(new p([[0,c],[1,c]],m))}this.anchors.NE=[1,l+a],this.anchors.NW=[0,l+a],this.anchors.SE=[1,-l],this.anchors.SW=[0,-l]}};var Un=class extends se{constructor(e={}){super(e);let t=.2,n=.25;this.segments.push(new p([[0,0],H,[0,n],[0,-n],H,[t/2,n],[t/2,-n],[t*1.5,-n],[t*1.5,n],[t/2,n],H,[t*2,n],[t*2,-n],H,[t*2,0]]))}};var dt=class extends se{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[.5*t,n],[1.5*t,-n],[2.5*t,n],[3.5*t,-n],[4.5*t,n],[5.5*t,-n],[6*t,0]]))}};var mt=class extends se{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[0,n],[t*6,n],[t*6,-n],[0,-n],[0,0],H,[t*6,0]]))}},cr=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=T(this.params,"arrowwidth",.16),i=T(this.params,"arrowlength",.2),o=T(this.params,"arrow_lw",void 0),a=T(this.params,"arrow_color",void 0);this.segments.push(new p([[1.5*t,-n*2],[4.5*t,t*3.5]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Zt=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=T(this.params,"arrowwidth",.16),i=T(this.params,"arrowlength",.2),o=T(this.params,"arrow_lw",void 0),a=T(this.params,"arrow_color",void 0);this.segments.push(new p([[1*t,-n*2],[5*t,t*3.5]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Jn=class extends mt{constructor(e={}){super(e),this.segments.push(new p([[0,-.25-.2],[.2,-.25-.2],[1,.25+.2]]))}},ur=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=T(this.params,"arrowwidth",.16),n=T(this.params,"arrowlength",.2),s=T(this.params,"arrow_lw",void 0),i=T(this.params,"arrow_color",void 0);this.segments.push(new p([[.7,.75],[.4,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i})),this.segments.push(new p([[1,.75],[.7,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i}))}},Qt=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=T(this.params,"arrowwidth",.16),n=T(this.params,"arrowlength",.2),s=T(this.params,"arrow_lw",void 0),i=T(this.params,"arrow_color",void 0);this.segments.push(new p([[.7,.75],[.4,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i})),this.segments.push(new p([[1,.75],[.7,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i}))}},Kn=class extends mt{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[-n*1.5,-n],[-n*1.5,-n*2]])),this.segments.push(new p([[t*6,0],[t*6+n*1.5,-n],[t*6+n*1.5,-n*2]])),this.anchors.v1=[-n*1.5,-n*2],this.anchors.v2=[t*6+n*1.5,-n*2]}},mr=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,tap_length:.72});let t=Ye,n=T(this.params,"tap_length",.72),s=T(this.params,"arrowwidth",.15),i=T(this.params,"arrowlength",.25);this.anchors.tap=[t*3,n],this.elmParams.lblloc="bot",this.segments.push(new p([[t*3,n],[t*3,t*1.5]],{arrow:"->",arrowwidth:s,arrowlength:i}))}},er=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,tap_length:.72});let t=Ye,n=T(this.params,"tap_length",.72),s=T(this.params,"arrowwidth",.15),i=T(this.params,"arrowlength",.25);this.anchors.tap=[t*3,n],this.elmParams.lblloc="bot",this.segments.push(new p([[t*3,n],[t*3,t*1.5]],{arrow:"->",arrowwidth:s,arrowlength:i}))}},dr=class extends mt{constructor(e={}){super(e);let t=Ye;this.segments.push(new p([[0,0],[t*6,0]]))}},Dr=class extends mt{constructor(e={}){super(e);let t=Ye,n=.25,s=n*.66;this.segments.push(new p([[s,n],[s,-n]])),this.segments.push(new p([[6*t-s,n],[6*t-s,-n]]))}};var an={Resistor:dt,ResistorVar:cr,Potentiometer:mr,Photoresistor:ur,Fuse:dr},Xl={Resistor:mt,ResistorVar:Zt,Potentiometer:er,Photoresistor:Qt,Fuse:Dr},Zn=dt,Qn=cr,es=mr,ts=ur,rs=dr;function Gl(r){r.Resistor!==void 0&&(Zn=r.Resistor),r.ResistorVar!==void 0&&(Qn=r.ResistorVar),r.Potentiometer!==void 0&&(es=r.Potentiometer),r.Photoresistor!==void 0&&(ts=r.Photoresistor),r.Fuse!==void 0&&(rs=r.Fuse)}function Wl(){Zn=an.Resistor,Qn=an.ResistorVar,es=an.Potentiometer,ts=an.Photoresistor,rs=an.Fuse}var ns=class extends se{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[0,0],[t,0],[t,-t*.75],[t*2,-t*.75],[t*2,t*.75],[t*3,t*.75],[t*3,-t*.75],[t*4,-t*.75],[t*4,0],[t*5,0]])),this.segments.push(new p([[0,t*1.25],[t*5,t*1.25],[t*5,t*-1.25],[0,t*-1.25],[0,t*1.25]])),this.segments.push(new U([[0,t*1.25],[0,-t*1.25],[t/2,-t*1.25],[t/2,t*1.25]],{closed:!0,fill:"black"}))}},ss=class extends se{constructor(e={}){super(e);let t=.2,n=.25;this.segments.push(new p([[0,0],[0,n],[t,n],[t,-n],[t*2,-n],[t*2,n],[t*3,n],[t*3,-n],[t*4,-n],[t*4,n],[t*5,n],[t*5,-n],[t*6,-n],[t*6,0],[t*7,0]]))}},is=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{box:!1});let t=.25;T(this.params,"box",!1)?(this.segments.push(new p([[-t,0],H,[t,0]])),this.segments.push(new p([[-t,t],[t,-t],H,[t,t],[-t,-t]])),this.segments.push(new U([[-t,t],[-t,-t],[t,-t],[t,t]],{closed:!0,fill:!1}))):this.segments.push(new p([[0,0],H,[-t,t],[t,-t],H,[t,t],[-t,-t],H,[0,0]]))}},os=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{dots:!0,dot_r:.12});let t=T(this.params,"dot_r",.12),n=50,s=ze(t*2,1+t,n),o=ze(0,2*Math.PI,n).map(l=>Math.sin(l)*.25),a=s.map((l,h)=>[l,o[h]]);this.segments.push(new p(a)),this.segments.push(new p([[0,0],H,[1+t*3,0]])),T(this.params,"dots",!0)&&(this.segments.push(new D([t,0],t,{zorder:4,fill:"bg"})),this.segments.push(new D([t*2+1,0],t,{zorder:4,fill:"bg"})))}},as=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{dots:!0,dot_r:.12});let t=e.dots,n=T(this.params,"dots",!0),s=t?25:10,i=t?155:170,o=T(this.params,"arc_lw",void 0),a=T(this.params,"arc_color",void 0);if(this.segments.push(new p([[0,0],H,[1,0]])),this.segments.push(new xe([.5,0],1,.65,{theta1:s,theta2:i,lw:o,color:a})),n){let l=T(this.params,"dot_r",.12);this.segments.push(new D([l,0],l,{zorder:4})),this.segments.push(new D([1-l,0],l,{zorder:4}))}}},ls=class extends se{constructor(e={}){super(e);let t=.25,n=.25,s=.25;this.segments.push(new p([[0,0],[-n,0],H,[n,0],[0,-s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,0],H,[n,0],[0,s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,s],H,[0,-s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,-s],H,[0,-s],H,[t,0]]))}},hs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{gap:.08,arrowwidth:.25,arrowlength:.25});let t=T(this.params,"gap",.08),n=T(this.params,"arrowwidth",.25),s=T(this.params,"arrowlength",.25);this.segments.push(new p([[0,0],H,[1,0]])),this.segments.push(new p([[0,0],[.5-t/2,0]],{arrow:"->",arrowwidth:n,arrowlength:s})),this.segments.push(new p([[1,0],[.5+t/2,0]],{arrow:"->",arrowwidth:n,arrowlength:s}))}},Nr=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new xe([.5,0],1,.5,{theta1:0,theta2:360})),this.elmParams.theta=90}},Or=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.25,0],.25)),this.segments.push(new D([1-.25,0],.25)),this.elmParams.theta=90}},Fr=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.3,0],.3,{lw:1e-9,ls:"None"})),this.segments.push(new D([1-.3,0],.3,{lw:1e-9,ls:"None"})),this.segments.push(new D([.3,0],.3,{fill:!1})),this.segments.push(new D([1-.3,0],.3,{fill:!1})),this.elmParams.theta=90,this.anchors.common=[.5,Math.sqrt(.3**2-.2**2)]}},$r=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new xe([.7,0],.6,.3,{theta1:0,theta2:360})),this.segments.push(new xe([.3,0],.6,.3,{theta1:0,theta2:360})),this.elmParams.theta=90,this.anchors.common=[.5,Math.sqrt(1-.2**2/.3**2)*.15]}};var wt=2.5,jt=wt*Math.sqrt(3)/2,N0=jt/8,O0=.2,cs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{sign:!0,leads:!1});let t=T(this.params,"leads",!1),n=T(this.params,"sign",!0),s=wt/4,i=t?s:0;this.segments.push(new p([[i,0],[i,wt/2],[i+jt,0],[i,-wt/2],[i,0],H,[i+jt,0]])),n&&(this.segments.push(new p([[i+N0-O0/2,wt/4],[i+N0+O0/2,wt/4]])),this.segments.push(new p([[i+N0-O0/2,-wt/4],[i+N0+O0/2,-wt/4]])),this.segments.push(new p([[i+N0,-wt/4-O0/2],[i+N0,-wt/4+O0/2]]))),t&&(this.segments.push(new p([[0,wt/4],[s,wt/4]])),this.segments.push(new p([[0,-wt/4],[s,-wt/4]])),this.segments.push(new p([[s+jt,0],[jt+2*s,0]])));let o=jt+2*i;this.anchors.out=[o,0],this.anchors.in1=[0,wt/4],this.anchors.in2=[0,-wt/4],this.anchors.center=[i+jt/2,0],this.anchors.vd=[i+jt/3,.84],this.anchors.vs=[i+jt/3,-.84],this.anchors.n1=[i+jt*2/3,-.42],this.anchors.n2=[i+jt*2/3,.42],this.anchors.n1a=[i+jt*.9,-.13],this.anchors.n2a=[i+jt*.9,.13],this.elmParams.drop=[o,0],Object.assign(this._labelhints,{in1:{ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:9},in2:{ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:9},out:{ofst:[0,.1],halign:"left",valign:"bottom",fontsize:9},vd:{ofst:[-.1,.25],halign:"right",valign:"bottom",fontsize:9},vs:{ofst:[-.1,-.25],halign:"right",valign:"top",fontsize:9},n1:{ofst:[-.1,-.25],halign:"right",valign:"top",fontsize:9},n1a:{ofst:[-.1,-.3],halign:"right",valign:"top",fontsize:9},n2:{ofst:[-.1,.25],halign:"right",valign:"bottom",fontsize:9},n2a:{ofst:[-.1,.3],halign:"right",valign:"bottom",fontsize:9}})}};var C=Ye*.5;function p1(r,e,t,n,s){r.push(new p([[-3*C,-6.5*C],[-3*C,-7.5*C]])),r.push(new p([[-3*C,-9.5*C],[-3*C,-10.5*C]])),r.push(new p([[-3*C,-12.5*C],[-3*C,-13.5*C]])),r.push(new p([[0,-7*C],[0,0]])),r.push(new p([[-3*C,-7*C],[0,-7*C]])),r.push(new p([[0,-20*C],[0,-13*C]])),r.push(new p([[-3*C,-13*C],[0,-13*C]]));let i={};return e==="nmos"?(r.push(new p([[-10*C,-14*C],[-5*C,-14*C]])),r.push(new p([[-5*C,-14*C],[-5*C,-6*C]])),r.push(new p([[-3*C,-10*C],[0,-10*C]],{arrow:"<-",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[0,-10*C],[0,-13*C]])),i.drain=[0,0],i.gate=[-10*C,-14*C],i.center=[0,-10*C],i.source=[0,-20*C]):(r.push(new p([[-10*C,-6*C],[-5*C,-6*C]])),r.push(new p([[-5*C,-6*C],[-5*C,-14*C]])),r.push(new p([[-3*C,-10*C],[0,-10*C]],{arrow:"->",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[0,-10*C],[0,-7*C]])),i.source=[0,0],i.gate=[-10*C,-6*C],i.center=[0,-10*C],i.drain=[0,-20*C]),t&&(r.push(new p([[0,-7*C],[3*C,-7*C]])),r.push(new p([[3*C,-7*C],[3*C,-9*C]])),r.push(new p([[2*C,-9*C],[4*C,-9*C]])),r.push(new U([[3*C,-9*C],[2*C,-11*C],[4*C,-11*C]],{closed:!0,fill:!1})),r.push(new p([[3*C,-11*C],[3*C,-13*C]])),r.push(new p([[3*C,-13*C],[0,-13*C]]))),n&&r.push(new D([-1*C,-10*C],7*C,{lw:s})),i}var ms=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=p1(this.segments,"nmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[0,-20*C],this.elmParams.lblloc="rgt"}},ds=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=p1(this.segments,"pmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[0,-20*C],this.elmParams.lblloc="rgt"}};function f1(r,e,t,n,s){r.push(new p([[0,0],[7*C,0],[7*C,-3*C],H,[13*C,-3*C],[13*C,0],[20*C,0]])),r.push(new p([[6.5*C,-3*C],[7.5*C,-3*C]])),r.push(new p([[9.5*C,-3*C],[10.5*C,-3*C]])),r.push(new p([[12.5*C,-3*C],[13.5*C,-3*C]]));let i={};return e==="nmos"?(r.push(new p([[14*C,-10*C],[14*C,-5*C]])),r.push(new p([[14*C,-5*C],[6*C,-5*C]])),r.push(new p([[10*C,-3*C],[10*C,0]],{arrow:"<-",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[10*C,0],[13*C,0]])),i.drain=[0,0],i.gate=[14*C,-10*C],i.source=[20*C,0]):(r.push(new p([[6*C,-10*C],[6*C,-5*C]])),r.push(new p([[6*C,-5*C],[14*C,-5*C]])),r.push(new p([[10*C,-3*C],[10*C,0]],{arrow:"->",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[10*C,0],[7*C,0]])),i.source=[0,0],i.gate=[6*C,-10*C],i.drain=[20*C,0]),i.center=[10*C,0],t&&(r.push(new p([[7*C,0],[7*C,3*C]])),r.push(new p([[7*C,3*C],[9*C,3*C]])),r.push(new p([[9*C,2*C],[9*C,4*C]])),r.push(new U([[9*C,3*C],[11*C,2*C],[11*C,4*C]],{closed:!0,fill:!1})),r.push(new p([[11*C,3*C],[13*C,3*C]])),r.push(new p([[13*C,3*C],[13*C,0]]))),n&&r.push(new D([10*C,-1*C],7*C,{lw:s})),i}var ps=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=f1(this.segments,"nmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[20*C,0],this.elmParams.lblloc="bottom"}},fs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=f1(this.segments,"pmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[20*C,0],this.elmParams.lblloc="bottom"}},q=Ye*4,c2=Ye*5,O=c2/2,tt=Ye,Xe=Ye*.7,gs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[q,-O],[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q+tt,-O],[q+tt,-O-q]])),this.segments.push(new p([[q+tt,-O-q/2],[q+tt+O+Xe,-O-q/2]])),this.anchors.source=[0,-2*O-q],this.anchors.drain=[0,0],this.anchors.gate=[q+tt+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft",T(this.params,"bulk",!1)&&(this.segments.push(new p([[0,-O-q/2],[q,-O-q/2]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[0,-O-q/2])}},bs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[q,-O],[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q+tt,-O],[q+tt,-O-q]])),this.segments.push(new p([[q+tt+Xe*2,-O-q/2],[q+tt+O+Xe,-O-q/2]])),this.segments.push(new D([q+tt+Xe,-O-q/2],Xe)),this.anchors.source=[0,0],this.anchors.drain=[0,-2*O-q],this.anchors.gate=[q+tt+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft",T(this.params,"bulk",!1)&&(this.segments.push(new p([[0,-O-q/2],[q,-O-q/2]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[0,-O-q/2])}},ws=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,q],[O+q,q],[O+q,0],[2*O+q,0]])),this.segments.push(new p([[O,q+tt],[O+q,q+tt]])),this.segments.push(new p([[O+q/2,q+tt],[O+q/2,q+tt+Xe+O]])),this.anchors.isource=[2*O+q,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+q/2,q+tt+Xe+O],this.elmParams.lblloc="bottom",T(this.params,"bulk",!1)&&(this.segments.push(new p([[O+q/2,0],[O+q/2,q]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[O+q/2,0])}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},xs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,q],[O+q,q],[O+q,0],[2*O+q,0]])),this.segments.push(new p([[O,q+tt],[O+q,q+tt]])),this.segments.push(new D([O+q/2,q+tt+Xe],Xe)),this.segments.push(new p([[O+q/2,q+tt+Xe*2],[O+q/2,q+tt+Xe+O]])),this.anchors.isource=[2*O+q,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+q/2,q+tt+Xe+O],this.elmParams.lblloc="bottom",T(this.params,"bulk",!1)&&(this.segments.push(new p([[O+q/2,0],[O+q/2,q]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[O+q/2,0])}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},Re=Ye*2.5,me=Re*2,ne=me*.5,Ve=Re*.2,yt=me*.1,Vl=yt*.75,us=.25,F0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=T(this.params,"bulk",!1),n=T(this.params,"offset_gate",!0),i=T(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Re,-ne],[Re,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new p([[Re,-ne-me],[0,-ne-me]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Re+Ve,-ne-me+yt],[Re+Ve+ne,-ne-me+yt]])),this.anchors.gate=[Re+Ve+ne,-ne-me+yt]):(this.segments.push(new p([[Re+Ve,-ne-me/2],[Re+Ve+ne,-ne-me/2]])),this.anchors.gate=[Re+Ve+ne,-ne-me/2]),this.anchors.source=[0,-2*ne-me],this.anchors.drain=[0,0],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[0,-ne-me/2],[Re,-ne-me/2]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.anchors.bulk=[0,-ne-me/2])}},$0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=T(this.params,"bulk",!1),n=T(this.params,"offset_gate",!0),i=T(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Re,-ne],[Re,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new p([[0,-ne],[Re,-ne]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve+ne,-ne-yt]])),this.anchors.gate=[Re+Ve+ne,-ne-yt]):(this.segments.push(new p([[Re+Ve,-ne-me/2],[Re+Ve+ne,-ne-me/2]])),this.anchors.gate=[Re+Ve+ne,-ne-me/2]),this.anchors.source=[0,0],this.anchors.drain=[0,-2*ne-me],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[Re,-ne-me/2],[0,-ne-me/2]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.anchors.bulk=[0,-ne-me/2])}},j0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=T(this.params,"bulk",!1),n=T(this.params,"offset_gate",!0),i=T(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Re,-ne],[Re,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new D([Vl*2,-ne-me],Vl,{fill:!0})),this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Re+Ve,-ne-me+yt],[Re+Ve+ne,-ne-me+yt]])),this.anchors.gate=[Re+Ve+ne,-ne-me+yt]):(this.segments.push(new p([[Re+Ve,-ne-me/2],[Re+Ve+ne,-ne-me/2]])),this.anchors.gate=[Re+Ve+ne,-ne-me/2]),this.anchors.source=[0,-2*ne-me],this.anchors.drain=[0,0],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[0,-ne-me/2],[Re,-ne-me/2]])),this.segments.push(new D([Re-Vl*2,-ne-me/2],Vl,{fill:!0})),this.anchors.bulk=[0,-ne-me/2])}},Jl=q*.2,ue=Ye*3,vs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[ue,-O],[ue,-O+Jl],[ue,-O-ue-Jl],[ue,-O-ue],[0,-O-ue],[0,-2*O-ue]])),this.segments.push(new p([[ue,-O-ue],[ue+O,-O-ue]])),this.elmParams.drop=[ue+O,-O-ue],this.anchors.source=[0,-2*O-ue],this.anchors.drain=[0,0],this.anchors.gate=[ue+O,-O-ue],this.anchors.center=[0,-O-ue/2],this.elmParams.lblloc="lft",T(this.params,"circle",!1)&&this.segments.push(new D([ue/2,-q],q*1.1,{lw:T(this.params,"circle_lw",void 0)}))}},q0=class extends vs{constructor(e={}){super(e),this.segments.push(new p([[ue+.1,-O-ue],[ue+.3,-O-ue]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},H0=class extends vs{constructor(e={}){super(e),this.segments.push(new p([[ue+.25,-O-ue],[ue,-O-ue]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},ys=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,ue],[O+ue,ue],[O+ue,0],[2*O+ue,0]])),this.segments.push(new p([[O-Jl,ue],[O+ue+Jl,ue]])),this.segments.push(new p([[O+ue,ue],[O+ue,ue+O]])),this.anchors.isource=[2*O+ue,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+ue,ue+O],this.elmParams.lblloc="bottom",T(this.params,"circle",!1)&&this.segments.push(new D([O+ue/2,ue/2],q*1.1,{lw:T(this.params,"circle_lw",void 0)}))}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},Y0=class extends ys{constructor(e={}){super(e),this.segments.push(new p([[O+ue,ue],[O+ue,ue+.3]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},X0=class extends ys{constructor(e={}){super(e),this.segments.push(new p([[O+ue,ue+.3],[O+ue,ue]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},Ma=(q+2*Xe)/5,G0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{split:!0,arrow:!0,arrowlength:.25,arrowwidth:.2});let t=T(this.params,"split",!0),n=this.params.arrow,s=T(this.params,"arrowwidth",.2),i=T(this.params,"arrowlength",.25);t?this.segments.push(new p([[0,0],[0,-O],[q,-O],H,[q,-O+Xe],[q,-O+Xe-Ma],H,[q,-O+Xe-2*Ma],[q,-O+Xe-3*Ma],H,[q,-O+Xe-4*Ma],[q,-O+Xe-5*Ma],H,[q,-O-q],[0,-O-q],[0,-2*O-q]])):this.segments.push(new p([[0,0],[0,-O],[q,-O],H,[q,-O+Xe],[q,-O-q-Xe],H,[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q,-O-q/2],[q+O+Xe,-O-q/2]])),n===">"?this.segments.push(new p([[0,-O-q],[q,-O-q]],{arrow:"->",arrowwidth:s,arrowlength:i})):n!==!1&&this.segments.push(new p([[0,-O-q],[q,-O-q]],{arrow:"<-",arrowwidth:s,arrowlength:i})),this.anchors.drain=[0,-2*O-q],this.anchors.source=[0,0],this.anchors.gate=[q+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft"}},za=Ye*3.3,pe=za*2/3,ht=za*(4/3),tr=ht/4,It=pe+za*.7,qt=ht*.7,qr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowwidth:.2,arrowlength:.25}),this.segments.push(new p([[0,0],[pe,0]])),this.segments.push(new p([[pe,ht/2],[pe,-ht/2]])),this.segments.push(new p([[pe,tr],[It,qt],[It,qt+tr]])),this.segments.push(new p([[pe,-tr],[It,-qt],[It,-qt-tr]])),T(this.params,"circle",!1)&&this.segments.push(new D([za,0],za,{lw:T(this.params,"circle_lw",void 0)})),this.elmParams.drop=[It,qt+tr],this.anchors.base=[0,0],this.anchors.collector=[It,qt+tr],this.anchors.emitter=[It,-qt-tr],this.anchors.center=[It,0]}},Ht=class extends qr{constructor(e={}){super(e),this.segments.push(new p([[pe,-tr],[It,-qt]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},rr=class extends qr{constructor(e={}){super(e),this.segments.push(new p([[It,qt],[pe,tr]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.base=[0,0],this.anchors.collector=[It,-qt-tr],this.anchors.emitter=[It,qt+tr]}},d1=.55,Ea=.2,Ul=.75,jr=.42,Ct=1.1,Hr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,lblloc:"bottom",theta:90,arrowwidth:.2,arrowlength:.25}),this.segments.push(new p([[0,0],[Ct/2-Ea,jr],[Ct/2+Ea,jr],[Ct,0]])),this.segments.push(new p([[Ct/2-Ul/2,jr],[Ct/2+Ul/2,jr]])),this.segments.push(new p([[Ct/2,jr],[Ct/2,jr+Ul/2]])),T(this.params,"circle",!1)&&this.segments.push(new D([Ct/2,d1/2],d1,{lw:T(this.params,"circle_lw",void 0)})),this.anchors.base=[Ct/2,jr+Ul/2],this.anchors.icollector=[Ct,0],this.anchors.iemitter=[0,0]}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.emitter=this.anchors.start,this.anchors.collector=this.anchors.end,T(this.params,"reverse",!1)&&(this.anchors.emitter=this.anchors.end,this.anchors.collector=this.anchors.start)}},Ss=class extends Hr{constructor(e={}){super(e),this.segments.push(new p([[0,0],[Ct/2-Ea,jr]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},ln=class extends Hr{constructor(e={}){super(e),this.segments.push(new p([[Ct/2+Ea,jr],[Ct,0]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}));let t=this.anchors.icollector,n=this.anchors.iemitter;this.anchors.icollector=n,this.anchors.iemitter=t}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.emitter=this.anchors.end,this.anchors.collector=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.emitter=this.anchors.start,this.anchors.collector=this.anchors.end)}},W0=class extends rr{constructor(e={}){super(e);let t=-.25;this.segments.push(new p([[pe,-tr-t],[It,-qt-t]])),this.anchors.C2=[It,-qt-t]}},xt=.1,V0=class extends Ht{constructor(e={}){super(e),this.segments.push(new p([[pe,ht/2],[pe,ht/2+xt],[pe+xt,ht/2+xt],[pe+xt,ht/2]])),this.segments.push(new p([[pe,-ht/2],[pe,-ht/2-xt],[pe-xt,-ht/2-xt],[pe-xt,-ht/2]]))}},U0=class extends rr{constructor(e={}){super(e),this.segments.push(new p([[pe,ht/2],[pe,ht/2+xt],[pe-xt,ht/2+xt],[pe-xt,ht/2]])),this.segments.push(new p([[pe,-ht/2],[pe,-ht/2-xt],[pe+xt,-ht/2-xt],[pe+xt,-ht/2]]))}},J0=class extends Ht{constructor(e={}){super(e),this.segments.shift();let t=.25;this.segments.push(new p([[-.1,pe],[pe*.75,.1]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.segments.push(new p([[-.1,pe-t],[pe*.75,.1-t]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},K0=class extends rr{constructor(e={}){super(e),this.segments.shift();let t=.25;this.segments.push(new p([[-.1,pe],[pe*.75,.1]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.segments.push(new p([[-.1,pe-t],[pe*.75,.1-t]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},vt=.15,Z0=class extends Ht{constructor(e={}){super(e),this.segments.shift(),this.segments.push(new p([[pe-vt,pe-vt/2],[pe-vt,-pe+vt/2],[pe-vt*2,-pe+vt/2]])),this.anchors.base=[pe-vt*2,-pe+vt/2]}},Q0=class extends rr{constructor(e={}){super(e),this.segments.shift(),this.segments.push(new p([[pe-vt*2,pe-vt/2],[pe-vt,pe-vt/2],[pe-vt,-pe+vt/2]])),this.anchors.base=[pe-vt*2,pe-vt/2]}},ei=class extends ln{constructor(e={}){super(e);let t=.25;this.segments.push(new p([[t,0],[t+Ct/2-Ea,jr]])),this.anchors.C2=[t,0]}};function Cc(r){let e=r[0].toUpperCase();return e==="L"||e==="R"||e==="T"||e==="B"?e:"L"}var Kl=class{constructor(e={}){z(this,"name");z(this,"pin");z(this,"side");z(this,"pos");z(this,"slot");z(this,"invert",!1);z(this,"invertradius",.15);z(this,"color");z(this,"rotation",0);z(this,"anchorname");z(this,"lblsize");z(this,"pinlblsize");z(this,"href");z(this,"decoration");this.side=e.side!==void 0?Cc(String(e.side)):"L",e.name!==void 0&&(this.name=e.name),e.pin!==void 0&&(this.pin=e.pin),e.pos!==void 0&&(this.pos=e.pos),e.slot!==void 0&&(this.slot=e.slot),e.invert!==void 0&&(this.invert=e.invert),e.invertradius!==void 0&&(this.invertradius=e.invertradius),e.color!==void 0&&(this.color=e.color),e.rotation!==void 0&&(this.rotation=e.rotation),e.anchorname!==void 0&&(this.anchorname=e.anchorname),e.lblsize!==void 0&&(this.lblsize=e.lblsize),e.pinlblsize!==void 0&&(this.pinlblsize=e.pinlblsize),e.href!==void 0&&(this.href=e.href),e.decoration!==void 0&&(this.decoration=e.decoration)}};function u2(r,e){let t=Math.max(.15,r.length*e/72),n=e/72*1.2;return[t*2,n*2]}function g1(r){return{...r}}var nr=class extends N{constructor(t={}){let{size:n,pins:s,slant:i,label:o,...a}=t;super({...a,...o!==void 0?{label:o}:{}});z(this,"size");z(this,"slant");z(this,"pins");z(this,"usersides");z(this,"sides");z(this,"pincount",{L:0,R:0,T:0,B:0});z(this,"_sizeauto");z(this,"_icbox");z(this,"_dflt");if(Object.assign(this.defaults,{pinspacing:0,edgepadH:.5,edgepadW:.5,leadlen:.5,lsize:14,lofst:.15,plblofst:.075,plblsize:11}),this.slant=i??0,this.pins={L:[],R:[],T:[],B:[]},this.usersides={},this.sides={L:this.mkSide(),R:this.mkSide(),T:this.mkSide(),B:this.mkSide()},this._dflt=this.mkSide(),this.size=n??this.params.size,s)for(let l of s)this.pins[l.side].push({...l,side:l.side});this._setsize()}mkSide(){return{spacing:T(this.params,"pinspacing",0),pad:T(this.params,"edgepadH",.25),leadlen:T(this.params,"leadlen",.5),label_ofst:T(this.params,"lofst",.15),label_size:T(this.params,"lsize",14),pinlabel_ofst:T(this.params,"plblofst",.05),pinlabel_size:T(this.params,"plblsize",11)}}pin(t){let n=Cc(t.side??"L"),s={side:n,name:t.name,pin:t.pin,pos:t.pos,slot:t.slot,invert:t.invert??!1,invertradius:t.invertradius??.15,color:t.color,rotation:t.rotation??0,anchorname:t.anchorname,lblsize:t.lblsize,pinlblsize:t.pinlblsize,href:t.href,decoration:t.decoration};return this.pins[n].push(s),this._setsize(),this}side(t,n=0,s=.5,i=.5,o=.15,a=14,l=.05,h=11){let c=Cc(t);return this.usersides[c]={spacing:n,pad:s,leadlen:i,label_ofst:o,label_size:a,pinlabel_ofst:l,pinlabel_size:h},this._setsize(),this}get pinnames(){let t=[];for(let n of["L","R","T","B"])for(let s of this.pins[n])s.name&&t.push(s.anchorname??s.name);return t}getAnchorNamesForGetattr(){let t=new Set(super.getAnchorNamesForGetattr());for(let n of["L","R","T","B"])for(let s of this.pins[n])s.name&&t.add(s.anchorname??s.name),s.pin&&t.add(`pin${s.pin}`);return[...t]}getPinAnchor(t){return this.resolveAnchor(t)}_countpins(){let t={L:0,R:0,T:0,B:0};for(let n of["L","R","T","B"]){let i=this.pins[n].map(o=>o.slot).filter(o=>o!=null).map(o=>Number(o.split("/")[1])).concat([0]);t[n]=Math.max(this.pins[n].length,Math.max(...i))}return t}_autosize(){let t={},n={};for(let a of["L","R","T","B"]){let l=g1(this.usersides[a]??this._dflt);l.spacing===0&&(l={...l,spacing:.6}),this.sides[a]=l;let h=Math.max(1,this.pincount[a]);t[a]=l.pad*2+l.spacing*(h-1);let c=0;for(let m of this.pins[a])if(m.name){let f=m.lblsize??T(this.params,"lsize",14);c=Math.max(c,u2(m.name,f)[0])}n[a]=c}let s=n.L+n.R+4*T(this.params,"lofst",.15),i=Math.max(t.L??0,t.R??0,2+T(this.params,"edgepadH",.5)),o=Math.max(t.T??0,t.B??0,2+T(this.params,"edgepadW",.5),s);this._sizeauto=[o,i];for(let a of["L","R"]){let l=this.sides[a],h=Math.max(1,this.pincount[a]);l.pad=(i-l.spacing*(h-1))/2}for(let a of["T","B"]){let l=this.sides[a],h=Math.max(1,this.pincount[a]);l.pad=(o-l.spacing*(h-1))/2}}_autopinlayout(){let t=this.size;for(let n of["L","R","T","B"]){let s=g1(this.usersides[n]??this._dflt);this.sides[n]=s;let i=["T","B"].includes(n)?t[0]:t[1],o=s.pad;s.spacing===0?this.pincount[n]>1?s.spacing=(i-2*o)/(this.pincount[n]-1):s.pad=i/2:s.pad=(i-s.spacing*(this.pincount[n]-1))/2}}_setsize(){this.pincount=this._countpins(),this.size===void 0?this._autosize():this._autopinlayout()}_drawBox(){let t,n;this.size?[t,n]=this.size:this._sizeauto?[t,n]=this._sizeauto:(t=2,n=3);let s=t*Math.tan(this.slant*Math.PI/180),i=0,o=n,a;return this.slant>0?(i=0-s,o=n+s,a=[new A(0,0),new A(t,i),new A(t,o),new A(0,n),new A(0,0)]):this.slant<0?(i=0+s,o=n-s,a=[new A(0,i),new A(t,0),new A(t,n),new A(0,o),new A(0,i)]):(i=0,o=n,a=[new A(0,0),new A(t,0),new A(t,n),new A(0,n),new A(0,0)]),this.segments.push(new p(a.map(l=>[l.x,l.y]),{})),{w:t,h:n,y1:i,y2:o}}_pinpos(t,n,s){let i=this.sides[t]??this._dflt,o=i.spacing>0?i.spacing:.6,a=s;n.slot&&(a=Number(n.slot.split("/")[0])-1);let l=i.pad+a*o;n.pos!==void 0&&n.pos!==null&&(l=i.pad+n.pos*(this.pincount[t]-1)*o);let h;return t==="L"?h=new A(0,l):t==="R"?h=new A(this._icbox.w,l):t==="T"?h=new A(l,this._icbox.h):h=new A(l,0),t==="T"&&this.slant>0?h=new A(h.x,h.y-h.x*Math.tan(-this.slant*Math.PI/180)):t==="T"&&this.slant<0?h=new A(h.x,h.y+(this._icbox.y2-this._icbox.h)-h.x*Math.tan(-this.slant*Math.PI/180)):t==="B"&&this.slant<0?h=new A(h.x,h.y-(this._icbox.y2-this._icbox.h)-h.x*Math.tan(this.slant*Math.PI/180)):t==="B"&&this.slant>0&&(h=new A(h.x,h.y-h.x*Math.tan(this.slant*Math.PI/180))),h}_drawClkpin(t,n,s){let i=this.sides[s]??this._dflt,o=.4*(i.label_size/16),a=.2*(i.label_size/16),l;if(s==="T"||s==="B"){let h=n.y!==0?Math.sign(n.y):1,c=Math.abs(o)*h;l=[new A(t.x-a,t.y),new A(t.x,t.y-c),new A(t.x+a,t.y)]}else{let h=n.x!==0?-Math.sign(n.x):1,c=Math.abs(o)*h;l=[new A(t.x,t.y+a),new A(t.x+c,t.y),new A(t.x,t.y-a)]}this.segments.push(new p(l.map(h=>[h.x,h.y])))}_drawPin(t,n,s){let i=this.sides[t]??this._dflt,o=this._pinpos(t,n,s),l={L:new A(-i.leadlen,0),R:new A(i.leadlen,0),T:new A(0,i.leadlen),B:new A(0,-i.leadlen)}[t],h=o.add(l);if(this.anchors[`in${t}${s+1}`]=[h.x,h.y],n.anchorname?this.anchors[n.anchorname]=[h.x,h.y]:n.name&&(n.name===">"&&(this.anchors.CLK=[h.x,h.y]),this.anchors[n.name]=[h.x,h.y]),n.pin&&(this.anchors[`pin${n.pin}`]=[h.x,h.y]),i.leadlen>0)if(n.invert){let c=n.invertradius??.15,f={L:new A(-c,0),R:new A(c,0),T:new A(0,c),B:new A(0,-c)}[t],g=o.add(f);this.segments.push(new D([g.x,g.y],c));let b=g.add(f.mul(2));this.segments.push(new p([[b.x,b.y],[h.x,h.y]],{}))}else this.segments.push(new p([[o.x,o.y],[h.x,h.y]],{}));if(n.pin){let c=(n.invert?n.invertradius??.15:0)*(n.invert?1:0),m=i.pinlabel_ofst,g={L:new A(-m-c*2,m),R:new A(m+c*2,m),T:new A(m,m+c*2),B:new A(m,-m-c*2)}[t],b=this.userParams.flip===!0,x=this.userParams.reverse===!0,v={L:"right",R:"left",T:"left",B:"left"},S={L:"bottom",R:"bottom",T:"bottom",B:"top"},k=v[t],M=S[t];b&&(t==="L"||t==="R")&&(g=g.flip()),b&&(t==="T"||t==="B")&&(M=t==="T"?"top":"bottom"),x&&(t==="L"||t==="R")&&(k=t==="L"?"left":"right"),x&&(t==="T"||t==="B")&&(g=g.mirrorx(0));let _=o.add(g);this.segments.push(new W([_.x,_.y],String(n.pin),{fontsize:n.pinlblsize??i.pinlabel_size,align:[k,M]}))}if(n.name===">"){this._drawClkpin(o,l,t);return}if(n.name&&n.name!==""){let c={L:new A(i.label_ofst,0),R:new A(-i.label_ofst,0),T:new A(0,-i.label_ofst),B:new A(0,i.label_ofst)},m=o.add(c[t]),f=this.userParams.flip===!0,g=this.userParams.reverse===!0,b={L:"left",R:"right",T:"center",B:"center"},x={L:"center",R:"center",T:"top",B:"bottom"},v=b[t],S=x[t];f&&(t==="T"||t==="B")&&(S=t==="T"?"bottom":"top"),g&&(t==="L"||t==="R")&&(v=t==="L"?"right":"left"),this.segments.push(new W([m.x,m.y],n.name,{fontsize:n.lblsize??i.label_size,color:n.color??void 0,align:[v,S],href:n.href??void 0,decoration:n.decoration??void 0,rotation:n.rotation??0}))}}_drawPins(){for(let t of["L","R","T","B"])this.pins[t].forEach((n,s)=>this._drawPin(t,n,s))}_place(t,n,s){return this.anchors={},this._setsize(),this._icbox=this._drawBox(),this._drawPins(),this.elmParams.lblloc="center",this.anchors.center=[this._icbox.w/2,this._icbox.h/2],this.elmParams.drop=[this._icbox.w,this._icbox.h/2],super._place(t,n,s)}},ti=class extends nr{constructor(e={}){let{demux:t=!1,...n}=e,s=e.slant!==void 0?e.slant:25;super({...n,slant:t?s:-s})}},ri=class extends nr{constructor(e={}){let{preclr:t=!1,preclrinvert:n=!0,...s}=e,i=[{name:"D",side:"L",slot:"2/2"},{name:">",side:"L",slot:"1/2"},{name:"Q",side:"R",slot:"2/2"},{name:"Q",side:"R",slot:"1/2",anchorname:"Qbar",decoration:"overline"}];t&&(i.push({name:"PRE",side:"T",invert:n}),i.push({name:"CLR",side:"B",invert:n})),super({...s,pins:i,size:s.size??[2,3]})}},ni=class extends nr{constructor(e={}){let{preclr:t=!1,preclrinvert:n=!0,...s}=e,i=[{name:"J",side:"L",slot:"3/3"},{name:">",side:"L",slot:"2/3"},{name:"K",side:"L",slot:"1/3"},{name:"Q",side:"R",slot:"3/3"},{name:"Q",side:"R",slot:"1/3",anchorname:"Qbar",decoration:"overline"}];t&&(i.push({name:"PRE",side:"T",invert:n}),i.push({name:"CLR",side:"B",invert:n})),super({...s,pins:i,size:s.size??[2,3]})}},si=class extends nr{constructor(e={}){let t=[{name:"in",side:"L",slot:"3/3"},{name:"out",side:"R",slot:"3/3"},{name:"gnd",side:"B"}];super({...e,pins:t,size:e.size??[2,1.5]})}},ii=class extends nr{constructor(e={}){let t=[{name:"TRG",side:"L",pin:"2"},{name:"THR",side:"L",pin:"6"},{name:"DIS",side:"L",pin:"7"},{name:"CTL",side:"R",pin:"5"},{name:"OUT",side:"R",pin:"3"},{name:"RST",side:"T",pin:"4"},{name:"Vcc",side:"T",pin:"8"},{name:"GND",side:"B",pin:"1"}];super({...e,edgepadW:.5,edgepadH:1,pinspacing:1.5,leadlen:1,pins:t,label:"555"})}};function Ic(r){let e=r.bottom??0,t=r.left??0,n=r.seglen??1.5,s=r.segw??.3,i=r.spacing??.12,o=r.digit??8,a=r.segcolor??"red",l=r.tilt??10,h=r.labelsegments??!0,c=s/2,m=s/5,f=i/2,g=l*Math.PI/180,b=Math.sin(g),x=[f,f+c,n-f-c,n-f,n-f-c,f+c],v=[0,c,c,0,-c,-c],S=[...x],k=[...x],M=v.map(Te=>Te+n*2),_=v.map(Te=>Te+n),B=[0,c,c,0,-c,-c],$=[f,f+c,n-f-c,n-f,n-f-c,f+c],Y=[...B],Z=$.map(Te=>Te+n),L=B.map(Te=>Te+n),I=[...Z],X=[...L],j=[...$],re=[n/2+f,n*2+c+m],te=[n/2+f,n+c+m],ke=[n/2+f,c+m],he=[n+c+f,n*1.5],ve=[n+c+f,n*.5],de=[-c-f,n*.5],Fe=[-c-f,n*1.5],qe=Te=>[Te[0]+Te[1]*b,Te[1]],Ie=t;l!==0&&(S=S.map((Te,nt)=>Te+b*M[nt]),L=L.map((Te,nt)=>Te+b*I[nt]),X=X.map((Te,nt)=>Te+b*j[nt]),x=x.map((Te,nt)=>Te+b*v[nt]),B=B.map((Te,nt)=>Te+b*$[nt]),Y=Y.map((Te,nt)=>Te+b*Z[nt]),k=k.map((Te,nt)=>Te+b*_[nt]),re=qe(re),te=qe(te),ke=qe(ke),he=qe(he),ve=qe(ve),de=qe(de),Fe=qe(Fe),Ie-=b*n);let ge=Te=>Te.map(nt=>nt+Ie),Me=Te=>Te.map(nt=>nt+e);x=ge(x),v=Me(v),k=ge(k),_=Me(_),S=ge(S),M=Me(M),B=ge(B),$=Me($),Y=ge(Y),Z=Me(Z),L=ge(L),I=Me(I),X=ge(X),j=Me(j),re=[re[0]+Ie,re[1]+e],te=[te[0]+Ie,te[1]+e],ke=[ke[0]+Ie,ke[1]+e],he=[he[0]+Ie,he[1]+e],ve=[ve[0]+Ie,ve[1]+e],de=[de[0]+Ie,de[1]+e],Fe=[Fe[0]+Ie,Fe[1]+e];let be=String(o).toLowerCase(),Be=["2","3","5","6","7","8","9","0","a","c","e","f"].includes(be)?a:void 0,De=["1","2","3","4","7","8","9","0","a","d"].includes(be)?a:void 0,ye=["1","3","4","5","6","7","8","9","0","a","b","d"].includes(be)?a:void 0,_e=["2","3","5","6","8","9","0","b","c","d","e"].includes(be)?a:void 0,Ae=["2","6","8","0","a","b","c","d","e","f"].includes(be)?a:void 0,Ze=["4","5","6","8","9","0","a","b","c","e","f"].includes(be)?a:void 0,bn=["2","3","4","5","6","8","9","a","b","d","e","f"].includes(be)?a:void 0,ft=[],Rt=(Te,nt,ch)=>ft.push(new U(Te.map((uh,Da)=>[uh,nt[Da]]),{closed:!0,fill:ch??!1,color:"gray",lw:.5}));return Rt(S,M,Be),Rt(L,I,De),Rt(X,j,ye),Rt(x,v,_e),Rt(B,$,Ae),Rt(Y,Z,Ze),Rt(k,_,bn),h&&(ft.push(new W(re,"a",{align:["center","bottom"],fontsize:10})),ft.push(new W(te,"g",{align:["center","bottom"],fontsize:10})),ft.push(new W(ke,"d",{align:["center","bottom"],fontsize:10})),ft.push(new W(he,"b",{align:["left","center"],fontsize:10})),ft.push(new W(ve,"c",{align:["left","center"],fontsize:10})),ft.push(new W(de,"e",{align:["right","center"],fontsize:10})),ft.push(new W(Fe,"f",{align:["right","center"],fontsize:10}))),r.decimal&&ft.push(new D([Ie+n+s+.15/2,e],.15,{color:"gray",fill:a,lw:.5})),ft}var oi=class extends nr{constructor(e={}){let t=T(e,"decimal",!1),n=t?"8":"7",s=t?5.9:5.3,o=e.size??[3,s],a=[{pin:"a",side:"L",slot:`${7+(t?1:0)}/${n}`,anchorname:"a"},{pin:"b",side:"L",slot:`${6+(t?1:0)}/${n}`,anchorname:"b"},{pin:"c",side:"L",slot:`${5+(t?1:0)}/${n}`,anchorname:"c"},{pin:"d",side:"L",slot:`${4+(t?1:0)}/${n}`,anchorname:"d"},{pin:"e",side:"L",slot:`${3+(t?1:0)}/${n}`,anchorname:"e"},{pin:"f",side:"L",slot:`${2+(t?1:0)}/${n}`,anchorname:"f"},{pin:"g",side:"L",slot:`${1+(t?1:0)}/${n}`,anchorname:"g"}];t&&a.push({pin:"dp",side:"L",slot:`1/${n}`,anchorname:"dp"}),T(e,"anode",!1)&&a.push({pin:"ca",side:"T",anchorname:"anode"}),T(e,"cathode",!1)&&a.push({pin:"cc",side:"B",anchorname:"cathode"}),super({...e,pins:a,size:o,pinspacing:.6});let l=.8,c=(s-1.5*2)/2;this.segments.push(...Ic({left:l,bottom:c,decimal:t,digit:T(e,"digit",8),segcolor:T(e,"segcolor","red"),tilt:T(e,"tilt",10),labelsegments:T(e,"labelsegments",!0)}))}},ai=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pins:8,notch:!0,width:3,pinw:.6,spacing:.5,number:!0,fontsize:12,pfontsize:10});let t=T(this.params,"width",3),n=T(this.params,"pinw",.6),s=T(this.params,"spacing",.5),i=T(this.params,"pins",8),o=T(this.params,"names",void 0);if(i%2===1)throw new Error("pins must be even");let a=i/2*n+s*(i/2+1);if(this.segments.push(new U([[0,0],[t,0],[t,a],[0,a]],{closed:!0})),T(this.params,"notch",!0)){let h=t/2,c=ze(-Math.PI,0,50),m=n/2,f=c.map(b=>h+m*Math.cos(b)),g=c.map(b=>a+m*Math.sin(b));this.segments.push(new p(f.map((b,x)=>[b,g[x]])))}let l=i/2;for(let h=0;h<l;h++){let c=s+s*h+h*n,m=s+s*h+(h+1)*n,f=(c+m)/2;this.segments.push(new U([[0,c],[0,m],[-n,m],[-n,c]],{closed:!0}));let g=l-h;this.anchors[`p${g}`]=[-n,f],this.anchors[`p${g}_in`]=[0,f],T(this.params,"number",!0)&&this.segments.push(new W([-n/2,f],String(g),{fontsize:T(this.params,"pfontsize",10)})),o&&o[g-1]&&(this.segments.push(new W([.1,f],o[g-1],{align:["left","center"],fontsize:T(this.params,"fontsize",12)})),this.anchors[o[g-1]]=[-n,f],this.anchors[`${o[g-1]}_in`]=[0,f]),this.segments.push(new U([[t,c],[t,m],[t+n,m],[t+n,c]],{closed:!0})),g=l+h+1,this.anchors[`p${g}`]=[t+n,f],this.anchors[`p${g}_in`]=[t,f],T(this.params,"number",!0)&&this.segments.push(new W([t+n/2,f],String(g),{fontsize:T(this.params,"pfontsize",10)})),o&&o[g-1]&&(this.segments.push(new W([t-.1,f],o[g-1],{align:["right","center"],fontsize:T(this.params,"fontsize",12)})),this.anchors[o[g-1]]=[t+n,f],this.anchors[`${o[g-1]}_in`]=[t,f])}}};var Qc={};$a(Qc,{Adc:()=>Ls,Amp:()=>un,And:()=>Bt,Bjt:()=>qr,Bjt2:()=>Hr,BjtNpn:()=>Ht,BjtNpn2:()=>Ss,BjtPnp:()=>rr,BjtPnp2:()=>ln,Breaker:()=>as,Buf:()=>Jt,CPE:()=>ls,Capacitor:()=>Cr,Capacitor2:()=>Cn,CapacitorTrim:()=>Ln,CapacitorVar:()=>In,Circle:()=>ui,Circulator:()=>Os,Connect:()=>pr,Crystal:()=>Un,CurrentMirror:()=>Fr,Dac:()=>Ds,Data:()=>Ms,Decision:()=>Es,Demod:()=>Ns,Diac:()=>on,Diode:()=>et,DiodeShockley:()=>$n,DiodeTVS:()=>Fn,DiodeTunnel:()=>On,DrawTree:()=>l0,DspBox:()=>sr,DspCircle:()=>Yt,DspSpeaker:()=>_s,Ellipse:()=>zs,Filter:()=>Is,FlowBox:()=>cn,Fuse:()=>rs,FuseIEC:()=>Dr,FuseIEEE:()=>dr,FuseUS:()=>os,Inductor:()=>Ir,Inductor2:()=>Lr,Isolator:()=>Fs,Josephson:()=>is,LED:()=>qn,LED2:()=>Hn,LogicTree:()=>gr,Memristor:()=>ns,Memristor2:()=>ss,Mixer:()=>As,NFet:()=>gs,NFet2:()=>ws,NMos:()=>ms,NMos2:()=>ps,Norator:()=>Or,Not:()=>Kt,Nullator:()=>Nr,Opamp:()=>cs,Or:()=>$t,Oscillator:()=>Cs,OscillatorBox:()=>Bs,PFet:()=>bs,PFet2:()=>xs,PMos:()=>ds,PMos2:()=>fs,Photodiode:()=>Yn,Photoresistor:()=>ts,PhotoresistorIEC:()=>Qt,PhotoresistorIEEE:()=>ur,Potentiometer:()=>es,PotentiometerIEC:()=>er,PotentiometerIEEE:()=>mr,Process:()=>hi,Resistor:()=>Zn,ResistorIEC:()=>mt,ResistorVar:()=>Qn,ResistorVarIEC:()=>Zt,ResistorVarIEEE:()=>cr,RoundBox:()=>Yr,RoundProcess:()=>li,Rshunt:()=>Kn,SCR:()=>Xn,STYLE_IEC:()=>Xl,STYLE_IEEE:()=>an,Schottky:()=>Dn,SparkGap:()=>hs,Start:()=>ci,State:()=>mi,StateEnd:()=>Ps,Subroutine:()=>ks,Sum:()=>Ts,SumSigma:()=>Rs,Terminal:()=>hn,Thermistor:()=>Jn,Triac:()=>Gn,Tristate:()=>Bn,VGA:()=>$s,Varactor:()=>jn,VoltageMirror:()=>$r,Zener:()=>Nn,buchheim:()=>Ra,cycloid:()=>Vn,logicparse:()=>Ql,nand:()=>Tn,nor:()=>Rn,pictorial:()=>Kc,resetElementStyleForTests:()=>Wl,setBoxAnchors16:()=>fr,setElementStyle:()=>Gl,xnor:()=>_n,xor:()=>An});function fr(r,e,t){r.center=[e/2,0],r.N=[e/2,t/2],r.E=[e,0],r.S=[e/2,-t/2],r.W=[0,0],r.NW=[0,t/2],r.NE=[e,t/2],r.SW=[0,-t/2],r.SE=[e,-t/2],r.NNE=[3*e/4,t/2],r.NNW=[e/4,t/2],r.SSE=[3*e/4,-t/2],r.SSW=[e/4,-t/2],r.ENE=[e,t/3],r.ESE=[e,-t/3],r.WNW=[0,t/3],r.WSW=[0,-t/3]}function m2(r,e,t,n){let s=n-n*Math.sqrt(2)/2;fr(r,e,t),r.NW=[s,t/2-s],r.NE=[e-s,t/2-s],r.SW=[s,-t/2+s],r.SE=[e-s,-t/2+s],r.NNE=[n<e/4?3*e/4:e-n,t/2],r.NNW=[n<e/4?e/4:n,t/2],r.SSE=[n<e/4?3*e/4:e-n,-t/2],r.SSW=[n<e/4?e/4:n,-t/2],r.ENE=[e,n<t/4?t/4:t/2-n],r.ESE=[e,n<t/4?-t/4:-t/2+n],r.WNW=[0,n<t/4?t/4:t/2-n],r.WSW=[0,n<t/4?-t/4:-t/2+n]}function d2(r,e,t,n){fr(r,e,t);let s=n*Math.sqrt(2)/2;r.SE=[n+s,-s],r.SW=[n-s,-s],r.NE=[n+s,s],r.NW=[n-s,s];let i=n*Math.cos(22.5*Math.PI/180),o=n*Math.cos(67.5*Math.PI/180);r.NNE=[n+o,i],r.ENE=[n+i,o],r.ESE=[n+i,-o],r.SSE=[n+o,-i],r.NNW=[n-o,i],r.WNW=[n-i,o],r.WSW=[n-i,-o],r.SSW=[n-o,-i]}var Yr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,cornerradius:.3});let t=T(this.params,"w",3),n=T(this.params,"h",2),s=T(this.params,"cornerradius",.3);this.segments.push(new U([[0,n/2],[t,n/2],[t,-n/2],[0,-n/2]],{closed:!0,cornerradius:s,fill:"none"})),m2(this.anchors,t,n,s),this.elmParams.drop=[t,0]}},hn=class extends Yr{constructor(e={}){let t=e.h??1.25,n=e.w??3,s=e.anchor??"N";super({...e,w:n,h:t,cornerradius:t/2,anchor:s}),this.elmParams.drop=[n/2,-t/2],this.elmParams.droptheta=-90}},li=Yr,cn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0});let t=T(this.params,"w",3),n=T(this.params,"h",2);this.segments.push(new p([[0,0],[0,n/2],[t,n/2],[t,-n/2],[0,-n/2],[0,0]])),fr(this.anchors,t,n),this.elmParams.drop=[t,0]}},hi=cn,ci=hn,ks=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,s:.3});let t=T(this.params,"s",.3),n=T(this.params,"w",3)+t*2,s=T(this.params,"h",2);this.segments.push(new p([[0,0],[0,s/2],[n,s/2],[n,-s/2],[0,-s/2],[0,0]])),this.segments.push(new p([[n-t,s/2],[n-t,-s/2]])),this.segments.push(new p([[t,s/2],[t,-s/2]])),fr(this.anchors,n,s),this.elmParams.drop=[n,0]}},Ms=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,slant:.5});let t=T(this.params,"w",3),n=T(this.params,"h",2),s=T(this.params,"slant",.5);this.segments.push(new U([[0,0],[s/2,n/2],[t+s/2,n/2],[t-s/2,-n/2],[-s/2,-n/2]],{closed:!0,fill:"none"})),fr(this.anchors,t,n),this.anchors.N=[t/2+s/2,n/2],this.anchors.S=[t/2-s/2,-n/2],this.anchors.NE=[t+s/2,n/2],this.anchors.SE=[t-s/2,-n/2],this.anchors.NW=[s/2,n/2],this.anchors.SW=[-s/2,-n/2],this.anchors.ENE=[t+s/4,n/4],this.anchors.WNW=[s/4,n/4],this.anchors.ESE=[t-s/4,-n/4],this.anchors.WSW=[-s/4,-n/4],this.anchors.NNE=[3*t/4+s/2,n/2],this.anchors.SSE=[3*t/4-s/2,-n/2],this.anchors.NNW=[t/4+s/2,n/2],this.anchors.SSW=[t/4-s/2,-n/2],this.elmParams.drop=[t,0]}},zs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0});let t=T(this.params,"w",3),n=T(this.params,"h",2),i=ze(0,Math.PI*2,50).map(c=>{let m=n/2*Math.sin(c);return[t/2*Math.cos(c)+t/2,m]});i[i.length-1]=[i[0][0],i[0][1]],this.segments.push(new p(i)),fr(this.anchors,t,n);let o=Math.sin(Math.PI/4),a=Math.cos(Math.PI/4),l=Math.sin(Math.PI/8),h=Math.cos(Math.PI/8);this.anchors.SE=[t/2+t/2*a,-n/2*o],this.anchors.SW=[t/2-t/2*a,-n/2*o],this.anchors.NW=[t/2-t/2*a,n/2*o],this.anchors.NE=[t/2+t/2*a,n/2*o],this.anchors.ENE=[t/2+t/2*h,n/2*l],this.anchors.WNW=[t/2-t/2*h,n/2*l],this.anchors.ESE=[t/2+t/2*h,-n/2*l],this.anchors.WSW=[t/2-t/2*h,-n/2*l],this.anchors.NNE=[t/2+t/2*l,n/2*h],this.anchors.NNW=[t/2-t/2*l,n/2*h],this.anchors.SSE=[t/2+t/2*l,-n/2*h],this.anchors.SSW=[t/2-t/2*l,-n/2*h],this.elmParams.drop=[t,0]}},Es=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:4,h:2.25,theta:0,fontsize:14});let t=T(this.params,"w",4),n=T(this.params,"h",2.25),s=T(this.params,"fontsize",14),i=T(this.params,"font",void 0),o=.13,a=e.N,l=e.E,h=e.S,c=e.W;this.segments.push(new U([[0,0],[t/2,n/2],[t,0],[t/2,-n/2]],{closed:!0,fill:"none"})),a&&this.segments.push(new W([t/2+o,n/2+o],a,{align:["left","bottom"],fontsize:s,fontfamily:i})),h&&this.segments.push(new W([t/2+o,-n/2-o],h,{align:["left","top"],fontsize:s,fontfamily:i})),l&&this.segments.push(new W([t+o,o],l,{align:["left","bottom"],fontsize:s,fontfamily:i})),c&&this.segments.push(new W([-o,o],c,{align:["right","bottom"],fontsize:s,fontfamily:i})),fr(this.anchors,t,n),this.anchors.NE=[3*t/4,n/4],this.anchors.NW=[t/4,n/4],this.anchors.SE=[3*t/4,-n/4],this.anchors.SW=[t/4,-n/4],this.anchors.NNE=[5*t/8,3*n/8],this.anchors.NNW=[3*t/8,3*n/8],this.anchors.SSE=[5*t/8,-3*n/8],this.anchors.SSW=[3*t/8,-3*n/8],this.anchors.ENE=[7*t/8,n/8],this.anchors.ESE=[7*t/8,-n/8],this.anchors.WNW=[t/8,n/8],this.anchors.WSW=[t/8,-n/8],this.elmParams.drop=[t,0]}},pr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:1.5,h:1.5,r:.75});let t=T(this.params,"w",1.5),n=T(this.params,"h",1.5);if(e.r!==void 0){let i=e.r;t=i*2,n=i*2}let s=t/2;this.segments.push(new D([s,0],s)),d2(this.anchors,t,n,s),this.elmParams.drop=[t,0]}},ui=pr,mi=pr,Ps=class extends pr{constructor(e={}){let t=e.dr??.15,n=e.w??1.5,s=e.h??1.5;if(e.r!==void 0){let h=e.r;n=h*2,s=h*2}let{r:i,...o}=e;super({...o,w:n,h:s});let l=T(this.params,"w",n)/2;this.segments.push(new D([l,0],l-t))}};var sr=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.5],[1,.5],[1,-.5],[0,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.anchors.N=[.5,.5],this.anchors.S=[.5,-.5],this.anchors.E=[1,0],this.anchors.W=[0,0],this.elmParams.drop=[1,0]}},Yt=class extends N{constructor(e={}){super(e);let t=e.radius??.5,n=t*Math.SQRT2/2;this.segments.push(new D([t,0],t)),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[2*t,0],this.anchors.N=[t,t],this.anchors.S=[t,-t],this.anchors.E=[2*t,0],this.anchors.W=[0,0],this.anchors.NW=[t-n,n],this.anchors.NE=[t+n,n],this.anchors.SW=[t-n,-n],this.anchors.SE=[t+n,-n],this.anchors.center=[t,0]}},Ts=class extends Yt{constructor(e={}){super(e),this.segments.push(new p([[.5,.2],[.5,-.2]])),this.segments.push(new p([[.3,0],[.7,0]]))}},Rs=class extends Yt{constructor(e={}){super(e),this.segments.push(new W([.45,0],"\u03A3",{align:["center","center"]}))}},As=class extends Yt{constructor(e={}){super(e);let t=.5,n=t*Math.SQRT2/2;this.segments.push(new p([[t+n,n],[t-n,-n]],{lw:1})),this.segments.push(new p([[t+n,-n],[t-n,n]],{lw:1})),this.elmParams.lblloc="top",this.elmParams.lblofst=.2;let s=e.font,i=e.fontsize??10;e.N&&this.segments.push(new W([t,t/2+.01],e.N,{fontfamily:s,fontsize:i})),e.S&&this.segments.push(new W([t,-t/2-.065],e.S,{fontfamily:s,fontsize:i})),e.E&&this.segments.push(new W([t*1.5+.05,0],e.E,{fontfamily:s,fontsize:i})),e.W&&this.segments.push(new W([t/2-.05,0],e.W,{fontfamily:s,fontsize:i}))}},_s=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.25],[.25,.25],[.25,-.25],[0,-.25],[0,0]])),this.segments.push(new p([[.25,.25],[.5,.5],[.5,-.5],[.25,-.25],[.25,.25]]))}},un=class extends N{constructor(e={}){super(e);let t=1,n=.75;this.segments.push(new p([[0,0],[0,-t/2],[n,0],[0,t/2],[0,0]])),this.elmParams.drop=[n,0],this.anchors.input=[0,0],this.anchors.out=[n,0]}};function Lc(){return ze(-Math.PI,Math.PI,20).map(e=>[e/Math.PI*.3+.5,-Math.sin(e)/10])}var Bs=class extends sr{constructor(e={}){super(e),this.segments.push(new p(Lc()))}},Cs=class extends Yt{constructor(e={}){super(e),this.segments.push(new p(Lc()))}},Is=class extends sr{constructor(e={}){super(e);let t=Lc(),n=t.map(([o,a])=>[o,a+.25]),s=t.map(([o,a])=>[o,a-.25]);this.segments.push(new p(t)),this.segments.push(new p(n)),this.segments.push(new p(s));let i=e.response;if(i){let o=i.toLowerCase();(o==="bp"||o==="lp")&&this.segments.push(new p([[.45,.17],[.55,.33]])),(o==="bp"||o==="hp")&&this.segments.push(new p([[.45,-.33],[.55,-.17]])),(o==="lp"||o==="hp"||o==="notch")&&this.segments.push(new p([[.45,-.08],[.55,.08]]))}}},Ls=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[.22,.5],[1.4,.5],[1.4,-.5],[.22,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[1.4,0],this.anchors.input=[0,0],this.anchors.out=[1.4,0],this.anchors.E=[1.4,0],this.anchors.W=[0,0]}},Ds=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.5],[1.18,.5],[1.4,0],[1.18,-.5],[0,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[1.4,0],this.anchors.input=[0,0],this.anchors.out=[1.4,0],this.anchors.E=[1.4,0],this.anchors.W=[0,0]}},Ns=class extends sr{constructor(e={}){super(e),this.segments.push(new p([[.15,0],[.3,0]])),this.segments.push(new p([[.3,.25],[.7,0],[.3,-.25],[.3,.25]])),this.segments.push(new p([[.7,.25],[.7,-.25]])),this.segments.push(new p([[.7,0],[.85,0]]))}},Os=class extends Yt{constructor(e={}){super(e);let t=.5;this.segments.push(new xe([.5,0],.9*t,.9*t,{theta1:20,theta2:200,arrow:"cw"}))}},Fs=class extends sr{constructor(e={}){super(e);let t=.25;this.segments.push(new p([[t,0],[1-t,0]],{arrow:"->"}))}},$s=class extends un{constructor(e={}){super(e);let t=e.tuneup??!0;this.segments.push(new p([[-.1,-.5],[.75,.5]],{arrow:"->"})),this.anchors.tune=[.325,t?.5:-.5]}};var Kc={};$a(Kc,{Breadboard:()=>Uc,CapacitorCeramic:()=>Gc,CapacitorElectrolytic:()=>Yc,CapacitorMylar:()=>Xc,DIP:()=>Vc,Diode:()=>Oc,ElementPictorial:()=>Ta,FritzingPart:()=>Jc,INCH:()=>Ce,LED:()=>qs,LEDBlue:()=>qc,LEDGreen:()=>jc,LEDOrange:()=>Fc,LEDWhite:()=>Hc,LEDYellow:()=>$c,MILLIMETER:()=>p2,PINSPACING:()=>ee,Resistor:()=>Nc,TO92:()=>Wc,fritzParts:()=>x2,parseSizeToUnits:()=>g2,resistorColors:()=>w1});var js=class extends N{constructor(e,t,n,s={}){super(s);let{xy:i,imgfmt:o,zorder:a,...l}=s;this.segments.push(new Br(e,{xy:i??[0,0],width:t,height:n,zorder:a??1,imgfmt:o})),this.elmParams.theta=0;let h=t/2,c=n/2,m=(i?.[0]??0)+h,f=(i?.[1]??0)+c;this.anchors.center=[m,f],this.anchors.N=[m,f+c],this.anchors.S=[m,f-c],this.anchors.E=[m+h,f],this.anchors.W=[m-h,f]}};var Ce=3.5,p2=Ce/25.4,ee=.1*Ce,Pa="#333",b1="#777",Lt="#A0A0A0",f2=96;function g2(r){return b2(r)/f2*Ce}function b2(r){let e=r.match(/^([0-9.]+)\s*(px|pt|in|mm|cm|pc|em|ex|%)?$/i);if(!e)return 0;let t=parseFloat(e[1]);switch((e[2]??"px").toLowerCase()){case"px":return t;case"pt":return t*(96/72);case"in":return t*96;case"mm":return t*(96/25.4);case"cm":return t*(96/2.54);case"pc":return t*16;default:return t}}var Dc={0:"black",1:"brown",2:"red",3:"orange",4:"yellow",5:"green",6:"blue",7:"violet",8:"gray",9:"white",[-1]:"gold",[-2]:"silver",[-3]:"pink"},w2={1:"brown",2:"red","0.05":"orange","0.02":"yellow","0.5":"green","0.25":"blue","0.1":"violet","0.01":"gray",5:"gold",10:"silver"};function w1(r,e){let t=Math.floor(Math.log10(r))-1,n=r/10**t;n<10&&(t-=1,n=r/10**t);let s=Math.floor(n/10),i=Math.floor(n%10),o=e!==void 0?w2[String(e)]:void 0;return[Dc[s],Dc[i],Dc[t],o]}var Ta=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{leadcolor:Lt,lw:3})}},Nc=class extends Ta{constructor(e=1e3,t,n={}){super(n),Object.assign(this.defaults,{fill:"blanchedalmond"});let s=ee,i=ee/2,o=i*.9;this.segments.push(new p([[0,0],[NaN,NaN],[i*3+s,0]])),this.segments.push(new ut(["M",[0,0],"Q",[0,i],[i,i],"Q",[i*1.25,i],[i*1.5,o],"L",[i*1.5+s,o],"Q",[i*1.75+s,i],[i*2+s,i],"Q",[i*3+s,i],[i*3+s,0],"Q",[i*3+s,-i],[i*2+s,-i],"Q",[i*1.75+s,-i],[i*1.5+s,-o],"L",[i*1.5,-o],"Q",[i*1.25,-i],[i,-i],"Q",[0,-i],[0,0],"Z"],{color:"black",lw:1}));let a=.16,l=.32,h=.48,c=.68,m=.08,[f,g,b,x]=w1(e,t);this.segments.push(new U([[a,o],[a,-o],[a+m,-o],[a+m,o]],{fill:f,lw:.1,zorder:2})),this.segments.push(new U([[l,o],[l,-o],[l+m,-o],[l+m,o]],{fill:g,lw:.1,zorder:2})),this.segments.push(new U([[h,o],[h,-o],[h+m,-o],[h+m,o]],{fill:b,lw:.1,zorder:2})),x&&this.segments.push(new U([[c,o],[c,-o],[c+m,-o],[c+m,o]],{fill:x,lw:.1,zorder:2}))}},Oc=class extends Ta{constructor(e={}){super(e),Object.assign(this.defaults,{fill:Pa,stripe_color:"silver"});let t=ee/2,n=ee*2.5,s=n*.78,i=.08,o=this.params.stripe_color??"silver";Vr(o),this.segments.push(new p([[0,0],[NaN,NaN],[n,0]])),this.segments.push(new U([[0,t],[n,t],[n,-t],[0,-t]],{closed:!0,lw:1,color:"black",zorder:2})),this.segments.push(new U([[s,t],[s+i,t],[s+i,-t],[s,-t]],{closed:!0,lw:1,color:"none",fill:o,zorder:2}))}},qs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead_length:ee*5,fill:"#dd4433",theta:0});let t=.197*Ce,n=.338*Ce,s=this.params.lead_length??ee*5,i=ee*5;this.segments.push(new p([[0,0],[0,s]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,s-i*.3],[ee*.6,s-i*.2],[ee*.6,s]],{color:Lt,lw:4}));let o=t*.8,a=ee/2-t/2,l=ee/2,h=s+n;this.segments.push(new ut(["M",[a,s],"Q",[l,s-i*.2],[a+t,s],"L",[a+t,h-o],"C",[a+t,h],[a,h],[a,h-o],"Z"],{color:"none"}));let c=.039*Ce;this.segments.push(new ut(["M",[a,s+c/2],"Q",[l*.5,s-i*.16+c],[a+t*.7,s-i*.03],"L",[a+t,s+c/2]],{color:"#FFFFFF55",lw:2}));let m=a+.03*Ce;this.segments.push(new ut(["M",[m,s+c*2],"L",[m,h-o],"Q",[m,h-o+.04*Ce],[m+.04*Ce,h-o+.07*Ce]],{color:"#FFFFFF55",lw:3}))}},Fc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#efa207"})}},$c=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#f1de0f"})}},jc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#4be317"})}},qc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#3892bc"})}},Hc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#e5e5e5"})}},Yc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#303b91",lead_length:.2*Ce,cap_color:"#CCC",stripe_color:"#dff1f6",theta:0});let t=ee*1.7,n=.3*Ce,s=this.params.lead_length??.2*Ce;this.segments.push(new p([[0,0],[0,s]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,s]],{color:Lt,lw:4}));let i=ee*2,o=i*.3,a=ee/2-t/2,l=ee/2,h=s+n;this.segments.push(new ut(["M",[a,s],"Q",[l,s-i*.3],[a+t,s],"L",[a+t,h-o],"Q",[l,h],[a,h-o],"Z"],{color:"none"}));let c=this.params.cap_color??"#CCC";this.segments.push(new xe([l,h-o-.01*Ce],t-.03*Ce,o*.9,{theta1:0,theta2:360,fill:c,color:"none",lw:.5,zorder:2}));let m=.039*Ce/2;this.segments.push(new ut(["M",[a,s+m],"Q",[l,s-i*.1],[a+t,s+m]],{color:"#FFFFFF99",fill:"none",lw:1.5}));let f=this.params.stripe_color??"#dff1f6",g=a+.03*Ce;this.segments.push(new ut(["M",[g,s+m],"L",[g,h-o*2]],{color:f,fill:"none",lw:3}))}},Xc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#8c2510",lead_length:.4*Ce,theta:0});let t=ee*1.75,n=t*.75,s=ee/2,i=s-t/2,o=this.params.lead_length??.4*Ce;this.segments.push(new p([[0,0],[0,o]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,o]],{color:Lt,lw:4}));let a=.02*Ce;this.segments.push(new ut(["M",[i,o],"Q",[i-a,o+n/2],[i,o+n],"Q",[s,o+n+a],[i+t,o+n],"Q",[i+t+a,o+n/2],[i+t,o],"Q",[s,o+a/2],[i,o],"Z"],{color:"none"}));let l=o+n-.025*Ce;this.segments.push(new p([[-.01*Ce,l],[ee*.8,l]],{color:"#FFFFFF44",lw:3}))}},Gc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#e2800b",radius:.1*Ce,lead_length:.4*Ce,theta:0});let t=this.params.radius??.1*Ce,n=this.params.lead_length??.4*Ce,s=[ee/2,n+t-.05*Ce];this.segments.push(new p([[0,0],[0,n]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,n]],{color:Lt,lw:4})),this.segments.push(new D(s,t,{color:"none",zorder:2})),this.segments.push(new xe(s,t*2*.7,t*2*.7,{theta1:100,theta2:200,color:"#FFFFFF44",zorder:2}))}},Wc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{theta:0});let t=.175*Ce,n=.17*Ce*.9,s=ee*1.2,i=ee*1.3,o=ee-t/2,a=ee;this.segments.push(new p([[0,0],[0,ee*.8],[ee/2,i]],{color:Lt,lw:4})),this.segments.push(new p([[a,0],[a,i]],{color:Lt,lw:4})),this.segments.push(new p([[ee*2,0],[ee*2,ee*.8],[3*ee/2,i]],{color:Lt,lw:4})),this.segments.push(new U([[o,i],[o+t,i],[o+t,i+n],[o,i+n]],{fill:Pa,lw:1,color:b1,zorder:2})),this.segments.push(new xe([a,i+n],t,s,{theta1:0,theta2:180,fill:Pa,lw:1,color:b1,zorder:2})),this.anchors.pin1=[0,0],this.anchors.pin2=[ee,0],this.anchors.pin3=[ee*2,0],this.anchors.case_center=[a,i+n/2],this.elmParams.lblloc="case_center",this.elmParams.lblalign=["center","center"]}},Vc=class extends N{constructor(e=8,t=!1,n={}){super(n),Object.assign(this.defaults,{theta:0});let s=e;s%2!==0&&(s+=1);let i=t?6*ee:3*ee,o=ee*.25,a=ee*.25,l=(s/2-1)*ee,h=i/2,c=ee*.75,m=a,f=i-a,g=5;for(let b=0;b<s/2;b++)this.segments.push(new p([[0,-b*ee],[m,-b*ee]],{color:Lt,lw:g,zorder:1})),this.segments.push(new p([[f,-b*ee],[f+a,-b*ee]],{color:Lt,lw:g,zorder:1})),this.anchors[`pin${b+1}`]=[0,-b*ee],this.anchors[`pin${s-b}`]=[f+a,-b*ee];this.segments.push(new U([[a,o],[f,o],[f,-o-l],[a,-o-l]],{fill:Pa,lw:1,color:"#444"})),this.segments.push(new xe([h,o],c,c,{theta1:180,theta2:0,lw:1,color:"#777",fill:"#555"})),this.elmParams.lblloc="center",this.elmParams.lblrotate=!0,this.elmParams.lblofst=0}},Uc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{color:"#DDD",fill:"#F8F8F5",shadow_color:"#E5E5E5",text_color:"#666"});let t=.02,n=.1,s=this.params.shadow_color??"#E5E5E5",i=this.params.text_color??"#666";Vr(s),Vr(i);let o=(k,M)=>{this.segments.push(new U([[k-n,M+n],[k+n,M+n],[k+n,M-n]],{fill:!0,color:s,lw:2})),this.segments.push(new U([[k-t,M-t],[k-t,M+t],[k+t,M+t],[k+t,M-t]],{fill:!0,color:Pa,lw:2}))},a=30,l=5,h=.37*Ce,c=(h-ee)/2,m=2.1*Ce,f=3.3*Ce,g=1.5*c,b=-c,x=b+m;this.segments.push(new U([[b,g],[x,g],[x,g-f],[b,g-f]],{lw:2}));let v=0,S=0;for(let k=0;k<2;k++)for(let M=0;M<a;M++){if(M%6===0)continue;let _=[v,S-M*ee],B=[v+ee,S-M*ee];o(..._),o(...B),this.anchors[`L1_${M}`]=_,this.anchors[`L2_${M}`]=B}v=x-c;for(let k=0;k<2;k++)for(let M=0;M<a;M++){if(M%6===0)continue;let _=[v,S-M*ee],B=[v-ee,S-M*ee];o(..._),o(...B),this.anchors[`R1_${M}`]=B,this.anchors[`R2_${M}`]=_}v=h;for(let k=0;k<l;k++){let M=String.fromCharCode(65+k);this.segments.push(new W([v+k*ee,S+ee],M,{fontsize:8,rotation:0,align:["center","center"],color:i,zorder:1}));for(let _=0;_<a;_++){let B=[v+k*ee,S-_*ee];o(...B),this.anchors[`${M}${_+1}`]=B}}for(let k=0;k<l;k++){let M=String.fromCharCode(70+k);this.segments.push(new W([v+ee*7+k*ee,S+ee],M,{fontsize:8,rotation:0,align:["center","center"],color:i,zorder:1}));for(let _=0;_<a;_++){let B=[v+ee*7+k*ee,S-_*ee];o(...B),this.anchors[`${M}${_+1}`]=B}}for(let k=0;k<a;k++)this.segments.push(new W([v-ee,S-k*ee-.04],String(k+1),{fontsize:8,rotation:0,align:["center","bottom"],color:i,zorder:1})),this.segments.push(new W([v+ee*12,S-k*ee-.04],String(k+1),{fontsize:8,rotation:0,align:["center","bottom"],color:i,zorder:1}));this.segments.push(new p([[b+c*.4,g-ee*2],[b+c*.4,g-f+ee]],{color:"red",lw:.5})),this.segments.push(new p([[b+h-c*.4,g-ee*2],[b+h-c*.4,g-f+ee]],{color:"blue",lw:.5})),this.segments.push(new p([[x-c*.4,g-ee*2],[x-c*.4,g-f+ee]],{color:"blue",lw:.5})),this.segments.push(new p([[x-h+c*.4,g-ee*2],[x-h+c*.4,g-f+ee]],{color:"red",lw:.5}))}},Jc=class extends js{constructor(t,n,s,i,o,a={}){super(t,n,s,{imgfmt:"svg",...a});z(this,"info");if(this.info=o,i)for(let[l,h]of Object.entries(i))this.anchors[l]=h}};function x2(r){throw new Error("fritzParts requires a .fzpz zip parser. Use a library like 'jszip' and pass the extracted SVG/anchors to FritzingPart directly.")}var Pe=class extends se{constructor(e={}){let{arrow:t,...n}=e;super(n),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25});let s=this.params.arrowwidth,i=this.params.arrowlength;this.segments.push(new p([[0,0]],{arrow:t,arrowwidth:s,arrowlength:i}))}};var x1=H,di=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,to:[1,1]})}toXY(e){return this.userParams.to=e,this}delta(e=0,t=0){return this.userParams.delta=[e,t],this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.elmParams.theta=0;let s=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),i=this.params.to!==void 0?A.fromXY(this.params.to):A.fromXY(e),o=this.params.delta,a=this.params.n??1,l=this.params.dy??.6,h=this.params.xstart,c=this.params.arrow,m,f;if(o!==void 0?[m,f]=o:(m=i.x!==void 0?i.x-s.x:this.params.to[0]-(this.params.at!==void 0?this.params.at[0]:e[0]),f=i.x!==void 0?i.y-s.y:this.params.to[1]-(this.params.at!==void 0?this.params.at[1]:e[1])),Math.abs(f)<.05)for(let g=0;g<a;g++){let b=-g*l;this.segments.push(new p([[0,b],[m,b]],{arrow:c}))}else{let g;h!==void 0?f>0?g=m*h:g=m*h-l-l*(a-1)*h:m>0?g=m/2-l*(a-1)/2:g=m/2+l*(a-1)/2;for(let b=0;b<a;b++){let x=-b*l,v;f>0?v=m>0?g+l*b:g-l*b:v=m>0?g+(a-b)*l:g-(a-b)*l,this.segments.push(new p([[0,x],[v,x],[v,x+f],[m,x+f]],{arrow:c}))}}return super._place(e,t,n)}},Hs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,to:[3,-2],theta:0,n:1})}toXY(e){return this.userParams.to=e,this}delta(e=0,t=0){return this.userParams.delta=[e,t],this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),i=this.params.delta,o=this.params.to,a=this.params.n??1,l=this.params.dy??.6,h=this.params.arrow,c,m;i!==void 0?[c,m]=i:(c=o[0]-s.x,m=o[1]-s.y);let f=0;for(let g=0;g<a;g++){let b=-g*l;m>0?f=c<0?c-g*l:c+g*l:f=c>0?c+(a-g-1)*l:c-(a-g-1)*l,this.segments.push(new p([[0,b],[f,b],[f,m]],{arrow:h}))}return this.anchors.mid=[c/2,0],this.elmParams.lblloc="mid",this.elmParams.drop=[f,m],this.elmParams.droptheta=m>0?90:-90,super._place(e,t,n)}},pi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,style:"round",numbering:"lr",pinfontsizeleft:9,pinfontsizeright:9,edge:.3,pinfill:"bg",shownumber:!1,pinalignleft:"bottom",pinalignright:"bottom",pinrad:.1});let t=e.rows??4,n=e.cols??1,s=e.pinsleft??[],i=e.pinsright??[];this.elmParams.d="right";let o=this.params.pinspacing??.6,a=this.params.edge??.3,l=this.params.pinrad??.1,h=this.params.style??"round",c=this.params.numbering??"lr",m=this.params.shownumber??!1,f=this.params.pinfill??"bg",g=this.params.pinfontsizeleft??9,b=this.params.pinfontsizeright??9,x=this.params.pinalignleft??"bottom",v=(n-1)*o+a*2,S=(t-1)*o+a*2;this.segments.push(new U([[0,0],[0,S],[v,S],[v,0]]));for(let k=0;k<t;k++)for(let M=0;M<n;M++){let _=M*o+a,B=S-k*o-a,$=[_,B];h==="square"?this.segments.push(new U([[_-l,B-l],[_+l,B-l],[_+l,B+l],[_-l,B+l]],{fill:"bg",zorder:4})):h==="screw"?(this.segments.push(new D($,l*1.75,{fill:f,zorder:4})),this.segments.push(new p([[_+l,B+l],[_-l,B-l]],{zorder:5}))):this.segments.push(new D($,l,{fill:f,zorder:4}));let Y;if(c==="lr"||c===!0?Y=String(k*n+M+1):c==="ud"?Y=String(k+M*t+1):Y=M%2?String(t*M+(t-k)):String(k+1),this.anchors[`pin${Y}`]=$,m){let Z=[M%2?v+.05:-.05,B],L=M%2?"left":"right";this.segments.push(new W(Z,Y,{fontsize:g,align:[L,"bottom"]}))}if(s.length>0&&(n===1||!(M%2))){let Z=[-.05,B];this.segments.push(new W(Z,s[k]??"",{fontsize:g,align:["right",x]}))}if(i.length>0&&(n===1||M%2)){let Z=[v+.05,B];this.segments.push(new W(Z,i[k]??"",{fontsize:b,align:["left",x]}))}}}},fi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,pinrad:.1,theta:0});let t=this.params.pinrad??.1,n=this.params.pinspacing??.6,s=t*2.5;this.segments.push(new U([[-s,-s],[n+s,-s],[n+s,s],[-s,s]]))}},gi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,lwbus:4,l:3,slantx:.5}),this.elmParams.theta=0;let t=e.n??1,n=e.up??!0,s=this.params.l??3,i=this.params.dy??.6,o=this.params.lwbus??4,a=this.params.slantx??.5,l=n?a:-a;for(let h=0;h<t;h++){let c=-h*i;this.segments.push(new p([[0,c],[s-a,c],[s,c+l]])),this.anchors[`pin${h+1}`]=[0,c]}this.segments.push(new p([[s,a],[s,l-t*i]],{lw:o})),this.elmParams.drop=[s,a],this.anchors.start=[s,a],this.anchors.end=[s,l-t*i]}},bi=class extends Pe{constructor(e={}){super(e),Object.assign(this.defaults,{lw:4})}},a0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=4*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<4;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${9-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(9-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<5;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${5-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(5-c),{fontsize:9,align:["center","bottom"]}))}}},wi=class extends a0{},xi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",number:!1,pinrad:.1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=12*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<12;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${25-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(25-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<13;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${13-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(13-c),{fontsize:9,align:["center","bottom"]}))}}},vi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=7*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<7;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${15-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(15-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<8;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${8-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(8-c),{fontsize:9,align:["center","bottom"]}))}}},yi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=18*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<18;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${37-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(37-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<19;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${19-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(19-c),{fontsize:9,align:["center","bottom"]}))}}},Si=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t*2+n*2,l=16*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<17;c++){let m=[n,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${50-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(50-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<16;c++){let m=[n+t,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${33-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(33-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<17;c++){let m=[n+t*2,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${17-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(17-c),{fontsize:9,align:["center","bottom"]}))}}},ki=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.4,radiusinner:.12,fillinner:"bg"});let t=this.params.radius??.4,n=this.params.radiusinner??.12,s=this.params.fillinner??"bg";this.segments.push(new D([0,0],t)),this.segments.push(new D([0,0],n,{fill:s,zorder:4})),this.anchors.center=[0,0],this.anchors.N=[0,t],this.anchors.S=[0,-t],this.anchors.E=[t,0],this.anchors.W=[-t,0]}},Mi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pluggap:.18});let t=this.params.pluggap??.18;this.segments.push(new p([[0,0],[1,0],x1,[1-.25,.25],[1,0],[1-.25,-.25]])),this.elmParams.drop=[1+t,0]}},zi=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[-.25,.25],x1,[-.25,-.25],[0,0],[1,0]])),this.elmParams.drop=[1,0]}},Ei=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{r:.18,open:!0,fill:"bg",drop:[0,0],theta:0,zorder:4});let t=this.params.r??.18;this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0];let n=this.params.open??!0;this.elmParams.fill=n?"bg":!0,this.segments.push(new D([0,0],t));let s=1,i=2;this.segments.push(new p([[-s*t,-i*t],[s*t,i*t]]))}};var gr=class{constructor(e,...t){z(this,"node");z(this,"children");this.node=e,this.children=t}[Symbol.iterator](){return this.children[Symbol.iterator]()}},l0=class r{constructor(e,t=null,n=0,s=1){z(this,"x",-1);z(this,"y");z(this,"node");z(this,"children");z(this,"parent");z(this,"thread",null);z(this,"mod",0);z(this,"ancestor",this);z(this,"change",0);z(this,"shift",0);z(this,"number");z(this,"_lmostSibling",null);this.y=n,this.node=e.node,this.parent=t,this.number=s,this.children=e.children.map((i,o)=>new r(i,this,n+1,o+1)),this.ancestor=this}left(){return this.thread??(this.children.length>0?this.children[0]:null)}right(){return this.thread??(this.children.length>0?this.children[this.children.length-1]:null)}lbrother(){let e=null;if(this.parent)for(let t of this.parent.children){if(t===this)return e;e=t}return e}get lmostSibling(){return!this._lmostSibling&&this.parent&&this!==this.parent.children[0]&&(this._lmostSibling=this.parent.children[0]),this._lmostSibling}};function S1(r,e){r.x+=e;for(let t of r.children)S1(t,e)}function v2(r){let e=0,t=0;for(let n=r.children.length-1;n>=0;n--){let s=r.children[n];s.x+=e,s.mod+=e,t+=s.change,e+=s.shift+t}}function y2(r,e,t){return e.parent&&e.parent.children.includes(r.ancestor)?r.ancestor:t}function S2(r,e,t){let n=e.number-r.number;e.change-=t/n,e.shift+=t,r.change+=t/n,e.x+=t,e.mod+=t}function k2(r,e,t){let n=r.lbrother();if(n!==null){let s=r,i=r,o=n,a=r.lmostSibling,l=r.mod,h=r.mod,c=o.mod,m=a.mod;for(;o.right()&&s.left();){o=o.right(),s=s.left(),a=a.left(),i=i.right(),i.ancestor=r;let f=o.x+c-(s.x+l)+t;f>0&&(S2(y2(o,r,e),r,f),l+=f,h+=f),c+=o.mod,l+=s.mod,m+=a.mod,h+=i.mod}o.right()&&!i.right()?(i.thread=o.right(),i.mod+=c-h):(s.left()&&!a.left()&&(a.thread=s.left(),a.mod+=l-m),e=r)}return e}function k1(r,e=1){if(r.children.length===0)r.lmostSibling?r.x=r.lbrother().x+e:r.x=0;else{let t=r.children[0];for(let i of r.children)k1(i),t=k2(i,t,e);v2(r);let n=(r.children[0].x+r.children[r.children.length-1].x)/2,s=r.lbrother();s?(r.x=s.x+e,r.mod=r.x-n):r.x=n}return r}function M1(r,e=0,t=0,n=null){r.x+=e,r.y=t,(n===null||r.x<n)&&(n=r.x);for(let s of r.children)n=M1(s,e+r.mod,t+1,n);return n}function Ra(r){let e=k1(new l0(r)),t=M1(e);return t<0&&S1(e,-t),e}var M2=new Set(["and","or","not","nand","nor","xor","xnor","true","false"]),z1=(o=>(o[o.IDENT=0]="IDENT",o[o.KEYWORD=1]="KEYWORD",o[o.LPAREN=2]="LPAREN",o[o.RPAREN=3]="RPAREN",o[o.SYMBOL=4]="SYMBOL",o[o.EOF=5]="EOF",o))(z1||{});function z2(r){let e=[],t=0;for(;t<r.length;){let n=r[t];if(/\s/.test(n)){t++;continue}if(n==="("){e.push({tt:2,val:"("}),t++;continue}if(n===")"){e.push({tt:3,val:")"}),t++;continue}if("&|+~\xAC\u2227\u2228\u2295\u22BB".includes(n)){e.push({tt:4,val:n}),t++;continue}if(/[$_a-zA-Z]/.test(n)){let s="";for(;t<r.length&&/[$_a-zA-Z0-9]/.test(r[t]);)s+=r[t],t++;M2.has(s)?e.push({tt:1,val:s}):e.push({tt:0,val:s});continue}throw new Error(`logicparse: unexpected character '${n}'`)}return e.push({tt:5,val:""}),e}var Zc=class{constructor(e){z(this,"tokens");z(this,"pos",0);this.tokens=e}peek(){return this.tokens[this.pos]}advance(){return this.tokens[this.pos++]}expect(e,t){let n=this.advance();if(n.tt!==e||t!==void 0&&n.val!==t)throw new Error(`logicparse: expected ${t??z1[e]}, got '${n.val}'`);return n}parse(){let e=this.xorExpr();if(this.peek().tt!==5)throw new Error(`logicparse: unexpected token '${this.peek().val}'`);return e}isNotOp(e){return e.tt===1&&e.val==="not"||e.tt===4&&(e.val==="~"||e.val==="\xAC")}isAndOp(e){return e.tt===1&&(e.val==="and"||e.val==="nand")||e.tt===4&&(e.val==="&"||e.val==="\u2227")}isOrOp(e){return e.tt===1&&(e.val==="or"||e.val==="nor")||e.tt===4&&(e.val==="|"||e.val==="\u2228"||e.val==="+")}isXorOp(e){return e.tt===1&&(e.val==="xor"||e.val==="xnor")||e.tt===4&&(e.val==="\u2295"||e.val==="\u22BB")}xorExpr(){let e=this.orExpr();for(;this.isXorOp(this.peek());){let t=this.advance(),n=this.orExpr();e={kind:"binary",op:t.val,left:e,right:n}}return e}orExpr(){let e=this.andExpr();for(;this.isOrOp(this.peek());){let t=this.advance(),n=this.andExpr();e={kind:"binary",op:t.val,left:e,right:n}}return e}andExpr(){let e=this.unary();for(;this.isAndOp(this.peek());){let t=this.advance(),n=this.unary();e={kind:"binary",op:t.val,left:e,right:n}}return e}unary(){return this.isNotOp(this.peek())?(this.advance(),{kind:"unary",operand:this.unary()}):this.atom()}atom(){let e=this.peek();if(e.tt===2){this.advance();let t=this.xorExpr();return this.expect(3,")"),t}if(e.tt===0||e.tt===1&&(e.val==="true"||e.val==="false"))return this.advance(),{kind:"ident",name:e.val};throw new Error(`logicparse: unexpected token '${e.val}'`)}};function Zl(r,e){return r.kind==="binary"&&r.op===e?[...Zl(r.left,e),...Zl(r.right,e)]:[r]}function v1(r){return{"&":"and","\u2227":"and","|":"or","\u2228":"or","+":"or","\u2295":"xor","\u22BB":"xor"}[r]??r}var E2={and:"nand",or:"nor",not:"buf",nand:"and",nor:"or",buf:"not",xor:"xnor",xnor:"xor"};function Pi(r){if(r.kind==="ident")return new gr(r.name);if(r.kind==="unary"){if(r.operand.kind==="ident")return new gr("not",Pi(r.operand));let n=r.operand;if(n.kind==="binary"){let s=v1(n.op),i=E2[s];if(i){let o=Zl(n,n.op);return new gr(i,...o.map(Pi))}}return n.kind==="unary"?Pi(n.operand):new gr("not",Pi(n))}let e=v1(r.op),t=Zl(r,r.op);return new gr(e,...t.map(Pi))}var E1={and:Bt,or:$t,not:Kt,buf:Jt};function P2(r,e){let t=E1[r];if(t)return new t(e);switch(r){case"nand":return Tn(e);case"nor":return Rn(e);case"xor":return An(e);case"xnor":return _n(e);default:return new Bt(e)}}function y1(r){return r in E1||["nand","nor","xor","xnor"].includes(r)}function T2(r,e=.7,t=2,n){let s=new lr;s.unit=t;let i=Ra(r);function o(a,l=0,h){let c=a.node==="not"||a.node==="buf",m={d:"r",at:[a.y*-t,-a.x*e],anchor:"end",l:t,...c?{}:{inputs:a.children.length}},f=P2(a.node,m);h&&f.label(h,{loc:"end"});for(let g=0;g<a.children.length;g++){let b=a.children[g],x=c?"start":`in${g+1}`;y1(b.node)||f.label(b.node,{loc:x})}s.add(f);for(let g=0;g<a.children.length;g++){let b=a.children[g],x=c?"start":`in${g+1}`;if(y1(b.node)){let v=o(b,l+1);s.add(new Hs({at:[f,x],to:v.anchors.end}))}}return f}return o(i,0,n),s}function Ql(r,e={}){let{gateW:t=2,gateH:n=.75,outlabel:s}=e,i=z2(r),o=new Zc(i).parse(),a=Pi(o);return T2(a,n,t,s)}var eh=.12,R2=.4,Ti=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,theta:0,drop:[0,0]});let n=this.params.lead!==!1?R2:0;this.segments.push(new p([[0,0],[0,-n],[-.25,-n],[.25,-n],H,[-.25*.7,-eh-n],[.25*.7,-eh-n],H,[-.25*.2,-eh*2-n],[.25*.2,-eh*2-n]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}};function P1(r="svg"){if(r==="matplotlib")throw new Error("@skillpet/circuit: use('matplotlib') is not supported; only 'svg' is available.")}function T1(r=!0,e=!0){kt({dwgbbox:r,elmbbox:e})}function R1(r="default"){switch(r){case"default":kt({bgcolor:"white",color:"black"});break;case"dark":kt({color:"white",bgcolor:"black"});break;case"solarizedd":kt({bgcolor:"#002b36",color:"#657b83"});break;case"solarizedl":kt({bgcolor:"#eee8d5",color:"#073642"});break;case"onedork":kt({bgcolor:"#373e4b",color:"#899ab8"});break;case"oceans16":kt({bgcolor:"#384151",color:"#CDD2E9"});break;case"monokai":kt({bgcolor:"#232323",color:"#BBBBBB"});break;case"gruvboxl":kt({bgcolor:"#ebdbb2",color:"#3c3836"});break;case"gruvboxd":kt({bgcolor:"#1d2021",color:"#d5c4a1"});break;case"grade3":kt({bgcolor:"#ffffff",color:"#3f3d46"});break;case"chesterish":kt({bgcolor:"#323A48",color:"#92A2BD"});break;default:throw new Error(`Unknown theme ${r}`)}}var Aa=class{constructor(){z(this,"_text","text");z(this,"_svg2",!0);z(this,"precision",3);z(this,"useBatik",!1)}get text(){return this._text}set text(e){this._text=e}get svg2(){return this._svg2}set svg2(e){this._svg2=e}},A1=new Aa;var $e=.25*.75,pt=.25*1.5,St=.25*.75,rt=class extends se{constructor(e={}){super(e),this.elmParams.theta=90,this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.5,0],.5))}},Ri=class extends rt{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[.25,-t/2],[.25,t/2]])),this.segments.push(new p([[.75-t/2,0],[.75+t/2,0]])),this.segments.push(new p([[.75,-t/2],[.75,t/2]]))}},Ai=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,0],[.75,0]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},_i=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{sin_lw:void 0,sin_color:void 0});let t=ze(-.25,.25,25),s=t.map(i=>.2*Math.sin((i-.25)*Math.PI*2/.5)+.5).map((i,o)=>[i,t[o]]);this.segments.push(new p(s,{lw:this.params.sin_lw,color:this.params.sin_color}))}},Bi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{pulse_lw:void 0,pulse_color:void 0});let t=.15,n=.4;this.segments.push(new p([[n,t*2],[n,t],[n+t,t],[n+t,-t],[n,-t],[n,-t*2]],{lw:this.params.pulse_lw,color:this.params.pulse_color}))}},Ci=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{tri_lw:void 0,tri_color:void 0}),this.segments.push(new p([[.4,.25],[.7,0],[.4,-.25]],{lw:this.params.tri_lw,color:this.params.tri_color}))}},Ii=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{ramp_lw:void 0,ramp_color:void 0}),this.segments.push(new p([[.4,.25],[.8,-.2],[.4,-.2]],{lw:this.params.ramp_lw,color:this.params.ramp_color}))}},Li=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{square_lw:void 0,square_color:void 0}),this.segments.push(new p([[.5,.25],[.7,.25],[.7,0],[.3,0],[.3,-.25],[.5,-.25]],{lw:this.params.square_lw,color:this.params.square_color}))}},Ys=class extends se{constructor(e={}){super(e),this.elmParams.theta=90,this.segments.push(new p([[0,0],[.5,.5],[1,0],[.5,-.5],[0,0],H,[1,0]]))}},br=class extends Ys{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[.25,-t/2],[.25,t/2]])),this.segments.push(new p([[.75-t/2,0],[.75+t/2,0]])),this.segments.push(new p([[.75,-t/2],[.75,t/2]]))}},wr=class extends Ys{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,0],[.75,0]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},Di=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]]))}},Ni=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e*3,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]])),this.segments.push(new p([[$e*2,pt],[$e*2,-pt]])),this.segments.push(new p([[$e*3,St],[$e*3,-St]]))}},Oi=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e*9,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]])),this.segments.push(new p([[$e*2,pt],[$e*2,-pt]])),this.segments.push(new p([[$e*3,St],[$e*3,-St]])),this.segments.push(new p([[$e*4,pt],[$e*4,-pt]])),this.segments.push(new p([[$e*5,St],[$e*5,-St]])),this.segments.push(new p([[$e*6,pt],[$e*6,-pt]])),this.segments.push(new p([[$e*7,St],[$e*7,-St]])),this.segments.push(new p([[$e*8,pt],[$e*8,-pt]])),this.segments.push(new p([[$e*9,St],[$e*9,-St]])),this.anchors.tap=[$e*4,pt]}},Fi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=.25*.5,n=t+.15,s=.4,i=this.params;this.segments.push(new p([[s,t],[s,-t]])),this.segments.push(new p([[s+.2,n],[s+.2,-n]])),this.segments.push(new p([[0,0],[s,0],H,[s+.2,0],[1,0]]));let o=i.arrowwidth,a=i.arrowlength;this.segments.push(new p([[1.1,.9],[.8,.6]],{arrow:"->",arrowwidth:o,arrowlength:a,lw:i.arrow_lw,color:i.arrow_color})),this.segments.push(new p([[1.3,.7],[1,.4]],{arrow:"->",arrowwidth:o,arrowlength:a,lw:i.arrow_lw,color:i.arrow_color}))}},$i=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"V",{halign:"center",valign:"center"}))}},ji=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"I",{halign:"center",valign:"center"}))}},qi=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"A",{halign:"center",valign:"center"}))}},Hi=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"\u03A9",{halign:"center",valign:"center"}))}},Yi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,.16],[.75,-.16]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},Xi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{filament_lw:void 0,filament_color:void 0});let t=.25,n=.7,s=ze(1.4,3.6*Math.PI,80),i=s.map(c=>t*c-n*Math.sin(c)),o=s.map(c=>t-n*Math.cos(c));i=i.map(c=>c-i[0]);let a=i[i.length-1];i=i.map(c=>c/a);let l=o.map(c=>(c-o[0])*.25),h=i.map((c,m)=>[c,l[m]]);this.segments.push(new p(h,{lw:this.params.filament_lw,color:this.params.filament_color}))}},Gi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{filament_lw:void 0,filament_color:void 0});let t=.5,n=this.params;this.segments.push(new p([[t-t/2**.5,-t/2**.5],[t+t/2**.5,t/2**.5]],{lw:n.filament_lw,color:n.filament_color})),this.segments.push(new p([[t-t/2**.5,t/2**.5],[t+t/2**.5,-t/2**.5]],{lw:n.filament_lw,color:n.filament_color}))}},Wi=class extends rt{constructor(e={}){super(e);let t=.25,n=.4;this.segments.push(new p([[n,t],[n,-t]])),this.segments.push(new p([[n+.2,t],[n+.2,-t]])),this.segments.push(new p([[0,0],[n,0],H,[n+.2,0],[1,0]])),this.segments.push(new D([n-.15,.2],.05,{fill:!0}))}},mn=class extends N{constructor(e={}){let{inputs:t,...n}=e,s=t!==!1;super(n),Object.assign(this.defaults,{width:1.5,corner:.2,input_ofst:[.4,.3],input_lw:1,input_rad:.1,input_fill:"none"});let i=this.params.width,o=this.params.corner,a=this.params.input_ofst,l=this.params.input_lw,h=this.params.input_rad;this.segments.push(new U([[0,0],[0,i],[i,i],[i,0]],{closed:!0,cornerradius:o})),s&&(this.segments.push(new D([a[0],a[1]],h,{lw:l,fill:this.params.input_fill,zorder:4})),this.segments.push(new D([i-a[0],a[1]],h,{lw:l,fill:this.params.input_fill,zorder:4}))),this.anchors.N=[i/2,i],this.anchors.S=[i/2,0],this.anchors.E=[i,i/2],this.anchors.W=[0,i/2],this.anchors.NE=[i,i],this.anchors.SE=[i,0],this.anchors.NW=[0,i],this.anchors.SW=[0,0],this.anchors.in1=[a[0],a[1]],this.anchors.in2=[i-a[0],a[1]],this.anchors.name=[i/2,0],this.elmParams.drop=this.anchors.in2}},Vi=class extends mn{constructor(e={}){super(e);let t=e.needle_percent??70;Object.assign(this.defaults,{needle_color:"black",needle_width:1.5,window_fill:"none"});let n=this.params.width,s=n/2,i=1.2,o=.86,a=.2;this.segments.push(new ut(["M",[s-n/3,i],"Q",[s,i+a],[s+n/3,i],"L",[s+n/4,o],"Q",[s,o+a*.7],[s-n/4,o],"Z"],{color:"black",fill:this.params.window_fill,lw:1}));let l=.94,h=1.2,c=(112-45*t/100)*Math.PI/180,m=[s+l*Math.cos(c),l*Math.sin(c)],f=[s+h*Math.cos(c),h*Math.sin(c)];this.segments.push(new p([m,f],{lw:this.params.needle_width,color:this.params.needle_color}))}},Ui=class extends mn{constructor(e={}){super(e);let t=e.signal??"none";Object.assign(this.defaults,{screen_fill:"none",screen_lw:1,grid:!0,grid_color:"#666666",grid_lw:.3,signal_lw:2,signal_color:"#e0213b"});let n=this.params.width,s=4,i=n*.15,o=n*.85,a=o-i,l=a/(s+1),h=l*3,c=n*.9,m=c-h;if(this.segments.push(new U([[i,m],[i,c],[o,c],[o,m]],{closed:!0,lw:this.params.screen_lw,fill:this.params.screen_fill})),this.params.grid){for(let f=0;f<s;f++){let g=i+(f+1)*l;this.segments.push(new p([[g,m],[g,c]],{lw:this.params.grid_lw,color:this.params.grid_color}))}for(let f=0;f<2;f++){let g=m+(f+1)*l;this.segments.push(new p([[i,g],[o,g]],{lw:this.params.grid_lw,color:this.params.grid_color}))}}if(t==="sine"){let f=ze(i,o,20),g=f.map(x=>m+h/2+Math.sin((x-i)/a*Math.PI*2)*(h/2)*.75),b=f.map((x,v)=>[x,g[v]]);this.segments.push(new p(b,{lw:this.params.signal_lw,color:this.params.signal_color}))}else if(t==="square"){let f=m+h/4,g=c-h/4,b=i+a/3-.1,x=i+a*2/3-.1,v=i+a-.1;this.segments.push(new p([[i,f],[b,f],[b,g],[x,g],[x,f],[v,f],[v,g],[o,g]],{lw:this.params.signal_lw,color:this.params.signal_color}))}else if(t==="triangle"){let f=m+h/4,g=c-h/4,b=i+a/3-.1,x=i+a*2/3-.1,v=i+a-.1;this.segments.push(new p([[i,f],[b,g],[x,f],[v,g],[o,g-.1]],{lw:this.params.signal_lw,color:this.params.signal_color}))}}},Ji=class extends mn{constructor(e={}){super(e),Object.assign(this.defaults,{screen_fill:"none",screen_lw:1});let t=this.params.width,n=t*.1,s=t*.9,i=t/3,o=t*.85,a=o-i;this.segments.push(new U([[n,a],[n,o],[s,o],[s,a]],{closed:!0,lw:this.params.screen_lw,fill:this.params.screen_fill})),this.anchors.display=[(n+s)/2,a]}};var th=.4,Ki=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,theta:0,drop:[0,0]});let n=this.params.lead!==!1?th:0;this.segments.push(new p([[0,0],[0,-n],[-.25,-n],[0,-n-.25],[.25,-n],[0,-n]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},Zi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0});let n=this.params.lead!==!1?th:0,s=.25*.75,i=.25;this.segments.push(new p([[0,0],[0,-n],[-s,-n-i]])),this.segments.push(new p([[0,-n],[-s,-n],[-s*2,-n-i]])),this.segments.push(new p([[0,-n],[s,-n],[0,-n-i]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},Qi=class extends N{constructor(e={}){super(e);let t=.6,n=.6,s=.38;this.segments.push(new p([[0,0],[0,t],[-s,t+n],[s,t+n],[0,t]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},eo=class extends N{constructor(e={}){super(e);let t=.2,n=.5;this.segments.push(new p([[0,0],[0,t],[-n,n+t],[t/2,n*2+1.5*t],[n+t,n+t],[t,t],[t,0]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.end=[t,0]}},to=class extends N{constructor(e={}){super(e);let t=.25,n=1,s=-n/2-t/2,i=s+t,o=n/2+t/2,a=o+t,l=t,h=t*2,c=n+h,m=c+t;this.segments.push(new p([[0,0],[0,l],[s,l],[s,c],[o,c],[o,h],[i,h],[i,m],[a,m],[a,l],[t,l],[t,0]])),this.elmParams.drop=[t,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.end=[t,0]}},ro=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0,lblloc:"bottom"});let t=.25*.75,s=this.params.lead!==!1?th:0;this.segments.push(new p([[0,0],[0,-s]])),this.segments.push(new p([[0,-s],[-t,-s]])),this.segments.push(new p([[0,-s],[t,-s]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},no=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0});let t=.25*.75,s=this.params.lead!==!1?th:0;this.segments.push(new p([[0,0],[0,s]])),this.segments.push(new p([[0,s],[-t,s]])),this.segments.push(new p([[0,s],[t,s]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},so=class extends N{constructor(e={}){super(e);let t=.25*.75,n=.25*.75;this.segments.push(new p([[-t,-n],[t,n]])),this.segments.push(new p([[-t,n],[t,-n]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.elmParams.lblofst="bottom",this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}};var le=.12,Xr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let{action:t,contacts:n=!0,nc:s=!1}=e,i=this.params;n?(s?this.segments.push(new p([[0,0],H,[le*2,0],[.9,le+.05],H,[1,0]])):this.segments.push(new p([[0,0],H,[le*2,.1],[.8,.45],H,[1,0]])),this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,0],le,{fill:"bg",zorder:3}))):s?(this.segments.push(new p([[0,0],[1.15,.45],H,[1,0]])),this.segments.push(new p([[1,0],[1,.55]]))):this.segments.push(new p([[0,0],[.85,.45],H,[1,0]])),t==="open"?this.segments.push(new xe([.4,.1],.5,.75,{theta1:-10,theta2:70,arrow:"ccw",lw:i.arrow_lw,color:i.arrow_color,arrowwidth:i.arrowwidth,arrowlength:i.arrowlength})):t==="close"&&this.segments.push(new xe([.4,.25],.5,.75,{theta1:-10,theta2:70,arrow:"cw",lw:i.arrow_lw,color:i.arrow_color,arrowwidth:i.arrowwidth,arrowlength:i.arrowlength}))}},io=class extends Xr{constructor(e={}){super(e),e.contacts!==!1?(this.segments.push(new D([1-le,.7],le,{fill:"bg",zorder:3})),this.anchors.a=[le,0],this.anchors.b=[1-le,0],this.anchors.c=[1-le,.7]):(this.anchors.a=[0,0],this.anchors.b=[1,0],this.anchors.c=[1,.7])}},Xs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let{action:t,contacts:n=!0}=e,s=this.params;n?(this.segments.push(new p([[0,0],H,[le*2,.1],[.7,.25],H,[1,.4]])),this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,.4],le,{fill:"bg",zorder:3})),this.anchors.a=[le,0],this.anchors.b=[1-le,.4],this.anchors.c=[1-le,-.4]):(this.segments.push(new p([[0,0],[.85,.25],H,[1,.4]])),this.anchors.a=[0,0],this.anchors.b=[1,.4],this.anchors.c=[1,-.4]),t==="open"?this.segments.push(new xe([.35,0],.5,.75,{theta1:-10,theta2:70,arrow:"ccw",lw:s.arrow_lw,color:s.arrow_color,arrowwidth:s.arrowwidth,arrowlength:s.arrowlength})):t==="close"&&this.segments.push(new xe([.3,0],.5,.75,{theta1:-10,theta2:70,arrow:"cw",lw:s.arrow_lw,color:s.arrow_color,arrowwidth:s.arrowwidth,arrowlength:s.arrowlength})),this.elmParams.drop=[1,.4]}},oo=class extends se{constructor(e={}){super(e);let{nc:t=!1,contacts:n=!0}=e,s,i;n?(s=[[0,0],H],i=[H,[1,0]]):(s=[[0,0],[le,0],H],i=[H,[1-le,0],[1,0]]);let o=t?-le-.05:.3,a=t?le+.15:.5,l=[[le,o],[1-le,o],H,[.5,o],[.5,a]],h=[...s,...l,...i];this.segments.push(new p(h)),n&&(this.segments.push(new D([le,0],le)),this.segments.push(new D([1-le,0],le)))}},Gs=class extends N{constructor(e={}){super(e);let t=-1,{link:n=!0,contacts:s=!0}=e,i,o;s?(i=[[0,0],H,[le*2,.1],[.8,.45],H,[1,0]],o=[[le*2,t+.1],[.8,t+.45]],this.anchors.p1=[le,0],this.anchors.t1=[1-le,0],this.anchors.p2=[le,t],this.anchors.t2=[1-le,t]):(i=[[0,0],[.8,.45],H,[1,0]],o=[[0,t],[.8,t+.45]],this.anchors.p1=[0,0],this.anchors.t1=[1,0],this.anchors.p2=[0,t],this.anchors.t2=[1,t]),this.segments.push(new p(i)),this.segments.push(new p(o)),s&&(this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([le,t],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t],le,{fill:"bg",zorder:3}))),n&&this.segments.push(new p([[.5,t+.25],[.5,.2]],{ls:":"}))}},Ws=class extends N{constructor(e={}){super(e);let t=-1.4,{link:n=!0,contacts:s=!0}=e,i,o;s?(i=[[0,0],H,[le*2,.1],[.7,.25],H,[1,.4]],o=[[le*2,t+.1],[.7,t+.25]],this.anchors.p1=[le,0],this.anchors.t1=[1-le,.4],this.anchors.t2=[1-le,-.4],this.anchors.p2=[le,t],this.anchors.t3=[1-le,t+.4],this.anchors.t4=[1-le,t-.4]):(i=[[0,0],[.7,.25],H,[1,.4]],o=[[0,t],[.7,t+.25]],this.anchors.p1=[0,0],this.anchors.t1=[1,.4],this.anchors.t2=[1,-.4],this.anchors.p2=[0,t],this.anchors.t3=[1,t+.4],this.anchors.t4=[1,t-.4]),this.segments.push(new p(i)),this.segments.push(new p(o)),s&&(this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([le,t],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t+.4],le,{fill:"bg",zorder:3}))),n&&this.segments.push(new p([[.5,t+.25],[.5,.2]],{ls:":"}))}},ao=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[.85,.15],H,[.8,0]]));let t=.3,n=ze(-Math.PI/2,Math.PI/2,32),s=n.map(m=>-t*Math.cos(m)),i=n.map(m=>t*Math.sin(m)),o=s.map(m=>1-m),a=[...i].reverse(),l=[...s,...o,s[0]],h=[...i,...a,i[0]],c=l.map((m,f)=>[m,h[f]]);this.segments.push(new p(c))}},lo=class extends N{constructor(e={}){super(e);let t=e.n??4,n=e.dtheta,s=e.radius??1,i=e.arrowlen??.75,o=e.arrowcontact??0;this.elmParams.fill="bg",this.elmParams.zorder=4,this.segments.push(new D([0,0],le)),this.anchors.P=[0,0],n===void 0&&(n=Math.min(35,360/(t+1)));let a=n*Math.PI/180,l=e.theta0;l===void 0?l=-a*(t-1)/2:l=l*Math.PI/180;for(let h=0;h<t;h++){let c=l+a*h,m=s*Math.cos(c),f=s*Math.sin(c);if(this.segments.push(new D([m,f],le)),this.anchors[`T${h+1}`]=[m,f],h===o){let g=i*Math.cos(c),b=i*Math.sin(c);this.segments.push(new p([[0,0],[g,b]],{arrow:"->",zorder:2}))}}}},ho=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{switchcolor:"#333333",swidth:.4,spacing:.2});let t=e.n??3,n=e.pattern,s=this.params.swidth,i=this.params.spacing,o=s*t+i*(t+1),a=s*2+i*2;this.segments.push(new U([[0,0],[o,0],[o,a],[0,a]]));for(let l=0;l<t;l++){let h=i*(l+1)+s*l,c=n?n[l]:!1,m=n?!n[l]:!1;this.segments.push(new U([[h,i+s],[h+s,i+s],[h+s,i+s*2],[h,i+s*2]],{fill:c?this.params.switchcolor:void 0})),this.segments.push(new U([[h,i],[h+s,i],[h+s,i+s],[h,i+s]],{fill:m?this.params.switchcolor:void 0})),this.anchors[`a${l+1}`]=[h+s/2,0],this.anchors[`b${l+1}`]=[h+s/2,a]}}};var co=class extends N{constructor(e={}){super(e);let t=.5;this.segments.push(new p([[0,0],[.25,0]])),this.segments.push(new p([[0,-t],[.25,-t]])),this.segments.push(new U([[.25,t/2],[.25,-t*1.5],[.25*2,-t*1.5],[.25*2,t/2]])),this.segments.push(new U([[.25*2,t/2],[.25*3.5,t*1.25],[.25*3.5,-t*2.25],[.25*2,-t*1.5]],{closed:!1})),this.anchors.in1=[0,0],this.anchors.in2=[0,-t],this.elmParams.drop=[0,-t]}},uo=class extends N{constructor(e={}){super(e);let t=.5;this.segments.push(new p([[0,0],[.25,0]])),this.segments.push(new p([[0,-t],[.25,-t]])),this.segments.push(new p([[-.25*2,.25],[-.25*2,-.25*3]])),this.segments.push(new xe([-.25*2,-.25],.25*4,.25*4,{theta1:270,theta2:90})),this.anchors.in1=[.25,0],this.anchors.in2=[.25,-t],this.elmParams.drop=[0,-t]}},mo=class extends se{constructor(e={}){super(e);let t=.22;this.segments.push(new p([[-t,0],[-t,0],H,[1+t,0],[1+t,0]])),this.segments.push(new p([[0,-t],[-t,-t],[-t,t],[0,t]])),this.segments.push(new p([[1,-t],[1+t,-t],[1+t,t],[1,t]])),this.segments.push(new D([.5,0],.5))}},po=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!0});let{ring:t=!1,ringswitch:n=!1,dots:s=!0,switch:i=!1}=e,o=this.params.open?"bg":void 0,a=this.params.radius,l=2,h=.75,c=.55,m=.2,f=1,g=1,b=.1,x=.35,v=.4,S=.5;i&&(g+=.2),t&&n&&(x+=.2,b-=.2),t?(s&&this.segments.push(new D([0,-x],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,-x],[-l,-x],[-l,0],[-l,f],[-l-m,f],[-l-m,0],[-l,0]])),this.anchors.sleeve=[0,-x],s&&this.segments.push(new D([0,b],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,b],[-l*.75,b],[-l*h-2*a,b+2*a],[-l*h-a*4,b]])),this.anchors.ring=[0,b]):(s&&this.segments.push(new D([0,0],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,0],[-l,0],[-l,f],[-l+m,f],[-l+m,0]])),this.anchors.sleeve=[0,0]),s&&this.segments.push(new D([0,g],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,g],[-l*.55,g],[-l*c-2*a,g-2*a],[-l*c-a*4,g]])),this.anchors.tip=[0,g],i&&(s&&this.segments.push(new D([0,g-v],a,{fill:o,zorder:4})),this.segments.push(new p([[0,g-v],[-S,g-v]])),this.segments.push(new p([[-S,g-v],[-S,g]],{arrow:"->"})),this.anchors.tipswitch=[0,g-v]),t&&n&&(s&&this.segments.push(new D([0,b+v],a,{fill:o,zorder:4})),this.segments.push(new p([[0,b+v],[-S,b+v]])),this.segments.push(new p([[-S,b+v],[-S,b]],{arrow:"->"})),this.anchors.ringswitch=[0,b+v])}};var fo=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{length:3,leadlen:.6,radius:.3});let t=this.params.leadlen,n=this.params.length,s=this.params.radius;this.segments.push(new p([[0,0],[t,0],H,[n-t+s/2,0],[n,0]])),this.segments.push(new p([[t,s],[n-t,s]])),this.segments.push(new p([[t,-s],[n-t,-s]])),this.segments.push(new xe([t,0],s,s*2,{theta1:0,theta2:360})),this.segments.push(new xe([n-t,0],s,s*2,{theta1:270,theta2:90})),this.anchors.shieldstart=[t,-s],this.anchors.shieldstart_top=[t,s],this.anchors.shieldend=[n-t,-s],this.anchors.shieldend_top=[n-t,s],this.anchors.shieldcenter=[n/2,-s],this.anchors.shieldcenter_top=[n/2,s]}},go=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{length:3,leadlen:.6,radiusinner:.3,radiusouter:.6,shieldofststart:.3,shieldofstend:.3});let t=this.params.radiusinner,n=this.params.radiusouter,s=this.params.length,i=this.params.leadlen,o=this.params.shieldofstend,a=this.params.shieldofststart;if(n<t)throw new Error("Triax inner radius > outer radius");let l=n/2*Math.sqrt(1-t*t/(n*n)),h=180;a-l>-t/2&&(h=180-Math.atan2(t,l)*180/Math.PI),s-i-o+n<s?(this.segments.push(new p([[0,0],[i,0],H,[s-i+t/2,0],[s,0]])),this.segments.push(new p([[s-i-o+l,t],[s-i,t]])),this.segments.push(new p([[s-i-o+l,-t],[s-i,-t]])),this.segments.push(new xe([s-i,0],t,t*2,{theta1:270,theta2:90}))):this.segments.push(new p([[0,0],[i,0],H,[s-i-o+n/2,0]])),this.segments.push(new p([[i,t],[i+a+l,t]])),this.segments.push(new p([[i,-t],[i+a+l,-t]])),this.segments.push(new p([[i+a,n],[s-i-o,n]])),this.segments.push(new p([[i+a,-n],[s-i-o,-n]])),this.segments.push(new xe([i,0],t,t*2,{theta1:0,theta2:360})),this.segments.push(new xe([i+a,0],n,n*2,{theta1:-h,theta2:h})),this.segments.push(new xe([s-i-o,0],n,n*2,{theta1:270,theta2:90})),this.anchors.guardstart=[i,-t],this.anchors.guardstart_top=[i,t],this.anchors.guardend=[s-i,-t],this.anchors.guardend_top=[s-i,t],this.anchors.shieldstart=[i+a,-n],this.anchors.shieldstart_top=[i+a,n],this.anchors.shieldend=[s-i-o,-n],this.anchors.shieldend_top=[s-i-o,n],this.anchors.shieldcenter=[s/2,-n],this.anchors.shieldcenter_top=[s/2,n]}};var bo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{core:!0,loop:!1,corewidth:.75,phasegap:.4,arcwidth:.4});let t=e.t1??4,n=e.t2??4;typeof t=="number"&&(t=[t]),typeof n=="number"&&(n=[n]);let s=t,i=n,o=this.params.phasegap,a=this.params.loop,l=this.params.core,h=e.align??"center",c=this.params.corewidth;a&&(c+=.4),l&&(c+=.25);let m=0,f,g,b,x=(v,S)=>{if(h==="center"){let k=v/2-S/2;return[k,k+S]}else return h==="bottom"?[0,S]:[v-S,v]};if(a){let v=s.map(re=>Vn(re,[0,0],.06,.19,!1,!0,!1)),S=i.map(re=>Vn(re,[c,0],.06,.19,!1,!0,!0)),k=v.reduce((re,te)=>re+te[te.length-1][1],0)+o*(v.length-1),M=S.reduce((re,te)=>re+te[te.length-1][1],0)+o*(S.length-1);f=k,[g,b]=x(k,M);let _=.06,B=.19,$=Math.acos(_/B),Y=Math.PI*2*_,Z=Y-(_*$-B*Math.sin($)),I=(_-B)/2/.25,X=m,j=0;for(let re=0;re<v.length;re++){let te=v[re],ke=te[te.length-1][1],he=te.map(de=>[de[0],de[1]+X]);this.segments.push(new p(he)),this.anchors[`p${re*2+1}`]=he[0],this.anchors[`p${re*2+2}`]=he[he.length-1],f=he[he.length-1][1];let ve=0;for(ve=0;ve<s[re];ve++)this.anchors[`tapP${j+ve+1}`]=[I,he[0][1]+ve*Y+Z];j+=ve,X+=ke+o}X=g,j=0;for(let re=0;re<S.length;re++){let te=S[re],ke=te[te.length-1][1],he=te.map(de=>[de[0],de[1]+X]);this.segments.push(new p(he)),this.anchors[`s${re*2+1}`]=he[0],this.anchors[`s${re*2+2}`]=he[he.length-1],b=he[he.length-1][1];let ve=0;for(ve=0;ve<i[re];ve++)this.anchors[`tapS${j+ve+1}`]=[c-I,he[0][1]+ve*Y+Z];j+=ve,X+=ke+o}}else{let v=this.params.arcwidth,S=s.reduce((B,$)=>B+$,0)*v+o*(s.length-1),k=i.reduce((B,$)=>B+$,0)*v+o*(i.length-1);f=S,[g,b]=x(S,k);let M=m,_=0;for(let B=0;B<s.length;B++){let $=s[B];this.anchors[`p${B*2+2}`]=[0,M],this.anchors[`p${B*2+1}`]=[0,M+$*v];for(let Y=0;Y<$;Y++)this.segments.push(new xe([0,M+v/2],v,v,{theta1:270,theta2:90})),Y<$-1&&(this.anchors[`tapP${_+Y+1}`]=[0,M+v]),M+=v;_+=$-1,M+=o}M=g,_=0;for(let B=0;B<i.length;B++){let $=i[B];this.anchors[`s${B*2+2}`]=[c,M],this.anchors[`s${B*2+1}`]=[c,M+$*v];for(let Y=0;Y<$;Y++)this.segments.push(new xe([c,M+v/2],v,v,{theta1:90,theta2:270})),Y<$-1&&(this.anchors[`tapS${_+Y+1}`]=[c,M+v]),M+=v;_+=$-1,M+=o}}if(l){let v=Math.max(f,b),S=Math.min(m,g),k=c/2,M=c/10;this.segments.push(new p([[k-M,v],[k-M,S]])),this.segments.push(new p([[k+M,v],[k+M,S]]))}}tap(e,t,n="primary"){let s=n==="primary"?"P":"S",i;if(t===0?i=this.anchors[`${s.toLowerCase()}1`]:i=this.anchors[`tap${s}${t}`],i)this.anchors[e]=i;else throw new Error(`No tap at position ${t}`);return this}};function A2(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}var rh=.25,dn=class extends Pe{constructor(e={}){let{double:t,...n}=e;super({...n,arrow:t?"<->":e.arrow??"->"}),this.anchors.center=[0,0]}},wo=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[-rh/2,rh],[rh/2,-rh],H,[0,0]]))}},Xt=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{lblloc:"center",lblalign:["center","center"],lblofst:0}),this.segments.push(new p([[0,0],H,[1,0]],{visible:!1}))}},pn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!1});let n=this.params.open===!0?"bg":!0;this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0],this.elmParams.drop=[0,0],this.elmParams.theta=0,this.elmParams.zorder=4,this.elmParams.fill=n,this.segments.push(new D([0,0],this.params.radius,{fill:n}))}},xo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{headwidth:.15,headlength:.25,lblofst:.25});let t=this.params.headwidth,n=this.params.headlength;this.segments.push(new p([[-n,0],[0,0]],{arrowwidth:t,arrowlength:n,arrow:"->"})),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},vo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!1});let t=this.params.radius,n=this.params.open?"bg":!0;this.elmParams.fill=n,this.segments.push(new D([.5,0],t)),this.segments.push(new D([1,0],t)),this.segments.push(new D([1.5,0],t)),this.elmParams.drop=[2,0]}},xr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{zorder:0});let t=e.corner1??[0,0],n=e.corner2??[1,1],s=[t[0],n[1]],i=[n[0],t[1]];this.segments.push(new U([t,s,n,i],{closed:!0,zorder:0,fill:e.fill,lw:e.lw,ls:e.ls}))}},yo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{shape:"-",k:1,to:[3,-2],dotradius:.075})}to(e,t=0,n=0){let s=A.fromXY(A2(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}dot(e=!1){return this.userParams.dot=e?"open":!0,this}idot(e=!1){return this.userParams.idot=e?"open":!0,this}shape(e){return this.userParams.shape=e,this}k(e){return this.userParams.k=e,this}arrow(e){return this.userParams.arrow=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a=this.params.arrow,l=this.params.shape,h=this.params.k??1,c,m;if(o!==void 0?(c=o[0],m=o[1]):(c=i[0]-s[0],m=i[1]-s[1]),this.segments=[],l==="-")this.segments.push(new p([[0,0],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2];else if(l==="-|")this.segments.push(new p([[0,0],[c,0],[c,m]],{arrow:a})),this.anchors.mid=[c,m/2],this.elmParams.droptheta=m>0?90:-90;else if(l==="|-")this.segments.push(new p([[0,0],[0,m],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m],this.elmParams.droptheta=c>0?0:180;else if(l==="z"||l==="Z"){let g=c>0?Math.abs(h):-Math.abs(h);this.segments.push(new p([[0,0],[g,0],[c-g,m],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2],this.elmParams.droptheta=c>0?0:180}else if(l==="N"){let g=m>0?Math.abs(h):-Math.abs(h);this.segments.push(new p([[0,0],[0,g],[c,m-g],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2],this.elmParams.droptheta=m>0?90:-90}else if(l==="n")this.segments.push(new p([[0,0],[0,h],[c,h],[c,m]],{arrow:a})),this.anchors.mid=[c/2,h],this.elmParams.droptheta=m>h?90:-90;else if(l==="c")this.segments.push(new p([[0,0],[h,0],[h,m],[c,m]],{arrow:a})),this.anchors.mid=[h,m/2],this.elmParams.droptheta=c>h?0:180;else throw new Error(`Wire: undefined shape ${l}`);let f=T(this.params,"dotradius",.075);if(this.params.dot){let b=this.params.dot==="open"?"bg":!0;this.segments.push(new D([c,m],f,{fill:b,zorder:3}))}if(this.params.idot){let b=this.params.idot==="open"?"bg":!0;this.segments.push(new D([0,0],f,{fill:b,zorder:3}))}return this.elmParams.lblloc="mid",this.elmParams.drop=[c,m],this.anchors.start=[0,0],this.anchors.end=[c,m],this._positioned=!0,super._place(e,t,n)}},So=class extends N{constructor(e={}){super(e),this.elmParams.lblloc="center",this.elmParams.lblofst=0;let t=e.label;t!==void 0&&t!==""&&this.label(t)}},ko=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{width:1.5,height:.625,lblloc:"center",fontsize:12,lblofst:0});let t=e.width??1.5,n=(e.height??.625)/2;this.segments.push(new U([[0,0],[n,n],[t,n],[t,-n],[n,-n]],{closed:!0})),this.anchors.start=[0,0];let s=e.s;s&&this.segments.push(new W([t/2,0],s,{fontsize:12}))}};function eu(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}function _1(r,e,t=.01){return Math.abs(r-e)<=t}function B1(r){let e=r.absanchors.center;if(e!==void 0)return e;let t=r.getBBox(!1,!1),n=(t.xmin+t.xmax)/2,s=(t.ymin+t.ymax)/2;return r.transform.transform([n,s])}var Mo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{k:.5})}to(e,t=0,n=0){let s=A.fromXY(eu(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}k(e){return this.userParams.k=e,this}arrow(e){return this.userParams.arrow=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??[s[0]+3,s[1]],o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.k??.5,c=[a/2-l*h,l/2+a*h],m=[a/2-l*h/2,l/2+a*h/2],f=this.params.arrow;this.segments.push(new Ut([[0,0],c,[a,l]],{arrow:f})),this.anchors.ctrl=c,this.anchors.mid=m,this.anchors.start=[0,0],this.anchors.end=[a,l],this.elmParams.lblloc="mid",this.elmParams.drop=[a,l];let g="bottom",b="left",x=.1,v=0;return _1(m[1],c[1])?(g="center",x=0):m[1]>c[1]&&(g="top",x=-.1),_1(m[0],c[0])?b="center":m[0]>c[0]?(b="right",x=0,v=-.1):(v=.1,x=0),this.elmParams.lblofst=[v,x],this.elmParams.lblalign=[b,g],this._positioned=!0,super._place(e,t,n)}},fn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{k:.75,th1:0,th2:180,to:[1,0],arrowlength:.25,arrowwidth:.2})}to(e,t=0,n=0){let s=A.fromXY(eu(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}k(e){return this.userParams.k=e,this}th1(e){return this.userParams.th1=e,this}th2(e){return this.userParams.th2=e,this}arrow(e){return this.userParams.arrow=e,this}arrowlength(e){return this.userParams.arrowlength=e,this}arrowwidth(e){return this.userParams.arrowwidth=e,this}setLabelAlign(e,t){this.elmParams.lblloc="center";let n="left",s="bottom";t>0&&(s="top",this.elmParams.lblofst=-.1),e<=0&&(n="right"),this.elmParams.lblalign=[n,s]}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.userParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.k??.75,c=(this.params.th1??0)*(Math.PI/180),m=(this.params.th2??180)*(Math.PI/180),f=[a*h*Math.cos(c),l*h*Math.sin(c)],g=[a+a*h*Math.cos(m),l+l*h*Math.sin(m)],b=this.params.arrow,x=this.params.arrowlength,v=this.params.arrowwidth;return this.segments.push(new Ut([[0,0],f,g,[a,l]],{arrow:b,arrowlength:x,arrowwidth:v})),this.anchors.center=[a/2,l/2],this.anchors.start=[0,0],this.anchors.end=[a,l],this.anchors.ctrl1=f,this.anchors.ctrl2=g,this.elmParams.drop=[a,l],this.setLabelAlign(a,l),this._positioned=!0,super._place(e,t,n)}},zo=class extends fn{constructor(e={}){super({...e,to:e.to??[1,1],th1:e.th1??75,th2:e.th2??180,arrow:e.arrow??"<-"})}setLabelAlign(e,t){this.elmParams.lblloc="end";let n=this.anchors.ctrl2,s=this.anchors.end,i;for(n[0]===s[0]&&n[1]===s[1]?i=t<0?-90:90:i=Math.atan2(s[1]-n[1],s[0]-n[0])*180/Math.PI;i<0;)i+=360;i<45||i>315?(this.elmParams.lblalign=["left","center"],this.elmParams.lblofst=[.1,0]):i>=45&&i<=135?(this.elmParams.lblalign=["center","bottom"],this.elmParams.lblofst=[0,.1]):i>135&&i<=225?(this.elmParams.lblalign=["right","center"],this.elmParams.lblofst=[-.1,0]):(this.elmParams.lblalign=["center","top"],this.elmParams.lblofst=[0,-.1])}},Eo=class extends fn{constructor(e={}){super({...e,th1:0,th2:180})}},Po=class extends fn{constructor(e={}){super({...e,th1:90,th2:-90})}},To=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.6,arrowlength:.25,arrowwidth:.2})}to(e,t=0,n=0){let s=A.fromXY(eu(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}radius(e){return this.userParams.radius=e,this}arrow(e){return this.userParams.arrow=e,this}arrowlength(e){return this.userParams.arrowlength=e,this}arrowwidth(e){return this.userParams.arrowwidth=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.radius??.6,c=a/2,m=l/2,f=Math.sqrt(a*a+l*l),g=h*h-f/2*(f/2);if(g<0)throw new Error(`ArcLoop: no solution for radius ${h}`);let b=Math.sqrt(g),x=[c+b*(-l/f),m+b*(a/f)],v=Math.sqrt(c*c+m*m),S=Math.atan2(m,c),k=Math.acos(v/h),M=S-k,_=S+k,B=ze(Math.PI+_,M,50),$=[],Y=[];for(let re of B)$.push(x[0]+h*Math.cos(re)),Y.push(x[1]+h*Math.sin(re));let Z=$.map((re,te)=>[re,Y[te]]),L=this.params.arrow,I=this.params.arrowlength,X=this.params.arrowwidth;this.segments.push(new p(Z,{arrow:L,arrowlength:I,arrowwidth:X}));let j=Math.floor($.length/2);return this.anchors.start=[0,0],this.anchors.end=[$[$.length-1],Y[Y.length-1]],this.anchors.mid=[$[j],Y[j]],this.anchors.BL=[Math.min(...$),Math.min(...Y)],this.anchors.BR=[Math.max(...$),Math.min(...Y)],this.anchors.TL=[Math.min(...$),Math.max(...Y)],this.anchors.TR=[Math.max(...$),Math.max(...Y)],this.elmParams.lblloc="mid",this.elmParams.drop=[i[0]-s[0],i[1]-s[1]],this.elmParams.lblofst=[0,.2],Y[j]<Y[0]&&(this.elmParams.lblofst=[0,-.25]),this._positioned=!0,super._place(e,t,n)}},h0=class extends N{constructor(t={}){super(t);z(this,"_side","top");Object.assign(this.defaults,{ofst:.15,length:2,top:!0,reverse:!1,headlength:.3,headwidth:.2,anchor:"center",drop:null}),this.anchors.center=[0,0]}at(t,n=0,s=0){return t instanceof N?(this.userParams.overElement=t,this):super.at(t,n,s)}over(t){return this.userParams.overElement=t,this}placeArrowSegment(t){let n=this.params.ofst??.15,s=this.params.length??2;this._side==="bottom"&&(n=-n);let i=[-s/2,n],o=[s/2,n],a=this.params.headwidth??.2,l=this.params.headlength??.3;this.segments.push(new p([i,o],{arrow:"->",arrowwidth:a,arrowlength:l}))}placeFromOverElement(t){let n=String(T(t.params,"ilabel","top")).toLowerCase();n==="bot"&&(n="bottom"),this.params.top!==!1||(n={top:"bottom",bottom:"top",left:"right",right:"left"}[n]??n);let i=this.userParams.reverse===!0;if(t.userParams.reverse===!0){let f={left:"right",right:"left"};f[n]!==void 0?n=f[n]:i=!i}t.userParams.flip===!0&&(n==="left"||n==="right")&&(i=!i),n==="left"&&(i=!i),this.userParams.reverse=i;let o=t.transform.theta,a=t.getBBox(!1,!1),l,h;n==="top"?(l=new A((a.xmin+a.xmax)/2,a.ymax),h="top"):n==="bottom"?(l=new A((a.xmin+a.xmax)/2,a.ymin),h="bot"):n==="right"?(l=new A(a.xmax,(a.ymin+a.ymax)/2),h="bot",o-=90):n==="left"?(l=new A(a.xmin,(a.ymin+a.ymax)/2),h="top",o+=90):(l=new A((a.xmin+a.xmax)/2,a.ymax),h="top");let c=t.transform.transform(l.toTuple());this.userParams.at=[c.x,c.y],this.userParams.theta=o,this.elmParams.lblloc=h,this._side=n==="bottom"?"bottom":n==="top"?"top":n==="left"?"left":"right";let m=t.userParams.color;m!==void 0&&(this.userParams.color=m)}_place(t,n,s){this.dwgParams={...s};let i=this.params.overElement;i!==void 0&&this.placeFromOverElement(i),this.segments=[];let o=((this.params.theta??0)%360+360)%360,a=this.params.lblloc??"top",l=this._side;if(l==="right"&&(o<=90||o>270)){let h=this.elmParams.lblloc??"top";this.elmParams.lblloc=h==="bot"?"top":"bot",a=this.elmParams.lblloc}else if((l==="top"||l==="left"||l==="bottom")&&o>90&&o<=270){let h=this.elmParams.lblloc??"top";this.elmParams.lblloc=h==="bot"?"top":"bot",a=this.elmParams.lblloc}return this.placeArrowSegment(a),super._place(t,n,s)}},Ro=class extends h0{constructor(e={}){super(e),Object.assign(this.defaults,{length:1.75,ofst:.075,bend:.6})}placeArrowSegment(e){let t=this.params.ofst??.075,n=this.params.bend??.6,s=this.params.length??1.75;this._side==="bottom"&&(t=-t,n=-n);let i=this.params.headwidth??.2,o=this.params.headlength??.3,a=this.params.reverse===!0?"<-":"->",l=[-s/2,t],h=[s/2,t],c=[0,n];this.segments.push(new Ut([l,c,h],{arrow:a,arrowlength:o,arrowwidth:i}))}},gn=class extends N{constructor(e="in",t=.8,n=!0,s={}){super(s),Object.assign(this.defaults,{headlength:.3,headwidth:.3}),this.elmParams.lblofst=0,this.elmParams.drop=null,this.elmParams.zorder=4;let i=t,o=this.params.headlength??.3;e==="in"&&(i+=this.params.headlength??.3,o=-o),n&&(i=-i,o=-o);let a=this.params.headwidth??.3,l=this.params.headlength??.3;this.segments.push(new p([[i,0],[i+o,0]],{arrow:"->",arrowwidth:a,arrowlength:l}))}at(e,t=0,n=0){return e instanceof N?(this.userParams.overElement=e,this):super.at(e,t,n)}over(e){return this.userParams.overElement=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.overElement;if(s!==void 0){let i=B1(s);this.userParams.at=[i.x,i.y],this.userParams.theta=s.transform.theta;let o=s.userParams.color;o!==void 0&&(this.userParams.color=o)}return this._positioned=!0,super._place(e,t,n)}},Ao=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{ofst:.5,hofst:.4,length:1,lengthtip:.5,headlength:.25,headwidth:.15}),this.userParams.anchor="center",this.anchors.center=[0,0]}at(e,t=0,n=0){return e instanceof N?(this.userParams.overElement=e,this):super.at(e,t,n)}over(e){return this.userParams.overElement=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.overElement;if(s!==void 0){let x=B1(s);this.userParams.at=[x.x,x.y];let v=s.transform.theta;(v%360+360)%360>90&&(v%360+360)%360<=270&&(v+=180),this.userParams.theta=v;let S=s.userParams.color;S!==void 0&&(this.userParams.color=S)}let i=this.params.hofst??.4,o=this.params.ofst??.5,a=this.params.lengthtip??.5,l=this.params.length??1,h=this.params.headwidth??.15,c=this.params.headlength??.25,m=[-i,o],f=[-i-a,o],g=[-i-a,o-l];this.anchors.head=m,this.anchors.tail=g,this.segments=[],this.segments.push(new p([g,f,m],{arrow:"->",arrowwidth:h,arrowlength:c})),this.elmParams.lblloc="tail";let b=this.params.theta??0;return this.params.flip===!0&&(b+=180),b-=90,b=(b%360+360)%360,b<45||b>315?(this.elmParams.lblalign=["left","center"],this.elmParams.lblofst=[0,-.1]):b>=45&&b<=135?(this.elmParams.lblalign=["center","bottom"],this.elmParams.lblofst=[0,.1]):b>135&&b<=225?(this.elmParams.lblalign=["right","center"],this.elmParams.lblofst=[0,.1]):(this.elmParams.lblalign=["center","top"],this.elmParams.lblofst=[0,-.1]),this._positioned=!0,super._place(e,t,n)}},c0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lblloc:"center",lblofst:0,theta:0});let t=e.direction??"cw",n=e.theta1??35,s=e.theta2??-35,i=e.width??1,o=e.height??1;this.segments.push(new xe([0,0],i,o,{theta1:n,theta2:s,arrow:t})),this.anchors.center=[0,0]}},nh=class extends c0{constructor(e){At(null);let{elm_list:t,pad:n=.2,...s}=e,i=t[0].getBBox(!0,!1),o=t[1].getBBox(!0,!1),a=t[2].getBBox(!0,!1),l=t[3].getBBox(!0,!1),h=i.ymin-n,c=a.ymax+n,m=l.xmax+n,f=o.xmin-n,g=[(m+f)/2,(h+c)/2],b=f-m,x=h-c;super({...s,width:b,height:x,at:g})}},sh=class extends N{constructor(e){At(null);let{elm_list:t,includelabels:n=!0,...s}=e;super(s),Object.assign(this.defaults,{padx:.2,pady:.2,theta:0});let i=1/0,o=-1/0,a=1/0,l=-1/0;for(let k of t){let M=k.getBBox(!0,n);i=Math.min(i,M.xmin),o=Math.max(o,M.xmax),a=Math.min(a,M.ymin),l=Math.max(l,M.ymax)}let h=this.params.padx??.2,c=this.params.pady??.2;i-=h,o+=h,a-=c,l+=c;let m=o-i,f=l-a,g=[(o+i)/2,(l+a)/2];this.userParams.at=g,this.segments.push(new xe([0,0],m,f,{theta1:0,theta2:360}));let b=Math.sin(Math.PI/4),x=Math.cos(Math.PI/4),v=Math.sin(Math.PI/8),S=Math.cos(Math.PI/8);this.anchors.N=[0,f/2],this.anchors.S=[0,-f/2],this.anchors.E=[m/2,0],this.anchors.W=[-m/2,0],this.anchors.SE=[m/2*x,-f/2*b],this.anchors.SW=[-m/2*x,-f/2*b],this.anchors.NW=[-m/2*x,f/2*b],this.anchors.NE=[m/2*x,f/2*b],this.anchors.ENE=[m/2*S,f/2*v],this.anchors.WNW=[-m/2*S,f/2*v],this.anchors.ESE=[m/2*S,-f/2*v],this.anchors.WSW=[-m/2*S,-f/2*v],this.anchors.NNE=[m/2*v,f/2*S],this.anchors.NNW=[-m/2*v,f/2*S],this.anchors.SSE=[m/2*v,-f/2*S],this.anchors.SSW=[-m/2*v,-f/2*S]}},ih=class extends N{constructor(e){At(null);let{elm_list:t,includelabels:n=!0,...s}=e;super(s),Object.assign(this.defaults,{cornerradius:.3,padx:.2,pady:.2,theta:0});let i=1/0,o=-1/0,a=1/0,l=-1/0;for(let v of t){let S=v.getBBox(!0,n);i=Math.min(i,S.xmin),o=Math.max(o,S.xmax),a=Math.min(a,S.ymin),l=Math.max(l,S.ymax)}let h=this.params.padx??.2,c=this.params.pady??.2;i-=h,o+=h,a-=c,l+=c;let m=o-i,f=l-a,g=[(o+i)/2,(l+a)/2];this.userParams.at=g;let b=this.params.cornerradius??.3;this.segments.push(new U([[-m/2,f/2],[m/2,f/2],[m/2,-f/2],[-m/2,-f/2]],{closed:!0,cornerradius:b}));let x=b-b*Math.sqrt(2)/2;this.anchors.NE=[m/2-x,f/2-x],this.anchors.NW=[-m/2+x,f/2-x],this.anchors.SE=[m/2-x,-f/2+x],this.anchors.SW=[-m/2+x,-f/2+x],this.anchors.N=[0,f/2],this.anchors.S=[0,-f/2],this.anchors.E=[m/2,0],this.anchors.W=[-m/2,0]}};var ir=class extends N{constructor(t={}){super(t);z(this,"compoundDwgParams");z(this,"elements",[]);z(this,"_here",new A(0,0));z(this,"_theta",0);this.compoundDwgParams={unit:t.unit??3,font:t.font??null,fontsize:t.fontsize??14,lblofst:t.lblofst??.1,color:t.color??"black",lw:t.lw??2,ls:t.ls??"-",fill:t.fill??"none"};let n=la(!0);try{this.setup(),this._initAnchors()}finally{la(n)}}_initAnchors(){for(let[t,n]of Object.entries(this))if(n instanceof N&&t!=="elements")for(let s of Object.keys(n.anchors)){let i=n.absanchors[s];i&&(this.anchors[`${t}.${s}`]=[i.x,i.y])}}move(t,n){this._here=new A(this._here.x+t,this._here.y+n)}moveFrom(t,n=0,s=0,i){let o=t instanceof A?t.x:t[0],a=t instanceof A?t.y:t[1];this._here=new A(o+n,a+s),i!==void 0&&(this._theta=i)}contains(t){return this.elements.includes(t)}add(t){this.elements.push(t);let n=t._place(this._here.toTuple(),this._theta,this.compoundDwgParams);this._here=n.point,this._theta=n.theta;for(let s of t.segments){let i=s.xform(t.transform,t.params);this.segments.push(i)}return t}};function fe(r,e){let t=r.absanchors[e];return[t.x,t.y]}var _o=class extends ir{constructor(e={}){super({...e,unit:1.5,_box:e.box!==!1,_boxfill:e.boxfill??"none",_boxpad:e.boxpad??.2,_base:e.base===!0})}setup(){let t=this.userParams._box!==!1,n=this.userParams._boxfill??"none",s=this.userParams._boxpad??.2,i=this.userParams._base===!0,o=this.add(new et({d:"d"})),a=new Ht({d:"r",at:[1,-1.5/2]});a.segments.splice(0,1);let l=this.add(a);this.add(new dn({d:"r",at:[.5,-1.5/2+.2],l:.6,arrowwidth:.15,arrowlength:.2})),this.add(new dn({d:"r",at:[.5,-1.5/2-.2],l:.6,arrowwidth:.15,arrowlength:.2}));let h=this.getBBox(!1);if(t&&this.add(new xr({d:"r",at:[0,0],corner1:[h.xmin-s,h.ymin-s],corner2:[h.xmax+s,h.ymax+s],fill:n,zorder:0})),i){let b=l.getBBox(!0),x=o.absanchors.center;this.add(new Pe({d:"l",at:[b.xmin,x.y],l:.15}));let v=this.add(new Pe({d:"d",toy:h.ymax+s}));this.anchors.base=fe(v,"end")}let c=this.add(new Pe({d:"r",at:fe(a,"collector"),l:s})),m=this.add(new Pe({d:"r",at:fe(a,"emitter"),l:s})),f=this.add(new Pe({d:"l",at:fe(o,"start"),tox:h.xmin-s})),g=this.add(new Pe({d:"l",at:fe(o,"end"),tox:h.xmin-s}));this.anchors.anode=fe(f,"end"),this.anchors.cathode=fe(g,"end"),this.anchors.emitter=fe(m,"end"),this.anchors.collector=fe(c,"end")}},Bo=class extends ir{constructor(e={}){super(e)}setup(){let e=this.userParams.fill??!1,t=this.userParams.labels,n=new et({fill:e}).theta(45),s=new et({fill:e}).theta(-45),i=new et({fill:e}).theta(-135).reverse(),o=new et({fill:e}).theta(135).reverse(),a=["top","top","bottom","bottom"];t&&[n,s,i,o].forEach((l,h)=>{t[h]&&l.label(t[h],{loc:a[h]})}),this.add(n),this.add(s),this.add(i),this.add(o),this.anchors.W=fe(n,"start"),this.anchors.N=fe(s,"start"),this.anchors.E=fe(i,"start"),this.anchors.S=fe(o,"start"),this.elmParams.theta=0}},Co=class extends ir{constructor(e={}){super(e)}setup(){let e=this.userParams.vout===!0,t=this.userParams.labels,n=new dt().theta(45),s=new dt().theta(-45),i=new dt().theta(-135),o=new dt().theta(135),a=["top","top","bottom","bottom"];if(t&&[n,s,i,o].forEach((l,h)=>{t[h]&&l.label(t[h],{loc:a[h]})}),this.add(n),this.add(s),this.add(i),this.add(o),e){let l=n.absanchors.start;this.add(new Pe({}).right().at([l.x,l.y]).length(1));let h=this.add(new pn({open:!0})),c=i.absanchors.start;this.add(new Pe({}).left().at([c.x,c.y]).length(1));let m=this.add(new pn({open:!0}));this.anchors.vo1=fe(h,"center"),this.anchors.vo2=fe(m,"center"),this._labelhints.vo1={ofst:[0,.1],halign:"center",valign:"bottom"},this._labelhints.vo2={ofst:[0,.1],halign:"center",valign:"bottom"}}this.anchors.W=fe(n,"start"),this.anchors.N=fe(s,"start"),this.anchors.E=fe(i,"start"),this.anchors.S=fe(o,"start"),this.elmParams.theta=0}},Io=class extends ir{constructor(e={}){let t=e.unit??2;super({...e,unit:t})}setup(){let e=this.userParams.unit??2,t=this.userParams.cycl===!0,n=this.userParams.switch??"spst",s=this.userParams.core!==!1,i=this.userParams.box!==!1,o=this.userParams.boxfill??"none",a=this.userParams.boxpad??.25,l=this.userParams.swreverse===!0,h=this.userParams.swflip===!0,c=this.userParams.link!==!1,m=t?this.add(new Lr({d:"d"})):this.add(new Ir({d:"d"}));this.anchors.in1=fe(m,"start"),this.anchors.in2=fe(m,"end");let f=m.getBBox(!0).xmax,g=f+.6;s&&(this.add(new Pe({d:"d",at:[f+.15,-e/2],anchor:"center",l:1})),g+=.1);let b;if(n==="spst"){let x=new Xr({d:"d",reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),0],this.add(x),this.anchors.a=fe(x,"start"),this.anchors.b=fe(x,"end"),b=x}else if(n==="spdt"){let x=new Xs({d:"d",reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),-.5],this.add(x);let S=l?-e:0,k=l?0:-e,M=this.add(new Pe({d:l?"d":"u",at:fe(x,"a"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(x,"b"),toy:k})),B=this.add(new Pe({d:l?"u":"d",at:fe(x,"c"),toy:k}));this.anchors.a=fe(M,"end"),this.anchors.b=fe(_,"end"),this.anchors.c=fe(B,"end"),b=x}else if(n==="dpst"){let x=new Gs({d:"d",link:!1,reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),-.5],this.add(x);let S=l?0:-e,k=l?-e:0,M=this.add(new Pe({d:l?"u":"d",at:fe(x,"t1"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(x,"t2"),toy:S})),B=this.add(new Pe({d:l?"d":"u",at:fe(x,"p1"),toy:k})),$=this.add(new Pe({d:l?"d":"u",at:fe(x,"p2"),toy:k}));this.anchors.t1=fe(M,"end"),this.anchors.t2=fe(_,"end"),this.anchors.p1=fe(B,"end"),this.anchors.p2=fe($,"end"),b=x}else if(n==="dpdt"){let x=new Ws({d:"d",link:!1,reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),-.5],this.add(x);let S=l?0:-e,k=l?-e:0,M=this.add(new Pe({d:l?"u":"d",at:fe(x,"t1"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(x,"t2"),toy:S})),B=this.add(new Pe({d:l?"u":"d",at:fe(x,"t3"),toy:S})),$=this.add(new Pe({d:l?"u":"d",at:fe(x,"t4"),toy:S})),Y=this.add(new Pe({d:l?"d":"u",at:fe(x,"p1"),toy:k})),Z=this.add(new Pe({d:l?"d":"u",at:fe(x,"p2"),toy:k}));this.anchors.t1=fe(M,"end"),this.anchors.t2=fe(_,"end"),this.anchors.t3=fe(B,"end"),this.anchors.t4=fe($,"end"),this.anchors.p1=fe(Y,"end"),this.anchors.p2=fe(Z,"end"),b=x}else{let x=new Xr({d:"d"});x.userParams.at=[g,0],this.add(x),b=x}if(c){let x=b.getBBox(!1),v=h?x.ymax:x.ymin;this.add(new Pe({d:"r",at:[f+.2,-e/2],ls:":",tox:v}))}if(i){let x=this.getBBox(!1);this.add(new xr({d:"r",at:[0,0],corner1:[x.xmin-a,x.ymin+.2],corner2:[x.xmax+a,x.ymax-.2],fill:o,zorder:0}))}}};var C1=1,I1=.5;function Vs(r,e){let t=r.absanchors[e];return[t.x,t.y]}var vr=class extends ir{constructor(t={}){super({unit:t.unit??1.5,...t});z(this,"inputComponent");z(this,"outputComponent")}setup(){let t=this.userParams._inputFactory,n=this.userParams._outputFactory,s=this.userParams.boxpadx??.2,i=this.userParams.boxpady??.2,o=this.userParams.minw??.5,a=this.userParams.terminals??!0,l=this.userParams.width??2.15,h=this.userParams.box??!0,c=this.userParams.boxfill,m=this.userParams.boxlw,f=this.userParams.boxls,g=(t??(()=>new Xt))();g.down();let b=(n??(()=>new Xt))();b.down();let x=g.getBBox(!1,!1),v=b.getBBox(!1,!1),S=Math.max((x.ymax-x.ymin)/2,o/2),k=Math.max((v.ymax-v.ymin)/2,o/2);g.at([s+S,0]),b.at([l-s-k,0]),this.inputComponent=this.add(g),this.outputComponent=this.add(b);let M=this.getBBox(!1,!1);h&&this.add(new xr({theta:0,at:[0,0],corner1:[0,M.ymin-i],corner2:[l,M.ymax+i],fill:c??"none",lw:m,ls:f,zorder:0})),M=this.getBBox(!1,!1);let _=this.add(new Pe({at:Vs(this.outputComponent,"start")}).tox(M.xmax).right()),B=this.add(new Pe({at:Vs(this.outputComponent,"end")}).tox(M.xmax).right()),$=this.add(new Pe({at:Vs(this.inputComponent,"start")}).tox(M.xmin).left()),Y=this.add(new Pe({at:Vs(this.inputComponent,"end")}).tox(M.xmin).left());if(this.anchors.in_p=Vs($,"end"),this.anchors.in_n=Vs(Y,"end"),this.anchors.out_p=Vs(_,"end"),this.anchors.out_n=Vs(B,"end"),this.anchors.center=[(M.xmin+M.xmax)/2,(M.ymin+M.ymax)/2],this._labelhints.in_p={ofst:[0,.15],halign:"right"},this._labelhints.in_n={ofst:[0,.15],halign:"right"},this._labelhints.out_p={ofst:[0,.15],halign:"left"},this._labelhints.out_n={ofst:[0,.15],halign:"left"},a)for(let Z of["in_p","in_n","out_p","out_n"]){let L=Z.startsWith("in")?-I1:I1,I=this.anchors[Z],X=[I[0]+L,I[1]];this.anchors[Z]=X,this.segments.push(new p([I,X]))}}},Lo=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>new Xt,boxpadx:e.boxpadx??0,minw:e.minw??0})}setup(){super.setup();let e=this.userParams.sign??!0,t=this.userParams.arrow??!0,n=this.userParams.reverse_output??!1;if(e){let s=this.inputComponent.absanchors.end,i=this.inputComponent.absanchors.start;this.segments.push(new W([s.x+.1,s.y+.1],"\u2212",{halign:"left",valign:"center",rotation:0})),this.segments.push(new W([i.x+.1,i.y-.1],"+",{halign:"left",valign:"center",rotation:0}));let o=this.outputComponent.absanchors.end,a=this.outputComponent.absanchors.start;n?(this.segments.push(new W([o.x-.1,o.y+.1],"+",{halign:"right",valign:"center",rotation:0})),this.segments.push(new W([a.x-.1,a.y-.1],"\u2212",{halign:"right",valign:"center",rotation:0}))):(this.segments.push(new W([o.x-.1,o.y+.1],"\u2212",{halign:"right",valign:"center",rotation:0})),this.segments.push(new W([a.x-.1,a.y-.1],"+",{halign:"right",valign:"center",rotation:0})))}if(t){let s=this.anchors.center;this.segments.push(new p([[s[0]-C1/2,s[1]],[s[0]+C1/2,s[1]]],{arrow:"->",lw:2,arrowwidth:.3,arrowlength:.3}))}}},Do=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>t?new br:new br({reverse:!0})})}setup(){super.setup();let e=this.inputComponent.absanchors.end,t=this.inputComponent.absanchors.start;this.segments.push(new W([e.x,e.y+.05],"\u2212",{halign:"right",valign:"bottom",rotation:0})),this.segments.push(new W([t.x,t.y-.05],"+",{halign:"right",valign:"top",rotation:0}))}},No=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Pe,_outputFactory:()=>t?new br:new br({reverse:!0})})}setup(){super.setup();let e=new gn("in",-.15,!0,{headlength:.3});e.at(this.inputComponent),this.add(e)}},Oo=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Pe,_outputFactory:()=>t?new wr:new wr({reverse:!0})})}setup(){super.setup();let e=new gn("in",-.15,!0,{headlength:.3});e.at(this.inputComponent),this.add(e)}},Fo=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>t?new wr:new wr({reverse:!0})})}setup(){super.setup();let e=this.inputComponent.absanchors.end,t=this.inputComponent.absanchors.start;this.segments.push(new W([e.x,e.y+.05],"\u2212",{halign:"right",valign:"bottom",rotation:0})),this.segments.push(new W([t.x,t.y-.05],"+",{halign:"right",valign:"top",rotation:0}))}},$o=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new Nr,_outputFactory:()=>new Or,boxpadx:e.boxpadx??.3})}},jo=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new $r,_outputFactory:()=>new Fr,boxpadx:e.boxpadx??.3})}};var Le=1.1,u0=class extends N{constructor(t={}){super(t);z(this,"_outletrad",1.5);let n=!!t.plug,s=this._outletrad,i=ze(Math.PI*3/4,Math.PI*5/4),o=i.map(_=>.15+s*Math.cos(_)),a=i.map(_=>s*Math.sin(_)),l=i.map(_=>-.15+-s*Math.cos(_)),h=i.map(_=>-s*Math.sin(_)),c=[...o,...l],m=[...a,...h],f=c.map((_,B)=>[_,m[B]]);this.segments.push(new U(f));let g=s/8,b=g*3,x=b*1.25,v=b/2,S=x/2,k=s/2.2,M=n?"black":"bg";this.segments.push(new U([[-k,S],[-k,S-x],[-k+g,S-x],[-k+g,S]],{fill:M,zorder:3})),this.segments.push(new U([[k,v],[k,v-b],[k-g,v-b],[k-g,v]],{fill:M,zorder:3})),this.anchors.hot=[k-g/2,0],this.anchors.neutral=[-k+g/2,0],this.elmParams.drop=[k-g/2,0]}},qo=class extends u0{constructor(e={}){super(e);let t=!!e.plug,n=this._outletrad,s=n/4,i=-n/2.5,o=[-s/2,-s/2,s/2,s/2],a=[i,i-s/2,i-s/2,i],l=ze(0,Math.PI);for(let b of l)o.push(s/2*Math.cos(b)),a.push(i+s/2*Math.sin(b));let h=t?"black":"bg",c=o.map((b,x)=>[b,a[x]]);this.segments.push(new U(c,{fill:h,zorder:3}));let m=s/2,f=this.segments[1];f.verts=f.verts.map(([b,x])=>[b,x+m]);let g=this.segments[2];g.verts=g.verts.map(([b,x])=>[b,x+m]),this.anchors.hot=[this.anchors.hot[0],this.anchors.hot[1]+m],this.anchors.neutral=[this.anchors.neutral[0],this.anchors.neutral[1]+m],this.anchors.ground=[0,i]}},m0=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2;this.segments.push(new D([-i,0],s,{fill:n,zorder:3})),this.segments.push(new D([i,0],s,{fill:n,zorder:3})),this.anchors.hot=[i,0],this.anchors.neutral=[-i,0],this.elmParams.drop=[i,0]}},Ho=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2,o=-Le/4,a=Le/2.5;this.segments.push(new D([-i,o],s,{fill:n,zorder:3})),this.segments.push(new D([i,o],s,{fill:n,zorder:3})),this.segments.push(new D([0,a],s*1.2,{fill:n,zorder:3})),this.anchors.hot=[i,o],this.anchors.neutral=[-i,o],this.anchors.ground=[0,a],this.elmParams.drop=[0,a]}},Yo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2,o=0,a=Le/2;this.segments.push(new D([-i,o],s,{fill:n,zorder:3})),this.segments.push(new D([i,o],s,{fill:n,zorder:3})),this.segments.push(new D([0,a],s,{fill:n,zorder:3})),this.anchors.hot=[i,o],this.anchors.neutral=[-i,o],this.anchors.ground=[0,a],this.elmParams.drop=[-i,o]}},Xo=class extends m0{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le/8,i=Le/6,o=Le-.05,a=-Le+.05;this.segments.push(new p([[-s,o],[-s,o-i],[s,o-i],[s,o]],{fill:n,zorder:3})),this.segments.push(new p([[-s,a],[-s,a+i],[s,a+i],[s,a]],{fill:n,zorder:3}))}},Go=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/6,i=s*3,o=Le/5,a=Le*3/4,l=-Le/2.5,h=s;this.segments.push(new U([[-o/2,a],[-o/2,a-i],[o/2,a-i],[o/2,a]],{fill:n,zorder:3})),this.segments.push(new U([[-h,l],[-h,l-s],[-h-i,l-s],[-h-i,l]],{fill:n,zorder:3})),this.segments.push(new U([[h,l],[h,l-s],[h+i,l-s],[h+i,l]],{fill:n,zorder:3})),this.anchors.hot=[h+i/2,l-s/2],this.anchors.neutral=[-h-i/2,l-s/2],this.anchors.ground=[0,a-i/2],this.elmParams.drop=[h+i/2,l-s/2]}},d0=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=s*3,o=-s*2,a=[[-s/2,o],[-s/2,o-i],[s/2,o-i],[s/2,o]],l=a.map(c=>Wr(c,120).toTuple()),h=a.map(c=>Wr(c,-120).toTuple());this.segments.push(new U(a,{fill:n,zorder:3})),this.segments.push(new U(l,{fill:n,zorder:3})),this.segments.push(new U(h,{fill:n,zorder:3})),this.anchors.hot=l[1],this.anchors.neutral=h[2],this.anchors.ground=[0,o-i],this.elmParams.drop=l[1]}},Wo=class extends d0{constructor(e={}){super(e);let t=[.4,.3],n=[-.4,.3],s=this.segments[2];s.verts=s.verts.map(o=>Wr(o,90,t).toTuple());let i=this.segments[3];i.verts=i.verts.map(o=>Wr(o,-90,n).toTuple()),this.anchors.hot=Wr(this.anchors.hot,90,t).toTuple(),this.anchors.neutral=Wr(this.anchors.neutral,-90,n).toTuple()}},Vo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le*1.5,i=s*2,o=i/5;this.segments.push(new U([[-i/2,0],[-i/2+o,s/2],[i/2-o,s/2],[i/2,0],[i/2-o,-s/2],[-i/2+o,-s/2]]));let a=Le/8;this.segments.push(new D([-i/4,0],a,{fill:n,zorder:3})),this.segments.push(new D([0,-a*2],a,{fill:n,zorder:3})),this.segments.push(new D([i/4,0],a,{fill:n,zorder:3})),this.anchors.hot=[i/4,0],this.anchors.neutral=[-i/4,0],this.anchors.ground=[0,-a*2],this.elmParams.drop=[i/4,0]}},Uo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2;this.segments.push(new D([-i,0],s,{fill:n,zorder:3})),this.segments.push(new D([i,0],s,{fill:n,zorder:3})),this.anchors.hot=[i,0],this.anchors.neutral=[-i,0],this.elmParams.drop=[i,0];let o=Le/4,a=-Le/2,l=[-o/2,-o/2,o/2,o/2],h=[a,a+o/2,a+o/2,a],c=ze(0,Math.PI);for(let f of c)l.push(o/2*Math.cos(f)),h.push(a-o/2*Math.sin(f));let m=l.map((f,g)=>[f,h[g]]);this.segments.push(new U(m,{fill:n,zorder:3})),this.anchors.ground=[0,a]}},Jo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le*1.2,i=s*2.25;this.segments.push(new U([[-i/2,s/2],[i/2,s/2],[i/2,-s/2],[-i/2,-s/2]]));let o=Le/8;this.segments.push(new D([-i/4,0],o,{fill:n,zorder:3})),this.segments.push(new D([0,0],o,{fill:n,zorder:3})),this.segments.push(new D([i/4,0],o,{fill:n,zorder:3})),this.anchors.hot=[i/4,0],this.anchors.neutral=[-i/4,0],this.anchors.ground=[0,0],this.elmParams.drop=[i/4,0]}};var Us=0,st=1.75,_a=st/2,oh=20,Gt=st*.4,or=st/9,Ba=st/6,Ca=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{tube_lw:2.5,anode_lw:2,cathode_lw:2,heat_lw:2,grid_lw:2,n_grid_dashes:3,dot_radius:.075,theta:0})}_drawEnvelope(e,t,n="none"){let s=-e,i=t/2,o=-i,a=i,l=[0,-e/2],h=Math.min(t/2,e/2);n==="left"?this.segments.push(new xe(l,t,e,{theta1:90-oh,theta2:270+oh,lw:this.params.tube_lw})):n==="right"?this.segments.push(new xe(l,t,e,{theta1:270-oh,theta2:90+oh,lw:this.params.tube_lw})):this.segments.push(new U([[o,Us],[a,Us],[a,s],[o,s]],{cornerradius:h,lw:this.params.tube_lw})),this.anchors.N=[0,0],this.anchors.S=[0,-e],this.anchors.E=[a,-e/2],this.anchors.W=[o,-e/2];let c=_a/Math.sqrt(2);this.anchors.NE=[c,-_a+c],this.anchors.NW=[-c,-_a+c],this.anchors.SE=[c,-_a-c],this.anchors.SW=[-c,-_a-c],this._labelhints.NE={ofst:[.12,.12],halign:"left"},this._labelhints.NW={ofst:[-.12,.12],halign:"right"},this._labelhints.SE={ofst:[.12,-.12],halign:"left",valign:"top"},this._labelhints.SW={ofst:[-.12,-.12],halign:"right",valign:"top"}}_drawElements(e,t,n,s,i,o,a=""){let l=this.params.dot_radius,h=Us-t/2+Math.max(0,s-1)*or/2,c=h-or*Math.max(0,s-1),m=e-Gt/2,f=e+Gt/2,g=h+or;o==="narrow"?this.segments.push(new p([[e-l,g],[e+l,g]],{lw:this.params.anode_lw})):o==="dot"?(g+=l*2,this.segments.push(new D([e,g-l],l,{lw:this.params.anode_lw}))):o!=="none"&&o!=null&&this.segments.push(new p([[m,g],[f,g]],{lw:this.params.anode_lw})),o!=="none"&&o!=null&&(this.segments.push(new p([[e,Us],[e,g]],{lw:this.params.anode_lw})),this.anchors[`anode${a}`]=[e,Us],this._labelhints[`anode${a}`]={ofst:[.1,.1],halign:"left",valign:"bottom",fontsize:11});let b=this.params.n_grid_dashes,x=Gt/(b+2),v=(Gt-x*(b-1))/b,S=[];for(let _=0;_<b;_++)S.push(m+_*(v+x));for(let _=0;_<s;_++){let B=h-or*_;for(let $=0;$<b;$++)this.segments.push(new p([[S[$],B],[S[$]+v,B]],{lw:this.params.grid_lw}));s===1?(this.anchors[`grid${a}`]=[m-x,B],this.anchors[`grid${a}_R`]=[f+x,B],this._labelhints[`grid${a}`]={ofst:[-n/2-m+.1,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints[`grid${a}_R`]={ofst:[n/2-f-.1,.1],halign:"left",valign:"bottom",fontsize:11}):(this.anchors[`grid${a}_${_+1}`]=[m-x,B],this.anchors[`grid${a}_${_+1}R`]=[f+x,B],this._labelhints[`grid${a}_${_+1}`]={ofst:[-n/2-m+.1,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints[`grid${a}_${_+1}R`]={ofst:[n/2-f-.1,.1],halign:"left",valign:"bottom",fontsize:11})}let k=c-or,M=l*2;return i==="cold"?(this.segments.push(new p([[e,k-l*2],[e,-t]])),this.segments.push(new D([e,k-l],l)),this.anchors[`cathode${a}`]=[e,-t],this._labelhints[`cathode${a}`]={ofst:[.1,-.1],halign:"left",valign:"top",fontsize:11}):i!=="none"&&i!=null&&(this.segments.push(new p([[m,k-M],[m,k],[f,k],[f,k-M]],{lw:this.params.cathode_lw})),this.anchors[`cathode${a}`]=[m,k-M],this.anchors[`cathode${a}_R`]=[f,k-M],this._labelhints[`cathode${a}`]={ofst:[-.1,-t-k+M],halign:"right",valign:"top",fontsize:11},this._labelhints[`cathode${a}_R`]={ofst:[.1,-t-k+M],halign:"left",valign:"top",fontsize:11}),k}_drawHeat(e,t){let n=e-or*1.25,s=-Gt/3.5,i=Gt/3.5,o=Us-t-or,a=n-Math.sqrt(2)*i;this.segments.push(new p([[s,o],[s,a],[0,n],[i,a],[i,o]],{lw:this.params.heat_lw})),this.anchors.heat1=[s,o],this.anchors.heat2=[i,o],this._labelhints.heat1={ofst:[-.1,0],halign:"right",valign:"bottom",fontsize:11},this._labelhints.heat2={ofst:[.1,0],halign:"left",valign:"bottom",fontsize:11}}},Gr=class extends Ca{constructor(e={}){let{cathode:t="heated",anodetype:n="plate",grids:s=1,heater:i=!0,split:o="none",...a}=e;super(a);let l=Math.max(st,st+(s-4)*or);this._drawEnvelope(l,st,o);let h=this._drawElements(0,l,st,s,t,n);i&&this._drawHeat(h,l)}},Ko=class extends Ca{constructor(e={}){let{cathode:t="heated",anodetype:n="plate",grids_left:s=1,grids_right:i=1,heater:o=!0,...a}=e;super(a);let l=Math.max(s,i),h=Math.max(st,st+(l-4)*or),c=st*1.5,m=-c*.2,f=c*.2;this._drawEnvelope(h,c);let g=this._drawElements(m,h,c,s,t,n,"A"),b=this._drawElements(f,h,c,i,t,n,"B");o&&this._drawHeat(Math.min(g,b),h)}},Zo=class extends Ca{constructor(e={}){let{anodes:t=3,cathode:n="T",anodetype:s="narrow",grid:i=!1,...o}=e;super(o);let a=st,l=Math.max(st,(t-1)*Ba+st);this._drawEnvelope(a,l),i&&this._drawNixieGrid(t,l),this._drawNixieAnodes(t,s),this._drawNixieCathode(t,n)}_drawNixieAnodes(e,t){let n=-st/4,i=-((e-1)*Ba)/2,o=this.params.dot_radius;for(let a=0;a<e;a++){let l=i+a*Ba;t==="dot"?this.segments.push(new D([l,n-o],o,{lw:this.params.anode_lw})):this.segments.push(new p([[l-o,n],[l+o,n]],{lw:this.params.anode_lw})),this.segments.push(new p([[l,Us],[l,n]],{lw:this.params.anode_lw})),this.anchors[`anode${a}`]=[l,Us],this._labelhints[`anode${a}`]={ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:11}}}_drawNixieGrid(e,t){let n=(e-1)*Ba,s=-n/2,i=e+1,o=n/(i+2),a=(n-o*(i-1))/i,l=[];for(let c=0;c<i;c++)l.push(s+c*(a+o));let h=-st/2;for(let c=0;c<i;c++)this.segments.push(new p([[l[c],h],[l[c]+a,h]],{lw:this.params.grid_lw}));this.anchors.grid=[s-o,h],this.anchors.grid_R=[s+n+o,h],this._labelhints.grid={ofst:[-t/2-s,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints.grid_R={ofst:[t/2-n/2,.1],halign:"left",valign:"bottom",fontsize:11}}_drawNixieCathode(e,t){let n=this.params.dot_radius,s=-3*st/4,i=n,o=(e-1)*Ba;t==="cold"?(this.segments.push(new p([[0,s-n*2],[0,-st]],{lw:this.params.cathode_lw})),this.segments.push(new D([0,s-n],n)),this.anchors.cathode=[0,-st]):t==="heated"?(this.segments.push(new p([[-Gt/2,s-i],[-Gt/2,s],[Gt/2,s],[Gt/2,s-i]],{lw:this.params.cathode_lw})),this.anchors.cathode=[-Gt/2,s-i],this.anchors.cathode_R=[Gt/2,s-i]):t!=="none"&&t!=null&&(this.segments.push(new p([[0,-st],[0,s],H,[-o/2,s],[o/2,s]],{lw:this.params.cathode_lw})),this.anchors.cathode=[0,-st])}},Qo=class extends Gr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:0,heater:t,split:n,...s})}},ea=class extends Gr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:1,heater:t,split:n,...s}),this.anchors.control=this.anchors.grid,this.anchors.control_R=this.anchors.grid_R,this._labelhints.control=this._labelhints.grid,this._labelhints.control_R=this._labelhints.grid_R}},ta=class extends Gr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:2,heater:t,split:n,...s}),this.anchors.screen=this.anchors.grid_1,this.anchors.screen_R=this.anchors.grid_1R,this.anchors.control=this.anchors.grid_2,this.anchors.control_R=this.anchors.grid_2R,this._labelhints.screen=this._labelhints.grid_1,this._labelhints.screen_R=this._labelhints.grid_1R,this._labelhints.control=this._labelhints.grid_2,this._labelhints.control_R=this._labelhints.grid_2R}},ra=class extends Gr{constructor(e={}){let{strap:t=!1,heater:n=!1,split:s="none",...i}=e;if(super({cathode:"heated",grids:3,heater:n,split:s,...i}),this.anchors.suppressor=this.anchors.grid_1,this.anchors.suppressor_R=this.anchors.grid_1R,this.anchors.screen=this.anchors.grid_2,this.anchors.screen_R=this.anchors.grid_2R,this.anchors.control=this.anchors.grid_3,this.anchors.control_R=this.anchors.grid_3R,this._labelhints.suppressor=this._labelhints.grid_1,this._labelhints.suppressor_R=this._labelhints.grid_1R,this._labelhints.screen=this._labelhints.grid_2,this._labelhints.screen_R=this._labelhints.grid_2R,this._labelhints.control=this._labelhints.grid_3,this._labelhints.control_R=this._labelhints.grid_3R,t){let o=this.params.dot_radius,a=this.anchors.cathode_R,l=[a[0],a[1]+o*2],h=this.anchors.suppressor_R,c=[Gt/2,h[1]],m=[l[0]+or*.75,l[1]+or/2],f=[m[0],c[1]-or/2];this.segments.push(new p([l,m,f,c],{lw:this.params.cathode_lw}))}}};var Js={ResistorIEEE:r=>new dt(r??{}),ResistorIEC:r=>new mt(r??{}),ResistorVarIEEE:r=>new cr(r??{}),ResistorVarIEC:r=>new Zt(r??{}),Thermistor:r=>new Jn(r??{}),PhotoresistorIEEE:r=>new ur(r??{}),PhotoresistorIEC:r=>new Qt(r??{}),Rshunt:r=>new Kn(r??{}),PotentiometerIEEE:r=>new mr(r??{}),PotentiometerIEC:r=>new er(r??{}),FuseIEEE:r=>new dr(r??{}),FuseIEC:r=>new Dr(r??{}),Resistor:r=>new Zn(r??{}),ResistorVar:r=>new Qn(r??{}),Photoresistor:r=>new ts(r??{}),Potentiometer:r=>new es(r??{}),Fuse:r=>new rs(r??{}),Memristor:r=>new ns(r??{}),Memristor2:r=>new ss(r??{}),Josephson:r=>new is(r??{}),FuseUS:r=>new os(r??{}),Breaker:r=>new as(r??{}),CPE:r=>new ls(r??{}),SparkGap:r=>new hs(r??{}),Nullator:r=>new Nr(r??{}),Norator:r=>new Or(r??{}),CurrentMirror:r=>new Fr(r??{}),VoltageMirror:r=>new $r(r??{}),Capacitor:r=>new Cr(r??{}),Capacitor2:r=>new Cn(r??{}),CapacitorVar:r=>new In(r??{}),CapacitorTrim:r=>new Ln(r??{}),Diode:r=>new et(r??{}),Schottky:r=>new Dn(r??{}),Zener:r=>new Nn(r??{}),DiodeTunnel:r=>new On(r??{}),DiodeTVS:r=>new Fn(r??{}),DiodeShockley:r=>new $n(r??{}),Varactor:r=>new jn(r??{}),LED:r=>new qn(r??{}),LED2:r=>new Hn(r??{}),Photodiode:r=>new Yn(r??{}),SCR:r=>new Xn(r??{}),Diac:r=>new on(r??{}),Triac:r=>new Gn(r??{}),Inductor:r=>new Ir(r??{}),Inductor2:r=>new Lr(r??{}),Crystal:r=>new Un(r??{}),Opamp:r=>new cs(r??{}),AnalogBiasedFet:r=>new j0(r??{}),AnalogNFet:r=>new F0(r??{}),AnalogPFet:r=>new $0(r??{}),Bjt:r=>new qr(r??{}),Bjt2:r=>new Hr(r??{}),BjtNpn:r=>new Ht(r??{}),BjtNpn2:r=>new Ss(r??{}),BjtPnp:r=>new rr(r??{}),BjtPnp2:r=>new ln(r??{}),BjtPnp2c:r=>new W0(r??{}),BjtPnp2c2:r=>new ei(r??{}),Hemt:r=>new G0(r??{}),IgbtN:r=>new Z0(r??{}),IgbtP:r=>new Q0(r??{}),JFet:r=>new vs(r??{}),JFet2:r=>new ys(r??{}),JFetN:r=>new q0(r??{}),JFetN2:r=>new Y0(r??{}),JFetP:r=>new H0(r??{}),JFetP2:r=>new X0(r??{}),NFet:r=>new gs(r??{}),NFet2:r=>new ws(r??{}),NMos:r=>new ms(r??{}),NMos2:r=>new ps(r??{}),NpnPhoto:r=>new J0(r??{}),NpnSchottky:r=>new V0(r??{}),PFet:r=>new bs(r??{}),PFet2:r=>new xs(r??{}),PMos:r=>new ds(r??{}),PMos2:r=>new fs(r??{}),PnpPhoto:r=>new K0(r??{}),PnpSchottky:r=>new U0(r??{}),DFlipFlop:r=>new ri(r??{}),Ic:r=>new nr(r??{}),Ic555:r=>new ii(r??{}),IcDIP:r=>new ai(r??{}),JKFlipFlop:r=>new ni(r??{}),Multiplexer:r=>new ti(r??{}),SevenSegment:r=>new oi(r??{}),VoltageRegulator:r=>new si(r??{}),Source:r=>new rt(r??{}),SourceV:r=>new Ri(r??{}),SourceI:r=>new Ai(r??{}),SourceSin:r=>new _i(r??{}),SourcePulse:r=>new Bi(r??{}),SourceSquare:r=>new Li(r??{}),SourceTriangle:r=>new Ci(r??{}),SourceRamp:r=>new Ii(r??{}),SourceControlled:r=>new Ys(r??{}),SourceControlledV:r=>new br(r??{}),SourceControlledI:r=>new wr(r??{}),BatteryCell:r=>new Di(r??{}),Battery:r=>new Ni(r??{}),BatteryDouble:r=>new Oi(r??{}),Solar:r=>new Fi(r??{}),MeterV:r=>new $i(r??{}),MeterI:r=>new ji(r??{}),MeterA:r=>new qi(r??{}),MeterOhm:r=>new Hi(r??{}),MeterArrow:r=>new Yi(r??{}),Lamp:r=>new Xi(r??{}),Lamp2:r=>new Gi(r??{}),Neon:r=>new Wi(r??{}),MeterBox:r=>new mn(r??{}),MeterAnalog:r=>new Vi(r??{}),Oscilloscope:r=>new Ui(r??{}),MeterDigital:r=>new Ji(r??{}),GroundSignal:r=>new Ki(r??{}),GroundChassis:r=>new Zi(r??{}),Antenna:r=>new Qi(r??{}),AntennaLoop:r=>new eo(r??{}),AntennaLoop2:r=>new to(r??{}),Vss:r=>new ro(r??{}),Vdd:r=>new no(r??{}),NoConnect:r=>new so(r??{}),Switch:r=>new Xr(r??{}),SwitchSpdt:r=>new io(r??{}),SwitchSpdt2:r=>new Xs(r??{}),SwitchDpst:r=>new Gs(r??{}),SwitchDpdt:r=>new Ws(r??{}),Button:r=>new oo(r??{}),SwitchReed:r=>new ao(r??{}),SwitchRotary:r=>new lo(r??{}),SwitchDIP:r=>new ho(r??{}),Speaker:r=>new co(r??{}),Mic:r=>new uo(r??{}),Motor:r=>new mo(r??{}),AudioJack:r=>new po(r??{}),Coax:r=>new fo(r??{}),Triax:r=>new go(r??{}),Transformer:r=>new bo(r??{}),Line:r=>new Pe(r??{}),Ground:r=>new Ti(r??{}),Arrow:r=>new dn(r??{}),DataBusLine:r=>new wo(r??{}),Dot:r=>new pn(r??{}),DotDotDot:r=>new vo(r??{}),Gap:r=>new Xt(r??{}),Arrowhead:r=>new xo(r??{}),Label:r=>new So(r??{}),Rect:r=>new xr(r??{}),Tag:r=>new ko(r??{}),Wire:r=>new yo(r??{}),Annotate:r=>new zo(r??{}),Arc2:r=>new Mo(r??{}),Arc3:r=>new fn(r??{}),ArcLoop:r=>new To(r??{}),ArcN:r=>new Po(r??{}),ArcZ:r=>new Eo(r??{}),CurrentLabel:r=>new h0(r??{}),CurrentLabelInline:r=>{let{direction:e,ofst:t,start:n,...s}=r??{};return new gn(e,t,n,s)},LoopArrow:r=>new c0(r??{}),VoltageLabelArc:r=>new Ro(r??{}),ZLabel:r=>new Ao(r??{}),Optocoupler:r=>new _o(r??{}),Rectifier:r=>new Bo(r??{}),Relay:r=>new Io(r??{}),Wheatstone:r=>new Co(r??{}),TwoPort:r=>new Lo(r??{}),VoltageTransactor:r=>new Do(r??{}),TransimpedanceTransactor:r=>new No(r??{}),CurrentTransactor:r=>new Oo(r??{}),TransadmittanceTransactor:r=>new Fo(r??{}),Nullor:r=>new $o(r??{}),VMCMPair:r=>new jo(r??{}),OrthoLines:r=>new di(r??{}),RightLines:r=>new Hs(r??{}),Header:r=>new pi(r??{}),Jumper:r=>new fi(r??{}),BusConnect:r=>new gi(r??{}),BusLine:r=>new bi(r??{}),DB25:r=>new xi(r??{}),DE9:r=>new a0(r??{}),DB9:r=>new wi(r??{}),DA15:r=>new vi(r??{}),DC37:r=>new yi(r??{}),DD50:r=>new Si(r??{}),CoaxConnect:r=>new ki(r??{}),Plug:r=>new Mi(r??{}),Jack:r=>new zi(r??{}),ConnectorTerminal:r=>new Ei(r??{}),OutletA:r=>new u0(r??{}),OutletB:r=>new qo(r??{}),OutletC:r=>new m0(r??{}),OutletD:r=>new Ho(r??{}),OutletE:r=>new Yo(r??{}),OutletF:r=>new Xo(r??{}),OutletG:r=>new Go(r??{}),OutletH:r=>new d0(r??{}),OutletI:r=>new Wo(r??{}),OutletJ:r=>new Vo(r??{}),OutletK:r=>new Uo(r??{}),OutletL:r=>new Jo(r??{}),VacuumTube:r=>new Gr(r??{}),DualVacuumTube:r=>new Ko(r??{}),NixieTube:r=>new Zo(r??{}),TubeDiode:r=>new Qo(r??{}),Triode:r=>new ea(r??{}),Tetrode:r=>new ta(r??{}),Pentode:r=>new ra(r??{}),ElementImage:r=>{let{image:e,width:t,height:n,...s}=r??{};return new js(e,t,n,s)},And:r=>new Bt(r??{}),Or:r=>new $t(r??{}),Buf:r=>new Jt(r??{}),Not:r=>new Kt(r??{}),Tristate:r=>new Bn(r??{}),Kmap:r=>new A0(r??{}),BitField:r=>new s0(r??{}),NotNot:r=>new C0(r??{}),Schmitt:r=>new L0(r??{}),SchmittAnd:r=>new o0(r??{}),SchmittNand:r=>Yl(r),SchmittNot:r=>new D0(r??{}),Table:r=>new B0(r),Tgate:r=>new I0(r??{}),TimingDiagram:r=>new n0(r??{}),FlowBox:r=>new cn(r??{}),RoundBox:r=>new Yr(r??{}),Terminal:r=>new hn(r??{}),RoundProcess:r=>new li(r??{}),Process:r=>new hi(r??{}),Start:r=>new ci(r??{}),Subroutine:r=>new ks(r??{}),Data:r=>new Ms(r??{}),Ellipse:r=>new zs(r??{}),Decision:r=>new Es(r??{}),Connect:r=>new pr(r??{}),Circle:r=>new ui(r??{}),State:r=>new mi(r??{}),StateEnd:r=>new Ps(r??{}),DspBox:r=>new sr(r??{}),DspCircle:r=>new Yt(r??{}),Sum:r=>new Ts(r??{}),SumSigma:r=>new Rs(r??{}),Mixer:r=>new As(r??{}),DspSpeaker:r=>new _s(r??{}),Amp:r=>new un(r??{}),OscillatorBox:r=>new Bs(r??{}),Oscillator:r=>new Cs(r??{}),Filter:r=>new Is(r??{}),Adc:r=>new Ls(r??{}),Dac:r=>new Ds(r??{}),Demod:r=>new Ns(r??{}),Circulator:r=>new Os(r??{}),Isolator:r=>new Fs(r??{}),VGA:r=>new $s(r??{}),RBox:r=>new mt(r??{}),RBoxVar:r=>new Zt(r??{}),PotBox:r=>new er(r??{}),PhotoresistorBox:r=>new Qt(r??{}),Nand:r=>Tn(r),Nor:r=>Rn(r),Xor:r=>An(r),Xnor:r=>_n(r)};function tu(){return Object.keys(Js).sort()}var L1=tu;function D1(r){let e=Js[r];if(!e)throw new Error(`Unknown element type "${r}". Use getAvailableTypes() to see all available types.`);let t=e();return new lr().add(t),Object.keys(t.absanchors).sort()}function ru(r,e){let t=r.indexOf(".");if(t<0)throw new Error(`Invalid anchor reference "${r}". Expected format "elementId.anchorName"`);let n=r.slice(0,t),s=r.slice(t+1),i=e.get(n);if(!i){let a=[...e.keys()].join(", ")||"(none)";throw new Error(`Element "${n}" not found. Available elements: ${a}`)}let o=i.absanchors[s];if(!o){let a=Object.keys(i.absanchors).join(", ")||"(none)";throw new Error(`Anchor "${s}" not found on element "${n}". Available anchors: ${a}`)}return o.toTuple()}function Ia(r,e){return Array.isArray(r)?r:ru(r,e)}function ah(r,e){return typeof r=="number"?r:ru(r,e)}function lh(r,e){return typeof r=="number"?r:ru(r,e)}var yr={light:{bg:"#ffffff",stroke:"#000000",fill:"none",text:"#000000",font:"sans-serif",lw:2},dark:{bg:"#1a1a2e",stroke:"#c8d6e5",fill:"none",text:"#dfe6e9",font:"sans-serif",lw:2},print:{bg:"#ffffff",stroke:"#333333",fill:"none",text:"#333333",font:"serif",lw:1.5}},Ks={bg:"--circuit-bg",stroke:"--circuit-stroke",fill:"--circuit-fill",text:"--circuit-text",font:"--circuit-font",lw:"--circuit-lw"};function _2(){if(typeof getComputedStyle>"u")return{...yr.light};let r=getComputedStyle(document.documentElement),e=t=>r.getPropertyValue(t).trim();return{bg:e(Ks.bg)||"transparent",stroke:e(Ks.stroke)||yr.light.stroke,fill:e(Ks.fill)||"none",text:e(Ks.text)||yr.light.text,font:e(Ks.font)||yr.light.font,lw:parseFloat(e(Ks.lw))||yr.light.lw}}function Zs(r){if(r===void 0)return{...yr.light};if(typeof r=="string"){if(r==="auto")return _2();let e=yr[r];if(!e)throw new Error(`Unknown theme "${r}". Available: ${Object.keys(yr).join(", ")}, auto`);return{...e}}return{...yr.light,...r}}var N1={bg:"bgcolor",stroke:"color",fill:"fill",font:"font",lw:"lw"};function O1(r,e){let t={};for(let n of Object.keys(N1)){let s=N1[n];s&&(t[s]=r[n])}return{...t,...e}}function hh(r,e){let t=typeof r=="string"?JSON.parse(r):r,n=e?.theme??t.theme,s=n!==void 0?O1(Zs(n),t.drawing):{...t.drawing??{}},i=e?.colorTransition??t.drawing?.colorTransition??!1,o={...s,...e?.interactive?{interactive:!0}:{},...i?{colorTransition:!0}:{}},a=new lr(o),l=new Map;for(let h of t.elements){if(h==="push"){a.push();continue}if(h==="pop"){a.pop();continue}let c=Js[h.type];if(!c)throw new Error(`Unknown element type "${h.type}". Use getAvailableTypes() to see all available types.`);let m=c(h.params);if(h.d)switch(h.d){case"up":m.up();break;case"down":m.down();break;case"left":m.left();break;case"right":m.right();break}if(h.theta!==void 0&&m.theta(h.theta),h.at!==void 0&&m.at(Ia(h.at,l)),h.anchor&&m.anchor(h.anchor),h.flip&&m.flip(),h.reverse&&m.reverse(),h.scale!==void 0&&m.scale(h.scale),m instanceof se&&(h.to!==void 0&&m.to(Ia(h.to,l)),h.tox!==void 0&&m.tox(ah(h.tox,l)),h.toy!==void 0&&m.toy(lh(h.toy,l)),h.l!==void 0&&m.length(h.l),h.dot&&m.dot(h.dot==="open"),h.idot&&m.idot(h.idot==="open")),h.label)if(typeof h.label=="string")m.label(h.label);else{let{text:f,...g}=h.label;m.label(f,g)}if(h.labels)for(let f of h.labels){let{text:g,...b}=f;m.label(g,b)}h.color&&m.color(h.color),h.fill&&m.fill(h.fill),h.lw!==void 0&&m.linewidth(h.lw),h.ls&&m.linestyle(h.ls),a.add(m),h.id&&(l.set(h.id,m),e?.interactive&&a.setElementMeta(m,{id:h.id,type:h.type,tooltip:h.tooltip??`${h.id} \u2014 ${h.type}`}))}return a.toSvgString()}function F1(r){let e=[],t;if(typeof r=="string")try{t=JSON.parse(r)}catch(i){return{valid:!1,errors:[{path:"",message:`Invalid JSON: ${i.message}`}]}}else t=r;if(!t.elements||!Array.isArray(t.elements))return e.push({path:"elements",message:'"elements" must be an array'}),{valid:!1,errors:e};let n=new Set,s=0;for(let i=0;i<t.elements.length;i++){let o=t.elements[i],a=`elements[${i}]`;if(typeof o=="string"){o==="push"?s++:o==="pop"?(s--,s<0&&(e.push({path:a,message:'"pop" without matching "push"'}),s=0)):e.push({path:a,message:`Invalid control instruction "${o}". Expected "push" or "pop"`});continue}if(typeof o!="object"||o===null){e.push({path:a,message:'Element must be an object or "push"/"pop" string'});continue}let l=o;if(!l.type||typeof l.type!="string"){e.push({path:`${a}.type`,message:'"type" is required and must be a string'});continue}Js[l.type]||e.push({path:`${a}.type`,message:`Unknown element type "${l.type}"`}),l.d&&!["up","down","left","right"].includes(l.d)&&e.push({path:`${a}.d`,message:`Invalid direction "${l.d}". Expected "up", "down", "left", or "right"`});for(let h of["at","to","tox","toy"]){let c=l[h];if(typeof c=="string"&&c.includes(".")){let m=c.slice(0,c.indexOf("."));n.has(m)||e.push({path:`${a}.${h}`,message:`Element "${m}" referenced before definition`})}else typeof c=="string"&&!c.includes(".")&&e.push({path:`${a}.${h}`,message:`Invalid anchor reference "${c}". Expected format "elementId.anchorName"`})}l.id&&n.add(l.id)}return s>0&&e.push({path:"elements",message:`${s} unmatched "push" without "pop"`}),{valid:e.length===0,errors:e}}var na="data-sd-original-style",nu="path,polyline,polygon,circle,ellipse,line";function B2(r){r.hasAttribute(na)||r.setAttribute(na,r.getAttribute("style")??"")}function $1(r){let e=r.getAttribute(na);e!==null?(r.setAttribute("style",e),r.removeAttribute(na)):r.style.removeProperty("stroke")}var La=class{constructor(e,t,n){z(this,"_container");z(this,"_json");z(this,"_opts");z(this,"_svg");z(this,"_elementMap",new Map);z(this,"_listeners",new Map);z(this,"_selectedId",null);z(this,"_theme");z(this,"_destroyed",!1);z(this,"_tooltipEl",null);z(this,"_autoObserver",null);z(this,"_mediaQuery",null);z(this,"_mediaHandler",null);z(this,"_boundClick");z(this,"_boundMouseover");z(this,"_boundMouseout");z(this,"_boundContextmenu");z(this,"_boundMousemove");this._container=e,this._json=t,this._opts={...n,interactive:!0},this._theme=Zs(n.theme??this._json.theme),this._boundClick=this._onClick.bind(this),this._boundMouseover=this._onMouseover.bind(this),this._boundMouseout=this._onMouseout.bind(this),this._boundContextmenu=this._onContextmenu.bind(this),this._boundMousemove=this._onMousemove.bind(this),this._render(),this._bindEvents(),this._initTooltip(),this._initAutoTheme()}_isAutoTheme(){return(this._opts.theme??this._json.theme)==="auto"}_initAutoTheme(){if(!this._isAutoTheme())return;let e=()=>{this._destroyed||(this._theme=Zs("auto"),this._unbindEvents(),this._render(),this._bindEvents(),this._selectedId=null)};this._autoObserver=new MutationObserver(e),this._autoObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","data-color-mode","style"]}),typeof matchMedia<"u"&&(this._mediaQuery=matchMedia("(prefers-color-scheme: dark)"),this._mediaHandler=e,this._mediaQuery.addEventListener("change",this._mediaHandler))}_teardownAutoTheme(){this._autoObserver&&(this._autoObserver.disconnect(),this._autoObserver=null),this._mediaQuery&&this._mediaHandler&&(this._mediaQuery.removeEventListener("change",this._mediaHandler),this._mediaQuery=null,this._mediaHandler=null)}_render(){let e=hh(this._json,this._opts);this._container.innerHTML=e;let t=this._container.querySelector("svg");if(!t)throw new Error("Failed to render SVG from circuit JSON.");this._svg=t,this._svg.querySelectorAll("g.sd-el > title").forEach(o=>o.remove()),this._elementMap.clear();let n=this._svg.querySelectorAll("g.sd-el[data-id]"),s=new Map;for(let o of this._json.elements)o!=="push"&&o!=="pop"&&o.id&&s.set(o.id,o);let i="http://www.w3.org/2000/svg";n.forEach(o=>{let a=o.getAttribute("data-id"),l=o.getAttribute("data-type")??"",h=o.getAttribute("data-tooltip")??void 0,c=o.getBBox(),m=document.createElementNS(i,"rect");m.setAttribute("x",String(c.x)),m.setAttribute("y",String(c.y)),m.setAttribute("width",String(c.width)),m.setAttribute("height",String(c.height)),m.setAttribute("fill","transparent"),m.setAttribute("stroke","none"),o.prepend(m);let f=s.get(a)??{type:l,id:a};this._elementMap.set(a,{info:{id:a,type:l,tooltip:h,bbox:{x:c.x,y:c.y,width:c.width,height:c.height},anchors:{},element:o,spec:f},spec:f})})}_initTooltip(){let e=document.createElement("div");e.className="schemdraw-tooltip",e.style.cssText="position:fixed;z-index:99999;pointer-events:none;opacity:0;transition:opacity .15s ease;font-size:12px;line-height:1.4;padding:6px 12px;border-radius:6px;max-width:260px;white-space:pre-wrap;",this._applyTooltipTheme(e),document.body.appendChild(e),this._tooltipEl=e}_applyTooltipTheme(e){document.documentElement.classList.contains("dark")||document.documentElement.getAttribute("data-theme")==="dark"||typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches&&!document.documentElement.classList.contains("light")?(e.style.background="rgba(250,250,250,.95)",e.style.color="#1a1a1a",e.style.boxShadow="0 2px 12px rgba(0,0,0,.4)"):(e.style.background="rgba(15,15,15,.92)",e.style.color="#fff",e.style.boxShadow="0 2px 8px rgba(0,0,0,.2)")}_showTooltip(e,t,n){let s=this._tooltipEl;if(!s)return;this._applyTooltipTheme(s),s.textContent=e,s.style.opacity="1";let i=10,o=window.innerWidth,a=window.innerHeight;s.style.left="0",s.style.top="0";let l=s.getBoundingClientRect(),h=t+i,c=n+i;h+l.width>o&&(h=t-l.width-i),c+l.height>a&&(c=n-l.height-i),s.style.left=`${h}px`,s.style.top=`${c}px`}_hideTooltip(){this._tooltipEl&&(this._tooltipEl.style.opacity="0")}_bindEvents(){this._svg.addEventListener("click",this._boundClick),this._svg.addEventListener("mouseover",this._boundMouseover),this._svg.addEventListener("mouseout",this._boundMouseout),this._svg.addEventListener("mousemove",this._boundMousemove),this._svg.addEventListener("contextmenu",this._boundContextmenu)}_unbindEvents(){this._svg.removeEventListener("click",this._boundClick),this._svg.removeEventListener("mouseover",this._boundMouseover),this._svg.removeEventListener("mouseout",this._boundMouseout),this._svg.removeEventListener("mousemove",this._boundMousemove),this._svg.removeEventListener("contextmenu",this._boundContextmenu)}_closestGroup(e){let t=e.target;return t?t.closest("g.sd-el[data-id]"):null}_svgPoint(e){let t=this._svg.getScreenCTM();if(t){let n=t.inverse();return{x:n.a*e.clientX+n.c*e.clientY+n.e,y:n.b*e.clientX+n.d*e.clientY+n.f,clientX:e.clientX,clientY:e.clientY}}return{x:e.offsetX,y:e.offsetY,clientX:e.clientX,clientY:e.clientY}}_getInfoForGroup(e){let t=e.getAttribute("data-id");if(t)return this._elementMap.get(t)?.info}_onClick(e){let t=this._closestGroup(e);if(t){let n=this._getInfoForGroup(t);if(n){this._emit("element:click",n,e);let s=this._selectedId;this._selectedId=n.id,s&&s!==n.id&&this._clearSelectedClass(s),t.classList.add("sd-selected"),this._emit("element:select",n,e)}}else this._selectedId&&(this._clearSelectedClass(this._selectedId),this._selectedId=null,this._emit("element:select",null,e)),this._emit("canvas:click",this._svgPoint(e),e)}_onMouseover(e){let t=this._closestGroup(e);if(!t)return;let n=e.relatedTarget;if(n&&t.contains(n))return;let s=this._getInfoForGroup(t);s&&(this._emit("element:hover",s,e),s.tooltip&&this._showTooltip(s.tooltip,e.clientX,e.clientY))}_onMousemove(e){let t=this._closestGroup(e);if(t){let n=t.getAttribute("data-tooltip");n&&this._showTooltip(n,e.clientX,e.clientY)}else this._hideTooltip()}_onMouseout(e){let t=this._closestGroup(e);if(!t)return;let n=e.relatedTarget;if(n&&t.contains(n))return;let s=this._getInfoForGroup(t);s&&(this._emit("element:leave",s,e),this._hideTooltip())}_onContextmenu(e){this._emit("canvas:contextmenu",this._svgPoint(e),e)}_clearSelectedClass(e){let t=this._elementMap.get(e);t&&(t.info.element.classList.remove("sd-selected"),t.info.element.style.removeProperty("--sd-highlight"),t.info.element.querySelectorAll(nu).forEach(n=>{let s=n;s.hasAttribute(na)&&$1(s)}))}_emit(e,...t){let n=this._listeners.get(e);if(n)for(let s of n)try{s(...t)}catch{}}on(e,t){return this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t),this}off(e,t){return t?this._listeners.get(e)?.delete(t):this._listeners.delete(e),this}highlight(e,t){let n=this._elementMap.get(e);n&&(n.info.element.classList.add("sd-selected"),t&&(n.info.element.style.setProperty("--sd-highlight",t),n.info.element.querySelectorAll(nu).forEach(s=>{let i=s;B2(i),i.style.setProperty("stroke",t)})))}clearHighlight(){this._svg.querySelectorAll("g.sd-selected").forEach(t=>{t.classList.remove("sd-selected"),t.style.removeProperty("--sd-highlight"),t.querySelectorAll(nu).forEach(n=>{let s=n;s.hasAttribute(na)&&$1(s)})}),this._selectedId=null}setTheme(e){this._teardownAutoTheme(),this._opts={...this._opts,theme:e},this._theme=Zs(e),this.update(this._json),this._initAutoTheme()}update(e){let t=typeof e=="string"?JSON.parse(e):e;this._json=t,this._unbindEvents(),this._render(),this._bindEvents(),this._selectedId=null}destroy(){this._destroyed||(this._destroyed=!0,this._unbindEvents(),this._teardownAutoTheme(),this._tooltipEl&&(this._tooltipEl.remove(),this._tooltipEl=null),this._container.innerHTML="",this._elementMap.clear(),this._listeners.clear())}get svgElement(){return this._svg}getElementInfo(e){return this._elementMap.get(e)?.info}getAllElements(){return[...this._elementMap.values()].map(e=>e.info)}getDrawingInfo(){let e=this._svg.getAttribute("viewBox")??"",t=this._svg.width.baseVal.value||parseFloat(this._svg.getAttribute("width")??"0"),n=this._svg.height.baseVal.value||parseFloat(this._svg.getAttribute("height")??"0");return{width:t,height:n,viewBox:e,theme:this._theme,elementCount:this._json.elements.filter(s=>s!=="push"&&s!=="pop").length,namedElementCount:this._elementMap.size}}};function j1(r,e,t){if(typeof document>"u")throw new Error("mountFromJson requires a browser environment with DOM access.");let n=typeof e=="string"?JSON.parse(e):e;return new La(r,n,t??{})}return td(C2);})();
271
+ `);this.segments.push(new W([De-Z*M*Ze-Z*M/2,L-c],Rt,{fontsize:i,align:["center","top"]}))}}}te+=de,B||(Y+=1)}let ke=l?_:_+b;o?L-=ke:L+=ke}}};var i0=1,lt=.65,sn=.12;function p1(r){let e=r.replace(/\|\|/g,"\u01C1");for(;;){let s=e.replace(/([lcr])([lcr])/g,"$1.$2");if(s===e)break;e=s}!e.startsWith("|")&&!e.startsWith("\u01C1")&&(e="."+e),!e.endsWith("|")&&!e.endsWith("\u01C1")&&(e+=".");let t="",n="";for(let s=0;s<e.length;s++)s%2===0?t+=e[s]:n+=e[s];return{justs:n,bars:t}}var B0=class extends N{constructor(e){super(e);let t=e.table,n=e.fontsize??12,s=e.font??"sans",i=.03,o=.3,a=.4,l=t.trim().split(`
272
+ `),h="";for(let L of l)L.includes("---")?h+="|":L.includes("===")?h+="\u01C1":h+="l";let{justs:c,bars:m}=p1(h),f=L=>L.replace(/^\|?\s*|\s*\|?$/g,""),g=l.filter(L=>!L.includes("---")&&!L.includes("===")),b=f(g[0]).split("|").length,v=e.colfmt;(v==null||v==="")&&(v="c".repeat(b));let{justs:x,bars:S}=p1(v),k=x.length,M=c.length;if(f(g[0]).split("|").length!==k)throw new Error("Number of columns in table does not match colfmt string.");let _=new Array(k).fill(0),B=new Array(M).fill(0);for(let L=0;L<g.length;L++){let I=f(g[L]).split("|").map(X=>X.trim());for(let X=0;X<I.length;X++){let{width:j,height:re}=b0(I[X],n,s);_[X]=Math.max(_[X],j/72*2+a),B[L]=Math.max(B[L],re/72*2+o)}}let $=B.reduce((L,I)=>L+I,0),Y=_.reduce((L,I)=>L+I,0),Z=(L,I)=>L.slice(0,I).reduce((X,j)=>X+j,0);for(let L=0;L<S.length;L++){let I=Z(_,L);S[L]==="|"?this.segments.push(new p([[I,0],[I,-$]],{lw:1})):S[L]==="\u01C1"&&(this.segments.push(new p([[I-i,0],[I-i,-$]],{lw:1})),this.segments.push(new p([[I+i,0],[I+i,-$]],{lw:1})))}for(let L=0;L<m.length;L++){let I=-Z(B,L);m[L]==="|"?this.segments.push(new p([[0,I],[Y,I]],{lw:1})):m[L]==="\u01C1"&&(this.segments.push(new p([[0,I-i],[Y,I-i]],{lw:1})),this.segments.push(new p([[0,I+i],[Y,I+i]],{lw:1})))}for(let L=0;L<g.length;L++){let I=f(g[L]).split("|").map(X=>X.trim());for(let X=0;X<I.length;X++){let j=Z(_,X),re=-Z(B,L)-B[L],te={c:"center",l:"left",r:"right"}[x[X]]??"center";te==="center"?j+=_[X]/2:te==="right"?j+=_[X]-a/2:j+=a/2,this.segments.push(new W([j,re+o/3],I[X],{fontfamily:s,fontsize:n,align:[te,"bottom"]})),this.anchors[`cell${L}_${X}`]=[j,re+B[L]/2]}}}},C0=class extends se{constructor(e={}){super(e),this.segments.push(new p([[-sn*2,0],H,[lt+sn*2,0]])),this.segments.push(new p([[0,i0/2],[lt,0],[0,-i0/2],[0,i0/2]])),this.segments.push(new D([lt+sn,0],sn)),this.segments.push(new D([lt+sn,0],sn)),this.segments.push(new D([-sn,0],sn)),this.anchors.out=[lt+sn*2,0],this.anchors.in1=[0,0]}},I0=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[lt,0]])),this.segments.push(new p([[0,0],[0,-i0/2],[lt,0],[0,i0/2],[0,0]])),this.segments.push(new p([[lt,0],[lt,-i0/2],[0,0],[lt,i0/2],[lt,0]])),this.segments.push(new D([lt/2,.28+.08],.08)),this.segments.push(new p([[lt/2,.28+.16],[lt/2,.7]])),this.segments.push(new p([[lt/2,-.28],[lt/2,-.7]])),this.anchors.out=[lt,0],this.anchors.in1=[0,0],this.anchors.c=[lt/2,-.7],this.anchors.cbar=[lt/2,.7]}},_c=(r=0)=>new p([[r+.07,-.15],[r+.25,-.15],[r+.25,.15],H,[r+.33,.15],[r+.15,.15],[r+.15,-.15]],{lw:1}),L0=class extends Jt{constructor(e={}){super(e),this.segments.push(_c())}},D0=class extends Kt{constructor(e={}){super(e),this.segments.push(_c())}},o0=class extends Bt{constructor(e={}){super(e);let n=T(this.params,"leadin",.35)+lt/2;this.segments.push(_c(n))}};function Yl(r){return new o0({...r,nand:!0})}var F=.25,Ye=.16666666666666666;var Cr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{polar:!1});let t=.18;this.segments.push(new p([[0,0],H,[0,.25],[0,-.25],H,[t,.25],[t,-.25],H,[t,0]])),T(this.params,"polar",!1)&&this.segments.push(new W([-t*1.2,t],"+"))}},Cn=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{polar:!1});let t=.18;this.segments.push(new p([[0,0],H,[0,.25],[0,-.25],H,[t,0]])),this.segments.push(new xe([t*1.5,0],t*1.5,.25*2.5,{theta1:105,theta2:-105})),T(this.params,"polar",!1)&&this.segments.push(new W([-t*1.2,t],"+"))}},In=class extends Cr{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=T(this.params,"arrowwidth",.16),i=T(this.params,"arrowlength",.2),o=T(this.params,"arrow_lw",void 0),a=T(this.params,"arrow_color",void 0);this.segments.push(new p([[-2*t,-n],[3*t,t*2]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Ln=class extends Cr{constructor(e={}){super(e),Object.assign(this.defaults,{trim_lw:void 0,trim_color:void 0});let t=.18,n=Ye,s=.25,i=[-1.8*n,-s],o=[1.8*n+t,s],a=o[0]-i[0],l=o[1]-i[1],h=.14,c=Math.atan2(l,a)+Math.PI/2,m=[o[0]+h*Math.cos(c),o[1]+h*Math.sin(c)],f=[o[0]+h*Math.cos(c-Math.PI),o[1]+h*Math.sin(c-Math.PI)],g=T(this.params,"trim_lw",void 0),b=T(this.params,"trim_color",void 0);this.segments.push(new p([i,o],{lw:g,color:b})),this.segments.push(new p([m,f],{lw:g,color:b}))}};var et=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],H,[t,.25],[t,-.25],H,[t,0]])),this.segments.push(new U([[0,.25],[t,0],[0,-.25]],{closed:!0,fill:!1}))}},Dn=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t-n,.25],[t-n,.25-n]])),this.segments.push(new p([[t,-.25],[t+n,-.25],[t+n,-.25+n]]))}},Nn=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t+n,.25+n]])),this.segments.push(new p([[t,-.25],[t-n,-.25-n]]))}};var On=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t-n,.25]])),this.segments.push(new p([[t,-.25],[t-n,-.25]]))}},Fn=class extends se{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[0,0],H,[2*t,0]])),this.segments.push(new U([[0,.25],[t,0],[0,-.25]],{closed:!0,fill:!1})),this.segments.push(new U([[t,0],[t*2,.25],[t*2,-.25]],{closed:!0,fill:!1})),this.segments.push(new p([[t+n,.25],[t,.25],[t,-.25],[t-n,-.25]]))}},$n=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],[t,0],[t,.25],[t,-.25],H,[t,0]])),this.segments.push(new p([[0,-.25],[0,.25],[t,0]]))}},jn=class extends se{constructor(e={}){super(e);let t=.13,n=.25*1.4;this.segments.push(new p([[0,0],H,[n,.25],[n,-.25],H,[n+t,.25],[n+t,-.25],H,[n+t,0]])),this.segments.push(new U([[0,.25],[n,0],[0,-.25]],{closed:!0,fill:!1}))}},qn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=T(this.params,"arrowwidth",.16),s=T(this.params,"arrowlength",.2),i=T(this.params,"arrow_color",void 0);this.segments.push(new p([[t,t*1.5],[t*2,t*3.25]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[t*.1,t*1.5],[t*1.1,t*3.25]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Hn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=T(this.params,"arrowwidth",.16),s=T(this.params,"arrowlength",.2),i=T(this.params,"arrow_color",void 0),o=T(this.params,"arrow_lw",void 0),a=ze(-1,1),l=a.map(v=>-v*(v-.7)*(v+.7)/2+t*2.5),h=ze(t*.75,t*1.25,a.length),c=20,m=h.map((v,x)=>{let S=A.fromXY([v,l[x]]).rotate(c,[0,0]);return[S.x,S.y]}),f=h.map((v,x)=>{let S=A.fromXY([v-.2,l[x]]).rotate(c,[0,0]);return[S.x,S.y]});this.segments.push(new p(m,{lw:o,color:i})),this.segments.push(new p(f,{lw:o,color:i}));let g=A.fromXY([h[0],l[0]+.1]).rotate(c,[0,0]),b=A.fromXY([h[0]-.2,l[0]+.1]).rotate(c,[0,0]);this.segments.push(new p([[m[1][0],m[1][1]],[g.x,g.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[f[1][0],f[1][1]],[b.x,b.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Yn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=T(this.params,"arrowwidth",.16),s=T(this.params,"arrowlength",.2),i=T(this.params,"arrow_color",void 0),o=T(this.params,"arrow_lw",void 0),a=ze(-1,1),l=a.map(x=>-x*(x-.7)*(x+.7)/2+t*2.5),h=ze(t*.75,t*1.25,a.length),c=20,m=h.map((x,S)=>{let k=A.fromXY([x,l[S]]).rotate(c,[0,0]);return[k.x,k.y]}),f=h.map((x,S)=>{let k=A.fromXY([x-.2,l[S]]).rotate(c,[0,0]);return[k.x,k.y]});this.segments.push(new p(m,{lw:o,color:i})),this.segments.push(new p(f,{lw:o,color:i}));let g=A.fromXY([h[h.length-1],l[l.length-1]-.1]).rotate(c,[0,0]),b=A.fromXY([h[h.length-1]-.2,l[l.length-1]-.1]).rotate(c,[0,0]),v=m.length;this.segments.push(new p([[m[v-2][0],m[v-2][1]],[g.x,g.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[f[v-2][0],f[v-2][1]],[b.x,b.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Xn=class extends et{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[t,0],[t+.3,-.3],[t+.3,-.5]])),this.anchors.gate=[t+.3,-.5]}},on=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],H,[t,.25*1.8],[t,-.25*1.8],H,[0,.25*1.8],[0,-.25*1.8],H,[t,0]])),this.segments.push(new U([[0,-.25-.25],[t,-.25],[0,-.25+.25]],{closed:!0,fill:!1})),this.segments.push(new U([[t,.25+.25],[0,.25],[t,.25-.25]],{closed:!0,fill:!1}))}},Gn=class extends on{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[t,.25],[t+.5,.5]])),this.anchors.gate=[t+.5,.5]}};var Wn=.25;function Vn(r=4,e=[0,0],t=.06,n=.19,s=!0,i=!1,o=!1){let a=Math.acos(t/n),l=ze(a,2*(r+1)*Math.PI-a,r*50),h=l.map(x=>t*x-n*Math.sin(x)),c=l.map(x=>t-n*Math.cos(x)),m=h[0];if(h=h.map(x=>x-m),s){let x=h[h.length-1]-h[0];x!==0&&(h=h.map(S=>S/x))}o&&(c=c.map(x=>-x));let g=Math.max(...c)-Math.min(...c);c=c.map(x=>x*g/.25);let b=h,v=c;return i&&(b=c,v=h),b.map((x,S)=>[x+e[0],v[S]+e[1]])}var Ir=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{core:0});let t=T(this.params,"core",0),n=T(this.params,"core_ls",void 0),s=T(this.params,"core_lw",void 0),i=T(this.params,"core_color",void 0);this.segments.push(new p([[0,0],H,[1,0]]));for(let a=0;a<4;a++)this.segments.push(new xe([(a*2+1)*Wn/2,0],Wn,Wn,{theta1:0,theta2:180}));let o=.12;if(t>0)for(let a=0;a<t;a++){let l=Wn+o*a,h={};n!==void 0&&(h.ls=n),s!==void 0&&(h.lw=s),i!==void 0&&(h.color=i),this.segments.push(new p([[0,l],[1,l]],h))}this.anchors.NE=[1,Wn+o],this.anchors.NW=[0,Wn+o],this.anchors.SE=[1,-Wn],this.anchors.SW=[0,-Wn]}},Lr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{loops:4,core:0});let t=T(this.params,"loops",4),n=T(this.params,"core",0),s=T(this.params,"core_ls",void 0),i=T(this.params,"core_lw",void 0),o=T(this.params,"core_color",void 0);this.segments.push(new p(Vn(t)));let a=.12,l=.5;if(n>0)for(let h=0;h<n;h++){let c=l+a*h,m={};s!==void 0&&(m.ls=s),i!==void 0&&(m.lw=i),o!==void 0&&(m.color=o),this.segments.push(new p([[0,c],[1,c]],m))}this.anchors.NE=[1,l+a],this.anchors.NW=[0,l+a],this.anchors.SE=[1,-l],this.anchors.SW=[0,-l]}};var Un=class extends se{constructor(e={}){super(e);let t=.2,n=.25;this.segments.push(new p([[0,0],H,[0,n],[0,-n],H,[t/2,n],[t/2,-n],[t*1.5,-n],[t*1.5,n],[t/2,n],H,[t*2,n],[t*2,-n],H,[t*2,0]]))}};var dt=class extends se{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[.5*t,n],[1.5*t,-n],[2.5*t,n],[3.5*t,-n],[4.5*t,n],[5.5*t,-n],[6*t,0]]))}};var mt=class extends se{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[0,n],[t*6,n],[t*6,-n],[0,-n],[0,0],H,[t*6,0]]))}},cr=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=T(this.params,"arrowwidth",.16),i=T(this.params,"arrowlength",.2),o=T(this.params,"arrow_lw",void 0),a=T(this.params,"arrow_color",void 0);this.segments.push(new p([[1.5*t,-n*2],[4.5*t,t*3.5]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Zt=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=T(this.params,"arrowwidth",.16),i=T(this.params,"arrowlength",.2),o=T(this.params,"arrow_lw",void 0),a=T(this.params,"arrow_color",void 0);this.segments.push(new p([[1*t,-n*2],[5*t,t*3.5]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Jn=class extends mt{constructor(e={}){super(e),this.segments.push(new p([[0,-.25-.2],[.2,-.25-.2],[1,.25+.2]]))}},ur=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=T(this.params,"arrowwidth",.16),n=T(this.params,"arrowlength",.2),s=T(this.params,"arrow_lw",void 0),i=T(this.params,"arrow_color",void 0);this.segments.push(new p([[.7,.75],[.4,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i})),this.segments.push(new p([[1,.75],[.7,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i}))}},Qt=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=T(this.params,"arrowwidth",.16),n=T(this.params,"arrowlength",.2),s=T(this.params,"arrow_lw",void 0),i=T(this.params,"arrow_color",void 0);this.segments.push(new p([[.7,.75],[.4,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i})),this.segments.push(new p([[1,.75],[.7,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i}))}},Kn=class extends mt{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[-n*1.5,-n],[-n*1.5,-n*2]])),this.segments.push(new p([[t*6,0],[t*6+n*1.5,-n],[t*6+n*1.5,-n*2]])),this.anchors.v1=[-n*1.5,-n*2],this.anchors.v2=[t*6+n*1.5,-n*2]}},mr=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,tap_length:.72});let t=Ye,n=T(this.params,"tap_length",.72),s=T(this.params,"arrowwidth",.15),i=T(this.params,"arrowlength",.25);this.anchors.tap=[t*3,n],this.elmParams.lblloc="bot",this.segments.push(new p([[t*3,n],[t*3,t*1.5]],{arrow:"->",arrowwidth:s,arrowlength:i}))}},er=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,tap_length:.72});let t=Ye,n=T(this.params,"tap_length",.72),s=T(this.params,"arrowwidth",.15),i=T(this.params,"arrowlength",.25);this.anchors.tap=[t*3,n],this.elmParams.lblloc="bot",this.segments.push(new p([[t*3,n],[t*3,t*1.5]],{arrow:"->",arrowwidth:s,arrowlength:i}))}},dr=class extends mt{constructor(e={}){super(e);let t=Ye;this.segments.push(new p([[0,0],[t*6,0]]))}},Dr=class extends mt{constructor(e={}){super(e);let t=Ye,n=.25,s=n*.66;this.segments.push(new p([[s,n],[s,-n]])),this.segments.push(new p([[6*t-s,n],[6*t-s,-n]]))}};var an={Resistor:dt,ResistorVar:cr,Potentiometer:mr,Photoresistor:ur,Fuse:dr},Xl={Resistor:mt,ResistorVar:Zt,Potentiometer:er,Photoresistor:Qt,Fuse:Dr},Zn=dt,Qn=cr,es=mr,ts=ur,rs=dr;function Gl(r){r.Resistor!==void 0&&(Zn=r.Resistor),r.ResistorVar!==void 0&&(Qn=r.ResistorVar),r.Potentiometer!==void 0&&(es=r.Potentiometer),r.Photoresistor!==void 0&&(ts=r.Photoresistor),r.Fuse!==void 0&&(rs=r.Fuse)}function Wl(){Zn=an.Resistor,Qn=an.ResistorVar,es=an.Potentiometer,ts=an.Photoresistor,rs=an.Fuse}var ns=class extends se{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[0,0],[t,0],[t,-t*.75],[t*2,-t*.75],[t*2,t*.75],[t*3,t*.75],[t*3,-t*.75],[t*4,-t*.75],[t*4,0],[t*5,0]])),this.segments.push(new p([[0,t*1.25],[t*5,t*1.25],[t*5,t*-1.25],[0,t*-1.25],[0,t*1.25]])),this.segments.push(new U([[0,t*1.25],[0,-t*1.25],[t/2,-t*1.25],[t/2,t*1.25]],{closed:!0,fill:"black"}))}},ss=class extends se{constructor(e={}){super(e);let t=.2,n=.25;this.segments.push(new p([[0,0],[0,n],[t,n],[t,-n],[t*2,-n],[t*2,n],[t*3,n],[t*3,-n],[t*4,-n],[t*4,n],[t*5,n],[t*5,-n],[t*6,-n],[t*6,0],[t*7,0]]))}},is=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{box:!1});let t=.25;T(this.params,"box",!1)?(this.segments.push(new p([[-t,0],H,[t,0]])),this.segments.push(new p([[-t,t],[t,-t],H,[t,t],[-t,-t]])),this.segments.push(new U([[-t,t],[-t,-t],[t,-t],[t,t]],{closed:!0,fill:!1}))):this.segments.push(new p([[0,0],H,[-t,t],[t,-t],H,[t,t],[-t,-t],H,[0,0]]))}},os=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{dots:!0,dot_r:.12});let t=T(this.params,"dot_r",.12),n=50,s=ze(t*2,1+t,n),o=ze(0,2*Math.PI,n).map(l=>Math.sin(l)*.25),a=s.map((l,h)=>[l,o[h]]);this.segments.push(new p(a)),this.segments.push(new p([[0,0],H,[1+t*3,0]])),T(this.params,"dots",!0)&&(this.segments.push(new D([t,0],t,{zorder:4,fill:"bg"})),this.segments.push(new D([t*2+1,0],t,{zorder:4,fill:"bg"})))}},as=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{dots:!0,dot_r:.12});let t=e.dots,n=T(this.params,"dots",!0),s=t?25:10,i=t?155:170,o=T(this.params,"arc_lw",void 0),a=T(this.params,"arc_color",void 0);if(this.segments.push(new p([[0,0],H,[1,0]])),this.segments.push(new xe([.5,0],1,.65,{theta1:s,theta2:i,lw:o,color:a})),n){let l=T(this.params,"dot_r",.12);this.segments.push(new D([l,0],l,{zorder:4})),this.segments.push(new D([1-l,0],l,{zorder:4}))}}},ls=class extends se{constructor(e={}){super(e);let t=.25,n=.25,s=.25;this.segments.push(new p([[0,0],[-n,0],H,[n,0],[0,-s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,0],H,[n,0],[0,s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,s],H,[0,-s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,-s],H,[0,-s],H,[t,0]]))}},hs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{gap:.08,arrowwidth:.25,arrowlength:.25});let t=T(this.params,"gap",.08),n=T(this.params,"arrowwidth",.25),s=T(this.params,"arrowlength",.25);this.segments.push(new p([[0,0],H,[1,0]])),this.segments.push(new p([[0,0],[.5-t/2,0]],{arrow:"->",arrowwidth:n,arrowlength:s})),this.segments.push(new p([[1,0],[.5+t/2,0]],{arrow:"->",arrowwidth:n,arrowlength:s}))}},Nr=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new xe([.5,0],1,.5,{theta1:0,theta2:360})),this.elmParams.theta=90}},Or=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.25,0],.25)),this.segments.push(new D([1-.25,0],.25)),this.elmParams.theta=90}},Fr=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.3,0],.3,{lw:1e-9,ls:"None"})),this.segments.push(new D([1-.3,0],.3,{lw:1e-9,ls:"None"})),this.segments.push(new D([.3,0],.3,{fill:!1})),this.segments.push(new D([1-.3,0],.3,{fill:!1})),this.elmParams.theta=90,this.anchors.common=[.5,Math.sqrt(.3**2-.2**2)]}},$r=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new xe([.7,0],.6,.3,{theta1:0,theta2:360})),this.segments.push(new xe([.3,0],.6,.3,{theta1:0,theta2:360})),this.elmParams.theta=90,this.anchors.common=[.5,Math.sqrt(1-.2**2/.3**2)*.15]}};var wt=2.5,jt=wt*Math.sqrt(3)/2,N0=jt/8,O0=.2,cs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{sign:!0,leads:!1});let t=T(this.params,"leads",!1),n=T(this.params,"sign",!0),s=wt/4,i=t?s:0;this.segments.push(new p([[i,0],[i,wt/2],[i+jt,0],[i,-wt/2],[i,0],H,[i+jt,0]])),n&&(this.segments.push(new p([[i+N0-O0/2,wt/4],[i+N0+O0/2,wt/4]])),this.segments.push(new p([[i+N0-O0/2,-wt/4],[i+N0+O0/2,-wt/4]])),this.segments.push(new p([[i+N0,-wt/4-O0/2],[i+N0,-wt/4+O0/2]]))),t&&(this.segments.push(new p([[0,wt/4],[s,wt/4]])),this.segments.push(new p([[0,-wt/4],[s,-wt/4]])),this.segments.push(new p([[s+jt,0],[jt+2*s,0]])));let o=jt+2*i;this.anchors.out=[o,0],this.anchors.in1=[0,wt/4],this.anchors.in2=[0,-wt/4],this.anchors.center=[i+jt/2,0],this.anchors.vd=[i+jt/3,.84],this.anchors.vs=[i+jt/3,-.84],this.anchors.n1=[i+jt*2/3,-.42],this.anchors.n2=[i+jt*2/3,.42],this.anchors.n1a=[i+jt*.9,-.13],this.anchors.n2a=[i+jt*.9,.13],this.elmParams.drop=[o,0],Object.assign(this._labelhints,{in1:{ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:9},in2:{ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:9},out:{ofst:[0,.1],halign:"left",valign:"bottom",fontsize:9},vd:{ofst:[-.1,.25],halign:"right",valign:"bottom",fontsize:9},vs:{ofst:[-.1,-.25],halign:"right",valign:"top",fontsize:9},n1:{ofst:[-.1,-.25],halign:"right",valign:"top",fontsize:9},n1a:{ofst:[-.1,-.3],halign:"right",valign:"top",fontsize:9},n2:{ofst:[-.1,.25],halign:"right",valign:"bottom",fontsize:9},n2a:{ofst:[-.1,.3],halign:"right",valign:"bottom",fontsize:9}})}};var C=Ye*.5;function g1(r,e,t,n,s){r.push(new p([[-3*C,-6.5*C],[-3*C,-7.5*C]])),r.push(new p([[-3*C,-9.5*C],[-3*C,-10.5*C]])),r.push(new p([[-3*C,-12.5*C],[-3*C,-13.5*C]])),r.push(new p([[0,-7*C],[0,0]])),r.push(new p([[-3*C,-7*C],[0,-7*C]])),r.push(new p([[0,-20*C],[0,-13*C]])),r.push(new p([[-3*C,-13*C],[0,-13*C]]));let i={};return e==="nmos"?(r.push(new p([[-10*C,-14*C],[-5*C,-14*C]])),r.push(new p([[-5*C,-14*C],[-5*C,-6*C]])),r.push(new p([[-3*C,-10*C],[0,-10*C]],{arrow:"<-",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[0,-10*C],[0,-13*C]])),i.drain=[0,0],i.gate=[-10*C,-14*C],i.center=[0,-10*C],i.source=[0,-20*C]):(r.push(new p([[-10*C,-6*C],[-5*C,-6*C]])),r.push(new p([[-5*C,-6*C],[-5*C,-14*C]])),r.push(new p([[-3*C,-10*C],[0,-10*C]],{arrow:"->",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[0,-10*C],[0,-7*C]])),i.source=[0,0],i.gate=[-10*C,-6*C],i.center=[0,-10*C],i.drain=[0,-20*C]),t&&(r.push(new p([[0,-7*C],[3*C,-7*C]])),r.push(new p([[3*C,-7*C],[3*C,-9*C]])),r.push(new p([[2*C,-9*C],[4*C,-9*C]])),r.push(new U([[3*C,-9*C],[2*C,-11*C],[4*C,-11*C]],{closed:!0,fill:!1})),r.push(new p([[3*C,-11*C],[3*C,-13*C]])),r.push(new p([[3*C,-13*C],[0,-13*C]]))),n&&r.push(new D([-1*C,-10*C],7*C,{lw:s})),i}var ms=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=g1(this.segments,"nmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[0,-20*C],this.elmParams.lblloc="rgt"}},ds=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=g1(this.segments,"pmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[0,-20*C],this.elmParams.lblloc="rgt"}};function b1(r,e,t,n,s){r.push(new p([[0,0],[7*C,0],[7*C,-3*C],H,[13*C,-3*C],[13*C,0],[20*C,0]])),r.push(new p([[6.5*C,-3*C],[7.5*C,-3*C]])),r.push(new p([[9.5*C,-3*C],[10.5*C,-3*C]])),r.push(new p([[12.5*C,-3*C],[13.5*C,-3*C]]));let i={};return e==="nmos"?(r.push(new p([[14*C,-10*C],[14*C,-5*C]])),r.push(new p([[14*C,-5*C],[6*C,-5*C]])),r.push(new p([[10*C,-3*C],[10*C,0]],{arrow:"<-",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[10*C,0],[13*C,0]])),i.drain=[0,0],i.gate=[14*C,-10*C],i.source=[20*C,0]):(r.push(new p([[6*C,-10*C],[6*C,-5*C]])),r.push(new p([[6*C,-5*C],[14*C,-5*C]])),r.push(new p([[10*C,-3*C],[10*C,0]],{arrow:"->",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[10*C,0],[7*C,0]])),i.source=[0,0],i.gate=[6*C,-10*C],i.drain=[20*C,0]),i.center=[10*C,0],t&&(r.push(new p([[7*C,0],[7*C,3*C]])),r.push(new p([[7*C,3*C],[9*C,3*C]])),r.push(new p([[9*C,2*C],[9*C,4*C]])),r.push(new U([[9*C,3*C],[11*C,2*C],[11*C,4*C]],{closed:!0,fill:!1})),r.push(new p([[11*C,3*C],[13*C,3*C]])),r.push(new p([[13*C,3*C],[13*C,0]]))),n&&r.push(new D([10*C,-1*C],7*C,{lw:s})),i}var ps=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=b1(this.segments,"nmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[20*C,0],this.elmParams.lblloc="bottom"}},fs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=T(this.params,"diode",!1),n=T(this.params,"circle",!1),s=T(this.params,"circle_lw",void 0),i=b1(this.segments,"pmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[20*C,0],this.elmParams.lblloc="bottom"}},q=Ye*4,m2=Ye*5,O=m2/2,tt=Ye,Xe=Ye*.7,gs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[q,-O],[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q+tt,-O],[q+tt,-O-q]])),this.segments.push(new p([[q+tt,-O-q/2],[q+tt+O+Xe,-O-q/2]])),this.anchors.source=[0,-2*O-q],this.anchors.drain=[0,0],this.anchors.gate=[q+tt+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft",T(this.params,"bulk",!1)&&(this.segments.push(new p([[0,-O-q/2],[q,-O-q/2]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[0,-O-q/2])}},bs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[q,-O],[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q+tt,-O],[q+tt,-O-q]])),this.segments.push(new p([[q+tt+Xe*2,-O-q/2],[q+tt+O+Xe,-O-q/2]])),this.segments.push(new D([q+tt+Xe,-O-q/2],Xe)),this.anchors.source=[0,0],this.anchors.drain=[0,-2*O-q],this.anchors.gate=[q+tt+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft",T(this.params,"bulk",!1)&&(this.segments.push(new p([[0,-O-q/2],[q,-O-q/2]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[0,-O-q/2])}},ws=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,q],[O+q,q],[O+q,0],[2*O+q,0]])),this.segments.push(new p([[O,q+tt],[O+q,q+tt]])),this.segments.push(new p([[O+q/2,q+tt],[O+q/2,q+tt+Xe+O]])),this.anchors.isource=[2*O+q,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+q/2,q+tt+Xe+O],this.elmParams.lblloc="bottom",T(this.params,"bulk",!1)&&(this.segments.push(new p([[O+q/2,0],[O+q/2,q]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[O+q/2,0])}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},xs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,q],[O+q,q],[O+q,0],[2*O+q,0]])),this.segments.push(new p([[O,q+tt],[O+q,q+tt]])),this.segments.push(new D([O+q/2,q+tt+Xe],Xe)),this.segments.push(new p([[O+q/2,q+tt+Xe*2],[O+q/2,q+tt+Xe+O]])),this.anchors.isource=[2*O+q,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+q/2,q+tt+Xe+O],this.elmParams.lblloc="bottom",T(this.params,"bulk",!1)&&(this.segments.push(new p([[O+q/2,0],[O+q/2,q]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.bulk=[O+q/2,0])}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},Re=Ye*2.5,me=Re*2,ne=me*.5,Ve=Re*.2,yt=me*.1,Vl=yt*.75,us=.25,F0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=T(this.params,"bulk",!1),n=T(this.params,"offset_gate",!0),i=T(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Re,-ne],[Re,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new p([[Re,-ne-me],[0,-ne-me]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Re+Ve,-ne-me+yt],[Re+Ve+ne,-ne-me+yt]])),this.anchors.gate=[Re+Ve+ne,-ne-me+yt]):(this.segments.push(new p([[Re+Ve,-ne-me/2],[Re+Ve+ne,-ne-me/2]])),this.anchors.gate=[Re+Ve+ne,-ne-me/2]),this.anchors.source=[0,-2*ne-me],this.anchors.drain=[0,0],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[0,-ne-me/2],[Re,-ne-me/2]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.anchors.bulk=[0,-ne-me/2])}},$0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=T(this.params,"bulk",!1),n=T(this.params,"offset_gate",!0),i=T(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Re,-ne],[Re,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new p([[0,-ne],[Re,-ne]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve+ne,-ne-yt]])),this.anchors.gate=[Re+Ve+ne,-ne-yt]):(this.segments.push(new p([[Re+Ve,-ne-me/2],[Re+Ve+ne,-ne-me/2]])),this.anchors.gate=[Re+Ve+ne,-ne-me/2]),this.anchors.source=[0,0],this.anchors.drain=[0,-2*ne-me],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[Re,-ne-me/2],[0,-ne-me/2]],{arrow:"->",arrowwidth:us,arrowlength:us})),this.anchors.bulk=[0,-ne-me/2])}},j0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=T(this.params,"bulk",!1),n=T(this.params,"offset_gate",!0),i=T(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Re,-ne],[Re,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new D([Vl*2,-ne-me],Vl,{fill:!0})),this.segments.push(new p([[Re+Ve,-ne-yt],[Re+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Re+Ve,-ne-me+yt],[Re+Ve+ne,-ne-me+yt]])),this.anchors.gate=[Re+Ve+ne,-ne-me+yt]):(this.segments.push(new p([[Re+Ve,-ne-me/2],[Re+Ve+ne,-ne-me/2]])),this.anchors.gate=[Re+Ve+ne,-ne-me/2]),this.anchors.source=[0,-2*ne-me],this.anchors.drain=[0,0],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[0,-ne-me/2],[Re,-ne-me/2]])),this.segments.push(new D([Re-Vl*2,-ne-me/2],Vl,{fill:!0})),this.anchors.bulk=[0,-ne-me/2])}},Jl=q*.2,ue=Ye*3,vs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[ue,-O],[ue,-O+Jl],[ue,-O-ue-Jl],[ue,-O-ue],[0,-O-ue],[0,-2*O-ue]])),this.segments.push(new p([[ue,-O-ue],[ue+O,-O-ue]])),this.elmParams.drop=[ue+O,-O-ue],this.anchors.source=[0,-2*O-ue],this.anchors.drain=[0,0],this.anchors.gate=[ue+O,-O-ue],this.anchors.center=[0,-O-ue/2],this.elmParams.lblloc="lft",T(this.params,"circle",!1)&&this.segments.push(new D([ue/2,-q],q*1.1,{lw:T(this.params,"circle_lw",void 0)}))}},q0=class extends vs{constructor(e={}){super(e),this.segments.push(new p([[ue+.1,-O-ue],[ue+.3,-O-ue]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},H0=class extends vs{constructor(e={}){super(e),this.segments.push(new p([[ue+.25,-O-ue],[ue,-O-ue]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},ys=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,ue],[O+ue,ue],[O+ue,0],[2*O+ue,0]])),this.segments.push(new p([[O-Jl,ue],[O+ue+Jl,ue]])),this.segments.push(new p([[O+ue,ue],[O+ue,ue+O]])),this.anchors.isource=[2*O+ue,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+ue,ue+O],this.elmParams.lblloc="bottom",T(this.params,"circle",!1)&&this.segments.push(new D([O+ue/2,ue/2],q*1.1,{lw:T(this.params,"circle_lw",void 0)}))}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},Y0=class extends ys{constructor(e={}){super(e),this.segments.push(new p([[O+ue,ue],[O+ue,ue+.3]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},X0=class extends ys{constructor(e={}){super(e),this.segments.push(new p([[O+ue,ue+.3],[O+ue,ue]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},Ma=(q+2*Xe)/5,G0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{split:!0,arrow:!0,arrowlength:.25,arrowwidth:.2});let t=T(this.params,"split",!0),n=this.params.arrow,s=T(this.params,"arrowwidth",.2),i=T(this.params,"arrowlength",.25);t?this.segments.push(new p([[0,0],[0,-O],[q,-O],H,[q,-O+Xe],[q,-O+Xe-Ma],H,[q,-O+Xe-2*Ma],[q,-O+Xe-3*Ma],H,[q,-O+Xe-4*Ma],[q,-O+Xe-5*Ma],H,[q,-O-q],[0,-O-q],[0,-2*O-q]])):this.segments.push(new p([[0,0],[0,-O],[q,-O],H,[q,-O+Xe],[q,-O-q-Xe],H,[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q,-O-q/2],[q+O+Xe,-O-q/2]])),n===">"?this.segments.push(new p([[0,-O-q],[q,-O-q]],{arrow:"->",arrowwidth:s,arrowlength:i})):n!==!1&&this.segments.push(new p([[0,-O-q],[q,-O-q]],{arrow:"<-",arrowwidth:s,arrowlength:i})),this.anchors.drain=[0,-2*O-q],this.anchors.source=[0,0],this.anchors.gate=[q+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft"}},za=Ye*3.3,pe=za*2/3,ht=za*(4/3),tr=ht/4,It=pe+za*.7,qt=ht*.7,qr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowwidth:.2,arrowlength:.25}),this.segments.push(new p([[0,0],[pe,0]])),this.segments.push(new p([[pe,ht/2],[pe,-ht/2]])),this.segments.push(new p([[pe,tr],[It,qt],[It,qt+tr]])),this.segments.push(new p([[pe,-tr],[It,-qt],[It,-qt-tr]])),T(this.params,"circle",!1)&&this.segments.push(new D([za,0],za,{lw:T(this.params,"circle_lw",void 0)})),this.elmParams.drop=[It,qt+tr],this.anchors.base=[0,0],this.anchors.collector=[It,qt+tr],this.anchors.emitter=[It,-qt-tr],this.anchors.center=[It,0]}},Ht=class extends qr{constructor(e={}){super(e),this.segments.push(new p([[pe,-tr],[It,-qt]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},rr=class extends qr{constructor(e={}){super(e),this.segments.push(new p([[It,qt],[pe,tr]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.anchors.base=[0,0],this.anchors.collector=[It,-qt-tr],this.anchors.emitter=[It,qt+tr]}},f1=.55,Ea=.2,Ul=.75,jr=.42,Ct=1.1,Hr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,lblloc:"bottom",theta:90,arrowwidth:.2,arrowlength:.25}),this.segments.push(new p([[0,0],[Ct/2-Ea,jr],[Ct/2+Ea,jr],[Ct,0]])),this.segments.push(new p([[Ct/2-Ul/2,jr],[Ct/2+Ul/2,jr]])),this.segments.push(new p([[Ct/2,jr],[Ct/2,jr+Ul/2]])),T(this.params,"circle",!1)&&this.segments.push(new D([Ct/2,f1/2],f1,{lw:T(this.params,"circle_lw",void 0)})),this.anchors.base=[Ct/2,jr+Ul/2],this.anchors.icollector=[Ct,0],this.anchors.iemitter=[0,0]}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.emitter=this.anchors.start,this.anchors.collector=this.anchors.end,T(this.params,"reverse",!1)&&(this.anchors.emitter=this.anchors.end,this.anchors.collector=this.anchors.start)}},Ss=class extends Hr{constructor(e={}){super(e),this.segments.push(new p([[0,0],[Ct/2-Ea,jr]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},ln=class extends Hr{constructor(e={}){super(e),this.segments.push(new p([[Ct/2+Ea,jr],[Ct,0]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}));let t=this.anchors.icollector,n=this.anchors.iemitter;this.anchors.icollector=n,this.anchors.iemitter=t}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.emitter=this.anchors.end,this.anchors.collector=this.anchors.start,T(this.params,"reverse",!1)&&(this.anchors.emitter=this.anchors.start,this.anchors.collector=this.anchors.end)}},W0=class extends rr{constructor(e={}){super(e);let t=-.25;this.segments.push(new p([[pe,-tr-t],[It,-qt-t]])),this.anchors.C2=[It,-qt-t]}},xt=.1,V0=class extends Ht{constructor(e={}){super(e),this.segments.push(new p([[pe,ht/2],[pe,ht/2+xt],[pe+xt,ht/2+xt],[pe+xt,ht/2]])),this.segments.push(new p([[pe,-ht/2],[pe,-ht/2-xt],[pe-xt,-ht/2-xt],[pe-xt,-ht/2]]))}},U0=class extends rr{constructor(e={}){super(e),this.segments.push(new p([[pe,ht/2],[pe,ht/2+xt],[pe-xt,ht/2+xt],[pe-xt,ht/2]])),this.segments.push(new p([[pe,-ht/2],[pe,-ht/2-xt],[pe+xt,-ht/2-xt],[pe+xt,-ht/2]]))}},J0=class extends Ht{constructor(e={}){super(e),this.segments.shift();let t=.25;this.segments.push(new p([[-.1,pe],[pe*.75,.1]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.segments.push(new p([[-.1,pe-t],[pe*.75,.1-t]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},K0=class extends rr{constructor(e={}){super(e),this.segments.shift();let t=.25;this.segments.push(new p([[-.1,pe],[pe*.75,.1]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)})),this.segments.push(new p([[-.1,pe-t],[pe*.75,.1-t]],{arrow:"->",arrowwidth:T(this.params,"arrowwidth",.2),arrowlength:T(this.params,"arrowlength",.25)}))}},vt=.15,Z0=class extends Ht{constructor(e={}){super(e),this.segments.shift(),this.segments.push(new p([[pe-vt,pe-vt/2],[pe-vt,-pe+vt/2],[pe-vt*2,-pe+vt/2]])),this.anchors.base=[pe-vt*2,-pe+vt/2]}},Q0=class extends rr{constructor(e={}){super(e),this.segments.shift(),this.segments.push(new p([[pe-vt*2,pe-vt/2],[pe-vt,pe-vt/2],[pe-vt,-pe+vt/2]])),this.anchors.base=[pe-vt*2,pe-vt/2]}},ei=class extends ln{constructor(e={}){super(e);let t=.25;this.segments.push(new p([[t,0],[t+Ct/2-Ea,jr]])),this.anchors.C2=[t,0]}};function Bc(r){let e=r[0].toUpperCase();return e==="L"||e==="R"||e==="T"||e==="B"?e:"L"}var Kl=class{constructor(e={}){z(this,"name");z(this,"pin");z(this,"side");z(this,"pos");z(this,"slot");z(this,"invert",!1);z(this,"invertradius",.15);z(this,"color");z(this,"rotation",0);z(this,"anchorname");z(this,"lblsize");z(this,"pinlblsize");z(this,"href");z(this,"decoration");this.side=e.side!==void 0?Bc(String(e.side)):"L",e.name!==void 0&&(this.name=e.name),e.pin!==void 0&&(this.pin=e.pin),e.pos!==void 0&&(this.pos=e.pos),e.slot!==void 0&&(this.slot=e.slot),e.invert!==void 0&&(this.invert=e.invert),e.invertradius!==void 0&&(this.invertradius=e.invertradius),e.color!==void 0&&(this.color=e.color),e.rotation!==void 0&&(this.rotation=e.rotation),e.anchorname!==void 0&&(this.anchorname=e.anchorname),e.lblsize!==void 0&&(this.lblsize=e.lblsize),e.pinlblsize!==void 0&&(this.pinlblsize=e.pinlblsize),e.href!==void 0&&(this.href=e.href),e.decoration!==void 0&&(this.decoration=e.decoration)}};function d2(r,e){let t=Math.max(.15,r.length*e/72),n=e/72*1.2;return[t*2,n*2]}function w1(r){return{...r}}var nr=class extends N{constructor(t={}){let{size:n,pins:s,slant:i,label:o,...a}=t;super({...a,...o!==void 0?{label:o}:{}});z(this,"size");z(this,"slant");z(this,"pins");z(this,"usersides");z(this,"sides");z(this,"pincount",{L:0,R:0,T:0,B:0});z(this,"_sizeauto");z(this,"_icbox");z(this,"_dflt");if(Object.assign(this.defaults,{pinspacing:0,edgepadH:.5,edgepadW:.5,leadlen:.5,lsize:14,lofst:.15,plblofst:.075,plblsize:11}),this.slant=i??0,this.pins={L:[],R:[],T:[],B:[]},this.usersides={},this.sides={L:this.mkSide(),R:this.mkSide(),T:this.mkSide(),B:this.mkSide()},this._dflt=this.mkSide(),this.size=n??this.params.size,s)for(let l of s)this.pins[l.side].push({...l,side:l.side});this._setsize()}mkSide(){return{spacing:T(this.params,"pinspacing",0),pad:T(this.params,"edgepadH",.25),leadlen:T(this.params,"leadlen",.5),label_ofst:T(this.params,"lofst",.15),label_size:T(this.params,"lsize",14),pinlabel_ofst:T(this.params,"plblofst",.05),pinlabel_size:T(this.params,"plblsize",11)}}pin(t){let n=Bc(t.side??"L"),s={side:n,name:t.name,pin:t.pin,pos:t.pos,slot:t.slot,invert:t.invert??!1,invertradius:t.invertradius??.15,color:t.color,rotation:t.rotation??0,anchorname:t.anchorname,lblsize:t.lblsize,pinlblsize:t.pinlblsize,href:t.href,decoration:t.decoration};return this.pins[n].push(s),this._setsize(),this}side(t,n=0,s=.5,i=.5,o=.15,a=14,l=.05,h=11){let c=Bc(t);return this.usersides[c]={spacing:n,pad:s,leadlen:i,label_ofst:o,label_size:a,pinlabel_ofst:l,pinlabel_size:h},this._setsize(),this}get pinnames(){let t=[];for(let n of["L","R","T","B"])for(let s of this.pins[n])s.name&&t.push(s.anchorname??s.name);return t}getAnchorNamesForGetattr(){let t=new Set(super.getAnchorNamesForGetattr());for(let n of["L","R","T","B"])for(let s of this.pins[n])s.name&&t.add(s.anchorname??s.name),s.pin&&t.add(`pin${s.pin}`);return[...t]}getPinAnchor(t){return this.resolveAnchor(t)}_countpins(){let t={L:0,R:0,T:0,B:0};for(let n of["L","R","T","B"]){let i=this.pins[n].map(o=>o.slot).filter(o=>o!=null).map(o=>Number(o.split("/")[1])).concat([0]);t[n]=Math.max(this.pins[n].length,Math.max(...i))}return t}_autosize(){let t={},n={};for(let a of["L","R","T","B"]){let l=w1(this.usersides[a]??this._dflt);l.spacing===0&&(l={...l,spacing:.6}),this.sides[a]=l;let h=Math.max(1,this.pincount[a]);t[a]=l.pad*2+l.spacing*(h-1);let c=0;for(let m of this.pins[a])if(m.name){let f=m.lblsize??T(this.params,"lsize",14);c=Math.max(c,d2(m.name,f)[0])}n[a]=c}let s=n.L+n.R+4*T(this.params,"lofst",.15),i=Math.max(t.L??0,t.R??0,2+T(this.params,"edgepadH",.5)),o=Math.max(t.T??0,t.B??0,2+T(this.params,"edgepadW",.5),s);this._sizeauto=[o,i];for(let a of["L","R"]){let l=this.sides[a],h=Math.max(1,this.pincount[a]);l.pad=(i-l.spacing*(h-1))/2}for(let a of["T","B"]){let l=this.sides[a],h=Math.max(1,this.pincount[a]);l.pad=(o-l.spacing*(h-1))/2}}_autopinlayout(){let t=this.size;for(let n of["L","R","T","B"]){let s=w1(this.usersides[n]??this._dflt);this.sides[n]=s;let i=["T","B"].includes(n)?t[0]:t[1],o=s.pad;s.spacing===0?this.pincount[n]>1?s.spacing=(i-2*o)/(this.pincount[n]-1):s.pad=i/2:s.pad=(i-s.spacing*(this.pincount[n]-1))/2}}_setsize(){this.pincount=this._countpins(),this.size===void 0?this._autosize():this._autopinlayout()}_drawBox(){let t,n;this.size?[t,n]=this.size:this._sizeauto?[t,n]=this._sizeauto:(t=2,n=3);let s=t*Math.tan(this.slant*Math.PI/180),i=0,o=n,a;return this.slant>0?(i=0-s,o=n+s,a=[new A(0,0),new A(t,i),new A(t,o),new A(0,n),new A(0,0)]):this.slant<0?(i=0+s,o=n-s,a=[new A(0,i),new A(t,0),new A(t,n),new A(0,o),new A(0,i)]):(i=0,o=n,a=[new A(0,0),new A(t,0),new A(t,n),new A(0,n),new A(0,0)]),this.segments.push(new p(a.map(l=>[l.x,l.y]),{})),{w:t,h:n,y1:i,y2:o}}_pinpos(t,n,s){let i=this.sides[t]??this._dflt,o=i.spacing>0?i.spacing:.6,a=s;n.slot&&(a=Number(n.slot.split("/")[0])-1);let l=i.pad+a*o;n.pos!==void 0&&n.pos!==null&&(l=i.pad+n.pos*(this.pincount[t]-1)*o);let h;return t==="L"?h=new A(0,l):t==="R"?h=new A(this._icbox.w,l):t==="T"?h=new A(l,this._icbox.h):h=new A(l,0),t==="T"&&this.slant>0?h=new A(h.x,h.y-h.x*Math.tan(-this.slant*Math.PI/180)):t==="T"&&this.slant<0?h=new A(h.x,h.y+(this._icbox.y2-this._icbox.h)-h.x*Math.tan(-this.slant*Math.PI/180)):t==="B"&&this.slant<0?h=new A(h.x,h.y-(this._icbox.y2-this._icbox.h)-h.x*Math.tan(this.slant*Math.PI/180)):t==="B"&&this.slant>0&&(h=new A(h.x,h.y-h.x*Math.tan(this.slant*Math.PI/180))),h}_drawClkpin(t,n,s){let i=this.sides[s]??this._dflt,o=.4*(i.label_size/16),a=.2*(i.label_size/16),l;if(s==="T"||s==="B"){let h=n.y!==0?Math.sign(n.y):1,c=Math.abs(o)*h;l=[new A(t.x-a,t.y),new A(t.x,t.y-c),new A(t.x+a,t.y)]}else{let h=n.x!==0?-Math.sign(n.x):1,c=Math.abs(o)*h;l=[new A(t.x,t.y+a),new A(t.x+c,t.y),new A(t.x,t.y-a)]}this.segments.push(new p(l.map(h=>[h.x,h.y])))}_drawPin(t,n,s){let i=this.sides[t]??this._dflt,o=this._pinpos(t,n,s),l={L:new A(-i.leadlen,0),R:new A(i.leadlen,0),T:new A(0,i.leadlen),B:new A(0,-i.leadlen)}[t],h=o.add(l);if(this.anchors[`in${t}${s+1}`]=[h.x,h.y],n.anchorname?this.anchors[n.anchorname]=[h.x,h.y]:n.name&&(n.name===">"&&(this.anchors.CLK=[h.x,h.y]),this.anchors[n.name]=[h.x,h.y]),n.pin&&(this.anchors[`pin${n.pin}`]=[h.x,h.y]),i.leadlen>0)if(n.invert){let c=n.invertradius??.15,f={L:new A(-c,0),R:new A(c,0),T:new A(0,c),B:new A(0,-c)}[t],g=o.add(f);this.segments.push(new D([g.x,g.y],c));let b=g.add(f.mul(2));this.segments.push(new p([[b.x,b.y],[h.x,h.y]],{}))}else this.segments.push(new p([[o.x,o.y],[h.x,h.y]],{}));if(n.pin){let c=(n.invert?n.invertradius??.15:0)*(n.invert?1:0),m=i.pinlabel_ofst,g={L:new A(-m-c*2,m),R:new A(m+c*2,m),T:new A(m,m+c*2),B:new A(m,-m-c*2)}[t],b=this.userParams.flip===!0,v=this.userParams.reverse===!0,x={L:"right",R:"left",T:"left",B:"left"},S={L:"bottom",R:"bottom",T:"bottom",B:"top"},k=x[t],M=S[t];b&&(t==="L"||t==="R")&&(g=g.flip()),b&&(t==="T"||t==="B")&&(M=t==="T"?"top":"bottom"),v&&(t==="L"||t==="R")&&(k=t==="L"?"left":"right"),v&&(t==="T"||t==="B")&&(g=g.mirrorx(0));let _=o.add(g);this.segments.push(new W([_.x,_.y],String(n.pin),{fontsize:n.pinlblsize??i.pinlabel_size,align:[k,M]}))}if(n.name===">"){this._drawClkpin(o,l,t);return}if(n.name&&n.name!==""){let c={L:new A(i.label_ofst,0),R:new A(-i.label_ofst,0),T:new A(0,-i.label_ofst),B:new A(0,i.label_ofst)},m=o.add(c[t]),f=this.userParams.flip===!0,g=this.userParams.reverse===!0,b={L:"left",R:"right",T:"center",B:"center"},v={L:"center",R:"center",T:"top",B:"bottom"},x=b[t],S=v[t];f&&(t==="T"||t==="B")&&(S=t==="T"?"bottom":"top"),g&&(t==="L"||t==="R")&&(x=t==="L"?"right":"left"),this.segments.push(new W([m.x,m.y],n.name,{fontsize:n.lblsize??i.label_size,color:n.color??void 0,align:[x,S],href:n.href??void 0,decoration:n.decoration??void 0,rotation:n.rotation??0}))}}_drawPins(){for(let t of["L","R","T","B"])this.pins[t].forEach((n,s)=>this._drawPin(t,n,s))}_place(t,n,s){return this.anchors={},this._setsize(),this._icbox=this._drawBox(),this._drawPins(),this.elmParams.lblloc="center",this.anchors.center=[this._icbox.w/2,this._icbox.h/2],this.elmParams.drop=[this._icbox.w,this._icbox.h/2],super._place(t,n,s)}},ti=class extends nr{constructor(e={}){let{demux:t=!1,...n}=e,s=e.slant!==void 0?e.slant:25;super({...n,slant:t?s:-s})}},ri=class extends nr{constructor(e={}){let{preclr:t=!1,preclrinvert:n=!0,...s}=e,i=[{name:"D",side:"L",slot:"2/2"},{name:">",side:"L",slot:"1/2"},{name:"Q",side:"R",slot:"2/2"},{name:"Q",side:"R",slot:"1/2",anchorname:"Qbar",decoration:"overline"}];t&&(i.push({name:"PRE",side:"T",invert:n}),i.push({name:"CLR",side:"B",invert:n})),super({...s,pins:i,size:s.size??[2,3]})}},ni=class extends nr{constructor(e={}){let{preclr:t=!1,preclrinvert:n=!0,...s}=e,i=[{name:"J",side:"L",slot:"3/3"},{name:">",side:"L",slot:"2/3"},{name:"K",side:"L",slot:"1/3"},{name:"Q",side:"R",slot:"3/3"},{name:"Q",side:"R",slot:"1/3",anchorname:"Qbar",decoration:"overline"}];t&&(i.push({name:"PRE",side:"T",invert:n}),i.push({name:"CLR",side:"B",invert:n})),super({...s,pins:i,size:s.size??[2,3]})}},si=class extends nr{constructor(e={}){let t=[{name:"in",side:"L",slot:"3/3"},{name:"out",side:"R",slot:"3/3"},{name:"gnd",side:"B"}];super({...e,pins:t,size:e.size??[2,1.5]})}},ii=class extends nr{constructor(e={}){let t=[{name:"TRG",side:"L",pin:"2"},{name:"THR",side:"L",pin:"6"},{name:"DIS",side:"L",pin:"7"},{name:"CTL",side:"R",pin:"5"},{name:"OUT",side:"R",pin:"3"},{name:"RST",side:"T",pin:"4"},{name:"Vcc",side:"T",pin:"8"},{name:"GND",side:"B",pin:"1"}];super({...e,edgepadW:.5,edgepadH:1,pinspacing:1.5,leadlen:1,pins:t,label:"555"})}};function Cc(r){let e=r.bottom??0,t=r.left??0,n=r.seglen??1.5,s=r.segw??.3,i=r.spacing??.12,o=r.digit??8,a=r.segcolor??"red",l=r.tilt??10,h=r.labelsegments??!0,c=s/2,m=s/5,f=i/2,g=l*Math.PI/180,b=Math.sin(g),v=[f,f+c,n-f-c,n-f,n-f-c,f+c],x=[0,c,c,0,-c,-c],S=[...v],k=[...v],M=x.map(Te=>Te+n*2),_=x.map(Te=>Te+n),B=[0,c,c,0,-c,-c],$=[f,f+c,n-f-c,n-f,n-f-c,f+c],Y=[...B],Z=$.map(Te=>Te+n),L=B.map(Te=>Te+n),I=[...Z],X=[...L],j=[...$],re=[n/2+f,n*2+c+m],te=[n/2+f,n+c+m],ke=[n/2+f,c+m],he=[n+c+f,n*1.5],ve=[n+c+f,n*.5],de=[-c-f,n*.5],Fe=[-c-f,n*1.5],qe=Te=>[Te[0]+Te[1]*b,Te[1]],Ie=t;l!==0&&(S=S.map((Te,nt)=>Te+b*M[nt]),L=L.map((Te,nt)=>Te+b*I[nt]),X=X.map((Te,nt)=>Te+b*j[nt]),v=v.map((Te,nt)=>Te+b*x[nt]),B=B.map((Te,nt)=>Te+b*$[nt]),Y=Y.map((Te,nt)=>Te+b*Z[nt]),k=k.map((Te,nt)=>Te+b*_[nt]),re=qe(re),te=qe(te),ke=qe(ke),he=qe(he),ve=qe(ve),de=qe(de),Fe=qe(Fe),Ie-=b*n);let ge=Te=>Te.map(nt=>nt+Ie),Me=Te=>Te.map(nt=>nt+e);v=ge(v),x=Me(x),k=ge(k),_=Me(_),S=ge(S),M=Me(M),B=ge(B),$=Me($),Y=ge(Y),Z=Me(Z),L=ge(L),I=Me(I),X=ge(X),j=Me(j),re=[re[0]+Ie,re[1]+e],te=[te[0]+Ie,te[1]+e],ke=[ke[0]+Ie,ke[1]+e],he=[he[0]+Ie,he[1]+e],ve=[ve[0]+Ie,ve[1]+e],de=[de[0]+Ie,de[1]+e],Fe=[Fe[0]+Ie,Fe[1]+e];let be=String(o).toLowerCase(),Be=["2","3","5","6","7","8","9","0","a","c","e","f"].includes(be)?a:void 0,De=["1","2","3","4","7","8","9","0","a","d"].includes(be)?a:void 0,ye=["1","3","4","5","6","7","8","9","0","a","b","d"].includes(be)?a:void 0,_e=["2","3","5","6","8","9","0","b","c","d","e"].includes(be)?a:void 0,Ae=["2","6","8","0","a","b","c","d","e","f"].includes(be)?a:void 0,Ze=["4","5","6","8","9","0","a","b","c","e","f"].includes(be)?a:void 0,bn=["2","3","4","5","6","8","9","a","b","d","e","f"].includes(be)?a:void 0,ft=[],Rt=(Te,nt,ch)=>ft.push(new U(Te.map((uh,Da)=>[uh,nt[Da]]),{closed:!0,fill:ch??!1,color:"gray",lw:.5}));return Rt(S,M,Be),Rt(L,I,De),Rt(X,j,ye),Rt(v,x,_e),Rt(B,$,Ae),Rt(Y,Z,Ze),Rt(k,_,bn),h&&(ft.push(new W(re,"a",{align:["center","bottom"],fontsize:10})),ft.push(new W(te,"g",{align:["center","bottom"],fontsize:10})),ft.push(new W(ke,"d",{align:["center","bottom"],fontsize:10})),ft.push(new W(he,"b",{align:["left","center"],fontsize:10})),ft.push(new W(ve,"c",{align:["left","center"],fontsize:10})),ft.push(new W(de,"e",{align:["right","center"],fontsize:10})),ft.push(new W(Fe,"f",{align:["right","center"],fontsize:10}))),r.decimal&&ft.push(new D([Ie+n+s+.15/2,e],.15,{color:"gray",fill:a,lw:.5})),ft}var oi=class extends nr{constructor(e={}){let t=T(e,"decimal",!1),n=t?"8":"7",s=t?5.9:5.3,o=e.size??[3,s],a=[{pin:"a",side:"L",slot:`${7+(t?1:0)}/${n}`,anchorname:"a"},{pin:"b",side:"L",slot:`${6+(t?1:0)}/${n}`,anchorname:"b"},{pin:"c",side:"L",slot:`${5+(t?1:0)}/${n}`,anchorname:"c"},{pin:"d",side:"L",slot:`${4+(t?1:0)}/${n}`,anchorname:"d"},{pin:"e",side:"L",slot:`${3+(t?1:0)}/${n}`,anchorname:"e"},{pin:"f",side:"L",slot:`${2+(t?1:0)}/${n}`,anchorname:"f"},{pin:"g",side:"L",slot:`${1+(t?1:0)}/${n}`,anchorname:"g"}];t&&a.push({pin:"dp",side:"L",slot:`1/${n}`,anchorname:"dp"}),T(e,"anode",!1)&&a.push({pin:"ca",side:"T",anchorname:"anode"}),T(e,"cathode",!1)&&a.push({pin:"cc",side:"B",anchorname:"cathode"}),super({...e,pins:a,size:o,pinspacing:.6});let l=.8,c=(s-1.5*2)/2;this.segments.push(...Cc({left:l,bottom:c,decimal:t,digit:T(e,"digit",8),segcolor:T(e,"segcolor","red"),tilt:T(e,"tilt",10),labelsegments:T(e,"labelsegments",!0)}))}},ai=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pins:8,notch:!0,width:3,pinw:.6,spacing:.5,number:!0,fontsize:12,pfontsize:10});let t=T(this.params,"width",3),n=T(this.params,"pinw",.6),s=T(this.params,"spacing",.5),i=T(this.params,"pins",8),o=T(this.params,"names",void 0);if(i%2===1)throw new Error("pins must be even");let a=i/2*n+s*(i/2+1);if(this.segments.push(new U([[0,0],[t,0],[t,a],[0,a]],{closed:!0})),T(this.params,"notch",!0)){let h=t/2,c=ze(-Math.PI,0,50),m=n/2,f=c.map(b=>h+m*Math.cos(b)),g=c.map(b=>a+m*Math.sin(b));this.segments.push(new p(f.map((b,v)=>[b,g[v]])))}let l=i/2;for(let h=0;h<l;h++){let c=s+s*h+h*n,m=s+s*h+(h+1)*n,f=(c+m)/2;this.segments.push(new U([[0,c],[0,m],[-n,m],[-n,c]],{closed:!0}));let g=l-h;this.anchors[`p${g}`]=[-n,f],this.anchors[`p${g}_in`]=[0,f],T(this.params,"number",!0)&&this.segments.push(new W([-n/2,f],String(g),{fontsize:T(this.params,"pfontsize",10)})),o&&o[g-1]&&(this.segments.push(new W([.1,f],o[g-1],{align:["left","center"],fontsize:T(this.params,"fontsize",12)})),this.anchors[o[g-1]]=[-n,f],this.anchors[`${o[g-1]}_in`]=[0,f]),this.segments.push(new U([[t,c],[t,m],[t+n,m],[t+n,c]],{closed:!0})),g=l+h+1,this.anchors[`p${g}`]=[t+n,f],this.anchors[`p${g}_in`]=[t,f],T(this.params,"number",!0)&&this.segments.push(new W([t+n/2,f],String(g),{fontsize:T(this.params,"pfontsize",10)})),o&&o[g-1]&&(this.segments.push(new W([t-.1,f],o[g-1],{align:["right","center"],fontsize:T(this.params,"fontsize",12)})),this.anchors[o[g-1]]=[t+n,f],this.anchors[`${o[g-1]}_in`]=[t,f])}}};var Zc={};$a(Zc,{Adc:()=>Ls,Amp:()=>un,And:()=>Bt,Bjt:()=>qr,Bjt2:()=>Hr,BjtNpn:()=>Ht,BjtNpn2:()=>Ss,BjtPnp:()=>rr,BjtPnp2:()=>ln,Breaker:()=>as,Buf:()=>Jt,CPE:()=>ls,Capacitor:()=>Cr,Capacitor2:()=>Cn,CapacitorTrim:()=>Ln,CapacitorVar:()=>In,Circle:()=>ui,Circulator:()=>Os,Connect:()=>pr,Crystal:()=>Un,CurrentMirror:()=>Fr,Dac:()=>Ds,Data:()=>Ms,Decision:()=>Es,Demod:()=>Ns,Diac:()=>on,Diode:()=>et,DiodeShockley:()=>$n,DiodeTVS:()=>Fn,DiodeTunnel:()=>On,DrawTree:()=>l0,DspBox:()=>sr,DspCircle:()=>Yt,DspSpeaker:()=>_s,Ellipse:()=>zs,Filter:()=>Is,FlowBox:()=>cn,Fuse:()=>rs,FuseIEC:()=>Dr,FuseIEEE:()=>dr,FuseUS:()=>os,Inductor:()=>Ir,Inductor2:()=>Lr,Isolator:()=>Fs,Josephson:()=>is,LED:()=>qn,LED2:()=>Hn,LogicTree:()=>gr,Memristor:()=>ns,Memristor2:()=>ss,Mixer:()=>As,NFet:()=>gs,NFet2:()=>ws,NMos:()=>ms,NMos2:()=>ps,Norator:()=>Or,Not:()=>Kt,Nullator:()=>Nr,Opamp:()=>cs,Or:()=>$t,Oscillator:()=>Cs,OscillatorBox:()=>Bs,PFet:()=>bs,PFet2:()=>xs,PMos:()=>ds,PMos2:()=>fs,Photodiode:()=>Yn,Photoresistor:()=>ts,PhotoresistorIEC:()=>Qt,PhotoresistorIEEE:()=>ur,Potentiometer:()=>es,PotentiometerIEC:()=>er,PotentiometerIEEE:()=>mr,Process:()=>hi,Resistor:()=>Zn,ResistorIEC:()=>mt,ResistorVar:()=>Qn,ResistorVarIEC:()=>Zt,ResistorVarIEEE:()=>cr,RoundBox:()=>Yr,RoundProcess:()=>li,Rshunt:()=>Kn,SCR:()=>Xn,STYLE_IEC:()=>Xl,STYLE_IEEE:()=>an,Schottky:()=>Dn,SparkGap:()=>hs,Start:()=>ci,State:()=>mi,StateEnd:()=>Ps,Subroutine:()=>ks,Sum:()=>Ts,SumSigma:()=>Rs,Terminal:()=>hn,Thermistor:()=>Jn,Triac:()=>Gn,Tristate:()=>Bn,VGA:()=>$s,Varactor:()=>jn,VoltageMirror:()=>$r,Zener:()=>Nn,buchheim:()=>Ra,cycloid:()=>Vn,logicparse:()=>Ql,nand:()=>Tn,nor:()=>Rn,pictorial:()=>Jc,resetElementStyleForTests:()=>Wl,setBoxAnchors16:()=>fr,setElementStyle:()=>Gl,xnor:()=>_n,xor:()=>An});function fr(r,e,t){r.center=[e/2,0],r.N=[e/2,t/2],r.E=[e,0],r.S=[e/2,-t/2],r.W=[0,0],r.NW=[0,t/2],r.NE=[e,t/2],r.SW=[0,-t/2],r.SE=[e,-t/2],r.NNE=[3*e/4,t/2],r.NNW=[e/4,t/2],r.SSE=[3*e/4,-t/2],r.SSW=[e/4,-t/2],r.ENE=[e,t/3],r.ESE=[e,-t/3],r.WNW=[0,t/3],r.WSW=[0,-t/3]}function p2(r,e,t,n){let s=n-n*Math.sqrt(2)/2;fr(r,e,t),r.NW=[s,t/2-s],r.NE=[e-s,t/2-s],r.SW=[s,-t/2+s],r.SE=[e-s,-t/2+s],r.NNE=[n<e/4?3*e/4:e-n,t/2],r.NNW=[n<e/4?e/4:n,t/2],r.SSE=[n<e/4?3*e/4:e-n,-t/2],r.SSW=[n<e/4?e/4:n,-t/2],r.ENE=[e,n<t/4?t/4:t/2-n],r.ESE=[e,n<t/4?-t/4:-t/2+n],r.WNW=[0,n<t/4?t/4:t/2-n],r.WSW=[0,n<t/4?-t/4:-t/2+n]}function f2(r,e,t,n){fr(r,e,t);let s=n*Math.sqrt(2)/2;r.SE=[n+s,-s],r.SW=[n-s,-s],r.NE=[n+s,s],r.NW=[n-s,s];let i=n*Math.cos(22.5*Math.PI/180),o=n*Math.cos(67.5*Math.PI/180);r.NNE=[n+o,i],r.ENE=[n+i,o],r.ESE=[n+i,-o],r.SSE=[n+o,-i],r.NNW=[n-o,i],r.WNW=[n-i,o],r.WSW=[n-i,-o],r.SSW=[n-o,-i]}var Yr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,cornerradius:.3});let t=T(this.params,"w",3),n=T(this.params,"h",2),s=T(this.params,"cornerradius",.3);this.segments.push(new U([[0,n/2],[t,n/2],[t,-n/2],[0,-n/2]],{closed:!0,cornerradius:s,fill:"none"})),p2(this.anchors,t,n,s),this.elmParams.drop=[t,0]}},hn=class extends Yr{constructor(e={}){let t=e.h??1.25,n=e.w??3,s=e.anchor??"N";super({...e,w:n,h:t,cornerradius:t/2,anchor:s}),this.elmParams.drop=[n/2,-t/2],this.elmParams.droptheta=-90}},li=Yr,cn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0});let t=T(this.params,"w",3),n=T(this.params,"h",2);this.segments.push(new p([[0,0],[0,n/2],[t,n/2],[t,-n/2],[0,-n/2],[0,0]])),fr(this.anchors,t,n),this.elmParams.drop=[t,0]}},hi=cn,ci=hn,ks=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,s:.3});let t=T(this.params,"s",.3),n=T(this.params,"w",3)+t*2,s=T(this.params,"h",2);this.segments.push(new p([[0,0],[0,s/2],[n,s/2],[n,-s/2],[0,-s/2],[0,0]])),this.segments.push(new p([[n-t,s/2],[n-t,-s/2]])),this.segments.push(new p([[t,s/2],[t,-s/2]])),fr(this.anchors,n,s),this.elmParams.drop=[n,0]}},Ms=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,slant:.5});let t=T(this.params,"w",3),n=T(this.params,"h",2),s=T(this.params,"slant",.5);this.segments.push(new U([[0,0],[s/2,n/2],[t+s/2,n/2],[t-s/2,-n/2],[-s/2,-n/2]],{closed:!0,fill:"none"})),fr(this.anchors,t,n),this.anchors.N=[t/2+s/2,n/2],this.anchors.S=[t/2-s/2,-n/2],this.anchors.NE=[t+s/2,n/2],this.anchors.SE=[t-s/2,-n/2],this.anchors.NW=[s/2,n/2],this.anchors.SW=[-s/2,-n/2],this.anchors.ENE=[t+s/4,n/4],this.anchors.WNW=[s/4,n/4],this.anchors.ESE=[t-s/4,-n/4],this.anchors.WSW=[-s/4,-n/4],this.anchors.NNE=[3*t/4+s/2,n/2],this.anchors.SSE=[3*t/4-s/2,-n/2],this.anchors.NNW=[t/4+s/2,n/2],this.anchors.SSW=[t/4-s/2,-n/2],this.elmParams.drop=[t,0]}},zs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0});let t=T(this.params,"w",3),n=T(this.params,"h",2),i=ze(0,Math.PI*2,50).map(c=>{let m=n/2*Math.sin(c);return[t/2*Math.cos(c)+t/2,m]});i[i.length-1]=[i[0][0],i[0][1]],this.segments.push(new p(i)),fr(this.anchors,t,n);let o=Math.sin(Math.PI/4),a=Math.cos(Math.PI/4),l=Math.sin(Math.PI/8),h=Math.cos(Math.PI/8);this.anchors.SE=[t/2+t/2*a,-n/2*o],this.anchors.SW=[t/2-t/2*a,-n/2*o],this.anchors.NW=[t/2-t/2*a,n/2*o],this.anchors.NE=[t/2+t/2*a,n/2*o],this.anchors.ENE=[t/2+t/2*h,n/2*l],this.anchors.WNW=[t/2-t/2*h,n/2*l],this.anchors.ESE=[t/2+t/2*h,-n/2*l],this.anchors.WSW=[t/2-t/2*h,-n/2*l],this.anchors.NNE=[t/2+t/2*l,n/2*h],this.anchors.NNW=[t/2-t/2*l,n/2*h],this.anchors.SSE=[t/2+t/2*l,-n/2*h],this.anchors.SSW=[t/2-t/2*l,-n/2*h],this.elmParams.drop=[t,0]}},Es=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:4,h:2.25,theta:0,fontsize:14});let t=T(this.params,"w",4),n=T(this.params,"h",2.25),s=T(this.params,"fontsize",14),i=T(this.params,"font",void 0),o=.13,a=e.N,l=e.E,h=e.S,c=e.W;this.segments.push(new U([[0,0],[t/2,n/2],[t,0],[t/2,-n/2]],{closed:!0,fill:"none"})),a&&this.segments.push(new W([t/2+o,n/2+o],a,{align:["left","bottom"],fontsize:s,fontfamily:i})),h&&this.segments.push(new W([t/2+o,-n/2-o],h,{align:["left","top"],fontsize:s,fontfamily:i})),l&&this.segments.push(new W([t+o,o],l,{align:["left","bottom"],fontsize:s,fontfamily:i})),c&&this.segments.push(new W([-o,o],c,{align:["right","bottom"],fontsize:s,fontfamily:i})),fr(this.anchors,t,n),this.anchors.NE=[3*t/4,n/4],this.anchors.NW=[t/4,n/4],this.anchors.SE=[3*t/4,-n/4],this.anchors.SW=[t/4,-n/4],this.anchors.NNE=[5*t/8,3*n/8],this.anchors.NNW=[3*t/8,3*n/8],this.anchors.SSE=[5*t/8,-3*n/8],this.anchors.SSW=[3*t/8,-3*n/8],this.anchors.ENE=[7*t/8,n/8],this.anchors.ESE=[7*t/8,-n/8],this.anchors.WNW=[t/8,n/8],this.anchors.WSW=[t/8,-n/8],this.elmParams.drop=[t,0]}},pr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:1.5,h:1.5,r:.75});let t=T(this.params,"w",1.5),n=T(this.params,"h",1.5);if(e.r!==void 0){let i=e.r;t=i*2,n=i*2}let s=t/2;this.segments.push(new D([s,0],s)),f2(this.anchors,t,n,s),this.elmParams.drop=[t,0]}},ui=pr,mi=pr,Ps=class extends pr{constructor(e={}){let t=e.dr??.15,n=e.w??1.5,s=e.h??1.5;if(e.r!==void 0){let h=e.r;n=h*2,s=h*2}let{r:i,...o}=e;super({...o,w:n,h:s});let l=T(this.params,"w",n)/2;this.segments.push(new D([l,0],l-t))}};var sr=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.5],[1,.5],[1,-.5],[0,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.anchors.N=[.5,.5],this.anchors.S=[.5,-.5],this.anchors.E=[1,0],this.anchors.W=[0,0],this.elmParams.drop=[1,0]}},Yt=class extends N{constructor(e={}){super(e);let t=e.radius??.5,n=t*Math.SQRT2/2;this.segments.push(new D([t,0],t)),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[2*t,0],this.anchors.N=[t,t],this.anchors.S=[t,-t],this.anchors.E=[2*t,0],this.anchors.W=[0,0],this.anchors.NW=[t-n,n],this.anchors.NE=[t+n,n],this.anchors.SW=[t-n,-n],this.anchors.SE=[t+n,-n],this.anchors.center=[t,0]}},Ts=class extends Yt{constructor(e={}){super(e),this.segments.push(new p([[.5,.2],[.5,-.2]])),this.segments.push(new p([[.3,0],[.7,0]]))}},Rs=class extends Yt{constructor(e={}){super(e),this.segments.push(new W([.45,0],"\u03A3",{align:["center","center"]}))}},As=class extends Yt{constructor(e={}){super(e);let t=.5,n=t*Math.SQRT2/2;this.segments.push(new p([[t+n,n],[t-n,-n]],{lw:1})),this.segments.push(new p([[t+n,-n],[t-n,n]],{lw:1})),this.elmParams.lblloc="top",this.elmParams.lblofst=.2;let s=e.font,i=e.fontsize??10;e.N&&this.segments.push(new W([t,t/2+.01],e.N,{fontfamily:s,fontsize:i})),e.S&&this.segments.push(new W([t,-t/2-.065],e.S,{fontfamily:s,fontsize:i})),e.E&&this.segments.push(new W([t*1.5+.05,0],e.E,{fontfamily:s,fontsize:i})),e.W&&this.segments.push(new W([t/2-.05,0],e.W,{fontfamily:s,fontsize:i}))}},_s=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.25],[.25,.25],[.25,-.25],[0,-.25],[0,0]])),this.segments.push(new p([[.25,.25],[.5,.5],[.5,-.5],[.25,-.25],[.25,.25]]))}},un=class extends N{constructor(e={}){super(e);let t=1,n=.75;this.segments.push(new p([[0,0],[0,-t/2],[n,0],[0,t/2],[0,0]])),this.elmParams.drop=[n,0],this.anchors.input=[0,0],this.anchors.out=[n,0]}};function Ic(){return ze(-Math.PI,Math.PI,20).map(e=>[e/Math.PI*.3+.5,-Math.sin(e)/10])}var Bs=class extends sr{constructor(e={}){super(e),this.segments.push(new p(Ic()))}},Cs=class extends Yt{constructor(e={}){super(e),this.segments.push(new p(Ic()))}},Is=class extends sr{constructor(e={}){super(e);let t=Ic(),n=t.map(([o,a])=>[o,a+.25]),s=t.map(([o,a])=>[o,a-.25]);this.segments.push(new p(t)),this.segments.push(new p(n)),this.segments.push(new p(s));let i=e.response;if(i){let o=i.toLowerCase();(o==="bp"||o==="lp")&&this.segments.push(new p([[.45,.17],[.55,.33]])),(o==="bp"||o==="hp")&&this.segments.push(new p([[.45,-.33],[.55,-.17]])),(o==="lp"||o==="hp"||o==="notch")&&this.segments.push(new p([[.45,-.08],[.55,.08]]))}}},Ls=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[.22,.5],[1.4,.5],[1.4,-.5],[.22,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[1.4,0],this.anchors.input=[0,0],this.anchors.out=[1.4,0],this.anchors.E=[1.4,0],this.anchors.W=[0,0]}},Ds=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.5],[1.18,.5],[1.4,0],[1.18,-.5],[0,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[1.4,0],this.anchors.input=[0,0],this.anchors.out=[1.4,0],this.anchors.E=[1.4,0],this.anchors.W=[0,0]}},Ns=class extends sr{constructor(e={}){super(e),this.segments.push(new p([[.15,0],[.3,0]])),this.segments.push(new p([[.3,.25],[.7,0],[.3,-.25],[.3,.25]])),this.segments.push(new p([[.7,.25],[.7,-.25]])),this.segments.push(new p([[.7,0],[.85,0]]))}},Os=class extends Yt{constructor(e={}){super(e);let t=.5;this.segments.push(new xe([.5,0],.9*t,.9*t,{theta1:20,theta2:200,arrow:"cw"}))}},Fs=class extends sr{constructor(e={}){super(e);let t=.25;this.segments.push(new p([[t,0],[1-t,0]],{arrow:"->"}))}},$s=class extends un{constructor(e={}){super(e);let t=e.tuneup??!0;this.segments.push(new p([[-.1,-.5],[.75,.5]],{arrow:"->"})),this.anchors.tune=[.325,t?.5:-.5]}};var Jc={};$a(Jc,{Breadboard:()=>Vc,CapacitorCeramic:()=>Xc,CapacitorElectrolytic:()=>Hc,CapacitorMylar:()=>Yc,DIP:()=>Wc,Diode:()=>Nc,ElementPictorial:()=>Ta,FritzingPart:()=>Uc,INCH:()=>Ce,LED:()=>qs,LEDBlue:()=>jc,LEDGreen:()=>$c,LEDOrange:()=>Oc,LEDWhite:()=>qc,LEDYellow:()=>Fc,MILLIMETER:()=>g2,PINSPACING:()=>ee,Resistor:()=>Dc,TO92:()=>Gc,fritzParts:()=>y2,parseSizeToUnits:()=>w2,resistorColors:()=>v1});var js=class extends N{constructor(e,t,n,s={}){super(s);let{xy:i,imgfmt:o,zorder:a,...l}=s;this.segments.push(new Br(e,{xy:i??[0,0],width:t,height:n,zorder:a??1,imgfmt:o})),this.elmParams.theta=0;let h=t/2,c=n/2,m=(i?.[0]??0)+h,f=(i?.[1]??0)+c;this.anchors.center=[m,f],this.anchors.N=[m,f+c],this.anchors.S=[m,f-c],this.anchors.E=[m+h,f],this.anchors.W=[m-h,f]}};var Ce=3.5,g2=Ce/25.4,ee=.1*Ce,Pa="#333",x1="#777",Lt="#A0A0A0",b2=96;function w2(r){return x2(r)/b2*Ce}function x2(r){let e=r.match(/^([0-9.]+)\s*(px|pt|in|mm|cm|pc|em|ex|%)?$/i);if(!e)return 0;let t=parseFloat(e[1]);switch((e[2]??"px").toLowerCase()){case"px":return t;case"pt":return t*(96/72);case"in":return t*96;case"mm":return t*(96/25.4);case"cm":return t*(96/2.54);case"pc":return t*16;default:return t}}var Lc={0:"black",1:"brown",2:"red",3:"orange",4:"yellow",5:"green",6:"blue",7:"violet",8:"gray",9:"white",[-1]:"gold",[-2]:"silver",[-3]:"pink"},v2={1:"brown",2:"red","0.05":"orange","0.02":"yellow","0.5":"green","0.25":"blue","0.1":"violet","0.01":"gray",5:"gold",10:"silver"};function v1(r,e){let t=Math.floor(Math.log10(r))-1,n=r/10**t;n<10&&(t-=1,n=r/10**t);let s=Math.floor(n/10),i=Math.floor(n%10),o=e!==void 0?v2[String(e)]:void 0;return[Lc[s],Lc[i],Lc[t],o]}var Ta=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{leadcolor:Lt,lw:3})}},Dc=class extends Ta{constructor(e=1e3,t,n={}){super(n),Object.assign(this.defaults,{fill:"blanchedalmond"});let s=ee,i=ee/2,o=i*.9;this.segments.push(new p([[0,0],[NaN,NaN],[i*3+s,0]])),this.segments.push(new ut(["M",[0,0],"Q",[0,i],[i,i],"Q",[i*1.25,i],[i*1.5,o],"L",[i*1.5+s,o],"Q",[i*1.75+s,i],[i*2+s,i],"Q",[i*3+s,i],[i*3+s,0],"Q",[i*3+s,-i],[i*2+s,-i],"Q",[i*1.75+s,-i],[i*1.5+s,-o],"L",[i*1.5,-o],"Q",[i*1.25,-i],[i,-i],"Q",[0,-i],[0,0],"Z"],{color:"black",lw:1}));let a=.16,l=.32,h=.48,c=.68,m=.08,[f,g,b,v]=v1(e,t);this.segments.push(new U([[a,o],[a,-o],[a+m,-o],[a+m,o]],{fill:f,lw:.1,zorder:2})),this.segments.push(new U([[l,o],[l,-o],[l+m,-o],[l+m,o]],{fill:g,lw:.1,zorder:2})),this.segments.push(new U([[h,o],[h,-o],[h+m,-o],[h+m,o]],{fill:b,lw:.1,zorder:2})),v&&this.segments.push(new U([[c,o],[c,-o],[c+m,-o],[c+m,o]],{fill:v,lw:.1,zorder:2}))}},Nc=class extends Ta{constructor(e={}){super(e),Object.assign(this.defaults,{fill:Pa,stripe_color:"silver"});let t=ee/2,n=ee*2.5,s=n*.78,i=.08,o=this.params.stripe_color??"silver";Vr(o),this.segments.push(new p([[0,0],[NaN,NaN],[n,0]])),this.segments.push(new U([[0,t],[n,t],[n,-t],[0,-t]],{closed:!0,lw:1,color:"black",zorder:2})),this.segments.push(new U([[s,t],[s+i,t],[s+i,-t],[s,-t]],{closed:!0,lw:1,color:"none",fill:o,zorder:2}))}},qs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead_length:ee*5,fill:"#dd4433",theta:0});let t=.197*Ce,n=.338*Ce,s=this.params.lead_length??ee*5,i=ee*5;this.segments.push(new p([[0,0],[0,s]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,s-i*.3],[ee*.6,s-i*.2],[ee*.6,s]],{color:Lt,lw:4}));let o=t*.8,a=ee/2-t/2,l=ee/2,h=s+n;this.segments.push(new ut(["M",[a,s],"Q",[l,s-i*.2],[a+t,s],"L",[a+t,h-o],"C",[a+t,h],[a,h],[a,h-o],"Z"],{color:"none"}));let c=.039*Ce;this.segments.push(new ut(["M",[a,s+c/2],"Q",[l*.5,s-i*.16+c],[a+t*.7,s-i*.03],"L",[a+t,s+c/2]],{color:"#FFFFFF55",lw:2}));let m=a+.03*Ce;this.segments.push(new ut(["M",[m,s+c*2],"L",[m,h-o],"Q",[m,h-o+.04*Ce],[m+.04*Ce,h-o+.07*Ce]],{color:"#FFFFFF55",lw:3}))}},Oc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#efa207"})}},Fc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#f1de0f"})}},$c=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#4be317"})}},jc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#3892bc"})}},qc=class extends qs{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#e5e5e5"})}},Hc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#303b91",lead_length:.2*Ce,cap_color:"#CCC",stripe_color:"#dff1f6",theta:0});let t=ee*1.7,n=.3*Ce,s=this.params.lead_length??.2*Ce;this.segments.push(new p([[0,0],[0,s]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,s]],{color:Lt,lw:4}));let i=ee*2,o=i*.3,a=ee/2-t/2,l=ee/2,h=s+n;this.segments.push(new ut(["M",[a,s],"Q",[l,s-i*.3],[a+t,s],"L",[a+t,h-o],"Q",[l,h],[a,h-o],"Z"],{color:"none"}));let c=this.params.cap_color??"#CCC";this.segments.push(new xe([l,h-o-.01*Ce],t-.03*Ce,o*.9,{theta1:0,theta2:360,fill:c,color:"none",lw:.5,zorder:2}));let m=.039*Ce/2;this.segments.push(new ut(["M",[a,s+m],"Q",[l,s-i*.1],[a+t,s+m]],{color:"#FFFFFF99",fill:"none",lw:1.5}));let f=this.params.stripe_color??"#dff1f6",g=a+.03*Ce;this.segments.push(new ut(["M",[g,s+m],"L",[g,h-o*2]],{color:f,fill:"none",lw:3}))}},Yc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#8c2510",lead_length:.4*Ce,theta:0});let t=ee*1.75,n=t*.75,s=ee/2,i=s-t/2,o=this.params.lead_length??.4*Ce;this.segments.push(new p([[0,0],[0,o]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,o]],{color:Lt,lw:4}));let a=.02*Ce;this.segments.push(new ut(["M",[i,o],"Q",[i-a,o+n/2],[i,o+n],"Q",[s,o+n+a],[i+t,o+n],"Q",[i+t+a,o+n/2],[i+t,o],"Q",[s,o+a/2],[i,o],"Z"],{color:"none"}));let l=o+n-.025*Ce;this.segments.push(new p([[-.01*Ce,l],[ee*.8,l]],{color:"#FFFFFF44",lw:3}))}},Xc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#e2800b",radius:.1*Ce,lead_length:.4*Ce,theta:0});let t=this.params.radius??.1*Ce,n=this.params.lead_length??.4*Ce,s=[ee/2,n+t-.05*Ce];this.segments.push(new p([[0,0],[0,n]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,n]],{color:Lt,lw:4})),this.segments.push(new D(s,t,{color:"none",zorder:2})),this.segments.push(new xe(s,t*2*.7,t*2*.7,{theta1:100,theta2:200,color:"#FFFFFF44",zorder:2}))}},Gc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{theta:0});let t=.175*Ce,n=.17*Ce*.9,s=ee*1.2,i=ee*1.3,o=ee-t/2,a=ee;this.segments.push(new p([[0,0],[0,ee*.8],[ee/2,i]],{color:Lt,lw:4})),this.segments.push(new p([[a,0],[a,i]],{color:Lt,lw:4})),this.segments.push(new p([[ee*2,0],[ee*2,ee*.8],[3*ee/2,i]],{color:Lt,lw:4})),this.segments.push(new U([[o,i],[o+t,i],[o+t,i+n],[o,i+n]],{fill:Pa,lw:1,color:x1,zorder:2})),this.segments.push(new xe([a,i+n],t,s,{theta1:0,theta2:180,fill:Pa,lw:1,color:x1,zorder:2})),this.anchors.pin1=[0,0],this.anchors.pin2=[ee,0],this.anchors.pin3=[ee*2,0],this.anchors.case_center=[a,i+n/2],this.elmParams.lblloc="case_center",this.elmParams.lblalign=["center","center"]}},Wc=class extends N{constructor(e=8,t=!1,n={}){super(n),Object.assign(this.defaults,{theta:0});let s=e;s%2!==0&&(s+=1);let i=t?6*ee:3*ee,o=ee*.25,a=ee*.25,l=(s/2-1)*ee,h=i/2,c=ee*.75,m=a,f=i-a,g=5;for(let b=0;b<s/2;b++)this.segments.push(new p([[0,-b*ee],[m,-b*ee]],{color:Lt,lw:g,zorder:1})),this.segments.push(new p([[f,-b*ee],[f+a,-b*ee]],{color:Lt,lw:g,zorder:1})),this.anchors[`pin${b+1}`]=[0,-b*ee],this.anchors[`pin${s-b}`]=[f+a,-b*ee];this.segments.push(new U([[a,o],[f,o],[f,-o-l],[a,-o-l]],{fill:Pa,lw:1,color:"#444"})),this.segments.push(new xe([h,o],c,c,{theta1:180,theta2:0,lw:1,color:"#777",fill:"#555"})),this.elmParams.lblloc="center",this.elmParams.lblrotate=!0,this.elmParams.lblofst=0}},Vc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{color:"#DDD",fill:"#F8F8F5",shadow_color:"#E5E5E5",text_color:"#666"});let t=.02,n=.1,s=this.params.shadow_color??"#E5E5E5",i=this.params.text_color??"#666";Vr(s),Vr(i);let o=(k,M)=>{this.segments.push(new U([[k-n,M+n],[k+n,M+n],[k+n,M-n]],{fill:!0,color:s,lw:2})),this.segments.push(new U([[k-t,M-t],[k-t,M+t],[k+t,M+t],[k+t,M-t]],{fill:!0,color:Pa,lw:2}))},a=30,l=5,h=.37*Ce,c=(h-ee)/2,m=2.1*Ce,f=3.3*Ce,g=1.5*c,b=-c,v=b+m;this.segments.push(new U([[b,g],[v,g],[v,g-f],[b,g-f]],{lw:2}));let x=0,S=0;for(let k=0;k<2;k++)for(let M=0;M<a;M++){if(M%6===0)continue;let _=[x,S-M*ee],B=[x+ee,S-M*ee];o(..._),o(...B),this.anchors[`L1_${M}`]=_,this.anchors[`L2_${M}`]=B}x=v-c;for(let k=0;k<2;k++)for(let M=0;M<a;M++){if(M%6===0)continue;let _=[x,S-M*ee],B=[x-ee,S-M*ee];o(..._),o(...B),this.anchors[`R1_${M}`]=B,this.anchors[`R2_${M}`]=_}x=h;for(let k=0;k<l;k++){let M=String.fromCharCode(65+k);this.segments.push(new W([x+k*ee,S+ee],M,{fontsize:8,rotation:0,align:["center","center"],color:i,zorder:1}));for(let _=0;_<a;_++){let B=[x+k*ee,S-_*ee];o(...B),this.anchors[`${M}${_+1}`]=B}}for(let k=0;k<l;k++){let M=String.fromCharCode(70+k);this.segments.push(new W([x+ee*7+k*ee,S+ee],M,{fontsize:8,rotation:0,align:["center","center"],color:i,zorder:1}));for(let _=0;_<a;_++){let B=[x+ee*7+k*ee,S-_*ee];o(...B),this.anchors[`${M}${_+1}`]=B}}for(let k=0;k<a;k++)this.segments.push(new W([x-ee,S-k*ee-.04],String(k+1),{fontsize:8,rotation:0,align:["center","bottom"],color:i,zorder:1})),this.segments.push(new W([x+ee*12,S-k*ee-.04],String(k+1),{fontsize:8,rotation:0,align:["center","bottom"],color:i,zorder:1}));this.segments.push(new p([[b+c*.4,g-ee*2],[b+c*.4,g-f+ee]],{color:"red",lw:.5})),this.segments.push(new p([[b+h-c*.4,g-ee*2],[b+h-c*.4,g-f+ee]],{color:"blue",lw:.5})),this.segments.push(new p([[v-c*.4,g-ee*2],[v-c*.4,g-f+ee]],{color:"blue",lw:.5})),this.segments.push(new p([[v-h+c*.4,g-ee*2],[v-h+c*.4,g-f+ee]],{color:"red",lw:.5}))}},Uc=class extends js{constructor(t,n,s,i,o,a={}){super(t,n,s,{imgfmt:"svg",...a});z(this,"info");if(this.info=o,i)for(let[l,h]of Object.entries(i))this.anchors[l]=h}};function y2(r){throw new Error("fritzParts requires a .fzpz zip parser. Use a library like 'jszip' and pass the extracted SVG/anchors to FritzingPart directly.")}var Pe=class extends se{constructor(e={}){let{arrow:t,...n}=e;super(n),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25});let s=this.params.arrowwidth,i=this.params.arrowlength;this.segments.push(new p([[0,0]],{arrow:t,arrowwidth:s,arrowlength:i}))}};var y1=H,di=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,to:[1,1]})}toXY(e){return this.userParams.to=e,this}delta(e=0,t=0){return this.userParams.delta=[e,t],this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.elmParams.theta=0;let s=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),i=this.params.to!==void 0?A.fromXY(this.params.to):A.fromXY(e),o=this.params.delta,a=this.params.n??1,l=this.params.dy??.6,h=this.params.xstart,c=this.params.arrow,m,f;if(o!==void 0?[m,f]=o:(m=i.x!==void 0?i.x-s.x:this.params.to[0]-(this.params.at!==void 0?this.params.at[0]:e[0]),f=i.x!==void 0?i.y-s.y:this.params.to[1]-(this.params.at!==void 0?this.params.at[1]:e[1])),Math.abs(f)<.05)for(let g=0;g<a;g++){let b=-g*l;this.segments.push(new p([[0,b],[m,b]],{arrow:c}))}else{let g;h!==void 0?f>0?g=m*h:g=m*h-l-l*(a-1)*h:m>0?g=m/2-l*(a-1)/2:g=m/2+l*(a-1)/2;for(let b=0;b<a;b++){let v=-b*l,x;f>0?x=m>0?g+l*b:g-l*b:x=m>0?g+(a-b)*l:g-(a-b)*l,this.segments.push(new p([[0,v],[x,v],[x,v+f],[m,v+f]],{arrow:c}))}}return super._place(e,t,n)}},Hs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,to:[3,-2],theta:0,n:1})}toXY(e){return this.userParams.to=e,this}delta(e=0,t=0){return this.userParams.delta=[e,t],this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),i=this.params.delta,o=this.params.to,a=this.params.n??1,l=this.params.dy??.6,h=this.params.arrow,c,m;i!==void 0?[c,m]=i:(c=o[0]-s.x,m=o[1]-s.y);let f=0;for(let g=0;g<a;g++){let b=-g*l;m>0?f=c<0?c-g*l:c+g*l:f=c>0?c+(a-g-1)*l:c-(a-g-1)*l,this.segments.push(new p([[0,b],[f,b],[f,m]],{arrow:h}))}return this.anchors.mid=[c/2,0],this.elmParams.lblloc="mid",this.elmParams.drop=[f,m],this.elmParams.droptheta=m>0?90:-90,super._place(e,t,n)}},pi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,style:"round",numbering:"lr",pinfontsizeleft:9,pinfontsizeright:9,edge:.3,pinfill:"bg",shownumber:!1,pinalignleft:"bottom",pinalignright:"bottom",pinrad:.1});let t=e.rows??4,n=e.cols??1,s=e.pinsleft??[],i=e.pinsright??[];this.elmParams.d="right";let o=this.params.pinspacing??.6,a=this.params.edge??.3,l=this.params.pinrad??.1,h=this.params.style??"round",c=this.params.numbering??"lr",m=this.params.shownumber??!1,f=this.params.pinfill??"bg",g=this.params.pinfontsizeleft??9,b=this.params.pinfontsizeright??9,v=this.params.pinalignleft??"bottom",x=(n-1)*o+a*2,S=(t-1)*o+a*2;this.segments.push(new U([[0,0],[0,S],[x,S],[x,0]]));for(let k=0;k<t;k++)for(let M=0;M<n;M++){let _=M*o+a,B=S-k*o-a,$=[_,B];h==="square"?this.segments.push(new U([[_-l,B-l],[_+l,B-l],[_+l,B+l],[_-l,B+l]],{fill:"bg",zorder:4})):h==="screw"?(this.segments.push(new D($,l*1.75,{fill:f,zorder:4})),this.segments.push(new p([[_+l,B+l],[_-l,B-l]],{zorder:5}))):this.segments.push(new D($,l,{fill:f,zorder:4}));let Y;if(c==="lr"||c===!0?Y=String(k*n+M+1):c==="ud"?Y=String(k+M*t+1):Y=M%2?String(t*M+(t-k)):String(k+1),this.anchors[`pin${Y}`]=$,m){let Z=[M%2?x+.05:-.05,B],L=M%2?"left":"right";this.segments.push(new W(Z,Y,{fontsize:g,align:[L,"bottom"]}))}if(s.length>0&&(n===1||!(M%2))){let Z=[-.05,B];this.segments.push(new W(Z,s[k]??"",{fontsize:g,align:["right",v]}))}if(i.length>0&&(n===1||M%2)){let Z=[x+.05,B];this.segments.push(new W(Z,i[k]??"",{fontsize:b,align:["left",v]}))}}}},fi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,pinrad:.1,theta:0});let t=this.params.pinrad??.1,n=this.params.pinspacing??.6,s=t*2.5;this.segments.push(new U([[-s,-s],[n+s,-s],[n+s,s],[-s,s]]))}},gi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,lwbus:4,l:3,slantx:.5}),this.elmParams.theta=0;let t=e.n??1,n=e.up??!0,s=this.params.l??3,i=this.params.dy??.6,o=this.params.lwbus??4,a=this.params.slantx??.5,l=n?a:-a;for(let h=0;h<t;h++){let c=-h*i;this.segments.push(new p([[0,c],[s-a,c],[s,c+l]])),this.anchors[`pin${h+1}`]=[0,c]}this.segments.push(new p([[s,a],[s,l-t*i]],{lw:o})),this.elmParams.drop=[s,a],this.anchors.start=[s,a],this.anchors.end=[s,l-t*i]}},bi=class extends Pe{constructor(e={}){super(e),Object.assign(this.defaults,{lw:4})}},a0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=4*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<4;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${9-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(9-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<5;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${5-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(5-c),{fontsize:9,align:["center","bottom"]}))}}},wi=class extends a0{},xi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",number:!1,pinrad:.1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=12*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<12;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${25-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(25-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<13;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${13-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(13-c),{fontsize:9,align:["center","bottom"]}))}}},vi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=7*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<7;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${15-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(15-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<8;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${8-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(8-c),{fontsize:9,align:["center","bottom"]}))}}},yi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=18*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<18;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${37-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(37-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<19;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${19-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(19-c),{fontsize:9,align:["center","bottom"]}))}}},Si=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t*2+n*2,l=16*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<17;c++){let m=[n,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${50-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(50-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<16;c++){let m=[n+t,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${33-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(33-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<17;c++){let m=[n+t*2,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${17-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(17-c),{fontsize:9,align:["center","bottom"]}))}}},ki=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.4,radiusinner:.12,fillinner:"bg"});let t=this.params.radius??.4,n=this.params.radiusinner??.12,s=this.params.fillinner??"bg";this.segments.push(new D([0,0],t)),this.segments.push(new D([0,0],n,{fill:s,zorder:4})),this.anchors.center=[0,0],this.anchors.N=[0,t],this.anchors.S=[0,-t],this.anchors.E=[t,0],this.anchors.W=[-t,0]}},Mi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pluggap:.18});let t=this.params.pluggap??.18;this.segments.push(new p([[0,0],[1,0],y1,[1-.25,.25],[1,0],[1-.25,-.25]])),this.elmParams.drop=[1+t,0]}},zi=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[-.25,.25],y1,[-.25,-.25],[0,0],[1,0]])),this.elmParams.drop=[1,0]}},Ei=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{r:.18,open:!0,fill:"bg",drop:[0,0],theta:0,zorder:4});let t=this.params.r??.18;this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0];let n=this.params.open??!0;this.elmParams.fill=n?"bg":!0,this.segments.push(new D([0,0],t));let s=1,i=2;this.segments.push(new p([[-s*t,-i*t],[s*t,i*t]]))}};var gr=class{constructor(e,...t){z(this,"node");z(this,"children");this.node=e,this.children=t}[Symbol.iterator](){return this.children[Symbol.iterator]()}},l0=class r{constructor(e,t=null,n=0,s=1){z(this,"x",-1);z(this,"y");z(this,"node");z(this,"children");z(this,"parent");z(this,"thread",null);z(this,"mod",0);z(this,"ancestor",this);z(this,"change",0);z(this,"shift",0);z(this,"number");z(this,"_lmostSibling",null);this.y=n,this.node=e.node,this.parent=t,this.number=s,this.children=e.children.map((i,o)=>new r(i,this,n+1,o+1)),this.ancestor=this}left(){return this.thread??(this.children.length>0?this.children[0]:null)}right(){return this.thread??(this.children.length>0?this.children[this.children.length-1]:null)}lbrother(){let e=null;if(this.parent)for(let t of this.parent.children){if(t===this)return e;e=t}return e}get lmostSibling(){return!this._lmostSibling&&this.parent&&this!==this.parent.children[0]&&(this._lmostSibling=this.parent.children[0]),this._lmostSibling}};function M1(r,e){r.x+=e;for(let t of r.children)M1(t,e)}function S2(r){let e=0,t=0;for(let n=r.children.length-1;n>=0;n--){let s=r.children[n];s.x+=e,s.mod+=e,t+=s.change,e+=s.shift+t}}function k2(r,e,t){return e.parent&&e.parent.children.includes(r.ancestor)?r.ancestor:t}function M2(r,e,t){let n=e.number-r.number;e.change-=t/n,e.shift+=t,r.change+=t/n,e.x+=t,e.mod+=t}function z2(r,e,t){let n=r.lbrother();if(n!==null){let s=r,i=r,o=n,a=r.lmostSibling,l=r.mod,h=r.mod,c=o.mod,m=a.mod;for(;o.right()&&s.left();){o=o.right(),s=s.left(),a=a.left(),i=i.right(),i.ancestor=r;let f=o.x+c-(s.x+l)+t;f>0&&(M2(k2(o,r,e),r,f),l+=f,h+=f),c+=o.mod,l+=s.mod,m+=a.mod,h+=i.mod}o.right()&&!i.right()?(i.thread=o.right(),i.mod+=c-h):(s.left()&&!a.left()&&(a.thread=s.left(),a.mod+=l-m),e=r)}return e}function z1(r,e=1){if(r.children.length===0)r.lmostSibling?r.x=r.lbrother().x+e:r.x=0;else{let t=r.children[0];for(let i of r.children)z1(i),t=z2(i,t,e);S2(r);let n=(r.children[0].x+r.children[r.children.length-1].x)/2,s=r.lbrother();s?(r.x=s.x+e,r.mod=r.x-n):r.x=n}return r}function E1(r,e=0,t=0,n=null){r.x+=e,r.y=t,(n===null||r.x<n)&&(n=r.x);for(let s of r.children)n=E1(s,e+r.mod,t+1,n);return n}function Ra(r){let e=z1(new l0(r)),t=E1(e);return t<0&&M1(e,-t),e}var E2=new Set(["and","or","not","nand","nor","xor","xnor","true","false"]),P1=(o=>(o[o.IDENT=0]="IDENT",o[o.KEYWORD=1]="KEYWORD",o[o.LPAREN=2]="LPAREN",o[o.RPAREN=3]="RPAREN",o[o.SYMBOL=4]="SYMBOL",o[o.EOF=5]="EOF",o))(P1||{});function P2(r){let e=[],t=0;for(;t<r.length;){let n=r[t];if(/\s/.test(n)){t++;continue}if(n==="("){e.push({tt:2,val:"("}),t++;continue}if(n===")"){e.push({tt:3,val:")"}),t++;continue}if("&|+~\xAC\u2227\u2228\u2295\u22BB".includes(n)){e.push({tt:4,val:n}),t++;continue}if(/[$_a-zA-Z]/.test(n)){let s="";for(;t<r.length&&/[$_a-zA-Z0-9]/.test(r[t]);)s+=r[t],t++;E2.has(s)?e.push({tt:1,val:s}):e.push({tt:0,val:s});continue}throw new Error(`logicparse: unexpected character '${n}'`)}return e.push({tt:5,val:""}),e}var Kc=class{constructor(e){z(this,"tokens");z(this,"pos",0);this.tokens=e}peek(){return this.tokens[this.pos]}advance(){return this.tokens[this.pos++]}expect(e,t){let n=this.advance();if(n.tt!==e||t!==void 0&&n.val!==t)throw new Error(`logicparse: expected ${t??P1[e]}, got '${n.val}'`);return n}parse(){let e=this.xorExpr();if(this.peek().tt!==5)throw new Error(`logicparse: unexpected token '${this.peek().val}'`);return e}isNotOp(e){return e.tt===1&&e.val==="not"||e.tt===4&&(e.val==="~"||e.val==="\xAC")}isAndOp(e){return e.tt===1&&(e.val==="and"||e.val==="nand")||e.tt===4&&(e.val==="&"||e.val==="\u2227")}isOrOp(e){return e.tt===1&&(e.val==="or"||e.val==="nor")||e.tt===4&&(e.val==="|"||e.val==="\u2228"||e.val==="+")}isXorOp(e){return e.tt===1&&(e.val==="xor"||e.val==="xnor")||e.tt===4&&(e.val==="\u2295"||e.val==="\u22BB")}xorExpr(){let e=this.orExpr();for(;this.isXorOp(this.peek());){let t=this.advance(),n=this.orExpr();e={kind:"binary",op:t.val,left:e,right:n}}return e}orExpr(){let e=this.andExpr();for(;this.isOrOp(this.peek());){let t=this.advance(),n=this.andExpr();e={kind:"binary",op:t.val,left:e,right:n}}return e}andExpr(){let e=this.unary();for(;this.isAndOp(this.peek());){let t=this.advance(),n=this.unary();e={kind:"binary",op:t.val,left:e,right:n}}return e}unary(){return this.isNotOp(this.peek())?(this.advance(),{kind:"unary",operand:this.unary()}):this.atom()}atom(){let e=this.peek();if(e.tt===2){this.advance();let t=this.xorExpr();return this.expect(3,")"),t}if(e.tt===0||e.tt===1&&(e.val==="true"||e.val==="false"))return this.advance(),{kind:"ident",name:e.val};throw new Error(`logicparse: unexpected token '${e.val}'`)}};function Zl(r,e){return r.kind==="binary"&&r.op===e?[...Zl(r.left,e),...Zl(r.right,e)]:[r]}function S1(r){return{"&":"and","\u2227":"and","|":"or","\u2228":"or","+":"or","\u2295":"xor","\u22BB":"xor"}[r]??r}var T2={and:"nand",or:"nor",not:"buf",nand:"and",nor:"or",buf:"not",xor:"xnor",xnor:"xor"};function Pi(r){if(r.kind==="ident")return new gr(r.name);if(r.kind==="unary"){if(r.operand.kind==="ident")return new gr("not",Pi(r.operand));let n=r.operand;if(n.kind==="binary"){let s=S1(n.op),i=T2[s];if(i){let o=Zl(n,n.op);return new gr(i,...o.map(Pi))}}return n.kind==="unary"?Pi(n.operand):new gr("not",Pi(n))}let e=S1(r.op),t=Zl(r,r.op);return new gr(e,...t.map(Pi))}var T1={and:Bt,or:$t,not:Kt,buf:Jt};function R2(r,e){let t=T1[r];if(t)return new t(e);switch(r){case"nand":return Tn(e);case"nor":return Rn(e);case"xor":return An(e);case"xnor":return _n(e);default:return new Bt(e)}}function k1(r){return r in T1||["nand","nor","xor","xnor"].includes(r)}function A2(r,e=.7,t=2,n){let s=new lr;s.unit=t;let i=Ra(r);function o(a,l=0,h){let c=a.node==="not"||a.node==="buf",m={d:"r",at:[a.y*-t,-a.x*e],anchor:"end",l:t,...c?{}:{inputs:a.children.length}},f=R2(a.node,m);h&&f.label(h,{loc:"end"});for(let g=0;g<a.children.length;g++){let b=a.children[g],v=c?"start":`in${g+1}`;k1(b.node)||f.label(b.node,{loc:v})}s.add(f);for(let g=0;g<a.children.length;g++){let b=a.children[g],v=c?"start":`in${g+1}`;if(k1(b.node)){let x=o(b,l+1);s.add(new Hs({at:[f,v],to:x.anchors.end}))}}return f}return o(i,0,n),s}function Ql(r,e={}){let{gateW:t=2,gateH:n=.75,outlabel:s}=e,i=P2(r),o=new Kc(i).parse(),a=Pi(o);return A2(a,n,t,s)}var eh=.12,_2=.4,Ti=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,theta:0,drop:[0,0]});let n=this.params.lead!==!1?_2:0;this.segments.push(new p([[0,0],[0,-n],[-.25,-n],[.25,-n],H,[-.25*.7,-eh-n],[.25*.7,-eh-n],H,[-.25*.2,-eh*2-n],[.25*.2,-eh*2-n]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}};function R1(r="svg"){if(r==="matplotlib")throw new Error("@skillpet/circuit: use('matplotlib') is not supported; only 'svg' is available.")}function A1(r=!0,e=!0){kt({dwgbbox:r,elmbbox:e})}function _1(r="default"){switch(r){case"default":kt({bgcolor:"white",color:"black"});break;case"dark":kt({color:"white",bgcolor:"black"});break;case"solarizedd":kt({bgcolor:"#002b36",color:"#657b83"});break;case"solarizedl":kt({bgcolor:"#eee8d5",color:"#073642"});break;case"onedork":kt({bgcolor:"#373e4b",color:"#899ab8"});break;case"oceans16":kt({bgcolor:"#384151",color:"#CDD2E9"});break;case"monokai":kt({bgcolor:"#232323",color:"#BBBBBB"});break;case"gruvboxl":kt({bgcolor:"#ebdbb2",color:"#3c3836"});break;case"gruvboxd":kt({bgcolor:"#1d2021",color:"#d5c4a1"});break;case"grade3":kt({bgcolor:"#ffffff",color:"#3f3d46"});break;case"chesterish":kt({bgcolor:"#323A48",color:"#92A2BD"});break;default:throw new Error(`Unknown theme ${r}`)}}var Aa=class{constructor(){z(this,"_text","text");z(this,"_svg2",!0);z(this,"precision",3);z(this,"useBatik",!1)}get text(){return this._text}set text(e){this._text=e}get svg2(){return this._svg2}set svg2(e){this._svg2=e}},B1=new Aa;var $e=.25*.75,pt=.25*1.5,St=.25*.75,rt=class extends se{constructor(e={}){super(e),this.elmParams.theta=90,this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.5,0],.5))}},Ri=class extends rt{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[.25,-t/2],[.25,t/2]])),this.segments.push(new p([[.75-t/2,0],[.75+t/2,0]])),this.segments.push(new p([[.75,-t/2],[.75,t/2]]))}},Ai=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,0],[.75,0]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},_i=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{sin_lw:void 0,sin_color:void 0});let t=ze(-.25,.25,25),s=t.map(i=>.2*Math.sin((i-.25)*Math.PI*2/.5)+.5).map((i,o)=>[i,t[o]]);this.segments.push(new p(s,{lw:this.params.sin_lw,color:this.params.sin_color}))}},Bi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{pulse_lw:void 0,pulse_color:void 0});let t=.15,n=.4;this.segments.push(new p([[n,t*2],[n,t],[n+t,t],[n+t,-t],[n,-t],[n,-t*2]],{lw:this.params.pulse_lw,color:this.params.pulse_color}))}},Ci=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{tri_lw:void 0,tri_color:void 0}),this.segments.push(new p([[.4,.25],[.7,0],[.4,-.25]],{lw:this.params.tri_lw,color:this.params.tri_color}))}},Ii=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{ramp_lw:void 0,ramp_color:void 0}),this.segments.push(new p([[.4,.25],[.8,-.2],[.4,-.2]],{lw:this.params.ramp_lw,color:this.params.ramp_color}))}},Li=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{square_lw:void 0,square_color:void 0}),this.segments.push(new p([[.5,.25],[.7,.25],[.7,0],[.3,0],[.3,-.25],[.5,-.25]],{lw:this.params.square_lw,color:this.params.square_color}))}},Ys=class extends se{constructor(e={}){super(e),this.elmParams.theta=90,this.segments.push(new p([[0,0],[.5,.5],[1,0],[.5,-.5],[0,0],H,[1,0]]))}},br=class extends Ys{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[.25,-t/2],[.25,t/2]])),this.segments.push(new p([[.75-t/2,0],[.75+t/2,0]])),this.segments.push(new p([[.75,-t/2],[.75,t/2]]))}},wr=class extends Ys{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,0],[.75,0]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},Di=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]]))}},Ni=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e*3,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]])),this.segments.push(new p([[$e*2,pt],[$e*2,-pt]])),this.segments.push(new p([[$e*3,St],[$e*3,-St]]))}},Oi=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e*9,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]])),this.segments.push(new p([[$e*2,pt],[$e*2,-pt]])),this.segments.push(new p([[$e*3,St],[$e*3,-St]])),this.segments.push(new p([[$e*4,pt],[$e*4,-pt]])),this.segments.push(new p([[$e*5,St],[$e*5,-St]])),this.segments.push(new p([[$e*6,pt],[$e*6,-pt]])),this.segments.push(new p([[$e*7,St],[$e*7,-St]])),this.segments.push(new p([[$e*8,pt],[$e*8,-pt]])),this.segments.push(new p([[$e*9,St],[$e*9,-St]])),this.anchors.tap=[$e*4,pt]}},Fi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=.25*.5,n=t+.15,s=.4,i=this.params;this.segments.push(new p([[s,t],[s,-t]])),this.segments.push(new p([[s+.2,n],[s+.2,-n]])),this.segments.push(new p([[0,0],[s,0],H,[s+.2,0],[1,0]]));let o=i.arrowwidth,a=i.arrowlength;this.segments.push(new p([[1.1,.9],[.8,.6]],{arrow:"->",arrowwidth:o,arrowlength:a,lw:i.arrow_lw,color:i.arrow_color})),this.segments.push(new p([[1.3,.7],[1,.4]],{arrow:"->",arrowwidth:o,arrowlength:a,lw:i.arrow_lw,color:i.arrow_color}))}},$i=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"V",{halign:"center",valign:"center"}))}},ji=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"I",{halign:"center",valign:"center"}))}},qi=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"A",{halign:"center",valign:"center"}))}},Hi=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"\u03A9",{halign:"center",valign:"center"}))}},Yi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,.16],[.75,-.16]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},Xi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{filament_lw:void 0,filament_color:void 0});let t=.25,n=.7,s=ze(1.4,3.6*Math.PI,80),i=s.map(c=>t*c-n*Math.sin(c)),o=s.map(c=>t-n*Math.cos(c));i=i.map(c=>c-i[0]);let a=i[i.length-1];i=i.map(c=>c/a);let l=o.map(c=>(c-o[0])*.25),h=i.map((c,m)=>[c,l[m]]);this.segments.push(new p(h,{lw:this.params.filament_lw,color:this.params.filament_color}))}},Gi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{filament_lw:void 0,filament_color:void 0});let t=.5,n=this.params;this.segments.push(new p([[t-t/2**.5,-t/2**.5],[t+t/2**.5,t/2**.5]],{lw:n.filament_lw,color:n.filament_color})),this.segments.push(new p([[t-t/2**.5,t/2**.5],[t+t/2**.5,-t/2**.5]],{lw:n.filament_lw,color:n.filament_color}))}},Wi=class extends rt{constructor(e={}){super(e);let t=.25,n=.4;this.segments.push(new p([[n,t],[n,-t]])),this.segments.push(new p([[n+.2,t],[n+.2,-t]])),this.segments.push(new p([[0,0],[n,0],H,[n+.2,0],[1,0]])),this.segments.push(new D([n-.15,.2],.05,{fill:!0}))}},mn=class extends N{constructor(e={}){let{inputs:t,...n}=e,s=t!==!1;super(n),Object.assign(this.defaults,{width:1.5,corner:.2,input_ofst:[.4,.3],input_lw:1,input_rad:.1,input_fill:"none"});let i=this.params.width,o=this.params.corner,a=this.params.input_ofst,l=this.params.input_lw,h=this.params.input_rad;this.segments.push(new U([[0,0],[0,i],[i,i],[i,0]],{closed:!0,cornerradius:o})),s&&(this.segments.push(new D([a[0],a[1]],h,{lw:l,fill:this.params.input_fill,zorder:4})),this.segments.push(new D([i-a[0],a[1]],h,{lw:l,fill:this.params.input_fill,zorder:4}))),this.anchors.N=[i/2,i],this.anchors.S=[i/2,0],this.anchors.E=[i,i/2],this.anchors.W=[0,i/2],this.anchors.NE=[i,i],this.anchors.SE=[i,0],this.anchors.NW=[0,i],this.anchors.SW=[0,0],this.anchors.in1=[a[0],a[1]],this.anchors.in2=[i-a[0],a[1]],this.anchors.name=[i/2,0],this.elmParams.drop=this.anchors.in2}},Vi=class extends mn{constructor(e={}){super(e);let t=e.needle_percent??70;Object.assign(this.defaults,{needle_color:"black",needle_width:1.5,window_fill:"none"});let n=this.params.width,s=n/2,i=1.2,o=.86,a=.2;this.segments.push(new ut(["M",[s-n/3,i],"Q",[s,i+a],[s+n/3,i],"L",[s+n/4,o],"Q",[s,o+a*.7],[s-n/4,o],"Z"],{color:"black",fill:this.params.window_fill,lw:1}));let l=.94,h=1.2,c=(112-45*t/100)*Math.PI/180,m=[s+l*Math.cos(c),l*Math.sin(c)],f=[s+h*Math.cos(c),h*Math.sin(c)];this.segments.push(new p([m,f],{lw:this.params.needle_width,color:this.params.needle_color}))}},Ui=class extends mn{constructor(e={}){super(e);let t=e.signal??"none";Object.assign(this.defaults,{screen_fill:"none",screen_lw:1,grid:!0,grid_color:"#666666",grid_lw:.3,signal_lw:2,signal_color:"#e0213b"});let n=this.params.width,s=4,i=n*.15,o=n*.85,a=o-i,l=a/(s+1),h=l*3,c=n*.9,m=c-h;if(this.segments.push(new U([[i,m],[i,c],[o,c],[o,m]],{closed:!0,lw:this.params.screen_lw,fill:this.params.screen_fill})),this.params.grid){for(let f=0;f<s;f++){let g=i+(f+1)*l;this.segments.push(new p([[g,m],[g,c]],{lw:this.params.grid_lw,color:this.params.grid_color}))}for(let f=0;f<2;f++){let g=m+(f+1)*l;this.segments.push(new p([[i,g],[o,g]],{lw:this.params.grid_lw,color:this.params.grid_color}))}}if(t==="sine"){let f=ze(i,o,20),g=f.map(v=>m+h/2+Math.sin((v-i)/a*Math.PI*2)*(h/2)*.75),b=f.map((v,x)=>[v,g[x]]);this.segments.push(new p(b,{lw:this.params.signal_lw,color:this.params.signal_color}))}else if(t==="square"){let f=m+h/4,g=c-h/4,b=i+a/3-.1,v=i+a*2/3-.1,x=i+a-.1;this.segments.push(new p([[i,f],[b,f],[b,g],[v,g],[v,f],[x,f],[x,g],[o,g]],{lw:this.params.signal_lw,color:this.params.signal_color}))}else if(t==="triangle"){let f=m+h/4,g=c-h/4,b=i+a/3-.1,v=i+a*2/3-.1,x=i+a-.1;this.segments.push(new p([[i,f],[b,g],[v,f],[x,g],[o,g-.1]],{lw:this.params.signal_lw,color:this.params.signal_color}))}}},Ji=class extends mn{constructor(e={}){super(e),Object.assign(this.defaults,{screen_fill:"none",screen_lw:1});let t=this.params.width,n=t*.1,s=t*.9,i=t/3,o=t*.85,a=o-i;this.segments.push(new U([[n,a],[n,o],[s,o],[s,a]],{closed:!0,lw:this.params.screen_lw,fill:this.params.screen_fill})),this.anchors.display=[(n+s)/2,a]}};var th=.4,Ki=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,theta:0,drop:[0,0]});let n=this.params.lead!==!1?th:0;this.segments.push(new p([[0,0],[0,-n],[-.25,-n],[0,-n-.25],[.25,-n],[0,-n]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},Zi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0});let n=this.params.lead!==!1?th:0,s=.25*.75,i=.25;this.segments.push(new p([[0,0],[0,-n],[-s,-n-i]])),this.segments.push(new p([[0,-n],[-s,-n],[-s*2,-n-i]])),this.segments.push(new p([[0,-n],[s,-n],[0,-n-i]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},Qi=class extends N{constructor(e={}){super(e);let t=.6,n=.6,s=.38;this.segments.push(new p([[0,0],[0,t],[-s,t+n],[s,t+n],[0,t]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},eo=class extends N{constructor(e={}){super(e);let t=.2,n=.5;this.segments.push(new p([[0,0],[0,t],[-n,n+t],[t/2,n*2+1.5*t],[n+t,n+t],[t,t],[t,0]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.end=[t,0]}},to=class extends N{constructor(e={}){super(e);let t=.25,n=1,s=-n/2-t/2,i=s+t,o=n/2+t/2,a=o+t,l=t,h=t*2,c=n+h,m=c+t;this.segments.push(new p([[0,0],[0,l],[s,l],[s,c],[o,c],[o,h],[i,h],[i,m],[a,m],[a,l],[t,l],[t,0]])),this.elmParams.drop=[t,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.end=[t,0]}},ro=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0,lblloc:"bottom"});let t=.25*.75,s=this.params.lead!==!1?th:0;this.segments.push(new p([[0,0],[0,-s]])),this.segments.push(new p([[0,-s],[-t,-s]])),this.segments.push(new p([[0,-s],[t,-s]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},no=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0});let t=.25*.75,s=this.params.lead!==!1?th:0;this.segments.push(new p([[0,0],[0,s]])),this.segments.push(new p([[0,s],[-t,s]])),this.segments.push(new p([[0,s],[t,s]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},so=class extends N{constructor(e={}){super(e);let t=.25*.75,n=.25*.75;this.segments.push(new p([[-t,-n],[t,n]])),this.segments.push(new p([[-t,n],[t,-n]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.elmParams.lblofst="bottom",this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}};var le=.12,Xr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let{action:t,contacts:n=!0,nc:s=!1}=e,i=this.params;n?(s?this.segments.push(new p([[0,0],H,[le*2,0],[.9,le+.05],H,[1,0]])):this.segments.push(new p([[0,0],H,[le*2,.1],[.8,.45],H,[1,0]])),this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,0],le,{fill:"bg",zorder:3}))):s?(this.segments.push(new p([[0,0],[1.15,.45],H,[1,0]])),this.segments.push(new p([[1,0],[1,.55]]))):this.segments.push(new p([[0,0],[.85,.45],H,[1,0]])),t==="open"?this.segments.push(new xe([.4,.1],.5,.75,{theta1:-10,theta2:70,arrow:"ccw",lw:i.arrow_lw,color:i.arrow_color,arrowwidth:i.arrowwidth,arrowlength:i.arrowlength})):t==="close"&&this.segments.push(new xe([.4,.25],.5,.75,{theta1:-10,theta2:70,arrow:"cw",lw:i.arrow_lw,color:i.arrow_color,arrowwidth:i.arrowwidth,arrowlength:i.arrowlength}))}},io=class extends Xr{constructor(e={}){super(e),e.contacts!==!1?(this.segments.push(new D([1-le,.7],le,{fill:"bg",zorder:3})),this.anchors.a=[le,0],this.anchors.b=[1-le,0],this.anchors.c=[1-le,.7]):(this.anchors.a=[0,0],this.anchors.b=[1,0],this.anchors.c=[1,.7])}},Xs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let{action:t,contacts:n=!0}=e,s=this.params;n?(this.segments.push(new p([[0,0],H,[le*2,.1],[.7,.25],H,[1,.4]])),this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,.4],le,{fill:"bg",zorder:3})),this.anchors.a=[le,0],this.anchors.b=[1-le,.4],this.anchors.c=[1-le,-.4]):(this.segments.push(new p([[0,0],[.85,.25],H,[1,.4]])),this.anchors.a=[0,0],this.anchors.b=[1,.4],this.anchors.c=[1,-.4]),t==="open"?this.segments.push(new xe([.35,0],.5,.75,{theta1:-10,theta2:70,arrow:"ccw",lw:s.arrow_lw,color:s.arrow_color,arrowwidth:s.arrowwidth,arrowlength:s.arrowlength})):t==="close"&&this.segments.push(new xe([.3,0],.5,.75,{theta1:-10,theta2:70,arrow:"cw",lw:s.arrow_lw,color:s.arrow_color,arrowwidth:s.arrowwidth,arrowlength:s.arrowlength})),this.elmParams.drop=[1,.4]}},oo=class extends se{constructor(e={}){super(e);let{nc:t=!1,contacts:n=!0}=e,s,i;n?(s=[[0,0],H],i=[H,[1,0]]):(s=[[0,0],[le,0],H],i=[H,[1-le,0],[1,0]]);let o=t?-le-.05:.3,a=t?le+.15:.5,l=[[le,o],[1-le,o],H,[.5,o],[.5,a]],h=[...s,...l,...i];this.segments.push(new p(h)),n&&(this.segments.push(new D([le,0],le)),this.segments.push(new D([1-le,0],le)))}},Gs=class extends N{constructor(e={}){super(e);let t=-1,{link:n=!0,contacts:s=!0}=e,i,o;s?(i=[[0,0],H,[le*2,.1],[.8,.45],H,[1,0]],o=[[le*2,t+.1],[.8,t+.45]],this.anchors.p1=[le,0],this.anchors.t1=[1-le,0],this.anchors.p2=[le,t],this.anchors.t2=[1-le,t]):(i=[[0,0],[.8,.45],H,[1,0]],o=[[0,t],[.8,t+.45]],this.anchors.p1=[0,0],this.anchors.t1=[1,0],this.anchors.p2=[0,t],this.anchors.t2=[1,t]),this.segments.push(new p(i)),this.segments.push(new p(o)),s&&(this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([le,t],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t],le,{fill:"bg",zorder:3}))),n&&this.segments.push(new p([[.5,t+.25],[.5,.2]],{ls:":"}))}},Ws=class extends N{constructor(e={}){super(e);let t=-1.4,{link:n=!0,contacts:s=!0}=e,i,o;s?(i=[[0,0],H,[le*2,.1],[.7,.25],H,[1,.4]],o=[[le*2,t+.1],[.7,t+.25]],this.anchors.p1=[le,0],this.anchors.t1=[1-le,.4],this.anchors.t2=[1-le,-.4],this.anchors.p2=[le,t],this.anchors.t3=[1-le,t+.4],this.anchors.t4=[1-le,t-.4]):(i=[[0,0],[.7,.25],H,[1,.4]],o=[[0,t],[.7,t+.25]],this.anchors.p1=[0,0],this.anchors.t1=[1,.4],this.anchors.t2=[1,-.4],this.anchors.p2=[0,t],this.anchors.t3=[1,t+.4],this.anchors.t4=[1,t-.4]),this.segments.push(new p(i)),this.segments.push(new p(o)),s&&(this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([le,t],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t+.4],le,{fill:"bg",zorder:3}))),n&&this.segments.push(new p([[.5,t+.25],[.5,.2]],{ls:":"}))}},ao=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[.85,.15],H,[.8,0]]));let t=.3,n=ze(-Math.PI/2,Math.PI/2,32),s=n.map(m=>-t*Math.cos(m)),i=n.map(m=>t*Math.sin(m)),o=s.map(m=>1-m),a=[...i].reverse(),l=[...s,...o,s[0]],h=[...i,...a,i[0]],c=l.map((m,f)=>[m,h[f]]);this.segments.push(new p(c))}},lo=class extends N{constructor(e={}){super(e);let t=e.n??4,n=e.dtheta,s=e.radius??1,i=e.arrowlen??.75,o=e.arrowcontact??0;this.elmParams.fill="bg",this.elmParams.zorder=4,this.segments.push(new D([0,0],le)),this.anchors.P=[0,0],n===void 0&&(n=Math.min(35,360/(t+1)));let a=n*Math.PI/180,l=e.theta0;l===void 0?l=-a*(t-1)/2:l=l*Math.PI/180;for(let h=0;h<t;h++){let c=l+a*h,m=s*Math.cos(c),f=s*Math.sin(c);if(this.segments.push(new D([m,f],le)),this.anchors[`T${h+1}`]=[m,f],h===o){let g=i*Math.cos(c),b=i*Math.sin(c);this.segments.push(new p([[0,0],[g,b]],{arrow:"->",zorder:2}))}}}},ho=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{switchcolor:"#333333",swidth:.4,spacing:.2});let t=e.n??3,n=e.pattern,s=this.params.swidth,i=this.params.spacing,o=s*t+i*(t+1),a=s*2+i*2;this.segments.push(new U([[0,0],[o,0],[o,a],[0,a]]));for(let l=0;l<t;l++){let h=i*(l+1)+s*l,c=n?n[l]:!1,m=n?!n[l]:!1;this.segments.push(new U([[h,i+s],[h+s,i+s],[h+s,i+s*2],[h,i+s*2]],{fill:c?this.params.switchcolor:void 0})),this.segments.push(new U([[h,i],[h+s,i],[h+s,i+s],[h,i+s]],{fill:m?this.params.switchcolor:void 0})),this.anchors[`a${l+1}`]=[h+s/2,0],this.anchors[`b${l+1}`]=[h+s/2,a]}}};var co=class extends N{constructor(e={}){super(e);let t=.5;this.segments.push(new p([[0,0],[.25,0]])),this.segments.push(new p([[0,-t],[.25,-t]])),this.segments.push(new U([[.25,t/2],[.25,-t*1.5],[.25*2,-t*1.5],[.25*2,t/2]])),this.segments.push(new U([[.25*2,t/2],[.25*3.5,t*1.25],[.25*3.5,-t*2.25],[.25*2,-t*1.5]],{closed:!1})),this.anchors.in1=[0,0],this.anchors.in2=[0,-t],this.elmParams.drop=[0,-t]}},uo=class extends N{constructor(e={}){super(e);let t=.5;this.segments.push(new p([[0,0],[.25,0]])),this.segments.push(new p([[0,-t],[.25,-t]])),this.segments.push(new p([[-.25*2,.25],[-.25*2,-.25*3]])),this.segments.push(new xe([-.25*2,-.25],.25*4,.25*4,{theta1:270,theta2:90})),this.anchors.in1=[.25,0],this.anchors.in2=[.25,-t],this.elmParams.drop=[0,-t]}},mo=class extends se{constructor(e={}){super(e);let t=.22;this.segments.push(new p([[-t,0],[-t,0],H,[1+t,0],[1+t,0]])),this.segments.push(new p([[0,-t],[-t,-t],[-t,t],[0,t]])),this.segments.push(new p([[1,-t],[1+t,-t],[1+t,t],[1,t]])),this.segments.push(new D([.5,0],.5))}},po=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!0});let{ring:t=!1,ringswitch:n=!1,dots:s=!0,switch:i=!1}=e,o=this.params.open?"bg":void 0,a=this.params.radius,l=2,h=.75,c=.55,m=.2,f=1,g=1,b=.1,v=.35,x=.4,S=.5;i&&(g+=.2),t&&n&&(v+=.2,b-=.2),t?(s&&this.segments.push(new D([0,-v],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,-v],[-l,-v],[-l,0],[-l,f],[-l-m,f],[-l-m,0],[-l,0]])),this.anchors.sleeve=[0,-v],s&&this.segments.push(new D([0,b],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,b],[-l*.75,b],[-l*h-2*a,b+2*a],[-l*h-a*4,b]])),this.anchors.ring=[0,b]):(s&&this.segments.push(new D([0,0],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,0],[-l,0],[-l,f],[-l+m,f],[-l+m,0]])),this.anchors.sleeve=[0,0]),s&&this.segments.push(new D([0,g],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,g],[-l*.55,g],[-l*c-2*a,g-2*a],[-l*c-a*4,g]])),this.anchors.tip=[0,g],i&&(s&&this.segments.push(new D([0,g-x],a,{fill:o,zorder:4})),this.segments.push(new p([[0,g-x],[-S,g-x]])),this.segments.push(new p([[-S,g-x],[-S,g]],{arrow:"->"})),this.anchors.tipswitch=[0,g-x]),t&&n&&(s&&this.segments.push(new D([0,b+x],a,{fill:o,zorder:4})),this.segments.push(new p([[0,b+x],[-S,b+x]])),this.segments.push(new p([[-S,b+x],[-S,b]],{arrow:"->"})),this.anchors.ringswitch=[0,b+x])}};var fo=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{length:3,leadlen:.6,radius:.3});let t=this.params.leadlen,n=this.params.length,s=this.params.radius;this.segments.push(new p([[0,0],[t,0],H,[n-t+s/2,0],[n,0]])),this.segments.push(new p([[t,s],[n-t,s]])),this.segments.push(new p([[t,-s],[n-t,-s]])),this.segments.push(new xe([t,0],s,s*2,{theta1:0,theta2:360})),this.segments.push(new xe([n-t,0],s,s*2,{theta1:270,theta2:90})),this.anchors.shieldstart=[t,-s],this.anchors.shieldstart_top=[t,s],this.anchors.shieldend=[n-t,-s],this.anchors.shieldend_top=[n-t,s],this.anchors.shieldcenter=[n/2,-s],this.anchors.shieldcenter_top=[n/2,s]}},go=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{length:3,leadlen:.6,radiusinner:.3,radiusouter:.6,shieldofststart:.3,shieldofstend:.3});let t=this.params.radiusinner,n=this.params.radiusouter,s=this.params.length,i=this.params.leadlen,o=this.params.shieldofstend,a=this.params.shieldofststart;if(n<t)throw new Error("Triax inner radius > outer radius");let l=n/2*Math.sqrt(1-t*t/(n*n)),h=180;a-l>-t/2&&(h=180-Math.atan2(t,l)*180/Math.PI),s-i-o+n<s?(this.segments.push(new p([[0,0],[i,0],H,[s-i+t/2,0],[s,0]])),this.segments.push(new p([[s-i-o+l,t],[s-i,t]])),this.segments.push(new p([[s-i-o+l,-t],[s-i,-t]])),this.segments.push(new xe([s-i,0],t,t*2,{theta1:270,theta2:90}))):this.segments.push(new p([[0,0],[i,0],H,[s-i-o+n/2,0]])),this.segments.push(new p([[i,t],[i+a+l,t]])),this.segments.push(new p([[i,-t],[i+a+l,-t]])),this.segments.push(new p([[i+a,n],[s-i-o,n]])),this.segments.push(new p([[i+a,-n],[s-i-o,-n]])),this.segments.push(new xe([i,0],t,t*2,{theta1:0,theta2:360})),this.segments.push(new xe([i+a,0],n,n*2,{theta1:-h,theta2:h})),this.segments.push(new xe([s-i-o,0],n,n*2,{theta1:270,theta2:90})),this.anchors.guardstart=[i,-t],this.anchors.guardstart_top=[i,t],this.anchors.guardend=[s-i,-t],this.anchors.guardend_top=[s-i,t],this.anchors.shieldstart=[i+a,-n],this.anchors.shieldstart_top=[i+a,n],this.anchors.shieldend=[s-i-o,-n],this.anchors.shieldend_top=[s-i-o,n],this.anchors.shieldcenter=[s/2,-n],this.anchors.shieldcenter_top=[s/2,n]}};var bo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{core:!0,loop:!1,corewidth:.75,phasegap:.4,arcwidth:.4});let t=e.t1??4,n=e.t2??4;typeof t=="number"&&(t=[t]),typeof n=="number"&&(n=[n]);let s=t,i=n,o=this.params.phasegap,a=this.params.loop,l=this.params.core,h=e.align??"center",c=this.params.corewidth;a&&(c+=.4),l&&(c+=.25);let m=0,f,g,b,v=(x,S)=>{if(h==="center"){let k=x/2-S/2;return[k,k+S]}else return h==="bottom"?[0,S]:[x-S,x]};if(a){let x=s.map(re=>Vn(re,[0,0],.06,.19,!1,!0,!1)),S=i.map(re=>Vn(re,[c,0],.06,.19,!1,!0,!0)),k=x.reduce((re,te)=>re+te[te.length-1][1],0)+o*(x.length-1),M=S.reduce((re,te)=>re+te[te.length-1][1],0)+o*(S.length-1);f=k,[g,b]=v(k,M);let _=.06,B=.19,$=Math.acos(_/B),Y=Math.PI*2*_,Z=Y-(_*$-B*Math.sin($)),I=(_-B)/2/.25,X=m,j=0;for(let re=0;re<x.length;re++){let te=x[re],ke=te[te.length-1][1],he=te.map(de=>[de[0],de[1]+X]);this.segments.push(new p(he)),this.anchors[`p${re*2+1}`]=he[0],this.anchors[`p${re*2+2}`]=he[he.length-1],f=he[he.length-1][1];let ve=0;for(ve=0;ve<s[re];ve++)this.anchors[`tapP${j+ve+1}`]=[I,he[0][1]+ve*Y+Z];j+=ve,X+=ke+o}X=g,j=0;for(let re=0;re<S.length;re++){let te=S[re],ke=te[te.length-1][1],he=te.map(de=>[de[0],de[1]+X]);this.segments.push(new p(he)),this.anchors[`s${re*2+1}`]=he[0],this.anchors[`s${re*2+2}`]=he[he.length-1],b=he[he.length-1][1];let ve=0;for(ve=0;ve<i[re];ve++)this.anchors[`tapS${j+ve+1}`]=[c-I,he[0][1]+ve*Y+Z];j+=ve,X+=ke+o}}else{let x=this.params.arcwidth,S=s.reduce((B,$)=>B+$,0)*x+o*(s.length-1),k=i.reduce((B,$)=>B+$,0)*x+o*(i.length-1);f=S,[g,b]=v(S,k);let M=m,_=0;for(let B=0;B<s.length;B++){let $=s[B];this.anchors[`p${B*2+2}`]=[0,M],this.anchors[`p${B*2+1}`]=[0,M+$*x];for(let Y=0;Y<$;Y++)this.segments.push(new xe([0,M+x/2],x,x,{theta1:270,theta2:90})),Y<$-1&&(this.anchors[`tapP${_+Y+1}`]=[0,M+x]),M+=x;_+=$-1,M+=o}M=g,_=0;for(let B=0;B<i.length;B++){let $=i[B];this.anchors[`s${B*2+2}`]=[c,M],this.anchors[`s${B*2+1}`]=[c,M+$*x];for(let Y=0;Y<$;Y++)this.segments.push(new xe([c,M+x/2],x,x,{theta1:90,theta2:270})),Y<$-1&&(this.anchors[`tapS${_+Y+1}`]=[c,M+x]),M+=x;_+=$-1,M+=o}}if(l){let x=Math.max(f,b),S=Math.min(m,g),k=c/2,M=c/10;this.segments.push(new p([[k-M,x],[k-M,S]])),this.segments.push(new p([[k+M,x],[k+M,S]]))}}tap(e,t,n="primary"){let s=n==="primary"?"P":"S",i;if(t===0?i=this.anchors[`${s.toLowerCase()}1`]:i=this.anchors[`tap${s}${t}`],i)this.anchors[e]=i;else throw new Error(`No tap at position ${t}`);return this}};function B2(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}var rh=.25,dn=class extends Pe{constructor(e={}){let{double:t,...n}=e;super({...n,arrow:t?"<->":e.arrow??"->"}),this.anchors.center=[0,0]}},wo=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[-rh/2,rh],[rh/2,-rh],H,[0,0]]))}},Xt=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{lblloc:"center",lblalign:["center","center"],lblofst:0}),this.segments.push(new p([[0,0],H,[1,0]],{visible:!1}))}},pn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!1});let n=this.params.open===!0?"bg":!0;this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0],this.elmParams.drop=[0,0],this.elmParams.theta=0,this.elmParams.zorder=4,this.elmParams.fill=n,this.segments.push(new D([0,0],this.params.radius,{fill:n}))}},xo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{headwidth:.15,headlength:.25,lblofst:.25});let t=this.params.headwidth,n=this.params.headlength;this.segments.push(new p([[-n,0],[0,0]],{arrowwidth:t,arrowlength:n,arrow:"->"})),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},vo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!1});let t=this.params.radius,n=this.params.open?"bg":!0;this.elmParams.fill=n,this.segments.push(new D([.5,0],t)),this.segments.push(new D([1,0],t)),this.segments.push(new D([1.5,0],t)),this.elmParams.drop=[2,0]}},xr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{zorder:0});let t=e.corner1??[0,0],n=e.corner2??[1,1],s=[t[0],n[1]],i=[n[0],t[1]];this.segments.push(new U([t,s,n,i],{closed:!0,zorder:0,fill:e.fill,lw:e.lw,ls:e.ls}))}},yo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{shape:"-",k:1,to:[3,-2],dotradius:.075})}to(e,t=0,n=0){let s=A.fromXY(B2(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}dot(e=!1){return this.userParams.dot=e?"open":!0,this}idot(e=!1){return this.userParams.idot=e?"open":!0,this}shape(e){return this.userParams.shape=e,this}k(e){return this.userParams.k=e,this}arrow(e){return this.userParams.arrow=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a=this.params.arrow,l=this.params.shape,h=this.params.k??1,c,m;if(o!==void 0?(c=o[0],m=o[1]):(c=i[0]-s[0],m=i[1]-s[1]),this.segments=[],l==="-")this.segments.push(new p([[0,0],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2];else if(l==="-|")this.segments.push(new p([[0,0],[c,0],[c,m]],{arrow:a})),this.anchors.mid=[c,m/2],this.elmParams.droptheta=m>0?90:-90;else if(l==="|-")this.segments.push(new p([[0,0],[0,m],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m],this.elmParams.droptheta=c>0?0:180;else if(l==="z"||l==="Z"){let g=c>0?Math.abs(h):-Math.abs(h);this.segments.push(new p([[0,0],[g,0],[c-g,m],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2],this.elmParams.droptheta=c>0?0:180}else if(l==="N"){let g=m>0?Math.abs(h):-Math.abs(h);this.segments.push(new p([[0,0],[0,g],[c,m-g],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2],this.elmParams.droptheta=m>0?90:-90}else if(l==="n")this.segments.push(new p([[0,0],[0,h],[c,h],[c,m]],{arrow:a})),this.anchors.mid=[c/2,h],this.elmParams.droptheta=m>h?90:-90;else if(l==="c")this.segments.push(new p([[0,0],[h,0],[h,m],[c,m]],{arrow:a})),this.anchors.mid=[h,m/2],this.elmParams.droptheta=c>h?0:180;else throw new Error(`Wire: undefined shape ${l}`);let f=T(this.params,"dotradius",.075);if(this.params.dot){let b=this.params.dot==="open"?"bg":!0;this.segments.push(new D([c,m],f,{fill:b,zorder:3}))}if(this.params.idot){let b=this.params.idot==="open"?"bg":!0;this.segments.push(new D([0,0],f,{fill:b,zorder:3}))}return this.elmParams.lblloc="mid",this.elmParams.drop=[c,m],this.anchors.start=[0,0],this.anchors.end=[c,m],this._positioned=!0,super._place(e,t,n)}},So=class extends N{constructor(e={}){super(e),this.elmParams.lblloc="center",this.elmParams.lblofst=0;let t=e.label;t!==void 0&&t!==""&&this.label(t)}},ko=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{width:1.5,height:.625,lblloc:"center",fontsize:12,lblofst:0});let t=e.width??1.5,n=(e.height??.625)/2;this.segments.push(new U([[0,0],[n,n],[t,n],[t,-n],[n,-n]],{closed:!0})),this.anchors.start=[0,0];let s=e.s;s&&this.segments.push(new W([t/2,0],s,{fontsize:12}))}};function Qc(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}function C1(r,e,t=.01){return Math.abs(r-e)<=t}function I1(r){let e=r.absanchors.center;if(e!==void 0)return e;let t=r.getBBox(!1,!1),n=(t.xmin+t.xmax)/2,s=(t.ymin+t.ymax)/2;return r.transform.transform([n,s])}var Mo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{k:.5})}to(e,t=0,n=0){let s=A.fromXY(Qc(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}k(e){return this.userParams.k=e,this}arrow(e){return this.userParams.arrow=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??[s[0]+3,s[1]],o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.k??.5,c=[a/2-l*h,l/2+a*h],m=[a/2-l*h/2,l/2+a*h/2],f=this.params.arrow;this.segments.push(new Ut([[0,0],c,[a,l]],{arrow:f})),this.anchors.ctrl=c,this.anchors.mid=m,this.anchors.start=[0,0],this.anchors.end=[a,l],this.elmParams.lblloc="mid",this.elmParams.drop=[a,l];let g="bottom",b="left",v=.1,x=0;return C1(m[1],c[1])?(g="center",v=0):m[1]>c[1]&&(g="top",v=-.1),C1(m[0],c[0])?b="center":m[0]>c[0]?(b="right",v=0,x=-.1):(x=.1,v=0),this.elmParams.lblofst=[x,v],this.elmParams.lblalign=[b,g],this._positioned=!0,super._place(e,t,n)}},fn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{k:.75,th1:0,th2:180,to:[1,0],arrowlength:.25,arrowwidth:.2})}to(e,t=0,n=0){let s=A.fromXY(Qc(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}k(e){return this.userParams.k=e,this}th1(e){return this.userParams.th1=e,this}th2(e){return this.userParams.th2=e,this}arrow(e){return this.userParams.arrow=e,this}arrowlength(e){return this.userParams.arrowlength=e,this}arrowwidth(e){return this.userParams.arrowwidth=e,this}setLabelAlign(e,t){this.elmParams.lblloc="center";let n="left",s="bottom";t>0&&(s="top",this.elmParams.lblofst=-.1),e<=0&&(n="right"),this.elmParams.lblalign=[n,s]}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.userParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.k??.75,c=(this.params.th1??0)*(Math.PI/180),m=(this.params.th2??180)*(Math.PI/180),f=[a*h*Math.cos(c),l*h*Math.sin(c)],g=[a+a*h*Math.cos(m),l+l*h*Math.sin(m)],b=this.params.arrow,v=this.params.arrowlength,x=this.params.arrowwidth;return this.segments.push(new Ut([[0,0],f,g,[a,l]],{arrow:b,arrowlength:v,arrowwidth:x})),this.anchors.center=[a/2,l/2],this.anchors.start=[0,0],this.anchors.end=[a,l],this.anchors.ctrl1=f,this.anchors.ctrl2=g,this.elmParams.drop=[a,l],this.setLabelAlign(a,l),this._positioned=!0,super._place(e,t,n)}},zo=class extends fn{constructor(e={}){super({...e,to:e.to??[1,1],th1:e.th1??75,th2:e.th2??180,arrow:e.arrow??"<-"})}setLabelAlign(e,t){this.elmParams.lblloc="end";let n=this.anchors.ctrl2,s=this.anchors.end,i;for(n[0]===s[0]&&n[1]===s[1]?i=t<0?-90:90:i=Math.atan2(s[1]-n[1],s[0]-n[0])*180/Math.PI;i<0;)i+=360;i<45||i>315?(this.elmParams.lblalign=["left","center"],this.elmParams.lblofst=[.1,0]):i>=45&&i<=135?(this.elmParams.lblalign=["center","bottom"],this.elmParams.lblofst=[0,.1]):i>135&&i<=225?(this.elmParams.lblalign=["right","center"],this.elmParams.lblofst=[-.1,0]):(this.elmParams.lblalign=["center","top"],this.elmParams.lblofst=[0,-.1])}},Eo=class extends fn{constructor(e={}){super({...e,th1:0,th2:180})}},Po=class extends fn{constructor(e={}){super({...e,th1:90,th2:-90})}},To=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.6,arrowlength:.25,arrowwidth:.2})}to(e,t=0,n=0){let s=A.fromXY(Qc(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}radius(e){return this.userParams.radius=e,this}arrow(e){return this.userParams.arrow=e,this}arrowlength(e){return this.userParams.arrowlength=e,this}arrowwidth(e){return this.userParams.arrowwidth=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.radius??.6,c=a/2,m=l/2,f=Math.sqrt(a*a+l*l),g=h*h-f/2*(f/2);if(g<0)throw new Error(`ArcLoop: no solution for radius ${h}`);let b=Math.sqrt(g),v=[c+b*(-l/f),m+b*(a/f)],x=Math.sqrt(c*c+m*m),S=Math.atan2(m,c),k=Math.acos(x/h),M=S-k,_=S+k,B=ze(Math.PI+_,M,50),$=[],Y=[];for(let re of B)$.push(v[0]+h*Math.cos(re)),Y.push(v[1]+h*Math.sin(re));let Z=$.map((re,te)=>[re,Y[te]]),L=this.params.arrow,I=this.params.arrowlength,X=this.params.arrowwidth;this.segments.push(new p(Z,{arrow:L,arrowlength:I,arrowwidth:X}));let j=Math.floor($.length/2);return this.anchors.start=[0,0],this.anchors.end=[$[$.length-1],Y[Y.length-1]],this.anchors.mid=[$[j],Y[j]],this.anchors.BL=[Math.min(...$),Math.min(...Y)],this.anchors.BR=[Math.max(...$),Math.min(...Y)],this.anchors.TL=[Math.min(...$),Math.max(...Y)],this.anchors.TR=[Math.max(...$),Math.max(...Y)],this.elmParams.lblloc="mid",this.elmParams.drop=[i[0]-s[0],i[1]-s[1]],this.elmParams.lblofst=[0,.2],Y[j]<Y[0]&&(this.elmParams.lblofst=[0,-.25]),this._positioned=!0,super._place(e,t,n)}},h0=class extends N{constructor(t={}){super(t);z(this,"_side","top");Object.assign(this.defaults,{ofst:.15,length:2,top:!0,reverse:!1,headlength:.3,headwidth:.2,anchor:"center",drop:null}),this.anchors.center=[0,0]}at(t,n=0,s=0){return t instanceof N?(this.userParams.overElement=t,this):super.at(t,n,s)}over(t){return this.userParams.overElement=t,this}placeArrowSegment(t){let n=this.params.ofst??.15,s=this.params.length??2;this._side==="bottom"&&(n=-n);let i=[-s/2,n],o=[s/2,n],a=this.params.headwidth??.2,l=this.params.headlength??.3;this.segments.push(new p([i,o],{arrow:"->",arrowwidth:a,arrowlength:l}))}placeFromOverElement(t){let n=String(T(t.params,"ilabel","top")).toLowerCase();n==="bot"&&(n="bottom"),this.params.top!==!1||(n={top:"bottom",bottom:"top",left:"right",right:"left"}[n]??n);let i=this.userParams.reverse===!0;if(t.userParams.reverse===!0){let f={left:"right",right:"left"};f[n]!==void 0?n=f[n]:i=!i}t.userParams.flip===!0&&(n==="left"||n==="right")&&(i=!i),n==="left"&&(i=!i),this.userParams.reverse=i;let o=t.transform.theta,a=t.getBBox(!1,!1),l,h;n==="top"?(l=new A((a.xmin+a.xmax)/2,a.ymax),h="top"):n==="bottom"?(l=new A((a.xmin+a.xmax)/2,a.ymin),h="bot"):n==="right"?(l=new A(a.xmax,(a.ymin+a.ymax)/2),h="bot",o-=90):n==="left"?(l=new A(a.xmin,(a.ymin+a.ymax)/2),h="top",o+=90):(l=new A((a.xmin+a.xmax)/2,a.ymax),h="top");let c=t.transform.transform(l.toTuple());this.userParams.at=[c.x,c.y],this.userParams.theta=o,this.elmParams.lblloc=h,this._side=n==="bottom"?"bottom":n==="top"?"top":n==="left"?"left":"right";let m=t.userParams.color;m!==void 0&&(this.userParams.color=m)}_place(t,n,s){this.dwgParams={...s};let i=this.params.overElement;i!==void 0&&this.placeFromOverElement(i),this.segments=[];let o=((this.params.theta??0)%360+360)%360,a=this.params.lblloc??"top",l=this._side;if(l==="right"&&(o<=90||o>270)){let h=this.elmParams.lblloc??"top";this.elmParams.lblloc=h==="bot"?"top":"bot",a=this.elmParams.lblloc}else if((l==="top"||l==="left"||l==="bottom")&&o>90&&o<=270){let h=this.elmParams.lblloc??"top";this.elmParams.lblloc=h==="bot"?"top":"bot",a=this.elmParams.lblloc}return this.placeArrowSegment(a),super._place(t,n,s)}},Ro=class extends h0{constructor(e={}){super(e),Object.assign(this.defaults,{length:1.75,ofst:.075,bend:.6})}placeArrowSegment(e){let t=this.params.ofst??.075,n=this.params.bend??.6,s=this.params.length??1.75;this._side==="bottom"&&(t=-t,n=-n);let i=this.params.headwidth??.2,o=this.params.headlength??.3,a=this.params.reverse===!0?"<-":"->",l=[-s/2,t],h=[s/2,t],c=[0,n];this.segments.push(new Ut([l,c,h],{arrow:a,arrowlength:o,arrowwidth:i}))}},gn=class extends N{constructor(e="in",t=.8,n=!0,s={}){super(s),Object.assign(this.defaults,{headlength:.3,headwidth:.3}),this.elmParams.lblofst=0,this.elmParams.drop=null,this.elmParams.zorder=4;let i=t,o=this.params.headlength??.3;e==="in"&&(i+=this.params.headlength??.3,o=-o),n&&(i=-i,o=-o);let a=this.params.headwidth??.3,l=this.params.headlength??.3;this.segments.push(new p([[i,0],[i+o,0]],{arrow:"->",arrowwidth:a,arrowlength:l}))}at(e,t=0,n=0){return e instanceof N?(this.userParams.overElement=e,this):super.at(e,t,n)}over(e){return this.userParams.overElement=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.overElement;if(s!==void 0){let i=I1(s);this.userParams.at=[i.x,i.y],this.userParams.theta=s.transform.theta;let o=s.userParams.color;o!==void 0&&(this.userParams.color=o)}return this._positioned=!0,super._place(e,t,n)}},Ao=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{ofst:.5,hofst:.4,length:1,lengthtip:.5,headlength:.25,headwidth:.15}),this.userParams.anchor="center",this.anchors.center=[0,0]}at(e,t=0,n=0){return e instanceof N?(this.userParams.overElement=e,this):super.at(e,t,n)}over(e){return this.userParams.overElement=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.overElement;if(s!==void 0){let v=I1(s);this.userParams.at=[v.x,v.y];let x=s.transform.theta;(x%360+360)%360>90&&(x%360+360)%360<=270&&(x+=180),this.userParams.theta=x;let S=s.userParams.color;S!==void 0&&(this.userParams.color=S)}let i=this.params.hofst??.4,o=this.params.ofst??.5,a=this.params.lengthtip??.5,l=this.params.length??1,h=this.params.headwidth??.15,c=this.params.headlength??.25,m=[-i,o],f=[-i-a,o],g=[-i-a,o-l];this.anchors.head=m,this.anchors.tail=g,this.segments=[],this.segments.push(new p([g,f,m],{arrow:"->",arrowwidth:h,arrowlength:c})),this.elmParams.lblloc="tail";let b=this.params.theta??0;return this.params.flip===!0&&(b+=180),b-=90,b=(b%360+360)%360,b<45||b>315?(this.elmParams.lblalign=["left","center"],this.elmParams.lblofst=[0,-.1]):b>=45&&b<=135?(this.elmParams.lblalign=["center","bottom"],this.elmParams.lblofst=[0,.1]):b>135&&b<=225?(this.elmParams.lblalign=["right","center"],this.elmParams.lblofst=[0,.1]):(this.elmParams.lblalign=["center","top"],this.elmParams.lblofst=[0,-.1]),this._positioned=!0,super._place(e,t,n)}},c0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lblloc:"center",lblofst:0,theta:0});let t=e.direction??"cw",n=e.theta1??35,s=e.theta2??-35,i=e.width??1,o=e.height??1;this.segments.push(new xe([0,0],i,o,{theta1:n,theta2:s,arrow:t})),this.anchors.center=[0,0]}},nh=class extends c0{constructor(e){At(null);let{elm_list:t,pad:n=.2,...s}=e,i=t[0].getBBox(!0,!1),o=t[1].getBBox(!0,!1),a=t[2].getBBox(!0,!1),l=t[3].getBBox(!0,!1),h=i.ymin-n,c=a.ymax+n,m=l.xmax+n,f=o.xmin-n,g=[(m+f)/2,(h+c)/2],b=f-m,v=h-c;super({...s,width:b,height:v,at:g})}},sh=class extends N{constructor(e){At(null);let{elm_list:t,includelabels:n=!0,...s}=e;super(s),Object.assign(this.defaults,{padx:.2,pady:.2,theta:0});let i=1/0,o=-1/0,a=1/0,l=-1/0;for(let k of t){let M=k.getBBox(!0,n);i=Math.min(i,M.xmin),o=Math.max(o,M.xmax),a=Math.min(a,M.ymin),l=Math.max(l,M.ymax)}let h=this.params.padx??.2,c=this.params.pady??.2;i-=h,o+=h,a-=c,l+=c;let m=o-i,f=l-a,g=[(o+i)/2,(l+a)/2];this.userParams.at=g,this.segments.push(new xe([0,0],m,f,{theta1:0,theta2:360}));let b=Math.sin(Math.PI/4),v=Math.cos(Math.PI/4),x=Math.sin(Math.PI/8),S=Math.cos(Math.PI/8);this.anchors.N=[0,f/2],this.anchors.S=[0,-f/2],this.anchors.E=[m/2,0],this.anchors.W=[-m/2,0],this.anchors.SE=[m/2*v,-f/2*b],this.anchors.SW=[-m/2*v,-f/2*b],this.anchors.NW=[-m/2*v,f/2*b],this.anchors.NE=[m/2*v,f/2*b],this.anchors.ENE=[m/2*S,f/2*x],this.anchors.WNW=[-m/2*S,f/2*x],this.anchors.ESE=[m/2*S,-f/2*x],this.anchors.WSW=[-m/2*S,-f/2*x],this.anchors.NNE=[m/2*x,f/2*S],this.anchors.NNW=[-m/2*x,f/2*S],this.anchors.SSE=[m/2*x,-f/2*S],this.anchors.SSW=[-m/2*x,-f/2*S]}},ih=class extends N{constructor(e){At(null);let{elm_list:t,includelabels:n=!0,...s}=e;super(s),Object.assign(this.defaults,{cornerradius:.3,padx:.2,pady:.2,theta:0});let i=1/0,o=-1/0,a=1/0,l=-1/0;for(let x of t){let S=x.getBBox(!0,n);i=Math.min(i,S.xmin),o=Math.max(o,S.xmax),a=Math.min(a,S.ymin),l=Math.max(l,S.ymax)}let h=this.params.padx??.2,c=this.params.pady??.2;i-=h,o+=h,a-=c,l+=c;let m=o-i,f=l-a,g=[(o+i)/2,(l+a)/2];this.userParams.at=g;let b=this.params.cornerradius??.3;this.segments.push(new U([[-m/2,f/2],[m/2,f/2],[m/2,-f/2],[-m/2,-f/2]],{closed:!0,cornerradius:b}));let v=b-b*Math.sqrt(2)/2;this.anchors.NE=[m/2-v,f/2-v],this.anchors.NW=[-m/2+v,f/2-v],this.anchors.SE=[m/2-v,-f/2+v],this.anchors.SW=[-m/2+v,-f/2+v],this.anchors.N=[0,f/2],this.anchors.S=[0,-f/2],this.anchors.E=[m/2,0],this.anchors.W=[-m/2,0]}};var ir=class extends N{constructor(t={}){super(t);z(this,"compoundDwgParams");z(this,"elements",[]);z(this,"_here",new A(0,0));z(this,"_theta",0);this.compoundDwgParams={unit:t.unit??3,font:t.font??null,fontsize:t.fontsize??14,lblofst:t.lblofst??.1,color:t.color??"black",lw:t.lw??2,ls:t.ls??"-",fill:t.fill??"none"};let n=la(!0);try{this.setup(),this._initAnchors()}finally{la(n)}}_initAnchors(){for(let[t,n]of Object.entries(this))if(n instanceof N&&t!=="elements")for(let s of Object.keys(n.anchors)){let i=n.absanchors[s];i&&(this.anchors[`${t}.${s}`]=[i.x,i.y])}}move(t,n){this._here=new A(this._here.x+t,this._here.y+n)}moveFrom(t,n=0,s=0,i){let o=t instanceof A?t.x:t[0],a=t instanceof A?t.y:t[1];this._here=new A(o+n,a+s),i!==void 0&&(this._theta=i)}contains(t){return this.elements.includes(t)}add(t){this.elements.push(t);let n=t._place(this._here.toTuple(),this._theta,this.compoundDwgParams);this._here=n.point,this._theta=n.theta;for(let s of t.segments){let i=s.xform(t.transform,t.params);this.segments.push(i)}return t}};function fe(r,e){let t=r.absanchors[e];return[t.x,t.y]}var _o=class extends ir{constructor(e={}){super({...e,unit:1.5,_box:e.box!==!1,_boxfill:e.boxfill??"none",_boxpad:e.boxpad??.2,_base:e.base===!0})}setup(){let t=this.userParams._box!==!1,n=this.userParams._boxfill??"none",s=this.userParams._boxpad??.2,i=this.userParams._base===!0,o=this.add(new et({d:"d"})),a=new Ht({d:"r",at:[1,-1.5/2]});a.segments.splice(0,1);let l=this.add(a);this.add(new dn({d:"r",at:[.5,-1.5/2+.2],l:.6,arrowwidth:.15,arrowlength:.2})),this.add(new dn({d:"r",at:[.5,-1.5/2-.2],l:.6,arrowwidth:.15,arrowlength:.2}));let h=this.getBBox(!1);if(t&&this.add(new xr({d:"r",at:[0,0],corner1:[h.xmin-s,h.ymin-s],corner2:[h.xmax+s,h.ymax+s],fill:n,zorder:0})),i){let b=l.getBBox(!0),v=o.absanchors.center;this.add(new Pe({d:"l",at:[b.xmin,v.y],l:.15}));let x=this.add(new Pe({d:"d",toy:h.ymax+s}));this.anchors.base=fe(x,"end")}let c=this.add(new Pe({d:"r",at:fe(a,"collector"),l:s})),m=this.add(new Pe({d:"r",at:fe(a,"emitter"),l:s})),f=this.add(new Pe({d:"l",at:fe(o,"start"),tox:h.xmin-s})),g=this.add(new Pe({d:"l",at:fe(o,"end"),tox:h.xmin-s}));this.anchors.anode=fe(f,"end"),this.anchors.cathode=fe(g,"end"),this.anchors.emitter=fe(m,"end"),this.anchors.collector=fe(c,"end")}},Bo=class extends ir{constructor(e={}){super(e)}setup(){let e=this.userParams.fill??!1,t=this.userParams.labels,n=new et({fill:e}).theta(45),s=new et({fill:e}).theta(-45),i=new et({fill:e}).theta(-135).reverse(),o=new et({fill:e}).theta(135).reverse(),a=["top","top","bottom","bottom"];t&&[n,s,i,o].forEach((l,h)=>{t[h]&&l.label(t[h],{loc:a[h]})}),this.add(n),this.add(s),this.add(i),this.add(o),this.anchors.W=fe(n,"start"),this.anchors.N=fe(s,"start"),this.anchors.E=fe(i,"start"),this.anchors.S=fe(o,"start"),this.elmParams.theta=0}},Co=class extends ir{constructor(e={}){super(e)}setup(){let e=this.userParams.vout===!0,t=this.userParams.labels,n=new dt().theta(45),s=new dt().theta(-45),i=new dt().theta(-135),o=new dt().theta(135),a=["top","top","bottom","bottom"];if(t&&[n,s,i,o].forEach((l,h)=>{t[h]&&l.label(t[h],{loc:a[h]})}),this.add(n),this.add(s),this.add(i),this.add(o),e){let l=n.absanchors.start;this.add(new Pe({}).right().at([l.x,l.y]).length(1));let h=this.add(new pn({open:!0})),c=i.absanchors.start;this.add(new Pe({}).left().at([c.x,c.y]).length(1));let m=this.add(new pn({open:!0}));this.anchors.vo1=fe(h,"center"),this.anchors.vo2=fe(m,"center"),this._labelhints.vo1={ofst:[0,.1],halign:"center",valign:"bottom"},this._labelhints.vo2={ofst:[0,.1],halign:"center",valign:"bottom"}}this.anchors.W=fe(n,"start"),this.anchors.N=fe(s,"start"),this.anchors.E=fe(i,"start"),this.anchors.S=fe(o,"start"),this.elmParams.theta=0}},Io=class extends ir{constructor(e={}){let t=e.unit??2;super({...e,unit:t})}setup(){let e=this.userParams.unit??2,t=this.userParams.cycl===!0,n=this.userParams.switch??"spst",s=this.userParams.core!==!1,i=this.userParams.box!==!1,o=this.userParams.boxfill??"none",a=this.userParams.boxpad??.25,l=this.userParams.swreverse===!0,h=this.userParams.swflip===!0,c=this.userParams.link!==!1,m=t?this.add(new Lr({d:"d"})):this.add(new Ir({d:"d"}));this.anchors.in1=fe(m,"start"),this.anchors.in2=fe(m,"end");let f=m.getBBox(!0).xmax,g=f+.6;s&&(this.add(new Pe({d:"d",at:[f+.15,-e/2],anchor:"center",l:1})),g+=.1);let b;if(n==="spst"){let v=new Xr({d:"d",reverse:l,flip:h}),x=v.getBBox(!1);v.userParams.at=[g-(h?-x.ymax:x.ymin),0],this.add(v),this.anchors.a=fe(v,"start"),this.anchors.b=fe(v,"end"),b=v}else if(n==="spdt"){let v=new Xs({d:"d",reverse:l,flip:h}),x=v.getBBox(!1);v.userParams.at=[g-(h?-x.ymax:x.ymin),-.5],this.add(v);let S=l?-e:0,k=l?0:-e,M=this.add(new Pe({d:l?"d":"u",at:fe(v,"a"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(v,"b"),toy:k})),B=this.add(new Pe({d:l?"u":"d",at:fe(v,"c"),toy:k}));this.anchors.a=fe(M,"end"),this.anchors.b=fe(_,"end"),this.anchors.c=fe(B,"end"),b=v}else if(n==="dpst"){let v=new Gs({d:"d",link:!1,reverse:l,flip:h}),x=v.getBBox(!1);v.userParams.at=[g-(h?-x.ymax:x.ymin),-.5],this.add(v);let S=l?0:-e,k=l?-e:0,M=this.add(new Pe({d:l?"u":"d",at:fe(v,"t1"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(v,"t2"),toy:S})),B=this.add(new Pe({d:l?"d":"u",at:fe(v,"p1"),toy:k})),$=this.add(new Pe({d:l?"d":"u",at:fe(v,"p2"),toy:k}));this.anchors.t1=fe(M,"end"),this.anchors.t2=fe(_,"end"),this.anchors.p1=fe(B,"end"),this.anchors.p2=fe($,"end"),b=v}else if(n==="dpdt"){let v=new Ws({d:"d",link:!1,reverse:l,flip:h}),x=v.getBBox(!1);v.userParams.at=[g-(h?-x.ymax:x.ymin),-.5],this.add(v);let S=l?0:-e,k=l?-e:0,M=this.add(new Pe({d:l?"u":"d",at:fe(v,"t1"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(v,"t2"),toy:S})),B=this.add(new Pe({d:l?"u":"d",at:fe(v,"t3"),toy:S})),$=this.add(new Pe({d:l?"u":"d",at:fe(v,"t4"),toy:S})),Y=this.add(new Pe({d:l?"d":"u",at:fe(v,"p1"),toy:k})),Z=this.add(new Pe({d:l?"d":"u",at:fe(v,"p2"),toy:k}));this.anchors.t1=fe(M,"end"),this.anchors.t2=fe(_,"end"),this.anchors.t3=fe(B,"end"),this.anchors.t4=fe($,"end"),this.anchors.p1=fe(Y,"end"),this.anchors.p2=fe(Z,"end"),b=v}else{let v=new Xr({d:"d"});v.userParams.at=[g,0],this.add(v),b=v}if(c){let v=b.getBBox(!1),x=h?v.ymax:v.ymin;this.add(new Pe({d:"r",at:[f+.2,-e/2],ls:":",tox:x}))}if(i){let v=this.getBBox(!1);this.add(new xr({d:"r",at:[0,0],corner1:[v.xmin-a,v.ymin+.2],corner2:[v.xmax+a,v.ymax-.2],fill:o,zorder:0}))}}};var L1=1,D1=.5;function Vs(r,e){let t=r.absanchors[e];return[t.x,t.y]}var vr=class extends ir{constructor(t={}){super({unit:t.unit??1.5,...t});z(this,"inputComponent");z(this,"outputComponent")}setup(){let t=this.userParams._inputFactory,n=this.userParams._outputFactory,s=this.userParams.boxpadx??.2,i=this.userParams.boxpady??.2,o=this.userParams.minw??.5,a=this.userParams.terminals??!0,l=this.userParams.width??2.15,h=this.userParams.box??!0,c=this.userParams.boxfill,m=this.userParams.boxlw,f=this.userParams.boxls,g=(t??(()=>new Xt))();g.down();let b=(n??(()=>new Xt))();b.down();let v=g.getBBox(!1,!1),x=b.getBBox(!1,!1),S=Math.max((v.ymax-v.ymin)/2,o/2),k=Math.max((x.ymax-x.ymin)/2,o/2);g.at([s+S,0]),b.at([l-s-k,0]),this.inputComponent=this.add(g),this.outputComponent=this.add(b);let M=this.getBBox(!1,!1);h&&this.add(new xr({theta:0,at:[0,0],corner1:[0,M.ymin-i],corner2:[l,M.ymax+i],fill:c??"none",lw:m,ls:f,zorder:0})),M=this.getBBox(!1,!1);let _=this.add(new Pe({at:Vs(this.outputComponent,"start")}).tox(M.xmax).right()),B=this.add(new Pe({at:Vs(this.outputComponent,"end")}).tox(M.xmax).right()),$=this.add(new Pe({at:Vs(this.inputComponent,"start")}).tox(M.xmin).left()),Y=this.add(new Pe({at:Vs(this.inputComponent,"end")}).tox(M.xmin).left());if(this.anchors.in_p=Vs($,"end"),this.anchors.in_n=Vs(Y,"end"),this.anchors.out_p=Vs(_,"end"),this.anchors.out_n=Vs(B,"end"),this.anchors.center=[(M.xmin+M.xmax)/2,(M.ymin+M.ymax)/2],this._labelhints.in_p={ofst:[0,.15],halign:"right"},this._labelhints.in_n={ofst:[0,.15],halign:"right"},this._labelhints.out_p={ofst:[0,.15],halign:"left"},this._labelhints.out_n={ofst:[0,.15],halign:"left"},a)for(let Z of["in_p","in_n","out_p","out_n"]){let L=Z.startsWith("in")?-D1:D1,I=this.anchors[Z],X=[I[0]+L,I[1]];this.anchors[Z]=X,this.segments.push(new p([I,X]))}}},Lo=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>new Xt,boxpadx:e.boxpadx??0,minw:e.minw??0})}setup(){super.setup();let e=this.userParams.sign??!0,t=this.userParams.arrow??!0,n=this.userParams.reverse_output??!1;if(e){let s=this.inputComponent.absanchors.end,i=this.inputComponent.absanchors.start;this.segments.push(new W([s.x+.1,s.y+.1],"\u2212",{halign:"left",valign:"center",rotation:0})),this.segments.push(new W([i.x+.1,i.y-.1],"+",{halign:"left",valign:"center",rotation:0}));let o=this.outputComponent.absanchors.end,a=this.outputComponent.absanchors.start;n?(this.segments.push(new W([o.x-.1,o.y+.1],"+",{halign:"right",valign:"center",rotation:0})),this.segments.push(new W([a.x-.1,a.y-.1],"\u2212",{halign:"right",valign:"center",rotation:0}))):(this.segments.push(new W([o.x-.1,o.y+.1],"\u2212",{halign:"right",valign:"center",rotation:0})),this.segments.push(new W([a.x-.1,a.y-.1],"+",{halign:"right",valign:"center",rotation:0})))}if(t){let s=this.anchors.center;this.segments.push(new p([[s[0]-L1/2,s[1]],[s[0]+L1/2,s[1]]],{arrow:"->",lw:2,arrowwidth:.3,arrowlength:.3}))}}},Do=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>t?new br:new br({reverse:!0})})}setup(){super.setup();let e=this.inputComponent.absanchors.end,t=this.inputComponent.absanchors.start;this.segments.push(new W([e.x,e.y+.05],"\u2212",{halign:"right",valign:"bottom",rotation:0})),this.segments.push(new W([t.x,t.y-.05],"+",{halign:"right",valign:"top",rotation:0}))}},No=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Pe,_outputFactory:()=>t?new br:new br({reverse:!0})})}setup(){super.setup();let e=new gn("in",-.15,!0,{headlength:.3});e.at(this.inputComponent),this.add(e)}},Oo=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Pe,_outputFactory:()=>t?new wr:new wr({reverse:!0})})}setup(){super.setup();let e=new gn("in",-.15,!0,{headlength:.3});e.at(this.inputComponent),this.add(e)}},Fo=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>t?new wr:new wr({reverse:!0})})}setup(){super.setup();let e=this.inputComponent.absanchors.end,t=this.inputComponent.absanchors.start;this.segments.push(new W([e.x,e.y+.05],"\u2212",{halign:"right",valign:"bottom",rotation:0})),this.segments.push(new W([t.x,t.y-.05],"+",{halign:"right",valign:"top",rotation:0}))}},$o=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new Nr,_outputFactory:()=>new Or,boxpadx:e.boxpadx??.3})}},jo=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new $r,_outputFactory:()=>new Fr,boxpadx:e.boxpadx??.3})}};var Le=1.1,u0=class extends N{constructor(t={}){super(t);z(this,"_outletrad",1.5);let n=!!t.plug,s=this._outletrad,i=ze(Math.PI*3/4,Math.PI*5/4),o=i.map(_=>.15+s*Math.cos(_)),a=i.map(_=>s*Math.sin(_)),l=i.map(_=>-.15+-s*Math.cos(_)),h=i.map(_=>-s*Math.sin(_)),c=[...o,...l],m=[...a,...h],f=c.map((_,B)=>[_,m[B]]);this.segments.push(new U(f));let g=s/8,b=g*3,v=b*1.25,x=b/2,S=v/2,k=s/2.2,M=n?"black":"bg";this.segments.push(new U([[-k,S],[-k,S-v],[-k+g,S-v],[-k+g,S]],{fill:M,zorder:3})),this.segments.push(new U([[k,x],[k,x-b],[k-g,x-b],[k-g,x]],{fill:M,zorder:3})),this.anchors.hot=[k-g/2,0],this.anchors.neutral=[-k+g/2,0],this.elmParams.drop=[k-g/2,0]}},qo=class extends u0{constructor(e={}){super(e);let t=!!e.plug,n=this._outletrad,s=n/4,i=-n/2.5,o=[-s/2,-s/2,s/2,s/2],a=[i,i-s/2,i-s/2,i],l=ze(0,Math.PI);for(let b of l)o.push(s/2*Math.cos(b)),a.push(i+s/2*Math.sin(b));let h=t?"black":"bg",c=o.map((b,v)=>[b,a[v]]);this.segments.push(new U(c,{fill:h,zorder:3}));let m=s/2,f=this.segments[1];f.verts=f.verts.map(([b,v])=>[b,v+m]);let g=this.segments[2];g.verts=g.verts.map(([b,v])=>[b,v+m]),this.anchors.hot=[this.anchors.hot[0],this.anchors.hot[1]+m],this.anchors.neutral=[this.anchors.neutral[0],this.anchors.neutral[1]+m],this.anchors.ground=[0,i]}},m0=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2;this.segments.push(new D([-i,0],s,{fill:n,zorder:3})),this.segments.push(new D([i,0],s,{fill:n,zorder:3})),this.anchors.hot=[i,0],this.anchors.neutral=[-i,0],this.elmParams.drop=[i,0]}},Ho=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2,o=-Le/4,a=Le/2.5;this.segments.push(new D([-i,o],s,{fill:n,zorder:3})),this.segments.push(new D([i,o],s,{fill:n,zorder:3})),this.segments.push(new D([0,a],s*1.2,{fill:n,zorder:3})),this.anchors.hot=[i,o],this.anchors.neutral=[-i,o],this.anchors.ground=[0,a],this.elmParams.drop=[0,a]}},Yo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2,o=0,a=Le/2;this.segments.push(new D([-i,o],s,{fill:n,zorder:3})),this.segments.push(new D([i,o],s,{fill:n,zorder:3})),this.segments.push(new D([0,a],s,{fill:n,zorder:3})),this.anchors.hot=[i,o],this.anchors.neutral=[-i,o],this.anchors.ground=[0,a],this.elmParams.drop=[-i,o]}},Xo=class extends m0{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le/8,i=Le/6,o=Le-.05,a=-Le+.05;this.segments.push(new p([[-s,o],[-s,o-i],[s,o-i],[s,o]],{fill:n,zorder:3})),this.segments.push(new p([[-s,a],[-s,a+i],[s,a+i],[s,a]],{fill:n,zorder:3}))}},Go=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/6,i=s*3,o=Le/5,a=Le*3/4,l=-Le/2.5,h=s;this.segments.push(new U([[-o/2,a],[-o/2,a-i],[o/2,a-i],[o/2,a]],{fill:n,zorder:3})),this.segments.push(new U([[-h,l],[-h,l-s],[-h-i,l-s],[-h-i,l]],{fill:n,zorder:3})),this.segments.push(new U([[h,l],[h,l-s],[h+i,l-s],[h+i,l]],{fill:n,zorder:3})),this.anchors.hot=[h+i/2,l-s/2],this.anchors.neutral=[-h-i/2,l-s/2],this.anchors.ground=[0,a-i/2],this.elmParams.drop=[h+i/2,l-s/2]}},d0=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=s*3,o=-s*2,a=[[-s/2,o],[-s/2,o-i],[s/2,o-i],[s/2,o]],l=a.map(c=>Wr(c,120).toTuple()),h=a.map(c=>Wr(c,-120).toTuple());this.segments.push(new U(a,{fill:n,zorder:3})),this.segments.push(new U(l,{fill:n,zorder:3})),this.segments.push(new U(h,{fill:n,zorder:3})),this.anchors.hot=l[1],this.anchors.neutral=h[2],this.anchors.ground=[0,o-i],this.elmParams.drop=l[1]}},Wo=class extends d0{constructor(e={}){super(e);let t=[.4,.3],n=[-.4,.3],s=this.segments[2];s.verts=s.verts.map(o=>Wr(o,90,t).toTuple());let i=this.segments[3];i.verts=i.verts.map(o=>Wr(o,-90,n).toTuple()),this.anchors.hot=Wr(this.anchors.hot,90,t).toTuple(),this.anchors.neutral=Wr(this.anchors.neutral,-90,n).toTuple()}},Vo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le*1.5,i=s*2,o=i/5;this.segments.push(new U([[-i/2,0],[-i/2+o,s/2],[i/2-o,s/2],[i/2,0],[i/2-o,-s/2],[-i/2+o,-s/2]]));let a=Le/8;this.segments.push(new D([-i/4,0],a,{fill:n,zorder:3})),this.segments.push(new D([0,-a*2],a,{fill:n,zorder:3})),this.segments.push(new D([i/4,0],a,{fill:n,zorder:3})),this.anchors.hot=[i/4,0],this.anchors.neutral=[-i/4,0],this.anchors.ground=[0,-a*2],this.elmParams.drop=[i/4,0]}},Uo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2;this.segments.push(new D([-i,0],s,{fill:n,zorder:3})),this.segments.push(new D([i,0],s,{fill:n,zorder:3})),this.anchors.hot=[i,0],this.anchors.neutral=[-i,0],this.elmParams.drop=[i,0];let o=Le/4,a=-Le/2,l=[-o/2,-o/2,o/2,o/2],h=[a,a+o/2,a+o/2,a],c=ze(0,Math.PI);for(let f of c)l.push(o/2*Math.cos(f)),h.push(a-o/2*Math.sin(f));let m=l.map((f,g)=>[f,h[g]]);this.segments.push(new U(m,{fill:n,zorder:3})),this.anchors.ground=[0,a]}},Jo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le*1.2,i=s*2.25;this.segments.push(new U([[-i/2,s/2],[i/2,s/2],[i/2,-s/2],[-i/2,-s/2]]));let o=Le/8;this.segments.push(new D([-i/4,0],o,{fill:n,zorder:3})),this.segments.push(new D([0,0],o,{fill:n,zorder:3})),this.segments.push(new D([i/4,0],o,{fill:n,zorder:3})),this.anchors.hot=[i/4,0],this.anchors.neutral=[-i/4,0],this.anchors.ground=[0,0],this.elmParams.drop=[i/4,0]}};var Us=0,st=1.75,_a=st/2,oh=20,Gt=st*.4,or=st/9,Ba=st/6,Ca=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{tube_lw:2.5,anode_lw:2,cathode_lw:2,heat_lw:2,grid_lw:2,n_grid_dashes:3,dot_radius:.075,theta:0})}_drawEnvelope(e,t,n="none"){let s=-e,i=t/2,o=-i,a=i,l=[0,-e/2],h=Math.min(t/2,e/2);n==="left"?this.segments.push(new xe(l,t,e,{theta1:90-oh,theta2:270+oh,lw:this.params.tube_lw})):n==="right"?this.segments.push(new xe(l,t,e,{theta1:270-oh,theta2:90+oh,lw:this.params.tube_lw})):this.segments.push(new U([[o,Us],[a,Us],[a,s],[o,s]],{cornerradius:h,lw:this.params.tube_lw})),this.anchors.N=[0,0],this.anchors.S=[0,-e],this.anchors.E=[a,-e/2],this.anchors.W=[o,-e/2];let c=_a/Math.sqrt(2);this.anchors.NE=[c,-_a+c],this.anchors.NW=[-c,-_a+c],this.anchors.SE=[c,-_a-c],this.anchors.SW=[-c,-_a-c],this._labelhints.NE={ofst:[.12,.12],halign:"left"},this._labelhints.NW={ofst:[-.12,.12],halign:"right"},this._labelhints.SE={ofst:[.12,-.12],halign:"left",valign:"top"},this._labelhints.SW={ofst:[-.12,-.12],halign:"right",valign:"top"}}_drawElements(e,t,n,s,i,o,a=""){let l=this.params.dot_radius,h=Us-t/2+Math.max(0,s-1)*or/2,c=h-or*Math.max(0,s-1),m=e-Gt/2,f=e+Gt/2,g=h+or;o==="narrow"?this.segments.push(new p([[e-l,g],[e+l,g]],{lw:this.params.anode_lw})):o==="dot"?(g+=l*2,this.segments.push(new D([e,g-l],l,{lw:this.params.anode_lw}))):o!=="none"&&o!=null&&this.segments.push(new p([[m,g],[f,g]],{lw:this.params.anode_lw})),o!=="none"&&o!=null&&(this.segments.push(new p([[e,Us],[e,g]],{lw:this.params.anode_lw})),this.anchors[`anode${a}`]=[e,Us],this._labelhints[`anode${a}`]={ofst:[.1,.1],halign:"left",valign:"bottom",fontsize:11});let b=this.params.n_grid_dashes,v=Gt/(b+2),x=(Gt-v*(b-1))/b,S=[];for(let _=0;_<b;_++)S.push(m+_*(x+v));for(let _=0;_<s;_++){let B=h-or*_;for(let $=0;$<b;$++)this.segments.push(new p([[S[$],B],[S[$]+x,B]],{lw:this.params.grid_lw}));s===1?(this.anchors[`grid${a}`]=[m-v,B],this.anchors[`grid${a}_R`]=[f+v,B],this._labelhints[`grid${a}`]={ofst:[-n/2-m+.1,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints[`grid${a}_R`]={ofst:[n/2-f-.1,.1],halign:"left",valign:"bottom",fontsize:11}):(this.anchors[`grid${a}_${_+1}`]=[m-v,B],this.anchors[`grid${a}_${_+1}R`]=[f+v,B],this._labelhints[`grid${a}_${_+1}`]={ofst:[-n/2-m+.1,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints[`grid${a}_${_+1}R`]={ofst:[n/2-f-.1,.1],halign:"left",valign:"bottom",fontsize:11})}let k=c-or,M=l*2;return i==="cold"?(this.segments.push(new p([[e,k-l*2],[e,-t]])),this.segments.push(new D([e,k-l],l)),this.anchors[`cathode${a}`]=[e,-t],this._labelhints[`cathode${a}`]={ofst:[.1,-.1],halign:"left",valign:"top",fontsize:11}):i!=="none"&&i!=null&&(this.segments.push(new p([[m,k-M],[m,k],[f,k],[f,k-M]],{lw:this.params.cathode_lw})),this.anchors[`cathode${a}`]=[m,k-M],this.anchors[`cathode${a}_R`]=[f,k-M],this._labelhints[`cathode${a}`]={ofst:[-.1,-t-k+M],halign:"right",valign:"top",fontsize:11},this._labelhints[`cathode${a}_R`]={ofst:[.1,-t-k+M],halign:"left",valign:"top",fontsize:11}),k}_drawHeat(e,t){let n=e-or*1.25,s=-Gt/3.5,i=Gt/3.5,o=Us-t-or,a=n-Math.sqrt(2)*i;this.segments.push(new p([[s,o],[s,a],[0,n],[i,a],[i,o]],{lw:this.params.heat_lw})),this.anchors.heat1=[s,o],this.anchors.heat2=[i,o],this._labelhints.heat1={ofst:[-.1,0],halign:"right",valign:"bottom",fontsize:11},this._labelhints.heat2={ofst:[.1,0],halign:"left",valign:"bottom",fontsize:11}}},Gr=class extends Ca{constructor(e={}){let{cathode:t="heated",anodetype:n="plate",grids:s=1,heater:i=!0,split:o="none",...a}=e;super(a);let l=Math.max(st,st+(s-4)*or);this._drawEnvelope(l,st,o);let h=this._drawElements(0,l,st,s,t,n);i&&this._drawHeat(h,l)}},Ko=class extends Ca{constructor(e={}){let{cathode:t="heated",anodetype:n="plate",grids_left:s=1,grids_right:i=1,heater:o=!0,...a}=e;super(a);let l=Math.max(s,i),h=Math.max(st,st+(l-4)*or),c=st*1.5,m=-c*.2,f=c*.2;this._drawEnvelope(h,c);let g=this._drawElements(m,h,c,s,t,n,"A"),b=this._drawElements(f,h,c,i,t,n,"B");o&&this._drawHeat(Math.min(g,b),h)}},Zo=class extends Ca{constructor(e={}){let{anodes:t=3,cathode:n="T",anodetype:s="narrow",grid:i=!1,...o}=e;super(o);let a=st,l=Math.max(st,(t-1)*Ba+st);this._drawEnvelope(a,l),i&&this._drawNixieGrid(t,l),this._drawNixieAnodes(t,s),this._drawNixieCathode(t,n)}_drawNixieAnodes(e,t){let n=-st/4,i=-((e-1)*Ba)/2,o=this.params.dot_radius;for(let a=0;a<e;a++){let l=i+a*Ba;t==="dot"?this.segments.push(new D([l,n-o],o,{lw:this.params.anode_lw})):this.segments.push(new p([[l-o,n],[l+o,n]],{lw:this.params.anode_lw})),this.segments.push(new p([[l,Us],[l,n]],{lw:this.params.anode_lw})),this.anchors[`anode${a}`]=[l,Us],this._labelhints[`anode${a}`]={ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:11}}}_drawNixieGrid(e,t){let n=(e-1)*Ba,s=-n/2,i=e+1,o=n/(i+2),a=(n-o*(i-1))/i,l=[];for(let c=0;c<i;c++)l.push(s+c*(a+o));let h=-st/2;for(let c=0;c<i;c++)this.segments.push(new p([[l[c],h],[l[c]+a,h]],{lw:this.params.grid_lw}));this.anchors.grid=[s-o,h],this.anchors.grid_R=[s+n+o,h],this._labelhints.grid={ofst:[-t/2-s,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints.grid_R={ofst:[t/2-n/2,.1],halign:"left",valign:"bottom",fontsize:11}}_drawNixieCathode(e,t){let n=this.params.dot_radius,s=-3*st/4,i=n,o=(e-1)*Ba;t==="cold"?(this.segments.push(new p([[0,s-n*2],[0,-st]],{lw:this.params.cathode_lw})),this.segments.push(new D([0,s-n],n)),this.anchors.cathode=[0,-st]):t==="heated"?(this.segments.push(new p([[-Gt/2,s-i],[-Gt/2,s],[Gt/2,s],[Gt/2,s-i]],{lw:this.params.cathode_lw})),this.anchors.cathode=[-Gt/2,s-i],this.anchors.cathode_R=[Gt/2,s-i]):t!=="none"&&t!=null&&(this.segments.push(new p([[0,-st],[0,s],H,[-o/2,s],[o/2,s]],{lw:this.params.cathode_lw})),this.anchors.cathode=[0,-st])}},Qo=class extends Gr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:0,heater:t,split:n,...s})}},ea=class extends Gr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:1,heater:t,split:n,...s}),this.anchors.control=this.anchors.grid,this.anchors.control_R=this.anchors.grid_R,this._labelhints.control=this._labelhints.grid,this._labelhints.control_R=this._labelhints.grid_R}},ta=class extends Gr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:2,heater:t,split:n,...s}),this.anchors.screen=this.anchors.grid_1,this.anchors.screen_R=this.anchors.grid_1R,this.anchors.control=this.anchors.grid_2,this.anchors.control_R=this.anchors.grid_2R,this._labelhints.screen=this._labelhints.grid_1,this._labelhints.screen_R=this._labelhints.grid_1R,this._labelhints.control=this._labelhints.grid_2,this._labelhints.control_R=this._labelhints.grid_2R}},ra=class extends Gr{constructor(e={}){let{strap:t=!1,heater:n=!1,split:s="none",...i}=e;if(super({cathode:"heated",grids:3,heater:n,split:s,...i}),this.anchors.suppressor=this.anchors.grid_1,this.anchors.suppressor_R=this.anchors.grid_1R,this.anchors.screen=this.anchors.grid_2,this.anchors.screen_R=this.anchors.grid_2R,this.anchors.control=this.anchors.grid_3,this.anchors.control_R=this.anchors.grid_3R,this._labelhints.suppressor=this._labelhints.grid_1,this._labelhints.suppressor_R=this._labelhints.grid_1R,this._labelhints.screen=this._labelhints.grid_2,this._labelhints.screen_R=this._labelhints.grid_2R,this._labelhints.control=this._labelhints.grid_3,this._labelhints.control_R=this._labelhints.grid_3R,t){let o=this.params.dot_radius,a=this.anchors.cathode_R,l=[a[0],a[1]+o*2],h=this.anchors.suppressor_R,c=[Gt/2,h[1]],m=[l[0]+or*.75,l[1]+or/2],f=[m[0],c[1]-or/2];this.segments.push(new p([l,m,f,c],{lw:this.params.cathode_lw}))}}};var Js={ResistorIEEE:r=>new dt(r??{}),ResistorIEC:r=>new mt(r??{}),ResistorVarIEEE:r=>new cr(r??{}),ResistorVarIEC:r=>new Zt(r??{}),Thermistor:r=>new Jn(r??{}),PhotoresistorIEEE:r=>new ur(r??{}),PhotoresistorIEC:r=>new Qt(r??{}),Rshunt:r=>new Kn(r??{}),PotentiometerIEEE:r=>new mr(r??{}),PotentiometerIEC:r=>new er(r??{}),FuseIEEE:r=>new dr(r??{}),FuseIEC:r=>new Dr(r??{}),Resistor:r=>new Zn(r??{}),ResistorVar:r=>new Qn(r??{}),Photoresistor:r=>new ts(r??{}),Potentiometer:r=>new es(r??{}),Fuse:r=>new rs(r??{}),Memristor:r=>new ns(r??{}),Memristor2:r=>new ss(r??{}),Josephson:r=>new is(r??{}),FuseUS:r=>new os(r??{}),Breaker:r=>new as(r??{}),CPE:r=>new ls(r??{}),SparkGap:r=>new hs(r??{}),Nullator:r=>new Nr(r??{}),Norator:r=>new Or(r??{}),CurrentMirror:r=>new Fr(r??{}),VoltageMirror:r=>new $r(r??{}),Capacitor:r=>new Cr(r??{}),Capacitor2:r=>new Cn(r??{}),CapacitorVar:r=>new In(r??{}),CapacitorTrim:r=>new Ln(r??{}),Diode:r=>new et(r??{}),Schottky:r=>new Dn(r??{}),Zener:r=>new Nn(r??{}),DiodeTunnel:r=>new On(r??{}),DiodeTVS:r=>new Fn(r??{}),DiodeShockley:r=>new $n(r??{}),Varactor:r=>new jn(r??{}),LED:r=>new qn(r??{}),LED2:r=>new Hn(r??{}),Photodiode:r=>new Yn(r??{}),SCR:r=>new Xn(r??{}),Diac:r=>new on(r??{}),Triac:r=>new Gn(r??{}),Inductor:r=>new Ir(r??{}),Inductor2:r=>new Lr(r??{}),Crystal:r=>new Un(r??{}),Opamp:r=>new cs(r??{}),AnalogBiasedFet:r=>new j0(r??{}),AnalogNFet:r=>new F0(r??{}),AnalogPFet:r=>new $0(r??{}),Bjt:r=>new qr(r??{}),Bjt2:r=>new Hr(r??{}),BjtNpn:r=>new Ht(r??{}),BjtNpn2:r=>new Ss(r??{}),BjtPnp:r=>new rr(r??{}),BjtPnp2:r=>new ln(r??{}),BjtPnp2c:r=>new W0(r??{}),BjtPnp2c2:r=>new ei(r??{}),Hemt:r=>new G0(r??{}),IgbtN:r=>new Z0(r??{}),IgbtP:r=>new Q0(r??{}),JFet:r=>new vs(r??{}),JFet2:r=>new ys(r??{}),JFetN:r=>new q0(r??{}),JFetN2:r=>new Y0(r??{}),JFetP:r=>new H0(r??{}),JFetP2:r=>new X0(r??{}),NFet:r=>new gs(r??{}),NFet2:r=>new ws(r??{}),NMos:r=>new ms(r??{}),NMos2:r=>new ps(r??{}),NpnPhoto:r=>new J0(r??{}),NpnSchottky:r=>new V0(r??{}),PFet:r=>new bs(r??{}),PFet2:r=>new xs(r??{}),PMos:r=>new ds(r??{}),PMos2:r=>new fs(r??{}),PnpPhoto:r=>new K0(r??{}),PnpSchottky:r=>new U0(r??{}),DFlipFlop:r=>new ri(r??{}),Ic:r=>new nr(r??{}),Ic555:r=>new ii(r??{}),IcDIP:r=>new ai(r??{}),JKFlipFlop:r=>new ni(r??{}),Multiplexer:r=>new ti(r??{}),SevenSegment:r=>new oi(r??{}),VoltageRegulator:r=>new si(r??{}),Source:r=>new rt(r??{}),SourceV:r=>new Ri(r??{}),SourceI:r=>new Ai(r??{}),SourceSin:r=>new _i(r??{}),SourcePulse:r=>new Bi(r??{}),SourceSquare:r=>new Li(r??{}),SourceTriangle:r=>new Ci(r??{}),SourceRamp:r=>new Ii(r??{}),SourceControlled:r=>new Ys(r??{}),SourceControlledV:r=>new br(r??{}),SourceControlledI:r=>new wr(r??{}),BatteryCell:r=>new Di(r??{}),Battery:r=>new Ni(r??{}),BatteryDouble:r=>new Oi(r??{}),Solar:r=>new Fi(r??{}),MeterV:r=>new $i(r??{}),MeterI:r=>new ji(r??{}),MeterA:r=>new qi(r??{}),MeterOhm:r=>new Hi(r??{}),MeterArrow:r=>new Yi(r??{}),Lamp:r=>new Xi(r??{}),Lamp2:r=>new Gi(r??{}),Neon:r=>new Wi(r??{}),MeterBox:r=>new mn(r??{}),MeterAnalog:r=>new Vi(r??{}),Oscilloscope:r=>new Ui(r??{}),MeterDigital:r=>new Ji(r??{}),GroundSignal:r=>new Ki(r??{}),GroundChassis:r=>new Zi(r??{}),Antenna:r=>new Qi(r??{}),AntennaLoop:r=>new eo(r??{}),AntennaLoop2:r=>new to(r??{}),Vss:r=>new ro(r??{}),Vdd:r=>new no(r??{}),NoConnect:r=>new so(r??{}),Switch:r=>new Xr(r??{}),SwitchSpdt:r=>new io(r??{}),SwitchSpdt2:r=>new Xs(r??{}),SwitchDpst:r=>new Gs(r??{}),SwitchDpdt:r=>new Ws(r??{}),Button:r=>new oo(r??{}),SwitchReed:r=>new ao(r??{}),SwitchRotary:r=>new lo(r??{}),SwitchDIP:r=>new ho(r??{}),Speaker:r=>new co(r??{}),Mic:r=>new uo(r??{}),Motor:r=>new mo(r??{}),AudioJack:r=>new po(r??{}),Coax:r=>new fo(r??{}),Triax:r=>new go(r??{}),Transformer:r=>new bo(r??{}),Line:r=>new Pe(r??{}),Ground:r=>new Ti(r??{}),Arrow:r=>new dn(r??{}),DataBusLine:r=>new wo(r??{}),Dot:r=>new pn(r??{}),DotDotDot:r=>new vo(r??{}),Gap:r=>new Xt(r??{}),Arrowhead:r=>new xo(r??{}),Label:r=>new So(r??{}),Rect:r=>new xr(r??{}),Tag:r=>new ko(r??{}),Wire:r=>new yo(r??{}),Annotate:r=>new zo(r??{}),Arc2:r=>new Mo(r??{}),Arc3:r=>new fn(r??{}),ArcLoop:r=>new To(r??{}),ArcN:r=>new Po(r??{}),ArcZ:r=>new Eo(r??{}),CurrentLabel:r=>new h0(r??{}),CurrentLabelInline:r=>{let{direction:e,ofst:t,start:n,...s}=r??{};return new gn(e,t,n,s)},LoopArrow:r=>new c0(r??{}),VoltageLabelArc:r=>new Ro(r??{}),ZLabel:r=>new Ao(r??{}),Optocoupler:r=>new _o(r??{}),Rectifier:r=>new Bo(r??{}),Relay:r=>new Io(r??{}),Wheatstone:r=>new Co(r??{}),TwoPort:r=>new Lo(r??{}),VoltageTransactor:r=>new Do(r??{}),TransimpedanceTransactor:r=>new No(r??{}),CurrentTransactor:r=>new Oo(r??{}),TransadmittanceTransactor:r=>new Fo(r??{}),Nullor:r=>new $o(r??{}),VMCMPair:r=>new jo(r??{}),OrthoLines:r=>new di(r??{}),RightLines:r=>new Hs(r??{}),Header:r=>new pi(r??{}),Jumper:r=>new fi(r??{}),BusConnect:r=>new gi(r??{}),BusLine:r=>new bi(r??{}),DB25:r=>new xi(r??{}),DE9:r=>new a0(r??{}),DB9:r=>new wi(r??{}),DA15:r=>new vi(r??{}),DC37:r=>new yi(r??{}),DD50:r=>new Si(r??{}),CoaxConnect:r=>new ki(r??{}),Plug:r=>new Mi(r??{}),Jack:r=>new zi(r??{}),ConnectorTerminal:r=>new Ei(r??{}),OutletA:r=>new u0(r??{}),OutletB:r=>new qo(r??{}),OutletC:r=>new m0(r??{}),OutletD:r=>new Ho(r??{}),OutletE:r=>new Yo(r??{}),OutletF:r=>new Xo(r??{}),OutletG:r=>new Go(r??{}),OutletH:r=>new d0(r??{}),OutletI:r=>new Wo(r??{}),OutletJ:r=>new Vo(r??{}),OutletK:r=>new Uo(r??{}),OutletL:r=>new Jo(r??{}),VacuumTube:r=>new Gr(r??{}),DualVacuumTube:r=>new Ko(r??{}),NixieTube:r=>new Zo(r??{}),TubeDiode:r=>new Qo(r??{}),Triode:r=>new ea(r??{}),Tetrode:r=>new ta(r??{}),Pentode:r=>new ra(r??{}),ElementImage:r=>{let{image:e,width:t,height:n,...s}=r??{};return new js(e,t,n,s)},And:r=>new Bt(r??{}),Or:r=>new $t(r??{}),Buf:r=>new Jt(r??{}),Not:r=>new Kt(r??{}),Tristate:r=>new Bn(r??{}),Kmap:r=>new A0(r??{}),BitField:r=>new s0(r??{}),NotNot:r=>new C0(r??{}),Schmitt:r=>new L0(r??{}),SchmittAnd:r=>new o0(r??{}),SchmittNand:r=>Yl(r),SchmittNot:r=>new D0(r??{}),Table:r=>new B0(r),Tgate:r=>new I0(r??{}),TimingDiagram:r=>new n0(r??{}),FlowBox:r=>new cn(r??{}),RoundBox:r=>new Yr(r??{}),Terminal:r=>new hn(r??{}),RoundProcess:r=>new li(r??{}),Process:r=>new hi(r??{}),Start:r=>new ci(r??{}),Subroutine:r=>new ks(r??{}),Data:r=>new Ms(r??{}),Ellipse:r=>new zs(r??{}),Decision:r=>new Es(r??{}),Connect:r=>new pr(r??{}),Circle:r=>new ui(r??{}),State:r=>new mi(r??{}),StateEnd:r=>new Ps(r??{}),DspBox:r=>new sr(r??{}),DspCircle:r=>new Yt(r??{}),Sum:r=>new Ts(r??{}),SumSigma:r=>new Rs(r??{}),Mixer:r=>new As(r??{}),DspSpeaker:r=>new _s(r??{}),Amp:r=>new un(r??{}),OscillatorBox:r=>new Bs(r??{}),Oscillator:r=>new Cs(r??{}),Filter:r=>new Is(r??{}),Adc:r=>new Ls(r??{}),Dac:r=>new Ds(r??{}),Demod:r=>new Ns(r??{}),Circulator:r=>new Os(r??{}),Isolator:r=>new Fs(r??{}),VGA:r=>new $s(r??{}),RBox:r=>new mt(r??{}),RBoxVar:r=>new Zt(r??{}),PotBox:r=>new er(r??{}),PhotoresistorBox:r=>new Qt(r??{}),Nand:r=>Tn(r),Nor:r=>Rn(r),Xor:r=>An(r),Xnor:r=>_n(r)};function eu(){return Object.keys(Js).sort()}var N1=eu;function O1(r){let e=Js[r];if(!e)throw new Error(`Unknown element type "${r}". Use getAvailableTypes() to see all available types.`);let t=e();return new lr().add(t),Object.keys(t.absanchors).sort()}function tu(r,e){let t=r.indexOf(".");if(t<0)throw new Error(`Invalid anchor reference "${r}". Expected format "elementId.anchorName"`);let n=r.slice(0,t),s=r.slice(t+1),i=e.get(n);if(!i){let a=[...e.keys()].join(", ")||"(none)";throw new Error(`Element "${n}" not found. Available elements: ${a}`)}let o=i.absanchors[s];if(!o){let a=Object.keys(i.absanchors).join(", ")||"(none)";throw new Error(`Anchor "${s}" not found on element "${n}". Available anchors: ${a}`)}return o.toTuple()}function Ia(r,e){return Array.isArray(r)?r:tu(r,e)}function ah(r,e){return typeof r=="number"?r:tu(r,e)}function lh(r,e){return typeof r=="number"?r:tu(r,e)}var yr={light:{bg:"#ffffff",stroke:"#000000",fill:"none",text:"#000000",font:"sans-serif",lw:2},dark:{bg:"#1a1a2e",stroke:"#c8d6e5",fill:"none",text:"#dfe6e9",font:"sans-serif",lw:2},print:{bg:"#ffffff",stroke:"#333333",fill:"none",text:"#333333",font:"serif",lw:1.5}},Ks={bg:"--circuit-bg",stroke:"--circuit-stroke",fill:"--circuit-fill",text:"--circuit-text",font:"--circuit-font",lw:"--circuit-lw"};function C2(){if(typeof getComputedStyle>"u")return{...yr.light};let r=getComputedStyle(document.documentElement),e=t=>r.getPropertyValue(t).trim();return{bg:e(Ks.bg)||"transparent",stroke:e(Ks.stroke)||yr.light.stroke,fill:e(Ks.fill)||"none",text:e(Ks.text)||yr.light.text,font:e(Ks.font)||yr.light.font,lw:parseFloat(e(Ks.lw))||yr.light.lw}}function Zs(r){if(r===void 0)return{...yr.light};if(typeof r=="string"){if(r==="auto")return C2();let e=yr[r];if(!e)throw new Error(`Unknown theme "${r}". Available: ${Object.keys(yr).join(", ")}, auto`);return{...e}}return{...yr.light,...r}}var F1={bg:"bgcolor",stroke:"color",fill:"fill",font:"font",lw:"lw"};function $1(r,e){let t={};for(let n of Object.keys(F1)){let s=F1[n];s&&(t[s]=r[n])}return{...t,...e}}function hh(r,e){let t=typeof r=="string"?JSON.parse(r):r,n=e?.theme??t.theme,s=n!==void 0?$1(Zs(n),t.drawing):{...t.drawing??{}},i=e?.colorTransition??t.drawing?.colorTransition??!1,o={...s,...e?.interactive?{interactive:!0}:{},...i?{colorTransition:!0}:{}},a=new lr(o),l=new Map;for(let h of t.elements){if(h==="push"){a.push();continue}if(h==="pop"){a.pop();continue}let c=Js[h.type];if(!c)throw new Error(`Unknown element type "${h.type}". Use getAvailableTypes() to see all available types.`);let m=c(h.params);if(h.d)switch(h.d){case"up":m.up();break;case"down":m.down();break;case"left":m.left();break;case"right":m.right();break}if(h.theta!==void 0&&m.theta(h.theta),h.at!==void 0&&m.at(Ia(h.at,l)),h.anchor&&m.anchor(h.anchor),h.flip&&m.flip(),h.reverse&&m.reverse(),h.scale!==void 0&&m.scale(h.scale),m instanceof se&&(h.to!==void 0&&m.to(Ia(h.to,l)),h.tox!==void 0&&m.tox(ah(h.tox,l)),h.toy!==void 0&&m.toy(lh(h.toy,l)),h.l!==void 0&&m.length(h.l),h.dot&&m.dot(h.dot==="open"),h.idot&&m.idot(h.idot==="open")),h.label)if(typeof h.label=="string")m.label(h.label);else{let{text:f,...g}=h.label;m.label(f,g)}if(h.labels)for(let f of h.labels){let{text:g,...b}=f;m.label(g,b)}h.color&&m.color(h.color),h.fill&&m.fill(h.fill),h.lw!==void 0&&m.linewidth(h.lw),h.ls&&m.linestyle(h.ls),a.add(m),h.id&&(l.set(h.id,m),e?.interactive&&a.setElementMeta(m,{id:h.id,type:h.type,tooltip:h.tooltip??`${h.id} \u2014 ${h.type}`}))}return a.toSvgString()}function j1(r){let e=[],t;if(typeof r=="string")try{t=JSON.parse(r)}catch(i){return{valid:!1,errors:[{path:"",message:`Invalid JSON: ${i.message}`}]}}else t=r;if(!t.elements||!Array.isArray(t.elements))return e.push({path:"elements",message:'"elements" must be an array'}),{valid:!1,errors:e};let n=new Set,s=0;for(let i=0;i<t.elements.length;i++){let o=t.elements[i],a=`elements[${i}]`;if(typeof o=="string"){o==="push"?s++:o==="pop"?(s--,s<0&&(e.push({path:a,message:'"pop" without matching "push"'}),s=0)):e.push({path:a,message:`Invalid control instruction "${o}". Expected "push" or "pop"`});continue}if(typeof o!="object"||o===null){e.push({path:a,message:'Element must be an object or "push"/"pop" string'});continue}let l=o;if(!l.type||typeof l.type!="string"){e.push({path:`${a}.type`,message:'"type" is required and must be a string'});continue}Js[l.type]||e.push({path:`${a}.type`,message:`Unknown element type "${l.type}"`}),l.d&&!["up","down","left","right"].includes(l.d)&&e.push({path:`${a}.d`,message:`Invalid direction "${l.d}". Expected "up", "down", "left", or "right"`});for(let h of["at","to","tox","toy"]){let c=l[h];if(typeof c=="string"&&c.includes(".")){let m=c.slice(0,c.indexOf("."));n.has(m)||e.push({path:`${a}.${h}`,message:`Element "${m}" referenced before definition`})}else typeof c=="string"&&!c.includes(".")&&e.push({path:`${a}.${h}`,message:`Invalid anchor reference "${c}". Expected format "elementId.anchorName"`})}l.id&&n.add(l.id)}return s>0&&e.push({path:"elements",message:`${s} unmatched "push" without "pop"`}),{valid:e.length===0,errors:e}}var na="data-sd-original-style",ru="path,polyline,polygon,circle,ellipse,line";function I2(r){r.hasAttribute(na)||r.setAttribute(na,r.getAttribute("style")??"")}function q1(r){let e=r.getAttribute(na);e!==null?(r.setAttribute("style",e),r.removeAttribute(na)):r.style.removeProperty("stroke")}var La=class{constructor(e,t,n){z(this,"_container");z(this,"_json");z(this,"_opts");z(this,"_svg");z(this,"_elementMap",new Map);z(this,"_listeners",new Map);z(this,"_selectedId",null);z(this,"_theme");z(this,"_destroyed",!1);z(this,"_tooltipEl",null);z(this,"_autoObserver",null);z(this,"_mediaQuery",null);z(this,"_mediaHandler",null);z(this,"_boundClick");z(this,"_boundMouseover");z(this,"_boundMouseout");z(this,"_boundContextmenu");z(this,"_boundMousemove");this._container=e,this._json=t,this._opts={...n,interactive:!0},this._theme=Zs(n.theme??this._json.theme),this._boundClick=this._onClick.bind(this),this._boundMouseover=this._onMouseover.bind(this),this._boundMouseout=this._onMouseout.bind(this),this._boundContextmenu=this._onContextmenu.bind(this),this._boundMousemove=this._onMousemove.bind(this),this._render(),this._bindEvents(),this._initTooltip(),this._initAutoTheme()}_isAutoTheme(){return(this._opts.theme??this._json.theme)==="auto"}_initAutoTheme(){if(!this._isAutoTheme())return;let e=()=>{this._destroyed||(this._theme=Zs("auto"),this._unbindEvents(),this._render(),this._bindEvents(),this._selectedId=null)};this._autoObserver=new MutationObserver(e),this._autoObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","data-color-mode","style"]}),typeof matchMedia<"u"&&(this._mediaQuery=matchMedia("(prefers-color-scheme: dark)"),this._mediaHandler=e,this._mediaQuery.addEventListener("change",this._mediaHandler))}_teardownAutoTheme(){this._autoObserver&&(this._autoObserver.disconnect(),this._autoObserver=null),this._mediaQuery&&this._mediaHandler&&(this._mediaQuery.removeEventListener("change",this._mediaHandler),this._mediaQuery=null,this._mediaHandler=null)}_render(){let e=hh(this._json,this._opts);this._container.innerHTML=e;let t=this._container.querySelector("svg");if(!t)throw new Error("Failed to render SVG from circuit JSON.");this._svg=t,this._svg.querySelectorAll("g.sd-el > title").forEach(o=>o.remove()),this._elementMap.clear();let n=this._svg.querySelectorAll("g.sd-el[data-id]"),s=new Map;for(let o of this._json.elements)o!=="push"&&o!=="pop"&&o.id&&s.set(o.id,o);let i="http://www.w3.org/2000/svg";n.forEach(o=>{let a=o.getAttribute("data-id"),l=o.getAttribute("data-type")??"",h=o.getAttribute("data-tooltip")??void 0,c=o.getBBox(),m=document.createElementNS(i,"rect");m.setAttribute("x",String(c.x)),m.setAttribute("y",String(c.y)),m.setAttribute("width",String(c.width)),m.setAttribute("height",String(c.height)),m.setAttribute("fill","transparent"),m.setAttribute("stroke","none"),o.prepend(m);let f=s.get(a)??{type:l,id:a};this._elementMap.set(a,{info:{id:a,type:l,tooltip:h,bbox:{x:c.x,y:c.y,width:c.width,height:c.height},anchors:{},element:o,spec:f},spec:f})})}_initTooltip(){let e=document.createElement("div");e.className="schemdraw-tooltip",e.style.cssText="position:fixed;z-index:99999;pointer-events:none;opacity:0;transition:opacity .15s ease;font-size:12px;line-height:1.4;padding:6px 12px;border-radius:6px;max-width:260px;white-space:pre-wrap;",this._applyTooltipTheme(e),document.body.appendChild(e),this._tooltipEl=e}_applyTooltipTheme(e){document.documentElement.classList.contains("dark")||document.documentElement.getAttribute("data-theme")==="dark"||typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches&&!document.documentElement.classList.contains("light")?(e.style.background="rgba(250,250,250,.95)",e.style.color="#1a1a1a",e.style.boxShadow="0 2px 12px rgba(0,0,0,.4)"):(e.style.background="rgba(15,15,15,.92)",e.style.color="#fff",e.style.boxShadow="0 2px 8px rgba(0,0,0,.2)")}_showTooltip(e,t,n){let s=this._tooltipEl;if(!s)return;this._applyTooltipTheme(s),s.textContent=e,s.style.opacity="1";let i=10,o=window.innerWidth,a=window.innerHeight;s.style.left="0",s.style.top="0";let l=s.getBoundingClientRect(),h=t+i,c=n+i;h+l.width>o&&(h=t-l.width-i),c+l.height>a&&(c=n-l.height-i),s.style.left=`${h}px`,s.style.top=`${c}px`}_hideTooltip(){this._tooltipEl&&(this._tooltipEl.style.opacity="0")}_bindEvents(){this._svg.addEventListener("click",this._boundClick),this._svg.addEventListener("mouseover",this._boundMouseover),this._svg.addEventListener("mouseout",this._boundMouseout),this._svg.addEventListener("mousemove",this._boundMousemove),this._svg.addEventListener("contextmenu",this._boundContextmenu)}_unbindEvents(){this._svg.removeEventListener("click",this._boundClick),this._svg.removeEventListener("mouseover",this._boundMouseover),this._svg.removeEventListener("mouseout",this._boundMouseout),this._svg.removeEventListener("mousemove",this._boundMousemove),this._svg.removeEventListener("contextmenu",this._boundContextmenu)}_closestGroup(e){let t=e.target;return t?t.closest("g.sd-el[data-id]"):null}_svgPoint(e){let t=this._svg.getScreenCTM();if(t){let n=t.inverse();return{x:n.a*e.clientX+n.c*e.clientY+n.e,y:n.b*e.clientX+n.d*e.clientY+n.f,clientX:e.clientX,clientY:e.clientY}}return{x:e.offsetX,y:e.offsetY,clientX:e.clientX,clientY:e.clientY}}_getInfoForGroup(e){let t=e.getAttribute("data-id");if(t)return this._elementMap.get(t)?.info}_onClick(e){let t=this._closestGroup(e);if(t){let n=this._getInfoForGroup(t);if(n){this._emit("element:click",n,e);let s=this._selectedId;this._selectedId=n.id,s&&s!==n.id&&this._clearSelectedClass(s),t.classList.add("sd-selected"),this._emit("element:select",n,e)}}else this._selectedId&&(this._clearSelectedClass(this._selectedId),this._selectedId=null,this._emit("element:select",null,e)),this._emit("canvas:click",this._svgPoint(e),e)}_onMouseover(e){let t=this._closestGroup(e);if(!t)return;let n=e.relatedTarget;if(n&&t.contains(n))return;let s=this._getInfoForGroup(t);s&&(this._emit("element:hover",s,e),s.tooltip&&this._showTooltip(s.tooltip,e.clientX,e.clientY))}_onMousemove(e){let t=this._closestGroup(e);if(t){let n=t.getAttribute("data-tooltip");n&&this._showTooltip(n,e.clientX,e.clientY)}else this._hideTooltip()}_onMouseout(e){let t=this._closestGroup(e);if(!t)return;let n=e.relatedTarget;if(n&&t.contains(n))return;let s=this._getInfoForGroup(t);s&&(this._emit("element:leave",s,e),this._hideTooltip())}_onContextmenu(e){this._emit("canvas:contextmenu",this._svgPoint(e),e)}_clearSelectedClass(e){let t=this._elementMap.get(e);t&&(t.info.element.classList.remove("sd-selected"),t.info.element.style.removeProperty("--sd-highlight"),t.info.element.querySelectorAll(ru).forEach(n=>{let s=n;s.hasAttribute(na)&&q1(s)}))}_emit(e,...t){let n=this._listeners.get(e);if(n)for(let s of n)try{s(...t)}catch{}}on(e,t){return this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t),this}off(e,t){return t?this._listeners.get(e)?.delete(t):this._listeners.delete(e),this}highlight(e,t){let n=this._elementMap.get(e);n&&(n.info.element.classList.add("sd-selected"),t&&(n.info.element.style.setProperty("--sd-highlight",t),n.info.element.querySelectorAll(ru).forEach(s=>{let i=s;I2(i),i.style.setProperty("stroke",t)})))}clearHighlight(){this._svg.querySelectorAll("g.sd-selected").forEach(t=>{t.classList.remove("sd-selected"),t.style.removeProperty("--sd-highlight"),t.querySelectorAll(ru).forEach(n=>{let s=n;s.hasAttribute(na)&&q1(s)})}),this._selectedId=null}setTheme(e){this._teardownAutoTheme(),this._opts={...this._opts,theme:e},this._theme=Zs(e),this.update(this._json),this._initAutoTheme()}update(e){let t=typeof e=="string"?JSON.parse(e):e;this._json=t,this._unbindEvents(),this._render(),this._bindEvents(),this._selectedId=null}destroy(){this._destroyed||(this._destroyed=!0,this._unbindEvents(),this._teardownAutoTheme(),this._tooltipEl&&(this._tooltipEl.remove(),this._tooltipEl=null),this._container.innerHTML="",this._elementMap.clear(),this._listeners.clear())}get svgElement(){return this._svg}getElementInfo(e){return this._elementMap.get(e)?.info}getAllElements(){return[...this._elementMap.values()].map(e=>e.info)}getDrawingInfo(){let e=this._svg.getAttribute("viewBox")??"",t=this._svg.width.baseVal.value||parseFloat(this._svg.getAttribute("width")??"0"),n=this._svg.height.baseVal.value||parseFloat(this._svg.getAttribute("height")??"0");return{width:t,height:n,viewBox:e,theme:this._theme,elementCount:this._json.elements.filter(s=>s!=="push"&&s!=="pop").length,namedElementCount:this._elementMap.size}}};function H1(r,e,t){if(typeof document>"u")throw new Error("mountFromJson requires a browser environment with DOM access.");let n=typeof e=="string"?JSON.parse(e):e;return new La(r,n,t??{})}return nd(L2);})();