)),o=this.uniquePort(t,new RegExp(`^${i} vendor/schematic-style-analysis.js - seveibar/nema17-rp2040-stepper-controller - tscircuit ));if(s\u0026\u0026o\u0026\u0026s!==o\u0026\u0026!Ui(s,new RegExp(`^${i} vendor/schematic-style-analysis.js - seveibar/nema17-rp2040-stepper-controller - tscircuit ))\u0026\u0026!Ui(o,new RegExp(`^${n} vendor/schematic-style-analysis.js - seveibar/nema17-rp2040-stepper-controller - tscircuit )))return[s,o]}}hasGroundedDriver(t,e){return(this.index.portsByNet.get(t)??[]).some((r)=\u003e{let n=r.source_component_id,i=this.index.components.get(n);if(i?.ftype!==\"simple_chip\"\u0026\u0026!(i?.ftype===\"simple_transistor\"\u0026\u0026i.transistor_type===\"npn\"))return!1;if(this.index.portsByComponent.get(n)?.length!==3)return!1;let s=this.uniquePort(n,/^(?:C|COLLECTOR)$/),o=this.uniquePort(n,/^(?:E|EMITTER)$/),c=this.uniquePort(n,/^(?:B|BASE)$/);if(!s||!o||!c||new Set([s,o,c]).size!==3||[s,o,c].some((p)=\u003ep.do_not_connect)||s.source_port_id!==r.source_port_id)return!1;let l=this.index.connected(o.source_port_id),a=this.index.connected(c.source_port_id);return this.index.groundNets.has(l)\u0026\u0026!this.index.powerNets.has(l)\u0026\u0026new Set([t,e,l,a]).size===4})}static issueToString(t){let e=[];return v(e,\"relayName\",t.relaySchematicBox.sourceComponentName),v(e,\"diodeName\",t.diodeSchematicBox.sourceComponentName),v(e,\"distanceFromCoilPins\",t.distanceFromCoilPins),v(e,\"message\",t.message),`\u003cFlybackDiodeSeparatedFromRelayCoil ${e.join(\" \")} /\u003e`}}function Ui(t,e){return[t.name,...t.port_hints??[]].some((r)=\u003ee.test(r.toUpperCase().replace(/[\\s_]/g,\"\")))}var nr=0.01;class Yn extends U{params;index;hostIds;traces;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.hostIds=[...this.index.components.values()].filter((e)=\u003ee.ftype===\"simple_chip\").map((e)=\u003ee.source_component_id),this.traces=t.ctx.circuitJson.filter((e)=\u003ee.type===\"schematic_trace\"),this.solved=this.hostIds.length===0}_step(){let t=this.hostIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.hostIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.portsByComponent.get(t)??[],i=n.filter((N)=\u003eJl(N)===\"positive\"),s=n.filter((N)=\u003eJl(N)===\"negative\"),o=n.filter((N)=\u003eGi(N,/^(?:OUT|VOUT|OUTPUT)$/));if(!r||i.length!==1||s.length!==1||o.length!==1||!n.some((N)=\u003eGi(N,/^(?:VS|VCC|VDD)$/))||!n.some((N)=\u003eGi(N,/^(?:GND|GROUND|VSS)$/)))return;let c=[i[0],s[0]],l=c.map((N)=\u003ee.connected(N.source_port_id));if(c.some((N)=\u003eN.do_not_connect)||l[0]===l[1]||l.includes(e.connected(o[0].source_port_id)))return;let a=c.map((N)=\u003ee.port(N)),[p,d]=a;if(!p||!d||!p.facing_direction||p.facing_direction!==d.facing_direction||a.some((N)=\u003eN.schematic_sheet_id!==r.schematicSheetId))return;let m=new Set((e.portsByNet.get(l[0])??[]).filter((N)=\u003ee.components.get(N.source_component_id)?.ftype===\"simple_resistor\").map((N)=\u003eN.source_component_id).filter((N)=\u003ee.twoTerminalNets(N)?.includes(l[1])));if(m.size!==1)return;let f=[...m][0],_=e.components.get(f);if(_?.ftype!==\"simple_resistor\"||!Number.isFinite(_.resistance)||_.resistance\u003c=0||_.resistance\u003e1)return;if(l.some((N)=\u003e(e.portsByNet.get(N)??[]).some((at)=\u003eat.source_component_id!==t\u0026\u0026Jl(at)!==void 0\u0026\u0026e.components.get(at.source_component_id)?.ftype===\"simple_chip\")))return;let g=e.placement(f);if(!g||!e.sameLocalScope(r,g))return;let y=e.portsByComponent.get(f);if(y.some((N)=\u003eN.do_not_connect))return;let S=l.map((N)=\u003ee.port(y.find((at)=\u003ee.connected(at.source_port_id)===N)));if(S.some((N)=\u003e!N||N.schematic_sheet_id!==r.schematicSheetId))return;let P=p.facing_direction===\"left\"||p.facing_direction===\"right\",b=(N)=\u003eP?N.y:N.x,C=b(p.center),L=b(d.center),B=Math.abs(C-L);if(B\u003cnr)return;let k=P?g.schY:g.schX,I=(P?g.height:g.width)/2,j=Math.max(Math.min(C,L)-(k+I),k-I-Math.max(C,L));if(j\u003c=Math.max(1.5,2*B)||Math.hypot(g.schX-r.schX,g.schY-r.schY)\u003eMath.max(8,4*Math.max(r.width,r.height)))return;let Q=a.map((N,at)=\u003ethis.hasVisibleConnection(S[at],N,l[at]));if(Q[0]===Q[1])return;let lt=Q[0]?1:0,z=l[lt];if(!this.params.ctx.circuitJson.some((N)=\u003e{if(N.type!==\"schematic_net_label\"||N.schematic_sheet_id!==r.schematicSheetId)return!1;if(N.source_net_id\u0026\u0026(e.connected(N.source_net_id)===z||e.connected(`connectivity:${N.source_net_id}`)===z))return!0;let at=S[lt].center;if(N.anchor_position\u0026\u0026Math.hypot(N.anchor_position.x-at.x,N.anchor_position.y-at.y)\u003cnr)return!0;return N.source_trace_id!==void 0\u0026\u0026this.sourceTraceTouchesNet(N.source_trace_id,z)}))return;this.params.issues.push({lineItemType:\"CurrentSenseShuntSeparatedFromInputs\",amplifierSchematicBox:r,shuntSchematicBox:g,positiveInputSourcePortId:c[0].source_port_id,negativeInputSourcePortId:c[1].source_port_id,inputBandGap:j,message:`Place ${g.sourceComponentName||\"component\"} near ${r.sourceComponentName||\"component\"}.${c[0].name}/${c[1].name}, so both sense connections can be read together. Move or rotate the shunt as needed; preserve all pin connections and leave room for labels.`})}hasVisibleConnection(t,e,r){let n=this.traces.filter((o)=\u003e{if(o.schematic_sheet_id!==t.schematic_sheet_id)return!1;if(o.subcircuit_connectivity_map_key)return this.index.connected(`connectivity:${o.subcircuit_connectivity_map_key}`)===r;if(this.sourceTraceTouchesNet(o.source_trace_id,r))return!0;let c=[o.edges[0]?.from,o.edges.at(-1)?.to],l=new Set(this.params.ctx.circuitJson.flatMap((a)=\u003ea.type===\"schematic_port\"\u0026\u0026a.source_port_id\u0026\u0026a.schematic_sheet_id===o.schematic_sheet_id\u0026\u0026c.some((p)=\u003ep\u0026\u0026Math.hypot(p.x-a.center.x,p.y-a.center.y)\u003cnr)?[this.index.connected(a.source_port_id)]:[]));return l.size===1\u0026\u0026l.has(r)}).flatMap((o)=\u003eo.edges),i=n.filter((o)=\u003eos(t.center,o.from,o.to)),s=new Set;for(let o=0;o\u003ci.length;o++){let c=i[o];if(os(e.center,c.from,c.to))return!0;for(let[l,a]of n.entries()){if(s.has(l)||![c.from,c.to].some((p)=\u003eos(p,a.from,a.to))\u0026\u0026![a.from,a.to].some((p)=\u003eos(p,c.from,c.to)))continue;s.add(l),i.push(a)}}return!1}sourceTraceTouchesNet(t,e){if(!t)return!1;let r=this.params.ctx.circuitJson.find((n)=\u003en.type===\"source_trace\"\u0026\u0026n.source_trace_id===t);return r?.type===\"source_trace\"\u0026\u0026r.connected_source_port_ids.some((n)=\u003ethis.index.connected(n)===e)}static issueToString(t){let e=[];return v(e,\"amplifierName\",t.amplifierSchematicBox.sourceComponentName),v(e,\"shuntName\",t.shuntSchematicBox.sourceComponentName),v(e,\"inputBandGap\",t.inputBandGap),v(e,\"message\",t.message),`\u003cCurrentSenseShuntSeparatedFromInputs ${e.join(\" \")} /\u003e`}}function Gi(t,e){return[t.name,...t.port_hints??[]].some((r)=\u003ee.test(r.toUpperCase().replace(/[\\s_]/g,\"\")))}function Jl(t){let e=Gi(t,/^(?:IN\\+|VIN\\+|INPOS|VINPOS)$/),r=Gi(t,/^(?:IN-|VIN-|INNEG|VINNEG)$/);return e===r?void 0:e?\"positive\":\"negative\"}function os(t,e,r){let n=r.x-e.x,i=r.y-e.y,s=Math.hypot(n,i);if(s\u003cnr)return Math.hypot(t.x-e.x,t.y-e.y)\u003cnr;let o=((t.x-e.x)*n+(t.y-e.y)*i)/s;return o\u003e=-nr\u0026\u0026o\u003c=s+nr\u0026\u0026Math.abs((t.x-e.x)*i-(t.y-e.y)*n)/s\u003cnr}class Ln extends U{params;index;positiveNets=new Set;resistorIds;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.resistorIds=[...this.index.components.values()].filter((e)=\u003ee.ftype===\"simple_resistor\").map((e)=\u003ee.source_component_id);for(let e of t.ctx.circuitJson)if(e.type===\"source_net\"\u0026\u0026e.is_positive_voltage_source)this.positiveNets.add(this.index.connected(e.source_net_id));this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.resistorIds.length,!t||!this.isResistor(t))return;let e=this.index,r=e.twoTerminalNets(t);if(!r)return;let n=r.filter((y)=\u003ee.isRail(y));if(n.length!==1)return;let i=n[0];if(!this.positiveNets.has(i)||e.groundNets.has(i))return;let s=r.find((y)=\u003ey!==i),o=e.portsByNet.get(s)??[],c=new Set(o.filter((y)=\u003ee.components.get(y.source_component_id)?.ftype===\"simple_resistor\").map((y)=\u003ey.source_component_id));if(c.size!==2)return;let l=[...c].find((y)=\u003ey!==t);if(!this.isResistor(l))return;let a=e.twoTerminalNets(l),p=a?.find((y)=\u003ey!==s);if(!a?.includes(s)||!p||!e.groundNets.has(p)||e.powerNets.has(p)||!o.some((y)=\u003e!c.has(y.source_component_id)))return;let d=e.placement(t),m=e.placement(l);if(!d||!m||!e.sameLocalScope(d,m))return;let f=this.getDownwardResistorPorts(t,i,s),_=this.getDownwardResistorPorts(l,s,p);if(!f||!_)return;let g=m.schY-m.height/2-(d.schY+d.height/2);if(g\u003c=1.5)return;this.params.issues.push({lineItemType:\"VoltageDividerSupplyResistorBelowGroundResistor\",supplyResistorSchematicBox:d,groundResistorSchematicBox:m,supplyTapSourcePortId:f.bottom.source_port_id,groundTapSourcePortId:_.top.source_port_id,reversedBodyGap:g,message:`Place ${d.sourceComponentName||\"component\"} above ${m.sourceComponentName||\"component\"}, close enough to read their shared divider tap. Preserve all connections and leave room for labels; exact alignment is not required.`})}isResistor(t){let e=this.index.components.get(t);return e?.ftype===\"simple_resistor\"\u0026\u0026Number.isFinite(e.resistance)\u0026\u0026e.resistance\u003e0}getDownwardResistorPorts(t,e,r){let n=this.index,i=n.placement(t),s=n.portsByComponent.get(t);if(s.some((p)=\u003ep.do_not_connect))return;let o=s.find((p)=\u003en.connected(p.source_port_id)===e),c=s.find((p)=\u003en.connected(p.source_port_id)===r);if(!o||!c)return;let l=n.port(o),a=n.port(c);if(!l||!a||l.schematic_sheet_id!==i.schematicSheetId||a.schematic_sheet_id!==i.schematicSheetId||l.facing_direction!==\"up\"||a.facing_direction!==\"down\"||l.center.y\u003c=a.center.y)return;return{top:o,bottom:c}}static issueToString(t){let e=[];return v(e,\"supplyResistorName\",t.supplyResistorSchematicBox.sourceComponentName),v(e,\"groundResistorName\",t.groundResistorSchematicBox.sourceComponentName),v(e,\"reversedBodyGap\",t.reversedBodyGap),v(e,\"message\",t.message),`\u003cVoltageDividerSupplyResistorBelowGroundResistor ${e.join(\" \")} /\u003e`}}class Tn extends U{params;index;hostIds;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.hostIds=[...this.index.components.values()].filter((e)=\u003ee.ftype===\"simple_chip\").map((e)=\u003ee.source_component_id),this.solved=this.hostIds.length===0}_step(){let t=this.hostIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.hostIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.portsByComponent.get(t)??[];if(!r||n.some((k)=\u003e!ss(k)))return;let i=n.filter((k)=\u003ess(k)===\"input\"),s=n.filter((k)=\u003ess(k)===\"output\"),o=n.filter((k)=\u003ess(k)===\"ground\");if(i.length!==1||s.length!==1||!o.length)return;let c=i[0],l=s[0];if([c,l,...o].some((k)=\u003ek.do_not_connect))return;let a=e.connected(c.source_port_id),p=e.connected(l.source_port_id),d=new Set(o.map((k)=\u003ee.connected(k.source_port_id)));if(d.size!==1)return;let m=[...d][0];if(new Set([a,p,m]).size!==3||!(e.groundNets.has(m)||o.some((k)=\u003ek.requires_ground||k.provides_ground))||!(e.powerNets.has(a)||c.requires_power)||!(e.powerNets.has(p)||l.provides_power))return;let f=e.port(c),_=e.port(l);if(!f||!_||f.schematic_sheet_id!==r.schematicSheetId||_.schematic_sheet_id!==r.schematicSheetId)return;let g=f.facing_direction===\"left\"\u0026\u0026_.facing_direction===\"right\"||f.facing_direction===\"right\"\u0026\u0026_.facing_direction===\"left\",y=f.facing_direction===\"up\"\u0026\u0026_.facing_direction===\"down\"||f.facing_direction===\"down\"\u0026\u0026_.facing_direction===\"up\";if(!g\u0026\u0026!y)return;let S=_.facing_direction===\"right\"||_.facing_direction===\"up\"?1:-1;if(S*(g?_.center.x-f.center.x:_.center.y-f.center.y)\u003c=0.01)return;let b=this.localCapacitor(r,a,m),C=this.localCapacitor(r,p,m);if(!b||!C)return;let L=(k,I)=\u003e{let j=I*S*(g?k.schX-r.schX:k.schY-r.schY),Q=g?(r.width+k.width)/2:(r.height+k.height)/2;return j\u003eQ+0.2};if(!L(b,1)||!L(C,-1))return;let B=r.sourceComponentName||\"component\";this.params.issues.push({lineItemType:\"RegulatorCapacitorsOnWrongSides\",regulatorSchematicBox:r,inputCapacitorSchematicBox:b,outputCapacitorSchematicBox:C,inputSourcePortId:c.source_port_id,outputSourcePortId:l.source_port_id,message:`Place ${b.sourceComponentName} near ${B}.${c.name} on the ${f.facing_direction} side and ${C.sourceComponentName} near ${B}.${l.name} on the ${_.facing_direction} side. Preserve all connections and leave room for labels; exact alignment is not required.`})}localCapacitor(t,e,r){let n=this.index,i=[],s=Math.max(6,4*Math.max(t.width,t.height)),o=new Set((n.portsByNet.get(e)??[]).map((c)=\u003ec.source_component_id));for(let c of o){if(n.components.get(c)?.ftype!==\"simple_capacitor\")continue;let l=n.twoTerminalNets(c),a=n.placement(c);if(!l?.includes(r)||!a||!n.sameLocalScope(t,a))continue;if(Math.hypot(a.schX-t.schX,a.schY-t.schY)\u003es)continue;if(n.portsByComponent.get(c).some((d)=\u003ed.do_not_connect||!n.port(d)||n.port(d).schematic_sheet_id!==t.schematicSheetId))continue;i.push(a)}return i.length===1?i[0]:void 0}static issueToString(t){let e=[];return v(e,\"regulatorName\",t.regulatorSchematicBox.sourceComponentName),v(e,\"inputCapacitorName\",t.inputCapacitorSchematicBox.sourceComponentName),v(e,\"outputCapacitorName\",t.outputCapacitorSchematicBox.sourceComponentName),v(e,\"message\",t.message),`\u003cRegulatorCapacitorsOnWrongSides ${e.join(\" \")} /\u003e`}}function ss(t){let e=new Set;for(let r of[t.name,...t.port_hints??[]]){let n=r.toUpperCase().replace(/[ _-]/g,\"\");if(/^(?:VIN|IN|INPUT)$/.test(n))e.add(\"input\");else if(/^(?:VOUT|OUT|OUTPUT)$/.test(n))e.add(\"output\");else if(/^(?:GND\\d*|VSS)$/.test(n))e.add(\"ground\");else if(/^(?:EN|ENABLE|CE|SHDN|NC\\d*|EP|PAD|ADJ|FB|BYP|BYPASS|NR|PG|PGOOD)$/.test(n))e.add(\"control\")}return e.size===1?[...e][0]:void 0}var Qi=0.01,Fy={right:{x:1,y:0},left:{x:-1,y:0},up:{x:0,y:1},down:{x:0,y:-1}},Ht=(t,e)=\u003et.x*e.x+t.y*e.y,Hi=(t,e)=\u003eMath.abs(t.x-e.x)+Math.abs(t.y-e.y),ir=(t,e)=\u003eHi(t,e)\u003c=Qi,En=(t)=\u003eMath.round(t*100)/100;class Rn extends U{params;constructor(t){super();this.params=t}_step(){let{ctx:t,issues:e}=this.params,r=new tt(t);for(let i of r.portsByComponent.values())for(let s of i){let o=r.connected(s.source_port_id);if(s.requires_ground||s.provides_ground)r.groundNets.add(o);if(s.requires_power||s.provides_power)r.powerNets.add(o)}let n=t.circuitJson.filter((i)=\u003ei.type===\"schematic_trace\");for(let[i,s]of r.components){if(s.ftype!==\"simple_pin_header\"\u0026\u0026s.ftype!==\"simple_connector\")continue;let o=r.placement(i),c=r.portsByComponent.get(i)??[];if(!o||c.length\u003c2)continue;let l=c.map((D)=\u003er.port(D)),a=l[0]?.facing_direction;if(!a||l.some((D)=\u003e!D||D.facing_direction!==a))continue;let p=Fy[a],d={x:-p.y,y:p.x},m=n.filter((D)=\u003eD.schematic_sheet_id===o.schematicSheetId),f=t.circuitJson.filter((D)=\u003eD.type===\"schematic_net_label\"\u0026\u0026D.schematic_sheet_id===o.schematicSheetId),_=[],g=!1;for(let D of c){let it=r.port(D),rt=r.connected(D.source_port_id),G=(r.portsByNet.get(rt)??[]).filter((st)=\u003est.source_port_id!==D.source_port_id),H=m.filter((st)=\u003est.edges.some((bt)=\u003eir(bt.from,it.center)||ir(bt.to,it.center)));if(r.isRail(rt)){if(H.some((st)=\u003e!f.some((bt)=\u003ebt.anchor_position\u0026\u0026My(st,it.center,bt.anchor_position))))g=!0;continue}if(G.length===0){if(H.length\u003e0)g=!0;continue}let J=G.length===1?r.port(G[0]):void 0,q=G.length===1?r.placement(G[0].source_component_id):void 0;if(!J?.facing_direction||!q||!r.sameLocalScope(o,q)||Ht(Fy[J.facing_direction],p)!==-1){g=!0;break}_.push({pin:it,peer:J,component:q})}if(g||_.length\u003c2)continue;if(_.some((D)=\u003eHt(D.peer.center,p)\u003e=Ht(D.pin.center,p)-2))continue;let y=_.map((D)=\u003em.filter((it)=\u003eMy(it,D.pin.center,D.peer.center)\u0026\u0026s5(it)\u003e=3)).filter((D)=\u003eD.length\u003e0);if(y.length\u003c2)continue;let S=y.flat(),P=[..._].sort((D,it)=\u003eHt(D.pin.center,d)-Ht(it.pin.center,d));if(P.some((D,it)=\u003eit\u003e0\u0026\u0026Ht(D.peer.center,d)\u003c=Ht(P[it-1].peer.center,d)+Qi))continue;let b={x:o.schX,y:o.schY},C=Math.max(..._.map((D)=\u003eHt(D.pin.center,p)-Ht(b,p))),L=Math.min(..._.map((D)=\u003eHt(D.peer.center,p)))-2-C,B=_.map((D)=\u003eHt(D.peer.center,d)-Ht(D.pin.center,d)+Ht(b,d)).sort((D,it)=\u003eD-it),k=B[Math.floor(B.length/2)],I={x:En(p.x*L+d.x*k),y:En(p.y*L+d.y*k)},j={x:I.x-b.x,y:I.y-b.y},Q=(D)=\u003e({x:D.center.x+j.x,y:D.center.y+j.y});if(_.some((D)=\u003eHi(Q(D.pin),D.peer.center)\u003eHi(D.pin.center,D.peer.center)+Qi))continue;let lt=_.reduce((D,it)=\u003eD+Hi(it.pin.center,it.peer.center),0),z=_.reduce((D,it)=\u003eD+Hi(Q(it.pin),it.peer.center),0);if(lt-z\u003c4||z\u003elt*0.75)continue;let N=t.componentPlacements.filter((D)=\u003eD.schematicSheetId===o.schematicSheetId\u0026\u0026D.schematicComponentId!==o.schematicComponentId),at=zt(I.x,I.y,o.width+0.4,o.height+0.4);if(N.some((D)=\u003exr(at,zt(D.schX,D.schY,D.width,D.height))))continue;if(_.some((D)=\u003e{let it=Q(D.pin),rt=D.peer.center,G=(Ht(it,p)+Ht(rt,p))/2,H=[it,{x:p.x*G+d.x*Ht(it,d),y:p.y*G+d.y*Ht(it,d)},{x:p.x*G+d.x*Ht(rt,d),y:p.y*G+d.y*Ht(rt,d)},rt];return N.some((J)=\u003eJ.schematicComponentId!==D.component.schematicComponentId\u0026\u0026H.slice(1).some((q,st)=\u003ea5(H[st],q,J)))}))continue;let ot=[...new Map(_.map((D)=\u003e[D.component.schematicComponentId,D.component])).values()],et=o.sourceComponentName||\"component\";e.push({lineItemType:\"ConnectorPositionCausesTraceDetours\",connectorSchematicBox:o,connectedComponents:ot,schematicTraceIds:[...new Set(S.map((D)=\u003eD.schematic_trace_id))],evaluatedSignalCount:_.length,newSchX:I.x,newSchY:I.y,deltaSchX:En(j.x),deltaSchY:En(j.y),currentTotalSignalDistance:En(lt),suggestedTotalSignalDistance:En(z),message:`Move ${et} to schX=${I.x}, schY=${I.y} so its signal pins face ${ot.map((D)=\u003eD.sourceComponentName||\"component\").join(\", \")}. Preserve rotation and pin assignments; reroute the connections and attached rail labels.`})}this.solved=!0}static issueToString(t){let e=[];v(e,\"connectorComponentName\",t.connectorSchematicBox.sourceComponentName),v(e,\"connectedComponents\",t.connectedComponents.map((r)=\u003er.sourceComponentName||\"component\").join(\",\"));for(let r of[\"evaluatedSignalCount\",\"newSchX\",\"newSchY\",\"deltaSchX\",\"deltaSchY\",\"currentTotalSignalDistance\",\"suggestedTotalSignalDistance\"])v(e,r,t[r]);return v(e,\"message\",t.message),`\u003cConnectorPositionCausesTraceDetours ${e.join(\" \")} /\u003e`}}function My(t,e,r){let n=t.edges[0]?.from,i=t.edges.at(-1)?.to;return!!n\u0026\u0026!!i\u0026\u0026(ir(n,e)\u0026\u0026ir(i,r)||ir(n,r)\u0026\u0026ir(i,e))}function s5(t){let e,r=0;for(let n=0;n\u003ct.edges.length;n++){let i=t.edges[n];if(n\u003e0\u0026\u0026!ir(t.edges[n-1].to,i.from))return 0;if(ir(i.from,i.to))continue;let s=Math.abs(i.from.y-i.to.y)\u003cQi?\"x\":Math.abs(i.from.x-i.to.x)\u003cQi?\"y\":void 0;if(!s)return 0;if(e\u0026\u0026e!==s)r++;e=s}return r}function a5(t,e,r){let n=zt(r.schX,r.schY,r.width+0.2,r.height+0.2);return Math.max(t.x,e.x)\u003en.left\u0026\u0026Math.min(t.x,e.x)\u003cn.right\u0026\u0026Math.max(t.y,e.y)\u003en.bottom\u0026\u0026Math.min(t.y,e.y)\u003cn.top}class On extends U{index;positiveNets=new Set;transistorIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t);for(let r of t.circuitJson)if(r.type===\"source_net\"\u0026\u0026r.is_positive_voltage_source)this.positiveNets.add(this.index.connected(r.source_net_id));this.transistorIds=[...this.index.components.values()].filter((r)=\u003er.ftype===\"simple_transistor\"\u0026\u0026r.transistor_type===\"npn\").map((r)=\u003er.source_component_id),this.solved=this.transistorIds.length===0}_step(){let t=this.transistorIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.transistorIds.length,!t)return;let e=this.index,r=e.placement(t);if(!r||e.portsByComponent.get(t)?.length!==3)return;let n=e.namedPort(t,\"base\"),i=e.namedPort(t,\"collector\"),s=e.namedPort(t,\"emitter\");if(!n||!i||!s)return;let o=e.connected(n.source_port_id),c=e.connected(i.source_port_id),l=e.connected(s.source_port_id);if(new Set([o,c,l]).size!==3||!e.groundNets.has(l)||e.powerNets.has(l)||e.isRail(o)||e.isRail(c))return;let a=(e.portsByNet.get(o)??[]).filter((it)=\u003eit.source_component_id!==t);if(a.length!==1)return;let p=a[0].source_component_id,d=e.components.get(p),m=e.placement(p),_=e.twoTerminalNets(p)?.find((it)=\u003eit!==o);if(d?.ftype!==\"simple_resistor\"||d.resistance\u003c=0||!m||!e.sameLocalScope(r,m)||!_||e.isRail(_)||_===c)return;let g=(e.portsByNet.get(c)??[]).filter((it)=\u003eit.source_component_id!==t),y=g.filter((it)=\u003ee.components.get(it.source_component_id)?.ftype===\"simple_chip\");if(y.length!==1)return;let S=y[0].source_component_id,P=e.placement(S),C=e.twoTerminalNets(S)?.find((it)=\u003eit!==c);if(!P||!e.sameLocalScope(r,P)||!C||!this.positiveNets.has(C)||e.groundNets.has(C))return;let L=g.filter((it)=\u003eit.source_component_id!==S);if(L.length!==1)return;let B=L[0].source_component_id,k=e.placement(B),I=e.namedPort(B,\"anode\"),j=e.namedPort(B,\"cathode\");if(e.components.get(B)?.ftype!==\"simple_diode\"||!e.twoTerminalNets(B)||!I||!j||e.connected(I.source_port_id)!==c||e.connected(j.source_port_id)!==C||!k||!e.sameLocalScope(r,k))return;let Q=e.port(i),lt=e.port(s),z=e.port(n);if(!Q||!lt||!z)return;let N=Q.facing_direction,at=lt.facing_direction;if(!N||!at)return;let ot=[];if(r.schY\u003e=P.schY)ot.push(\"transistor_not_below_load\");if(N!==\"up\")ot.push(\"collector_not_up\");if(at!==\"down\")ot.push(\"emitter_not_down\");if(ot.length===0)return;let et=r.sourceComponentName||\"component\",D=P.sourceComponentName||\"component\";this.issues.push({lineItemType:\"LowSideTransistorNotAlignedWithLoad\",transistorSchematicBox:r,loadSchematicBox:P,baseResistorSchematicBox:m,clampDiodeSchematicBox:k,collectorSourcePortId:i.source_port_id,emitterSourcePortId:s.source_port_id,collectorFacingDirection:N,emitterFacingDirection:at,placementProblems:ot,message:`Arrange ${et} below ${D}, with its collector facing up toward the load and emitter facing down toward ground; place ${m.sourceComponentName||\"component\"} beside the base. Preserve all pin connections and reroute affected traces.`})}static issueToString(t){let e=[];return v(e,\"transistorName\",t.transistorSchematicBox.sourceComponentName),v(e,\"loadName\",t.loadSchematicBox.sourceComponentName),v(e,\"baseResistorName\",t.baseResistorSchematicBox.sourceComponentName),v(e,\"clampDiodeName\",t.clampDiodeSchematicBox.sourceComponentName),v(e,\"placementProblems\",t.placementProblems.join(\",\")),v(e,\"collectorFacingDirection\",t.collectorFacingDirection),v(e,\"emitterFacingDirection\",t.emitterFacingDirection),v(e,\"message\",t.message),`\u003cLowSideTransistorNotAlignedWithLoad ${e.join(\" \")} /\u003e`}}class Wn extends U{params;index;hostIds;reportedPairs=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.hostIds=[...this.index.components.values()].filter((e)=\u003ee.ftype===\"simple_chip\").map((e)=\u003ee.source_component_id),this.solved=this.hostIds.length===0}_step(){let t=this.hostIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.hostIds.length,!t)return;let e=this.index.portsByComponent.get(t)??[],r=e.filter((L)=\u003eCy(L)===\"positive\"),n=e.filter((L)=\u003eCy(L)===\"negative\");if(r.length!==1||n.length!==1)return;let i=r[0],s=n[0],o=this.seriesResistor(i),c=this.seriesResistor(s);if(!o||!c||o.axis!==c.axis||!this.index.sameLocalScope(o.placement,c.placement)||new Set([o.hostNet,c.hostNet,o.interfaceNet,c.interfaceNet]).size!==4||!this.shareInterface(o,c,t))return;let l=[o.id,c.id].sort().join(\"\\x00\");if(this.reportedPairs.has(l))return;let a=o.placement,p=c.placement,d=o.axis===\"horizontal\",m=Math.abs(d?a.schX-p.schX:a.schY-p.schY),f=Math.abs(d?a.schY-p.schY:a.schX-p.schX),_=d?a.width:a.height,g=d?p.width:p.height,y=d?a.height:a.width,S=d?p.height:p.width;if(m-(_+g)/2\u003cMath.max(_,g)||f\u003e=(y+S)/2-0.01)return;this.reportedPairs.add(l);let b=a.sourceComponentName||\"component\",C=p.sourceComponentName||\"component\";this.params.issues.push({lineItemType:\"UsbSeriesResistorsNotAligned\",positiveResistorSchematicBox:a,negativeResistorSchematicBox:p,hostSourceComponentId:t,positiveSourcePortId:i.source_port_id,negativeSourcePortId:s.source_port_id,signalAxis:o.axis,message:`Place ${b} (D+) and ${C} (D−) near each other and draw clear traces to their corresponding USB ports. Exact alignment is not required; preserve pin assignments and leave space for labels.`})}seriesResistor(t){let e=this.index,r=e.connected(t.source_port_id);if(e.isRail(r))return;let n=new Set((e.portsByNet.get(r)??[]).filter((f)=\u003ee.components.get(f.source_component_id)?.ftype===\"simple_resistor\").map((f)=\u003ef.source_component_id));if(n.size!==1)return;let i=[...n][0],o=e.twoTerminalNets(i)?.find((f)=\u003ef!==r),c=e.placement(i);if(!o||e.isRail(o)||!c)return;if((e.portsByNet.get(o)??[]).some((f)=\u003ef.source_component_id!==i\u0026\u0026e.components.get(f.source_component_id)?.ftype===\"simple_resistor\"))return;let l=e.portsByComponent.get(i).map((f)=\u003ee.port(f)),[a,p]=l;if(!a||!p)return;let d=new Set([a.facing_direction,p.facing_direction]),m;if(d.has(\"left\")\u0026\u0026d.has(\"right\")\u0026\u0026Math.abs(a.center.y-p.center.y)\u003c0.01)m=\"horizontal\";else if(d.has(\"up\")\u0026\u0026d.has(\"down\")\u0026\u0026Math.abs(a.center.x-p.center.x)\u003c0.01)m=\"vertical\";else return;return{id:i,placement:c,hostNet:r,interfaceNet:o,axis:m}}shareInterface(t,e,r){let n=(s)=\u003enew Set((this.index.portsByNet.get(s)??[]).map((o)=\u003eo.source_component_id).filter((o)=\u003eo!==r\u0026\u0026o!==t.id\u0026\u0026o!==e.id\u0026\u0026(this.index.portsByComponent.get(o)?.length??0)\u003e2)),i=n(t.interfaceNet);return[...n(e.interfaceNet)].some((s)=\u003ei.has(s))}static issueToString(t){let e=[];return v(e,\"positiveResistorName\",t.positiveResistorSchematicBox.sourceComponentName),v(e,\"negativeResistorName\",t.negativeResistorSchematicBox.sourceComponentName),v(e,\"signalAxis\",t.signalAxis),v(e,\"message\",t.message),`\u003cUsbSeriesResistorsNotAligned ${e.join(\" \")} /\u003e`}}function Cy(t){let e=new Set;for(let r of[t.name,...t.port_hints??[]]){let n=r.toUpperCase();if(/^(?:USB_?)?D(?:P|\\+|_POS)$/.test(n))e.add(\"positive\");if(/^(?:USB_?)?D(?:M|N|-|_NEG)$/.test(n))e.add(\"negative\")}return e.size===1?[...e][0]:void 0}function ky(t){return t.filter((e)=\u003ee!==void 0).reduce((e,r)=\u003eQo(e,r),{})}function Ny(t,e,r){return{rects:[{center:{x:t.schX,y:t.schY},width:t.width,height:t.height,stroke:e,fill:e.replace(\"0.95\",\"0.15\"),label:r}]}}function Yy(t){return{rects:t.filter((r)=\u003er.type===\"schematic_box\").map((r)=\u003e{let n=r;return{center:{x:n.x,y:n.y},width:n.width,height:n.height,stroke:\"hsl(0,0%,60%)\"}})}}class le extends U{static EPSILON=0.01;static ORIENTATION_MESSAGE='Use schOrientation=\"vertical\" on this capacitor to fix the symbol orientation';ctx;out;schematicComponentById;sourceComponentById;capacitorPlacements;feedbackCapacitorIds;currentPlacementIndex=0;horizontalSymbolNames=new Set([\"capacitor_left\",\"capacitor_right\"]);constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e,this.schematicComponentById=this.buildSchematicComponentById(t.circuitJson),this.sourceComponentById=this.buildSourceComponentById(t.circuitJson),this.capacitorPlacements=this.getCapacitorPlacements();let r=new tt(t);this.feedbackCapacitorIds=new Set(this.capacitorPlacements.flatMap((n)=\u003en.sourceComponentId\u0026\u0026r.isDirectOpAmpFeedback(n.sourceComponentId)?[n.sourceComponentId]:[])),this.solved=this.capacitorPlacements.length===0}getCapacitorPlacements(){return this.ctx.componentPlacements.filter((t)=\u003et.sourceComponentId!==void 0\u0026\u0026this.sourceComponentById.get(t.sourceComponentId)?.ftype===\"simple_capacitor\").map((t)=\u003e({schX:t.schX,schY:t.schY,width:t.width,height:t.height,sourceComponentId:t.sourceComponentId,sourceComponentName:t.sourceComponentName,schematicComponentId:t.schematicComponentId,schematicSheetId:t.schematicSheetId,schematicSheetName:t.schematicSheetName}))}_step(){let t=this.capacitorPlacements[this.currentPlacementIndex];if(!t){this.solved=!0;return}this.currentPlacementIndex+=1,this.solved=this.currentPlacementIndex\u003e=this.capacitorPlacements.length;let e=this.getIssueForPlacement(t);if(e)this.out.push(e)}visualize(){let t=this.getFocusedPlacement();return ky([Yy(this.ctx.circuitJson),t?Ny(t,\"hsl(210, 100%, 50%, 0.95)\",\"capacitorOrientation\"):void 0])}getFocusedPlacement(){if(this.capacitorPlacements.length===0)return;let t=this.iterations===0?this.currentPlacementIndex:Math.max(0,this.currentPlacementIndex-1);return this.capacitorPlacements[t]}buildSchematicComponentById(t){return new Map(t.filter((e)=\u003ee.type===\"schematic_component\").map((e)=\u003e[e.schematic_component_id,e]))}buildSourceComponentById(t){return new Map(t.flatMap((e)=\u003e{if(e.type!==\"source_component\"||!(\"source_component_id\"in e)||typeof e.source_component_id!==\"string\")return[];return[{type:\"source_component\",source_component_id:e.source_component_id,ftype:\"ftype\"in e\u0026\u0026typeof e.ftype===\"string\"?e.ftype:void 0}]}).map((e)=\u003e[e.source_component_id,e]))}createIssuePlacement(t){return{positionAnchor:\"center\",schX:t.schX,schY:t.schY,width:t.width,height:t.height,sourceComponentId:t.sourceComponentId,sourceComponentName:t.sourceComponentName,schematicComponentId:t.schematicComponentId,schematicSheetId:t.schematicSheetId,schematicSheetName:t.schematicSheetName}}getIssueForPlacement(t){if(!t.schematicComponentId||!t.sourceComponentId)return;let e=this.schematicComponentById.get(t.schematicComponentId);if(!e)return;if(!this.horizontalSymbolNames.has(e.symbol_name??\"\"))return;if(this.feedbackCapacitorIds.has(t.sourceComponentId))return;if(this.isInlineWithHorizontalTraces(t.schematicComponentId))return;return{lineItemType:\"CapacitorSymbolHorizontal\",schematicBox:this.createIssuePlacement(t),message:le.ORIENTATION_MESSAGE}}isInlineWithHorizontalTraces(t){let e=this.ctx.circuitJson.filter((n)=\u003en.type===\"schematic_port\"\u0026\u0026n.schematic_component_id===t);if(e.length!==2)return!1;let r=e.map((n)=\u003ethis.getOutwardHorizontalTrace(n));return r.every((n)=\u003en!==void 0)\u0026\u0026r.some((n)=\u003en!==void 0\u0026\u0026n.edges.every((i)=\u003eMath.abs(i.from.y-i.to.y)\u003c=le.EPSILON))}getOutwardHorizontalTrace(t){if(t.facing_direction!==\"left\"\u0026\u0026t.facing_direction!==\"right\")return;return this.ctx.circuitJson.find((e)=\u003ee.type===\"schematic_trace\"\u0026\u0026e.schematic_sheet_id===t.schematic_sheet_id\u0026\u0026e.edges.some((r)=\u003e{let n=this.pointsEqual(r.from,t.center)?r.to:this.pointsEqual(r.to,t.center)?r.from:void 0;return n!==void 0\u0026\u0026Math.abs(n.y-t.center.y)\u003c=le.EPSILON\u0026\u0026(t.facing_direction===\"left\"?n.x\u003ct.center.x-le.EPSILON:n.x\u003et.center.x+le.EPSILON)}))}pointsEqual(t,e){return Math.abs(t.x-e.x)\u003c=le.EPSILON\u0026\u0026Math.abs(t.y-e.y)\u003c=le.EPSILON}static issueToString(t){let e=[];return v(e,\"componentName\",t.schematicBox.sourceComponentName),v(e,\"schX\",t.schematicBox.schX),v(e,\"schY\",t.schematicBox.schY),v(e,\"width\",t.schematicBox.width),v(e,\"height\",t.schematicBox.height),v(e,\"message\",t.message),`\u003cCapacitorSymbolHorizontal ${e.join(\" \")} /\u003e`}}class Re extends U{params;static MIN_BODY_GAP=1;banks=[];netNames=new Map;bankIndex=0;constructor(t){super();this.params=t;let e=new tt(t.ctx),r=new Set(e.powerNets),n=new Set(e.groundNets);for(let i of t.ctx.circuitJson)if(i.type===\"source_net\"){let s=e.connected(i.source_net_id);if(!this.netNames.has(s))this.netNames.set(s,i.name)}for(let i of e.portsByComponent.values())for(let s of i){if(s.do_not_connect)continue;let o=e.connected(s.source_port_id);if(s.provides_power||s.requires_power)r.add(o);if(s.provides_ground||s.requires_ground)n.add(o);if((r.has(o)||n.has(o))\u0026\u0026!this.netNames.has(o))this.netNames.set(o,s.name)}for(let i of e.components.values()){if(i.ftype!==\"simple_capacitor\")continue;let s=i.source_component_id,o=e.placement(s),c=e.twoTerminalNets(s),l=e.portsByComponent.get(s);if(!o||!c||!l||l.some((m)=\u003e{let f=e.port(m);return m.do_not_connect||!f||f.schematic_sheet_id!==o.schematicSheetId}))continue;let a=c.find((m)=\u003er.has(m)\u0026\u0026!n.has(m)),p=c.find((m)=\u003en.has(m)\u0026\u0026!r.has(m));if(!a||!p)continue;let d=this.banks.find((m)=\u003em.power===a\u0026\u0026m.ground===p\u0026\u0026e.sameLocalScope(m.capacitors[0],o));if(d)d.capacitors.push(o);else this.banks.push({power:a,ground:p,capacitors:[o]})}this.solved=this.banks.length===0}_step(){let t=this.banks[this.bankIndex++];if(this.solved=this.bankIndex\u003e=this.banks.length,t.capacitors.length\u003c2)return;let e=Math.max(Re.MIN_BODY_GAP,...t.capacitors.map((o)=\u003eMath.max(o.width,o.height))),r=0,n=t.capacitors.slice(1).map((o)=\u003e({box:o,gap:Re.bodyGap(t.capacitors[0],o)}));while(n.length\u003e0){let o=0;for(let l=1;l\u003cn.length;l++)if(n[l].gap\u003cn[o].gap)o=l;let c=n.splice(o,1)[0];r=Math.max(r,c.gap);for(let l of n)l.gap=Math.min(l.gap,Re.bodyGap(c.box,l.box))}if(r\u003c=e+0.000001)return;let i=this.netNames.get(t.power)??\"power\",s=this.netNames.get(t.ground)??\"ground\";this.params.issues.push({lineItemType:\"DecouplingCapacitorsNotCloseTogether\",railName:i,groundName:s,capacitorSchematicBoxes:t.capacitors,maxBodyGap:r,maxRecommendedBodyGap:e,message:`Group the decoupling capacitors between ${i} and ${s} closer together in this schematic block. Preserve their net connections.`})}static bodyGap(t,e){return Math.hypot(Math.max(0,Math.abs(t.schX-e.schX)-(t.width+e.width)/2),Math.max(0,Math.abs(t.schY-e.schY)-(t.height+e.height)/2))}static issueToString(t){let e=[];return v(e,\"rail\",t.railName),v(e,\"ground\",t.groundName),v(e,\"capacitorNames\",t.capacitorSchematicBoxes.map((r)=\u003er.sourceComponentName||\"component\").join(\", \")),v(e,\"maxBodyGap\",t.maxBodyGap),v(e,\"maxRecommendedBodyGap\",t.maxRecommendedBodyGap),v(e,\"message\",t.message),`\u003cDecouplingCapacitorsNotCloseTogether ${e.join(\" \")} /\u003e`}}class or extends U{params;placements;netLabelsByComponentId;rawCollisions=[];firstIndex=0;secondIndex=1;constructor(t){super();this.params=t;this.placements=t.ctx.componentPlacements,this.netLabelsByComponentId=this.buildNetLabelsByComponentId(t.ctx.circuitJson),this.solved=this.placements.length\u003c2}_step(){if(this.firstIndex\u003e=this.placements.length-1){this.buildAndPushIssues(),this.solved=!0;return}let t=this.placements[this.firstIndex],e=this.placements[this.secondIndex];if(this.detectPair(t,e),this.secondIndex++,this.secondIndex\u003e=this.placements.length)this.firstIndex++,this.secondIndex=this.firstIndex+1}detectPair(t,e){if(t.schematicSheetId!==e.schematicSheetId)return;this.rawCollisions.push(...this.detectLabelLabel(t,e)),this.rawCollisions.push(...this.detectBoxLabel(t,e)),this.rawCollisions.push(...this.detectBoxLabel(e,t))}detectLabelLabel(t,e){let r=t,n=e;if(t.schX\u003ee.schX)r=e,n=t;let i=r.schematicComponentId,s=n.schematicComponentId;if(!i||!s)return[];let o=this.netLabelsByComponentId.get(i)??[],c=this.netLabelsByComponentId.get(s)??[];if(o.length===0||c.length===0)return[];let l=[];for(let a of o)for(let p of c){let d=Ke(a),m=Ke(p);if(xr(d,m))l.push({type:\"label-label\",bounds:{left:Math.max(d.left,m.left),right:Math.min(d.right,m.right),top:Math.min(d.top,m.top),bottom:Math.max(d.bottom,m.bottom)},leftComp:r,rightComp:n,leftId:i,rightId:s,xSeparation:d.right-m.left+0.1})}return l}detectBoxLabel(t,e){let r=t.schematicComponentId,n=e.schematicComponentId;if(!r||!n)return[];let i=this.netLabelsByComponentId.get(n)??[];if(i.length===0)return[];let s=zt(t.schX,t.schY,t.width,t.height),o=t.schX\u003c=e.schX,c=[];for(let l of i){let a=Ke(l);if(!xr(s,a))continue;let p;if(o)p=s.right-a.left+0.1;else p=a.right-s.left+0.1;c.push({type:\"box-label\",bounds:{left:Math.max(s.left,a.left),right:Math.min(s.right,a.right),top:Math.min(s.top,a.top),bottom:Math.max(s.bottom,a.bottom)},boxComp:t,labelComp:e,boxId:r,labelId:n,xSeparation:p})}return c}buildAndPushIssues(){if(this.rawCollisions.length===0)return;let t=new Map;for(let e of this.rawCollisions){let n=(e.type===\"label-label\"?e.leftComp:e.boxComp).schematicSheetId??\"\",i=t.get(n);if(i)i.push(e);else t.set(n,[e])}for(let e of t.values())this.buildAndPushIssueForSheet(e)}buildAndPushIssueForSheet(t){let e=this.computeGlobalFixes(t);if(e.size===0)return;let r=new Set,n=[];for(let o of t){let c,l;if(o.type===\"label-label\")c=o.leftComp.sourceComponentName??\"\",l=o.rightComp.sourceComponentName??\"\";else c=o.boxComp.sourceComponentName??\"\",l=o.labelComp.sourceComponentName??\"\";let a=`${c}/${l}`;if(!r.has(a))r.add(a),n.push({comp1Name:c,comp2Name:l})}let i=t[0],s=i.type===\"label-label\"?i.leftComp:i.boxComp;this.params.issues.push({lineItemType:\"NetLabelCollision\",schematicSheetId:s.schematicSheetId,schematicSheetName:s.schematicSheetName,pairs:n,collisionBounds:t.map((o)=\u003eo.bounds),moves:Array.from(e.values())})}computeGlobalFixes(t){let e=new Map;for(let a of this.placements)if(a.schematicComponentId)e.set(a.schematicComponentId,a);let r=new Map,n=(a,p,d)=\u003e{let m=e.get(a),f=e.get(p);if(!m||!f)return;let _=f.schX-m.schX+d,g=`${a}|${p}`;r.set(g,Math.max(r.get(g)??0,_))};for(let a of t)if(a.type===\"label-label\")n(a.leftId,a.rightId,a.xSeparation);else if(a.boxComp.schX\u003c=a.labelComp.schX)n(a.boxId,a.labelId,a.xSeparation);else n(a.labelId,a.boxId,a.xSeparation);let i=[...r.entries()].map(([a,p])=\u003e{let d=a.indexOf(\"|\");return{leftId:a.slice(0,d),rightId:a.slice(d+1),minSep:p}}),s=new Set,o=new Map;for(let{leftId:a,rightId:p}of i){if(s.add(a),s.add(p),!o.has(a))o.set(a,new Set);if(!o.has(p))o.set(p,new Set);o.get(a).add(p),o.get(p).add(a)}let c=new Set,l=new Map;for(let a of s){if(c.has(a))continue;let p=[],d=[a];c.add(a);while(d.length){let y=d.shift();p.push(y);for(let S of o.get(y)??[])if(!c.has(S))c.add(S),d.push(S)}p.sort((y,S)=\u003e(e.get(y)?.schX??0)-(e.get(S)?.schX??0));let m=new Set(p),f=i.filter((y)=\u003em.has(y.leftId)\u0026\u0026m.has(y.rightId)),_=new Map;for(let y of p){let S=e.get(y)?.schX??0;for(let{leftId:P,rightId:b,minSep:C}of f)if(b===y\u0026\u0026_.has(P))S=Math.max(S,_.get(P)+C);_.set(y,S)}let g=[..._.entries()].reduce((y,[S,P])=\u003ey+(P-(e.get(S)?.schX??0)),0);if(g\u003e0.000000001){let y=g/p.length,S=new Map;for(let b of p){let C=(e.get(b)?.schX??0)-y;for(let{leftId:L,rightId:B,minSep:k}of f)if(B===b\u0026\u0026S.has(L))C=Math.max(C,S.get(L)+k);S.set(b,C)}let P=(b)=\u003e[...b.entries()].reduce((C,[L,B])=\u003eMath.max(C,Math.abs(B-(e.get(L)?.schX??0))),0);if(P(S)\u003cP(_))for(let[b,C]of S)_.set(b,C)}for(let[y,S]of _){let P=e.get(y);if(!P||Math.abs(S-P.schX)\u003c0.000000001)continue;l.set(y,{componentName:P.sourceComponentName||\"component\",newSchX:Math.round(S*100)/100,newSchY:Math.round(P.schY*100)/100})}}return l}buildNetLabelsByComponentId(t){let r=[];for(let i of t){if(i.type!==\"schematic_port\")continue;let s=i;if(!s.schematic_component_id)continue;r.push({componentId:s.schematic_component_id,cx:s.center.x,cy:s.center.y,schematicSheetId:s.schematic_sheet_id})}let n=new Map;for(let i of t){if(i.type!==\"schematic_net_label\")continue;let s=i;if(!s.anchor_position)continue;let{x:o,y:c}=s.anchor_position,l=r.filter((m)=\u003em.schematicSheetId===s.schematic_sheet_id\u0026\u0026Math.hypot(m.cx-o,m.cy-c)\u003c0.0001);if(l.length===0)continue;if(new Set(l.map((m)=\u003em.componentId)).size!==1)continue;let p=l[0].componentId,d=n.get(p)??[];d.push(s),n.set(p,d)}return n}static netLabelCollisionToString(t){let e=t.pairs.map((n,i)=\u003e`pair${i+1}=\"${n.comp1Name}/${n.comp2Name}\"`).join(\" \"),r=t.moves.map((n)=\u003e` \u003cMove componentName=\"${n.componentName}\" newSchX=\"${n.newSchX}\" newSchY=\"${n.newSchY}\" /\u003e`);return[`\u003cComponentNetLabelCollision ${e}\u003e`,' \u003cSuggestedFix note=\"Apply all moves simultaneously. Set schAutoLayoutEnabled on your circuit.\"\u003e',...r,\" \u003c/SuggestedFix\u003e\",\"\u003c/ComponentNetLabelCollision\u003e\"].join(`\n`)}}class sr extends U{static ALIGNMENT_EPSILON=0.01;ctx;out;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e}_step(){let t=new Map(this.ctx.circuitJson.filter((n)=\u003en.type===\"schematic_port\").map((n)=\u003e[n.schematic_port_id,n])),e=new Map(this.ctx.componentPlacements.flatMap((n)=\u003en.schematicComponentId?[[n.schematicComponentId,n]]:[])),r=new Map;for(let n of this.ctx.circuitJson.filter((i)=\u003ei.type===\"schematic_trace\")){let i=this.getTracePinPair(n,t);if(!i)continue;let s=i.firstPort.schematic_component_id,o=i.secondPort.schematic_component_id;if(!s||!o||s===o)continue;let c=s\u003co?i:{firstPort:i.secondPort,secondPort:i.firstPort},l=[s,o].sort().join(\"\\x00\"),a=r.get(l)??[];if(!a.some((d)=\u003ed.firstPort.schematic_port_id===c.firstPort.schematic_port_id\u0026\u0026d.secondPort.schematic_port_id===c.secondPort.schematic_port_id))a.push(c);r.set(l,a)}for(let n of r.values()){let i=this.findVerticalShiftIssue(n,e);if(i)this.out.push(i)}this.solved=!0}getTracePinPair(t,e){let r=t.edges?.[0],n=t.edges?.at(-1);if(!r||!n)return;let i=r.from_schematic_port_id??r.to_schematic_port_id,s=n.to_schematic_port_id??n.from_schematic_port_id,o=[...e.values()],c=i?e.get(i):this.findPortAtPoint(o,r.from,t.schematic_sheet_id),l=s?e.get(s):this.findPortAtPoint(o,n.to,t.schematic_sheet_id);if(!c||!l)return;if(c.schematic_port_id===l.schematic_port_id)return;if(c.schematic_sheet_id!==l.schematic_sheet_id)return;return{firstPort:c,secondPort:l}}findPortAtPoint(t,e,r){let{ALIGNMENT_EPSILON:n}=sr;return t.find((i)=\u003ei.schematic_sheet_id===r\u0026\u0026Math.abs(i.center.x-e.x)\u003c=n\u0026\u0026Math.abs(i.center.y-e.y)\u003c=n)}findVerticalShiftIssue(t,e){let r=t[0];if(!r)return;let n=e.get(r.firstPort.schematic_component_id),i=e.get(r.secondPort.schematic_component_id);if(!n||!i)return;let[s,o]=n.schX\u003c=i.schX?[n,i]:[i,n],c=t.flatMap((g)=\u003e{let[y,S]=g.firstPort.center.x\u003c=g.secondPort.center.x?[g.firstPort,g.secondPort]:[g.secondPort,g.firstPort];return y.facing_direction===\"right\"\u0026\u0026S.facing_direction===\"left\"?[{leftPort:y,rightPort:S}]:[]});if(c.length\u003c2)return;let{ALIGNMENT_EPSILON:l}=sr,a=c.filter(({leftPort:g,rightPort:y})=\u003eMath.abs(g.center.y-y.center.y)\u003c=l).length,p=[];for(let g of c){let y=g.leftPort.center.y-g.rightPort.center.y;if(Math.abs(y)\u003c=l)continue;let S=p.find((P)=\u003eMath.abs(P.deltaSchY-y)\u003c=l);if(S)S.pairs.push(g);else p.push({deltaSchY:y,pairs:[g]})}let d=p.sort((g,y)=\u003ey.pairs.length-g.pairs.length||Math.abs(g.deltaSchY)-Math.abs(y.deltaSchY))[0];if(!d||d.pairs.length\u003c2||d.pairs.length\u003c=a)return;let m=o.sourceComponentName||\"component\",f=d.deltaSchY,_=o.schY+f;return{lineItemType:\"ComponentPinsWouldAlignWithVerticalShift\",firstComponent:s,secondComponent:o,targetComponent:o,deltaSchY:f,newSchY:_,currentlyAlignedPinCount:a,alignedPinCount:d.pairs.length,alignedPinPairs:d.pairs.map(({leftPort:g,rightPort:y})=\u003e({firstPin:this.getPinLabel(g),secondPin:this.getPinLabel(y)})),message:`shift ${m} vertically by ${jl(f)} to align ${d.pairs.length} connected pin pairs`}}getPinLabel(t){return t.display_pin_label??t.pin_number?.toString()}static issueToString(t){let e=[];return v(e,\"firstComponentName\",t.firstComponent.sourceComponentName),v(e,\"secondComponentName\",t.secondComponent.sourceComponentName),v(e,\"targetComponentName\",t.targetComponent.sourceComponentName),v(e,\"deltaSchY\",t.deltaSchY),v(e,\"newSchY\",t.newSchY),v(e,\"currentlyAlignedPinCount\",t.currentlyAlignedPinCount),v(e,\"alignedPinCount\",t.alignedPinCount),v(e,\"message\",t.message),`\u003cComponentPinsWouldAlignWithVerticalShift ${e.join(\" \")} /\u003e`}}class Oe extends U{static ALIGNMENT_TOLERANCE=0.1;issues;networks;currentNetworkIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.networks=this.findCrystalLoadNetworks(t),this.solved=this.networks.length===0}_step(){let t=this.networks[this.currentNetworkIndex];if(!t){this.solved=!0;return}this.currentNetworkIndex+=1,this.solved=this.currentNetworkIndex\u003e=this.networks.length;let e=as(t.newSchX-t.crystal.schX),r=as(t.newSchY-t.crystal.schY);if(Math.abs(e)\u003c=Oe.ALIGNMENT_TOLERANCE\u0026\u0026Math.abs(r)\u003c=Oe.ALIGNMENT_TOLERANCE)return;let n=t.crystal.sourceComponentName??\"the crystal\",i=t.firstLoadCapacitor.sourceComponentName??\"the first load capacitor\",s=t.secondLoadCapacitor.sourceComponentName??\"the second load capacitor\",o=Math.abs(r)\u003c=Oe.ALIGNMENT_TOLERANCE?`horizontally centered between ${i} and ${s} while preserving its vertical placement`:`centered between ${i} and ${s} and aligned with their load-side pins`;this.issues.push({lineItemType:\"CrystalNotCenteredOverLoadCapacitors\",crystalSchematicBox:t.crystal,firstLoadCapacitorSchematicBox:t.firstLoadCapacitor,secondLoadCapacitorSchematicBox:t.secondLoadCapacitor,deltaSchX:e,deltaSchY:r,newSchX:t.newSchX,newSchY:t.newSchY,message:`move ${n} to schX=${t.newSchX}, schY=${t.newSchY} so it is ${o}`})}findCrystalLoadNetworks(t){let e=new Map,r=new Map,n=new Map,i=new Map(t.componentPlacements.flatMap((c)=\u003ec.sourceComponentId?[[c.sourceComponentId,c]]:[]));for(let c of t.circuitJson){if(c.type===\"source_component\")e.set(c.source_component_id,{sourceComponentId:c.source_component_id,ftype:\"ftype\"in c\u0026\u0026typeof c.ftype===\"string\"?c.ftype:void 0,pinVariant:\"pin_variant\"in c\u0026\u0026(c.pin_variant===\"two_pin\"||c.pin_variant===\"four_pin\")?c.pin_variant:void 0});if(c.type===\"source_port\"\u0026\u0026typeof c.source_component_id===\"string\"\u0026\u0026typeof c.subcircuit_connectivity_map_key===\"string\"){let l={sourcePortId:c.source_port_id,sourceComponentId:c.source_component_id,connectivityKey:c.subcircuit_connectivity_map_key},a=r.get(c.source_component_id)??[];a.push(l),r.set(c.source_component_id,a)}if(c.type===\"schematic_port\"\u0026\u0026c.source_port_id)n.set(c.source_port_id,c)}let s=new Map;for(let c of e.values()){if(c.ftype!==\"simple_capacitor\")continue;let l=r.get(c.sourceComponentId)??[];if(l.length!==2)continue;let a=l[0],p=l[1],d=i.get(c.sourceComponentId);if(!d)continue;for(let[m,f]of[[a,p],[p,a]]){let _=n.get(m.sourcePortId);if(!_)continue;let g=s.get(m.connectivityKey)??[];g.push({capacitor:d,loadPort:_,returnConnectivityKey:f.connectivityKey}),s.set(m.connectivityKey,g)}}let o=[];for(let c of e.values()){if(c.ftype!==\"simple_crystal\"\u0026\u0026c.ftype!==\"simple_chip\")continue;let l=r.get(c.sourceComponentId)??[],a=c.ftype===\"simple_chip\"?l.length===2\u0026\u0026l[0].connectivityKey!==l[1].connectivityKey?[[l[0].connectivityKey,l[1].connectivityKey]]:[]:c5(l);if(a.length===0)continue;let p=i.get(c.sourceComponentId);if(!p)continue;let d=a.flatMap(([y,S])=\u003e{if(![...r.entries()].some(([L,B])=\u003eL!==c.sourceComponentId\u0026\u0026B.length\u003e2\u0026\u0026B.some((k)=\u003ek.connectivityKey===y)\u0026\u0026B.some((k)=\u003ek.connectivityKey===S)))return[];let b=s.get(y)??[],C=s.get(S)??[];return b.flatMap((L)=\u003eC.flatMap((B)=\u003e{if(L.capacitor.sourceComponentId===B.capacitor.sourceComponentId||L.returnConnectivityKey!==B.returnConnectivityKey||L.returnConnectivityKey===y||L.returnConnectivityKey===S||L.capacitor.schematicSheetId!==p.schematicSheetId||B.capacitor.schematicSheetId!==p.schematicSheetId)return[];return[{firstConnection:L,secondConnection:B}]}))});if(d.length===0)continue;let m=d.toSorted((y,S)=\u003eLy(y,p)-Ly(S,p))[0],f=[m.firstConnection.loadPort,m.secondConnection.loadPort],_=[m.firstConnection.capacitor,m.secondConnection.capacitor].toSorted((y,S)=\u003ey.schX-S.schX),g=c.ftype===\"simple_crystal\"\u0026\u0026(c.pinVariant===\"four_pin\"||l.length\u003e2);o.push({crystal:p,firstLoadCapacitor:_[0],secondLoadCapacitor:_[1],newSchX:as((f[0].center.x+f[1].center.x)/2),newSchY:g?p.schY:as((f[0].center.y+f[1].center.y)/2)})}return o}static issueToString(t){let e=[];return v(e,\"crystalName\",t.crystalSchematicBox.sourceComponentName),v(e,\"firstLoadCapacitorName\",t.firstLoadCapacitorSchematicBox.sourceComponentName),v(e,\"secondLoadCapacitorName\",t.secondLoadCapacitorSchematicBox.sourceComponentName),v(e,\"newSchX\",t.newSchX),v(e,\"newSchY\",t.newSchY),v(e,\"deltaSchX\",t.deltaSchX,{formatDelta:!0}),v(e,\"deltaSchY\",t.deltaSchY,{formatDelta:!0}),v(e,\"message\",t.message),`\u003cCrystalNotCenteredOverLoadCapacitors ${e.join(\" \")} /\u003e`}}var c5=(t)=\u003e{let e=[...new Set(t.map((r)=\u003er.connectivityKey))];return e.flatMap((r,n)=\u003ee.slice(n+1).map((i)=\u003e[r,i]))},Ly=(t,e)=\u003eTy(t.firstConnection.capacitor,e)+Ty(t.secondConnection.capacitor,e),Ty=(t,e)=\u003eMath.hypot(t.schX-e.schX,t.schY-e.schY),as=(t)=\u003eMath.round(t*100)/100;function Kl(t){let e=new Map,r=0;function n(i){for(let[,o]of e)if(o.has(i))return o;let s=new Set;return e.set(`connectivity_net${r++}`,s),s}for(let i of t){let s=null;for(let o of i){if(!s)s=n(o);else if(!s.has(o)){let c=n(o);if(c!==s){for(let l of c)s.add(l);e.delete(Array.from(e.entries()).find(([,l])=\u003el===c)[0])}}s.add(o)}}return Object.fromEntries(Array.from(e.entries()).map(([i,s])=\u003e[i,Array.from(s)]))}var p5=class{netMap;idToNetMap;constructor(t){this.netMap=t,this.idToNetMap={};for(let[e,r]of Object.entries(t))for(let n of r)this.idToNetMap[n]=e}addConnections(t){for(let e of t){let r=new Set;for(let i of e){let s=this.idToNetMap[i];if(s)r.add(s)}let n;if(r.size===0)n=`connectivity_net${Object.keys(this.netMap).length}`,this.netMap[n]=[];else if(r.size===1)n=r.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;else{n=r.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;for(let i of r)if(i!==n){this.netMap[n].push(...this.netMap[i]),this.netMap[i]=this.netMap[n];for(let s of this.netMap[n])this.idToNetMap[s]=n}}for(let i of e){if(!this.netMap[n].includes(i))this.netMap[n].push(i);this.idToNetMap[i]=n}}}getIdsConnectedToNet(t){return this.netMap[t]||[]}getNetConnectedToId(t){return this.idToNetMap[t]}areIdsConnected(t,e){if(t===e)return!0;let r=this.getNetConnectedToId(t);if(!r)return!1;let n=this.getNetConnectedToId(e);if(!n)return!1;return r===n||n===t||n===t}areAllIdsConnected(t){let e=this.getNetConnectedToId(t[0]);for(let r of t){let n=this.getNetConnectedToId(r);if(n===void 0)return!1;if(n!==e)return!1}return!0}},cs=(t)=\u003e{let e=[];for(let n of t)if(n.type===\"source_trace\")e.push([...n.connected_source_port_ids??[],...n.connected_source_net_ids??[]]);else if(n.type===\"source_component\"){if(n.internally_connected_source_port_ids)for(let i of n.internally_connected_source_port_ids)e.push(i)}else if(n.type===\"source_component_internal_connection\")e.push(n.source_port_ids);let r=Kl(e);return new p5(r)};class Ae extends U{static DIODE_FTYPES=new Set([\"simple_led\",\"simple_diode\"]);ctx;out;schematicTraces;currentIndex=0;sourceConnectivity;sourceComponentFtypeById;sourceComponentIdBySourcePortId;schematicPorts;schematicBoxBySourceComponentId;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e;let{circuitJson:r}=t;this.sourceConnectivity=cs(r),this.sourceComponentFtypeById=this.buildSourceComponentFtypeById(r),this.sourceComponentIdBySourcePortId=this.buildSourceComponentIdBySourcePortId(r),this.schematicPorts=r.filter((n)=\u003en.type===\"schematic_port\"),this.schematicBoxBySourceComponentId=this.buildSchematicBoxBySourceComponentId(),this.schematicTraces=r.filter((n)=\u003en.type===\"schematic_trace\"),this.solved=this.schematicTraces.length===0}_step(){let t=this.schematicTraces[this.currentIndex];if(!t){this.solved=!0;return}if(this.currentIndex++,this.solved=this.currentIndex\u003e=this.schematicTraces.length,!t.edges||t.edges.length===0)return;let e=t.edges[0],r=t.edges[t.edges.length-1];if(!e||!r)return;let n=e.from,i=r.to,s=t.schematic_sheet_id,o=this.findSourceComponentIdNearPoint(n,s),c=this.findSourceComponentIdNearPoint(i,s);if(!o||!c)return;let l=this.sourceComponentFtypeById.get(o),a=this.sourceComponentFtypeById.get(c),{DIODE_FTYPES:p}=Ae;if(!(p.has(l)\u0026\u0026a===\"simple_resistor\"||l===\"simple_resistor\"\u0026\u0026p.has(a)))return;let m=p.has(l)?o:c,f=l===\"simple_resistor\"?o:c,_=this.schematicBoxBySourceComponentId.get(m),g=this.schematicBoxBySourceComponentId.get(f);if(!_||!g)return;let y=this.findNearestPort(p.has(l)?n:i,s),S=this.findNearestPort(l===\"simple_resistor\"?n:i,s);if(!y?.center||!S?.center)return;if(!this.sourceConnectivity.areIdsConnected(y.source_port_id,S.source_port_id))return;let P=_.sourceComponentName||\"component\",b=g.sourceComponentName||\"component\",C=y?.display_pin_label??y?.pin_number?.toString(),L=S?.display_pin_label??S?.pin_number?.toString(),B=y?.facing_direction,k=S?.facing_direction,I=C?`${P}.${C}`:P,j=L?`${b}.${L}`:b,Q=(lt)=\u003e({lineItemType:\"DiodeResistorNotAligned\",diodeSchematicBox:_,resistorSchematicBox:g,diodePin:C,resistorPin:L,diodePinFacingDirection:B,resistorPinFacingDirection:k,message:lt});if(!Ae.isCoLinear(y.center,S.center)){this.out.push(Q(`trace has corners — align ${P} and ${b} on same axis and rotate so ${I} faces ${j}`));return}if(B\u0026\u0026k\u0026\u0026!Ae.pinsFacingEachOther(y.center,B,S.center,k))this.out.push(Q(`${I} and ${j} face away from each other — rotate ${P} so ${I} faces ${j}`))}static isCoLinear(t,e,r=0.01){return Math.abs(t.x-e.x)\u003cr||Math.abs(t.y-e.y)\u003cr}static pinsFacingEachOther(t,e,r,n){let i=r.x-t.x,s=r.y-t.y,o=e===\"right\"\u0026\u0026i\u003e0||e===\"left\"\u0026\u0026i\u003c0||e===\"up\"\u0026\u0026s\u003e0||e===\"down\"\u0026\u0026s\u003c0,c=n===\"right\"\u0026\u0026i\u003c0||n===\"left\"\u0026\u0026i\u003e0||n===\"up\"\u0026\u0026s\u003c0||n===\"down\"\u0026\u0026s\u003e0;return o\u0026\u0026c}static dist(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}findNearestPort(t,e){let r,n=1/0;for(let i of this.schematicPorts){if(i.schematic_sheet_id!==e)continue;if(!i.center)continue;let s=Ae.dist(t,i.center);if(s\u003cn)n=s,r=i}return r}findSourceComponentIdNearPoint(t,e){let r=this.findNearestPort(t,e);if(!r||!r.source_port_id)return;return this.sourceComponentIdBySourcePortId.get(r.source_port_id)}buildSourceComponentFtypeById(t){let e=new Map;for(let r of t)if(r.type===\"source_component\"\u0026\u0026\"source_component_id\"in r\u0026\u0026\"ftype\"in r\u0026\u0026typeof r.ftype===\"string\")e.set(r.source_component_id,r.ftype);return e}buildSourceComponentIdBySourcePortId(t){let e=new Map;for(let r of t)if(r.type===\"source_port\"\u0026\u0026\"source_port_id\"in r\u0026\u0026\"source_component_id\"in r\u0026\u0026typeof r.source_port_id===\"string\"\u0026\u0026typeof r.source_component_id===\"string\")e.set(r.source_port_id,r.source_component_id);return e}buildSchematicBoxBySourceComponentId(){let t=new Map;for(let e of this.ctx.componentPlacements)if(e.sourceComponentId)t.set(e.sourceComponentId,e);return t}static issueToString(t){let e=[];return v(e,\"diodeComponentName\",t.diodeSchematicBox.sourceComponentName),v(e,\"diodePin\",t.diodePin),v(e,\"resistorComponentName\",t.resistorSchematicBox.sourceComponentName),v(e,\"resistorPin\",t.resistorPin),v(e,\"message\",t.message),`\u003cDiodeResistorNotAligned ${e.join(\" \")} /\u003e`}}class Ar extends U{static MIN_BODY_GAP=4;index;amplifierIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t),this.amplifierIds=[...this.index.components.values()].filter((r)=\u003er.ftype===\"simple_op_amp\").map((r)=\u003er.source_component_id),this.solved=this.amplifierIds.length===0}_step(){let t=this.amplifierIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.amplifierIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.namedPort(t,\"output\"),i=e.namedPort(t,\"inverting_input\");if(!r||!n||!i||!e.port(n)||!e.port(i))return;let s=e.connected(n.source_port_id),o=e.connected(i.source_port_id);if(s===o||e.isRail(s)||e.isRail(o))return;if((e.portsByNet.get(o)??[]).some((d)=\u003ed.source_component_id!==t\u0026\u0026e.components.get(d.source_component_id)?.ftype===\"simple_op_amp\"))return;let c=[],l=new Set;for(let d of e.portsByNet.get(s)??[]){let m=d.source_component_id;if(l.has(m))continue;l.add(m);let f=e.components.get(m);if(f?.ftype!==\"simple_resistor\"\u0026\u0026f?.ftype!==\"simple_capacitor\")continue;if(f.ftype===\"simple_resistor\"\u0026\u0026!(f.resistance\u003e0))continue;let _=e.twoTerminalNets(m);if(!_?.includes(o)||!_.includes(s))continue;let g=e.placement(m);if(!g||!e.sameLocalScope(r,g))return;c.push(g)}let a=c.flatMap((d)=\u003e{let m=h5(r,d),f=Math.max(Ar.MIN_BODY_GAP,3*Math.max(d.width,d.height));return m\u003ef?[{schematicBox:d,bodyGap:m,maxRecommendedBodyGap:f}]:[]});if(a.length===0)return;let p=a.map(({schematicBox:d})=\u003ed.sourceComponentName||\"component\").join(\", \");this.issues.push({lineItemType:\"FeedbackNetworkNotCompact\",amplifierSchematicBox:r,feedbackComponents:c,distantComponents:a,outputSourcePortId:n.source_port_id,invertingInputSourcePortId:i.source_port_id,message:`consider grouping ${p} closer to ${r.sourceComponentName||\"component\"}, with a compact feedback return path above or below the amplifier`})}static issueToString(t){let e=[];return v(e,\"amplifierName\",t.amplifierSchematicBox.sourceComponentName),v(e,\"feedbackComponentNames\",t.feedbackComponents.map((r)=\u003er.sourceComponentName||\"component\").join(\", \")),v(e,\"distantComponentNames\",t.distantComponents.map(({schematicBox:r})=\u003er.sourceComponentName||\"component\").join(\", \")),v(e,\"message\",t.message),`\u003cFeedbackNetworkNotCompact ${e.join(\" \")} /\u003e`}}function h5(t,e){return Math.hypot(Math.max(0,Math.abs(t.schX-e.schX)-(t.width+e.width)/2),Math.max(0,Math.abs(t.schY-e.schY)-(t.height+e.height)/2))}function tp(t){let e=[],r=(n)=\u003e{let i=t.portsByComponent.get(n);if(i?.length!==2)return!1;let s=t.port(i[0]),o=t.port(i[1]);return!!s\u0026\u0026!!o\u0026\u0026Math.abs(s.center.y-o.center.y)\u003c0.01\u0026\u0026Math.abs(s.center.x-o.center.x)\u003e0.01};for(let n of t.components.values()){if(n.ftype!==\"simple_resistor\"||n.resistance\u003c=0)continue;let i=n.source_component_id,s=t.twoTerminalNets(i);if(!s||s.filter((b)=\u003et.isRail(b)).length!==1)continue;let o=s.find((b)=\u003et.isRail(b));if(t.powerNets.has(o)\u0026\u0026t.groundNets.has(o))continue;let c=s.find((b)=\u003eb!==o),l=t.portsByNet.get(c)??[],a=l.filter((b)=\u003e{let C=t.components.get(b.source_component_id)?.ftype;return C===\"simple_switch\"||C===\"simple_push_button\"});if(a.length!==1||l.filter((b)=\u003et.components.get(b.source_component_id)?.ftype===\"simple_resistor\").length!==1)continue;let p=a[0],d=p.source_component_id,m=t.components.get(d)?.ftype,_=t.twoTerminalNets(d)?.find((b)=\u003eb!==c);if(!_)continue;let g=t.powerNets.has(o)?\"up\":\"down\";if(g===\"up\"?!t.groundNets.has(_)||t.powerNets.has(_):!t.powerNets.has(_)||t.groundNets.has(_))continue;if([i,d].some((b)=\u003et.portsByComponent.get(b)?.some((C)=\u003eC.do_not_connect)))continue;let y=t.placement(i),S=t.placement(d),P=t.port(p);if(!y||!S||!P||!t.sameLocalScope(y,S))continue;e.push({resistor:y,switchBox:S,signalPort:p,signalSchY:P.center.y,pullDirection:g,horizontalPushbutton:m===\"simple_push_button\"\u0026\u0026r(i)\u0026\u0026r(d)})}return e}function ls(t){return new Set(tp(t).flatMap((e)=\u003ee.horizontalPushbutton?[e.resistor.sourceComponentId,e.switchBox.sourceComponentId]:[]))}class ar extends U{static MIN_WRONG_SIDE_GAP=1.5;index;resistorIds;horizontalPushbuttonComponentIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t),this.horizontalPushbuttonComponentIds=ls(this.index),this.resistorIds=[...this.index.components.values()].filter((r)=\u003er.ftype===\"simple_resistor\"\u0026\u0026r.resistance\u003e0).map((r)=\u003er.source_component_id),this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.resistorIds.length,!t)return;if(this.horizontalPushbuttonComponentIds.has(t))return;let e=this.index,r=e.placement(t),n=e.twoTerminalNets(t);if(!r||!n)return;let i=n.filter((y)=\u003ee.isRail(y));if(i.length!==1)return;let s=i[0];if(e.powerNets.has(s)\u0026\u0026e.groundNets.has(s))return;let o=e.groundNets.has(s)?\"down\":\"up\",c=n.find((y)=\u003ey!==s),l=e.portsByNet.get(c)??[],a=l.filter((y)=\u003ey.needs_external_pullup||y.needs_external_pulldown);if(a.length!==1)return;let p=a[0];if(p.needs_external_pullup\u0026\u0026p.needs_external_pulldown)return;if(o===\"up\"?!p.needs_external_pullup:!p.needs_external_pulldown)return;let d=e.placement(p.source_component_id),m=e.port(p);if(!d||!m||!e.sameLocalScope(d,r))return;if(l.some((y)=\u003e{let S=y.source_component_id;if(S===t||S===p.source_component_id)return!1;if(e.components.get(S)?.ftype!==\"simple_capacitor\")return!0;let C=e.twoTerminalNets(S)?.find((B)=\u003eB!==c);if(!C||!e.groundNets.has(C)||e.powerNets.has(C))return!0;let L=e.placement(S);return!L||!e.sameLocalScope(d,L)}))return;let f=m.center.y,_=o===\"up\"?f-(r.schY+r.height/2):r.schY-r.height/2-f;if(_\u003c=ar.MIN_WRONG_SIDE_GAP)return;let g=o===\"up\"?\"above\":\"below\";this.issues.push({lineItemType:\"PullResistorOnWrongSide\",resistorSchematicBox:r,hostSchematicBox:d,signalSourcePortId:p.source_port_id,signalPinName:p.name,signalSchY:f,pullDirection:o,preferredSide:g,wrongSideGap:_,maxRecommendedWrongSideGap:ar.MIN_WRONG_SIDE_GAP,message:`consider placing ${r.sourceComponentName||\"component\"} ${g} ${d.sourceComponentName||\"component\"}.${p.name} so the pull-${o} branch reads toward ${o===\"up\"?\"power\":\"ground\"}`})}static issueToString(t){let e=[];return v(e,\"resistorName\",t.resistorSchematicBox.sourceComponentName),v(e,\"hostName\",t.hostSchematicBox.sourceComponentName),v(e,\"signalPin\",t.signalPinName),v(e,\"pullDirection\",t.pullDirection),v(e,\"preferredSide\",t.preferredSide),v(e,\"signalSchY\",t.signalSchY),v(e,\"wrongSideGap\",t.wrongSideGap),v(e,\"message\",t.message),`\u003cPullResistorOnWrongSide ${e.join(\" \")} /\u003e`}}class _e extends U{static EPSILON=0.01;index;powerNets;groundNets;positiveVoltageNets=new Set;componentIds;horizontalPushbuttonComponentIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t),this.horizontalPushbuttonComponentIds=ls(this.index),this.powerNets=new Set(this.index.powerNets),this.groundNets=new Set(this.index.groundNets);for(let r of t.circuitJson){if(r.type===\"source_net\"\u0026\u0026r.is_positive_voltage_source)this.positiveVoltageNets.add(this.index.connected(r.source_net_id));if(r.type!==\"source_port\")continue;let n=this.index.connected(r.source_port_id);if(r.provides_power||r.requires_power)this.powerNets.add(n);if(r.provides_ground||r.requires_ground)this.groundNets.add(n)}this.componentIds=[...this.index.components.keys()].filter((r)=\u003ethis.index.portsByComponent.get(r)?.length===2),this.solved=this.componentIds.length===0}_step(){let t=this.componentIds[this.currentIndex++];if(this.solved=this.currentIndex\u003e=this.componentIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.components.get(t),i=e.twoTerminalNets(t);if(!r||!i)return;if(n?.ftype===\"simple_inductor\"\u0026\u0026!i.some((B)=\u003ethis.groundNets.has(B)))return;if((n?.ftype===\"simple_diode\"||n?.ftype===\"simple_fuse\")\u0026\u0026i.every((B)=\u003ethis.powerNets.has(B)))return;if(i.some((B)=\u003ethis.powerNets.has(B)\u0026\u0026this.groundNets.has(B)))return;let s=i.map((B)=\u003ethis.powerNets.has(B)?\"power\":this.groundNets.has(B)?\"ground\":void 0);if(s.every((B)=\u003eB===void 0))return;let o=s.includes(\"power\")?\"power\":\"ground\",c=i.flatMap((B,k)=\u003es[k]===o?[{net:B,index:k}]:[]),l=(c.find(({net:B})=\u003ee.portsByNet.get(B)?.some((k)=\u003eo===\"power\"?k.provides_power:k.provides_ground))??c.find(({net:B})=\u003e(o===\"power\"?e.powerNets:e.groundNets).has(B))??c[0]).index,a=i[l],p=e.portsByComponent.get(t),d=p.find((B)=\u003ee.connected(B.source_port_id)===a),m=p.find((B)=\u003eB!==d),f=e.port(d),_=e.port(m);if(!f||!_)return;let g=e.connected(m.source_port_id),y=this.groundNets.has(g),S=n?.ftype===\"simple_resistor\"\u0026\u0026!this.powerNets.has(g)\u0026\u0026!y;if(this.positiveVoltageNets.has(a)\u0026\u0026(y||S)\u0026\u0026Math.abs(f.center.x-_.center.x)\u003c=_e.EPSILON\u0026\u0026f.center.y\u003c_.center.y-_e.EPSILON\u0026\u0026f.facing_direction===\"down\"\u0026\u0026_.facing_direction===\"up\"){this.issues.push({lineItemType:\"TwoPinComponentHasInvertedRails\",schematicBox:r,railSourcePortId:d.source_port_id,railPinName:d.name,railType:\"power\",deltaSchRotation:180,suggestedRailFacingDirection:\"up\",message:`rotate ${r.sourceComponentName||\"component\"} by 180° so its positive-supply pin faces up and its ${y?\"ground\":\"signal\"} pin faces down; preserve pin connections and reroute attached traces`});return}if(!(Math.abs(f.center.y-_.center.y)\u003c=_e.EPSILON\u0026\u0026Math.abs(f.center.x-_.center.x)\u003e_e.EPSILON\u0026\u0026(f.facing_direction===\"left\"\u0026\u0026_.facing_direction===\"right\"||f.facing_direction===\"right\"\u0026\u0026_.facing_direction===\"left\")))return;if(this.horizontalPushbuttonComponentIds.has(t))return;let C=o===\"power\"?\"up\":\"down\",L=f.facing_direction===\"left\"===(o===\"power\")?-90:90;this.issues.push({lineItemType:\"TwoPinComponentShouldBeVertical\",schematicBox:r,railSourcePortId:d.source_port_id,railPinName:d.name,railType:o,deltaSchRotation:L,suggestedRailFacingDirection:C,message:`rotate ${r.sourceComponentName||\"component\"} by ${L}° so its ${o}-connected pin faces ${C} and the component is vertical`})}static issueToString(t){let e=[];return v(e,\"componentName\",t.schematicBox.sourceComponentName),v(e,\"railPin\",t.railPinName),v(e,\"railType\",t.railType),v(e,\"deltaSchRotation\",t.deltaSchRotation),v(e,\"suggestedRailFacingDirection\",t.suggestedRailFacingDirection),v(e,\"message\",t.message),`\u003c${t.lineItemType} ${e.join(\" \")} /\u003e`}}function Ey(t,e,r){let n=we(e.side,r)-we(t.side,r);if(n===0)return 1/0;let[i,s]=n\u003e0?[t,e]:[e,t],o=r===\"width\"?s.xMin-i.xMax:s.yMin-i.yMax;return(be-o)/Math.abs(n)}function Ry(t,e){let r=(s)=\u003e{let{width:o,height:c}=t,l=e.map((p)=\u003e({...p})),a=l.length*(l.length-1)/2;for(let p=0;p\u003c=a;p++){let d;for(let k=0;k\u003cl.length\u0026\u0026!d;k++)for(let I=k+1;I\u003cl.length;I++){let j=l[k],Q=l[I];if(j.side!==Q.side\u0026\u0026wr(j,Q,be)){d=[j,Q];break}}if(!d)return{width:o\u003et.width?o:void 0,height:c\u003et.height?c:void 0};let[m,f]=d,_=s===\"height\"?1/0:Ey(m,f,\"width\"),g=s===\"width\"?1/0:Ey(m,f,\"height\"),y=_*c\u003c=g*o?\"width\":\"height\",S=y===\"width\"?_:g;if(!Number.isFinite(S)||S\u003c=0)return;let P=y===\"width\"?o:c,b=Math.ceil((P+S)*1000-0.000000001)/1000,C=b-P;if(y===\"width\")o=b;else c=b;let L=y===\"width\"?\"xMin\":\"yMin\",B=y===\"width\"?\"xMax\":\"yMax\";for(let k of l){let I=we(k.side,y)*C;k[L]+=I,k[B]+=I}}},n=[r(\"width\"),r(\"height\"),r()].filter((s)=\u003es!==void 0),i=(s)=\u003e(s.width??t.width)*(s.height??t.height);return n.sort((s,o)=\u003ei(s)-i(o))[0]}class $n extends U{params;entries;placementById;currentIndex=0;constructor(t){super();this.params=t;let{circuitJson:e,componentPlacements:r}=t.ctx;this.placementById=this.getPlacementBySchematicComponentId(r);let n=er(e);this.entries=Array.from(this.getPortsBySchematicComponentId(e)).filter(([i])=\u003en.has(i)),this.solved=this.entries.length===0}_step(){let t=this.entries[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex\u003e=this.entries.length;let[e,r]=t,n=this.placementById.get(e);if(!n)return;let i=Sr(n,r,_n);if(i.length===0)return;let s=this.getCollisionSummary(i);if(s.overlappingSides.length===0)return;let o=Ry(n,i);this.params.issues.push({lineItemType:\"SchematicBoxInnerLabelCollision\",schematicBox:n,overlappingSides:s.overlappingSides,minimumLabelGap:be,labelPairs:s.labelPairs,suggestedSchWidth:o?.width,suggestedSchHeight:o?.height,message:this.getMessage(s,o)})}static issueToString(t){let e=[];v(e,\"message\",t.message),v(e,\"componentName\",t.schematicBox.sourceComponentName),v(e,\"currentSchWidth\",t.schematicBox.width),v(e,\"currentSchHeight\",t.schematicBox.height),v(e,\"overlappingSides\",t.overlappingSides.join(\",\")),v(e,\"minimumLabelGap\",t.minimumLabelGap),v(e,\"suggestedSchWidth\",t.suggestedSchWidth),v(e,\"suggestedSchHeight\",t.suggestedSchHeight);let r=`\u003cSchematicBoxInnerLabelCollision ${e.join(\" \")}`;if(!t.labelPairs?.length)return`${r} /\u003e`;let n=t.labelPairs.map((i)=\u003e{let s=[];return v(s,\"label1\",i.firstLabel.text),v(s,\"label2\",i.secondLabel.text),v(s,\"port1\",i.firstLabel.schematicPortId),v(s,\"port2\",i.secondLabel.schematicPortId),v(s,\"side1\",i.firstLabel.side),v(s,\"side2\",i.secondLabel.side),v(s,\"kind\",i.kind),v(s,\"measuredGap\",i.measuredGap),` \u003cPinLabelPair ${s.join(\" \")} /\u003e`});return`${r}\u003e\n${n.join(`\n`)}\n\u003c/SchematicBoxInnerLabelCollision\u003e`}getMessage({overlappingSides:t,labelPairs:e},r){let n=r?.width\u0026\u0026r.height?\"schWidth and schHeight\":r?.width?\"schWidth\":r?.height?\"schHeight\":t.every((s)=\u003es===\"left\"||s===\"right\")?\"schWidth\":t.every((s)=\u003es===\"top\"||s===\"bottom\")?\"schHeight\":\"schWidth or schHeight\";return`${e.map(({firstLabel:s,secondLabel:o,kind:c})=\u003e`Labels ${s.text} (${s.side}) and ${o.text} (${o.side}) ${c===\"overlap\"?\"overlap\":\"are too close\"}.`).join(\" \")} Increase the ${n} to leave at least ${be} schematic units between these labels.`}isSchematicPort(t){return t.type===\"schematic_port\"}isSchematicSide(t){return t===\"left\"||t===\"right\"||t===\"top\"||t===\"bottom\"}getPlacementBySchematicComponentId(t){return new Map(t.filter((e)=\u003ee.schematicComponentId).map((e)=\u003e[e.schematicComponentId,e]))}getPortsBySchematicComponentId(t){let e=new Map;for(let r of t.filter((n)=\u003ethis.isSchematicPort(n))){if(!r.schematic_component_id)continue;if(!this.isSchematicSide(r.side_of_component))continue;let n=e.get(r.schematic_component_id);if(n)n.push(r);else e.set(r.schematic_component_id,[r])}return e}getCollisionSummary(t){let e=new Set,r=[],n=(i)=\u003e({schematicPortId:i.schematicPortId,text:i.text,side:i.side,bounds:{left:i.xMin,right:i.xMax,bottom:i.yMin,top:i.yMax}});for(let i=0;i\u003ct.length;i++)for(let s=i+1;s\u003ct.length;s++){let o=t[i],c=t[s];if(o.side===c.side)continue;if(!wr(o,c,be))continue;e.add(o.side),e.add(c.side),r.push({firstLabel:n(o),secondLabel:n(c),measuredGap:Math.max(0,o.xMin-c.xMax,c.xMin-o.xMax,o.yMin-c.yMax,c.yMin-o.yMax),kind:wr(o,c,0)?\"overlap\":\"clearance\"})}return{overlappingSides:this.sortSides(Array.from(e)),labelPairs:r}}sortSides(t){let e={left:0,right:1,top:2,bottom:3};return t.sort((r,n)=\u003ee[r]-e[n])}}class Pr extends U{params;placements;firstIndex=0;secondIndex=1;constructor(t){super();this.params=t;this.placements=t.ctx.componentPlacements,this.solved=this.placements.length\u003c2}_step(){if(this.firstIndex\u003e=this.placements.length-1){this.solved=!0;return}let t=this.getComponentOverlap(this.placements[this.firstIndex],this.placements[this.secondIndex]);if(t)this.params.issues.push(t);if(this.secondIndex++,this.secondIndex\u003e=this.placements.length)this.firstIndex++,this.secondIndex=this.firstIndex+1;this.solved=this.firstIndex\u003e=this.placements.length-1}getCenteredRectBounds(t){return{left:t.schX-t.width/2,right:t.schX+t.width/2,top:t.schY-t.height/2,bottom:t.schY+t.height/2}}getOverlapCorrectionSuggestions({firstComponent:t,secondComponent:e,overlapWidth:r,overlapHeight:n}){let i=t.width*t.height,s=e.width*e.height,o=i\u003c=s?t:e,c=o===t?e:t,l=o.schX\u003c=c.schX?-r:r,a=o.schY\u003c=c.schY?-n:n;return[{targetComponentName:o.sourceComponentName,deltaSchX:l,deltaSchY:0,newSchX:o.schX+l,newSchY:o.schY},{targetComponentName:o.sourceComponentName,deltaSchX:0,deltaSchY:a,newSchX:o.schX,newSchY:o.schY+a}]}static issueToString(t){let e=[];return v(e,\"component1Name\",t.firstComponent.sourceComponentName),v(e,\"component2Name\",t.secondComponent.sourceComponentName),v(e,\"component1SchX\",t.firstComponent.schX),v(e,\"component1SchY\",t.firstComponent.schY),v(e,\"component2SchX\",t.secondComponent.schX),v(e,\"component2SchY\",t.secondComponent.schY),v(e,\"overlapWidth\",t.overlapWidth),v(e,\"overlapHeight\",t.overlapHeight),[`\u003cComponentOverlap ${e.join(\" \")}\u003e`,...t.correctionSuggestions.map(Pr.correctionSuggestionToString),\"\u003c/ComponentOverlap\u003e\"].join(`\n`)}static correctionSuggestionToString(t){let e=[];if(v(e,\"target\",t.targetComponentName),t.deltaSchX!==0)v(e,\"newSchX\",t.newSchX),v(e,\"deltaSchX\",t.deltaSchX,{formatDelta:!0});if(t.deltaSchY!==0)v(e,\"newSchY\",t.newSchY),v(e,\"deltaSchY\",t.deltaSchY,{formatDelta:!0});return`\u003cOverlapCorrectionSuggestion ${e.join(\" \")} /\u003e`}getComponentOverlap(t,e){if(t.schematicSheetId!==e.schematicSheetId)return null;let r=this.getCenteredRectBounds(t),n=this.getCenteredRectBounds(e),i=Math.min(r.right,n.right)-Math.max(r.left,n.left),s=Math.min(r.bottom,n.bottom)-Math.max(r.top,n.top);if(i\u003c=0||s\u003c=0)return null;return{lineItemType:\"ComponentOverlap\",firstComponent:t,secondComponent:e,overlapWidth:i,overlapHeight:s,correctionSuggestions:this.getOverlapCorrectionSuggestions({firstComponent:t,secondComponent:e,overlapWidth:i,overlapHeight:s})}}}function ps(t,e){let r;for(let n of t){if(n.type!==\"schematic_path\"\u0026\u0026n.type!==\"schematic_circle\"\u0026\u0026n.type!==\"schematic_rect\"||n.schematic_component_id!==e)continue;let i=(n.stroke_width??0.02)/2,s;if(n.type===\"schematic_path\"){if(!n.points.length)continue;s={xMin:Math.min(...n.points.map((o)=\u003eo.x)),xMax:Math.max(...n.points.map((o)=\u003eo.x)),yMin:Math.min(...n.points.map((o)=\u003eo.y)),yMax:Math.max(...n.points.map((o)=\u003eo.y))}}else{let o=n.type===\"schematic_rect\"?(n.rotation??0)*Math.PI/180:0,c=n.type===\"schematic_circle\"?2*n.radius:n.width,l=n.type===\"schematic_circle\"?2*n.radius:n.height,a=(Math.abs(c*Math.cos(o))+Math.abs(l*Math.sin(o)))/2,p=(Math.abs(c*Math.sin(o))+Math.abs(l*Math.cos(o)))/2;s={xMin:n.center.x-a,xMax:n.center.x+a,yMin:n.center.y-p,yMax:n.center.y+p}}s.xMin-=i,s.xMax+=i,s.yMin-=i,s.yMax+=i,r=r?{xMin:Math.min(r.xMin,s.xMin),xMax:Math.max(r.xMax,s.xMax),yMin:Math.min(r.yMin,s.yMin),yMax:Math.max(r.yMax,s.yMax)}:s}return r}var Zi=(t)=\u003eArray.from(ns(t)).length*0.095*(is(t)/0.15),$y=(t)=\u003eMath.max(Zi(t),_n(t));function hs(t,e,r,n,i=0,s){if(!Number.isFinite(r)||r\u003c=0)return;if(e.some((g)=\u003e!g.side_of_component))return;if(!Wy(t,e,be,s))return;let o=0,c=0;for(let g of e)if(g.side_of_component===\"left\"||g.side_of_component===\"right\")c=Math.max(c,2*(Math.abs(g.center.y-t.schY)+r));else o=Math.max(o,2*(Math.abs(g.center.x-t.schX)+r));let l=n.width===void 0?t.width:Math.max(n.width,o,Oy(t,e,\"width\",s)),a=n.height===void 0?t.height:Math.max(n.height,c,Oy(t,e,\"height\",s)),p=(g)=\u003eg\u003e0.000000001\u0026\u0026g\u003e=i-0.000000001,d=p(t.width-l)?l:void 0,m=p(t.height-a)?a:void 0;if(d===void 0\u0026\u0026m===void 0)return;let f=[{width:d,height:m}];if(d!==void 0\u0026\u0026m!==void 0)f.push({width:d},{height:m});let _=(g)=\u003e(g.width??t.width)*(g.height??t.height);return f.sort((g,y)=\u003e_(g)-_(y)),f.find((g)=\u003eWy({...t,width:g.width??t.width,height:g.height??t.height},e,be,s))}function Oy(t,e,r,n){let i=t[r],s=r===\"width\"?t.schX:t.schY,o=r===\"width\"?\"xMin\":\"yMin\",c=r===\"width\"?\"xMax\":\"yMax\",l=r===\"width\"?\"yMin\":\"xMin\",a=r===\"width\"?\"yMax\":\"xMax\",p=0,d=(f,_,g=0)=\u003e{if(_\u003e0)p=Math.max(p,i+(g-f)/_)},m=Sr(t,e,$y);if(n)m.push(n);for(let f=0;f\u003cm.length;f++){let _=m[f],g=we(_.side,r);d(_[o]-(s-i/2),g+0.5),d(s+i/2-_[c],0.5-g);for(let y=f+1;y\u003cm.length;y++){let S=m[y],P=_.side\u0026\u0026S.side\u0026\u0026_.side!==S.side?be:yn;if(!rs(_[l],_[a],S[l],S[a],P))continue;let[b,C]=_[c]\u003c=S[o]?[_,S]:[S,_];d(C[o]-b[c],we(C.side,r)-we(b.side,r),P)}}return p}function Wy(t,e,r=yn,n){if(!Number.isFinite(t.width)||!Number.isFinite(t.height))return!1;let i=Sr(t,e,$y);if(n)i.push(n);for(let s=0;s\u003ci.length;s++){let o=i[s];if(o.xMin\u003ct.schX-t.width/2-0.000000001||o.xMax\u003et.schX+t.width/2+0.000000001||o.yMin\u003ct.schY-t.height/2-0.000000001||o.yMax\u003et.schY+t.height/2+0.000000001)return!1;for(let c=s+1;c\u003ci.length;c++){let l=i[c],a=o.side\u0026\u0026l.side\u0026\u0026o.side!==l.side?r:yn;if(wr(o,l,a))return!1}}return!0}class Br extends U{params;SCHEMATIC_BOX_TOO_WIDE_MESSAGE=\"Shrink schematic box width\";PIN_HEADER_MAX_ALLOWED_GAP=0.1;GENERIC_MAX_ALLOWED_GAP=1;PIN_LABEL_EDGE_PADDING=0.1;GAP_COMPARISON_EPSILON=0.000000001;entries;placementById;schematicComponentById;sourceComponentById;currentIndex=0;constructor(t){super();this.params=t;let{circuitJson:e,componentPlacements:r}=t.ctx;this.placementById=this.getPlacementBySchematicComponentId(r),this.schematicComponentById=new Map(e.filter((i)=\u003ei.type===\"schematic_component\").map((i)=\u003e[i.schematic_component_id,i])),this.sourceComponentById=this.getSourceComponentById(e);let n=er(e);this.entries=Array.from(this.getPortsBySchematicComponentId(e)).filter(([i])=\u003en.has(i)),this.solved=this.entries.length===0}_step(){let t=this.entries[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex\u003e=this.entries.length;let[e,r]=t,n=this.placementById.get(e);if(!n)return;let i=this.getCenteredRectBounds(n),s=this.getLabelColumn(\"left\",r),o=this.getLabelColumn(\"right\",r),c=this.getSourceComponentFtype(n,this.sourceComponentById),l;if(s\u0026\u0026o)l=this.getInnerLabelEdge(i,o)-this.getInnerLabelEdge(i,s);else if(s\u0026\u0026s.labelCount\u003e=4)l=i.right-this.getInnerLabelEdge(i,s);else if(o\u0026\u0026o.labelCount\u003e=4)l=this.getInnerLabelEdge(i,o)-i.left;if(l===void 0)return;let a=c===\"simple_pin_header\"?this.PIN_HEADER_MAX_ALLOWED_GAP:this.GENERIC_MAX_ALLOWED_GAP;if(!this.exceedsMaxAllowedGap(l,a))return;let p=this.getSuggestedWidth({measuredInnerLabelHorizontalEmptySpace:l,maxAllowedInnerLabelHorizontalEmptySpace:a,currentWidth:n.width}),d=this.schematicComponentById.get(e)?.pin_spacing;if(d===void 0)return;let m=hs(n,r,d,{width:p},0,ps(this.params.ctx.circuitJson,e));if(m?.width===void 0)return;let f=m.width;if(c===\"simple_pin_header\")this.params.issues.push({lineItemType:\"PinHeaderSchematicBoxTooWide\",schematicBox:n,measuredInnerLabelHorizontalEmptySpace:l,maxAllowedInnerLabelHorizontalEmptySpace:a,suggestedSchWidth:f,message:this.SCHEMATIC_BOX_TOO_WIDE_MESSAGE});else this.params.issues.push({lineItemType:\"GenericSchematicBoxTooWide\",schematicBox:n,measuredInnerLabelHorizontalEmptySpace:l,maxAllowedInnerLabelHorizontalEmptySpace:a,suggestedSchWidth:f,message:this.SCHEMATIC_BOX_TOO_WIDE_MESSAGE})}static issueToString(t){let e=[];return v(e,\"message\",t.message),v(e,\"componentName\",t.schematicBox.sourceComponentName),v(e,\"currentSchWidth\",t.schematicBox.width),v(e,\"measuredInnerLabelHorizontalEmptySpace\",t.measuredInnerLabelHorizontalEmptySpace),v(e,\"maxAllowedInnerLabelHorizontalEmptySpace\",t.maxAllowedInnerLabelHorizontalEmptySpace),v(e,\"suggestedSchWidth\",t.suggestedSchWidth),`\u003c${t.lineItemType} ${e.join(\" \")} /\u003e`}isSchematicPort(t){return t.type===\"schematic_port\"}getSourceComponentWithFtype(t){if(t.type!==\"source_component\"||!(\"source_component_id\"in t)||typeof t.source_component_id!==\"string\")return null;return{type:\"source_component\",source_component_id:t.source_component_id,ftype:\"ftype\"in t\u0026\u0026typeof t.ftype===\"string\"?t.ftype:void 0}}exceedsMaxAllowedGap(t,e){return t-e\u003ethis.GAP_COMPARISON_EPSILON}getCenteredRectBounds(t){return{left:t.schX-t.width/2,right:t.schX+t.width/2,top:t.schY+t.height/2,bottom:t.schY-t.height/2}}getSourceComponentById(t){return new Map(t.flatMap((e)=\u003e{let r=this.getSourceComponentWithFtype(e);return r?[r]:[]}).map((e)=\u003e[e.source_component_id,e]))}getPlacementBySchematicComponentId(t){return new Map(t.filter((e)=\u003ee.schematicComponentId).map((e)=\u003e[e.schematicComponentId,e]))}getPortsBySchematicComponentId(t){let e=new Map;for(let r of t.filter((n)=\u003ethis.isSchematicPort(n))){if(!r.schematic_component_id)continue;let n=e.get(r.schematic_component_id);if(n)n.push(r);else e.set(r.schematic_component_id,[r])}return e}getSourceComponentFtype(t,e){return t.sourceComponentId?e.get(t.sourceComponentId)?.ftype:void 0}getLabelColumn(t,e){let r=e.filter((n)=\u003en.side_of_component===t).flatMap((n)=\u003en.display_pin_label?[Zi(n)]:[]);if(r.length===0)return null;return{side:t,labelCount:r.length,maxLabelWidth:Math.max(...r)}}getInnerLabelEdge(t,e){return e.side===\"left\"?t.left+this.PIN_LABEL_EDGE_PADDING+e.maxLabelWidth:t.right-this.PIN_LABEL_EDGE_PADDING-e.maxLabelWidth}getSuggestedWidth(t){return t.currentWidth-t.measuredInnerLabelHorizontalEmptySpace+t.maxAllowedInnerLabelHorizontalEmptySpace}}class jn extends U{params;MESSAGE=\"Move schematic pins closer to the box edge or change the schematic box\";GAP_COMPARISON_EPSILON=0.000000001;entries;placementById;schematicComponentById;sourcePortById;currentIndex=0;constructor(t){super();this.params=t;let{circuitJson:e,componentPlacements:r}=t.ctx;this.placementById=this.getPlacementBySchematicComponentId(r),this.schematicComponentById=this.getSchematicComponentById(e),this.sourcePortById=this.getSourcePortById(e);let n=er(e);this.entries=Array.from(this.getPortsBySchematicComponentId(e)).filter(([i])=\u003en.has(i)),this.solved=this.entries.length===0}_step(){let t=this.entries[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex\u003e=this.entries.length;let[e,r]=t,n=this.placementById.get(e);if(!n)return;let i=this.getPinSpacing(n,this.schematicComponentById);if(i===null)return;let s=this.getMaxLabelLengthBySide(r),o=new Map;for(let g of r){if(!this.isSchematicSide(g.side_of_component))continue;let y=o.get(g.side_of_component)??[];y.push(g),o.set(g.side_of_component,y)}let c=[];for(let[g,y]of o){if(y.length===1)continue;for(let S of this.getBoxEdgeSidesForPinSide(g)){let P=this.getOuterPinBySide(S,y);if(!P)continue;let b=this.getPinPaddingToEdge(n,P,S),C=Math.max(i,this.getMaxAllowedPinPadding(i,S,s));if(!this.exceedsMaxAllowedGap(b,C+i))continue;c.push({schematicBox:n,pinSide:g,edgeSide:S,pinName:this.getPinName(P,this.sourcePortById),measuredPadding:b,maxAllowedPadding:C})}}if(!c.length)return;let l=c.map((g)=\u003ethis.createIssue(g)),a=l.flatMap((g)=\u003eg.suggestedSchWidth===void 0?[]:[g.suggestedSchWidth]),p=l.flatMap((g)=\u003eg.suggestedSchHeight===void 0?[]:[g.suggestedSchHeight]),d=hs(n,r,i,{width:a.length?Math.max(...a):void 0,height:p.length?Math.max(...p):void 0},2*i,ps(this.params.ctx.circuitJson,e));if(!d)return;let m=l.filter((g)=\u003ed.width!==void 0\u0026\u0026g.suggestedSchWidth!==void 0||d.height!==void 0\u0026\u0026g.suggestedSchHeight!==void 0),f=m.reduce((g,y)=\u003ey.excessPadding\u003eg.excessPadding?y:g),_=[d.width===void 0?\"\":\"width\",d.height===void 0?\"\":\"height\"].filter(Boolean).join(\" and \");this.params.issues.push({...f,paddingDetails:m.map(({pinSide:g,edgeSide:y,pinName:S,measuredPadding:P,maxAllowedPadding:b,excessPadding:C})=\u003e({pinSide:g,edgeSide:y,pinName:S,measuredPadding:P,maxAllowedPadding:b,excessPadding:C})),suggestedSchWidth:d.width,suggestedSchHeight:d.height,message:`${this.MESSAGE} ${_}`})}static issueToString(t){let e=[];if(v(e,\"message\",t.message),v(e,\"componentName\",t.schematicBox.sourceComponentName),t.paddingDetails)v(e,\"pinSides\",[...new Set(t.paddingDetails.map((r)=\u003er.pinSide))].join(\",\")),v(e,\"edgeSides\",[...new Set(t.paddingDetails.map((r)=\u003er.edgeSide))].join(\",\"));else v(e,\"pinSide\",t.pinSide),v(e,\"edgeSide\",t.edgeSide),v(e,\"pinName\",t.pinName),v(e,\"measuredPadding\",t.measuredPadding),v(e,\"maxAllowedPadding\",t.maxAllowedPadding),v(e,\"excessPadding\",t.excessPadding);return v(e,\"suggestedSchWidth\",t.suggestedSchWidth),v(e,\"suggestedSchHeight\",t.suggestedSchHeight),`\u003cSchematicPinPaddingToEdgeTooLarge ${e.join(\" \")} /\u003e`}isSchematicPort(t){return t.type===\"schematic_port\"}isSourcePort(t){return t.type===\"source_port\"}isSchematicComponent(t){return t.type===\"schematic_component\"}isHorizontalSide(t){return t===\"left\"||t===\"right\"}isVerticalSide(t){return t===\"top\"||t===\"bottom\"}isSchematicSide(t){return this.isHorizontalSide(t)||this.isVerticalSide(t)}exceedsMaxAllowedGap(t,e){return t-e\u003ethis.GAP_COMPARISON_EPSILON}getCenteredRectBounds(t){return{left:t.schX-t.width/2,right:t.schX+t.width/2,top:t.schY+t.height/2,bottom:t.schY-t.height/2}}getSourcePortById(t){return new Map(t.filter((e)=\u003ethis.isSourcePort(e)).map((e)=\u003e[e.source_port_id,e]))}getSchematicComponentById(t){return new Map(t.filter((e)=\u003ethis.isSchematicComponent(e)).map((e)=\u003e[e.schematic_component_id,e]))}getPlacementBySchematicComponentId(t){return new Map(t.filter((e)=\u003ee.schematicComponentId).map((e)=\u003e[e.schematicComponentId,e]))}getPortsBySchematicComponentId(t){let e=new Map;for(let r of t.filter((n)=\u003ethis.isSchematicPort(n))){if(!r.schematic_component_id)continue;let n=e.get(r.schematic_component_id);if(n)n.push(r);else e.set(r.schematic_component_id,[r])}return e}getPinSpacing(t,e){if(!t.schematicComponentId)return null;let r=e.get(t.schematicComponentId);return typeof r?.pin_spacing===\"number\"?r.pin_spacing:null}getPinName(t,e){let r=e.get(t.source_port_id);if(r?.name)return r.name;if(t.display_pin_label)return t.display_pin_label;if(r?.pin_number!==void 0)return String(r.pin_number);return}getMaxLabelLengthBySide(t){let e={left:0,right:0,top:0,bottom:0};for(let r of t){if(!this.isSchematicSide(r.side_of_component))continue;if(!r.display_pin_label)continue;e[r.side_of_component]=Math.max(e[r.side_of_component],Zi(r))}return e}getOuterPinBySide(t,e){if(e.length===0)return null;switch(t){case\"top\":return e.reduce((r,n)=\u003en.center.y\u003er.center.y?n:r);case\"bottom\":return e.reduce((r,n)=\u003en.center.y\u003cr.center.y?n:r);case\"left\":return e.reduce((r,n)=\u003en.center.x\u003cr.center.x?n:r);case\"right\":return e.reduce((r,n)=\u003en.center.x\u003er.center.x?n:r)}}getPinPaddingToEdge(t,e,r){let n=this.getCenteredRectBounds(t);switch(r){case\"top\":return Math.max(0,n.top-e.center.y);case\"bottom\":return Math.max(0,e.center.y-n.bottom);case\"left\":return Math.max(0,e.center.x-n.left);case\"right\":return Math.max(0,n.right-e.center.x)}}getBoxEdgeSidesForPinSide(t){return this.isHorizontalSide(t)?[\"top\",\"bottom\"]:[\"left\",\"right\"]}getMaxAllowedPinPadding(t,e,r){let n=this.isHorizontalSide(e)?[\"left\",\"right\"]:[\"top\",\"bottom\"];return(r[n[0]]+r[n[1]]+t)/2}createIssue(t){let e=Math.max(0,t.measuredPadding-t.maxAllowedPadding),r=e*2;return{lineItemType:\"SchematicPinPaddingToEdgeTooLarge\",pinSide:t.pinSide,edgeSide:t.edgeSide,pinName:t.pinName,schematicBox:t.schematicBox,measuredPadding:t.measuredPadding,maxAllowedPadding:t.maxAllowedPadding,excessPadding:e,suggestedSchWidth:this.isHorizontalSide(t.pinSide)?void 0:Math.max(0,t.schematicBox.width-r),suggestedSchHeight:this.isHorizontalSide(t.pinSide)?Math.max(0,t.schematicBox.height-r):void 0,message:this.isHorizontalSide(t.pinSide)?`${this.MESSAGE} height`:`${this.MESSAGE} width`}}}var Xy=new Map([[\"T\",1000000000000],[\"G\",1e9],[\"M\",1e6],[\"K\",1000],[\"k\",1000],[\"\",1],[\"m\",0.001],[\"µ\",0.000001],[\"μ\",0.000001],[\"u\",0.000001],[\"n\",0.000000001],[\"p\",0.000000000001],[\"f\",0.000000000000001]]),d5=[...Xy.keys()];function Dy(t){return Xy.get(t)}var Vy={Hz:{baseUnit:\"Hz\",variants:{MHz:1e6,kHz:1000,Hz:1}},g:{baseUnit:\"g\",variants:{kg:1000,g:1}},Ω:{baseUnit:\"Ω\",variants:{mΩ:0.001,mohm:0.001,mOhm:0.001,milliohm:0.001,Ω:1,ohm:1,Ohm:1,kΩ:1000,KΩ:1000,kohm:1000,kOhm:1000,KOhm:1000,Kohm:1000,MΩ:1e6,Mohm:1e6,MOhm:1e6,megohm:1e6,Megohm:1e6,GΩ:1e9,Gohm:1e9,GOhm:1e9,TΩ:1000000000000,Tohm:1000000000000,TOhm:1000000000000}},V:{baseUnit:\"V\",variants:{mV:0.001,V:1,kV:1000,KV:1000,MV:1e6,GV:1e9,TV:1000000000000}},A:{baseUnit:\"A\",variants:{µA:0.000001,μA:0.000001,mA:0.001,ma:0.001,A:1,kA:1000,MA:1e6}},F:{baseUnit:\"F\",variants:{pF:0.000000000001,nF:0.000000001,µF:0.000001,μF:0.000001,uF:0.000001,mF:0.001,F:1,kF:1000,KF:1000,MF:1e6}},H:{baseUnit:\"H\",variants:{pH:0.000000000001,nH:0.000000001,µH:0.000001,μH:0.000001,uH:0.000001,mH:0.001,H:1,kH:1000,KH:1000,MH:1e6}},ml:{baseUnit:\"ml\",variants:{ml:1,mL:1,l:1000,L:1000}},deg:{baseUnit:\"deg\",variants:{rad:180/Math.PI}},ms:{baseUnit:\"ms\",variants:{fs:0.000000000001,ps:0.000000001,ns:0.000001,us:0.001,µs:0.001,μs:0.001,ms:1,s:1000}},mm:{baseUnit:\"mm\",variants:{nm:0.000001,µm:0.001,μm:0.001,um:0.001,mm:1,cm:10,dm:100,m:1000,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:0.0254}}},ep=new Set;for(let[t,e]of Object.entries(Vy)){ep.add(t);for(let r of Object.keys(e.variants))ep.add(r)}function m5(t){for(let e of Object.values(Vy)){if(t in e.variants)return{baseUnit:e.baseUnit,conversionFactor:e.variants[t]};for(let[r,n]of Object.entries(e.variants)){if(!t.endsWith(r))continue;let i=t.slice(0,-r.length),s=Dy(i);if(s==null)continue;return{baseUnit:e.baseUnit,conversionFactor:s*n}}}return{baseUnit:t,conversionFactor:1}}function se(t,e){if(t===void 0||t===null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof t===\"string\"\u0026\u0026t.match(/^-?[\\d.]+$/))return{value:Number.parseFloat(t),parsedUnit:null,unitOfValue:null};if(typeof t===\"number\")return{value:t,parsedUnit:null,unitOfValue:null};if(typeof t===\"object\"\u0026\u0026\"x\"in t\u0026\u0026\"y\"in t){let a=se(t.x,e),p=se(t.x,e),d=se(t.y,e);if(p.value===null||d.value===null)return{parsedUnit:null,unitOfValue:null,value:null};return{parsedUnit:a.parsedUnit,unitOfValue:a.unitOfValue,value:{x:p.value,y:d.value}}}let n=t.toString().split(\"\").reverse().join(\"\").match(/[^\\d\\s]+/)?.[0];if(!n)throw Error(`Could not determine unit: \"${t}\"`);let i=n.split(\"\").reverse().join(\"\"),s=t.slice(0,-i.length),o=Dy(i);if(e\u0026\u0026o!=null)return{parsedUnit:null,unitOfValue:e,value:Number.parseFloat(s)*o};if(o!=null\u0026\u0026!ep.has(i))return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(s)*o};let{baseUnit:c,conversionFactor:l}=m5(i);return{parsedUnit:i,unitOfValue:c,value:l*Number.parseFloat(s)}}var u5=d5.filter((t)=\u003et!==\"\").sort((t,e)=\u003ee.length-t.length).map((t)=\u003et.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$\u0026\")).join(\"|\"),YU=new RegExp(`^([+-]?(?:\\\\d+(?:\\\\.\\\\d*)?|\\\\.\\\\d+)(?:[eE][+-]?\\\\d+)?)(?:(${u5}))? vendor/schematic-style-analysis.js - seveibar/nema17-rp2040-stepper-controller - tscircuit );var jy=[{value:1000000000000,symbol:\"T\"},{value:1e9,symbol:\"G\"},{value:1e6,symbol:\"M\"},{value:1000,symbol:\"k\"},{value:1,symbol:\"\"},{value:0.001,symbol:\"m\"},{value:0.000001,symbol:\"µ\"},{value:0.000000001,symbol:\"n\"},{value:0.000000000001,symbol:\"p\"}],LU=jy[jy.length-1];var kt;(function(t){t.assertEqual=(i)=\u003e{};function e(i){}t.assertIs=e;function r(i){throw Error()}t.assertNever=r,t.arrayToEnum=(i)=\u003e{let s={};for(let o of i)s[o]=o;return s},t.getValidEnumValues=(i)=\u003e{let s=t.objectKeys(i).filter((c)=\u003etypeof i[i[c]]!==\"number\"),o={};for(let c of s)o[c]=i[c];return t.objectValues(o)},t.objectValues=(i)=\u003et.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys===\"function\"?(i)=\u003eObject.keys(i):(i)=\u003e{let s=[];for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o))s.push(o);return s},t.find=(i,s)=\u003e{for(let o of i)if(s(o))return o;return},t.isInteger=typeof Number.isInteger===\"function\"?(i)=\u003eNumber.isInteger(i):(i)=\u003etypeof i===\"number\"\u0026\u0026Number.isFinite(i)\u0026\u0026Math.floor(i)===i;function n(i,s=\" | \"){return i.map((o)=\u003etypeof o===\"string\"?`'${o}'`:o).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=\u003e{if(typeof s===\"bigint\")return s.toString();return s}})(kt||(kt={}));var zy;(function(t){t.mergeShapes=(e,r)=\u003e({...e,...r})})(zy||(zy={}));var pt=kt.arrayToEnum([\"string\",\"nan\",\"number\",\"integer\",\"float\",\"boolean\",\"date\",\"bigint\",\"symbol\",\"function\",\"undefined\",\"null\",\"array\",\"object\",\"unknown\",\"promise\",\"void\",\"never\",\"map\",\"set\"]),We=(t)=\u003e{switch(typeof t){case\"undefined\":return pt.undefined;case\"string\":return pt.string;case\"number\":return Number.isNaN(t)?pt.nan:pt.number;case\"boolean\":return pt.boolean;case\"function\":return pt.function;case\"bigint\":return pt.bigint;case\"symbol\":return pt.symbol;case\"object\":if(Array.isArray(t))return pt.array;if(t===null)return pt.null;if(t.then\u0026\u0026typeof t.then===\"function\"\u0026\u0026t.catch\u0026\u0026typeof t.catch===\"function\")return pt.promise;if(typeof Map\u003c\"u\"\u0026\u0026t instanceof Map)return pt.map;if(typeof Set\u003c\"u\"\u0026\u0026t instanceof Set)return pt.set;if(typeof Date\u003c\"u\"\u0026\u0026t instanceof Date)return pt.date;return pt.object;default:return pt.unknown}};var X=kt.arrayToEnum([\"invalid_type\",\"invalid_literal\",\"custom\",\"invalid_union\",\"invalid_union_discriminator\",\"invalid_enum_value\",\"unrecognized_keys\",\"invalid_arguments\",\"invalid_return_type\",\"invalid_date\",\"invalid_string\",\"too_small\",\"too_big\",\"invalid_intersection_types\",\"not_multiple_of\",\"not_finite\"]);class pe extends Error{get errors(){return this.issues}constructor(t){super();this.issues=[],this.addIssue=(r)=\u003e{this.issues=[...this.issues,r]},this.addIssues=(r=[])=\u003e{this.issues=[...this.issues,...r]};let e=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,e);else this.__proto__=e;this.name=\"ZodError\",this.issues=t}format(t){let e=t||function(i){return i.message},r={_errors:[]},n=(i)=\u003e{for(let s of i.issues)if(s.code===\"invalid_union\")s.unionErrors.map(n);else if(s.code===\"invalid_return_type\")n(s.returnTypeError);else if(s.code===\"invalid_arguments\")n(s.argumentsError);else if(s.path.length===0)r._errors.push(e(s));else{let o=r,c=0;while(c\u003cs.path.length){let l=s.path[c];if(c!==s.path.length-1)o[l]=o[l]||{_errors:[]};else o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(s));o=o[l],c++}}};return n(this),r}static assert(t){if(!(t instanceof pe))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,kt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=(e)=\u003ee.message){let e={},r=[];for(let n of this.issues)if(n.path.length\u003e0){let i=n.path[0];e[i]=e[i]||[],e[i].push(t(n))}else r.push(t(n));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}}pe.create=(t)=\u003enew pe(t);var f5=(t,e)=\u003e{let r;switch(t.code){case X.invalid_type:if(t.received===pt.undefined)r=\"Required\";else r=`Expected ${t.expected}, received ${t.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,kt.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${kt.joinValues(t.keys,\", \")}`;break;case X.invalid_union:r=\"Invalid input\";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${kt.joinValues(t.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${kt.joinValues(t.options)}, received '${t.received}'`;break;case X.invalid_arguments:r=\"Invalid function arguments\";break;case X.invalid_return_type:r=\"Invalid function return type\";break;case X.invalid_date:r=\"Invalid date\";break;case X.invalid_string:if(typeof t.validation===\"object\")if(\"includes\"in t.validation){if(r=`Invalid input: must include \"${t.validation.includes}\"`,typeof t.validation.position===\"number\")r=`${r} at one or more positions greater than or equal to ${t.validation.position}`}else if(\"startsWith\"in t.validation)r=`Invalid input: must start with \"${t.validation.startsWith}\"`;else if(\"endsWith\"in t.validation)r=`Invalid input: must end with \"${t.validation.endsWith}\"`;else kt.assertNever(t.validation);else if(t.validation!==\"regex\")r=`Invalid ${t.validation}`;else r=\"Invalid\";break;case X.too_small:if(t.type===\"array\")r=`Array must contain ${t.exact?\"exactly\":t.inclusive?\"at least\":\"more than\"} ${t.minimum} element(s)`;else if(t.type===\"string\")r=`String must contain ${t.exact?\"exactly\":t.inclusive?\"at least\":\"over\"} ${t.minimum} character(s)`;else if(t.type===\"number\")r=`Number must be ${t.exact?\"exactly equal to \":t.inclusive?\"greater than or equal to \":\"greater than \"}${t.minimum}`;else if(t.type===\"bigint\")r=`Number must be ${t.exact?\"exactly equal to \":t.inclusive?\"greater than or equal to \":\"greater than \"}${t.minimum}`;else if(t.type===\"date\")r=`Date must be ${t.exact?\"exactly equal to \":t.inclusive?\"greater than or equal to \":\"greater than \"}${new Date(Number(t.minimum))}`;else r=\"Invalid input\";break;case X.too_big:if(t.type===\"array\")r=`Array must contain ${t.exact?\"exactly\":t.inclusive?\"at most\":\"less than\"} ${t.maximum} element(s)`;else if(t.type===\"string\")r=`String must contain ${t.exact?\"exactly\":t.inclusive?\"at most\":\"under\"} ${t.maximum} character(s)`;else if(t.type===\"number\")r=`Number must be ${t.exact?\"exactly\":t.inclusive?\"less than or equal to\":\"less than\"} ${t.maximum}`;else if(t.type===\"bigint\")r=`BigInt must be ${t.exact?\"exactly\":t.inclusive?\"less than or equal to\":\"less than\"} ${t.maximum}`;else if(t.type===\"date\")r=`Date must be ${t.exact?\"exactly\":t.inclusive?\"smaller than or equal to\":\"smaller than\"} ${new Date(Number(t.maximum))}`;else r=\"Invalid input\";break;case X.custom:r=\"Invalid input\";break;case X.invalid_intersection_types:r=\"Intersection results could not be merged\";break;case X.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case X.not_finite:r=\"Number must be finite\";break;default:r=e.defaultError,kt.assertNever(t)}return{message:r}},cr=f5;var y5=cr;function qi(){return y5}var ds=(t)=\u003e{let{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c=\"\",l=n.filter((a)=\u003e!!a).slice().reverse();for(let a of l)c=a(o,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function ct(t,e){let r=qi(),n=ds({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===cr?void 0:cr].filter((i)=\u003e!!i)});t.common.issues.push(n)}class ee{constructor(){this.value=\"valid\"}dirty(){if(this.value===\"valid\")this.value=\"dirty\"}abort(){if(this.value!==\"aborted\")this.value=\"aborted\"}static mergeArray(t,e){let r=[];for(let n of e){if(n.status===\"aborted\")return vt;if(n.status===\"dirty\")t.dirty();r.push(n.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,e){let r=[];for(let n of e){let i=await n.key,s=await n.value;r.push({key:i,value:s})}return ee.mergeObjectSync(t,r)}static mergeObjectSync(t,e){let r={};for(let n of e){let{key:i,value:s}=n;if(i.status===\"aborted\")return vt;if(s.status===\"aborted\")return vt;if(i.status===\"dirty\")t.dirty();if(s.status===\"dirty\")t.dirty();if(i.value!==\"__proto__\"\u0026\u0026(typeof s.value\u003c\"u\"||n.alwaysSet))r[i.value]=s.value}return{status:t.value,value:r}}}var vt=Object.freeze({status:\"aborted\"}),Xn=(t)=\u003e({status:\"dirty\",value:t}),ne=(t)=\u003e({status:\"valid\",value:t}),rp=(t)=\u003et.status===\"aborted\",np=(t)=\u003et.status===\"dirty\",Ir=(t)=\u003et.status===\"valid\",Ji=(t)=\u003etypeof Promise\u003c\"u\"\u0026\u0026t instanceof Promise;var dt;(function(t){t.errToObj=(e)=\u003etypeof e===\"string\"?{message:e}:e||{},t.toString=(e)=\u003etypeof e===\"string\"?e:e?.message})(dt||(dt={}));class ve{constructor(t,e,r,n){this._cachedPath=[],this.parent=t,this.data=e,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Uy=(t,e)=\u003e{if(Ir(e))return{success:!0,data:e.value};else{if(!t.common.issues.length)throw Error(\"Validation failed but no issues detected.\");return{success:!1,get error(){if(this._error)return this._error;let r=new pe(t.common.issues);return this._error=r,this._error}}}};function It(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e\u0026\u0026(r||n))throw Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);if(e)return{errorMap:e,description:i};return{errorMap:(o,c)=\u003e{let{message:l}=t;if(o.code===\"invalid_enum_value\")return{message:l??c.defaultError};if(typeof c.data\u003e\"u\")return{message:l??n??c.defaultError};if(o.code!==\"invalid_type\")return{message:c.defaultError};return{message:l??r??c.defaultError}},description:i}}class Ft{get description(){return this._def.description}_getType(t){return We(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:We(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ee,ctx:{common:t.parent.common,data:t.data,parsedType:We(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(Ji(e))throw Error(\"Synchronous parse encountered promise.\");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){let r={common:{issues:[],async:e?.async??!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:We(t)},n=this._parseSync({data:t,path:r.path,parent:r});return Uy(r,n)}\"~validate\"(t){let e={common:{issues:[],async:!!this[\"~standard\"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:We(t)};if(!this[\"~standard\"].async)try{let r=this._parseSync({data:t,path:[],parent:e});return Ir(r)?{value:r.value}:{issues:e.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes(\"encountered\"))this[\"~standard\"].async=!0;e.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:e}).then((r)=\u003eIr(r)?{value:r.value}:{issues:e.common.issues})}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:We(t)},n=this._parse({data:t,path:r.path,parent:r}),i=await(Ji(n)?n:Promise.resolve(n));return Uy(r,i)}refine(t,e){let r=(n)=\u003e{if(typeof e===\"string\"||typeof e\u003e\"u\")return{message:e};else if(typeof e===\"function\")return e(n);else return e};return this._refinement((n,i)=\u003e{let s=t(n),o=()=\u003ei.addIssue({code:X.custom,...r(n)});if(typeof Promise\u003c\"u\"\u0026\u0026s instanceof Promise)return s.then((c)=\u003e{if(!c)return o(),!1;else return!0});if(!s)return o(),!1;else return!0})}refinement(t,e){return this._refinement((r,n)=\u003e{if(!t(r))return n.addIssue(typeof e===\"function\"?e(r,n):e),!1;else return!0})}_refinement(t){return new Ie({schema:this,typeName:wt.ZodEffects,effect:{type:\"refinement\",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[\"~standard\"]={version:1,vendor:\"zod\",validate:(e)=\u003ethis[\"~validate\"](e)}}optional(){return Be.create(this,this._def)}nullable(){return lr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pe.create(this)}promise(){return Hn.create(this,this._def)}or(t){return no.create([this,t],this._def)}and(t){return io.create(this,t,this._def)}transform(t){return new Ie({...It(this._def),schema:this,typeName:wt.ZodEffects,effect:{type:\"transform\",transform:t}})}default(t){let e=typeof t===\"function\"?t:()=\u003et;return new co({...It(this._def),innerType:this,defaultValue:e,typeName:wt.ZodDefault})}brand(){return new ap({typeName:wt.ZodBranded,type:this,...It(this._def)})}catch(t){let e=typeof t===\"function\"?t:()=\u003et;return new lo({...It(this._def),innerType:this,catchValue:e,typeName:wt.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return xs.create(this,t)}readonly(){return po.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var _5=/^c[^\\s-]{8,}$/i,g5=/^[0-9a-z]+$/,x5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,b5=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,v5=/^[a-z0-9_-]{21}$/i,S5=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,w5=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,A5=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,P5=\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\",ip,B5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,I5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,F5=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,M5=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,C5=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,k5=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Hy=\"((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))\",N5=new RegExp(`^${Hy} vendor/schematic-style-analysis.js - seveibar/nema17-rp2040-stepper-controller - tscircuit );function Qy(t){let e=\"[0-5]\\\\d\";if(t.precision)e=`${e}\\\\.\\\\d{${t.precision}}`;else if(t.precision==null)e=`${e}(\\\\.\\\\d+)?`;let r=t.precision?\"+\":\"?\";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${r}`}function Y5(t){return new RegExp(`^${Qy(t)} vendor/schematic-style-analysis.js - seveibar/nema17-rp2040-stepper-controller - tscircuit )}function L5(t){let e=`${Hy}T${Qy(t)}`,r=[];if(r.push(t.local?\"Z?\":\"Z\"),t.offset)r.push(\"([+-]\\\\d{2}:?\\\\d{2})\");return e=`${e}(${r.join(\"|\")})`,new RegExp(`^${e} vendor/schematic-style-analysis.js - seveibar/nema17-rp2040-stepper-controller - tscircuit )}function T5(t,e){if((e===\"v4\"||!e)\u0026\u0026B5.test(t))return!0;if((e===\"v6\"||!e)\u0026\u0026F5.test(t))return!0;return!1}function E5(t,e){if(!S5.test(t))return!1;try{let[r]=t.split(\".\");if(!r)return!1;let n=r.replace(/-/g,\"+\").replace(/_/g,\"/\").padEnd(r.length+(4-r.length%4)%4,\"=\"),i=JSON.parse(atob(n));if(typeof i!==\"object\"||i===null)return!1;if(\"typ\"in i\u0026\u0026i?.typ!==\"JWT\")return!1;if(!i.alg)return!1;if(e\u0026\u0026i.alg!==e)return!1;return!0}catch{return!1}}function R5(t,e){if((e===\"v4\"||!e)\u0026\u0026I5.test(t))return!0;if((e===\"v6\"||!e)\u0026\u0026M5.test(t))return!0;return!1}class je extends Ft{_parse(t){if(this._def.coerce)t.data=String(t.data);if(this._getType(t)!==pt.string){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_type,expected:pt.string,received:i.parsedType}),vt}let r=new ee,n=void 0;for(let i of this._def.checks)if(i.kind===\"min\"){if(t.data.length\u003ci.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_small,minimum:i.value,type:\"string\",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind===\"max\"){if(t.data.length\u003ei.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_big,maximum:i.value,type:\"string\",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind===\"length\"){let s=t.data.length\u003ei.value,o=t.data.length\u003ci.value;if(s||o){if(n=this._getOrReturnCtx(t,n),s)ct(n,{code:X.too_big,maximum:i.value,type:\"string\",inclusive:!0,exact:!0,message:i.message});else if(o)ct(n,{code:X.too_small,minimum:i.value,type:\"string\",inclusive:!0,exact:!0,message:i.message});r.dirty()}}else if(i.kind===\"email\"){if(!A5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"email\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"emoji\"){if(!ip)ip=new RegExp(P5,\"u\");if(!ip.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"emoji\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"uuid\"){if(!b5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"uuid\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"nanoid\"){if(!v5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"nanoid\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"cuid\"){if(!_5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"cuid\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"cuid2\"){if(!g5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"cuid2\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"ulid\"){if(!x5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"ulid\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"url\")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),ct(n,{validation:\"url\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"regex\"){if(i.regex.lastIndex=0,!i.regex.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"regex\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"trim\")t.data=t.data.trim();else if(i.kind===\"includes\"){if(!t.data.includes(i.value,i.position))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()}else if(i.kind===\"toLowerCase\")t.data=t.data.toLowerCase();else if(i.kind===\"toUpperCase\")t.data=t.data.toUpperCase();else if(i.kind===\"startsWith\"){if(!t.data.startsWith(i.value))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()}else if(i.kind===\"endsWith\"){if(!t.data.endsWith(i.value))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()}else if(i.kind===\"datetime\"){if(!L5(i).test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:\"datetime\",message:i.message}),r.dirty()}else if(i.kind===\"date\"){if(!N5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:\"date\",message:i.message}),r.dirty()}else if(i.kind===\"time\"){if(!Y5(i).test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:\"time\",message:i.message}),r.dirty()}else if(i.kind===\"duration\"){if(!w5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"duration\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"ip\"){if(!T5(t.data,i.version))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"ip\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"jwt\"){if(!E5(t.data,i.alg))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"jwt\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"cidr\"){if(!R5(t.data,i.version))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"cidr\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"base64\"){if(!C5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"base64\",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind===\"base64url\"){if(!k5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:\"base64url\",code:X.invalid_string,message:i.message}),r.dirty()}else kt.assertNever(i);return{status:r.value,value:t.data}}_regex(t,e,r){return this.refinement((n)=\u003et.test(n),{validation:e,code:X.invalid_string,...dt.errToObj(r)})}_addCheck(t){return new je({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:\"email\",...dt.errToObj(t)})}url(t){return this._addCheck({kind:\"url\",...dt.errToObj(t)})}emoji(t){return this._addCheck({kind:\"emoji\",...dt.errToObj(t)})}uuid(t){return this._addCheck({kind:\"uuid\",...dt.errToObj(t)})}nanoid(t){return this._addCheck({kind:\"nanoid\",...dt.errToObj(t)})}cuid(t){return this._addCheck({kind:\"cuid\",...dt.errToObj(t)})}cuid2(t){return this._addCheck({kind:\"cuid2\",...dt.errToObj(t)})}ulid(t){return this._addCheck({kind:\"ulid\",...dt.errToObj(t)})}base64(t){return this._addCheck({kind:\"base64\",...dt.errToObj(t)})}base64url(t){return this._addCheck({kind:\"base64url\",...dt.errToObj(t)})}jwt(t){return this._addCheck({kind:\"jwt\",...dt.errToObj(t)})}ip(t){return this._addCheck({kind:\"ip\",...dt.errToObj(t)})}cidr(t){return this._addCheck({kind:\"cidr\",...dt.errToObj(t)})}datetime(t){if(typeof t===\"string\")return this._addCheck({kind:\"datetime\",precision:null,offset:!1,local:!1,message:t});return this._addCheck({kind:\"datetime\",precision:typeof t?.precision\u003e\"u\"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...dt.errToObj(t?.message)})}date(t){return this._addCheck({kind:\"date\",message:t})}time(t){if(typeof t===\"string\")return this._addCheck({kind:\"time\",precision:null,message:t});return this._addCheck({kind:\"time\",precision:typeof t?.precision\u003e\"u\"?null:t?.precision,...dt.errToObj(t?.message)})}duration(t){return this._addCheck({kind:\"duration\",...dt.errToObj(t)})}regex(t,e){return this._addCheck({kind:\"regex\",regex:t,...dt.errToObj(e)})}includes(t,e){return this._addCheck({kind:\"includes\",value:t,position:e?.position,...dt.errToObj(e?.message)})}startsWith(t,e){return this._addCheck({kind:\"startsWith\",value:t,...dt.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:\"endsWith\",value:t,...dt.errToObj(e)})}min(t,e){return this._addCheck({kind:\"min\",value:t,...dt.errToObj(e)})}max(t,e){return this._addCheck({kind:\"max\",value:t,...dt.errToObj(e)})}length(t,e){return this._addCheck({kind:\"length\",value:t,...dt.errToObj(e)})}nonempty(t){return this.min(1,dt.errToObj(t))}trim(){return new je({...this._def,checks:[...this._def.checks,{kind:\"trim\"}]})}toLowerCase(){return new je({...this._def,checks:[...this._def.checks,{kind:\"toLowerCase\"}]})}toUpperCase(){return new je({...this._def,checks:[...this._def.checks,{kind:\"toUpperCase\"}]})}get isDatetime(){return!!this._def.checks.find((t)=\u003et.kind===\"datetime\")}get isDate(){return!!this._def.checks.find((t)=\u003et.kind===\"date\")}get isTime(){return!!this._def.checks.find((t)=\u003et.kind===\"time\")}get isDuration(){return!!this._def.checks.find((t)=\u003et.kind===\"duration\")}get isEmail(){return!!this._def.checks.find((t)=\u003et.kind===\"email\")}get isURL(){return!!this._def.checks.find((t)=\u003et.kind===\"url\")}get isEmoji(){return!!this._def.checks.find((t)=\u003et.kind===\"emoji\")}get isUUID(){return!!this._def.checks.find((t)=\u003et.kind===\"uuid\")}get isNANOID(){return!!this._def.checks.find((t)=\u003et.kind===\"nanoid\")}get isCUID(){return!!this._def.checks.find((t)=\u003et.kind===\"cuid\")}get isCUID2(){return!!this._def.checks.find((t)=\u003et.kind===\"cuid2\")}get isULID(){return!!this._def.checks.find((t)=\u003et.kind===\"ulid\")}get isIP(){return!!this._def.checks.find((t)=\u003et.kind===\"ip\")}get isCIDR(){return!!this._def.checks.find((t)=\u003et.kind===\"cidr\")}get isBase64(){return!!this._def.checks.find((t)=\u003et.kind===\"base64\")}get isBase64url(){return!!this._def.checks.find((t)=\u003et.kind===\"base64url\")}get minLength(){let t=null;for(let e of this._def.checks)if(e.kind===\"min\"){if(t===null||e.value\u003et)t=e.value}return t}get maxLength(){let t=null;for(let e of this._def.checks)if(e.kind===\"max\"){if(t===null||e.value\u003ct)t=e.value}return t}}je.create=(t)=\u003enew je({checks:[],typeName:wt.ZodString,coerce:t?.coerce??!1,...It(t)});function O5(t,e){let r=(t.toString().split(\".\")[1]||\"\").length,n=(e.toString().split(\".\")[1]||\"\").length,i=r\u003en?r:n,s=Number.parseInt(t.toFixed(i).replace(\".\",\"\")),o=Number.parseInt(e.toFixed(i).replace(\".\",\"\"));return s%o/10**i}class Vn extends Ft{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce)t.data=Number(t.data);if(this._getType(t)!==pt.number){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_type,expected:pt.number,received:i.parsedType}),vt}let r=void 0,n=new ee;for(let i of this._def.checks)if(i.kind===\"int\"){if(!kt.isInteger(t.data))r=this._getOrReturnCtx(t,r),ct(r,{code:X.invalid_type,expected:\"integer\",received:\"float\",message:i.message}),n.dirty()}else if(i.kind===\"min\"){if(i.inclusive?t.data\u003ci.value:t.data\u003c=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_small,minimum:i.value,type:\"number\",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind===\"max\"){if(i.inclusive?t.data\u003ei.value:t.data\u003e=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_big,maximum:i.value,type:\"number\",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind===\"multipleOf\"){if(O5(t.data,i.value)!==0)r=this._getOrReturnCtx(t,r),ct(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else if(i.kind===\"finite\"){if(!Number.isFinite(t.data))r=this._getOrReturnCtx(t,r),ct(r,{code:X.not_finite,message:i.message}),n.dirty()}else kt.assertNever(i);return{status:n.value,value:t.data}}gte(t,e){return this.setLimit(\"min\",t,!0,dt.toString(e))}gt(t,e){return this.setLimit(\"min\",t,!1,dt.toString(e))}lte(t,e){return this.setLimit(\"max\",t,!0,dt.toString(e))}lt(t,e){return this.setLimit(\"max\",t,!1,dt.toString(e))}setLimit(t,e,r,n){return new Vn({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:dt.toString(n)}]})}_addCheck(t){return new Vn({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:\"int\",message:dt.toString(t)})}positive(t){return this._addCheck({kind:\"min\",value:0,inclusive:!1,message:dt.toString(t)})}negative(t){return this._addCheck({kind:\"max\",value:0,inclusive:!1,message:dt.toString(t)})}nonpositive(t){return this._addCheck({kind:\"max\",value:0,inclusive:!0,message:dt.toString(t)})}nonnegative(t){return this._addCheck({kind:\"min\",value:0,inclusive:!0,message:dt.toString(t)})}multipleOf(t,e){return this._addCheck({kind:\"multipleOf\",value:t,message:dt.toString(e)})}finite(t){return this._addCheck({kind:\"finite\",message:dt.toString(t)})}safe(t){return this._addCheck({kind:\"min\",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:dt.toString(t)})._addCheck({kind:\"max\",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:dt.toString(t)})}get minValue(){let t=null;for(let e of this._def.checks)if(e.kind===\"min\"){if(t===null||e.value\u003et)t=e.value}return t}get maxValue(){let t=null;for(let e of this._def.checks)if(e.kind===\"max\"){if(t===null||e.value\u003ct)t=e.value}return t}get isInt(){return!!this._def.checks.find((t)=\u003et.kind===\"int\"||t.kind===\"multipleOf\"\u0026\u0026kt.isInteger(t.value))}get isFinite(){let t=null,e=null;for(let r of this._def.checks)if(r.kind===\"finite\"||r.kind===\"int\"||r.kind===\"multipleOf\")return!0;else if(r.kind===\"min\"){if(e===null||r.value\u003ee)e=r.value}else if(r.kind===\"max\"){if(t===null||r.value\u003ct)t=r.value}return Number.isFinite(e)\u0026\u0026Number.isFinite(t)}}Vn.create=(t)=\u003enew Vn({checks:[],typeName:wt.ZodNumber,coerce:t?.coerce||!1,...It(t)});class zn extends Ft{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==pt.bigint)return this._getInvalidInput(t);let r=void 0,n=new ee;for(let i of this._def.checks)if(i.kind===\"min\"){if(i.inclusive?t.data\u003ci.value:t.data\u003c=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_small,type:\"bigint\",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind===\"max\"){if(i.inclusive?t.data\u003ei.value:t.data\u003e=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_big,type:\"bigint\",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind===\"multipleOf\"){if(t.data%i.value!==BigInt(0))r=this._getOrReturnCtx(t,r),ct(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else kt.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let e=this._getOrReturnCtx(t);return ct(e,{code:X.invalid_type,expected:pt.bigint,received:e.parsedType}),vt}gte(t,e){return this.setLimit(\"min\",t,!0,dt.toString(e))}gt(t,e){return this.setLimit(\"min\",t,!1,dt.toString(e))}lte(t,e){return this.setLimit(\"max\",t,!0,dt.toString(e))}lt(t,e){return this.setLimit(\"max\",t,!1,dt.toString(e))}setLimit(t,e,r,n){return new zn({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:dt.toString(n)}]})}_addCheck(t){return new zn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!1,message:dt.toString(t)})}negative(t){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!1,message:dt.toString(t)})}nonpositive(t){return this._addCheck({kind:\"max\",value:BigInt(0),inclusive:!0,message:dt.toString(t)})}nonnegative(t){return this._addCheck({kind:\"min\",value:BigInt(0),inclusive:!0,message:dt.toString(t)})}multipleOf(t,e){return this._addCheck({kind:\"multipleOf\",value:t,message:dt.toString(e)})}get minValue(){let t=null;for(let e of this._def.checks)if(e.kind===\"min\"){if(t===null||e.value\u003et)t=e.value}return t}get maxValue(){let t=null;for(let e of this._def.checks)if(e.kind===\"max\"){if(t===null||e.value\u003ct)t=e.value}return t}}zn.create=(t)=\u003enew zn({checks:[],typeName:wt.ZodBigInt,coerce:t?.coerce??!1,...It(t)});class ms extends Ft{_parse(t){if(this._def.coerce)t.data=Boolean(t.data);if(this._getType(t)!==pt.boolean){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.boolean,received:r.parsedType}),vt}return ne(t.data)}}ms.create=(t)=\u003enew ms({typeName:wt.ZodBoolean,coerce:t?.coerce||!1,...It(t)});class to extends Ft{_parse(t){if(this._def.coerce)t.data=new Date(t.data);if(this._getType(t)!==pt.date){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_type,expected:pt.date,received:i.parsedType}),vt}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_date}),vt}let r=new ee,n=void 0;for(let i of this._def.checks)if(i.kind===\"min\"){if(t.data.getTime()\u003ci.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:\"date\"}),r.dirty()}else if(i.kind===\"max\"){if(t.data.getTime()\u003ei.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:\"date\"}),r.dirty()}else kt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new to({...this._def,checks:[...this._def.checks,t]})}min(t,e){return this._addCheck({kind:\"min\",value:t.getTime(),message:dt.toString(e)})}max(t,e){return this._addCheck({kind:\"max\",value:t.getTime(),message:dt.toString(e)})}get minDate(){let t=null;for(let e of this._def.checks)if(e.kind===\"min\"){if(t===null||e.value\u003et)t=e.value}return t!=null?new Date(t):null}get maxDate(){let t=null;for(let e of this._def.checks)if(e.kind===\"max\"){if(t===null||e.value\u003ct)t=e.value}return t!=null?new Date(t):null}}to.create=(t)=\u003enew to({checks:[],coerce:t?.coerce||!1,typeName:wt.ZodDate,...It(t)});class us extends Ft{_parse(t){if(this._getType(t)!==pt.symbol){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.symbol,received:r.parsedType}),vt}return ne(t.data)}}us.create=(t)=\u003enew us({typeName:wt.ZodSymbol,...It(t)});class eo extends Ft{_parse(t){if(this._getType(t)!==pt.undefined){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.undefined,received:r.parsedType}),vt}return ne(t.data)}}eo.create=(t)=\u003enew eo({typeName:wt.ZodUndefined,...It(t)});class ro extends Ft{_parse(t){if(this._getType(t)!==pt.null){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.null,received:r.parsedType}),vt}return ne(t.data)}}ro.create=(t)=\u003enew ro({typeName:wt.ZodNull,...It(t)});class Un extends Ft{constructor(){super(...arguments);this._any=!0}_parse(t){return ne(t.data)}}Un.create=(t)=\u003enew Un({typeName:wt.ZodAny,...It(t)});class Fr extends Ft{constructor(){super(...arguments);this._unknown=!0}_parse(t){return ne(t.data)}}Fr.create=(t)=\u003enew Fr({typeName:wt.ZodUnknown,...It(t)});class Xe extends Ft{_parse(t){let e=this._getOrReturnCtx(t);return ct(e,{code:X.invalid_type,expected:pt.never,received:e.parsedType}),vt}}Xe.create=(t)=\u003enew Xe({typeName:wt.ZodNever,...It(t)});class fs extends Ft{_parse(t){if(this._getType(t)!==pt.undefined){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.void,received:r.parsedType}),vt}return ne(t.data)}}fs.create=(t)=\u003enew fs({typeName:wt.ZodVoid,...It(t)});class Pe extends Ft{_parse(t){let{ctx:e,status:r}=this._processInputParams(t),n=this._def;if(e.parsedType!==pt.array)return ct(e,{code:X.invalid_type,expected:pt.array,received:e.parsedType}),vt;if(n.exactLength!==null){let s=e.data.length\u003en.exactLength.value,o=e.data.length\u003cn.exactLength.value;if(s||o)ct(e,{code:s?X.too_big:X.too_small,minimum:o?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:\"array\",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(e.data.length\u003cn.minLength.value)ct(e,{code:X.too_small,minimum:n.minLength.value,type:\"array\",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(e.data.length\u003en.maxLength.value)ct(e,{code:X.too_big,maximum:n.maxLength.value,type:\"array\",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(e.common.async)return Promise.all([...e.data].map((s,o)=\u003en.type._parseAsync(new ve(e,s,e.path,o)))).then((s)=\u003eee.mergeArray(r,s));let i=[...e.data].map((s,o)=\u003en.type._parseSync(new ve(e,s,e.path,o)));return ee.mergeArray(r,i)}get element(){return this._def.type}min(t,e){return new Pe({...this._def,minLength:{value:t,message:dt.toString(e)}})}max(t,e){return new Pe({...this._def,maxLength:{value:t,message:dt.toString(e)}})}length(t,e){return new Pe({...this._def,exactLength:{value:t,message:dt.toString(e)}})}nonempty(t){return this.min(1,t)}}Pe.create=(t,e)=\u003enew Pe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:wt.ZodArray,...It(e)});function Dn(t){if(t instanceof Vt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Be.create(Dn(n))}return new Vt({...t._def,shape:()=\u003ee})}else if(t instanceof Pe)return new Pe({...t._def,type:Dn(t.element)});else if(t instanceof Be)return Be.create(Dn(t.unwrap()));else if(t instanceof lr)return lr.create(Dn(t.unwrap()));else if(t instanceof De)return De.create(t.items.map((e)=\u003eDn(e)));else return t}class Vt extends Ft{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),e=kt.objectKeys(t);return this._cached={shape:t,keys:e},this._cached}_parse(t){if(this._getType(t)!==pt.object){let l=this._getOrReturnCtx(t);return ct(l,{code:X.invalid_type,expected:pt.object,received:l.parsedType}),vt}let{status:r,ctx:n}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Xe\u0026\u0026this._def.unknownKeys===\"strip\")){for(let l in n.data)if(!s.includes(l))o.push(l)}let c=[];for(let l of s){let a=i[l],p=n.data[l];c.push({key:{status:\"valid\",value:l},value:a._parse(new ve(n,p,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Xe){let l=this._def.unknownKeys;if(l===\"passthrough\")for(let a of o)c.push({key:{status:\"valid\",value:a},value:{status:\"valid\",value:n.data[a]}});else if(l===\"strict\"){if(o.length\u003e0)ct(n,{code:X.unrecognized_keys,keys:o}),r.dirty()}else if(l===\"strip\");else throw Error(\"Internal ZodObject error: invalid unknownKeys value.\")}else{let l=this._def.catchall;for(let a of o){let p=n.data[a];c.push({key:{status:\"valid\",value:a},value:l._parse(new ve(n,p,n.path,a)),alwaysSet:a in n.data})}}if(n.common.async)return Promise.resolve().then(async()=\u003e{let l=[];for(let a of c){let p=await a.key,d=await a.value;l.push({key:p,value:d,alwaysSet:a.alwaysSet})}return l}).then((l)=\u003eee.mergeObjectSync(r,l));else return ee.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return dt.errToObj,new Vt({...this._def,unknownKeys:\"strict\",...t!==void 0?{errorMap:(e,r)=\u003e{let n=this._def.errorMap?.(e,r).message??r.defaultError;if(e.code===\"unrecognized_keys\")return{message:dt.errToObj(t).message??n};return{message:n}}}:{}})}strip(){return new Vt({...this._def,unknownKeys:\"strip\"})}passthrough(){return new Vt({...this._def,unknownKeys:\"passthrough\"})}extend(t){return new Vt({...this._def,shape:()=\u003e({...this._def.shape(),...t})})}merge(t){return new Vt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=\u003e({...this._def.shape(),...t._def.shape()}),typeName:wt.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new Vt({...this._def,catchall:t})}pick(t){let e={};for(let r of kt.objectKeys(t))if(t[r]\u0026\u0026this.shape[r])e[r]=this.shape[r];return new Vt({...this._def,shape:()=\u003ee})}omit(t){let e={};for(let r of kt.objectKeys(this.shape))if(!t[r])e[r]=this.shape[r];return new Vt({...this._def,shape:()=\u003ee})}deepPartial(){return Dn(this)}partial(t){let e={};for(let r of kt.objectKeys(this.shape)){let n=this.shape[r];if(t\u0026\u0026!t[r])e[r]=n;else e[r]=n.optional()}return new Vt({...this._def,shape:()=\u003ee})}required(t){let e={};for(let r of kt.objectKeys(this.shape))if(t\u0026\u0026!t[r])e[r]=this.shape[r];else{let i=this.shape[r];while(i instanceof Be)i=i._def.innerType;e[r]=i}return new Vt({...this._def,shape:()=\u003ee})}keyof(){return Zy(kt.objectKeys(this.shape))}}Vt.create=(t,e)=\u003enew Vt({shape:()=\u003et,unknownKeys:\"strip\",catchall:Xe.create(),typeName:wt.ZodObject,...It(e)});Vt.strictCreate=(t,e)=\u003enew Vt({shape:()=\u003et,unknownKeys:\"strict\",catchall:Xe.create(),typeName:wt.ZodObject,...It(e)});Vt.lazycreate=(t,e)=\u003enew Vt({shape:t,unknownKeys:\"strip\",catchall:Xe.create(),typeName:wt.ZodObject,...It(e)});class no extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function n(i){for(let o of i)if(o.result.status===\"valid\")return o.result;for(let o of i)if(o.result.status===\"dirty\")return e.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map((o)=\u003enew pe(o.ctx.common.issues));return ct(e,{code:X.invalid_union,unionErrors:s}),vt}if(e.common.async)return Promise.all(r.map(async(i)=\u003e{let s={...e,common:{...e.common,issues:[]},parent:null};return{result:await i._parseAsync({data:e.data,path:e.path,parent:s}),ctx:s}})).then(n);else{let i=void 0,s=[];for(let c of r){let l={...e,common:{...e.common,issues:[]},parent:null},a=c._parseSync({data:e.data,path:e.path,parent:l});if(a.status===\"valid\")return a;else if(a.status===\"dirty\"\u0026\u0026!i)i={result:a,ctx:l};if(l.common.issues.length)s.push(l.common.issues)}if(i)return e.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map((c)=\u003enew pe(c));return ct(e,{code:X.invalid_union,unionErrors:o}),vt}}get options(){return this._def.options}}no.create=(t,e)=\u003enew no({options:t,typeName:wt.ZodUnion,...It(e)});var $e=(t)=\u003e{if(t instanceof oo)return $e(t.schema);else if(t instanceof Ie)return $e(t.innerType());else if(t instanceof so)return[t.value];else if(t instanceof Mr)return t.options;else if(t instanceof ao)return kt.objectValues(t.enum);else if(t instanceof co)return $e(t._def.innerType);else if(t instanceof eo)return[void 0];else if(t instanceof ro)return[null];else if(t instanceof Be)return[void 0,...$e(t.unwrap())];else if(t instanceof lr)return[null,...$e(t.unwrap())];else if(t instanceof ap)return $e(t.unwrap());else if(t instanceof po)return $e(t.unwrap());else if(t instanceof lo)return $e(t._def.innerType);else return[]};class sp extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==pt.object)return ct(e,{code:X.invalid_type,expected:pt.object,received:e.parsedType}),vt;let r=this.discriminator,n=e.data[r],i=this.optionsMap.get(n);if(!i)return ct(e,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),vt;if(e.common.async)return i._parseAsync({data:e.data,path:e.path,parent:e});else return i._parseSync({data:e.data,path:e.path,parent:e})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,e,r){let n=new Map;for(let i of e){let s=$e(i.shape[t]);if(!s.length)throw Error(`A discriminator value for key \\`${t}\\` could not be extracted from all schema options`);for(let o of s){if(n.has(o))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);n.set(o,i)}}return new sp({typeName:wt.ZodDiscriminatedUnion,discriminator:t,options:e,optionsMap:n,...It(r)})}}function op(t,e){let r=We(t),n=We(e);if(t===e)return{valid:!0,data:t};else if(r===pt.object\u0026\u0026n===pt.object){let i=kt.objectKeys(e),s=kt.objectKeys(t).filter((c)=\u003ei.indexOf(c)!==-1),o={...t,...e};for(let c of s){let l=op(t[c],e[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(r===pt.array\u0026\u0026n===pt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s\u003ct.length;s++){let o=t[s],c=e[s],l=op(o,c);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else if(r===pt.date\u0026\u0026n===pt.date\u0026\u0026+t===+e)return{valid:!0,data:t};else return{valid:!1}}class io extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=(i,s)=\u003e{if(rp(i)||rp(s))return vt;let o=op(i.value,s.value);if(!o.valid)return ct(r,{code:X.invalid_intersection_types}),vt;if(np(i)||np(s))e.dirty();return{status:e.value,value:o.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=\u003en(i,s));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}io.create=(t,e,r)=\u003enew io({left:t,right:e,typeName:wt.ZodIntersection,...It(r)});class De extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.array)return ct(r,{code:X.invalid_type,expected:pt.array,received:r.parsedType}),vt;if(r.data.length\u003cthis._def.items.length)return ct(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),vt;if(!this._def.rest\u0026\u0026r.data.length\u003ethis._def.items.length)ct(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:\"array\"}),e.dirty();let i=[...r.data].map((s,o)=\u003e{let c=this._def.items[o]||this._def.rest;if(!c)return null;return c._parse(new ve(r,s,r.path,o))}).filter((s)=\u003e!!s);if(r.common.async)return Promise.all(i).then((s)=\u003eee.mergeArray(e,s));else return ee.mergeArray(e,i)}get items(){return this._def.items}rest(t){return new De({...this._def,rest:t})}}De.create=(t,e)=\u003e{if(!Array.isArray(t))throw Error(\"You must pass an array of schemas to z.tuple([ ... ])\");return new De({items:t,typeName:wt.ZodTuple,rest:null,...It(e)})};class ys extends Ft{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.object)return ct(r,{code:X.invalid_type,expected:pt.object,received:r.parsedType}),vt;let n=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)n.push({key:i._parse(new ve(r,o,r.path,o)),value:s._parse(new ve(r,r.data[o],r.path,o)),alwaysSet:o in r.data});if(r.common.async)return ee.mergeObjectAsync(e,n);else return ee.mergeObjectSync(e,n)}get element(){return this._def.valueType}static create(t,e,r){if(e instanceof Ft)return new ys({keyType:t,valueType:e,typeName:wt.ZodRecord,...It(r)});return new ys({keyType:je.create(),valueType:t,typeName:wt.ZodRecord,...It(e)})}}class _s extends Ft{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.map)return ct(r,{code:X.invalid_type,expected:pt.map,received:r.parsedType}),vt;let n=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,c],l)=\u003e({key:n._parse(new ve(r,o,r.path,[l,\"key\"])),value:i._parse(new ve(r,c,r.path,[l,\"value\"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=\u003e{for(let c of s){let l=await c.key,a=await c.value;if(l.status===\"aborted\"||a.status===\"aborted\")return vt;if(l.status===\"dirty\"||a.status===\"dirty\")e.dirty();o.set(l.value,a.value)}return{status:e.value,value:o}})}else{let o=new Map;for(let c of s){let{key:l,value:a}=c;if(l.status===\"aborted\"||a.status===\"aborted\")return vt;if(l.status===\"dirty\"||a.status===\"dirty\")e.dirty();o.set(l.value,a.value)}return{status:e.value,value:o}}}}_s.create=(t,e,r)=\u003enew _s({valueType:e,keyType:t,typeName:wt.ZodMap,...It(r)});class Gn extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.set)return ct(r,{code:X.invalid_type,expected:pt.set,received:r.parsedType}),vt;let n=this._def;if(n.minSize!==null){if(r.data.size\u003cn.minSize.value)ct(r,{code:X.too_small,minimum:n.minSize.value,type:\"set\",inclusive:!0,exact:!1,message:n.minSize.message}),e.dirty()}if(n.maxSize!==null){if(r.data.size\u003en.maxSize.value)ct(r,{code:X.too_big,maximum:n.maxSize.value,type:\"set\",inclusive:!0,exact:!1,message:n.maxSize.message}),e.dirty()}let i=this._def.valueType;function s(c){let l=new Set;for(let a of c){if(a.status===\"aborted\")return vt;if(a.status===\"dirty\")e.dirty();l.add(a.value)}return{status:e.value,value:l}}let o=[...r.data.values()].map((c,l)=\u003ei._parse(new ve(r,c,r.path,l)));if(r.common.async)return Promise.all(o).then((c)=\u003es(c));else return s(o)}min(t,e){return new Gn({...this._def,minSize:{value:t,message:dt.toString(e)}})}max(t,e){return new Gn({...this._def,maxSize:{value:t,message:dt.toString(e)}})}size(t,e){return this.min(t,e).max(t,e)}nonempty(t){return this.min(1,t)}}Gn.create=(t,e)=\u003enew Gn({valueType:t,minSize:null,maxSize:null,typeName:wt.ZodSet,...It(e)});class Ki extends Ft{constructor(){super(...arguments);this.validate=this.implement}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==pt.function)return ct(e,{code:X.invalid_type,expected:pt.function,received:e.parsedType}),vt;function r(o,c){return ds({data:o,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,qi(),cr].filter((l)=\u003e!!l),issueData:{code:X.invalid_arguments,argumentsError:c}})}function n(o,c){return ds({data:o,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,qi(),cr].filter((l)=\u003e!!l),issueData:{code:X.invalid_return_type,returnTypeError:c}})}let i={errorMap:e.common.contextualErrorMap},s=e.data;if(this._def.returns instanceof Hn){let o=this;return ne(async function(...c){let l=new pe([]),a=await o._def.args.parseAsync(c,i).catch((m)=\u003e{throw l.addIssue(r(c,m)),l}),p=await Reflect.apply(s,this,a);return await o._def.returns._def.type.parseAsync(p,i).catch((m)=\u003e{throw l.addIssue(n(p,m)),l})})}else{let o=this;return ne(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new pe([r(c,l.error)]);let a=Reflect.apply(s,this,l.data),p=o._def.returns.safeParse(a,i);if(!p.success)throw new pe([n(a,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ki({...this._def,args:De.create(t).rest(Fr.create())})}returns(t){return new Ki({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,e,r){return new Ki({args:t?t:De.create([]).rest(Fr.create()),returns:e||Fr.create(),typeName:wt.ZodFunction,...It(r)})}}class oo extends Ft{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}}oo.create=(t,e)=\u003enew oo({getter:t,typeName:wt.ZodLazy,...It(e)});class so extends Ft{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return ct(e,{received:e.data,code:X.invalid_literal,expected:this._def.value}),vt}return{status:\"valid\",value:t.data}}get value(){return this._def.value}}so.create=(t,e)=\u003enew so({value:t,typeName:wt.ZodLiteral,...It(e)});function Zy(t,e){return new Mr({values:t,typeName:wt.ZodEnum,...It(e)})}class Mr extends Ft{_parse(t){if(typeof t.data!==\"string\"){let e=this._getOrReturnCtx(t),r=this._def.values;return ct(e,{expected:kt.joinValues(r),received:e.parsedType,code:X.invalid_type}),vt}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(t.data)){let e=this._getOrReturnCtx(t),r=this._def.values;return ct(e,{received:e.data,code:X.invalid_enum_value,options:r}),vt}return ne(t.data)}get options(){return this._def.values}get enum(){let t={};for(let e of this._def.values)t[e]=e;return t}get Values(){let t={};for(let e of this._def.values)t[e]=e;return t}get Enum(){let t={};for(let e of this._def.values)t[e]=e;return t}extract(t,e=this._def){return Mr.create(t,{...this._def,...e})}exclude(t,e=this._def){return Mr.create(this.options.filter((r)=\u003e!t.includes(r)),{...this._def,...e})}}Mr.create=Zy;class ao extends Ft{_parse(t){let e=kt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==pt.string\u0026\u0026r.parsedType!==pt.number){let n=kt.objectValues(e);return ct(r,{expected:kt.joinValues(n),received:r.parsedType,code:X.invalid_type}),vt}if(!this._cache)this._cache=new Set(kt.getValidEnumValues(this._def.values));if(!this._cache.has(t.data)){let n=kt.objectValues(e);return ct(r,{received:r.data,code:X.invalid_enum_value,options:n}),vt}return ne(t.data)}get enum(){return this._def.values}}ao.create=(t,e)=\u003enew ao({values:t,typeName:wt.ZodNativeEnum,...It(e)});class Hn extends Ft{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==pt.promise\u0026\u0026e.common.async===!1)return ct(e,{code:X.invalid_type,expected:pt.promise,received:e.parsedType}),vt;let r=e.parsedType===pt.promise?e.data:Promise.resolve(e.data);return ne(r.then((n)=\u003ethis._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}}Hn.create=(t,e)=\u003enew Hn({type:t,typeName:wt.ZodPromise,...It(e)});class Ie extends Ft{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:(s)=\u003e{if(ct(r,s),s.fatal)e.abort();else e.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type===\"preprocess\"){let s=n.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async(o)=\u003e{if(e.value===\"aborted\")return vt;let c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});if(c.status===\"aborted\")return vt;if(c.status===\"dirty\")return Xn(c.value);if(e.value===\"dirty\")return Xn(c.value);return c});else{if(e.value===\"aborted\")return vt;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});if(o.status===\"aborted\")return vt;if(o.status===\"dirty\")return Xn(o.value);if(e.value===\"dirty\")return Xn(o.value);return o}}if(n.type===\"refinement\"){let s=(o)=\u003e{let c=n.refinement(o,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(o.status===\"aborted\")return vt;if(o.status===\"dirty\")e.dirty();return s(o.value),{status:e.value,value:o.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=\u003e{if(o.status===\"aborted\")return vt;if(o.status===\"dirty\")e.dirty();return s(o.value).then(()=\u003e({status:e.value,value:o.value}))})}if(n.type===\"transform\")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ir(s))return vt;let o=n.transform(s.value,i);if(o instanceof Promise)throw Error(\"Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.\");return{status:e.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=\u003e{if(!Ir(s))return vt;return Promise.resolve(n.transform(s.value,i)).then((o)=\u003e({status:e.value,value:o}))});kt.assertNever(n)}}Ie.create=(t,e,r)=\u003enew Ie({schema:t,typeName:wt.ZodEffects,effect:e,...It(r)});Ie.createWithPreprocess=(t,e,r)=\u003enew Ie({schema:e,effect:{type:\"preprocess\",transform:t},typeName:wt.ZodEffects,...It(r)});class Be extends Ft{_parse(t){if(this._getType(t)===pt.undefined)return ne(void 0);return this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Be.create=(t,e)=\u003enew Be({innerType:t,typeName:wt.ZodOptional,...It(e)});class lr extends Ft{_parse(t){if(this._getType(t)===pt.null)return ne(null);return this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}lr.create=(t,e)=\u003enew lr({innerType:t,typeName:wt.ZodNullable,...It(e)});class co extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;if(e.parsedType===pt.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}}co.create=(t,e)=\u003enew co({innerType:t,typeName:wt.ZodDefault,defaultValue:typeof e.default===\"function\"?e.default:()=\u003ee.default,...It(e)});class lo extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Ji(n))return n.then((i)=\u003e({status:\"valid\",value:i.status===\"valid\"?i.value:this._def.catchValue({get error(){return new pe(r.common.issues)},input:r.data})}));else return{status:\"valid\",value:n.status===\"valid\"?n.value:this._def.catchValue({get error(){return new pe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}lo.create=(t,e)=\u003enew lo({innerType:t,typeName:wt.ZodCatch,catchValue:typeof e.catch===\"function\"?e.catch:()=\u003ee.catch,...It(e)});class gs extends Ft{_parse(t){if(this._getType(t)!==pt.nan){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.nan,received:r.parsedType}),vt}return{status:\"valid\",value:t.data}}}gs.create=(t)=\u003enew gs({typeName:wt.ZodNaN,...It(t)});var KU=Symbol(\"zod_brand\");class ap extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}}class xs extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=\u003e{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(i.status===\"aborted\")return vt;if(i.status===\"dirty\")return e.dirty(),Xn(i.value);else return this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status===\"aborted\")return vt;if(n.status===\"dirty\")return e.dirty(),{status:\"dirty\",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(t,e){return new xs({in:t,out:e,typeName:wt.ZodPipeline})}}class po extends Ft{_parse(t){let e=this._def.innerType._parse(t),r=(n)=\u003e{if(Ir(n))n.value=Object.freeze(n.value);return n};return Ji(e)?e.then((n)=\u003er(n)):r(e)}unwrap(){return this._def.innerType}}po.create=(t,e)=\u003enew po({innerType:t,typeName:wt.ZodReadonly,...It(e)});function Gy(t,e){let r=typeof t===\"function\"?t(e):typeof t===\"string\"?{message:t}:t;return typeof r===\"string\"?{message:r}:r}function qy(t,e={},r){if(t)return Un.create().superRefine((n,i)=\u003e{let s=t(n);if(s instanceof Promise)return s.then((o)=\u003e{if(!o){let c=Gy(e,n),l=c.fatal??r??!0;i.addIssue({code:\"custom\",...c,fatal:l})}});if(!s){let o=Gy(e,n),c=o.fatal??r??!0;i.addIssue({code:\"custom\",...o,fatal:c})}return});return Un.create()}var tG={object:Vt.lazycreate},wt;(function(t){t.ZodString=\"ZodString\",t.ZodNumber=\"ZodNumber\",t.ZodNaN=\"ZodNaN\",t.ZodBigInt=\"ZodBigInt\",t.ZodBoolean=\"ZodBoolean\",t.ZodDate=\"ZodDate\",t.ZodSymbol=\"ZodSymbol\",t.ZodUndefined=\"ZodUndefined\",t.ZodNull=\"ZodNull\",t.ZodAny=\"ZodAny\",t.ZodUnknown=\"ZodUnknown\",t.ZodNever=\"ZodNever\",t.ZodVoid=\"ZodVoid\",t.ZodArray=\"ZodArray\",t.ZodObject=\"ZodObject\",t.ZodUnion=\"ZodUnion\",t.ZodDiscriminatedUnion=\"ZodDiscriminatedUnion\",t.ZodIntersection=\"ZodIntersection\",t.ZodTuple=\"ZodTuple\",t.ZodRecord=\"ZodRecord\",t.ZodMap=\"ZodMap\",t.ZodSet=\"ZodSet\",t.ZodFunction=\"ZodFunction\",t.ZodLazy=\"ZodLazy\",t.ZodLiteral=\"ZodLiteral\",t.ZodEnum=\"ZodEnum\",t.ZodEffects=\"ZodEffects\",t.ZodNativeEnum=\"ZodNativeEnum\",t.ZodOptional=\"ZodOptional\",t.ZodNullable=\"ZodNullable\",t.ZodDefault=\"ZodDefault\",t.ZodCatch=\"ZodCatch\",t.ZodPromise=\"ZodPromise\",t.ZodBranded=\"ZodBranded\",t.ZodPipeline=\"ZodPipeline\",t.ZodReadonly=\"ZodReadonly\"})(wt||(wt={}));var h=je.create,w=Vn.create,eG=gs.create,rG=zn.create,E=ms.create,nG=to.create,iG=us.create,oG=eo.create,sG=ro.create,Jy=Un.create,Ky=Fr.create,ho=Xe.create,aG=fs.create,W=Pe.create,{create:M,strictCreate:cG}=Vt,Wt=no.create,ie=sp.create,lG=io.create,t_=De.create,Qn=ys.create,pG=_s.create,hG=Gn.create,dG=Ki.create,mG=oo.create,x=so.create,ut=Mr.create,uG=ao.create,fG=Hn.create,yG=Ie.create,_G=Be.create,gG=lr.create,xG=Ie.createWithPreprocess,bG=xs.create;var vs=h().or(w()).transform((t)=\u003ese(t,\"Ω\").value),_p=h().or(w()).transform((t)=\u003ese(t,\"F\").value).transform((t)=\u003eNumber.parseFloat(t.toPrecision(12))),d_=h().or(w()).transform((t)=\u003ese(t,\"H\").value),xe=h().or(w()).transform((t)=\u003ese(t,\"V\").value),K=h().or(w()).transform((t)=\u003ese(t).value),kr=h().or(w()).transform((t)=\u003ese(t,\"Hz\").value),R=K,hr=h().or(w()).transform((t)=\u003ese(t,\"A\").value),Jn=h().or(w()).transform((t)=\u003ese(t).value),W5=Jn,Qt=Jn,m_=h().datetime(),Et=h().or(w()).transform((t)=\u003e{if(typeof t===\"number\")return t;if(t.endsWith(\"deg\"))return Number.parseFloat(t.split(\"deg\")[0]);if(t.endsWith(\"rad\"))return Number.parseFloat(t.split(\"rad\")[0])*180/Math.PI;return Number.parseFloat(t)}),u_=w().or(h().endsWith(\"mAh\")).transform((t)=\u003e{if(typeof t===\"string\"){let e=t.replace(\"mAh\",\"\"),r=Number.parseFloat(e);if(Number.isNaN(r))throw Error(\"Invalid capacity\");return r}return t}).describe(\"Battery capacity in mAh\"),A=(t)=\u003e{};A(\"extra props b\");A(\"missing props b\");A(!0);A(\"mismatched prop types: a\");var Nr=(t)=\u003e{};Nr(!0);Nr('T1 has extra: \"c\", T2 has extra: \"d\"');Nr('T1 has extra: \"c\"');Nr('T2 has extra: \"c\"');Nr('T1 has extra: \"d\", T2 has extra: \"c\"');Nr(!0);var nt=M({x:R,y:R}),$5=nt;A(!0);A(!0);var ge=M({x:R,y:R,z:R}),j5=ge;A(!0);var Ss=M({width:w(),height:w()});A(!0);var qn=R.pipe(w().finite()),pp=R.pipe(w().finite().positive()),gp=M({shape:x(\"circle\"),x:qn,y:qn,radius:pp}).strict(),ws=M({shape:x(\"rect\"),x:qn,y:qn,width:pp,height:pp}).strict(),xp=ws.extend({shape:x(\"rotated_rect\"),ccw_rotation:Et.pipe(w().finite())}),yo=M({shape:x(\"polygon\"),points:W(nt.extend({x:qn,y:qn})).min(3).refine((t)=\u003e{let e=t.reduce((r,n,i)=\u003e{let s=t[(i+1)%t.length];return r+n.x*s.y-s.x*n.y},0);return Number.isFinite(e)\u0026\u0026e!==0},\"Polygon boundary must enclose a nonzero area\")}).strict();A(!0);A(!0);A(!0);A(!0);var X5=ie(\"shape\",[gp,ws,xp,yo]);A(!0);var D5=(t)=\u003eArray.from({length:t},()=\u003e\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"[Math.floor(Math.random()*62)]).join(\"\"),T=(t)=\u003eh().optional().default(()=\u003e`${t}_${D5(10)}`),Ve=ut([\"top_left\",\"top_center\",\"top_right\",\"center_left\",\"center\",\"center_right\",\"bottom_left\",\"bottom_center\",\"bottom_right\"]);A(!0);var V5=ut([\"top_silkscreen\",\"bottom_silkscreen\",\"top_copper\",\"bottom_copper\",\"top_soldermask\",\"bottom_soldermask\",\"top_fabrication_note\",\"bottom_fabrication_note\",\"top_user_note\",\"bottom_user_note\",\"top_courtyard\",\"bottom_courtyard\",\"inner1_copper\",\"inner2_copper\",\"inner3_copper\",\"inner4_copper\",\"inner5_copper\",\"inner6_copper\",\"inner7_copper\",\"inner8_copper\",\"edge_cuts\",\"drill\"]);A(!0);var _o=M({project_relative_path:h(),url:h(),mimetype:h()});A(!0);var As=nt.extend({rotation:Et.optional()});A(!0);var bp=M({size:nt.optional(),thickness:R.optional()});A(!0);var f_=M({font:bp.optional()});A(!0);var fo=M({value:h(),at:As.optional(),layer:h().optional(),uuid:h().optional(),hide:E().optional(),effects:f_.optional()});A(!0);var y_=M({Reference:fo.optional(),Value:fo.optional(),Datasheet:fo.optional(),Description:fo.optional()});A(!0);var __=M({through_hole:E().optional(),smd:E().optional(),exclude_from_pos_files:E().optional(),exclude_from_bom:E().optional()});A(!0);var g_=M({name:h(),type:h(),shape:h().optional(),at:As.optional(),size:nt.optional(),drill:R.optional(),layers:W(h()).optional(),removeUnusedLayers:E().optional(),uuid:h().optional()});A(!0);var x_=M({path:h(),offset:ge.optional(),scale:ge.optional(),rotate:ge.optional()});A(!0);var b_=M({footprintName:h().optional(),version:Wt([w(),h()]).optional(),generator:h().optional(),generatorVersion:Wt([w(),h()]).optional(),layer:h().optional(),properties:y_.optional(),attributes:__.optional(),pads:W(g_).optional(),embeddedFonts:E().optional(),model:x_.optional()});A(!0);var v_=M({hide:E().optional()});A(!0);var S_=M({offset:R.optional(),hide:E().optional()});A(!0);var w_=M({font:bp.optional(),justify:Wt([h(),W(h())]).optional(),hide:E().optional()});A(!0);var pr=M({value:h(),id:Wt([w(),h()]).optional(),at:As.optional(),effects:w_.optional()});A(!0);var A_=M({Reference:pr.optional(),Value:pr.optional(),Footprint:pr.optional(),Datasheet:pr.optional(),Description:pr.optional(),ki_keywords:pr.optional(),ki_fp_filters:pr.optional()});A(!0);var P_=M({symbolName:h().optional(),extends:h().optional(),pinNumbers:v_.optional(),pinNames:S_.optional(),excludeFromSim:E().optional(),inBom:E().optional(),onBoard:E().optional(),properties:A_.optional(),embeddedFonts:E().optional()});A(!0);var Mt=M({error_type:h(),message:h(),is_fatal:E().optional()});A(!0);var Kn=ut([\"jlcpcb\",\"macrofab\",\"pcbway\",\"digikey\",\"mouser\",\"lcsc\"]);A(!0);var Tt=M({type:x(\"source_component\"),ftype:h().optional(),source_component_id:h(),name:h(),manufacturer_part_number:h().optional(),supplier_part_numbers:Qn(Kn,W(h())).optional(),display_value:h().optional(),display_name:h().optional(),are_pins_interchangeable:E().optional(),internally_connected_source_port_ids:W(W(h())).optional(),source_group_id:h().optional(),subcircuit_id:h().optional()});A(!0);var vp=Tt.extend({ftype:x(\"simple_capacitor\"),capacitance:_p,max_voltage_rating:xe.optional(),display_capacitance:h().optional(),max_decoupling_trace_length:R.optional()});A(!0);var Sp=Tt.extend({ftype:x(\"simple_resistor\"),resistance:vs,display_resistance:h().optional()});A(!0);var Ps=Tt.extend({ftype:x(\"simple_diode\")});A(!0);var B_=Tt.extend({ftype:x(\"simple_fiducial\")});A(!0);var wp=Ps.extend({ftype:x(\"simple_led\"),color:h().optional(),wavelength:h().optional()});A(!0);var I_=Tt.extend({ftype:x(\"simple_ground\")});A(!0);var Ap=Tt.extend({ftype:x(\"simple_chip\")});A(!0);var F_=Tt.extend({ftype:x(\"printedpart\"),material:ut([\"pla\",\"petg\",\"nylon\"]).optional(),color:h().trim().min(1).optional()});A(!0);var M_=Tt.extend({ftype:x(\"subassembly\")});A(!0);var C_=Tt.extend({ftype:x(\"motor\")});A(!0);var Pp=Tt.extend({ftype:x(\"simple_power_source\"),voltage:xe});A(!0);var k_=Tt.extend({ftype:x(\"simple_current_source\"),current:hr,frequency:kr.optional(),peak_to_peak_current:hr.optional(),wave_shape:ut([\"sine\",\"square\",\"triangle\",\"sawtooth\",\"dc\"]).optional().default(\"dc\"),phase:w().optional(),duty_cycle:w().min(0).max(1).optional()});A(!0);var N_=Tt.extend({ftype:x(\"simple_fuse\"),current_rating_amps:w().describe(\"Nominal current in amps the fuse is rated for\"),voltage_rating_volts:w().describe(\"Voltage rating in volts, e.g. ±5V would be 5\")});A(!0);var Y_=Tt.extend({ftype:x(\"simple_ammeter\")});A(!0);var e_=Wt([w(),h().trim().regex(/^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?\\s*(?:[fpnumkKMGTµμ]?V?|V)?$/,\"Expected a scalar voltage, optionally with SI units\")]).pipe(xe).pipe(w().finite()),L_=M({is_input:E().optional(),is_output:E().optional(),is_bidirectional:E().optional(),is_passive:E().optional(),can_use_tri_state:E().optional(),is_using_tri_state:E().optional(),can_use_open_collector:E().optional(),is_using_open_collector:E().optional(),can_use_open_emitter:E().optional(),is_using_open_emitter:E().optional(),is_gpio:E().optional(),highlight_color:h().optional(),must_be_connected:E().optional(),provides_power:E().optional(),requires_power:E().optional(),provides_ground:E().optional(),requires_ground:E().optional(),provides_voltage:e_.optional(),requires_voltage:e_.optional(),required_voltage_tolerance:w().finite().min(0).max(1).optional(),do_not_connect:E().optional(),include_in_board_pinout:E().optional(),can_use_internal_pullup:E().optional(),is_using_internal_pullup:E().optional(),needs_external_pullup:E().optional(),can_use_internal_pulldown:E().optional(),is_using_internal_pulldown:E().optional(),needs_external_pulldown:E().optional(),can_use_open_drain:E().optional(),is_using_open_drain:E().optional(),can_use_push_pull:E().optional(),is_using_push_pull:E().optional(),should_have_decoupling_capacitor:E().optional(),recommended_decoupling_capacitor_capacitance:Wt([h(),w()]).optional(),is_configured_for_i2c_sda:E().optional(),is_configured_for_i2c_scl:E().optional(),is_configured_for_spi_mosi:E().optional(),is_configured_for_spi_miso:E().optional(),is_configured_for_spi_sck:E().optional(),is_configured_for_spi_cs:E().optional(),is_configured_for_uart_tx:E().optional(),is_configured_for_uart_rx:E().optional(),supports_i2c_sda:E().optional(),supports_i2c_scl:E().optional(),supports_spi_mosi:E().optional(),supports_spi_miso:E().optional(),supports_spi_sck:E().optional(),supports_spi_cs:E().optional(),supports_uart_tx:E().optional(),supports_uart_rx:E().optional()});A(!0);var Bp=Tt.extend({ftype:x(\"simple_battery\"),capacity:u_});A(!0);var Ip=Tt.extend({ftype:x(\"simple_inductor\"),inductance:d_,display_inductance:h().optional(),max_current_rating:w().optional()});A(!0);var Fp=Tt.extend({ftype:x(\"simple_push_button\")});A(!0);var Mp=Tt.extend({ftype:x(\"simple_potentiometer\"),max_resistance:vs,display_max_resistance:h().optional()});A(!0);var T_=Tt.extend({ftype:x(\"simple_crystal\"),frequency:w().describe(\"Frequency in Hz\"),load_capacitance:w().optional().describe(\"Load capacitance in pF\"),pin_variant:ut([\"two_pin\",\"four_pin\"]).optional()});A(!0);var Cp=Tt.extend({ftype:x(\"simple_pin_header\"),pin_count:w(),gender:ut([\"male\",\"female\"]).optional().default(\"male\")});A(!0);var E_=[\"usb_c\",\"m2\",\"jst_sh\",\"jst_gh\",\"jst_zh\",\"jst_ph\",\"jst_xh\",\"jst_vh\"],R_=Tt.extend({ftype:x(\"simple_connector\"),standard:ut(E_).optional(),pin_count:w().int().positive().optional()});A(!0);var kp=Tt.extend({ftype:x(\"simple_pinout\")});A(!0);var Np=Tt.extend({ftype:x(\"simple_resonator\"),load_capacitance:_p,equivalent_series_resistance:vs.optional(),frequency:kr});A(!0);var Yp=Tt.extend({ftype:x(\"simple_transistor\"),transistor_type:ut([\"npn\",\"pnp\"])});A(!0);var Lp=Tt.extend({ftype:x(\"simple_test_point\"),footprint_variant:ut([\"pad\",\"through_hole\"]).optional(),pad_shape:ut([\"rect\",\"circle\"]).optional(),pad_diameter:Wt([w(),h()]).optional(),hole_diameter:Wt([w(),h()]).optional(),width:Wt([w(),h()]).optional(),height:Wt([w(),h()]).optional()});A(!0);var Tp=Tt.extend({ftype:x(\"simple_mosfet\"),channel_type:ut([\"n\",\"p\"]),mosfet_mode:ut([\"enhancement\",\"depletion\"])});A(!0);var Ep=Tt.extend({ftype:x(\"simple_op_amp\")});A(!0);var Rp=Tt.extend({ftype:x(\"simple_switch\")});A(!0);var Op=M({type:x(\"source_project_metadata\"),name:h().optional(),software_used_string:h().optional(),project_url:h().optional(),source_filesystem_md5_hash:h().optional(),created_at:m_.optional()});A(!0);var O_=Mt.extend({type:x(\"source_missing_property_error\"),source_missing_property_error_id:T(\"source_missing_property_error\"),source_component_id:h(),property_name:h(),subcircuit_id:h().optional(),error_type:x(\"source_missing_property_error\").default(\"source_missing_property_error\")}).describe(\"The source code is missing a property\");A(!0);var W_=Mt.extend({type:x(\"source_failed_to_create_component_error\"),source_failed_to_create_component_error_id:T(\"source_failed_to_create_component_error\"),error_type:x(\"source_failed_to_create_component_error\").default(\"source_failed_to_create_component_error\"),component_name:h().optional(),subcircuit_id:h().optional(),parent_source_component_id:h().optional(),pcb_center:M({x:w().optional(),y:w().optional()}).optional(),schematic_center:M({x:w().optional(),y:w().optional()}).optional()}).describe(\"Error emitted when a component fails to be constructed\");A(!0);var Wp=Mt.extend({type:x(\"source_invalid_component_property_error\"),source_invalid_component_property_error_id:T(\"source_invalid_component_property_error\"),source_component_id:h(),property_name:h(),property_value:Ky().optional(),expected_format:h().optional(),subcircuit_id:h().optional(),error_type:x(\"source_invalid_component_property_error\").default(\"source_invalid_component_property_error\")}).describe(\"The source component property is invalid\");A(!0);var $p=Mt.extend({type:x(\"source_trace_not_connected_error\"),source_trace_not_connected_error_id:T(\"source_trace_not_connected_error\"),error_type:x(\"source_trace_not_connected_error\").default(\"source_trace_not_connected_error\"),subcircuit_id:h().optional(),source_group_id:h().optional(),source_trace_id:h().optional(),connected_source_port_ids:W(h()).optional(),selectors_not_found:W(h()).optional()}).describe(\"Occurs when a source trace selector does not match any ports\");A(!0);var $_=M({type:x(\"source_property_ignored_warning\"),source_property_ignored_warning_id:T(\"source_property_ignored_warning\"),source_component_id:h(),property_name:h(),subcircuit_id:h().optional(),error_type:x(\"source_property_ignored_warning\").default(\"source_property_ignored_warning\"),message:h()}).describe(\"The source property was ignored\");A(!0);var jp=M({type:x(\"source_pin_missing_trace_warning\"),source_pin_missing_trace_warning_id:T(\"source_pin_missing_trace_warning\"),warning_type:x(\"source_pin_missing_trace_warning\").default(\"source_pin_missing_trace_warning\"),message:h(),source_component_id:h(),source_port_id:h(),subcircuit_id:h().optional()}).describe(\"Warning emitted when a source component pin is missing a trace connection\");A(!0);var Xp=M({type:x(\"source_missing_manufacturer_part_number_warning\"),source_missing_manufacturer_part_number_warning_id:T(\"source_missing_manufacturer_part_number_warning\"),warning_type:x(\"source_missing_manufacturer_part_number_warning\").default(\"source_missing_manufacturer_part_number_warning\"),message:h(),source_component_id:h(),standard:h().optional(),subcircuit_id:h().optional()}).describe(\"Warning emitted when a source component is missing its manufacturer part number\");A(!0);var Dp=M({type:x(\"source_refdes_convention_warning\"),source_refdes_convention_warning_id:T(\"source_refdes_convention_warning\"),warning_type:x(\"source_refdes_convention_warning\").default(\"source_refdes_convention_warning\"),message:h(),source_component_id:h(),refdes:h(),source_component_ftype:h(),expected_prefixes:W(h()),actual_prefix:h().optional(),subcircuit_id:h().optional()}).describe(\"Warning emitted when a source component reference designator does not match the component type convention\");A(!0);var Vp=M({type:x(\"source_component_availability_warning\"),source_component_availability_warning_id:T(\"source_component_availability_warning\"),warning_type:x(\"source_component_availability_warning\").default(\"source_component_availability_warning\"),message:h(),source_component_id:h(),subcircuit_id:h().optional(),supplier_name:Kn,supplier_part_numbers:W(h()).nonempty()}).describe(\"Warning emitted when no supplier alternative can be confirmed in stock. Availability may be unknown or change over time.\");A(!0);var j_=Tt.extend({ftype:x(\"simple_voltage_probe\")});A(!0);var X_=Tt.extend({ftype:x(\"interconnect\")});A(!0);var zp=Mt.extend({type:x(\"source_i2c_misconfigured_error\"),source_i2c_misconfigured_error_id:T(\"source_i2c_misconfigured_error\"),error_type:x(\"source_i2c_misconfigured_error\").default(\"source_i2c_misconfigured_error\"),source_port_ids:W(h())}).describe(\"Error emitted when incompatible I2C pins (e.g. SDA and SCL) are connected to the same net\");A(!0);var Up=Mt.extend({type:x(\"source_component_misconfigured_error\"),source_component_misconfigured_error_id:T(\"source_component_misconfigured_error\"),error_type:x(\"source_component_misconfigured_error\").default(\"source_component_misconfigured_error\"),source_component_ids:W(h()),source_port_ids:W(h()).optional()}).describe(\"Error emitted when one or more source components have an invalid or conflicting configuration\");A(!0);var D_=Tt.extend({ftype:x(\"simple_voltage_source\"),voltage:xe,frequency:kr.optional(),peak_to_peak_voltage:xe.optional(),wave_shape:ut([\"sinewave\",\"square\",\"triangle\",\"sawtooth\"]).optional(),phase:Et.optional(),duty_cycle:w().optional().describe(\"Duty cycle as a fraction (0 to 1)\"),pulse_delay:Qt.optional(),rise_time:Qt.optional(),fall_time:Qt.optional(),pulse_width:Qt.optional(),period:Qt.optional()});A(!0);var V_=Wt([Sp,vp,Ps,B_,wp,I_,Ap,F_,M_,C_,Pp,k_,Y_,Bp,Ip,Fp,Mp,T_,Cp,R_,kp,Np,Rp,Yp,Lp,Tp,Ep,N_,j_,X_,D_,Op,O_,Wp,W_,$p,$_,jp,Xp,Dp,Vp,zp,Up]);A(!0);var z_=M({type:x(\"source_port\"),pin_number:w().optional(),port_hints:W(h()).optional(),name:h(),source_port_id:h(),source_component_id:h().optional(),source_group_id:h().optional(),most_frequently_referenced_by_name:h().optional(),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional()}).merge(L_);A(!0);var U_=M({type:x(\"source_component_internal_connection\"),source_component_internal_connection_id:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()});A(!0);var G_=M({type:x(\"source_trace\"),source_trace_id:h(),connected_source_port_ids:W(h()),connected_source_net_ids:W(h()),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),max_length:w().optional(),max_via_count:w().int().nonnegative().optional(),name:h().optional(),min_trace_thickness:w().optional(),display_name:h().optional()});A(!0);var H_=M({type:x(\"source_group\"),source_group_id:h(),subcircuit_id:h().optional(),parent_subcircuit_id:h().optional(),parent_source_group_id:h().optional(),is_subcircuit:E().optional(),show_as_schematic_box:E().optional(),name:h().optional(),was_automatically_named:E().optional()});A(!0);var Q_=M({type:x(\"source_net\"),source_net_id:h(),name:h(),member_source_group_ids:W(h()),is_power:E().optional(),is_ground:E().optional(),is_digital_signal:E().optional(),is_analog_signal:E().optional(),is_positive_voltage_source:E().optional(),trace_width:w().optional(),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional()});A(!0);var Z_=M({type:x(\"source_board\"),source_board_id:h(),source_group_id:h(),title:h().optional()}).describe(\"Defines a board in the source domain\");A(!0);var q_=Mt.extend({type:x(\"source_ambiguous_port_reference\"),source_ambiguous_port_reference_id:T(\"source_ambiguous_port_reference\"),error_type:x(\"source_ambiguous_port_reference\").default(\"source_ambiguous_port_reference\"),source_port_id:h().optional(),source_component_id:h().optional()}).describe(\"Error emitted when a port hint matches multiple non-overlapping pads, making the port reference ambiguous\");A(!0);var J_=M({type:x(\"source_pcb_ground_plane\"),source_pcb_ground_plane_id:h(),source_group_id:h(),source_net_id:h(),subcircuit_id:h().optional()}).describe(\"Defines a ground plane in the source domain\");A(!0);var K_=[\"top\",\"bottom\",\"inner1\",\"inner2\",\"inner3\",\"inner4\",\"inner5\",\"inner6\",\"inner7\",\"inner8\"],hp=ut(K_),gt=hp.or(M({name:hp})).transform((t)=\u003e{if(typeof t===\"string\")return t;return t.name});A(!0);var Ut=ut([\"top\",\"bottom\"]),t0=M({type:x(\"source_manually_placed_via\"),source_manually_placed_via_id:h(),source_group_id:h(),source_net_id:h().min(1).optional(),subcircuit_id:h().optional(),source_trace_id:h().optional()}).describe(\"Defines a via that is manually placed in the source domain\");A(!0);var e0=M({type:x(\"source_unnamed_trace_warning\"),source_unnamed_trace_warning_id:T(\"source_unnamed_trace_warning\"),warning_type:x(\"source_unnamed_trace_warning\").default(\"source_unnamed_trace_warning\"),message:h(),source_trace_id:h(),subcircuit_id:h().optional()}).describe(\"Warning emitted when a source trace is missing a name\");A(!0);var r0=M({type:x(\"source_no_power_pin_defined_warning\"),source_no_power_pin_defined_warning_id:T(\"source_no_power_pin_defined_warning\"),warning_type:x(\"source_no_power_pin_defined_warning\").default(\"source_no_power_pin_defined_warning\"),message:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Warning emitted when a chip has no source ports with requires_power=true\");A(!0);var n0=M({type:x(\"source_no_ground_pin_defined_warning\"),source_no_ground_pin_defined_warning_id:T(\"source_no_ground_pin_defined_warning\"),warning_type:x(\"source_no_ground_pin_defined_warning\").default(\"source_no_ground_pin_defined_warning\"),message:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Warning emitted when a chip has no source ports marked as ground pins\");A(!0);var i0=M({type:x(\"source_component_pins_underspecified_warning\"),source_component_pins_underspecified_warning_id:T(\"source_component_pins_underspecified_warning\"),warning_type:x(\"source_component_pins_underspecified_warning\").default(\"source_component_pins_underspecified_warning\"),message:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Warning emitted when all ports on a source component are underspecified\");A(!0);var o0=Mt.extend({type:x(\"source_pin_must_be_connected_error\"),source_pin_must_be_connected_error_id:T(\"source_pin_must_be_connected_error\"),error_type:x(\"source_pin_must_be_connected_error\").default(\"source_pin_must_be_connected_error\"),source_component_id:h(),source_port_id:h(),subcircuit_id:h().optional()}).describe(\"Error emitted when a pin with mustBeConnected attribute is not connected to any trace\");A(!0);var s0=Mt.extend({type:x(\"unknown_error_finding_part\"),unknown_error_finding_part_id:T(\"unknown_error_finding_part\"),error_type:x(\"unknown_error_finding_part\").default(\"unknown_error_finding_part\"),source_component_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Error emitted when an unexpected error occurs while finding a part\");A(!0);var a0=M({type:x(\"source_part_not_found_warning\"),source_part_not_found_warning_id:T(\"source_part_not_found_warning\"),warning_type:x(\"source_part_not_found_warning\").default(\"source_part_not_found_warning\"),message:h(),source_component_id:h().optional(),subcircuit_id:h().optional(),supplier_name:Kn.optional(),manufacturer_part_number:h().optional(),supplier_part_number:h().optional(),part_name:h().optional()}).describe(\"Warning emitted when a requested part can not be found\");A(!0);var c0=M({type:x(\"source_confusing_net_name_warning\"),source_confusing_net_name_warning_id:T(\"source_confusing_net_name_warning\"),warning_type:x(\"source_confusing_net_name_warning\").default(\"source_confusing_net_name_warning\"),message:h(),source_net_ids:W(h()).min(2),net_name:h(),subcircuit_id:h().optional()}).describe(\"Warning emitted when electrically disconnected source nets share a name\");A(!0);var cp=Wt([w().nonnegative().finite(),M({reference:x(\"longest_manhattan\"),source_trace_ids:W(h()).min(1).optional(),offset:w().finite().optional()})]),r_=Wt([w().positive().finite(),M({width_multiplier:w().positive().finite()})]),l0=M({type:x(\"source_bus\"),source_bus_id:h(),name:h().optional(),source_trace_ids:W(h()).min(1),max_length_skew:w().nonnegative().finite().optional(),target_impedance:w().positive().finite().optional(),target_differential_impedance:w().positive().finite().optional(),differential_pair:M({positive_source_trace_id:h(),negative_source_trace_id:h(),trace_gap:w().positive().finite().optional(),max_uncoupled_length:w().nonnegative().finite().optional()}).optional(),length_match_source_trace_ids:W(h()).min(1).optional(),min_length:cp.optional(),max_length:cp.optional(),target_length:cp.optional(),length_tolerance:w().nonnegative().finite().optional(),pcb_trace_spacing:r_.optional(),pcb_spacing_to_other_signals:r_.optional(),target_impedance_min:w().positive().finite().optional(),target_impedance_max:w().positive().finite().optional(),target_differential_impedance_min:w().positive().finite().optional(),target_differential_impedance_max:w().positive().finite().optional(),subcircuit_id:h().optional()});A(!0);var p0=Mt.pick({message:!0,error_type:!0}).extend({type:x(\"source_runtime_error\"),source_runtime_error_id:T(\"source_runtime_error\"),error_type:x(\"source_runtime_error\").default(\"source_runtime_error\"),phase_name:h().optional()}).describe(\"An unexpected runtime failure while generating or validating a circuit\");A(!0);var h0=M({type:x(\"schematic_box\"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),width:R,height:R,is_dashed:E().default(!1),x:R,y:R,subcircuit_id:h().optional()}).describe(\"Draws a box on the schematic\");A(!0);var d0=M({type:x(\"schematic_path\"),schematic_path_id:T(\"schematic_path\"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),fill_color:h().optional(),is_filled:E().optional(),is_dashed:E().default(!1),stroke_width:R.nullable().optional(),stroke_color:h().optional(),dash_length:R.optional(),dash_gap:R.optional(),points:W(nt),subcircuit_id:h().optional()});A(!0);var m0=Qn(M({left_margin:K.optional(),right_margin:K.optional(),top_margin:K.optional(),bottom_margin:K.optional()})),u0=M({left_size:w(),right_size:w(),top_size:w().optional(),bottom_size:w().optional()});A(!0);var f0=M({left_side:M({pins:W(w()),direction:ut([\"top-to-bottom\",\"bottom-to-top\"]).optional()}).optional(),right_side:M({pins:W(w()),direction:ut([\"top-to-bottom\",\"bottom-to-top\"]).optional()}).optional(),top_side:M({pins:W(w()),direction:ut([\"left-to-right\",\"right-to-left\"]).optional()}).optional(),bottom_side:M({pins:W(w()),direction:ut([\"left-to-right\",\"right-to-left\"]).optional()}).optional()});A(!0);var y0=Wt([u0,f0]),_0=M({type:x(\"schematic_component\"),size:Ss,center:nt,source_component_id:h().optional(),schematic_component_id:h(),schematic_sheet_id:h().optional(),schematic_symbol_id:h().optional(),pin_spacing:K.optional(),pin_styles:m0.optional(),box_width:K.optional(),symbol_name:h().optional(),port_arrangement:y0.optional(),port_labels:Qn(h()).optional(),symbol_display_value:h().optional(),subcircuit_id:h().optional(),schematic_group_id:h().optional(),is_schematic_group:E().optional(),source_group_id:h().optional(),is_box_with_pins:E().optional().default(!0)});A(!0);var z5=M({kicad_symbol:P_.optional()}).catchall(Ky()),g0=M({type:x(\"schematic_symbol\"),schematic_symbol_id:h(),name:h().optional(),metadata:z5.optional()}).describe(\"Defines a named schematic symbol that can be referenced by components.\");A(!0);var x0=M({type:x(\"schematic_line\"),schematic_line_id:T(\"schematic_line\"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),x1:R,y1:R,x2:R,y2:R,stroke_width:R.nullable().optional(),color:h().default(\"#000000\"),is_dashed:E().default(!1),dash_length:R.optional(),dash_gap:R.optional(),subcircuit_id:h().optional()}).describe(\"Draws a styled line on the schematic\");A(!0);var b0=M({type:x(\"schematic_rect\"),schematic_rect_id:T(\"schematic_rect\"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),center:nt,width:R,height:R,rotation:Et.default(0),stroke_width:R.nullable().optional(),color:h().default(\"#000000\"),is_filled:E().default(!1),fill_color:h().optional(),is_dashed:E().default(!1),subcircuit_id:h().optional()}).describe(\"Draws a styled rectangle on the schematic\");A(!0);var v0=M({type:x(\"schematic_circle\"),schematic_circle_id:T(\"schematic_circle\"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),center:nt,radius:R,stroke_width:R.nullable().optional(),color:h().default(\"#000000\"),is_filled:E().default(!1),fill_color:h().optional(),is_dashed:E().default(!1),subcircuit_id:h().optional()}).describe(\"Draws a styled circle on the schematic\");A(!0);var S0=M({type:x(\"schematic_arc\"),schematic_arc_id:T(\"schematic_arc\"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),center:nt,radius:R,start_angle_degrees:Et,end_angle_degrees:Et,direction:ut([\"clockwise\",\"counterclockwise\"]).default(\"counterclockwise\"),stroke_width:R.nullable().optional(),color:h().default(\"#000000\"),is_dashed:E().default(!1),subcircuit_id:h().optional()}).describe(\"Draws a styled arc on the schematic\");A(!0);var w0=M({type:x(\"schematic_trace\"),schematic_trace_id:h(),schematic_sheet_id:h().optional(),source_trace_id:h().optional(),junctions:W(M({x:w(),y:w()})),edges:W(M({from:M({x:w(),y:w()}),to:M({x:w(),y:w()}),is_crossing:E().optional(),from_schematic_port_id:h().optional(),to_schematic_port_id:h().optional()})),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional()});A(!0);var U5=ut([\"center\",\"left\",\"right\",\"top\",\"bottom\"]);A(!0);var Gp=M({text:h(),is_overlined:E().optional()}),A0=M({type:x(\"schematic_text\"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),schematic_text_id:h(),source_trace_id:h().optional(),text:h(),text_parts:W(Gp).min(1).optional(),display_superscript:h().optional(),font_size:w().default(0.18),position:M({x:R,y:R}),rotation:w().default(0),anchor:Wt([U5.describe(\"legacy\"),Ve]).default(\"center\"),color:h().default(\"#000000\"),subcircuit_id:h().optional()});A(!0);var P0=M({type:x(\"schematic_port\"),schematic_port_id:h(),source_port_id:h(),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),center:nt,facing_direction:ut([\"up\",\"down\",\"left\",\"right\"]).optional(),distance_from_component_edge:w().optional(),side_of_component:ut([\"top\",\"bottom\",\"left\",\"right\"]).optional(),true_ccw_index:w().optional(),pin_number:w().optional(),display_pin_label:h().optional(),display_pin_label_text_parts:W(Gp).min(1).optional(),display_pin_label_font_size:w().positive().finite().optional(),subcircuit_id:h().optional(),is_connected:E().optional(),is_internal_circuit_port:E().optional(),is_overlapping_internal_circuit_port:E().optional(),has_input_arrow:E().optional(),has_output_arrow:E().optional(),is_drawn_with_inversion_circle:E().optional()}).describe(\"Defines a port on a schematic component\");A(!0);var B0=M({type:x(\"schematic_net_label\"),schematic_net_label_id:T(\"schematic_net_label\"),schematic_sheet_id:h().optional(),schematic_trace_id:h().optional(),source_trace_id:h().optional(),source_net_id:h(),center:nt,anchor_position:nt.optional(),anchor_side:ut([\"top\",\"bottom\",\"left\",\"right\"]),text:h(),display_superscript:h().optional(),symbol_name:h().optional(),is_movable:E().optional(),subcircuit_id:h().optional()});A(!0);var I0=Mt.extend({type:x(\"schematic_error\"),schematic_error_id:h(),error_type:x(\"schematic_port_not_found\").default(\"schematic_port_not_found\"),subcircuit_id:h().optional()}).describe(\"Defines a schematic error on the schematic\");A(!0);var F0=Mt.extend({type:x(\"schematic_layout_error\"),schematic_layout_error_id:T(\"schematic_layout_error\"),error_type:x(\"schematic_layout_error\").default(\"schematic_layout_error\"),source_group_id:h(),schematic_group_id:h(),subcircuit_id:h().optional()}).describe(\"Error emitted when schematic layout fails for a group\");A(!0);var Bs=M({type:x(\"schematic_debug_object\"),label:h().optional(),subcircuit_id:h().optional()}),M0=Bs.extend({shape:x(\"rect\"),center:nt,size:Ss}),C0=Bs.extend({shape:x(\"line\"),start:nt,end:nt}),k0=Bs.extend({shape:x(\"point\"),center:nt}),N0=ie(\"shape\",[M0,C0,k0]);A(!0);var Y0=M({type:x(\"schematic_voltage_probe\"),schematic_voltage_probe_id:h(),schematic_sheet_id:h().optional(),source_component_id:h().optional(),name:h().optional(),position:nt,schematic_trace_id:h(),voltage:xe.optional(),subcircuit_id:h().optional(),color:h().optional(),label_alignment:Ve.optional()}).describe(\"Defines a voltage probe measurement point on a schematic trace\");A(!0);var L0=M({type:x(\"schematic_manual_edit_conflict_warning\"),schematic_manual_edit_conflict_warning_id:T(\"schematic_manual_edit_conflict_warning\"),warning_type:x(\"schematic_manual_edit_conflict_warning\").default(\"schematic_manual_edit_conflict_warning\"),message:h(),schematic_component_id:h(),schematic_group_id:h().optional(),subcircuit_id:h().optional(),source_component_id:h()}).describe(\"Warning emitted when a component has both manual placement and explicit schX/schY coordinates\");A(!0);var T0=M({type:x(\"schematic_component_overlap_warning\"),schematic_component_overlap_warning_id:T(\"schematic_component_overlap_warning\"),warning_type:x(\"schematic_component_overlap_warning\").default(\"schematic_component_overlap_warning\"),message:h(),schematic_component_ids:t_([h(),h()]),schematic_sheet_id:h().optional()}).describe(\"Warning emitted when the rendered bounds of two schematic components overlap\");A(!0);var E0=M({type:x(\"schematic_component_styling_warning\"),schematic_component_styling_warning_id:T(\"schematic_component_styling_warning\"),warning_type:x(\"schematic_component_styling_warning\").default(\"schematic_component_styling_warning\"),message:h(),schematic_component_id:h(),styling_issue_type:h(),schematic_port_ids:W(h()).optional(),source_component_id:h().optional(),schematic_sheet_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Warning emitted when a schematic component has a visual styling issue\");A(!0);var R0=M({type:x(\"schematic_sheet_styling_warning\"),schematic_sheet_styling_warning_id:T(\"schematic_sheet_styling_warning\"),warning_type:x(\"schematic_sheet_styling_warning\").default(\"schematic_sheet_styling_warning\"),message:h(),schematic_sheet_id:h(),styling_issue_type:x(\"non_default_sheet_size\"),subcircuit_id:h().optional()}).describe(\"Style warning emitted when a schematic sheet uses a non-default size\");A(!0);var O0=M({type:x(\"schematic_element_outside_sheet_warning\"),schematic_element_outside_sheet_warning_id:T(\"schematic_element_outside_sheet_warning\"),warning_type:x(\"schematic_element_outside_sheet_warning\").default(\"schematic_element_outside_sheet_warning\"),message:h(),schematic_sheet_id:h(),schematic_element_type:ut([\"schematic_component\",\"schematic_net_label\",\"schematic_trace\"]),schematic_element_id:h()}).describe(\"Warning emitted when a schematic component, net label, or trace extends outside its schematic sheet\");A(!0);var n_=R.pipe(w().positive().finite()),W0=M({type:x(\"schematic_graphic\"),schematic_graphic_id:T(\"schematic_graphic\"),schematic_sheet_id:h().optional(),asset:_o.optional(),svg_content:h().optional(),width:n_.optional(),height:n_.optional()}).describe(\"References a graphic asset or inline SVG content with optional centered layout bounds on a schematic sheet\").superRefine(({asset:t,svg_content:e},r)=\u003e{if(t===void 0\u0026\u0026e===void 0)r.addIssue({code:X.custom,message:\"At least one of asset or svg_content is required\"})});A(!0);var $0=M({type:x(\"schematic_group\"),schematic_group_id:T(\"schematic_group\"),schematic_sheet_id:h().optional(),source_group_id:h(),is_subcircuit:E().optional(),subcircuit_id:h().optional(),width:K,height:K,center:nt,schematic_component_ids:W(h()),show_as_schematic_box:E().optional(),name:h().optional(),description:h().optional()}).describe(\"Defines a group of components on the schematic\");A(!0);var j0=M({type:x(\"schematic_table\"),schematic_table_id:T(\"schematic_table\"),schematic_sheet_id:h().optional(),anchor_position:nt,column_widths:W(R),row_heights:W(R),cell_padding:R.optional(),border_width:R.optional(),subcircuit_id:h().optional(),schematic_component_id:h().optional(),anchor:Ve.optional()}).describe(\"Defines a table on the schematic\");A(!0);var X0=M({type:x(\"schematic_table_cell\"),schematic_table_cell_id:T(\"schematic_table_cell\"),schematic_sheet_id:h().optional(),schematic_table_id:h(),start_row_index:w(),end_row_index:w(),start_column_index:w(),end_column_index:w(),text:h().optional(),center:nt,width:R,height:R,horizontal_align:ut([\"left\",\"center\",\"right\"]).optional(),vertical_align:ut([\"top\",\"middle\",\"bottom\"]).optional(),font_size:R.optional(),subcircuit_id:h().optional()}).describe(\"Defines a cell within a schematic_table\");A(!0);var D0=ut([\"a4\",\"ansi_b\"]),V0=M({type:x(\"schematic_sheet\"),schematic_sheet_id:T(\"schematic_sheet\"),name:h().optional(),sheet_index:w().optional(),sheet_size:D0.optional(),sheet_width:w().positive().optional(),sheet_height:w().positive().optional(),subcircuit_id:h().optional(),outline_color:h().optional()}).describe(\"Defines a schematic sheet or page that components can be placed on\");A(!0);var z0=M({type:x(\"schematic_missing_sheet_warning\"),schematic_missing_sheet_warning_id:T(\"schematic_missing_sheet_warning\"),warning_type:x(\"schematic_missing_sheet_warning\").default(\"schematic_missing_sheet_warning\"),message:h()}).describe(\"Circuit-wide warning emitted when a schematic has no schematic sheet. Display as a banner without attaching it to a component or drawing a target outline or leader line.\");A(!0);var U0=M({x:R,y:R,bulge:w().optional()});A(!0);var dp=M({vertices:W(U0)});A(!0);var Hp=M({outer_ring:dp,inner_rings:W(dp).default([])});A(!0);var G0={from_left:\"from_left\",from_right:\"from_right\",from_top:\"from_top\",from_bottom:\"from_bottom\",from_above:\"from_above\",from_below:\"from_below\",from_x_neg:\"from_left\",from_x_pos:\"from_right\",from_y_pos:\"from_top\",from_y_neg:\"from_bottom\",from_z_pos:\"from_above\",from_z_neg:\"from_below\",from_front:\"from_top\",from_back:\"from_bottom\"},G5={from_left:{x:-1,y:0,z:0},from_right:{x:1,y:0,z:0},from_top:{x:0,y:1,z:0},from_bottom:{x:0,y:-1,z:0},from_above:{x:0,y:0,z:1},from_below:{x:0,y:0,z:-1}},H0=ut([\"from_left\",\"from_right\",\"from_top\",\"from_bottom\",\"from_above\",\"from_below\",\"from_x_neg\",\"from_x_pos\",\"from_y_pos\",\"from_y_neg\",\"from_z_pos\",\"from_z_neg\",\"from_front\",\"from_back\"]).transform((t)=\u003eG0[t]).describe('The side exposing the receptacle where the cable or mating part is attached, following the 2D PCB diagram convention, not a 3D viewport frame. In project coordinate space, \"from_top\" is +Y, \"from_bottom\" -Y, \"from_left\" -X, \"from_right\" +X, \"from_above\" +Z and \"from_below\" -Z. A receptacle on the +Y edge is \"from_top\" even though the plug moves in -Y as it seats. Cartesian spellings such as \"from_y_pos\" are accepted and normalized to the named values, as are the deprecated \"from_front\" (now \"from_top\") and \"from_back\" (now \"from_bottom\").');A(!0);A(!0);var mp=ut([\"leftside_top\",\"leftside_bottom\",\"rightside_top\",\"rightside_bottom\",\"topside_left\",\"topside_right\",\"bottomside_left\",\"bottomside_right\"]);A(!0);var H5=[[\"leftside_top\",\"bottomside_left\",\"rightside_bottom\",\"topside_right\"],[\"leftside_bottom\",\"bottomside_right\",\"rightside_top\",\"topside_left\"]],Q5=(t,e)=\u003e{for(let r of H5){let n=r.indexOf(t),i=r.indexOf(e);if(n!==-1\u0026\u0026i!==-1)return(i-n+r.length)%r.length*90}return null},Q0=M({x:R,y:R,via:E().optional(),via_to_layer:gt.optional()}),Z5=W(Q0);A(!0);A(!0);var Z0=M({x:R,y:R,via:E().optional(),to_layer:gt.optional(),trace_width:R.optional()});A(!0);var q0=M({min_trace_width:K.optional(),min_board_edge_clearance:K.optional(),min_via_hole_edge_to_via_hole_edge_clearance:K.optional(),min_plated_hole_drill_edge_to_drill_edge_clearance:K.optional(),min_trace_to_pad_edge_clearance:K.optional(),min_trace_to_hole_edge_clearance:K.optional().describe(\"Minimum distance from a trace copper edge to a non-plated hole edge, in mm. No default is applied when omitted.\"),min_pad_edge_to_pad_edge_clearance:K.optional(),min_same_net_trace_edge_to_trace_edge_clearance:K.optional(),min_different_net_trace_edge_to_trace_edge_clearance:K.optional(),min_via_edge_to_pad_edge_clearance:K.optional(),min_via_hole_diameter:K.optional(),min_via_pad_diameter:K.optional()}),J0=M({type:x(\"pcb_component\"),pcb_component_id:T(\"pcb_component\"),source_component_id:h(),center:nt,layer:gt,rotation:Et,display_offset_x:h().optional().describe(\"How to display the x offset for this part, usually corresponding with how the user specified it\"),display_offset_y:h().optional().describe(\"How to display the y offset for this part, usually corresponding with how the user specified it\"),width:K,height:K,do_not_place:E().optional(),is_allowed_to_be_off_board:E().optional(),subcircuit_id:h().optional(),pcb_group_id:h().optional(),position_mode:ut([\"packed\",\"relative_to_group_anchor\",\"relative_to_another_component\",\"none\"]).optional(),anchor_position:nt.optional(),anchor_alignment:Ve.optional(),positioned_relative_to_pcb_group_id:h().optional(),positioned_relative_to_pcb_board_id:h().optional(),cable_insertion_center:nt.optional(),insertion_direction:H0.optional(),pin1_location:mp.optional().describe(\"Location of pin 1 on the unrotated, top-view component footprint\"),supplier_pin1_location_map:Qn(Kn,mp).optional().describe(\"Pin 1 location for each supplier's unrotated, top-view footprint\"),metadata:M({kicad_footprint:b_.optional()}).optional(),obstructs_within_bounds:E().default(!0).describe(\"Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath\")}).describe(\"Defines a component on the PCB\");A(!0);var Is=M({type:x(\"pcb_debug_object\"),pcb_debug_object_id:T(\"pcb_debug_object\"),label:h().optional(),subcircuit_id:h().optional()}),K0=Is.extend({shape:x(\"rect\"),center:nt,size:Ss}),tg=Is.extend({shape:x(\"line\"),start:nt,end:nt}),eg=Is.extend({shape:x(\"point\"),center:nt}),rg=ie(\"shape\",[K0,tg,eg]);A(!0);var ng=M({type:x(\"pcb_hole\"),pcb_hole_id:T(\"pcb_hole\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x(\"circle\"),hole_diameter:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),q5=ng.describe(\"Defines a circular hole on the PCB\");A(!0);var ig=M({type:x(\"pcb_hole\"),pcb_hole_id:T(\"pcb_hole\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x(\"rect\"),hole_width:w(),hole_height:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),J5=ig.describe(\"Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square.\");A(!0);var og=M({type:x(\"pcb_hole\"),pcb_hole_id:T(\"pcb_hole\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:ut([\"circle\",\"square\"]),hole_diameter:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),K5=og.describe(\"Defines a circular or square hole on the PCB\");A(!0);var sg=M({type:x(\"pcb_hole\"),pcb_hole_id:T(\"pcb_hole\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x(\"oval\"),hole_width:w(),hole_height:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),t3=sg.describe(\"Defines an oval hole on the PCB\");A(!0);var ag=M({type:x(\"pcb_hole\"),pcb_hole_id:T(\"pcb_hole\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x(\"pill\"),hole_width:w(),hole_height:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),e3=ag.describe(\"Defines a pill-shaped hole on the PCB\");A(!0);var cg=M({type:x(\"pcb_hole\"),pcb_hole_id:T(\"pcb_hole\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x(\"rotated_pill\"),hole_width:w(),hole_height:w(),x:R,y:R,ccw_rotation:Et,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),r3=cg.describe(\"Defines a rotated pill-shaped hole on the PCB\");A(!0);var lg=og.or(sg).or(ag).or(cg).or(ng).or(ig),n3=M({type:x(\"pcb_plated_hole\"),shape:x(\"circle\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),outer_diameter:w(),hole_diameter:w(),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T(\"pcb_plated_hole\"),soldermask_margin:w().optional()}),i3=M({type:x(\"pcb_plated_hole\"),shape:ut([\"oval\",\"pill\"]),pcb_group_id:h().optional(),subcircuit_id:h().optional(),outer_width:w(),outer_height:w(),hole_width:w(),hole_height:w(),is_covered_with_solder_mask:E().optional(),x:R,y:R,ccw_rotation:Et,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T(\"pcb_plated_hole\"),soldermask_margin:w().optional()}),o3=M({type:x(\"pcb_plated_hole\"),shape:x(\"circular_hole_with_rect_pad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:x(\"circle\"),pad_shape:x(\"rect\"),hole_diameter:w(),rect_pad_width:w(),rect_pad_height:w(),rect_border_radius:w().optional(),hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T(\"pcb_plated_hole\"),soldermask_margin:w().optional(),rect_ccw_rotation:Et.optional()}),s3=M({type:x(\"pcb_plated_hole\"),shape:x(\"pill_hole_with_rect_pad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:x(\"pill\"),pad_shape:x(\"rect\"),hole_width:w(),hole_height:w(),rect_pad_width:w(),rect_pad_height:w(),rect_border_radius:w().optional(),hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T(\"pcb_plated_hole\"),soldermask_margin:w().optional()}),a3=M({type:x(\"pcb_plated_hole\"),shape:x(\"rotated_pill_hole_with_rect_pad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:x(\"rotated_pill\"),pad_shape:x(\"rect\"),hole_width:w(),hole_height:w(),hole_ccw_rotation:Et,rect_pad_width:w(),rect_pad_height:w(),rect_border_radius:w().optional(),rect_ccw_rotation:Et,hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T(\"pcb_plated_hole\"),soldermask_margin:w().optional()}),c3=M({type:x(\"pcb_plated_hole\"),shape:x(\"hole_with_polygon_pad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:ut([\"circle\",\"oval\",\"pill\",\"rotated_pill\"]),hole_diameter:w().optional(),hole_width:w().optional(),hole_height:w().optional(),pad_outline:W(M({x:R,y:R})).min(3),hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T(\"pcb_plated_hole\"),soldermask_margin:w().optional(),ccw_rotation:Et.optional()}),pg=Wt([n3,i3,o3,s3,a3,c3]);A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);var hg=M({type:x(\"pcb_port\"),pcb_port_id:T(\"pcb_port\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),source_port_id:h(),pcb_component_id:h().optional(),x:R,y:R,layers:W(gt),is_board_pinout:E().optional()}).describe(\"Defines a port on the PCB\");A(!0);var l3=M({type:x(\"pcb_smtpad\"),shape:x(\"circle\"),pcb_smtpad_id:T(\"pcb_smtpad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,radius:w(),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),p3=M({type:x(\"pcb_smtpad\"),shape:x(\"rect\"),pcb_smtpad_id:T(\"pcb_smtpad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),rect_border_radius:w().optional(),corner_radius:w().optional(),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),soldermask_margin_left:w().optional(),soldermask_margin_top:w().optional(),soldermask_margin_right:w().optional(),soldermask_margin_bottom:w().optional(),solderpaste_margin:w().optional()}),h3=M({type:x(\"pcb_smtpad\"),shape:x(\"rotated_rect\"),pcb_smtpad_id:T(\"pcb_smtpad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),rect_border_radius:w().optional(),corner_radius:w().optional(),ccw_rotation:Et,layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),soldermask_margin_left:w().optional(),soldermask_margin_top:w().optional(),soldermask_margin_right:w().optional(),soldermask_margin_bottom:w().optional(),solderpaste_margin:w().optional()}),dg=M({type:x(\"pcb_smtpad\"),shape:x(\"pill\"),pcb_smtpad_id:T(\"pcb_smtpad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),d3=M({type:x(\"pcb_smtpad\"),shape:x(\"rotated_pill\"),pcb_smtpad_id:T(\"pcb_smtpad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),ccw_rotation:Et,layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),m3=M({type:x(\"pcb_smtpad\"),shape:x(\"polygon\"),pcb_smtpad_id:T(\"pcb_smtpad\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),points:W(nt),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),mg=ie(\"shape\",[l3,p3,h3,d3,dg,m3]).describe(\"Defines an SMT pad on the PCB\");A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);var u3=M({type:x(\"pcb_solder_paste\"),shape:x(\"circle\"),pcb_solder_paste_id:T(\"pcb_solder_paste\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,radius:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),f3=M({type:x(\"pcb_solder_paste\"),shape:x(\"rect\"),pcb_solder_paste_id:T(\"pcb_solder_paste\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),y3=M({type:x(\"pcb_solder_paste\"),shape:x(\"pill\"),pcb_solder_paste_id:T(\"pcb_solder_paste\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),_3=M({type:x(\"pcb_solder_paste\"),shape:x(\"rotated_rect\"),pcb_solder_paste_id:T(\"pcb_solder_paste\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),ccw_rotation:R,layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),g3=M({type:x(\"pcb_solder_paste\"),shape:x(\"rotated_pill\"),pcb_solder_paste_id:T(\"pcb_solder_paste\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),ccw_rotation:Et,layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),x3=M({type:x(\"pcb_solder_paste\"),shape:x(\"oval\"),pcb_solder_paste_id:T(\"pcb_solder_paste\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),b3=yo.extend({type:x(\"pcb_solder_paste\"),pcb_solder_paste_id:T(\"pcb_solder_paste\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),holes:W(yo.shape.points).optional(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),ug=Wt([u3,f3,y3,_3,g3,x3,b3]).describe(\"Defines solderpaste on the PCB\");A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);var bs=M({type:x(\"pcb_soldermask_opening\"),pcb_soldermask_opening_id:T(\"pcb_soldermask_opening\"),layer:gt.pipe(Ut),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional()}),fg=ie(\"shape\",[gp.extend(bs.shape),ws.extend(bs.shape),xp.extend(bs.shape),yo.extend(bs.shape)]).describe(\"An explicit opening in top or bottom solder mask or flex coverlay, independent of pads. Removes mask without adding copper or solder paste.\");A(!0);var yg=M({type:x(\"pcb_text\"),pcb_text_id:T(\"pcb_text\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),text:h(),center:nt,layer:gt,width:K,height:K,lines:w(),align:ut([\"bottom-left\"])}).describe(\"Defines text on the PCB\");A(!0);var i_=R.pipe(w().finite().positive()),_g=M({route_type:x(\"wire\"),x:R,y:R,width:R,start_width:i_.optional(),end_width:i_.optional(),width_interpolation_mode:ut([\"linear\",\"quadratic\"]).optional(),copper_pour_id:h().optional(),is_inside_copper_pour:E().optional(),start_pcb_port_id:h().optional(),end_pcb_port_id:h().optional(),layer:gt}).superRefine((t,e)=\u003e{let r=[t.start_width,t.end_width,t.width_interpolation_mode].filter((n)=\u003en!==void 0).length;if(r===0)return;if(r!==3)e.addIssue({code:X.custom,message:\"Wire taper requires start_width, end_width and width_interpolation_mode together\"});if(t.width!==t.start_width)e.addIssue({code:X.custom,path:[\"start_width\"],message:\"start_width must equal width\"});if(!Number.isFinite(t.x)||!Number.isFinite(t.y))e.addIssue({code:X.custom,message:\"Tapered wire coordinates must be finite\"})}),gg=M({route_type:x(\"via\"),x:R,y:R,copper_pour_id:h().optional(),is_inside_copper_pour:E().optional(),hole_diameter:R.optional(),outer_diameter:R.optional(),tented_on_top:E().optional(),tented_on_bottom:E().optional(),from_layer:gt,to_layer:gt}),xg=M({route_type:x(\"through_pad\"),start:nt,end:nt,width:R,start_layer:gt,end_layer:gt,pcb_smtpad_id:h().optional(),pcb_plated_hole_id:h().optional()}),bg=Wt([_g,gg,xg]),vg=M({type:x(\"pcb_trace\"),source_trace_id:h().optional(),pcb_component_id:h().optional(),pcb_trace_id:T(\"pcb_trace\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),route_thickness_mode:ut([\"constant\",\"interpolated\"]).default(\"constant\").optional(),route_order_index:w().optional(),should_round_corners:E().optional(),trace_length:w().optional(),is_antenna_trace:E().optional(),highlight_color:h().optional(),route:W(bg).superRefine((t,e)=\u003e{for(let[r,n]of t.entries()){if(n.route_type!==\"wire\"||n.width_interpolation_mode===void 0)continue;let i=t[r+1],s=i?.route_type===\"through_pad\"?i.start:i,o=i?.route_type===\"wire\"?i.layer:i?.route_type===\"via\"?i.from_layer:i?.start_layer,c=s?Math.hypot(s.x-n.x,s.y-n.y):NaN;if(!Number.isFinite(c)||c\u003c=0||o!==n.layer)e.addIssue({code:X.custom,path:[r],message:\"Tapered wire must lead to a distinct finite next point on the same layer\"})}})}).describe(\"Defines a trace on the PCB\");A(!0);A(!0);var Sg=M({type:x(\"pcb_trace_warning\"),pcb_trace_warning_id:T(\"pcb_trace_warning\"),warning_type:x(\"pcb_trace_warning\").default(\"pcb_trace_warning\"),message:h(),center:nt.optional(),pcb_trace_id:h(),source_trace_id:h(),pcb_component_ids:W(h()),pcb_port_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Defines a trace warning on the PCB\");A(!0);var wg=M({type:x(\"pcb_trace_style_warning\"),pcb_trace_style_warning_id:T(\"pcb_trace_style_warning\"),warning_type:x(\"pcb_trace_style_warning\").default(\"pcb_trace_style_warning\"),message:h(),styling_issue_type:x(\"long_segment_at_odd_angle\"),pcb_trace_id:h(),source_trace_id:h().optional(),subcircuit_id:h().optional(),layer:gt,start_route_index:w().int().nonnegative(),end_route_index:w().int().nonnegative(),segment_start:nt,segment_end:nt,center:nt,segment_length:R,minimum_segment_length:R,angle_degrees:w().min(0).lt(360),nearest_allowed_angle_degrees:w().min(0).lt(360).multipleOf(45),angle_deviation_degrees:w().min(0).max(22.5),angle_tolerance_degrees:w().min(0).lt(22.5)}).describe(\"Warning for a long PCB trace segment whose direction deviates from a multiple of 45 degrees\");A(!0);var Ag=M({type:x(\"pcb_trace_too_long_error\"),pcb_trace_too_long_error_id:T(\"pcb_trace_too_long_error\"),error_type:x(\"pcb_trace_too_long_error\").default(\"pcb_trace_too_long_error\"),message:h(),pcb_trace_id:h(),source_net_id:h().optional(),source_trace_id:h().optional(),actual_trace_length:R,maximum_trace_length:R,subcircuit_id:h().optional()}).describe(\"Error emitted when a PCB trace is longer than its maximum allowed length\");A(!0);var Pg=Mt.extend({type:x(\"pcb_bus_length_skew_error\"),pcb_bus_length_skew_error_id:T(\"pcb_bus_length_skew_error\"),error_type:x(\"pcb_bus_length_skew_error\").default(\"pcb_bus_length_skew_error\"),source_bus_id:h(),source_trace_ids:W(h()),pcb_trace_ids:W(h()),actual_length_skew:w().nonnegative().finite(),maximum_length_skew:w().nonnegative().finite(),subcircuit_id:h().optional()});A(!0);var Bg=M({type:x(\"pcb_trace_too_long_warning\"),pcb_trace_too_long_warning_id:T(\"pcb_trace_too_long_warning\"),warning_type:x(\"pcb_trace_too_long_warning\").default(\"pcb_trace_too_long_warning\"),message:h(),pcb_trace_id:h(),source_net_id:h().optional(),source_trace_id:h().optional(),actual_trace_length:R,maximum_trace_length:R,subcircuit_id:h().optional()}).describe(\"Warning emitted when a PCB trace is longer than its maximum allowed length\");A(!0);var Ig=M({type:x(\"pcb_trace_too_many_vias_warning\"),pcb_trace_too_many_vias_warning_id:T(\"pcb_trace_too_many_vias_warning\"),warning_type:x(\"pcb_trace_too_many_vias_warning\").default(\"pcb_trace_too_many_vias_warning\"),message:h(),pcb_trace_id:h(),source_net_id:h().optional(),source_trace_id:h().optional(),actual_via_count:w().int().nonnegative(),maximum_via_count:w().int().nonnegative(),subcircuit_id:h().optional()}).describe(\"Warning emitted when a PCB trace has more vias than its maximum allowed count\");A(!0);var Cr=Mt.extend({type:x(\"pcb_bus_routing_constraint_error\"),pcb_bus_routing_constraint_error_id:T(\"pcb_bus_routing_constraint_error\"),error_type:x(\"pcb_bus_routing_constraint_error\").default(\"pcb_bus_routing_constraint_error\"),source_bus_id:h(),source_trace_ids:W(h()).min(1),pcb_trace_ids:W(h()),subcircuit_id:h().optional()}),Fg=ie(\"routing_rule\",[Cr.extend({routing_rule:x(\"length_skew\"),actual_length_skew:w().nonnegative().finite(),maximum_length_skew:w().nonnegative().finite()}),Cr.extend({routing_rule:x(\"min_length\"),actual_trace_length:w().nonnegative().finite(),minimum_trace_length:w().finite()}),Cr.extend({routing_rule:x(\"max_length\"),actual_trace_length:w().nonnegative().finite(),maximum_trace_length:w().finite()}),Cr.extend({routing_rule:x(\"target_length\"),actual_trace_length:w().nonnegative().finite(),target_trace_length:w().finite(),length_tolerance:w().nonnegative().finite()}),Cr.extend({routing_rule:x(\"pcb_trace_spacing\"),other_pcb_trace_id:h(),other_source_trace_id:h().optional(),actual_centerline_spacing:w().nonnegative().finite(),minimum_centerline_spacing:w().positive().finite()}),Cr.extend({routing_rule:x(\"pcb_spacing_to_other_signals\"),other_pcb_trace_id:h(),other_source_trace_id:h().optional(),actual_centerline_spacing:w().nonnegative().finite(),minimum_centerline_spacing:w().positive().finite()}),Cr.extend({routing_rule:x(\"impedance_target\"),target_impedance:w().positive().finite(),minimum_impedance:w().positive().finite().optional(),maximum_impedance:w().positive().finite().optional()})]).superRefine((t,e)=\u003e{if(t.routing_rule!==\"impedance_target\")return;if(t.minimum_impedance===void 0\u0026\u0026t.maximum_impedance===void 0)e.addIssue({code:X.custom,path:[\"minimum_impedance\"],message:\"Provide an impedance bound\"});if(t.minimum_impedance!==void 0\u0026\u0026t.maximum_impedance!==void 0\u0026\u0026t.minimum_impedance\u003et.maximum_impedance)e.addIssue({code:X.custom,path:[\"maximum_impedance\"],message:\"Impedance bounds must be ordered\"})}).describe(\"A declared bus or differential-pair routing constraint is violated.\");A(!0);var mo=M({type:x(\"pcb_bus_routing_constraint_warning\"),pcb_bus_routing_constraint_warning_id:T(\"pcb_bus_routing_constraint_warning\"),warning_type:x(\"pcb_bus_routing_constraint_warning\").default(\"pcb_bus_routing_constraint_warning\"),source_bus_id:h(),source_trace_ids:W(h()).min(1),pcb_trace_ids:W(h()),message:h(),subcircuit_id:h().optional()}).describe(\"A declared bus or pair constraint could not be verified; this is not a pass.\"),Mg=ie(\"routing_rule\",[mo.extend({routing_rule:x(\"route_geometry\")}),mo.extend({routing_rule:x(\"reference_geometry\")}),mo.extend({routing_rule:x(\"spacing_geometry\")}),mo.extend({routing_rule:x(\"target_length\")}),mo.extend({routing_rule:x(\"physical_impedance\")})]);A(!0);var Cg=Mt.extend({type:x(\"pcb_trace_error\"),pcb_trace_error_id:T(\"pcb_trace_error\"),error_type:x(\"pcb_trace_error\").default(\"pcb_trace_error\"),center:nt.optional(),pcb_trace_id:h(),source_trace_id:h(),pcb_component_ids:W(h()),pcb_port_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Defines a trace error on the PCB\");A(!0);var kg=Mt.extend({type:x(\"pcb_trace_missing_error\"),pcb_trace_missing_error_id:T(\"pcb_trace_missing_error\"),error_type:x(\"pcb_trace_missing_error\").default(\"pcb_trace_missing_error\"),center:nt.optional(),source_trace_id:h(),pcb_component_ids:W(h()),pcb_port_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Defines an error when a source trace has no corresponding PCB trace\");A(!0);var Ng=Mt.extend({type:x(\"pcb_port_not_matched_error\"),pcb_error_id:T(\"pcb_error\"),error_type:x(\"pcb_port_not_matched_error\").default(\"pcb_port_not_matched_error\"),pcb_component_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Defines a trace error on the PCB where a port is not matched\");A(!0);var Yg=Mt.extend({type:x(\"pcb_port_not_connected_error\"),pcb_port_not_connected_error_id:T(\"pcb_port_not_connected_error\"),error_type:x(\"pcb_port_not_connected_error\").default(\"pcb_port_not_connected_error\"),pcb_port_ids:W(h()),pcb_component_ids:W(h()),subcircuit_id:h().optional()}).describe(\"Defines an error when a pcb port is not connected to any trace\");A(!0);var Lg=M({type:x(\"pcb_net\"),pcb_net_id:T(\"pcb_net\"),source_net_id:h().optional(),highlight_color:h().optional()}).describe(\"Defines a net on the PCB\");A(!0);var Tg=M({type:x(\"pcb_via\"),pcb_via_id:T(\"pcb_via\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),x:R,y:R,outer_diameter:R.default(\"0.6mm\"),hole_diameter:R.default(\"0.25mm\"),topmost_drill_layer:gt.optional(),bottommost_drill_layer:gt.optional(),through_hole:E().optional(),from_layer:gt.optional(),to_layer:gt.optional(),layers:W(gt),pcb_port_ids:W(h()).optional(),pcb_trace_id:h().optional(),source_trace_id:h().optional(),source_net_id:h().min(1).optional(),net_is_assignable:E().optional(),net_assigned:E().optional(),is_tented:E().optional(),tented_on_top:E().optional(),tented_on_bottom:E().optional()}).transform(({is_tented:t,...e})=\u003e{if(t!==void 0)e.tented_on_top??=t,e.tented_on_bottom??=t;return e}).describe(\"Defines a via on the PCB\");A(!0);var Eg=M({type:x(\"pcb_board\"),pcb_board_id:T(\"pcb_board\"),pcb_panel_id:h().optional(),carrier_pcb_board_id:h().optional(),is_subcircuit:E().optional(),subcircuit_id:h().optional(),is_mounted_to_carrier_board:E().optional(),is_via_in_pad_allowed:E().optional(),default_via_tented_on_top:E().optional(),default_via_tented_on_bottom:E().optional(),default_via_plugged:E().optional(),width:K.optional(),height:K.optional(),center:nt,display_offset_x:h().optional().describe(\"How to display the x offset for this board, usually corresponding with how the user specified it\"),display_offset_y:h().optional().describe(\"How to display the y offset for this board, usually corresponding with how the user specified it\"),thickness:K.optional().default(1.4),num_layers:w().optional().default(4),allow_blind_and_buried_vias:E().optional().describe(\"Whether autorouters may generate blind and buried vias. False restricts newly generated vias to the full board stack.\"),outline:W(nt).optional(),shape:ut([\"rect\",\"polygon\"]).optional(),material:ut([\"fr4\",\"fr1\",\"flex\"]).default(\"fr4\"),solder_mask_color:h().optional(),silkscreen_color:h().optional(),anchor_position:nt.optional(),anchor_alignment:Ve.optional(),position_mode:ut([\"relative_to_panel_anchor\",\"none\"]).optional()}).merge(q0).describe(\"Defines the board outline of the PCB\");A(!0);var o_=nt.extend({x:K.pipe(w().finite()),y:K.pipe(w().finite())}),Rg=M({type:x(\"pcb_bend\"),pcb_bend_id:T(\"pcb_bend\"),pcb_board_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),start:o_,end:o_,bend_angle:Et.pipe(w().finite()),bend_radius:K.pipe(w().finite().positive()),bend_side:ut([\"left\",\"right\"])}).refine(({start:t,end:e})=\u003et.x!==e.x||t.y!==e.y,{message:\"Bend centerline endpoints must be distinct\",path:[\"end\"]}).describe(\"Defines a finite-radius bend on a flat PCB for runtime CAD folding\");A(!0);var up=K.pipe(w().finite().positive()),Og=nt.extend({x:K.pipe(w().finite()),y:K.pipe(w().finite())}),Wg=M({type:x(\"pcb_stiffener\"),pcb_stiffener_id:T(\"pcb_stiffener\"),pcb_board_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),layer:ut([\"top\",\"bottom\"]),material:ut([\"fr4\",\"polyimide\",\"stainless_steel\",\"aluminum\"]),thickness:up,adhesive_thickness:K.pipe(w().finite().nonnegative()).optional()}),$g=Wg.extend({shape:x(\"rect\"),center:Og,rotation:Et.pipe(w().finite()).optional(),width:up,height:up,outline:ho().optional()});A(!0);var jg=Wg.extend({shape:x(\"polygon\"),outline:W(Og).min(3).refine((t)=\u003e{let e=t.reduce((r,n,i)=\u003e{let s=t[(i+1)%t.length];return r+n.x*s.y-s.x*n.y},0);return Number.isFinite(e)\u0026\u0026e!==0},\"Stiffener outline must enclose a nonzero area\"),center:ho().optional(),rotation:ho().optional(),width:ho().optional(),height:ho().optional()});A(!0);var Xg=ie(\"shape\",[$g,jg]).describe(\"Defines bonded mechanical PCB reinforcement without adding copper layers\");A(!0);var Dg=M({type:x(\"pcb_panel\"),pcb_panel_id:T(\"pcb_panel\"),width:K,height:K,center:nt,thickness:K.optional().default(1.4),covered_with_solder_mask:E().optional().default(!0)}).describe(\"Defines a PCB panel that can contain multiple boards\");A(!0);var Vg=Mt.extend({type:x(\"pcb_placement_error\"),pcb_placement_error_id:T(\"pcb_placement_error\"),error_type:x(\"pcb_placement_error\").default(\"pcb_placement_error\"),subcircuit_id:h().optional()}).describe(\"Defines a placement error on the PCB\");A(!0);var zg=Mt.extend({type:x(\"pcb_packing_error\"),pcb_packing_error_id:T(\"pcb_packing_error\"),error_type:x(\"pcb_packing_error\").default(\"pcb_packing_error\"),pcb_group_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Defines a failure to pack PCB components within layout bounds\");A(!0);var Ug=Mt.extend({type:x(\"pcb_panelization_placement_error\"),pcb_panelization_placement_error_id:T(\"pcb_panelization_placement_error\"),error_type:x(\"pcb_panelization_placement_error\").default(\"pcb_panelization_placement_error\"),pcb_panel_id:h().optional(),pcb_board_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Defines a panelization placement error on the PCB\");A(!0);var Gg=M({type:x(\"pcb_trace_hint\"),pcb_trace_hint_id:T(\"pcb_trace_hint\"),pcb_port_id:h(),pcb_component_id:h(),route:W(Z0),subcircuit_id:h().optional()}).describe(\"A hint that can be used during generation of a PCB trace\");A(!0);var Hg=M({type:x(\"pcb_silkscreen_line\"),pcb_silkscreen_line_id:T(\"pcb_silkscreen_line\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),stroke_width:R.default(\"0.1mm\"),x1:R,y1:R,x2:R,y2:R,layer:Ut}).describe(\"Defines a silkscreen line on the PCB\");A(!0);var Qg=M({type:x(\"pcb_silkscreen_path\"),pcb_silkscreen_path_id:T(\"pcb_silkscreen_path\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,route:W(nt),stroke_width:K}).describe(\"Defines a silkscreen path on the PCB\");A(!0);var Zg=M({type:x(\"pcb_silkscreen_text\"),pcb_silkscreen_text_id:T(\"pcb_silkscreen_text\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),font:x(\"tscircuit2024\").default(\"tscircuit2024\"),font_size:R.default(\"0.2mm\"),pcb_component_id:h(),text:h(),is_knockout:E().default(!1).optional(),knockout_padding:M({left:K,top:K,bottom:K,right:K}).default({left:\"0.2mm\",top:\"0.2mm\",bottom:\"0.2mm\",right:\"0.2mm\"}).optional(),ccw_rotation:w().optional(),layer:gt,is_mirrored:E().default(!1).optional(),anchor_position:nt.default({x:0,y:0}),anchor_alignment:Ve.default(\"center\")}).describe(\"Defines silkscreen text on the PCB\");A(!0);var qg=M({type:x(\"pcb_copper_text\"),pcb_copper_text_id:T(\"pcb_copper_text\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),font:x(\"tscircuit2024\").default(\"tscircuit2024\"),font_size:R.default(\"0.2mm\"),pcb_component_id:h(),text:h(),is_knockout:E().default(!1).optional(),knockout_padding:M({left:K,top:K,bottom:K,right:K}).default({left:\"0.2mm\",top:\"0.2mm\",bottom:\"0.2mm\",right:\"0.2mm\"}).optional(),ccw_rotation:w().optional(),layer:gt,is_mirrored:E().default(!1).optional(),anchor_position:nt.default({x:0,y:0}),anchor_alignment:Ve.default(\"center\")}).describe(\"Defines copper text on the PCB\");A(!0);var Jg=M({type:x(\"pcb_silkscreen_rect\"),pcb_silkscreen_rect_id:T(\"pcb_silkscreen_rect\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:gt,stroke_width:K.default(\"1mm\"),corner_radius:K.optional(),is_filled:E().default(!0).optional(),has_stroke:E().optional(),is_stroke_dashed:E().optional(),ccw_rotation:w().optional()}).describe(\"Defines a silkscreen rect on the PCB\");A(!0);var Kg=M({type:x(\"pcb_silkscreen_circle\"),pcb_silkscreen_circle_id:T(\"pcb_silkscreen_circle\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius:K,layer:Ut,stroke_width:K.default(\"1mm\"),is_filled:E().optional()}).describe(\"Defines a silkscreen circle on the PCB\");A(!0);var tx=M({type:x(\"pcb_silkscreen_oval\"),pcb_silkscreen_oval_id:T(\"pcb_silkscreen_oval\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius_x:R,radius_y:R,layer:Ut,ccw_rotation:Et.optional()}).describe(\"Defines a silkscreen oval on the PCB\");A(!0);var v3=M({type:x(\"pcb_silkscreen_graphic\"),pcb_silkscreen_graphic_id:T(\"pcb_silkscreen_graphic\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,image_asset:_o.optional()}),ex=v3.extend({shape:x(\"brep\"),brep_shape:Hp}).describe(\"Defines a BRep silkscreen graphic on the PCB\");A(!0);var rx=ie(\"shape\",[ex]).describe(\"Defines a silkscreen graphic on the PCB\");A(!0);var nx=M({type:x(\"pcb_silkscreen_pill\"),pcb_silkscreen_pill_id:T(\"pcb_silkscreen_pill\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:gt,ccw_rotation:w().optional()}).describe(\"Defines a silkscreen pill on the PCB\");A(!0);var ix=M({type:x(\"pcb_fabrication_note_text\"),pcb_fabrication_note_text_id:T(\"pcb_fabrication_note_text\"),subcircuit_id:h().optional(),pcb_group_id:h().optional(),font:x(\"tscircuit2024\").default(\"tscircuit2024\"),font_size:R.default(\"1mm\"),pcb_component_id:h(),text:h(),ccw_rotation:w().optional(),layer:Ut,anchor_position:nt.default({x:0,y:0}),anchor_alignment:ut([\"center\",\"top_left\",\"top_right\",\"bottom_left\",\"bottom_right\"]).default(\"center\"),color:h().optional()}).describe(\"Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators\");A(!0);var ox=M({type:x(\"pcb_fabrication_note_path\"),pcb_fabrication_note_path_id:T(\"pcb_fabrication_note_path\"),pcb_component_id:h(),subcircuit_id:h().optional(),layer:gt,route:W(nt),stroke_width:K,color:h().optional(),is_filled:E().optional(),has_stroke:E().optional()}).describe(\"Defines a fabrication path on the PCB for fabricators or assemblers\");A(!0);var sx=M({type:x(\"pcb_fabrication_note_rect\"),pcb_fabrication_note_rect_id:T(\"pcb_fabrication_note_rect\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:Ut,stroke_width:K.default(\"0.1mm\"),corner_radius:K.optional(),is_filled:E().optional(),has_stroke:E().optional(),is_stroke_dashed:E().optional(),color:h().optional()}).describe(\"Defines a fabrication note rectangle on the PCB\");A(!0);var ax=M({type:x(\"pcb_fabrication_note_dimension\"),pcb_fabrication_note_dimension_id:T(\"pcb_fabrication_note_dimension\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,from:nt,to:nt,text:h().optional(),text_ccw_rotation:w().optional(),offset:K.optional(),offset_distance:K.optional(),offset_direction:M({x:w(),y:w()}).optional(),font:x(\"tscircuit2024\").default(\"tscircuit2024\"),font_size:K.default(\"1mm\"),color:h().optional(),arrow_size:K.default(\"1mm\")}).describe(\"Defines a measurement annotation within PCB fabrication notes\");A(!0);var cx=M({type:x(\"pcb_note_text\"),pcb_note_text_id:T(\"pcb_note_text\"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),font:x(\"tscircuit2024\").default(\"tscircuit2024\"),font_size:R.default(\"1mm\"),text:h().optional(),anchor_position:nt.default({x:0,y:0}),anchor_alignment:ut([\"center\",\"top_left\",\"top_right\",\"bottom_left\",\"bottom_right\"]).default(\"center\"),layer:Ut.default(\"top\"),is_mirrored_from_top_view:E().optional(),color:h().optional()}).describe(\"Defines a documentation note in text on the PCB\");A(!0);var lx=M({type:x(\"pcb_note_rect\"),pcb_note_rect_id:T(\"pcb_note_rect\"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),text:h().optional(),center:nt,width:K,height:K,layer:Ut.default(\"top\"),stroke_width:K.default(\"0.1mm\"),corner_radius:K.optional(),is_filled:E().optional(),has_stroke:E().optional(),is_stroke_dashed:E().optional(),color:h().optional()}).describe(\"Defines a rectangular documentation note on the PCB\");A(!0);var px=M({type:x(\"pcb_note_path\"),pcb_note_path_id:T(\"pcb_note_path\"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),text:h().optional(),route:W(nt),layer:Ut.default(\"top\"),stroke_width:K.default(\"0.1mm\"),color:h().optional()}).describe(\"Defines a polyline documentation note on the PCB\");A(!0);var hx=M({type:x(\"pcb_note_line\"),pcb_note_line_id:T(\"pcb_note_line\"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),text:h().optional(),x1:R,y1:R,x2:R,y2:R,layer:Ut.default(\"top\"),stroke_width:R.default(\"0.1mm\"),color:h().optional(),is_dashed:E().optional()}).describe(\"Defines a straight documentation note line on the PCB\");A(!0);var dx=M({type:x(\"pcb_note_dimension\"),pcb_note_dimension_id:T(\"pcb_note_dimension\"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),from:nt,to:nt,text:h().optional(),text_ccw_rotation:w().optional(),offset_distance:K.optional(),offset_direction:M({x:w(),y:w()}).optional(),font:x(\"tscircuit2024\").default(\"tscircuit2024\"),font_size:K.default(\"1mm\"),layer:Ut.default(\"top\"),color:h().optional(),arrow_size:K.default(\"1mm\")}).describe(\"Defines a measurement annotation within PCB documentation notes\");A(!0);var mx=Mt.extend({type:x(\"pcb_footprint_overlap_error\"),pcb_error_id:T(\"pcb_error\"),error_type:x(\"pcb_footprint_overlap_error\").default(\"pcb_footprint_overlap_error\"),pcb_smtpad_ids:W(h()).optional(),pcb_plated_hole_ids:W(h()).optional(),pcb_hole_ids:W(h()).optional(),pcb_keepout_ids:W(h()).optional()}).describe(\"Error emitted when a pcb footprint overlaps with another element\");A(!0);var ux=Mt.extend({type:x(\"pcb_courtyard_overlap_error\"),pcb_error_id:T(\"pcb_error\"),error_type:x(\"pcb_courtyard_overlap_error\").default(\"pcb_courtyard_overlap_error\"),pcb_component_ids:t_([h(),h()])}).describe(\"Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another\");A(!0);var fx=M({type:x(\"pcb_keepout\"),shape:x(\"outline\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),outline:W(nt).min(2),stroke_width:K,pcb_keepout_id:h(),layers:W(h()),description:h().optional(),excluded_pcb_component_ids:W(h()).optional(),warning_only:E().optional(),allow_traces:E().optional(),allow_placements:E().optional()}),yx=M({type:x(\"pcb_keepout\"),shape:x(\"rect\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:R,height:R,pcb_keepout_id:h(),layers:W(h()),description:h().optional(),excluded_pcb_component_ids:W(h()).optional(),warning_only:E().optional(),allow_traces:E().optional(),allow_placements:E().optional()}).or(M({type:x(\"pcb_keepout\"),shape:x(\"circle\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius:R,pcb_keepout_id:h(),layers:W(h()),description:h().optional(),excluded_pcb_component_ids:W(h()).optional(),warning_only:E().optional(),allow_traces:E().optional(),allow_placements:E().optional()})).or(fx);A(!0);A(!0);var _x=M({type:x(\"pcb_keepout_overlap_warning\"),pcb_keepout_overlap_warning_id:T(\"pcb_keepout_overlap_warning\"),warning_type:x(\"pcb_keepout_overlap_warning\").default(\"pcb_keepout_overlap_warning\"),message:h(),pcb_keepout_id:h(),pcb_component_ids:W(h()).optional(),pcb_trace_ids:W(h()).optional(),pcb_smtpad_ids:W(h()).optional(),pcb_plated_hole_ids:W(h()).optional(),pcb_via_ids:W(h()).optional(),center:nt.optional(),subcircuit_id:h().optional()}).describe(\"Warning emitted when copper overlaps a PCB keepout with warning_only enabled\");A(!0);var Fs=M({type:x(\"pcb_cutout\"),pcb_cutout_id:T(\"pcb_cutout\"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_board_id:h().optional(),pcb_panel_id:h().optional()}),gx=Fs.extend({shape:x(\"rect\"),center:nt,width:K,height:K,rotation:Et.optional(),corner_radius:K.optional()});A(!0);var xx=Fs.extend({shape:x(\"circle\"),center:nt,radius:K});A(!0);var bx=Fs.extend({shape:x(\"polygon\"),points:W(nt)});A(!0);var vx=Fs.extend({shape:x(\"path\"),route:W(nt),slot_width:K,slot_length:K.optional(),space_between_slots:K.optional(),slot_corner_radius:K.optional()});A(!0);var Sx=ie(\"shape\",[gx,xx,bx,vx]).describe(\"Defines a cutout on the PCB, removing board material.\");A(!0);var wx=Mt.extend({type:x(\"pcb_missing_footprint_error\"),pcb_missing_footprint_error_id:T(\"pcb_missing_footprint_error\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),error_type:x(\"pcb_missing_footprint_error\").default(\"pcb_missing_footprint_error\"),source_component_id:h()}).describe(\"Defines a missing footprint error on the PCB\");A(!0);var Ax=Mt.extend({type:x(\"external_footprint_load_error\"),external_footprint_load_error_id:T(\"external_footprint_load_error\"),pcb_component_id:h(),source_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),footprinter_string:h().optional(),error_type:x(\"external_footprint_load_error\").default(\"external_footprint_load_error\")}).describe(\"Defines an error when an external footprint fails to load\");A(!0);var Px=Mt.extend({type:x(\"circuit_json_footprint_load_error\"),circuit_json_footprint_load_error_id:T(\"circuit_json_footprint_load_error\"),pcb_component_id:h(),source_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),error_type:x(\"circuit_json_footprint_load_error\").default(\"circuit_json_footprint_load_error\"),circuit_json:W(Jy()).optional()}).describe(\"Defines an error when a circuit JSON footprint fails to load\");A(!0);var Bx=M({type:x(\"pcb_group\"),pcb_group_id:T(\"pcb_group\"),source_group_id:h(),is_subcircuit:E().optional(),subcircuit_id:h().optional(),width:K.optional(),height:K.optional(),center:nt,display_offset_x:h().optional().describe(\"How to display the x offset for this group, usually corresponding with how the user specified it\"),display_offset_y:h().optional().describe(\"How to display the y offset for this group, usually corresponding with how the user specified it\"),outline:W(nt).optional(),anchor_position:nt.optional(),anchor_alignment:Ve.default(\"center\"),position_mode:ut([\"packed\",\"relative_to_group_anchor\",\"none\"]).optional(),positioned_relative_to_pcb_group_id:h().optional(),positioned_relative_to_pcb_board_id:h().optional(),pcb_component_ids:W(h()),child_layout_mode:ut([\"packed\",\"none\"]).optional(),name:h().optional(),description:h().optional(),layout_mode:h().optional(),autorouter_configuration:M({trace_clearance:K}).optional(),autorouter_used_string:h().optional()}).describe(\"Defines a group of components on the PCB\");A(!0);var Ix=Mt.extend({type:x(\"pcb_autorouting_error\"),pcb_error_id:T(\"pcb_autorouting_error\"),error_type:x(\"pcb_autorouting_error\").default(\"pcb_autorouting_error\"),subcircuit_id:h().optional()}).describe(\"The autorouting has failed to route a portion of the board\");A(!0);var Fx=Mt.extend({type:x(\"pcb_preflight_routing_error\"),pcb_preflight_routing_error_id:T(\"pcb_preflight_routing_error\"),error_type:x(\"pcb_preflight_routing_error\").default(\"pcb_preflight_routing_error\"),error_code:h(),subcircuit_id:h().optional(),pcb_group_id:h().optional(),routing_phase_index:w().int().optional(),phase_name:h().optional(),source_trace_ids:W(h()).optional(),pcb_component_ids:W(h()).optional(),pcb_port_ids:W(h()).optional(),related_error_ids:W(h()).optional(),measurements:Qn(w().finite()).optional()});A(!0);var Mx=M({type:x(\"pcb_manual_edit_conflict_warning\"),pcb_manual_edit_conflict_warning_id:T(\"pcb_manual_edit_conflict_warning\"),warning_type:x(\"pcb_manual_edit_conflict_warning\").default(\"pcb_manual_edit_conflict_warning\"),message:h(),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),source_component_id:h()}).describe(\"Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates\");A(!0);var s_=ut([\"x-\",\"x+\",\"y+\",\"y-\"]),Cx=M({type:x(\"pcb_connector_not_in_accessible_orientation_warning\"),pcb_connector_not_in_accessible_orientation_warning_id:T(\"pcb_connector_not_in_accessible_orientation_warning\"),warning_type:x(\"pcb_connector_not_in_accessible_orientation_warning\").default(\"pcb_connector_not_in_accessible_orientation_warning\"),message:h(),pcb_component_id:h(),source_component_id:h().optional(),pcb_board_id:h().optional(),facing_direction:s_,recommended_facing_direction:s_,subcircuit_id:h().optional()}).describe(\"Warning emitted when a connector PCB component is facing inward toward the board and should be reoriented to an outward-facing direction\");A(!0);var kx=M({type:x(\"pcb_component_missing_courtyard_warning\"),pcb_component_missing_courtyard_warning_id:T(\"pcb_component_missing_courtyard_warning\"),warning_type:x(\"pcb_component_missing_courtyard_warning\").default(\"pcb_component_missing_courtyard_warning\"),message:h(),pcb_component_id:h(),source_component_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Warning emitted when a PCB component has no courtyard geometry\");A(!0);var Nx=M({type:x(\"supplier_footprint_mismatch_warning\"),supplier_footprint_mismatch_warning_id:T(\"supplier_footprint_mismatch_warning\"),warning_type:x(\"supplier_footprint_mismatch_warning\").default(\"supplier_footprint_mismatch_warning\"),message:h(),source_component_id:h(),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),supplier_name:Kn.optional(),supplier_part_number:h().optional(),supplier_footprint_url:h().optional(),footprint_copper_intersection_over_union:w()}).describe(\"Warning emitted when a supplier part footprint does not match the expected footprint\");A(!0);var Yx=M({type:x(\"pcb_fabricator_extra_charge_warning\"),pcb_fabricator_extra_charge_warning_id:T(\"pcb_fabricator_extra_charge_warning\"),warning_type:x(\"pcb_fabricator_extra_charge_warning\").default(\"pcb_fabricator_extra_charge_warning\"),message:h(),fabricator_preset:h(),pcb_board_id:h().optional(),pcb_via_ids:W(h()).optional(),subcircuit_id:h().optional()}).describe(\"Warning that a design feature incurs an extra charge for the selected fabricator preset, such as via hole diameters below 0.3 mm with JLCPCB economy or standard presets.\");A(!0);var Lx=M({type:x(\"pcb_breakout_point\"),pcb_breakout_point_id:T(\"pcb_breakout_point\"),pcb_group_id:h(),subcircuit_id:h().optional(),source_trace_id:h().optional(),source_port_id:h().optional(),source_net_id:h().optional(),layer:gt.optional(),x:R,y:R}).describe(\"Defines a routing target within a pcb_group for a source_trace or source_net\");A(!0);var Tx=M({type:x(\"pcb_ground_plane\"),pcb_ground_plane_id:T(\"pcb_ground_plane\"),source_pcb_ground_plane_id:h(),source_net_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Defines a ground plane on the PCB\");A(!0);var Ex=M({type:x(\"pcb_ground_plane_region\"),pcb_ground_plane_region_id:T(\"pcb_ground_plane_region\"),pcb_ground_plane_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:gt,points:W(nt)}).describe(\"Defines a polygon region of a ground plane\");A(!0);var Rx=M({type:x(\"pcb_thermal_spoke\"),pcb_thermal_spoke_id:T(\"pcb_thermal_spoke\"),pcb_ground_plane_id:h(),shape:h(),spoke_count:w(),spoke_thickness:R,spoke_inner_diameter:R,spoke_outer_diameter:R,pcb_plated_hole_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Pattern for connecting a ground plane to a plated hole\");A(!0);var Qp=M({type:x(\"pcb_copper_pour\"),pcb_copper_pour_id:T(\"pcb_copper_pour\"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:gt,source_net_id:h().optional(),covered_with_solder_mask:E().optional().default(!0)}),Ox=Qp.extend({shape:x(\"rect\"),center:nt,width:K,height:K,rotation:Et.optional()});A(!0);var Wx=Qp.extend({shape:x(\"brep\"),brep_shape:Hp});A(!0);var $x=Qp.extend({shape:x(\"polygon\"),points:W(nt)});A(!0);var jx=ie(\"shape\",[Ox,Wx,$x]).describe(\"Defines a copper pour on the PCB.\");A(!0);var Xx=Mt.extend({type:x(\"pcb_component_outside_board_error\"),pcb_component_outside_board_error_id:T(\"pcb_component_outside_board_error\"),error_type:x(\"pcb_component_outside_board_error\").default(\"pcb_component_outside_board_error\"),pcb_component_id:h(),pcb_board_id:h(),component_center:nt,component_bounds:M({min_x:w(),max_x:w(),min_y:w(),max_y:w()}),subcircuit_id:h().optional(),source_component_id:h().optional()}).describe(\"Error emitted when a PCB component is placed outside the board boundaries\");A(!0);var Dx=Mt.extend({type:x(\"pcb_component_not_on_board_edge_error\"),pcb_component_not_on_board_edge_error_id:T(\"pcb_component_not_on_board_edge_error\"),error_type:x(\"pcb_component_not_on_board_edge_error\").default(\"pcb_component_not_on_board_edge_error\"),pcb_component_id:h(),pcb_board_id:h(),component_center:nt,pad_to_nearest_board_edge_distance:w(),source_component_id:h().optional(),subcircuit_id:h().optional()}).describe(\"Error emitted when a component that must be placed on the board edge is centered away from the edge\");A(!0);var Vx=Mt.extend({type:x(\"pcb_component_invalid_layer_error\"),pcb_component_invalid_layer_error_id:T(\"pcb_component_invalid_layer_error\"),error_type:x(\"pcb_component_invalid_layer_error\").default(\"pcb_component_invalid_layer_error\"),pcb_component_id:h().optional(),source_component_id:h(),layer:gt,subcircuit_id:h().optional()}).describe(\"Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)\");A(!0);var zx=Mt.extend({type:x(\"pcb_via_clearance_error\"),pcb_error_id:T(\"pcb_error\"),error_type:x(\"pcb_via_clearance_error\").default(\"pcb_via_clearance_error\"),pcb_via_ids:W(h()).min(2),minimum_clearance:R.optional(),actual_clearance:R.optional(),pcb_center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe(\"Error emitted when vias are closer than the allowed clearance\");A(!0);var Ux=Mt.extend({type:x(\"pcb_via_trace_clearance_error\"),pcb_via_trace_clearance_error_id:T(\"pcb_via_trace_clearance_error\"),error_type:x(\"pcb_via_trace_clearance_error\").default(\"pcb_via_trace_clearance_error\"),pcb_via_id:h(),pcb_trace_id:h(),minimum_clearance:R.optional(),actual_clearance:R.optional(),center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe(\"Error emitted when a via and trace are closer than the allowed clearance\");A(!0);var Gx=Mt.extend({type:x(\"pcb_pad_pad_clearance_error\"),pcb_pad_pad_clearance_error_id:T(\"pcb_pad_pad_clearance_error\"),error_type:x(\"pcb_pad_pad_clearance_error\").default(\"pcb_pad_pad_clearance_error\"),pcb_pad_ids:W(h()).min(2),minimum_clearance:R.optional(),actual_clearance:R.optional(),center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe(\"Error emitted when pads are closer than the allowed clearance\");A(!0);var Hx=Mt.extend({type:x(\"pcb_pad_trace_clearance_error\"),pcb_pad_trace_clearance_error_id:T(\"pcb_pad_trace_clearance_error\"),error_type:x(\"pcb_pad_trace_clearance_error\").default(\"pcb_pad_trace_clearance_error\"),pcb_pad_id:h(),pcb_trace_id:h(),minimum_clearance:R.optional(),actual_clearance:R.optional(),center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe(\"Error emitted when a pad and trace are closer than allowed clearance\");A(!0);var Qx=M({type:x(\"pcb_courtyard_rect\"),pcb_courtyard_rect_id:T(\"pcb_courtyard_rect\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:Ut,ccw_rotation:Et.optional(),color:h().optional()}).describe(\"Defines a courtyard rectangle on the PCB\");A(!0);var Zx=M({type:x(\"pcb_courtyard_outline\"),pcb_courtyard_outline_id:T(\"pcb_courtyard_outline\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,outline:W(nt).min(2)}).describe(\"Defines a courtyard outline on the PCB\");A(!0);var qx=M({type:x(\"pcb_courtyard_polygon\"),pcb_courtyard_polygon_id:T(\"pcb_courtyard_polygon\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,points:W(nt).min(3),color:h().optional()}).describe(\"Defines a courtyard polygon on the PCB\");A(!0);var Jx=M({type:x(\"pcb_courtyard_circle\"),pcb_courtyard_circle_id:T(\"pcb_courtyard_circle\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius:K,layer:Ut,color:h().optional()}).describe(\"Defines a courtyard circle on the PCB\");A(!0);var Kx=M({type:x(\"pcb_courtyard_pill\"),pcb_courtyard_pill_id:T(\"pcb_courtyard_pill\"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,radius:K,layer:Ut,color:h().optional()}).describe(\"Defines a courtyard pill on the PCB\");A(!0);var S3=[\"obj\",\"stl\",\"3mf\",\"gltf\",\"glb\",\"step\",\"wrl\"],tb=[\"x+\",\"x-\",\"y+\",\"y-\",\"z+\",\"z-\"],w3={obj:\"z+\",stl:\"z+\",\"3mf\":\"z+\",gltf:\"y+\",glb:\"y+\",step:\"z+\",wrl:\"y+\"},eb=M({type:x(\"cad_component\"),cad_component_id:h(),pcb_component_id:h().optional().describe(\"Optional PCB component reference; omit for CAD geometry without a PCB component\"),source_component_id:h(),position:ge,rotation:ge.optional(),is_on_folded_board:E().optional().describe(\"True when position and rotation describe the assembled folded board pose. False or omitted means the flat board pose. PCB records remain flat; pcb_component_id identifies the flat mount and owning board for reversible transforms.\"),size:ge.optional(),layer:gt.optional(),subcircuit_id:h().optional(),footprinter_string:h().optional(),model_obj_url:h().optional(),model_stl_url:h().optional(),model_3mf_url:h().optional(),model_gltf_url:h().optional(),model_glb_url:h().optional(),model_step_url:h().optional(),model_wrl_url:h().optional(),model_asset:_o.optional(),model_unit_to_mm_scale_factor:w().optional(),model_board_normal_direction:ut(tb).optional().describe(`The direction in the model's coordinate space that is considered \"up\" or \"coming out of the board surface\"`),model_origin_position:ge.optional(),model_origin_alignment:ut([\"unknown\",\"center\",\"center_of_component_on_board_surface\",\"bottom_center_of_component\"]).optional(),model_object_fit:ut([\"contain_within_bounds\",\"fill_bounds\"]).optional().default(\"contain_within_bounds\"),model_jscad:Jy().optional(),color:h().trim().min(1).optional().describe(\"Explicit color override for CAD geometry, including authored JSCAD material colors. Omit to preserve model materials.\"),show_as_translucent_model:E().optional(),show_as_bounding_box:E().optional(),show_hidden_edges:E().optional(),anchor_alignment:ut([\"center\",\"center_of_component_on_board_surface\"]).optional().default(\"center\")}).describe(\"Defines CAD geometry, optionally associated with a PCB component\");A(!0);var rb=Mt.extend({type:x(\"cad_collision_error\"),cad_collision_error_id:T(\"cad_collision_error\"),error_type:x(\"cad_collision_error\").default(\"cad_collision_error\"),cad_component_ids:W(h()).min(1),pcb_component_ids:W(h()).optional(),source_component_ids:W(h()).min(1),intersection_area_mm2:w().finite().nonnegative(),threshold_area_mm2:w().finite().nonnegative()}).describe(\"An aperture-bearing part intersects the finished enclosure. The intersection_area_mm2 is the union silhouette area of the solid intersection projected along the aperture face normal, in the right-handed Circuit JSON world frame (+X right, +Y top, +Z above). It is an area in square millimetres, not intersection volume or surface area. This indicates possible aperture misplacement, insufficient size/depth, or body clearance problems; it does not prove which cause applies.\");A(!0);var a_=ge.refine((t)=\u003e[t.x,t.y,t.z].every(Number.isFinite),\"Connector pin 1 positions must be finite\").describe(\"Resolved pin 1 position at the connector mating face, in right-handed circuit world, millimeters: +X right, +Y top, +Z above. An absolute point, not a direction. Computed by the circuit producer from endpoint geometry. Together with the endpoint path tangent, fixes connector roll and identifies its pin 1 side; renderers must not infer it from footprints.\"),nb=M({type:x(\"cad_cable\"),cad_cable_id:h(),name:h().min(1),from_source_component_id:h(),to_source_component_id:h(),from_connector_pin1_position:a_.optional(),to_connector_pin1_position:a_.optional(),cableprinter_string:h().min(1).describe('Physical cable definition, e.g. \"usb_c\" or \"jst_ph_pins6\". Independent of the route.'),path:W(ge).min(2).refine((t)=\u003et.every((e,r)=\u003e[e.x,e.y,e.z].every(Number.isFinite)\u0026\u0026(r===0||Math.hypot(e.x-t[r-1].x,e.y-t[r-1].y,e.z-t[r-1].z)\u003e0.00000001)),\"Cable paths require finite, distinct consecutive points\").describe(\"Resolved cable centerline points in right-handed circuit world, millimeters: +X right, +Y top, +Z above. First/last samples are connector wire exits; their tangents point into/out of the cable. Includes routing/slack; renderers must not recompute the path.\")}).describe(\"A physical assembly cable with a resolved 3D route. Several cables are independent cad_cable records, each with its own endpoints, definition and path. Does not imply electrical pin mapping.\");A(!0);var ib=0.000001,c_=M({x:w().finite(),y:w().finite(),z:w().finite()}).refine((t)=\u003eMath.abs(Math.hypot(t.x,t.y,t.z)-1)\u003c=ib,\"Reference surface directions must be unit vectors\"),l_=R.pipe(w().finite().positive()),ob=M({type:x(\"cad_reference_surface\"),cad_reference_surface_id:h().min(1),source_component_id:h().min(1).describe(\"Owning assembly part's source component ID. The part may have no CAD geometry.\"),name:h().trim().min(1).describe(\"Reference name, unique within the owning part, e.g. shade in STEM.shade.\"),shape:x(\"rect\"),center:ge.refine((t)=\u003e[t.x,t.y,t.z].every(Number.isFinite),\"Reference surface centers must be finite\").describe(\"Resolved surface center in right-handed circuit-world XYZ, millimeters: +X right, +Y top, +Z above. An absolute point after assembly placement.\"),normal:c_.describe(\"Outward unit normal in circuit-world XYZ. Dimensionless direction; transform with the part's rotation, without translation.\"),x_axis:c_.describe(\"In-plane unit X direction in circuit-world XYZ, perpendicular to normal. The second tangent is normal cross x_axis, giving a right-handed frame.\"),width:l_.optional().describe(\"Rectangular extent along x_axis in millimeters. Supply together with height. Omission leaves the surface's display size unspecified.\"),height:l_.optional().describe(\"Rectangular extent along normal cross x_axis in millimeters. Supply together with width.\"),subcircuit_id:h().optional()}).superRefine((t,e)=\u003e{if(t.width===void 0!==(t.height===void 0))e.addIssue({code:X.custom,path:[\"width\"],message:\"Provide width and height together\"});let{normal:r,x_axis:n}=t;if(Math.abs(r.x*n.x+r.y*n.y+r.z*n.z)\u003eib)e.addIssue({code:X.custom,path:[\"x_axis\"],message:\"x_axis must be perpendicular to normal\"})}).describe(\"A named assembly mounting surface with a resolved world-space frame. Reference geometry for optional visualization; does not add solid material or electrical connectivity. The producer resolves part placement independently of CAD-model offsets; renderers consume the world frame without reapplying the owning model's transform.\");A(!0);var Zp=ut([\"sinewave\",\"square\",\"triangle\",\"sawtooth\"]),A3=Wt([h(),w()]).transform((t)=\u003e{if(typeof t===\"string\"){if(t.endsWith(\"%\"))return parseFloat(t.slice(0,-1))/100;return parseFloat(t)}return t}).pipe(w().min(0,\"Duty cycle must be non-negative\").max(1,\"Duty cycle cannot be greater than 100%\")),sb=M({type:x(\"simulation_voltage_source\"),simulation_voltage_source_id:T(\"simulation_voltage_source\"),is_dc_source:x(!0).optional().default(!0),positive_source_port_id:h().optional(),negative_source_port_id:h().optional(),positive_source_net_id:h().optional(),negative_source_net_id:h().optional(),voltage:xe,ac_magnitude:xe.optional(),ac_phase:Et.optional()}).describe(\"Defines a DC voltage source for simulation\"),ab=M({type:x(\"simulation_voltage_source\"),simulation_voltage_source_id:T(\"simulation_voltage_source\"),is_dc_source:x(!1),terminal1_source_port_id:h().optional(),terminal2_source_port_id:h().optional(),terminal1_source_net_id:h().optional(),terminal2_source_net_id:h().optional(),voltage:xe.optional(),frequency:kr.optional(),peak_to_peak_voltage:xe.optional(),wave_shape:Zp.optional(),phase:Et.optional(),duty_cycle:A3.optional(),pulse_delay:Qt.optional(),rise_time:Qt.optional(),fall_time:Qt.optional(),pulse_width:Qt.optional(),period:Qt.optional(),ac_magnitude:xe.optional(),ac_phase:Et.optional()}).describe(\"Defines an AC voltage source for simulation\"),cb=Wt([sb,ab]).describe(\"Defines a voltage source for simulation\");A(!0);A(!0);A(!0);var P3=Wt([h(),w()]).transform((t)=\u003e{if(typeof t===\"string\"){if(t.endsWith(\"%\"))return parseFloat(t.slice(0,-1))/100;return parseFloat(t)}return t}).pipe(w().min(0,\"Duty cycle must be non-negative\").max(1,\"Duty cycle cannot be greater than 100%\")),lb=M({type:x(\"simulation_current_source\"),simulation_current_source_id:T(\"simulation_current_source\"),is_dc_source:x(!0).optional().default(!0),positive_source_port_id:h().optional(),negative_source_port_id:h().optional(),positive_source_net_id:h().optional(),negative_source_net_id:h().optional(),current:hr,ac_magnitude:hr.optional(),ac_phase:Et.optional()}).describe(\"Defines a DC current source for simulation\"),pb=M({type:x(\"simulation_current_source\"),simulation_current_source_id:T(\"simulation_current_source\"),is_dc_source:x(!1),terminal1_source_port_id:h().optional(),terminal2_source_port_id:h().optional(),terminal1_source_net_id:h().optional(),terminal2_source_net_id:h().optional(),current:hr.optional(),frequency:kr.optional(),peak_to_peak_current:hr.optional(),wave_shape:Zp.optional(),phase:Et.optional(),duty_cycle:P3.optional(),ac_magnitude:hr.optional(),ac_phase:Et.optional()}).describe(\"Defines an AC current source for simulation\"),hb=Wt([lb,pb]).describe(\"Defines a current source for simulation\");A(!0);A(!0);A(!0);var Ms=qy((t)=\u003et===\"V\"||t===\"A\"),qp=qy((t)=\u003et===\"Ω\"||t===\"F\"||t===\"H\"||t===\"V\"||t===\"A\"),db=Wt([x(\"spice_dc_sweep\"),x(\"spice_dc_operating_point\"),x(\"spice_transient_analysis\"),x(\"spice_ac_analysis\"),x(\"pcb_return_current\")]),mb=M({method:ut([\"trap\",\"gear\"]).optional(),reltol:Wt([w(),h()]).optional(),abstol:Wt([w(),h()]).optional(),vntol:Wt([w(),h()]).optional()}).describe(\"SPICE solver options for a simulation experiment\"),ub=M({type:x(\"simulation_experiment\"),simulation_experiment_id:T(\"simulation_experiment\"),name:h(),experiment_type:db,time_per_step:Jn.optional(),start_time_ms:Qt.optional(),end_time_ms:Qt.optional(),spice_options:mb.optional(),dc_sweep_voltage_source_id:h().optional(),dc_sweep_current_source_id:h().optional(),dc_sweep_start:w().optional(),dc_sweep_stop:w().optional(),dc_sweep_step:w().refine((t)=\u003et!==0).optional(),dc_sweep_unit:Ms.optional(),ac_sweep_type:ut([\"linear\",\"decade\",\"octave\"]).optional(),ac_samples_per_interval:w().int().positive().optional(),ac_sample_count:w().int().positive().optional(),ac_start_frequency_hz:w().positive().optional(),ac_stop_frequency_hz:w().positive().optional()}).superRefine((t,e)=\u003e{if(t.experiment_type===\"spice_dc_sweep\"){let r=[\"dc_sweep_start\",\"dc_sweep_stop\",\"dc_sweep_step\",\"dc_sweep_unit\"];for(let s of r)if(t[s]===void 0)e.addIssue({code:X.custom,path:[s],message:`${s} is required for a DC sweep`});let n=t.dc_sweep_voltage_source_id!==void 0,i=t.dc_sweep_current_source_id!==void 0;if(n===i)e.addIssue({code:X.custom,path:[\"dc_sweep_voltage_source_id\"],message:\"Exactly one DC sweep voltage or current source ID is required\"})}if(t.experiment_type===\"spice_ac_analysis\"){if(t.ac_sweep_type===void 0)e.addIssue({code:X.custom,path:[\"ac_sweep_type\"],message:\"ac_sweep_type is required for an AC analysis\"});if(t.ac_start_frequency_hz===void 0)e.addIssue({code:X.custom,path:[\"ac_start_frequency_hz\"],message:\"ac_start_frequency_hz is required for an AC analysis\"});if(t.ac_stop_frequency_hz===void 0)e.addIssue({code:X.custom,path:[\"ac_stop_frequency_hz\"],message:\"ac_stop_frequency_hz is required for an AC analysis\"});if(t.ac_sweep_type===\"linear\"\u0026\u0026t.ac_sample_count===void 0)e.addIssue({code:X.custom,path:[\"ac_sample_count\"],message:\"ac_sample_count is required for a linear AC analysis\"});if((t.ac_sweep_type===\"decade\"||t.ac_sweep_type===\"octave\")\u0026\u0026t.ac_samples_per_interval===void 0)e.addIssue({code:X.custom,path:[\"ac_samples_per_interval\"],message:\"ac_samples_per_interval is required for decade and octave AC analyses\"})}}).describe(\"Defines a simulation experiment configuration\");A(!0);var ze=M({simulation_parameter_sweep_id:h(),sweep_index:w().int().nonnegative(),parameter_value:w(),parameter_unit:qp});A(!0);var fb=M({type:x(\"simulation_transient_voltage_graph\"),simulation_transient_voltage_graph_id:T(\"simulation_transient_voltage_graph\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),timestamps_ms:W(w()).optional(),voltage_levels:W(w()),source_component_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),time_per_step:Jn,start_time_ms:Qt,end_time_ms:Qt,name:h().optional(),color:h().optional()}).describe(\"Stores voltage measurements over time for a simulation\");A(!0);var yb=M({type:x(\"simulation_transient_current_graph\"),simulation_transient_current_graph_id:T(\"simulation_transient_current_graph\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),timestamps_ms:W(w()).optional(),current_levels:W(w()),source_component_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),time_per_step:Jn,start_time_ms:Qt,end_time_ms:Qt,name:h().optional(),color:h().optional()}).describe(\"Stores current measurements over time for a simulation\");A(!0);var _b=M({type:x(\"simulation_switch\"),simulation_switch_id:T(\"simulation_switch\"),source_component_id:h().optional(),closes_at:Qt.optional(),opens_at:Qt.optional(),starts_closed:E().optional(),switching_frequency:kr.optional()}).describe(\"Defines a switch for simulation timing control\");A(!0);var gb=M({type:x(\"simulation_voltage_probe\"),simulation_voltage_probe_id:T(\"simulation_voltage_probe\"),source_component_id:h().optional(),name:h().optional(),signal_input_source_port_id:h().optional(),signal_input_source_net_id:h().optional(),reference_input_source_port_id:h().optional(),reference_input_source_net_id:h().optional(),subcircuit_id:h().optional(),color:h().optional()}).describe(\"Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.\").superRefine((t,e)=\u003e{if(t.reference_input_source_port_id||t.reference_input_source_net_id){let n=!!t.signal_input_source_port_id||!!t.reference_input_source_port_id,i=!!t.signal_input_source_net_id||!!t.reference_input_source_net_id;if(n\u0026\u0026i)e.addIssue({code:X.custom,message:\"Cannot mix port and net connections in a differential probe.\"});else if(n){if(!t.signal_input_source_port_id||!t.reference_input_source_port_id)e.addIssue({code:X.custom,message:\"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id.\"})}else if(i){if(!t.signal_input_source_net_id||!t.reference_input_source_net_id)e.addIssue({code:X.custom,message:\"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id.\"})}}else if(!!t.signal_input_source_port_id===!!t.signal_input_source_net_id)e.addIssue({code:X.custom,message:\"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id.\"})});A(!0);var xb=M({type:x(\"simulation_current_probe\"),simulation_current_probe_id:T(\"simulation_current_probe\"),source_component_id:h().optional(),name:h().optional(),positive_source_port_id:h().optional(),negative_source_port_id:h().optional(),positive_source_net_id:h().optional(),negative_source_net_id:h().optional(),subcircuit_id:h().optional(),color:h().optional()}).describe(\"Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint.\").superRefine((t,e)=\u003e{let r=!!t.positive_source_port_id,n=!!t.negative_source_port_id,i=!!t.positive_source_net_id,s=!!t.negative_source_net_id,o=r||n,c=i||s;if(o\u0026\u0026c){e.addIssue({code:X.custom,message:\"Cannot mix port and net connections in a current probe.\"});return}if(o){if(!r||!n)e.addIssue({code:X.custom,message:\"Current probe using source ports requires both positive_source_port_id and negative_source_port_id.\"});return}if(c){if(!i||!s)e.addIssue({code:X.custom,message:\"Current probe using source nets requires both positive_source_net_id and negative_source_net_id.\"});return}e.addIssue({code:X.custom,message:\"A current probe must have either positive/negative source port ids or positive/negative source net ids.\"})});A(!0);var bb=Mt.extend({type:x(\"simulation_unknown_experiment_error\"),simulation_unknown_experiment_error_id:T(\"simulation_unknown_experiment_error\"),error_type:x(\"simulation_unknown_experiment_error\").default(\"simulation_unknown_experiment_error\"),simulation_experiment_id:h().optional(),subcircuit_id:h().optional()}).describe(\"An unknown error occurred during the simulation experiment.\");A(!0);var B3=ut([\"resistance\",\"capacitance\",\"inductance\",\"voltage\",\"current\"]),uo=M({type:x(\"simulation_parameter_sweep\"),simulation_parameter_sweep_id:T(\"simulation_parameter_sweep\"),simulation_experiment_id:h(),name:h().optional(),parameter_values:W(w()).min(1),parameter_unit:qp}),vb=ie(\"parameter_type\",[uo.extend({parameter_type:x(\"resistance\"),resistor_source_component_id:h()}),uo.extend({parameter_type:x(\"capacitance\"),capacitor_source_component_id:h()}),uo.extend({parameter_type:x(\"inductance\"),inductor_source_component_id:h()}),uo.extend({parameter_type:x(\"voltage\"),source_net_id:h()}),uo.extend({parameter_type:x(\"current\"),current_source_component_id:h()})]).describe(\"Repeats a simulation experiment over component parameter values\");A(!0);var Sb=M({type:x(\"simulation_dc_operating_point_voltage\"),simulation_dc_operating_point_voltage_id:T(\"simulation_dc_operating_point_voltage\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_voltage_probe_id:h(),voltage:w(),name:h().optional(),color:h().optional()});A(!0);var wb=M({type:x(\"simulation_dc_operating_point_current\"),simulation_dc_operating_point_current_id:T(\"simulation_dc_operating_point_current\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_current_probe_id:h(),current:w(),name:h().optional(),color:h().optional()});A(!0);var Ab=M({type:x(\"simulation_dc_sweep_voltage_graph\"),simulation_dc_sweep_voltage_graph_id:T(\"simulation_dc_sweep_voltage_graph\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_voltage_probe_id:h(),sweep_values:W(w()),sweep_unit:Ms,voltage_levels:W(w()),name:h().optional(),color:h().optional()}).refine((t)=\u003et.sweep_values.length===t.voltage_levels.length,{message:\"sweep_values and voltage_levels must have the same length\"});A(!0);var Pb=M({type:x(\"simulation_dc_sweep_current_graph\"),simulation_dc_sweep_current_graph_id:T(\"simulation_dc_sweep_current_graph\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_current_probe_id:h(),sweep_values:W(w()),sweep_unit:Ms,current_levels:W(w()),name:h().optional(),color:h().optional()}).refine((t)=\u003et.sweep_values.length===t.current_levels.length,{message:\"sweep_values and current_levels must have the same length\"});A(!0);var Jp=M({re:w(),im:w()});A(!0);var Bb=M({type:x(\"simulation_ac_sweep_voltage_graph\"),simulation_ac_sweep_voltage_graph_id:T(\"simulation_ac_sweep_voltage_graph\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_voltage_probe_id:h(),frequencies_hz:W(w()),complex_voltages:W(Jp),name:h().optional(),color:h().optional()}).refine((t)=\u003et.frequencies_hz.length===t.complex_voltages.length,{message:\"frequencies_hz and complex_voltages must have the same length\"});A(!0);var Ib=M({type:x(\"simulation_ac_sweep_current_graph\"),simulation_ac_sweep_current_graph_id:T(\"simulation_ac_sweep_current_graph\"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_current_probe_id:h(),frequencies_hz:W(w()),complex_currents:W(Jp),name:h().optional(),color:h().optional()}).refine((t)=\u003et.frequencies_hz.length===t.complex_currents.length,{message:\"frequencies_hz and complex_currents must have the same length\"});A(!0);var Fb=M({type:x(\"simulation_op_amp\"),simulation_op_amp_id:T(\"simulation_op_amp\"),source_component_id:h().optional(),inverting_input_source_port_id:h(),non_inverting_input_source_port_id:h(),output_source_port_id:h(),positive_supply_source_port_id:h(),negative_supply_source_port_id:h()}).describe(\"Defines a simple ideal operational amplifier for simulation\");A(!0);var Mb=M({type:x(\"simulation_spice_subcircuit\"),simulation_spice_subcircuit_id:T(\"simulation_spice_subcircuit\"),source_component_id:h(),spice_pin_to_source_port_map:Qn(h(),h()),subcircuit_source:h()}).describe(\"Defines a custom SPICE subcircuit model for simulation\");A(!0);var p_=(t)=\u003et!==void 0,Cb=M({type:x(\"simulation_oscilloscope_trace\"),simulation_oscilloscope_trace_id:T(\"simulation_oscilloscope_trace\"),simulation_transient_voltage_graph_id:h().optional(),simulation_transient_current_graph_id:h().optional(),simulation_voltage_probe_id:h().optional(),simulation_current_probe_id:h().optional(),display_name:h().optional(),color:h().optional(),display_center_value:w().optional(),display_center_offset_divs:w().optional(),volts_per_div:w().positive().optional(),amps_per_div:w().positive().optional()}).describe(\"Defines how a simulation measurement is rendered as an oscilloscope-style trace.\").superRefine((t,e)=\u003e{let r=[t.simulation_transient_voltage_graph_id,t.simulation_voltage_probe_id].filter(p_).length,n=[t.simulation_transient_current_graph_id,t.simulation_current_probe_id].filter(p_).length;if(r+n!==1)e.addIssue({code:X.custom,message:\"An oscilloscope trace must reference exactly one voltage graph, current graph, voltage probe, or current probe.\"});if(r\u003e0\u0026\u0026t.amps_per_div!==void 0)e.addIssue({code:X.custom,message:\"Voltage oscilloscope traces must use volts_per_div, not amps_per_div.\"});if(n\u003e0\u0026\u0026t.volts_per_div!==void 0)e.addIssue({code:X.custom,message:\"Current oscilloscope traces must use amps_per_div, not volts_per_div.\"})});A(!0);var lp=M({x:w().finite(),y:w().finite(),layer:gt}),fp=ie(\"contact_type\",[lp.extend({contact_type:x(\"pcb_port\"),pcb_port_id:h().min(1)}),lp.extend({contact_type:x(\"pcb_via\"),pcb_via_id:h().min(1)}),lp.extend({contact_type:x(\"pcb_copper_pour\"),pcb_copper_pour_id:h().min(1)})]).describe(\"Identifies the reference conductor at a return-current contact\");A(!0);var yp=M({signal_pcb_port_id:h().min(1),reference_pcb_port_id:h().min(1).optional(),reference_layer:gt,resistance:w().finite().positive()}).describe(\"A two-terminal return-current excitation port with resistance in ohms\");A(!0);var kb=M({type:x(\"simulation_return_current_excitation\"),simulation_return_current_excitation_id:T(\"simulation_return_current_excitation\"),simulation_experiment_id:h().min(1),pcb_trace_id:h().min(1),ground_source_net_id:h().min(1),current:w().finite(),return_source:fp,return_sink:fp,source_port:yp.optional(),load_port:yp.optional()}).describe(\"Excites a signal trace with signed current in amperes, peak for AC; return_source is near the load and return_sink near the driver for positive current\");A(!0);var Nb=M({type:x(\"simulation_pcb_return_current_result\"),simulation_pcb_return_current_result_id:T(\"simulation_pcb_return_current_result\"),simulation_experiment_id:h().min(1),pcb_board_id:h().min(1),simulation_return_current_excitation_ids:W(h().min(1)).min(1).refine((t)=\u003enew Set(t).size===t.length,\"Excitation IDs must be unique\"),frequency_hz:w().finite().positive().optional()}).describe(\"A PCB return-current result at one frequency, or a frequency-independent result when frequency_hz is absent\");A(!0);function Yb(t){return _o.extend({project_relative_path:h().min(1),url:h().url()}).superRefine((e,r)=\u003e{if(!t.includes(e.mimetype))r.addIssue({code:X.custom,path:[\"mimetype\"],message:`Expected one of: ${t.join(\", \")}`});if(e.url.startsWith(\"data:\")){if(/^data:([^;,]*)(?:;[^,]*)?,/i.exec(e.url)?.[1]?.toLowerCase()!==e.mimetype)r.addIssue({code:X.custom,path:[\"url\"],message:\"Data URL media type must match asset.mimetype\"})}})}var Lb=Yb([\"application/json\",\"application/gzip\"]),Tb=Yb([\"image/png\",\"image/webp\"]),Eb=M({type:x(\"simulation_pcb_return_current_field\"),simulation_pcb_return_current_field_id:T(\"simulation_pcb_return_current_field\"),simulation_pcb_return_current_result_id:h().min(1),layer:gt,source_net_id:h().min(1),field_type:ut([\"real\",\"complex_phasor\"]),min_x:w().finite(),min_y:w().finite(),columns:w().int().positive().safe(),rows:w().int().positive().safe(),cell_width:w().finite().positive(),cell_height:w().finite().positive(),copper_thickness:w().finite().positive(),data_format:x(\"simulation_return_current_grid_json_v1\"),field_asset:Lb}).superRefine((t,e)=\u003e{if(!Number.isSafeInteger(t.columns*t.rows))e.addIssue({code:X.custom,path:[\"columns\"],message:\"The grid cell count must be a safe integer\"})}).describe(\"A sampled sheet-current field in A/mm, using plain or gzipped JSON Asset URLs; dimensions are PCB millimeters\");A(!0);var Zn=W(w().finite().nullable()).min(1),Rb=ie(\"field_type\",[M({field_type:x(\"real\"),sheet_current_x:Zn,sheet_current_y:Zn}),M({field_type:x(\"complex_phasor\"),sheet_current_x_real:Zn,sheet_current_x_imag:Zn,sheet_current_y_real:Zn,sheet_current_y_imag:Zn})]).superRefine((t,e)=\u003e{let r=t.field_type===\"real\"?[t.sheet_current_x,t.sheet_current_y]:[t.sheet_current_x_real,t.sheet_current_x_imag,t.sheet_current_y_real,t.sheet_current_y_imag],n=r[0];if(r.some((i)=\u003ei.length!==n.length)){e.addIssue({code:X.custom,message:\"Current channels must have equal lengths\"});return}for(let i=0;i\u003cn.length;i++){let s=n[i]===null;if(r.some((o)=\u003eo[i]===null!==s)){e.addIssue({code:X.custom,message:`Cell ${i} must be null in every channel or finite in every channel`});return}}}).describe(\"Decoded real or complex sheet-current arrays with a shared conductor mask\");A(!0);function I3(t){let e=t.columns*t.rows;if(!Number.isSafeInteger(t.columns)||t.columns\u003c=0||!Number.isSafeInteger(t.rows)||t.rows\u003c=0||!Number.isSafeInteger(e))throw Error(\"Grid dimensions must be positive safe integers\");return Rb.superRefine((r,n)=\u003e{if(r.field_type!==t.field_type)n.addIssue({code:X.custom,path:[\"field_type\"],message:\"Decoded field_type must match the parent field\"});if((r.field_type===\"real\"?r.sheet_current_x:r.sheet_current_x_real).length!==e)n.addIssue({code:X.custom,message:`Each current channel must have ${e} entries (columns * rows)`})})}var Ob=M({type:x(\"simulation_pcb_return_current_heatmap\"),simulation_pcb_return_current_heatmap_id:T(\"simulation_pcb_return_current_heatmap\"),simulation_pcb_return_current_result_id:h().min(1),layer:gt,source_net_id:h().min(1),min_x:w().finite(),min_y:w().finite(),max_x:w().finite(),max_y:w().finite(),image_asset:Tb}).superRefine((t,e)=\u003e{for(let r of[\"x\",\"y\"])if(t[`max_${r}`]\u003c=t[`min_${r}`])e.addIssue({code:X.custom,path:[`max_${r}`],message:\"Heatmap bounds must have positive width and height\"})}).describe(\"A transparent PNG/WebP current-density overlay in A/mm²; the top-left pixel maps to (min_x, max_y)\");A(!0);var h_=M({type:x(\"simulation_pcb_return_current_marker\"),simulation_pcb_return_current_marker_id:T(\"simulation_pcb_return_current_marker\"),simulation_pcb_return_current_result_id:h().min(1),role:ut([\"signal_source\",\"signal_load\",\"return_source\",\"return_sink\",\"signal_transition\",\"return_transition\"]),label:h().optional(),label_x:w().finite().optional(),label_y:w().finite().optional()}),Wb=ie(\"target_type\",[h_.extend({target_type:x(\"pcb_port\"),pcb_port_id:h().min(1),layer:gt}),h_.extend({target_type:x(\"pcb_via\"),pcb_via_id:h().min(1),from_layer:gt,to_layer:gt})]).superRefine((t,e)=\u003e{if(t.label_x===void 0!==(t.label_y===void 0))e.addIssue({code:X.custom,path:[\"label_x\"],message:\"label_x and label_y must be provided together\"});if(t.target_type===\"pcb_via\"\u0026\u0026t.from_layer===t.to_layer)e.addIssue({code:X.custom,path:[\"to_layer\"],message:\"A via transition must connect distinct layers\"})}).describe(\"A signal/return port or via highlight; markers do not assert measured via-transfer currents\");A(!0);var $b=Wt([p0,G_,l0,z_,U_,V_,Q_,H_,Ap,vp,Ps,wp,Sp,Pp,Bp,Ip,Cp,kp,Np,Rp,Yp,Lp,Tp,Ep,Mp,Fp,J_,t0,Z_,Op,Wp,$p,jp,e0,c0,Xp,Vp,Dp,r0,n0,i0,o0,s0,a0,zp,Up,q_,J0,rg,lg,wx,Ax,Px,Mx,Cx,kx,Nx,Yx,pg,yx,_x,hg,Lg,yg,vg,Sg,wg,Bg,Ag,Pg,Ig,Tg,mg,ug,fg,Eg,Rg,Xg,Dg,Bx,Gg,Hg,Qg,Zg,nx,qg,Jg,Kg,tx,rx,Fg,Mg,Cg,kg,Vg,zg,Ug,Ng,Yg,zx,Ux,Gx,Hx,ox,ix,sx,ax,cx,lx,px,hx,dx,Ix,Fx,mx,ux,Lx,Sx,Tx,Ex,Rx,jx,Xx,Dx,Vx,Qx,Zx,qx,Jx,Kx,h0,A0,x0,b0,v0,S0,_0,g0,P0,w0,d0,I0,F0,B0,N0,Y0,L0,T0,E0,R0,z0,O0,W0,$0,V0,j0,X0,eb,nb,ob,rb,cb,hb,ub,kb,Nb,Eb,Ob,Wb,fb,yb,Sb,wb,Ab,Pb,Bb,Ib,vb,_b,gb,xb,Cb,bb,Fb,Mb]),ti=$b;A(!0);Nr(!0);function O(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function jb(t){let{a:e,b:r,c:n,d:i,e:s,f:o}=t,c=e*i-r*n;return{a:i/c,b:r/-c,c:n/-c,d:e/c,e:(i*s-n*o)/-c,f:(r*s-e*o)/c}}function Yr(t){return typeof t\u003e\"u\"}function Rt(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function dr(...t){t=Array.isArray(t[0])?t[0]:t;let e=(r,n)=\u003e({a:r.a*n.a+r.c*n.b,c:r.a*n.c+r.c*n.d,e:r.a*n.e+r.c*n.f+r.e,b:r.b*n.a+r.d*n.b,d:r.b*n.c+r.d*n.d,f:r.b*n.e+r.d*n.f+r.f});switch(t.length){case 0:throw Error(\"no matrices provided\");case 1:return t[0];case 2:return e(t[0],t[1]);default:{let[r,n,...i]=t,s=e(r,n);return dr(s,...i)}}}function Ct(...t){return dr(...t)}var{cos:F3,sin:M3,PI:iJ}=Math;function Se(t,e,r){let n=F3(t),i=M3(t),s={a:n,c:-i,e:0,b:i,d:n,f:0};if(Yr(e)||Yr(r))return s;return dr([Rt(e,r),s,Rt(-e,-r)])}function oe(t,e=void 0,r=void 0,n=void 0){if(Yr(e))e=t;let i={a:t,c:0,e:0,b:0,d:e,f:0};if(Yr(r)||Yr(n))return i;return dr([Rt(r,n),i,Rt(-r,-n)])}var{tan:hJ}=Math;function Xb(t){return Lr(t)}function Lr(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function Db(t,e=10000000000){return{a:Math.round(t.a*e)/e,b:Math.round(t.b*e)/e,c:Math.round(t.c*e)/e,d:Math.round(t.d*e)/e,e:Math.round(t.e*e)/e,f:Math.round(t.f*e)/e}}function Vb(t,e){let r=t[0].x!=null?t[0].x:t[0][0],n=t[0].y!=null?t[0].y:t[0][1],i=e[0].x!=null?e[0].x:e[0][0],s=e[0].y!=null?e[0].y:e[0][1],o=t[1].x!=null?t[1].x:t[1][0],c=t[1].y!=null?t[1].y:t[1][1],l=e[1].x!=null?e[1].x:e[1][0],a=e[1].y!=null?e[1].y:e[1][1],p=t[2].x!=null?t[2].x:t[2][0],d=t[2].y!=null?t[2].y:t[2][1],m=e[2].x!=null?e[2].x:e[2][0],f=e[2].y!=null?e[2].y:e[2][1],_={a:r-p,b:n-d,c:o-p,d:c-d,e:p,f:d},g={a:i-m,b:s-f,c:l-m,d:a-f,e:m,f},y=jb(_),S=dr([g,y]);return Db(S)}function k3(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Cs(t,e,r,n){var i=Error.call(this,t);if(Object.setPrototypeOf)Object.setPrototypeOf(i,Cs.prototype);return i.expected=e,i.found=r,i.location=n,i.name=\"SyntaxError\",i}k3(Cs,Error);function Kp(t,e,r){if(r=r||\" \",t.length\u003ee)return t;return e-=t.length,r+=r.repeat(e),t+r.slice(0,e)}Cs.prototype.format=function(t){var e=\"Error: \"+this.message;if(this.location){var r=null,n;for(n=0;n\u003ct.length;n++)if(t[n].source===this.location.source){r=t[n].text.split(/\\r\\n|\\n|\\r/g);break}var i=this.location.start,s=this.location.source\u0026\u0026typeof this.location.source.offset===\"function\"?this.location.source.offset(i):i,o=this.location.source+\":\"+s.line+\":\"+s.column;if(r){var c=this.location.end,l=Kp(\"\",s.line.toString().length,\" \"),a=r[i.line-1],p=i.line===c.line?c.column:a.length+1,d=p-i.column||1;e+=`\n --\u003e `+o+`\n`+l+` |\n`+s.line+\" | \"+a+`\n`+l+\" | \"+Kp(\"\",i.column-1,\" \")+Kp(\"\",d,\"^\")}else e+=`\n at `+o}return e};Cs.buildMessage=function(t,e){var r={literal:function(a){return'\"'+i(a.text)+'\"'},class:function(a){var p=a.parts.map(function(d){return Array.isArray(d)?s(d[0])+\"-\"+s(d[1]):s(d)});return\"[\"+(a.inverted?\"^\":\"\")+p.join(\"\")+\"]\"},any:function(){return\"any character\"},end:function(){return\"end of input\"},other:function(a){return a.description}};function n(a){return a.charCodeAt(0).toString(16).toUpperCase()}function i(a){return a.replace(/\\\\/g,\"\\\\\\\\\").replace(/\"/g,\"\\\\\\\"\").replace(/\\0/g,\"\\\\0\").replace(/\\t/g,\"\\\\t\").replace(/\\n/g,\"\\\\n\").replace(/\\r/g,\"\\\\r\").replace(/[\\x00-\\x0F]/g,function(p){return\"\\\\x0\"+n(p)}).replace(/[\\x10-\\x1F\\x7F-\\x9F]/g,function(p){return\"\\\\x\"+n(p)})}function s(a){return a.replace(/\\\\/g,\"\\\\\\\\\").replace(/\\]/g,\"\\\\]\").replace(/\\^/g,\"\\\\^\").replace(/-/g,\"\\\\-\").replace(/\\0/g,\"\\\\0\").replace(/\\t/g,\"\\\\t\").replace(/\\n/g,\"\\\\n\").replace(/\\r/g,\"\\\\r\").replace(/[\\x00-\\x0F]/g,function(p){return\"\\\\x0\"+n(p)}).replace(/[\\x10-\\x1F\\x7F-\\x9F]/g,function(p){return\"\\\\x\"+n(p)})}function o(a){return r[a.type](a)}function c(a){var p=a.map(o),d,m;if(p.sort(),p.length\u003e0){for(d=1,m=1;d\u003cp.length;d++)if(p[d-1]!==p[d])p[m]=p[d],m++;p.length=m}switch(p.length){case 1:return p[0];case 2:return p[0]+\" or \"+p[1];default:return p.slice(0,-1).join(\", \")+\", or \"+p[p.length-1]}}function l(a){return a?'\"'+i(a)+'\"':\"end of input\"}return\"Expected \"+c(t)+\" but \"+l(e)+\" found.\"};var ni={CCW:-1,CW:1,NOT_ORIENTABLE:0},Y3=2*Math.PI;var Ys=Object.freeze({__proto__:null,BOUNDARY:2,CCW:!0,CONTAINS:3,CW:!1,END_VERTEX:2,INSIDE:1,INTERLACE:4,NOT_VERTEX:0,ORIENTATION:ni,OUTSIDE:0,OVERLAP_OPPOSITE:2,OVERLAP_SAME:1,PIx2:Y3,START_VERTEX:1}),Ce=0.000001;function i1(t){Ce=t}function o1(){return Ce}var L3=3;function rh(t){return t\u003cCe\u0026\u0026t\u003e-Ce}function Er(t,e){return t-e\u003cCe\u0026\u0026t-e\u003e-Ce}function s1(t,e){return t-e\u003eCe}function T3(t,e){return t-e\u003e-Ce}function a1(t,e){return t-e\u003c-Ce}function E3(t,e){return t-e\u003cCe}var c1=Object.freeze({__proto__:null,DECIMALS:L3,EQ:Er,EQ_0:rh,GE:T3,GT:s1,LE:E3,LT:a1,getTolerance:o1,setTolerance:i1}),u={Utils:c1,Errors:void 0,Matrix:void 0,Planar_set:void 0,Point:void 0,Vector:void 0,Line:void 0,Circle:void 0,Segment:void 0,Arc:void 0,Box:void 0,Edge:void 0,Face:void 0,Ray:void 0,Ray_shooting:void 0,Multiline:void 0,Polygon:void 0,Distance:void 0,Inversion:void 0};for(let t in Ys)u[t]=Ys[t];Object.defineProperty(u,\"DP_TOL\",{get:function(){return o1()},set:function(t){i1(t)}});class $t{static get ILLEGAL_PARAMETERS(){return ReferenceError(\"Illegal Parameters\")}static get ZERO_DIVISION(){return Error(\"Zero division\")}static get UNRESOLVED_BOUNDARY_CONFLICT(){return Error(\"Unresolved boundary conflict in boolean operation\")}static get INFINITE_LOOP(){return Error(\"Infinite loop\")}static get CANNOT_COMPLETE_BOOLEAN_OPERATION(){return Error(\"Cannot complete boolean operation\")}static get CANNOT_INVOKE_ABSTRACT_METHOD(){return Error(\"Abstract method cannot be invoked\")}static get OPERATION_IS_NOT_SUPPORTED(){return Error(\"Operation is not supported\")}static get UNSUPPORTED_SHAPE_TYPE(){return Error(\"Unsupported shape type\")}}u.Errors=$t;class Ls{constructor(t,e){this.first=t,this.last=e||this.first}[Symbol.iterator](){let t=void 0;return{next:()=\u003e(t=t?t.next:this.first,{value:t,done:t===void 0})}}get size(){let t=0;for(let e of this)t++;return t}toArray(t=void 0,e=void 0){let r=[],n=t||this.first,i=e||this.last,s=n;if(s===void 0)return r;do r.push(s),s=s.next;while(s!==i.next);return r}append(t){if(this.isEmpty())this.first=t;else t.prev=this.last,this.last.next=t;return this.last=t,this.last.next=void 0,this.first.prev=void 0,this}insert(t,e){if(this.isEmpty())this.first=t,this.last=t;else if(e===null||e===void 0)t.next=this.first,this.first.prev=t,this.first=t;else{let r=e.next;if(e.next=t,r)r.prev=t;if(t.prev=e,t.next=r,this.last===e)this.last=t}return this.last.next=void 0,this.first.prev=void 0,this}remove(t){if(t===this.first\u0026\u0026t===this.last)this.first=void 0,this.last=void 0;else{if(t.prev)t.prev.next=t.next;if(t.next)t.next.prev=t.prev;if(t===this.first)this.first=t.next;if(t===this.last)this.last=t.prev}return this}isEmpty(){return this.first===void 0}static testInfiniteLoop(t){let e=t,r=t;do{if(e!=t\u0026\u0026e===r)throw $t.INFINITE_LOOP;e=e.next,r=r.next.next}while(e!=t)}}var zb={stroke:\"black\"};class l1{constructor(t=zb){for(let e in t)this[e]=t[e];this.stroke=t.stroke??zb.stroke}toAttributesString(){return Object.keys(this).reduce((t,e)=\u003et+(this[e]!==void 0?this.toAttrString(e,this[e]):\"\"),\"\")}toAttrString(t,e){let r=t===\"className\"?\"class\":this.convertCamelToKebabCase(t);return e===null?`${r} `:`${r}=\"${e.toString()}\" `}convertCamelToKebabCase(t){return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).join(\"-\").toLowerCase()}}function Or(t){return new l1(t).toAttributesString()}function ci(t,e){let r=[],[n,i,s]=t.standard,[o,c,l]=e.standard,a=n*c-i*o,p=s*c-i*l,d=n*l-s*o;if(!u.Utils.EQ_0(a)){let m,f;if(i===0)m=s/n,f=d/a;else if(c===0)m=l/o,f=d/a;else if(n===0)m=p/a,f=s/i;else if(o===0)m=p/a,f=l/c;else m=p/a,f=d/a;r.push(new u.Point(m,f))}return r}function Wr(t,e){let r=[],n=e.pc.projectionOn(t),i=e.pc.distanceTo(n)[0];if(u.Utils.EQ(i,e.r))r.push(n);else if(u.Utils.LT(i,e.r)){let s=Math.sqrt(e.r*e.r-i*i),o,c;o=t.norm.rotate90CCW().multiply(s),c=n.translate(o),r.push(c),o=t.norm.rotate90CW().multiply(s),c=n.translate(o),r.push(c)}return r}function ii(t,e){let r=[];for(let n of e.toSegments()){let i=wo(n,t);for(let s of i)if(!g1(s,r))r.push(s)}return r}function Ts(t,e){let r=[];if(ii(t,e.box).length===0)return r;let n=new u.Circle(e.pc,e.r),i=Wr(t,n);for(let s of i)if(s.on(e))r.push(s);return r}function wo(t,e){let r=[];if(t.ps.on(e))r.push(t.ps);if(t.pe.on(e)\u0026\u0026!t.isZeroLength())r.push(t.pe);if(r.length\u003e0)return r;if(t.isZeroLength())return r;if(t.ps.leftTo(e)\u0026\u0026t.pe.leftTo(e)||!t.ps.leftTo(e)\u0026\u0026!t.pe.leftTo(e))return r;let n=new u.Line(t.ps,t.pe);return ci(n,e)}function Es(t,e){let r=[];if(t.isZeroLength()){if(t.ps.on(e))r.push(t.ps);return r}if(e.isZeroLength()){if(e.ps.on(t))r.push(e.ps);return r}let n=new u.Line(t.ps,t.pe),i=new u.Line(e.ps,e.pe);if(n.incidentTo(i)){if(t.ps.on(e))r.push(t.ps);if(t.pe.on(e))r.push(t.pe);if(e.ps.on(t)\u0026\u0026!e.ps.equalTo(t.ps)\u0026\u0026!e.ps.equalTo(t.pe))r.push(e.ps);if(e.pe.on(t)\u0026\u0026!e.pe.equalTo(t.ps)\u0026\u0026!e.pe.equalTo(t.pe))r.push(e.pe)}else if(n.parallelTo(i)){let s=new u.Vector(t.ps,t.pe),o=new u.Vector(e.ps,e.pe),c=new u.Vector(t.ps,e.ps),l=s.cross(o);if(!u.Utils.EQ_0(l)){let a=c.cross(o)/l,p=c.cross(s)/l;if(u.Utils.GE(a,0)\u0026\u0026u.Utils.LE(a,1)\u0026\u0026u.Utils.GE(p,0)\u0026\u0026u.Utils.LE(p,1))r.push(Ub(t.ps.translate(s.multiply(a)),t,e))}}else{let s=ci(n,i);if(s.length\u003e0){if(Gb(s[0],t)\u0026\u0026Gb(s[0],e))r.push(Ub(s[0],t,e))}}return r}function Ub(t,e,r){for(let n of[e.ps,e.pe,r.ps,r.pe])if(t.equalTo(n))return n;return t}function Gb(t,e){let r=e.box;return u.Utils.LE(t.x,r.xmax)\u0026\u0026u.Utils.GE(t.x,r.xmin)\u0026\u0026u.Utils.LE(t.y,r.ymax)\u0026\u0026u.Utils.GE(t.y,r.ymin)}function Rs(t,e){let r=[];if(t.isZeroLength()){let[s,o]=t.ps.distanceTo(e.pc);if(u.Utils.EQ(s,e.r))r.push(t.ps);return r}let n=new u.Line(t.ps,t.pe),i=Wr(n,e);for(let s of i)if(s.on(t))r.push(s);return r}function li(t,e){let r=[];if(t.isZeroLength()){if(t.ps.on(e))r.push(t.ps);return r}let n=new u.Line(t.ps,t.pe),i=new u.Circle(e.pc,e.r),s=Wr(n,i);for(let o of s)if(o.on(t)\u0026\u0026o.on(e))r.push(o);return r}function R3(t,e){let r=[];for(let n of e.toSegments()){let i=Es(n,t);for(let s of i)r.push(s)}return r}function p1(t,e){let r=[],n=new u.Vector(t.pc,e.pc),i=t.r,s=e.r;if(u.Utils.EQ_0(i)||u.Utils.EQ_0(s))return r;if(u.Utils.EQ_0(n.x)\u0026\u0026u.Utils.EQ_0(n.y)\u0026\u0026u.Utils.EQ(i,s))return r.push(t.pc.translate(-i,0)),r;let o=t.pc.distanceTo(e.pc)[0];if(u.Utils.GT(o,i+s))return r;if(u.Utils.LT(o,Math.abs(i-s)))return r;n.x/=o,n.y/=o;let c;if(u.Utils.EQ(o,i+s)||u.Utils.EQ(o,Math.abs(i-s)))return c=t.pc.translate(i*n.x,i*n.y),r.push(c),r;let l=i*i/(2*o)-s*s/(2*o)+o/2,a=t.pc.translate(l*n.x,l*n.y),p=Math.sqrt(i*i-l*l);return c=a.translate(n.rotate90CCW().multiply(p)),r.push(c),c=a.translate(n.rotate90CW().multiply(p)),r.push(c),r}function O3(t,e){let r=[];for(let n of e.toSegments()){let i=Rs(n,t);for(let s of i)r.push(s)}return r}function h1(t,e){let r=[];if(t.pc.equalTo(e.pc)\u0026\u0026u.Utils.EQ(t.r,e.r)){let o;if(o=t.start,o.on(e))r.push(o);if(o=t.end,o.on(e))r.push(o);if(o=e.start,o.on(t))r.push(o);if(o=e.end,o.on(t))r.push(o);return r}let n=new u.Circle(t.pc,t.r),i=new u.Circle(e.pc,e.r),s=n.intersect(i);for(let o of s)if(o.on(t)\u0026\u0026o.on(e))r.push(o);return r}function ph(t,e){let r=[];if(e.pc.equalTo(t.pc)\u0026\u0026u.Utils.EQ(e.r,t.r))return r.push(t.start),r.push(t.end),r;let n=e,i=new u.Circle(t.pc,t.r),s=p1(n,i);for(let o of s)if(o.on(t))r.push(o);return r}function W3(t,e){let r=[];for(let n of e.toSegments()){let i=li(n,t);for(let s of i)r.push(s)}return r}function d1(t,e){return t.isSegment?Es(t.shape,e):li(e,t.shape)}function m1(t,e){return t.isSegment?li(t.shape,e):h1(t.shape,e)}function u1(t,e){return t.isSegment?wo(t.shape,e):Ts(e,t.shape)}function $3(t,e){return t.isSegment?mh(e,t.shape):uh(e,t.shape)}function j3(t,e){return t.isSegment?Rs(t.shape,e):ph(t.shape,e)}function hh(t,e){let r=[];for(let n of e.edges)for(let i of d1(n,t))r.push(i);return r}function dh(t,e){let r=[];for(let n of e.edges)for(let i of m1(n,t))r.push(i);return r}function Ao(t,e){let r=[];if(e.isEmpty())return r;for(let n of e.edges)for(let i of u1(n,t))if(!g1(i,r))r.push(i);return t.sortPoints(r)}function f1(t,e){let r=[];if(e.isEmpty())return r;for(let n of e.edges)for(let i of j3(n,t))r.push(i);return r}function y1(t,e){if(t.isSegment)return d1(e,t.shape);else if(t.isArc)return m1(e,t.shape);else if(t.isLine)return u1(e,t.shape);else if(t.isRay)return $3(e,t.shape);return[]}function _1(t,e){let r=[];if(e.isEmpty()||t.shape.box.not_intersect(e.box))return r;let n=e.edges.search(t.shape.box);for(let i of n)r=[...r,...y1(t,i)];return r}function X3(t,e){let r=[];if(e.isEmpty()||t.size===0)return r;for(let n of t)r=[...r,..._1(n,e)];return r}function D3(t,e){let r=[];if(t.isEmpty()||e.isEmpty())return r;if(t.box.not_intersect(e.box))return r;for(let n of t.edges)r=[...r,..._1(n,e)];return r}function V3(t,e){if(t instanceof u.Line)return Ao(t,e);else if(t instanceof u.Segment)return hh(t,e);else if(t instanceof u.Arc)return dh(t,e);else return[]}function g1(t,e){return e.some((r)=\u003er.equalTo(t))}function ur(t){return new u.Line(t.start,t.norm)}function mh(t,e){return wo(e,ur(t)).filter((r)=\u003et.contains(r))}function uh(t,e){return Ts(ur(t),e).filter((r)=\u003et.contains(r))}function x1(t,e){return Wr(ur(t),e).filter((r)=\u003et.contains(r))}function z3(t,e){return ii(ur(t),e).filter((r)=\u003et.contains(r))}function b1(t,e){return ci(ur(t),e).filter((r)=\u003et.contains(r))}function U3(t,e){return ci(ur(t),ur(e)).filter((r)=\u003et.contains(r)).filter((r)=\u003ee.contains(r))}function v1(t,e){return Ao(ur(t),e).filter((r)=\u003et.contains(r))}function S1(t,e){if(t.intersect\u0026\u0026t.intersect instanceof Function)return t.intersect(e);throw $t.UNSUPPORTED_SHAPE_TYPE}function pi(t,e){let r=[];for(let n of e)r=[...r,...S1(t,n.shape)];return r}function G3(t,e){let r=[];for(let n of t)for(let i of e)r=[...r,...S1(n.shape,i.shape)];return r}var $r=class t extends Ls{constructor(...e){super();if(this.isInfinite=!1,e.length===1\u0026\u0026e[0]instanceof Array\u0026\u0026e[0].length\u003e0){let r=e[0],n=r.length,i=(l)=\u003el instanceof u.Segment||l instanceof u.Arc||l instanceof u.Ray||l instanceof u.Line,s=(l)=\u003el instanceof u.Segment||l instanceof u.Arc||l instanceof u.Ray,o=(l)=\u003el instanceof u.Segment||l instanceof u.Arc;if(n===1\u0026\u0026i(r[0])||n\u003e1\u0026\u0026s(r[0])\u0026\u0026s(r[n-1])\u0026\u0026r.slice(1,n-1).every(o)){this.isInfinite=r.some((l)=\u003el instanceof u.Ray||l instanceof u.Line);for(let l of r){let a=new u.Edge(l);this.append(a)}this.setArcLength()}else throw u.Errors.ILLEGAL_PARAMETERS}}get edges(){return[...this]}get box(){return this.edges.reduce((e,r)=\u003ee.merge(r.box),new u.Box)}get vertices(){let e=this.edges.map((r)=\u003er.start);return e.push(this.last.end),e}get length(){if(this.isEmpty())return 0;if(this.isInfinite)return Number.POSITIVE_INFINITY;let e=0;for(let r of this)e+=r.length;return e}clone(){return new t(this.toShapes())}setArcLength(){for(let e of this)this.setOneEdgeArcLength(e)}setOneEdgeArcLength(e){if(e===this.first)e.arc_length=0;else e.arc_length=e.prev.arc_length+e.prev.length}pointAtLength(e){if(e\u003ethis.length||e\u003c0)return null;if(this.isInfinite)return null;let r=null;for(let n of this)if(e\u003e=n.arc_length\u0026\u0026(n===this.last||e\u003cn.next.arc_length)){r=n.pointAtLength(e-n.arc_length);break}return r}addVertex(e,r){let n=r.shape.split(e);if(n[0]===null)return r.prev;if(n[1]===null)return r;let i=new u.Edge(n[0]),s=r.prev;return this.insert(i,s),r.shape=n[1],i}getChain(e,r){let n=[];for(let i=e;i!==r.next;i=i.next)n.push(i);return n}split(e){for(let r of e){let n=this.findEdgeByPoint(r);this.addVertex(r,n)}return this}findEdgeByPoint(e){let r;for(let n of this)if(n.shape.contains(e)){r=n;break}return r}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Line){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Circle){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Segment){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Arc){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2multiline(new u.Polygon(e),this);return[r,n.reverse()]}if(e instanceof u.Multiline)return u.Distance.multiline2multiline(this,e);throw u.Errors.UNSUPPORTED_SHAPE_TYPE}intersect(e){if(e instanceof u.Multiline)return G3(this,e);else return pi(e,this)}contains(e){if(e instanceof u.Point)return this.edges.some((r)=\u003er.shape.contains(e));throw u.Errors.UNSUPPORTED_SHAPE_TYPE}translate(e){return new t(this.edges.map((r)=\u003er.shape.translate(e)))}rotate(e=0,r=new u.Point){return new t(this.edges.map((n)=\u003en.shape.rotate(e,r)))}transform(e=new u.Matrix){return new t(this.edges.map((r)=\u003er.shape.transform(e)))}toShapes(){return this.edges.map((e)=\u003ee.shape.clone())}toJSON(){return this.edges.map((e)=\u003ee.toJSON())}svgPoints(){return this.vertices.map((e)=\u003e`${e.x},${e.y}`).join(\" \")}dpath(){let e=`M${this.first.start.x},${this.first.start.y}`;for(let r of this)e+=r.svg();return e}svg(e={}){let r=`\n\u003cpath ${Or({fill:\"none\",...e})} d=\"`;r+=`\nM${this.first.start.x},${this.first.start.y}`;for(let n of this)r+=n.svg();return r+=`\" \u003e\n\u003c/path\u003e`,r}};u.Multiline=$r;var H3=(...t)=\u003enew u.Multiline(...t);u.multiline=H3;function oi(t,e,r){let n=r.length,i=t.shape.split(e);if(i.length===0)return;let s=0;if(i[0]===null)s=0;else if(i[1]===null)s=t.shape.length;else s=i[0].length;let o=0;if(Er(s,0))o|=1;if(Er(s,t.shape.length))o|=2;let c;if(s===1/0)c=i[0].coord(e);else c=o\u00262\u0026\u0026t.next\u0026\u0026t.next.arc_length===0?0:t.arc_length+s;r.push({id:n,pt:e,arc_length:c,edge_before:t,edge_after:void 0,face:t.face,is_vertex:o})}function vo(t){t.int_points1_sorted=mr(t.int_points1),t.int_points2_sorted=mr(t.int_points2)}function mr(t){let e=new Map,r=0;for(let i of t)if(!e.has(i.face))e.set(i.face,r),r++;for(let i of t)i.faceId=e.get(i.face);return t.slice().sort(Q3)}function Q3(t,e){if(t.faceId\u003ce.faceId)return-1;if(t.faceId\u003ee.faceId)return 1;if(t.arc_length\u003ce.arc_length)return-1;if(t.arc_length\u003ee.arc_length)return 1;return 0}function fh(t){if(t.int_points1.length\u003c2)return;let e=!1,r,n,i,s;for(let o=0;o\u003ct.int_points1_sorted.length;o++){if(t.int_points1_sorted[o].id===-1)continue;r=t.int_points1_sorted[o],n=t.int_points2[r.id];for(let c=o+1;c\u003ct.int_points1_sorted.length;c++){if(i=t.int_points1_sorted[c],!Er(i.arc_length,r.arc_length))break;if(i.id===-1)continue;if(s=t.int_points2[i.id],s.id===-1)continue;if(i.edge_before===r.edge_before\u0026\u0026i.edge_after===r.edge_after\u0026\u0026s.edge_before===n.edge_before\u0026\u0026s.edge_after===n.edge_after)i.id=-1,s.id=-1,e=!0}}n=t.int_points2_sorted[0],r=t.int_points1[n.id];for(let o=1;o\u003ct.int_points2_sorted.length;o++){let c=t.int_points2_sorted[o];if(c.id===-1)continue;if(n.id===-1||!Er(c.arc_length,n.arc_length)){n=c,r=t.int_points1[n.id];continue}let l=t.int_points1[c.id];if(l.edge_before===r.edge_before\u0026\u0026l.edge_after===r.edge_after\u0026\u0026c.edge_before===n.edge_before\u0026\u0026c.edge_after===n.edge_after)l.id=-1,c.id=-1,e=!0}if(e)t.int_points1=t.int_points1.filter((o)=\u003eo.id\u003e=0),t.int_points2=t.int_points2.filter((o)=\u003eo.id\u003e=0),t.int_points1.forEach((o,c)=\u003eo.id=c),t.int_points2.forEach((o,c)=\u003eo.id=c)}function nh(t){for(let e of t){if(e.edge_before)e.edge_before.bvStart=void 0,e.edge_before.bvEnd=void 0,e.edge_before.bv=void 0,e.edge_before.overlap=void 0;if(e.edge_after)e.edge_after.bvStart=void 0,e.edge_after.bvEnd=void 0,e.edge_after.bv=void 0,e.edge_after.overlap=void 0}for(let e of t){if(e.edge_before)e.edge_before.bvEnd=2;if(e.edge_after)e.edge_after.bvStart=2}}function ih(t,e){for(let r of t){if(r.edge_before)r.edge_before.setInclusion(e);if(r.edge_after)r.edge_after.setInclusion(e)}}function Z3(t){let e=void 0,r=void 0,n=void 0,i=t.int_points1.length;for(let s=0;s\u003ci;s++){let o=t.int_points1_sorted[s];if(o.face!==e)r=s,e=o.face;let c=s,l=si(t.int_points1_sorted,s,e),a;if(c+l\u003ci\u0026\u0026t.int_points1_sorted[c+l].face===e)a=c+l;else a=r;let p=si(t.int_points1_sorted,a,e);n=null;for(let S=a;S\u003ca+p;S++){let P=t.int_points1_sorted[S];if(P.face===e\u0026\u0026t.int_points2[P.id].face===t.int_points2[o.id].face){n=P;break}}if(n===null)continue;let d=o.edge_after,m=n.edge_before;if(!(d.bv===2\u0026\u0026m.bv===2))continue;if(d!==m)continue;let f=t.int_points2[o.id],_=t.int_points2[n.id],g=f.edge_after,y=_.edge_before;if(!(g.bv===2\u0026\u0026y.bv===2\u0026\u0026g===y))f=t.int_points2[n.id],_=t.int_points2[o.id],g=f.edge_after,y=_.edge_before;if(!(g.bv===2\u0026\u0026y.bv===2\u0026\u0026g===y))continue;d.setOverlap(g)}}function si(t,e,r){let n,i,s=1;if(t.length===1)return 1;n=t[e];for(let o=e+1;o\u003ct.length;o++){if(n.face!==r)break;if(i=t[o],!(i.pt.equalTo(n.pt)\u0026\u0026i.edge_before===n.edge_before\u0026\u0026i.edge_after===n.edge_after))break;s++}return s}function ai(t,e){if(!e)return;for(let r of e){let n=r.edge_before;if(r.is_vertex=0,n.shape.start\u0026\u0026n.shape.start.equalTo(r.pt))r.is_vertex|=1;if(n.shape.end\u0026\u0026n.shape.end.equalTo(r.pt))r.is_vertex|=2;if(r.is_vertex\u00261){if(r.edge_before=n.prev,n.prev)r.is_vertex=2;continue}if(r.is_vertex\u00262)continue;let i=t.addVertex(r.pt,n);r.edge_before=i}for(let r of e)if(r.edge_before)r.edge_after=r.edge_before.next;else if(t instanceof $r\u0026\u0026r.is_vertex\u00261)r.edge_after=t.first}function Hb(t,e,r){let n=t.edge_before,i=e.edge_after,s=r.length;n.next=r[0],r[0].prev=n,r[s-1].next=i,i.prev=r[s-1]}var{INSIDE:Fe,OUTSIDE:Me,BOUNDARY:Zt,OVERLAP_SAME:q3,OVERLAP_OPPOSITE:J3}=Ys,{NOT_VERTEX:pK,START_VERTEX:Qb,END_VERTEX:Zb}=Ys,Os=1,Po=2,Rr=3;function K3(t,e){let[r,n]=Bo(t,e,Os,!0);return r}function oh(t,e){let n=e.clone().reverse(),[i,s]=Bo(t,n,Rr,!0);return i}function w1(t,e){let[r,n]=Bo(t,e,Po,!0);return r}function A1(t,e){let[r,n]=Bo(t,e,Po,!1),i=[];for(let o of r.faces)i=[...i,...[...o.edges].map((c)=\u003ec.shape)];let s=[];for(let o of n.faces)s=[...s,...[...o.edges].map((c)=\u003ec.shape)];return[i,s]}function sh(t,e){let[r,n]=Bo(t,e,Rr,!1),i=[];for(let s of r.faces)i=[...i,...[...s.edges].map((o)=\u003eo.shape)];return i}function P1(t,e){let r=t.clone(),n=e.clone(),i=B1(r,n);vo(i),ai(r,i.int_points1_sorted),ai(n,i.int_points2_sorted),fh(i),vo(i);let s=i.int_points1_sorted.map((c)=\u003ec.pt),o=i.int_points2_sorted.map((c)=\u003ec.pt);return[s,o]}function tA(t,e,r,n){let i=qb(t,r.int_points1),s=qb(e,r.int_points2);Jb(i,e),Jb(s,t),nh(r.int_points1),nh(r.int_points2),ih(r.int_points1,e),ih(r.int_points2,t);while(rA(t,e,r.int_points1,r.int_points1_sorted,r.int_points2,r));Z3(r),ah(t,n,r.int_points1_sorted,!0),ah(e,n,r.int_points2_sorted,!1),Kb(t,i,n,!0),Kb(e,s,n,!1)}function eA(t,e,r,n){nA(t,e,n,r.int_points2),iA(t,e,r),ch(t,r.int_points1),ch(e,r.int_points2),lh(t,r.int_points1,r.int_points2),lh(t,r.int_points2,r.int_points1),t1(t),t1(e)}function Bo(t,e,r,n){let i=t.clone(),s=e.clone(),o=B1(i,s);if(vo(o),ai(i,o.int_points1_sorted),ai(s,o.int_points2_sorted),fh(o),vo(o),tA(i,s,o,r),n)eA(i,s,o,r);return[i,s]}function B1(t,e){let r={int_points1:[],int_points2:[]};for(let n of t.edges){let i=e.edges.search(n.box);for(let s of i){let o=n.shape.intersect(s.shape);for(let c of o)oi(n,c,r.int_points1),oi(s,c,r.int_points2)}}return r}function qb(t,e){let r=[];for(let n of t.faces)if(!e.find((i)=\u003ei.face===n))r.push(n);return r}function Jb(t,e){for(let r of t)r.first.bv=r.first.bvStart=r.first.bvEnd=void 0,r.first.setInclusion(e)}function rA(t,e,r,n,i,s){let o,c,l,a=n.length,p=!1;for(let d=0;d\u003ca;d++){let m=n[d];if(m.face!==o)c=d,o=m.face;let f=d,_=si(n,d,o),g;if(f+_\u003ca\u0026\u0026n[f+_].face===o)g=f+_;else g=c;let y=si(n,g,o);l=null;for(let b=g;b\u003cg+y;b++){let C=n[b];if(C.face===o\u0026\u0026i[C.id].face===i[m.id].face){l=C;break}}if(l===null)continue;let S=m.edge_after,P=l.edge_before;if(S.bv===Zt\u0026\u0026P.bv!=Zt){S.bv=P.bv;continue}if(S.bv!=Zt\u0026\u0026P.bv===Zt){P.bv=S.bv;continue}if(S.bv===Zt\u0026\u0026P.bv===Zt\u0026\u0026S!=P||(S.bv===Fe\u0026\u0026P.bv===Me||S.bv===Me\u0026\u0026P.bv===Fe)){let b=S.next;while(b!=P)b.bvStart=void 0,b.bvEnd=void 0,b.bv=void 0,b.setInclusion(e),b=b.next}if(S.bv===Zt\u0026\u0026P.bv===Zt\u0026\u0026S!=P){let b=S.next,C;while(b!=P){if(b.bv!=Zt){if(C===void 0)C=b.bv;else if(b.bv!=C)throw $t.UNRESOLVED_BOUNDARY_CONFLICT}b=b.next}if(C!=null)S.bv=C,P.bv=C;continue}if(S.bv===Fe\u0026\u0026P.bv===Me||S.bv===Me\u0026\u0026P.bv===Fe){let b=S;while(b!=P){if(b.bvStart===S.bv\u0026\u0026b.bvEnd===P.bv){let[C,L]=b.shape.distanceTo(e);if(C\u003c10*u.DP_TOL){oi(b,L.ps,r);let B=r[r.length-1];if(B.is_vertex\u0026Qb)B.edge_after=b,B.edge_before=b.prev,b.bvStart=Zt,b.bv=void 0,b.setInclusion(e);else if(B.is_vertex\u0026Zb)B.edge_after=b.next,b.bvEnd=Zt,b.bv=void 0,b.setInclusion(e);else{let j=e.addVertex(B.pt,b);B.edge_before=j,B.edge_after=j.next,j.setInclusion(e),j.next.bvStart=Zt,j.next.bvEnd=void 0,j.next.bv=void 0,j.next.setInclusion(e)}let k=e.findEdgeByPoint(L.pe);oi(k,L.pe,i);let I=i[i.length-1];if(I.is_vertex\u0026Qb)I.edge_after=k,I.edge_before=k.prev;else if(I.is_vertex\u0026Zb)I.edge_after=k.next;else{let j=i.find((lt)=\u003elt.edge_after===k),Q=e.addVertex(I.pt,k);if(I.edge_before=Q,I.edge_after=Q.next,j)j.edge_after=Q;Q.bvStart=void 0,Q.bvEnd=Zt,Q.bv=void 0,Q.setInclusion(t),Q.next.bvStart=Zt,Q.next.bvEnd=void 0,Q.next.bv=void 0,Q.next.setInclusion(t)}vo(s),p=!0;break}}b=b.next}if(p)break;throw $t.UNRESOLVED_BOUNDARY_CONFLICT}}return p}function ah(t,e,r,n){if(!r)return;let i=void 0,s=void 0,o,c;for(let l=0;l\u003cr.length;l++){if(o=r[l],o.face!==i)s=l,i=o.face;if(i.isEmpty())continue;let a=l,p=si(r,l,i),d;if(a+p\u003cr.length\u0026\u0026r[a+p].face===o.face)d=a+p;else d=s;c=r[d];let m=d,f=si(r,m,i),_=o.edge_after,g=c.edge_before;if(_.bv===Fe\u0026\u0026g.bv===Fe\u0026\u0026e===Os||_.bv===Me\u0026\u0026g.bv===Me\u0026\u0026e===Po||(_.bv===Me||g.bv===Me)\u0026\u0026e===Rr\u0026\u0026!n||(_.bv===Fe||g.bv===Fe)\u0026\u0026e===Rr\u0026\u0026n||_.bv===Zt\u0026\u0026g.bv===Zt\u0026\u0026_.overlap\u0026q3\u0026\u0026n||_.bv===Zt\u0026\u0026g.bv===Zt\u0026\u0026_.overlap\u0026J3){t.removeChain(i,_,g);for(let y=a;y\u003ca+p;y++)r[y].edge_after=void 0;for(let y=m;y\u003cm+f;y++)r[y].edge_before=void 0}l+=p-1}}function nA(t,e,r,n){for(let i of e.faces){for(let s of i)t.edges.add(s);if(n.find((s)=\u003es.face===i)===void 0)t.addFace(i.first,i.last)}}function iA(t,e,r){if(r.int_points1.length===0)return;for(let n=0;n\u003cr.int_points1.length;n++){let i=r.int_points1[n],s=r.int_points2[n];if(i.edge_before!==void 0\u0026\u0026i.edge_after===void 0){if(s.edge_before===void 0\u0026\u0026s.edge_after!==void 0)i.edge_before.next=s.edge_after,s.edge_after.prev=i.edge_before,i.edge_after=s.edge_after,s.edge_before=i.edge_before}if(s.edge_before!==void 0\u0026\u0026s.edge_after===void 0){if(i.edge_before===void 0\u0026\u0026i.edge_after!==void 0)s.edge_before.next=i.edge_after,i.edge_after.prev=s.edge_before,s.edge_after=i.edge_after,i.edge_before=s.edge_before}if(i.edge_before!==void 0\u0026\u0026i.edge_after===void 0)for(let o of r.int_points1_sorted){if(o===i)continue;if(o.edge_before===void 0\u0026\u0026o.edge_after!==void 0){if(o.pt.equalTo(i.pt))i.edge_before.next=o.edge_after,o.edge_after.prev=i.edge_before,i.edge_after=o.edge_after,o.edge_before=i.edge_before}}if(s.edge_before!==void 0\u0026\u0026s.edge_after===void 0)for(let o of r.int_points2_sorted){if(o===s)continue;if(o.edge_before===void 0\u0026\u0026o.edge_after!==void 0){if(o.pt.equalTo(s.pt))s.edge_before.next=o.edge_after,o.edge_after.prev=s.edge_before,s.edge_after=o.edge_after,o.edge_before=s.edge_before}}}}function ch(t,e){for(let r of e){if(t.faces.delete(r.face),r.face=void 0,r.edge_before)r.edge_before.face=void 0;if(r.edge_after)r.edge_after.face=void 0}}function lh(t,e,r){for(let n of e){if(n.edge_before===void 0||n.edge_after===void 0)continue;if(n.face)continue;if(n.edge_after.face||n.edge_before.face)continue;let{edge_after:i,edge_before:s}=n;try{Ls.testInfiniteLoop(i)}catch(c){throw $t.CANNOT_COMPLETE_BOOLEAN_OPERATION}let o=t.addFace(i,s);for(let c of e)if(c.edge_before\u0026\u0026c.edge_after\u0026\u0026c.edge_before.face===o\u0026\u0026c.edge_after.face===o)c.face=o;for(let c of r)if(c.edge_before\u0026\u0026c.edge_after\u0026\u0026c.edge_before.face===o\u0026\u0026c.edge_after.face===o)c.face=o}}function Kb(t,e,r,n){for(let i of e){let s=i.first.bv;if(r===Os\u0026\u0026s===Fe||r===Rr\u0026\u0026s===Fe\u0026\u0026n||r===Rr\u0026\u0026s===Me\u0026\u0026!n||r===Po\u0026\u0026s===Me)t.deleteFace(i)}}function t1(t){let e=[];for(let r of t.edges)if(!r.face||!t.faces.has(r.face))e.push(r);for(let r of e)t.edges.delete(r)}var oA=Object.freeze({__proto__:null,BOOLEAN_INTERSECT:Po,BOOLEAN_SUBTRACT:Rr,BOOLEAN_UNION:Os,calculateIntersections:P1,innerClip:A1,intersect:w1,outerClip:sh,removeNotRelevantChains:ah,removeOldFaces:ch,restoreFaces:lh,subtract:oh,unify:K3}),sA=RegExp(\"T.F..FFF.|T.F...F..\"),aA=RegExp(\"T........|.T.......|...T.....|....T....\"),cA=RegExp(\"FT.......|F..T.....|F...T....\"),lA=RegExp(\"T.F..F...\"),pA=RegExp(\"T.F..F...|.TF..F...|..FT.F...|..F.TF...\");class jr{constructor(){this.m=[,,,,,,,,,].fill(void 0)}get I2I(){return this.m[0]}set I2I(t){this.m[0]=t}get I2B(){return this.m[1]}set I2B(t){this.m[1]=t}get I2E(){return this.m[2]}set I2E(t){this.m[2]=t}get B2I(){return this.m[3]}set B2I(t){this.m[3]=t}get B2B(){return this.m[4]}set B2B(t){this.m[4]=t}get B2E(){return this.m[5]}set B2E(t){this.m[5]=t}get E2I(){return this.m[6]}set E2I(t){this.m[6]=t}get E2B(){return this.m[7]}set E2B(t){this.m[7]=t}get E2E(){return this.m[8]}set E2E(t){this.m[8]=t}toString(){return this.m.map((t)=\u003e{if(t instanceof Array\u0026\u0026t.length\u003e0)return\"T\";else if(t instanceof Array\u0026\u0026t.length===0)return\"F\";else return\"*\"}).join(\"\")}equal(){return sA.test(this.toString())}intersect(){return aA.test(this.toString())}touch(){return cA.test(this.toString())}inside(){return lA.test(this.toString())}covered(){return pA.test(this.toString())}}function xo(t,e){let r=void 0,n=new u.Ray(e),i=new u.Line(n.pt,n.norm),s=new u.Box(n.box.xmin-u.DP_TOL,n.box.ymin-u.DP_TOL,n.box.xmax+u.DP_TOL,n.box.ymax+u.DP_TOL);if(t.box.not_intersect(s))return u.OUTSIDE;let o=t.edges.search(s);if(o.length===0)return u.OUTSIDE;for(let p of o)if(p.shape.contains(e))return u.BOUNDARY;let c=[...t.faces],l=[];for(let p of o)for(let d of n.intersect(p.shape)){if(d.equalTo(e))return u.BOUNDARY;l.push({pt:d,edge:p,face_index:c.indexOf(p.face)})}l.sort((p,d)=\u003e{if(a1(p.pt.x,d.pt.x))return-1;if(s1(p.pt.x,d.pt.x))return 1;if(p.face_index\u003cd.face_index)return-1;if(p.face_index\u003ed.face_index)return 1;if(p.edge.arc_length\u003cd.edge.arc_length)return-1;if(p.edge.arc_length\u003ed.edge.arc_length)return 1;return 0});let a=0;for(let p=0;p\u003cl.length;p++){let d=l[p];if(d.pt.equalTo(d.edge.shape.start)){if(p\u003e0\u0026\u0026d.pt.equalTo(l[p-1].pt)\u0026\u0026d.face_index===l[p-1].face_index\u0026\u0026d.edge.prev===l[p-1].edge)continue;let m=d.edge.prev;while(rh(m.length))m=m.prev;let f=m.shape.tangentInEnd(),_=d.pt.translate(f),g=d.edge.shape.tangentInStart(),y=d.pt.translate(g),S=_.leftTo(i),P=y.leftTo(i);if(S\u0026\u0026!P||!S\u0026\u0026P)a++}else if(d.pt.equalTo(d.edge.shape.end)){if(p\u003e0\u0026\u0026d.pt.equalTo(l[p-1].pt)\u0026\u0026d.face_index===l[p-1].face_index\u0026\u0026d.edge.next===l[p-1].edge)continue;let m=d.edge.next;while(rh(m.length))m=m.next;let f=m.shape.tangentInStart(),_=d.pt.translate(f),g=d.edge.shape.tangentInEnd(),y=d.pt.translate(g),S=_.leftTo(i),P=y.leftTo(i);if(S\u0026\u0026!P||!S\u0026\u0026P)a++}else if(d.edge.shape instanceof u.Segment)a++;else{let m=d.edge.shape.box;if(!(Er(d.pt.y,m.ymin)||Er(d.pt.y,m.ymax)))a++}}return r=a%2===1?1:0,r}function hA(t,e){return hi(t,e).equal()}function I1(t,e){return hi(t,e).intersect()}function dA(t,e){return hi(t,e).touch()}function mA(t,e){return!I1(t,e)}function F1(t,e){return hi(t,e).inside()}function M1(t,e){return hi(t,e).covered()}function uA(t,e){return F1(e,t)}function C1(t,e){return M1(e,t)}function hi(t,e){if(t instanceof u.Line\u0026\u0026e instanceof u.Line)return fA(t,e);else if(t instanceof u.Line\u0026\u0026e instanceof u.Circle)return yA(t,e);else if(t instanceof u.Line\u0026\u0026e instanceof u.Box)return _A(t,e);else if(t instanceof u.Line\u0026\u0026e instanceof u.Polygon)return gA(t,e);else if((t instanceof u.Segment||t instanceof u.Arc)\u0026\u0026e instanceof u.Polygon)return e1(t,e);else if((t instanceof u.Segment||t instanceof u.Arc)\u0026\u0026(e instanceof u.Circle||e instanceof u.Box))return e1(t,new u.Polygon(e));else if(t instanceof u.Polygon\u0026\u0026e instanceof u.Polygon)return ks(t,e);else if((t instanceof u.Circle||t instanceof u.Box)\u0026\u0026(e instanceof u.Circle||e instanceof u.Box))return ks(new u.Polygon(t),new u.Polygon(e));else if((t instanceof u.Circle||t instanceof u.Box)\u0026\u0026e instanceof u.Polygon)return ks(new u.Polygon(t),e);else if(t instanceof u.Polygon\u0026\u0026(e instanceof u.Circle||e instanceof u.Box))return ks(t,new u.Polygon(e))}function fA(t,e){let r=new jr,n=ci(t,e);if(n.length===0)if(t.contains(e.pt)\u0026\u0026e.contains(t.pt))r.I2I=[t],r.I2E=[],r.E2I=[];else r.I2I=[],r.I2E=[t],r.E2I=[e];else r.I2I=n,r.I2E=t.split(n),r.E2I=e.split(n);return r}function yA(t,e){let r=new jr,n=Wr(t,e);if(n.length===0)r.I2I=[],r.I2B=[],r.I2E=[t],r.E2I=[e];else if(n.length===1)r.I2I=[],r.I2B=n,r.I2E=t.split(n),r.E2I=[e];else{let i=new $r([t]),s=t.sortPoints(n);i.split(s);let o=i.toShapes();r.I2I=[o[1]],r.I2B=s,r.I2E=[o[0],o[2]],r.E2I=new u.Polygon([e.toArc()]).cutWithLine(t)}return r}function _A(t,e){let r=new jr,n=ii(t,e);if(n.length===0)r.I2I=[],r.I2B=[],r.I2E=[t],r.E2I=[e];else if(n.length===1)r.I2I=[],r.I2B=n,r.I2E=t.split(n),r.E2I=[e];else{let i=new $r([t]),s=t.sortPoints(n);i.split(s);let o=i.toShapes();if(e.toSegments().some((c)=\u003ec.contains(n[0])\u0026\u0026c.contains(n[1])))r.I2I=[],r.I2B=[o[1]],r.I2E=[o[0],o[2]],r.E2I=[e];else r.I2I=[o[1]],r.I2B=s,r.I2E=[o[0],o[2]],r.E2I=new u.Polygon(e.toSegments()).cutWithLine(t)}return r}function gA(t,e){let r=new jr,n=Ao(t,e),i=new $r([t]),s=n.length\u003e0?n.slice():t.sortPoints(n);return i.split(s),[...i].forEach((o)=\u003eo.setInclusion(e)),r.I2I=[...i].filter((o)=\u003eo.bv===u.INSIDE).map((o)=\u003eo.shape),r.I2B=[...i].slice(1).map((o)=\u003eo.bv===u.BOUNDARY?o.shape:o.shape.start),r.I2E=[...i].filter((o)=\u003eo.bv===u.OUTSIDE).map((o)=\u003eo.shape),r.E2I=e.cutWithLine(t),r}function e1(t,e){let r=new jr,n=V3(t,e),i=n.length\u003e0?n.slice():t.sortPoints(n),s=new $r([t]);s.split(i),[...s].forEach((o)=\u003eo.setInclusion(e)),r.I2I=[...s].filter((o)=\u003eo.bv===u.INSIDE).map((o)=\u003eo.shape),r.I2B=[...s].slice(1).map((o)=\u003eo.bv===u.BOUNDARY?o.shape:o.shape.start),r.I2E=[...s].filter((o)=\u003eo.bv===u.OUTSIDE).map((o)=\u003eo.shape),r.B2I=[],r.B2B=[],r.B2E=[];for(let o of[t.start,t.end])switch(xo(e,o)){case u.INSIDE:r.B2I.push(o);break;case u.BOUNDARY:r.B2B.push(o);break;case u.OUTSIDE:r.B2E.push(o);break}return r}function ks(t,e){let r=new jr,[n,i]=P1(t,e),s=w1(t,e),o=oh(t,e),c=oh(e,t),[l,a]=A1(t,e),p=sh(t,e),d=sh(e,t);return r.I2I=s.isEmpty()?[]:[s],r.I2B=a,r.I2E=o.isEmpty()?[]:[o],r.B2I=l,r.B2B=n,r.B2E=p,r.E2I=c.isEmpty()?[]:[c],r.E2B=d,r}var xA=Object.freeze({__proto__:null,contain:uA,cover:C1,covered:M1,disjoint:mA,equal:hA,inside:F1,intersect:I1,relate:hi,touch:dA});class he{constructor(t=1,e=0,r=0,n=1,i=0,s=0){this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=s}fromMatrix3x3(t){let[e,r,n]=t[0],[i,s,o]=t[1];return new he(e,i,r,s,n,o)}toMatrix3x3(){return[[this.a,this.c,this.tx],[this.b,this.d,this.ty],[0,0,1]]}clone(){return new he(this.a,this.b,this.c,this.d,this.tx,this.ty)}transform(t){return[t[0]*this.a+t[1]*this.c+this.tx,t[0]*this.b+t[1]*this.d+this.ty]}multiply(t){return new he(this.a*t.a+this.c*t.b,this.b*t.a+this.d*t.b,this.a*t.c+this.c*t.d,this.b*t.c+this.d*t.d,this.a*t.tx+this.c*t.ty+this.tx,this.b*t.tx+this.d*t.ty+this.ty)}translate(...t){let e,r;if(t.length==1\u0026\u0026!isNaN(t[0].x)\u0026\u0026!isNaN(t[0].y))e=t[0].x,r=t[0].y;else if(t.length===2\u0026\u0026typeof t[0]==\"number\"\u0026\u0026typeof t[1]==\"number\")e=t[0],r=t[1];else throw $t.ILLEGAL_PARAMETERS;return this.multiply(new he(1,0,0,1,e,r))}rotate(t,e=0,r=0){let n=Math.cos(t),i=Math.sin(t);return this.translate(e,r).multiply(new he(n,i,-i,n,0,0)).translate(-e,-r)}scale(t,e){return this.multiply(new he(t,0,0,e,0,0))}equalTo(t){if(!u.Utils.EQ(this.tx,t.tx))return!1;if(!u.Utils.EQ(this.ty,t.ty))return!1;if(!u.Utils.EQ(this.a,t.a))return!1;if(!u.Utils.EQ(this.b,t.b))return!1;if(!u.Utils.EQ(this.c,t.c))return!1;if(!u.Utils.EQ(this.d,t.d))return!1;return!0}}u.Matrix=he;var bA=(...t)=\u003enew u.Matrix(...t);u.matrix=bA;class k1{constructor(t,e){this.low=t,this.high=e}get max(){return this.clone()}less_than(t){return this.low\u003ct.low||this.low===t.low\u0026\u0026this.high\u003ct.high}equal_to(t){return this.low===t.low\u0026\u0026this.high===t.high}intersect(t){return!this.not_intersect(t)}not_intersect(t){return this.high\u003ct.low||t.high\u003cthis.low}merge(t){let e=this.low===void 0?t.low:this.low\u003ct.low?this.low:t.low,r=this.high===void 0?t.high:this.high\u003et.high?this.high:t.high,n=this.clone();return n.low=e,n.high=r,n}output(){return[this.low,this.high]}comparable_less_than(t,e){return t\u003ce}}class yh extends k1{clone(){return new yh(this.low,this.high)}}var Jt=1,Ot=0;class Ue{constructor(t,e,r=null,n=null,i=null,s=Ot){if(this.left=r,this.right=n,this.parent=i,this.color=s,this.item={key:void 0,values:[]},e!==void 0)this.item.values.push(e);if(t!==void 0)if(Array.isArray(t)){let[o,c]=t;if(!Number.isNaN(o)\u0026\u0026!Number.isNaN(c)){let l=o,a=c;if(l\u003ea)[l,a]=[a,l];this.item.key=new yh(l,a)}}else this.item.key=t;this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0\u0026\u0026this.item.values.length===0\u0026\u0026this.left===null\u0026\u0026this.right===null\u0026\u0026this.color===Ot}requireKey(){if(!this.item.key)throw Error(\"Node key is undefined (nil/sentinel). Operation is not applicable.\");return this.item.key}less_than(t){let e=this.requireKey(),r=t.requireKey();return e.less_than(r)}_value_equal(t){let e=this.item.values[0],r=t.item.values[0];return e\u0026\u0026r\u0026\u0026e.equal_to?e.equal_to(r):e===r}equal_to(t){let e=this.requireKey(),r=t.requireKey();return e.equal_to(r)}intersect(t){let e=this.requireKey(),r=t.requireKey();return e.intersect(r)}copy_data(t){this.item.key=t.item.key,this.item.values=t.item.values.slice()}update_max(){if(this.max=this.item.key?this.item.key.max:void 0,this.right\u0026\u0026this.right.max)this.max=this.max?this.max.merge(this.right.max):this.right.max;if(this.left\u0026\u0026this.left.max)this.max=this.max?this.max.merge(this.left.max):this.left.max}not_intersect_left_subtree(t){if(!this.left)return!0;let e=this.left.max?this.left.max.high:this.left.item.key.high,r=this.requireKey(),n=t.requireKey();return r.comparable_less_than(e,n.low)}not_intersect_right_subtree(t){if(!this.right)return!0;let e=this.right.max?this.right.max.low:this.right.item.key.low,r=this.requireKey(),n=t.requireKey();return r.comparable_less_than(n.high,e)}}class So{constructor(){this.root=null,this.nil_node=new Ue}get size(){let t=0;return this.tree_walk(this.root,(e)=\u003et+=e.item.values.length),t}get keys(){let t=[];return this.tree_walk(this.root,(e)=\u003et.push(e.item.key.output())),t}get values(){let t=[];return this.tree_walk(this.root,(e)=\u003e{for(let r of e.item.values)t.push(r)}),t}get items(){let t=[];return this.tree_walk(this.root,(e)=\u003e{let r=e.item.key.output();for(let n of e.item.values)t.push({key:r,value:n})}),t}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(t,e=t){if(t===void 0)return;let r=this.tree_search(this.root,new Ue(t));if(r)return r.item.values.push(e),r;let n=new Ue(t,e,this.nil_node,this.nil_node,null,Jt);return this.tree_insert(n),this.recalc_max(n),n}exist(t,e=t){let r=this.tree_search(this.root,new Ue(t));if(!r)return!1;if(arguments.length\u003c2||e===t)return!0;return r.item.values.some((n)=\u003en\u0026\u0026n.equal_to?n.equal_to(e):n===e)}remove(t,e=t){let r=this.tree_search(this.root,new Ue(t));if(!r)return;if(arguments.length\u003c2)return this.tree_delete(r),r;let n=r.item.values.findIndex((i)=\u003ei\u0026\u0026i.equal_to?i.equal_to(e):i===e);if(n\u003e=0){if(r.item.values.splice(n,1),r.item.values.length===0)this.tree_delete(r);return r}return}search(t,e=(r,n)=\u003er===n?n.output():r){let r=new Ue(t),n=[];this.tree_search_interval(this.root,r,n);let i=[];for(let s of n)for(let o of s.item.values)i.push(e(o,s.item.key));return i}intersect_any(t){let e=new Ue(t);return this.tree_find_any_interval(this.root,e)}forEach(t){this.tree_walk(this.root,(e)=\u003e{for(let r of e.item.values)t(e.item.key,r)})}map(t){let e=new So;return this.tree_walk(this.root,(r)=\u003e{for(let n of r.item.values)e.insert(r.item.key,t(n,r.item.key))}),e}*iterate(t,e=(r,n)=\u003er===n?n.output():r){let r=null;if(t)r=this.tree_search_nearest_forward(this.root,new Ue(t));else if(this.root)r=this.local_minimum(this.root);while(r){for(let n of r.item.values)yield e(n,r.item.key);r=this.tree_successor(r)}}recalc_max(t){let e=t;while(e.parent!=null)e.parent.update_max(),e=e.parent}tree_insert(t){let e=this.root,r=null;if(this.root==null||this.root===this.nil_node)this.root=t;else{while(e!==this.nil_node)if(r=e,t.less_than(e))e=e.left;else e=e.right;if(t.parent=r,t.less_than(r))r.left=t;else r.right=t}this.insert_fixup(t)}insert_fixup(t){let e,r;e=t;while(e!==this.root\u0026\u0026e.parent.color===Jt)if(e.parent===e.parent.parent.left)if(r=e.parent.parent.right,r.color===Jt)e.parent.color=Ot,r.color=Ot,e.parent.parent.color=Jt,e=e.parent.parent;else{if(e===e.parent.right)e=e.parent,this.rotate_left(e);e.parent.color=Ot,e.parent.parent.color=Jt,this.rotate_right(e.parent.parent)}else if(r=e.parent.parent.left,r.color===Jt)e.parent.color=Ot,r.color=Ot,e.parent.parent.color=Jt,e=e.parent.parent;else{if(e===e.parent.left)e=e.parent,this.rotate_right(e);e.parent.color=Ot,e.parent.parent.color=Jt,this.rotate_left(e.parent.parent)}this.root.color=Ot}tree_delete(t){let e,r;if(t.left===this.nil_node||t.right===this.nil_node)e=t;else e=this.tree_successor(t);if(e.left!==this.nil_node)r=e.left;else r=e.right;if(r.parent=e.parent,e===this.root)this.root=r;else{if(e===e.parent.left)e.parent.left=r;else e.parent.right=r;e.parent.update_max()}if(this.recalc_max(r),e!==t)t.copy_data(e),t.update_max(),this.recalc_max(t);if(e.color===Ot)this.delete_fixup(r)}delete_fixup(t){let e=t,r;while(e!==this.root\u0026\u0026e.parent!=null\u0026\u0026e.color===Ot)if(e===e.parent.left){if(r=e.parent.right,r.color===Jt)r.color=Ot,e.parent.color=Jt,this.rotate_left(e.parent),r=e.parent.right;if(r.left.color===Ot\u0026\u0026r.right.color===Ot)r.color=Jt,e=e.parent;else{if(r.right.color===Ot)r.color=Jt,r.left.color=Ot,this.rotate_right(r),r=e.parent.right;r.color=e.parent.color,e.parent.color=Ot,r.right.color=Ot,this.rotate_left(e.parent),e=this.root}}else{if(r=e.parent.left,r.color===Jt)r.color=Ot,e.parent.color=Jt,this.rotate_right(e.parent),r=e.parent.left;if(r.left.color===Ot\u0026\u0026r.right.color===Ot)r.color=Jt,e=e.parent;else{if(r.left.color===Ot)r.color=Jt,r.right.color=Ot,this.rotate_left(r),r=e.parent.left;r.color=e.parent.color,e.parent.color=Ot,r.left.color=Ot,this.rotate_right(e.parent),e=this.root}}e.color=Ot}tree_search(t,e){if(t==null||t===this.nil_node)return;if(e.equal_to(t))return t;if(e.less_than(t))return this.tree_search(t.left,e);else return this.tree_search(t.right,e)}tree_search_nearest_forward(t,e){let r=null,n=t;while(n\u0026\u0026n!==this.nil_node)if(n.less_than(e))if(n.intersect(e))r=n,n=n.left;else n=n.right;else{if(!r||n.less_than(r))r=n;n=n.left}return r||null}tree_search_interval(t,e,r){if(t!=null\u0026\u0026t!==this.nil_node){if(t.left!==this.nil_node\u0026\u0026!t.not_intersect_left_subtree(e))this.tree_search_interval(t.left,e,r);if(t.intersect(e))r.push(t);if(t.right!==this.nil_node\u0026\u0026!t.not_intersect_right_subtree(e))this.tree_search_interval(t.right,e,r)}}tree_find_any_interval(t,e){let r=!1;if(t!=null\u0026\u0026t!==this.nil_node){if(t.left!==this.nil_node\u0026\u0026!t.not_intersect_left_subtree(e))r=this.tree_find_any_interval(t.left,e);if(!r)r=t.intersect(e);if(!r\u0026\u0026t.right!==this.nil_node\u0026\u0026!t.not_intersect_right_subtree(e))r=this.tree_find_any_interval(t.right,e)}return r}local_minimum(t){let e=t;while(e.left!=null\u0026\u0026e.left!==this.nil_node)e=e.left;return e}local_maximum(t){let e=t;while(e.right!=null\u0026\u0026e.right!==this.nil_node)e=e.right;return e}tree_successor(t){let e,r,n;if(t.right!==this.nil_node)e=this.local_minimum(t.right);else{r=t,n=t.parent;while(n!=null\u0026\u0026n.right===r)r=n,n=n.parent;e=n}return e}rotate_left(t){let e=t.right;if(t.right=e.left,e.left!==this.nil_node)e.left.parent=t;if(e.parent=t.parent,t===this.root)this.root=e;else if(t===t.parent.left)t.parent.left=e;else t.parent.right=e;if(e.left=t,t.parent=e,t!==null\u0026\u0026t!==this.nil_node)t.update_max();if(e!=null\u0026\u0026e!==this.nil_node)e.update_max()}rotate_right(t){let e=t.left;if(t.left=e.right,e.right!==this.nil_node)e.right.parent=t;if(e.parent=t.parent,t===this.root)this.root=e;else if(t===t.parent.left)t.parent.left=e;else t.parent.right=e;if(e.right=t,t.parent=e,t!==null\u0026\u0026t!==this.nil_node)t.update_max();if(e!=null\u0026\u0026e!==this.nil_node)e.update_max()}tree_walk(t,e){if(t!=null\u0026\u0026t!==this.nil_node)this.tree_walk(t.left,e),e(t),this.tree_walk(t.right,e)}testRedBlackProperty(){let t=!0;return this.tree_walk(this.root,function(e){if(e.color===Jt){if(!(e.left.color===Ot\u0026\u0026e.right.color===Ot))t=!1}}),t}testBlackHeightProperty(t){let e=0,r=0,n=0;if(t.color===Ot)e++;if(t.left!==this.nil_node)r=this.testBlackHeightProperty(t.left);else r=1;if(t.right!==this.nil_node)n=this.testBlackHeightProperty(t.right);else n=1;if(r!==n)throw Error(\"Red-black height property violated\");return e+=r,e}}class N1 extends Set{constructor(t){super(t);this.index=new So,this.forEach((e)=\u003ethis.index.insert(e))}add(t){let e=this.size,{key:r,value:n}=t,i=r||t.box,s=n||t;if(super.add(s),this.size\u003ee)this.index.insert(i,s);return this}delete(t){let{key:e,value:r}=t,n=e||t.box,i=r||t,s=super.delete(i);if(s)this.index.remove(n,i);return s}clear(){super.clear(),this.index=new So}search(t){return this.index.search(t)}hit(t){let e=new u.Box(t.x-1,t.y-1,t.x+1,t.y+1);return this.index.search(e).filter((n)=\u003et.on(n))}svg(){return[...this].reduce((e,r)=\u003ee+r.svg(),\"\")}}u.PlanarSet=N1;class Ge{get name(){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}get box(){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}clone(){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}translate(...t){return this.transform(new he().translate(...t))}rotate(t,e=new u.Point){return this.transform(new he().rotate(t,e.x,e.y))}scale(t,e){return this.transform(new he().scale(t,e))}transform(...t){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}toJSON(){return Object.assign({},this,{name:this.name})}svg(t={}){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}}var Y1=class t extends Ge{constructor(...e){super();if(this.x=0,this.y=0,e.length===0)return;if(e.length===1\u0026\u0026e[0]instanceof Array\u0026\u0026e[0].length===2){let r=e[0];if(typeof r[0]==\"number\"\u0026\u0026typeof r[1]==\"number\"){this.x=r[0],this.y=r[1];return}}if(e.length===1\u0026\u0026e[0]instanceof Object\u0026\u0026e[0].name===\"point\"){let{x:r,y:n}=e[0];this.x=r,this.y=n;return}if(e.length===2){if(typeof e[0]==\"number\"\u0026\u0026typeof e[1]==\"number\"){this.x=e[0],this.y=e[1];return}}throw $t.ILLEGAL_PARAMETERS}get box(){return new u.Box(this.x,this.y,this.x,this.y)}clone(){return new u.Point(this.x,this.y)}get vertices(){return[this.clone()]}equalTo(e){return u.Utils.EQ(this.x,e.x)\u0026\u0026u.Utils.EQ(this.y,e.y)}lessThan(e){if(u.Utils.LT(this.y,e.y))return!0;if(u.Utils.EQ(this.y,e.y)\u0026\u0026u.Utils.LT(this.x,e.x))return!0;return!1}transform(e){return new u.Point(e.transform([this.x,this.y]))}projectionOn(e){if(this.equalTo(e.pt))return this.clone();let r=new u.Vector(this,e.pt);if(u.Utils.EQ_0(r.cross(e.norm)))return e.pt.clone();let n=r.dot(e.norm),i=e.norm.multiply(n);return this.translate(i)}leftTo(e){let r=new u.Vector(e.pt,this);return u.Utils.GT(r.dot(e.norm),0)}distanceTo(e){if(e instanceof t){let r=e.x-this.x,n=e.y-this.y;return[Math.sqrt(r*r+n*n),new u.Segment(this,e)]}if(e instanceof u.Line)return u.Distance.point2line(this,e);if(e instanceof u.Circle)return u.Distance.point2circle(this,e);if(e instanceof u.Segment)return u.Distance.point2segment(this,e);if(e instanceof u.Arc)return u.Distance.point2arc(this,e);if(e instanceof u.Box)return u.Distance.point2polygon(this,new u.Polygon(e));if(e instanceof u.Polygon)return u.Distance.point2polygon(this,e);if(e instanceof u.PlanarSet)return u.Distance.shape2planarSet(this,e);if(e instanceof u.Multiline)return u.Distance.shape2multiline(this,e)}on(e){if(e instanceof u.Point)return this.equalTo(e);if(e.contains\u0026\u0026e.contains instanceof Function)return e.contains(this);throw u.Errors.UNSUPPORTED_SHAPE_TYPE}get name(){return\"point\"}svg(e={}){let r=e.r??3;return`\n\u003ccircle cx=\"${this.x}\" cy=\"${this.y}\" r=\"${r}\"\n ${Or({fill:\"red\",...e})} /\u003e`}};u.Point=Y1;var vA=(...t)=\u003enew u.Point(...t);u.point=vA;var SA=class extends Ge{constructor(...e){super();if(this.x=0,this.y=0,e.length===0)return;if(e.length===1\u0026\u0026e[0]instanceof Array\u0026\u0026e[0].length===2){let r=e[0];if(typeof r[0]==\"number\"\u0026\u0026typeof r[1]==\"number\"){this.x=r[0],this.y=r[1];return}}if(e.length===1\u0026\u0026e[0]instanceof Object\u0026\u0026e[0].name===\"vector\"){let{x:r,y:n}=e[0];this.x=r,this.y=n;return}if(e.length===1\u0026\u0026e[0]instanceof Object\u0026\u0026e[0].name===\"segment\"){let{start:r,end:n}=e[0];this.x=n.x-r.x,this.y=n.y-r.y;return}if(e.length===2){let r=e[0],n=e[1];if(typeof r==\"number\"\u0026\u0026typeof n==\"number\"){this.x=r,this.y=n;return}if(r instanceof u.Point\u0026\u0026n instanceof u.Point){this.x=n.x-r.x,this.y=n.y-r.y;return}}throw $t.ILLEGAL_PARAMETERS}clone(){return new u.Vector(this.x,this.y)}get slope(){let e=Math.atan2(this.y,this.x);if(e\u003c0)e=2*Math.PI+e;return e}get length(){return Math.sqrt(this.dot(this))}isZeroLength(){return u.Utils.EQ_0(this.length)}equalTo(e){return u.Utils.EQ(this.x,e.x)\u0026\u0026u.Utils.EQ(this.y,e.y)}multiply(e){return new u.Vector(e*this.x,e*this.y)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}normalize(){if(this.isZeroLength())throw $t.ZERO_DIVISION;return new u.Vector(this.x/this.length,this.y/this.length)}rotate(e,r=new u.Point){if(r.x===0\u0026\u0026r.y===0)return this.transform(new he().rotate(e));throw $t.OPERATION_IS_NOT_SUPPORTED}transform(e){return new u.Vector(e.transform([this.x,this.y]))}rotate90CCW(){return new u.Vector(-this.y,this.x)}rotate90CW(){return new u.Vector(this.y,-this.x)}invert(){return new u.Vector(-this.x,-this.y)}add(e){return new u.Vector(this.x+e.x,this.y+e.y)}subtract(e){return new u.Vector(this.x-e.x,this.y-e.y)}angleTo(e){let r=this.normalize(),n=e.normalize(),i=Math.atan2(r.cross(n),r.dot(n));if(i\u003c0)i+=2*Math.PI;return i}projectionOn(e){let r=e.normalize(),n=this.dot(r);return r.multiply(n)}get name(){return\"vector\"}};u.Vector=SA;var L1=(...t)=\u003enew u.Vector(...t);u.vector=L1;var T1=class t extends Ge{constructor(...e){super();if(this.ps=new u.Point,this.pe=new u.Point,e.length===0)return;if(e.length===1\u0026\u0026e[0]instanceof Array\u0026\u0026e[0].length===4){let r=e[0];this.ps=new u.Point(r[0],r[1]),this.pe=new u.Point(r[2],r[3]);return}if(e.length===1\u0026\u0026e[0]instanceof Object\u0026\u0026e[0].name===\"segment\"){let{ps:r,pe:n}=e[0];this.ps=new u.Point(r.x,r.y),this.pe=new u.Point(n.x,n.y);return}if(e.length===1\u0026\u0026e[0]instanceof u.Point){this.ps=e[0].clone();return}if(e.length===2\u0026\u0026e[0]instanceof u.Point\u0026\u0026e[1]instanceof u.Point){this.ps=e[0].clone(),this.pe=e[1].clone();return}if(e.length===4){this.ps=new u.Point(e[0],e[1]),this.pe=new u.Point(e[2],e[3]);return}throw $t.ILLEGAL_PARAMETERS}clone(){return new u.Segment(this.start,this.end)}get start(){return this.ps}get end(){return this.pe}get vertices(){return[this.ps.clone(),this.pe.clone()]}get length(){return this.start.distanceTo(this.end)[0]}get slope(){return new u.Vector(this.start,this.end).slope}get box(){return new u.Box(Math.min(this.start.x,this.end.x),Math.min(this.start.y,this.end.y),Math.max(this.start.x,this.end.x),Math.max(this.start.y,this.end.y))}equalTo(e){return this.ps.equalTo(e.ps)\u0026\u0026this.pe.equalTo(e.pe)}contains(e){return u.Utils.EQ_0(this.distanceToPoint(e))}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return wo(this,e);if(e instanceof u.Ray)return mh(e,this);if(e instanceof u.Segment)return Es(this,e);if(e instanceof u.Circle)return Rs(this,e);if(e instanceof u.Box)return R3(this,e);if(e instanceof u.Arc)return li(this,e);if(e instanceof u.Polygon)return hh(this,e);if(e instanceof u.Multiline)return pi(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2segment(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle){let[r,n]=u.Distance.segment2circle(this,e);return[r,n]}if(e instanceof u.Line){let[r,n]=u.Distance.segment2line(this,e);return[r,n]}if(e instanceof u.Segment){let[r,n]=u.Distance.segment2segment(this,e);return[r,n]}if(e instanceof u.Arc){let[r,n]=u.Distance.segment2arc(this,e);return[r,n]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2polygon(this,new u.Polygon(e));return[r,n]}if(e instanceof u.Polygon){let[r,n]=u.Distance.shape2polygon(this,e);return[r,n]}if(e instanceof u.PlanarSet){let[r,n]=u.Distance.shape2planarSet(this,e);return[r,n]}if(e instanceof u.Multiline)return u.Distance.shape2multiline(this,e)}tangentInStart(){return new u.Vector(this.start,this.end).normalize()}tangentInEnd(){return new u.Vector(this.end,this.start).normalize()}reverse(){return new t(this.end,this.start)}split(e){if(this.start.equalTo(e))return[null,this.clone()];if(this.end.equalTo(e))return[this.clone(),null];return[new u.Segment(this.start,e),new u.Segment(e,this.end)]}middle(){return new u.Point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}pointAtLength(e){if(e\u003ethis.length||e\u003c0)return null;if(e==0)return this.start;if(e==this.length)return this.end;let r=e/this.length;return new u.Point((this.end.x-this.start.x)*r+this.start.x,(this.end.y-this.start.y)*r+this.start.y)}distanceToPoint(e){let[r,...n]=u.Distance.point2segment(e,this);return r}definiteIntegral(e=0){let r=this.end.x-this.start.x,n=this.start.y-e,i=this.end.y-e;return r*(n+i)/2}transform(e=new u.Matrix){return new t(this.ps.transform(e),this.pe.transform(e))}isZeroLength(){return this.ps.equalTo(this.pe)}sortPoints(e){return new u.Line(this.start,this.end).sortPoints(e)}get name(){return\"segment\"}svg(e={}){return`\n\u003cline x1=\"${this.start.x}\" y1=\"${this.start.y}\" x2=\"${this.end.x}\" y2=\"${this.end.y}\" ${Or(e)} /\u003e`}};u.Segment=T1;var wA=(...t)=\u003enew u.Segment(...t);u.segment=wA;var{vector:go}=u,AA=class t extends Ge{constructor(...e){super();if(this.pt=new u.Point,this.norm=new u.Vector(0,1),e.length===0)return;if(e.length===1\u0026\u0026e[0]instanceof Object\u0026\u0026e[0].name===\"line\"){let{pt:r,norm:n}=e[0];this.pt=new u.Point(r),this.norm=new u.Vector(n);return}if(e.length===2){let r=e[0],n=e[1];if(r instanceof u.Point\u0026\u0026n instanceof u.Point){if(this.pt=r,this.norm=t.points2norm(r,n),this.norm.dot(go(this.pt.x,this.pt.y))\u003e=0)this.norm.invert();return}if(r instanceof u.Point\u0026\u0026n instanceof u.Vector){if(u.Utils.EQ_0(n.x)\u0026\u0026u.Utils.EQ_0(n.y))throw $t.ILLEGAL_PARAMETERS;if(this.pt=r.clone(),this.norm=n.clone(),this.norm=this.norm.normalize(),this.norm.dot(go(this.pt.x,this.pt.y))\u003e=0)this.norm.invert();return}if(r instanceof u.Vector\u0026\u0026n instanceof u.Point){if(u.Utils.EQ_0(r.x)\u0026\u0026u.Utils.EQ_0(r.y))throw $t.ILLEGAL_PARAMETERS;if(this.pt=n.clone(),this.norm=r.clone(),this.norm=this.norm.normalize(),this.norm.dot(go(this.pt.x,this.pt.y))\u003e=0)this.norm.invert();return}}throw $t.ILLEGAL_PARAMETERS}clone(){return new u.Line(this.pt,this.norm)}get start(){return}get end(){return}get length(){return Number.POSITIVE_INFINITY}get box(){return new u.Box(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}get middle(){return}get slope(){return new u.Vector(this.norm.y,-this.norm.x).slope}get standard(){let e=this.norm.x,r=this.norm.y,n=this.norm.dot(go(this.pt.x,this.pt.y));return[e,r,n]}parallelTo(e){return u.Utils.EQ_0(this.norm.cross(e.norm))}incidentTo(e){return this.parallelTo(e)\u0026\u0026this.pt.on(e)}contains(e){if(this.pt.equalTo(e))return!0;let r=new u.Vector(this.pt,e);return u.Utils.EQ_0(this.norm.dot(r))}coord(e){return go(e.x,e.y).cross(this.norm)}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return ci(this,e);if(e instanceof u.Ray)return b1(e,this);if(e instanceof u.Circle)return Wr(this,e);if(e instanceof u.Box)return ii(this,e);if(e instanceof u.Segment)return wo(e,this);if(e instanceof u.Arc)return Ts(this,e);if(e instanceof u.Polygon)return Ao(this,e);if(e instanceof u.Multiline)return pi(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2line(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle){let[r,n]=u.Distance.circle2line(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Segment){let[r,n]=u.Distance.segment2line(e,this);return[r,n.reverse()]}if(e instanceof u.Arc){let[r,n]=u.Distance.arc2line(e,this);return[r,n.reverse()]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2polygon(this,new u.Polygon(e));return[r,n]}if(e instanceof u.Polygon){let[r,n]=u.Distance.shape2polygon(this,e);return[r,n]}}split(e){if(e instanceof u.Point)return[new u.Ray(e,this.norm),new u.Ray(e,this.norm)];else{let r=new u.Multiline([this]),n=this.sortPoints(e);return r.split(n),r.toShapes()}}rotate(e,r=new u.Point){return new u.Line(this.pt.rotate(e,r),this.norm.rotate(e))}transform(e){return new u.Line(this.pt.transform(e),this.norm.clone())}sortPoints(e){return e.slice().sort((r,n)=\u003e{if(this.coord(r)\u003cthis.coord(n))return-1;if(this.coord(r)\u003ethis.coord(n))return 1;return 0})}get name(){return\"line\"}svg(e,r={}){let n=ii(this,e);if(n.length===0)return\"\";let i=n[0],s=n.length===2?n[1]:n.find((c)=\u003e!c.equalTo(i));if(s===void 0)s=i;return new u.Segment(i,s).svg(r)}static points2norm(e,r){if(e.equalTo(r))throw $t.ILLEGAL_PARAMETERS;return new u.Vector(e,r).normalize().rotate90CCW()}};u.Line=AA;var PA=(...t)=\u003enew u.Line(...t);u.line=PA;var E1=class extends Ge{constructor(...e){super();if(this.pc=new u.Point,this.r=1,e.length===1\u0026\u0026e[0]instanceof Object\u0026\u0026e[0].name===\"circle\"){let{pc:r,r:n}=e[0];this.pc=new u.Point(r),this.r=n}else{let[r,n]=[...e];if(r\u0026\u0026r instanceof u.Point)this.pc=r.clone();if(n!==void 0)this.r=n}}clone(){return new u.Circle(this.pc.clone(),this.r)}get center(){return this.pc}get box(){return new u.Box(this.pc.x-this.r,this.pc.y-this.r,this.pc.x+this.r,this.pc.y+this.r)}contains(e){if(e instanceof u.Point)return u.Utils.LE(e.distanceTo(this.center)[0],this.r);if(e instanceof u.Segment)return u.Utils.LE(e.start.distanceTo(this.center)[0],this.r)\u0026\u0026u.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof u.Arc)return this.intersect(e).length===0\u0026\u0026u.Utils.LE(e.start.distanceTo(this.center)[0],this.r)\u0026\u0026u.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof u.Circle)return this.intersect(e).length===0\u0026\u0026u.Utils.LE(e.r,this.r)\u0026\u0026u.Utils.LE(e.center.distanceTo(this.center)[0],this.r)}toArc(e=!0){return new u.Arc(this.center,this.r,Math.PI,-Math.PI,e)}scale(e,r){if(e!==r)throw $t.OPERATION_IS_NOT_SUPPORTED;if(!(this.pc.x===0\u0026\u0026this.pc.y===0))throw $t.OPERATION_IS_NOT_SUPPORTED;return new u.Circle(this.pc,this.r*e)}transform(e=new u.Matrix){return new u.Circle(this.pc.transform(e),this.r)}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return Wr(e,this);if(e instanceof u.Ray)return x1(e,this);if(e instanceof u.Segment)return Rs(e,this);if(e instanceof u.Circle)return p1(e,this);if(e instanceof u.Box)return O3(this,e);if(e instanceof u.Arc)return ph(e,this);if(e instanceof u.Polygon)return f1(this,e);if(e instanceof u.Multiline)return pi(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2circle(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle){let[r,n]=u.Distance.circle2circle(this,e);return[r,n]}if(e instanceof u.Line){let[r,n]=u.Distance.circle2line(this,e);return[r,n]}if(e instanceof u.Segment){let[r,n]=u.Distance.segment2circle(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Arc){let[r,n]=u.Distance.arc2circle(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2polygon(this,new u.Polygon(e));return[r,n]}if(e instanceof u.Polygon){let[r,n]=u.Distance.shape2polygon(this,e);return[r,n]}if(e instanceof u.PlanarSet){let[r,n]=u.Distance.shape2planarSet(this,e);return[r,n]}if(e instanceof u.Multiline){let[r,n]=u.Distance.shape2multiline(this,e);return[r,n]}}get name(){return\"circle\"}svg(e={}){return`\n\u003ccircle cx=\"${this.pc.x}\" cy=\"${this.pc.y}\" r=\"${this.r}\"\n ${Or({fill:\"none\",...e})} /\u003e`}};u.Circle=E1;var BA=(...t)=\u003enew u.Circle(...t);u.circle=BA;class _h extends Ge{constructor(...t){super();if(this.pc=new u.Point,this.r=1,this.startAngle=0,this.endAngle=2*Math.PI,this.counterClockwise=!0,t.length===0)return;if(t.length===1\u0026\u0026t[0]instanceof Object\u0026\u0026t[0].name===\"arc\"){let{pc:e,r,startAngle:n,endAngle:i,counterClockwise:s}=t[0];this.pc=new u.Point(e.x,e.y),this.r=r,this.startAngle=n,this.endAngle=i,this.counterClockwise=s}else{let[e,r,n,i,s]=[...t];if(e\u0026\u0026e instanceof u.Point)this.pc=e.clone();if(r!==void 0)this.r=r;if(n!==void 0)this.startAngle=n;if(i!==void 0)this.endAngle=i;if(s!==void 0)this.counterClockwise=s}}clone(){return new u.Arc(this.pc.clone(),this.r,this.startAngle,this.endAngle,this.counterClockwise)}get sweep(){let t=this.startAngle,e=this.endAngle;if(u.Utils.EQ(Math.abs(t-e),u.PIx2))return u.PIx2;if(Math.abs(t)\u003eu.PIx2)t-=Math.trunc(t/u.PIx2)*u.PIx2;if(t\u003c0)t+=u.PIx2;if(Math.abs(e)\u003eu.PIx2)e-=Math.trunc(e/u.PIx2)*u.PIx2;if(e\u003c0)e+=u.PIx2;let r=this.counterClockwise?e-t:t-e;if(r\u003c0)r+=u.PIx2;return r}get start(){return new u.Point(this.pc.x+this.r,this.pc.y).rotate(this.startAngle,this.pc)}get end(){return new u.Point(this.pc.x+this.r,this.pc.y).rotate(this.endAngle,this.pc)}get center(){return this.pc.clone()}get vertices(){return[this.start.clone(),this.end.clone()]}get length(){return Math.abs(this.sweep*this.r)}get box(){let e=this.breakToFunctional().reduce((r,n)=\u003er.merge(n.start.box),new u.Box);return e=e.merge(this.end.box),e}contains(t){if(!u.Utils.EQ(this.pc.distanceTo(t)[0],this.r))return!1;if(t.equalTo(this.start))return!0;let e=new u.Vector(this.pc,t).slope,r=new u.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise);return u.Utils.LE(r.length,this.length)}split(t){if(this.start.equalTo(t))return[null,this.clone()];if(this.end.equalTo(t))return[this.clone(),null];let e=new u.Vector(this.pc,t).slope;return[new u.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise),new u.Arc(this.pc,this.r,e,this.endAngle,this.counterClockwise)]}middle(){let t=this.counterClockwise?this.startAngle+this.sweep/2:this.startAngle-this.sweep/2;return new u.Arc(this.pc,this.r,this.startAngle,t,this.counterClockwise).end}pointAtLength(t){if(t\u003ethis.length||t\u003c0)return null;if(t===0)return this.start;if(t===this.length)return this.end;let e=t/this.length,r=this.counterClockwise?this.startAngle+this.sweep*e:this.startAngle-this.sweep*e;return new u.Arc(this.pc,this.r,this.startAngle,r,this.counterClockwise).end}chordHeight(){return(1-Math.cos(Math.abs(this.sweep/2)))*this.r}intersect(t){if(t instanceof u.Point)return this.contains(t)?[t]:[];if(t instanceof u.Line)return Ts(t,this);if(t instanceof u.Ray)return uh(t,this);if(t instanceof u.Circle)return ph(this,t);if(t instanceof u.Segment)return li(t,this);if(t instanceof u.Box)return W3(this,t);if(t instanceof u.Arc)return h1(this,t);if(t instanceof u.Polygon)return dh(this,t);if(t instanceof u.Multiline)return pi(this,t)}distanceTo(t){if(t instanceof u.Point){let[e,r]=u.Distance.point2arc(t,this);return r=r.reverse(),[e,r]}if(t instanceof u.Circle){let[e,r]=u.Distance.arc2circle(this,t);return[e,r]}if(t instanceof u.Line){let[e,r]=u.Distance.arc2line(this,t);return[e,r]}if(t instanceof u.Segment){let[e,r]=u.Distance.segment2arc(t,this);return r=r.reverse(),[e,r]}if(t instanceof u.Arc){let[e,r]=u.Distance.arc2arc(this,t);return[e,r]}if(t instanceof u.Box){let[e,r]=u.Distance.shape2polygon(this,new u.Polygon(t));return[e,r]}if(t instanceof u.Polygon){let[e,r]=u.Distance.shape2polygon(this,t);return[e,r]}if(t instanceof u.PlanarSet){let[e,r]=u.Distance.shape2planarSet(this,t);return[e,r]}if(t instanceof u.Multiline)return u.Distance.shape2multiline(this,t)}breakToFunctional(){let t=[],e=[0,Math.PI/2,Math.PI,3*Math.PI/2],r=this.startAngle,n=this.endAngle;if(u.Utils.EQ(Math.abs(r-n),u.PIx2))n=r;if(Math.abs(r)\u003eu.PIx2)r-=Math.trunc(r/u.PIx2)*u.PIx2;if(r\u003c0)r+=u.PIx2;if(Math.abs(n)\u003eu.PIx2)n-=Math.trunc(n/u.PIx2)*u.PIx2;if(n\u003c0)n+=u.PIx2;let i=r,s,o,c;if(this.counterClockwise)o=Math.ceil(r/(Math.PI/2))%4,c=1;else o=Math.floor(r/(Math.PI/2))%4,c=-1;for(let l=0,a=o;l\u003c4;l++,a=(a+c+4)%4){if(s=e[a],s===i)continue;let p=this.counterClockwise?s-r:r-s;if(p\u003c0)p+=u.PIx2;if(p\u003ethis.sweep)break;t.push(new u.Arc(this.pc,this.r,i,s,this.counterClockwise)),i=s}if(t.length===0)return t.push(this),t;if(s=n,i!==s)t.push(new u.Arc(this.pc,this.r,i,s,this.counterClockwise));return t}tangentInStart(){let t=new u.Vector(this.pc,this.start),e=this.counterClockwise?Math.PI/2:-Math.PI/2;return t.rotate(e).normalize()}tangentInEnd(){let t=new u.Vector(this.pc,this.end),e=this.counterClockwise?-Math.PI/2:Math.PI/2;return t.rotate(e).normalize()}reverse(){return new u.Arc(this.pc,this.r,this.endAngle,this.startAngle,!this.counterClockwise)}transform(t=new u.Matrix){let e=this.start.transform(t),r=this.end.transform(t),n=this.pc.transform(t),i=this.counterClockwise;if(t.a*t.d\u003c0)i=!i;return u.Arc.arcSE(n,e,r,i)}static arcSE(t,e,r,n){let{vector:i}=u,s=i(t,e).slope,o=i(t,r).slope;if(u.Utils.EQ(s,o))o+=2*Math.PI,n=!0;let c=i(t,e).length;return new u.Arc(t,c,s,o,n)}definiteIntegral(t=0){return this.breakToFunctional().reduce((n,i)=\u003en+i.circularSegmentDefiniteIntegral(t),0)}circularSegmentDefiniteIntegral(t){let r=new u.Segment(this.start,this.end).definiteIntegral(t),n=u.Utils.EQ(this.sweep,u.PIx2)?0:this.circularSegmentArea();return this.counterClockwise?r-n:r+n}circularSegmentArea(){return 0.5*this.r*this.r*(this.sweep-Math.sin(this.sweep))}sortPoints(t){let{vector:e}=u;return t.slice().sort((r,n)=\u003e{let i=e(this.pc,r).slope,s=e(this.pc,n).slope;if(i\u003cs)return-1;if(i\u003es)return 1;return 0})}get name(){return\"arc\"}svg(t={}){let e=this.sweep\u003c=Math.PI?\"0\":\"1\",r=this.counterClockwise?\"1\":\"0\";if(u.Utils.EQ(this.sweep,2*Math.PI))return new u.Circle(this.pc,this.r).svg(t);else return`\n\u003cpath d=\"M${this.start.x},${this.start.y}\n A${this.r},${this.r} 0 ${e},${r} ${this.end.x},${this.end.y}\"\n ${Or({fill:\"none\",...t})} /\u003e`}}u.Arc=_h;var IA=(...t)=\u003enew u.Arc(...t);u.arc=IA;class Tr extends Ge{constructor(t=void 0,e=void 0,r=void 0,n=void 0){super();this.xmin=t,this.ymin=e,this.xmax=r,this.ymax=n}clone(){return new Tr(this.xmin,this.ymin,this.xmax,this.ymax)}get low(){return new u.Point(this.xmin,this.ymin)}get high(){return new u.Point(this.xmax,this.ymax)}get max(){return this.clone()}get center(){return new u.Point((this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)}get width(){return Math.abs(this.xmax-this.xmin)}get height(){return Math.abs(this.ymax-this.ymin)}get box(){return this.clone()}not_intersect(t){return this.xmax\u003ct.xmin||this.xmin\u003et.xmax||this.ymax\u003ct.ymin||this.ymin\u003et.ymax}intersect(t){return!this.not_intersect(t)}merge(t){return new Tr(this.xmin===void 0?t.xmin:Math.min(this.xmin,t.xmin),this.ymin===void 0?t.ymin:Math.min(this.ymin,t.ymin),this.xmax===void 0?t.xmax:Math.max(this.xmax,t.xmax),this.ymax===void 0?t.ymax:Math.max(this.ymax,t.ymax))}less_than(t){if(this.low.lessThan(t.low))return!0;if(this.low.equalTo(t.low)\u0026\u0026this.high.lessThan(t.high))return!0;return!1}equal_to(t){return this.low.equalTo(t.low)\u0026\u0026this.high.equalTo(t.high)}output(){return this.clone()}comparable_less_than(t,e){return t.lessThan(e)}set(t,e,r,n){this.xmin=t,this.ymin=e,this.xmax=r,this.ymax=n}extend(t){if(t\u003c=0)return this.clone();return new Tr(this.xmin-t,this.ymin-t,this.xmax+t,this.ymax+t)}toPoints(){return[new u.Point(this.xmin,this.ymin),new u.Point(this.xmax,this.ymin),new u.Point(this.xmax,this.ymax),new u.Point(this.xmin,this.ymax)]}toSegments(){let t=this.toPoints();return[new u.Segment(t[0],t[1]),new u.Segment(t[1],t[2]),new u.Segment(t[2],t[3]),new u.Segment(t[3],t[0])]}rotate(t,e=new u.Point){throw $t.OPERATION_IS_NOT_SUPPORTED}transform(t=new u.Matrix){return this.toPoints().map((r)=\u003er.transform(t)).reduce((r,n)=\u003er.merge(n.box),new Tr)}contains(t){if(t instanceof u.Point)return t.x\u003e=this.xmin\u0026\u0026t.x\u003c=this.xmax\u0026\u0026t.y\u003e=this.ymin\u0026\u0026t.y\u003c=this.ymax;if(t instanceof u.Segment)return t.vertices.every((e)=\u003ethis.contains(e));if(t instanceof u.Box)return t.toSegments().every((e)=\u003ethis.contains(e));if(t instanceof u.Circle)return this.contains(t.box);if(t instanceof u.Arc)return t.vertices.every((e)=\u003ethis.contains(e))\u0026\u0026this.toSegments().every((e)=\u003eli(e,t).length===0);if(t instanceof u.Line||t instanceof u.Ray)return!1;if(t instanceof u.Multiline)return t.toShapes().every((e)=\u003ethis.contains(e));if(t instanceof u.Polygon)return this.contains(t.box)}distanceTo(t){let e=this.toSegments().map((n)=\u003en.distanceTo(t)),r=[Number.MAX_SAFE_INTEGER,null];return e.forEach((n)=\u003e{if(n[0]\u003cr[0])r=n}),r}get name(){return\"box\"}svg(t={}){let e=this.xmax-this.xmin,r=this.ymax-this.ymin;return`\n\u003crect x=\"${this.xmin}\" y=\"${this.ymin}\" width=\"${e}\" height=\"${r}\"\n ${Or({fill:\"none\",...t})} /\u003e`}}u.Box=Tr;var FA=(...t)=\u003enew u.Box(...t);u.box=FA;class R1{constructor(t){this.shape=t,this.next=void 0,this.prev=void 0,this.face=void 0,this.arc_length=0,this.bvStart=void 0,this.bvEnd=void 0,this.bv=void 0,this.overlap=void 0}get start(){return this.shape.start}get end(){return this.shape.end}get length(){return this.shape.length}get box(){return this.shape.box}get isSegment(){return this.shape instanceof u.Segment}get isArc(){return this.shape instanceof u.Arc}get isLine(){return this.shape instanceof u.Line}get isRay(){return this.shape instanceof u.Ray}middle(){return this.shape.middle()}pointAtLength(t){return this.shape.pointAtLength(t)}contains(t){return this.shape.contains(t)}setInclusion(t){if(this.bv!==void 0)return this.bv;if(this.shape instanceof u.Line||this.shape instanceof u.Ray)return this.bv=u.OUTSIDE,this.bv;if(this.bvStart===void 0)this.bvStart=xo(t,this.start);if(this.bvEnd===void 0)this.bvEnd=xo(t,this.end);if(this.bvStart===u.OUTSIDE||this.bvEnd==u.OUTSIDE)this.bv=u.OUTSIDE;else if(this.bvStart===u.INSIDE||this.bvEnd==u.INSIDE)this.bv=u.INSIDE;else{let e=xo(t,this.middle());this.bv=e}return this.bv}setOverlap(t){let e=void 0,r=this.shape,n=t.shape;if(r instanceof u.Segment\u0026\u0026n instanceof u.Segment){if(r.start.equalTo(n.start)\u0026\u0026r.end.equalTo(n.end))e=u.OVERLAP_SAME;else if(r.start.equalTo(n.end)\u0026\u0026r.end.equalTo(n.start))e=u.OVERLAP_OPPOSITE}else if(r instanceof u.Arc\u0026\u0026n instanceof u.Arc){if(r.start.equalTo(n.start)\u0026\u0026r.end.equalTo(n.end)\u0026\u0026r.middle().equalTo(n.middle()))e=u.OVERLAP_SAME;else if(r.start.equalTo(n.end)\u0026\u0026r.end.equalTo(n.start)\u0026\u0026r.middle().equalTo(n.middle()))e=u.OVERLAP_OPPOSITE}else if(r instanceof u.Segment\u0026\u0026n instanceof u.Arc||r instanceof u.Arc\u0026\u0026n instanceof u.Segment){if(r.start.equalTo(n.start)\u0026\u0026r.end.equalTo(n.end)\u0026\u0026r.middle().equalTo(n.middle()))e=u.OVERLAP_SAME;else if(r.start.equalTo(n.end)\u0026\u0026r.end.equalTo(n.start)\u0026\u0026r.middle().equalTo(n.middle()))e=u.OVERLAP_OPPOSITE}if(this.overlap===void 0)this.overlap=e;if(t.overlap===void 0)t.overlap=e}svg(){if(this.shape instanceof u.Segment)return` L${this.shape.end.x},${this.shape.end.y}`;else if(this.shape instanceof u.Arc){let t=this.shape,e,r=t.counterClockwise?\"1\":\"0\";if(u.Utils.EQ(t.sweep,2*Math.PI)){let n=t.counterClockwise?1:-1,i=new u.Arc(t.pc,t.r,t.startAngle,t.startAngle+n*Math.PI,t.counterClockwise),s=new u.Arc(t.pc,t.r,t.startAngle+n*Math.PI,t.endAngle,t.counterClockwise);return e=\"0\",` A${i.r},${i.r} 0 ${e},${r} ${i.end.x},${i.end.y}\n A${s.r},${s.r} 0 ${e},${r} ${s.end.x},${s.end.y}`}else return e=t.sweep\u003c=Math.PI?\"0\":\"1\",` A${t.r},${t.r} 0 ${e},${r} ${t.end.x},${t.end.y}`}}toJSON(){return this.shape.toJSON()}}u.Edge=R1;class O1 extends Ls{constructor(t,e){super(t,e);this.setCircularLinks()}setCircularLinks(){if(this.isEmpty())return;this.last.next=this.first,this.first.prev=this.last}[Symbol.iterator](){let t=void 0;return{next:()=\u003e{let e=t?t:this.first,r=this.first?t?t===this.first:!1:!0;return t=e?e.next:void 0,{value:e,done:r}}}}append(t){return super.append(t),this.setCircularLinks(),this}insert(t,e){return super.insert(t,e),this.setCircularLinks(),this}remove(t){return super.remove(t),this}}class ri extends O1{constructor(t,...e){super();if(this._box=void 0,this._orientation=void 0,e.length===0)return;if(e.length===1){if(e[0]instanceof Array){let r=e[0];if(r.length===0)return;if(r.every((n)=\u003en instanceof u.Point)){let n=ri.points2segments(r);this.shapes2face(t.edges,n)}else if(r.every((n)=\u003en instanceof Array\u0026\u0026n.length===2)){let n=r.map((s)=\u003enew u.Point(s[0],s[1])),i=ri.points2segments(n);this.shapes2face(t.edges,i)}else if(r.every((n)=\u003en instanceof u.Segment||n instanceof u.Arc))this.shapes2face(t.edges,r);else if(r.every((n)=\u003en.name===\"segment\"||n.name===\"arc\")){let n=[];for(let i of r){let s;if(i.name===\"segment\")s=new u.Segment(i);else s=new u.Arc(i);n.push(s)}this.shapes2face(t.edges,n)}}else if(e[0]instanceof ri){let r=e[0];this.first=r.first,this.last=r.last;for(let n of r)t.edges.add(n)}else if(e[0]instanceof u.Circle)this.shapes2face(t.edges,[e[0].toArc(!0)]);else if(e[0]instanceof u.Box){let r=e[0];this.shapes2face(t.edges,[new u.Segment(new u.Point(r.xmin,r.ymin),new u.Point(r.xmax,r.ymin)),new u.Segment(new u.Point(r.xmax,r.ymin),new u.Point(r.xmax,r.ymax)),new u.Segment(new u.Point(r.xmax,r.ymax),new u.Point(r.xmin,r.ymax)),new u.Segment(new u.Point(r.xmin,r.ymax),new u.Point(r.xmin,r.ymin))])}}if(e.length===2\u0026\u0026e[0]instanceof u.Edge\u0026\u0026e[1]instanceof u.Edge)this.first=e[0],this.last=e[1],this.last.next=this.first,this.first.prev=this.last,this.setArcLength()}get edges(){return this.toArray()}get vertices(){return this.edges.map((t)=\u003et.shape.start.clone())}get shapes(){return this.edges.map((t)=\u003et.shape.clone())}get box(){if(this._box===void 0){let t=new u.Box;for(let e of this)t=t.merge(e.box);this._box=t}return this._box}get perimeter(){return this.last.arc_length+this.last.length}pointAtLength(t){if(t\u003ethis.perimeter||t\u003c0)return null;let e=null;for(let r of this)if(t\u003e=r.arc_length\u0026\u0026(r===this.last||t\u003cr.next.arc_length)){e=r.pointAtLength(t-r.arc_length);break}return e}static points2segments(t){let e=[];for(let r=0;r\u003ct.length;r++){if(t[r].equalTo(t[(r+1)%t.length]))continue;e.push(new u.Segment(t[r],t[(r+1)%t.length]))}return e}shapes2face(t,e){for(let r of e){let n=new u.Edge(r);this.append(n),t.add(n)}}append(t){return super.append(t),this.setOneEdgeArcLength(t),t.face=this,this}insert(t,e){return super.insert(t,e),this.setOneEdgeArcLength(t),t.face=this,this}remove(t){return super.remove(t),this.setArcLength(),this}merge_with_next_edge(t){return t.shape.end.x=t.next.shape.end.x,t.shape.end.y=t.next.shape.end.y,this.remove(t.next),this}reverse(){let t=[],e=this.last;do e.shape=e.shape.reverse(),t.push(e),e=e.prev;while(e!==this.last);this.first=void 0,this.last=void 0;for(let r of t){if(this.first===void 0)r.prev=r,r.next=r,this.first=r,this.last=r;else r.prev=this.last,this.last.next=r,this.last=r,this.last.next=this.first,this.first.prev=this.last;this.setOneEdgeArcLength(r)}if(this._orientation!==void 0)this._orientation=void 0,this._orientation=this.orientation()}setArcLength(){for(let t of this)this.setOneEdgeArcLength(t),t.face=this}setOneEdgeArcLength(t){if(t===this.first)t.arc_length=0;else t.arc_length=t.prev.arc_length+t.prev.length}area(){return Math.abs(this.signedArea())}signedArea(){let t=0,e=this.box.ymin;for(let r of this)t+=r.shape.definiteIntegral(e);return t}orientation(){if(this._orientation===void 0){let t=this.signedArea();if(u.Utils.EQ_0(t))this._orientation=ni.NOT_ORIENTABLE;else if(u.Utils.LT(t,0))this._orientation=ni.CCW;else this._orientation=ni.CW}return this._orientation}isSimple(t){return ri.getSelfIntersections(this,t,!0).length===0}static getSelfIntersections(t,e,r=!1){let n=[];for(let i of t){let s=e.search(i.box);for(let o of s){if(i===o)continue;if(o.face!==t)continue;if(i.shape instanceof u.Segment\u0026\u0026o.shape instanceof u.Segment\u0026\u0026(i.next===o||i.prev===o))continue;let c=i.shape.intersect(o.shape);for(let l of c){if(l.equalTo(i.start)\u0026\u0026l.equalTo(o.end)\u0026\u0026o===i.prev)continue;if(l.equalTo(i.end)\u0026\u0026l.equalTo(o.start)\u0026\u0026o===i.next)continue;if(n.push(l),r)break}if(n.length\u003e0\u0026\u0026r)break}if(n.length\u003e0\u0026\u0026r)break}return n}findEdgeByPoint(t){let e;for(let r of this){if(t.equalTo(r.shape.start))continue;if(t.equalTo(r.shape.end)||r.shape.contains(t)){e=r;break}}return e}toPolygon(){return new u.Polygon(this.shapes)}toJSON(){return this.edges.map((t)=\u003et.toJSON())}svg(){let t=`M${this.first.start.x},${this.first.start.y}`;for(let e of this)t+=e.svg();return t+=\" z\",t}}u.Face=ri;class gh extends Ge{constructor(...t){super();if(this.pt=new u.Point,this.norm=new u.Vector(0,1),t.length===0)return;if(t.length\u003e=1\u0026\u0026t[0]instanceof u.Point)this.pt=t[0].clone();if(t.length===1)return;if(t.length===2\u0026\u0026t[1]instanceof u.Vector){this.norm=t[1].clone();return}throw $t.ILLEGAL_PARAMETERS}clone(){return new gh(this.pt,this.norm)}get slope(){return new u.Vector(this.norm.y,-this.norm.x).slope}get box(){let t=this.slope;return new u.Box(t\u003eMath.PI/2\u0026\u0026t\u003c3*Math.PI/2?Number.NEGATIVE_INFINITY:this.pt.x,t\u003e=0\u0026\u0026t\u003c=Math.PI?this.pt.y:Number.NEGATIVE_INFINITY,t\u003e=Math.PI/2\u0026\u0026t\u003c=3*Math.PI/2?this.pt.x:Number.POSITIVE_INFINITY,t\u003e=Math.PI\u0026\u0026t\u003c=2*Math.PI||t===0?this.pt.y:Number.POSITIVE_INFINITY)}get start(){return this.pt}get end(){return}get length(){return Number.POSITIVE_INFINITY}contains(t){if(this.pt.equalTo(t))return!0;let e=new u.Vector(this.pt,t);return u.Utils.EQ_0(this.norm.dot(e))\u0026\u0026u.Utils.GE(e.cross(this.norm),0)}coord(t){return L1(t.x,t.y).cross(this.norm)}split(t){if(!this.contains(t))return[];if(this.pt.equalTo(t))return[this];return[new u.Segment(this.pt,t),new u.Ray(t,this.norm)]}intersect(t){if(t instanceof u.Point)return this.contains(t)?[t]:[];if(t instanceof u.Segment)return mh(this,t);if(t instanceof u.Arc)return uh(this,t);if(t instanceof u.Line)return b1(this,t);if(t instanceof u.Ray)return U3(this,t);if(t instanceof u.Circle)return x1(this,t);if(t instanceof u.Box)return z3(this,t);if(t instanceof u.Polygon)return v1(this,t);if(t instanceof u.Multiline)return pi(this,t)}rotate(t,e=new u.Point){return new u.Ray(this.pt.rotate(t,e),this.norm.rotate(t))}transform(t){return new u.Ray(this.pt.transform(t),this.norm.clone())}get name(){return\"ray\"}svg(t,e={}){let r=new u.Line(this.pt,this.norm),n=ii(r,t);if(n=n.filter((s)=\u003ethis.contains(s)),n.length===0||n.length===2)return\"\";return new u.Segment(this.pt,n[0]).svg(e)}}u.Ray=gh;var MA=(...t)=\u003enew u.Ray(...t);u.ray=MA;var W1=class t{constructor(){this.faces=new u.PlanarSet,this.edges=new u.PlanarSet;let e=[...arguments];if(e.length===1\u0026\u0026(e[0]instanceof Array\u0026\u0026e[0].length\u003e0||e[0]instanceof u.Circle||e[0]instanceof u.Box)){let r=e[0];if(e[0]instanceof Array\u0026\u0026e[0].every((n)=\u003en instanceof Array))if(r.every((n)=\u003en instanceof Array\u0026\u0026n.length===2\u0026\u0026typeof n[0]===\"number\"\u0026\u0026typeof n[1]===\"number\"))this.faces.add(new u.Face(this,r));else for(let n of r)if(n instanceof Array\u0026\u0026n[0]instanceof Array\u0026\u0026n[0].every((i)=\u003ei instanceof Array\u0026\u0026i.length===2\u0026\u0026typeof i[0]===\"number\"\u0026\u0026typeof i[1]===\"number\"))for(let i of n)this.faces.add(new u.Face(this,i));else this.faces.add(new u.Face(this,n));else this.faces.add(new u.Face(this,r))}}get box(){return[...this.faces].reduce((e,r)=\u003ee.merge(r.box),new u.Box)}get vertices(){return[...this.faces].flatMap((e)=\u003ee.vertices)}clone(){let e=new t;for(let r of this.faces)e.addFace(r.shapes);return e}createFromArray(e){let r=new t;return e.forEach((n)=\u003e[...n.faces].forEach((i)=\u003er.addFace(i.shapes))),r}isEmpty(){return this.edges.size===0||this.faces.size===0}isValid(){let e=!0;for(let r of this.faces)if(!r.isSimple(this.edges)){e=!1;break}return e}area(){let e=[...this.faces].reduce((r,n)=\u003er+n.signedArea(),0);return Math.abs(e)}addFace(...e){let r=new u.Face(this,...e);return this.faces.add(r),r}deleteFace(e){for(let r of e)this.edges.delete(r);return this.faces.delete(e)}recreateFaces(){this.faces.clear();for(let n of this.edges)n.face=null;let e,r=!0;while(r){r=!1;for(let n of this.edges)if(n.face===null){e=n,r=!0;break}if(r){let n=e;do n=n.next;while(n.next!==e);this.addFace(e,n)}}}removeChain(e,r,n){if(n.next===r){this.deleteFace(e);return}for(let i=r;i!==n.next;i=i.next)if(e.remove(i),this.edges.delete(i),e.isEmpty()){this.deleteFace(e);break}}addVertex(e,r){let n=r.shape.split(e);if(n[0]===null)return r.prev;if(n[1]===null)return r;let i=new u.Edge(n[0]),s=r.prev;return r.face.insert(i,s),this.edges.delete(r),this.edges.add(i),r.shape=n[1],this.edges.add(r),i}removeEndVertex(e){let r=e.next;if(r===e)return;e.face.merge_with_next_edge(e),this.edges.delete(r)}cut(e){let n=this.splitToIslands().flatMap((i)=\u003ei._cutSingleIsland(e)).filter((i)=\u003ei.isValid()\u0026\u0026i.isEmpty()===!1);return this.createFromArray(n)}_cutSingleIsland(e){let r=this.clone(),n=e.clone(),i={int_points1:[],int_points2:[],int_points1_sorted:[],int_points2_sorted:[]};for(let c of n.edges)for(let l of r.edges){let a=y1(c,l);for(let p of a)oi(c,p,i.int_points1),oi(l,p,i.int_points2)}if(i.int_points1.length===0)return r;i.int_points1_sorted=mr(i.int_points1),i.int_points2_sorted=mr(i.int_points2),ai(n,i.int_points1_sorted),ai(r,i.int_points2_sorted),fh(i),i.int_points1_sorted=mr(i.int_points1),i.int_points2_sorted=mr(i.int_points2),nh(i.int_points1),ih(i.int_points1,r);for(let c of i.int_points1_sorted)if(c.edge_before\u0026\u0026c.edge_after\u0026\u0026c.edge_before.bv===c.edge_after.bv)i.int_points2[c.id]=-1,c.id=-1;if(i.int_points1=i.int_points1.filter((c)=\u003ec.id\u003e=0),i.int_points2=i.int_points2.filter((c)=\u003ec.id\u003e=0),i.int_points1.forEach((c,l)=\u003e{c.id=l}),i.int_points2.forEach((c,l)=\u003e{c.id=l}),i.int_points1.length===0)return r;i.int_points1_sorted=mr(i.int_points1),i.int_points2_sorted=mr(i.int_points2);let s,o;for(let c=1;c\u003ci.int_points1_sorted.length;c++)if(o=i.int_points1_sorted[c],s=i.int_points1_sorted[c-1],o.edge_before\u0026\u0026o.edge_before.bv===1){let l=s.edge_after,a=o.edge_before,p=n.getChain(l,a);Hb(i.int_points2[s.id],i.int_points2[o.id],p),p.forEach((d)=\u003er.edges.add(d)),p=p.reverse().map((d)=\u003enew u.Edge(d.shape.reverse()));for(let d=0;d\u003cp.length-1;d++)p[d].next=p[d+1],p[d+1].prev=p[d];Hb(i.int_points2[o.id],i.int_points2[s.id],p),p.forEach((d)=\u003er.edges.add(d))}return r.recreateFaces(),r}cutWithLine(e){let r=new $r([e]);return this.cut(r)}findEdgeByPoint(e){let r;for(let n of this.faces)if(r=n.findEdgeByPoint(e),r!==void 0)break;return r}splitToIslands(){if(this.isEmpty())return[];let e=this.toArray();e.sort((i,s)=\u003es.area()-i.area());let r=[...e[0].faces][0].orientation(),n=e.filter((i)=\u003e[...i.faces][0].orientation()===r);for(let i of e){let s=[...i.faces][0];if(s.orientation()===r)continue;for(let o of n)if(s.shapes.every((c)=\u003eo.contains(c))){o.addFace(s.shapes);break}}return n}rearrange(){if(this.faces.size\u003c=1)return this.clone();let e=this.splitToIslands(),r=new t;return e.forEach((n)=\u003e{n.faces.forEach((i)=\u003er.addFace(i.shapes))}),r}orientation(){if(this.isEmpty())return ni.NOT_ORIENTABLE;return[...this.faces][0].orientation()}isOuter(e){return e.orientation()===this.orientation()}isMultiPolygon(){let e=0;return this.faces.forEach((r)=\u003e{if(this.isOuter(r))e++}),e\u003e1}reverse(){for(let e of this.faces)e.reverse();return this}contains(e){if(e instanceof u.Point){let r=xo(this,e);return r===1||r===2}else return C1(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2polygon(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle||e instanceof u.Line||e instanceof u.Segment||e instanceof u.Arc){let[r,n]=u.Distance.shape2polygon(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Box)return this.distanceTo(new u.Polygon(e));if(e instanceof u.Polygon){let r=[Number.POSITIVE_INFINITY,new u.Segment],n,i;for(let s of this.edges){let o=r[0];if([n,i]=u.Distance.shape2planarSet(s.shape,e.edges,o),u.Utils.LT(n,o))r=[n,i]}return r}}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return Ao(e,this);if(e instanceof u.Ray)return v1(e,this);if(e instanceof u.Circle)return f1(e,this);if(e instanceof u.Segment)return hh(e,this);if(e instanceof u.Arc)return dh(e,this);if(e instanceof u.Polygon)return D3(e,this);if(e instanceof u.Multiline)return X3(e,this)}translate(e){let r=new t;for(let n of this.faces)r.addFace(n.shapes.map((i)=\u003ei.translate(e)));return r}rotate(e=0,r=new u.Point){let n=new t;for(let i of this.faces)n.addFace(i.shapes.map((s)=\u003es.rotate(e,r)));return n}scale(e,r){let n=new t;for(let i of this.faces)n.addFace(i.shapes.map((s)=\u003es.scale(e,r)));return n}transform(e=new u.Matrix){let r=new t;for(let n of this.faces)r.addFace(n.shapes.map((i)=\u003ei.transform(e)));return r}toJSON(){return[...this.faces].map((e)=\u003ee.toJSON())}toArray(){return[...this.faces].map((e)=\u003ee.toPolygon())}dpath(){return[...this.faces].reduce((e,r)=\u003ee+r.svg(),\"\")}svg(e={}){let r=`\n\u003cpath ${Or({fillRule:\"evenodd\",fill:\"lightcyan\",...e})} d=\"`;for(let n of this.faces)r+=`\n${n.svg()}`;return r+=`\" \u003e\n\u003c/path\u003e`,r}};u.Polygon=W1;var CA=(...t)=\u003enew u.Polygon(...t);u.polygon=CA;var{Circle:th,Line:r1,Point:n1,Vector:Ns,Utils:eh}=u;class bo{constructor(t){this.circle=t}get inversion_circle(){return this.circle}static inversePoint(t,e){let r=new Ns(t.pc,e),n=t.r*t.r,i=r.dot(r);return eh.EQ_0(i)?new n1(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY):t.pc.translate(r.multiply(n/i))}static inverseCircle(t,e){let r=t.pc.distanceTo(e.pc)[0];if(eh.EQ(r,e.r)){let n=t.r*t.r/(2*e.r),i=new Ns(t.pc,e.pc);i=i.normalize();let s=t.pc.translate(i.multiply(n));return new r1(s,i)}else{let n=new Ns(t.pc,e.pc),i=t.r*t.r/(n.dot(n)-e.r*e.r),s=t.pc.translate(n.multiply(i)),o=Math.abs(i)*e.r;return new th(s,o)}}static inverseLine(t,e){let[r,n]=t.pc.distanceTo(e);if(eh.EQ_0(r))return e.clone();else{let i=t.r*t.r/(2*r),s=new Ns(t.pc,n.end);return s=s.multiply(i/r),new th(t.pc.translate(s),i)}}inverse(t){if(t instanceof n1)return bo.inversePoint(this.circle,t);else if(t instanceof th)return bo.inverseCircle(this.circle,t);else if(t instanceof r1)return bo.inverseLine(this.circle,t)}}u.Inversion=bo;var kA=(t)=\u003enew u.Inversion(t);u.inversion=kA;class ht{static point2point(t,e){return t.distanceTo(e)}static point2line(t,e){let r=t.projectionOn(e);return[new u.Vector(t,r).length,new u.Segment(t,r)]}static point2circle(t,e){let[r,n]=t.distanceTo(e.center);if(u.Utils.EQ_0(r))return[e.r,new u.Segment(t,e.toArc().start)];else{let i=Math.abs(r-e.r),s=new u.Vector(e.pc,t).normalize().multiply(e.r),o=e.pc.translate(s);return[i,new u.Segment(t,o)]}}static point2segment(t,e){if(e.start.equalTo(e.end))return ht.point2point(t,e.start);let r=new u.Vector(e.start,e.end),n=new u.Vector(e.start,t),i=new u.Vector(e.end,t),s=r.dot(n),o=-r.dot(i),c,l;if(u.Utils.GE(s,0)\u0026\u0026u.Utils.GE(o,0)){let a=e.tangentInStart();return c=Math.abs(a.cross(n)),l=e.start.translate(a.multiply(a.dot(n))),[c,new u.Segment(t,l)]}else if(s\u003c0)return t.distanceTo(e.start);else return t.distanceTo(e.end)}static point2arc(t,e){let r=new u.Circle(e.pc,e.r),n=[],i,s;if([i,s]=ht.point2circle(t,r),s.end.on(e))n.push(ht.point2circle(t,r));return n.push(ht.point2point(t,e.start)),n.push(ht.point2point(t,e.end)),ht.sort(n),n[0]}static point2edge(t,e){return e.shape instanceof u.Segment?ht.point2segment(t,e.shape):ht.point2arc(t,e.shape)}static segment2line(t,e){let r=t.intersect(e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let n=[];return n.push(ht.point2line(t.start,e)),n.push(ht.point2line(t.end,e)),ht.sort(n),n[0]}static segment2segment(t,e){let r=Es(t,e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let n=[],i,s;return[i,s]=ht.point2segment(e.start,t),n.push([i,s.reverse()]),[i,s]=ht.point2segment(e.end,t),n.push([i,s.reverse()]),n.push(ht.point2segment(t.start,e)),n.push(ht.point2segment(t.end,e)),ht.sort(n),n[0]}static segment2circle(t,e){let r=t.intersect(e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let n=new u.Line(t.ps,t.pe),[i,s]=ht.point2line(e.center,n);if(u.Utils.GE(i,e.r)\u0026\u0026s.end.on(t))return ht.point2circle(s.end,e);else{let[o,c]=ht.point2circle(t.start,e),[l,a]=ht.point2circle(t.end,e);return u.Utils.LT(o,l)?[o,c]:[l,a]}}static segment2arc(t,e){let r=t.intersect(e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let n=new u.Line(t.ps,t.pe),i=new u.Circle(e.pc,e.r),[s,o]=ht.point2line(i.center,n);if(u.Utils.GE(s,i.r)\u0026\u0026o.end.on(t)){let[p,d]=ht.point2circle(o.end,i);if(d.end.on(e))return[p,d]}let c=[];c.push(ht.point2arc(t.start,e)),c.push(ht.point2arc(t.end,e));let l,a;return[l,a]=ht.point2segment(e.start,t),c.push([l,a.reverse()]),[l,a]=ht.point2segment(e.end,t),c.push([l,a.reverse()]),ht.sort(c),c[0]}static circle2circle(t,e){let r=t.intersect(e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];if(t.center.equalTo(e.center)){let n=t.toArc(),i=e.toArc();return ht.point2point(n.start,i.start)}else{let n=new u.Line(t.center,e.center),i=n.intersect(t),s=n.intersect(e),o=[];return o.push(ht.point2point(i[0],s[0])),o.push(ht.point2point(i[0],s[1])),o.push(ht.point2point(i[1],s[0])),o.push(ht.point2point(i[1],s[1])),ht.sort(o),o[0]}}static circle2line(t,e){let r=t.intersect(e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let[n,i]=ht.point2line(t.center,e),[s,o]=ht.point2circle(i.end,t);return o=o.reverse(),[s,o]}static arc2line(t,e){let r=e.intersect(t);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let n=new u.Circle(t.center,t.r),[i,s]=ht.point2line(n.center,e);if(u.Utils.GE(i,n.r)){let[o,c]=ht.point2circle(s.end,n);if(c.end.on(t))return[o,c]}else{let o=[];return o.push(ht.point2line(t.start,e)),o.push(ht.point2line(t.end,e)),ht.sort(o),o[0]}}static arc2circle(t,e){let r=t.intersect(e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let n=new u.Circle(t.center,t.r),[i,s]=ht.circle2circle(n,e);if(s.start.on(t))return[i,s];else{let o=[];return o.push(ht.point2circle(t.start,e)),o.push(ht.point2circle(t.end,e)),ht.sort(o),o[0]}}static arc2arc(t,e){let r=t.intersect(e);if(r.length\u003e0)return[0,new u.Segment(r[0],r[0])];let n=new u.Circle(t.center,t.r),i=new u.Circle(e.center,e.r),[s,o]=ht.circle2circle(n,i);if(o.start.on(t)\u0026\u0026o.end.on(e))return[s,o];else{let c=[],l,a;if([l,a]=ht.point2arc(t.start,e),a.end.on(e))c.push([l,a]);if([l,a]=ht.point2arc(t.end,e),a.end.on(e))c.push([l,a]);if([l,a]=ht.point2arc(e.start,t),a.end.on(t))c.push([l,a.reverse()]);if([l,a]=ht.point2arc(e.end,t),a.end.on(t))c.push([l,a.reverse()]);return[l,a]=ht.point2point(t.start,e.start),c.push([l,a]),[l,a]=ht.point2point(t.start,e.end),c.push([l,a]),[l,a]=ht.point2point(t.end,e.start),c.push([l,a]),[l,a]=ht.point2point(t.end,e.end),c.push([l,a]),ht.sort(c),c[0]}}static point2polygon(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e.edges){let[i,s]=ht.point2edge(t,n);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static shape2polygon(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e.edges){let[i,s]=t.distanceTo(n.shape);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static polygon2polygon(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of t.edges)for(let i of e.edges){let[s,o]=n.shape.distanceTo(i.shape);if(u.Utils.LT(s,r[0]))r=[s,o]}return r}static box2box_minmax(t,e){let r=Math.max(Math.max(t.xmin-e.xmax,0),Math.max(e.xmin-t.xmax,0)),n=Math.max(Math.max(t.ymin-e.ymax,0),Math.max(e.ymin-t.ymax,0)),i=r*r+n*n,s=t.merge(e),o=s.xmax-s.xmin,c=s.ymax-s.ymin,l=o*o+c*c;return[i,l]}static minmax_tree_process_level(t,e,r,n){let i,s;for(let a of e){[i,s]=ht.box2box_minmax(t.box,a.item.key);for(let p of a.item.values)if(p instanceof u.Edge)n.insert([i,s],p.shape);else n.insert([i,s],p);if(u.Utils.LT(s,r))r=s}if(e.length===0)return r;let o=e.map((a)=\u003ea.left.isNil()?void 0:a.left).filter((a)=\u003ea!==void 0),c=e.map((a)=\u003ea.right.isNil()?void 0:a.right).filter((a)=\u003ea!==void 0),l=[...o,...c].filter((a)=\u003e{let[p,d]=ht.box2box_minmax(t.box,a.max);return u.Utils.LE(p,r)});return r=ht.minmax_tree_process_level(t,l,r,n),r}static minmax_tree(t,e,r){let n=new So,i=[e.index.root],s=r\u003cNumber.POSITIVE_INFINITY?r*r:Number.POSITIVE_INFINITY;return s=ht.minmax_tree_process_level(t,i,s,n),n}static minmax_tree_calc_distance(t,e,r){let n,i;if(e!=null\u0026\u0026!e.isNil()){if([n,i]=ht.minmax_tree_calc_distance(t,e.left,r),i)return[n,i];if(u.Utils.LT(n[0],Math.sqrt(e.item.key.low)))return[n,!0];let[s,o]=ht.distanceToArray(t,e.item.values);if(u.Utils.LT(s,n[0]))n=[s,o];return[n,i]=ht.minmax_tree_calc_distance(t,e.right,n),[n,i]}return[r,!1]}static shape2planarSet(t,e,r=Number.POSITIVE_INFINITY){let n=[r,new u.Segment],i=!1;if(e instanceof u.PlanarSet){let s=ht.minmax_tree(t,e,r);[n,i]=ht.minmax_tree_calc_distance(t,s.root,n)}return n}static sort(t){t.sort((e,r)=\u003e{if(u.Utils.LT(e[0],r[0]))return-1;if(u.Utils.GT(e[0],r[0]))return 1;return 0})}static distance(t,e){return t.distanceTo(e)}static distanceToArray(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e){let[i,s]=t.distanceTo(n);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static shape2multiline(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e){let[i,s]=ht.distance(t,n.shape);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static multiline2multiline(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of t)for(let i of e){let[s,o]=ht.distance(n.shape,i.shape);if(u.Utils.LT(s,r[0]))r=[s,o]}return r}}u.Distance=ht;var{Multiline:NA,Point:$1,Segment:YA,Polygon:j1}=u;function xh(t){return new $1(t.split(\" \").map(Number))}function X1(t){return t.split(\", \").map(xh)}function bh(t){let e=X1(t),r=[];for(let n=0;n\u003ce.length-1;n++)r.push(new YA(e[n],e[n+1]));return new NA(r)}function LA(t){return t.replace(/\\(\\(/,\"\").replace(/\\)\\)$/,\"\").split(\"), (\").map(bh)}function D1(t){let e=t.replace(/\\(\\(/,\"\").replace(/\\)\\)$/,\"\").split(\"), (\"),r=new j1,n;return e.forEach((i,s)=\u003e{let o=i.split(\", \").map((l)=\u003enew $1(l.split(\" \").map(Number))),c=r.addFace(o);if(s===0)n=c.orientation();else if(c.orientation()===n)c.reverse()}),r}function TA(t){let r=t.split(/\\)\\), \\(\\(/).map((s)=\u003e\"((\"+s+\"))\").map(D1),n=new j1;return r.reduce((s,o)=\u003e[...s,...o?.faces],[]).forEach((s)=\u003en.addFace([...s?.shapes])),n}function EA(t){if(t.startsWith(\"POLYGON\")){let e=t.replace(/^POLYGON /,\"\");return D1(e)}else{let e=t.replace(/^MULTIPOLYGON \\(\\(\\((.*)\\)\\)\\)$/,\"$1\");return TA(e)}}function RA(t){return t.split(`\n`).map((r)=\u003er.match(/\\(([^)]+)\\)/)[1]).map(xh)}function OA(t){return t.split(`\n`).map((r)=\u003er.match(/\\(([^)]+)\\)/)[1]).map(bh).reduce((r,n)=\u003e[...r,...n],[])}function V1(t){if(t.startsWith(\"POINT\")){let e=t.replace(/^POINT \\(/,\"\").replace(/\\)$/,\"\");return xh(e)}else if(t.startsWith(\"MULTIPOINT\")){let e=t.replace(/^MULTIPOINT \\(/,\"\").replace(/\\)$/,\"\");return X1(e)}else if(t.startsWith(\"LINESTRING\")){let e=t.replace(/^LINESTRING \\(/,\"\").replace(/\\)$/,\"\");return bh(e)}else if(t.startsWith(\"MULTILINESTRING\")){let e=t.replace(/^MULTILINESTRING /,\"\");return LA(e)}else if(t.startsWith(\"POLYGON\")||t.startsWith(\"MULTIPOLYGON\"))return EA(t);else if(t.startsWith(\"GEOMETRYCOLLECTION\")){let e=/(?\u003ctype\u003ePOINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON) \\((?:[^\\(\\)]|\\([^\\)]*\\))*\\)/g,r=t.match(e);if(r[0].startsWith(\"GEOMETRYCOLLECTION\"))r[0]=r[0].replace(\"GEOMETRYCOLLECTION (\",\"\");return r.map(V1).map((i)=\u003ei instanceof Array?i:[i]).reduce((i,s)=\u003e[...i,...s],[])}else if(z1(t))return RA(t);else if(U1(t))return OA(t);return[]}function z1(t){return t.split(`\n`)?.every((e)=\u003ee.includes(\"POINT\"))}function U1(t){return t.split(`\n`)?.every((e)=\u003ee.includes(\"LINESTRING\"))}function WA(t){return t.startsWith(\"POINT\")||z1(t)||t.startsWith(\"LINESTRING\")||U1(t)||t.startsWith(\"MULTILINESTRING\")||t.startsWith(\"POLYGON\")||t.startsWith(\"MULTIPOINT\")||t.startsWith(\"MULTIPOLYGON\")||t.startsWith(\"GEOMETRYCOLLECTION\")}u.isWktString=WA;u.parseWKT=V1;u.BooleanOperations=oA;u.Relations=xA;function G1(t,e,r){if(!e||!r)return;let n=t.get(e);if(!n)n=new Set,t.set(e,n);n.add(r);let i=t.get(r);if(!i)i=new Set,t.set(r,i);i.add(e)}function H1(t,e){if(!e.subcircuit_id\u0026\u0026!e.source_group_id)return[...t];let r=e;if(e.subcircuit_id){let c=new Set([e.subcircuit_id]),l=new Map,a=new Map;for(let d of t)if(d.type===\"source_group\"){let{source_group_id:m,subcircuit_id:f}=d;if(f)a.set(m,f);let _=d.parent_source_group_id;if(_){if(!l.has(_))l.set(_,[]);l.get(_).push(m)}}let p;for(let[d,m]of a)if(m===e.subcircuit_id){p=d;break}if(p){let d=(m)=\u003e{let f=l.get(m)||[];for(let _ of f){let g=a.get(_);if(g)c.add(g);d(_)}};d(p),r={...e,subcircuit_ids:Array.from(c)}}}let n=new Map;for(let c of t){let l=`${c.type}_id`,a=c[l];if(typeof a===\"string\")n.set(a,c)}let i=new Map;for(let c of t){let l=Object.entries(c);for(let[a,p]of l){if(a===\"parent_source_group_id\")continue;if(a.endsWith(\"_id\")\u0026\u0026typeof p===\"string\"){let d=n.get(p);G1(i,c,d)}else if(a.endsWith(\"_ids\")\u0026\u0026Array.isArray(p)){for(let d of p)if(typeof d===\"string\"){let m=n.get(d);G1(i,c,m)}}}}let s=[],o=new Set;for(let c of t){let l=!1;if(r.subcircuit_id\u0026\u0026\"subcircuit_id\"in c\u0026\u0026c.subcircuit_id===r.subcircuit_id)l=!0;else if(r.subcircuit_ids\u0026\u0026\"subcircuit_id\"in c\u0026\u0026c.subcircuit_id\u0026\u0026r.subcircuit_ids.includes(c.subcircuit_id))l=!0;else if(r.source_group_id\u0026\u0026\"source_group_id\"in c\u0026\u0026c.source_group_id===r.source_group_id)l=!0;else if(r.source_group_id\u0026\u0026\"member_source_group_ids\"in c\u0026\u0026Array.isArray(c.member_source_group_ids)\u0026\u0026c.member_source_group_ids.includes(r.source_group_id))l=!0;if(l)s.push(c),o.add(c)}while(s.length\u003e0){let c=s.shift(),l=i.get(c);if(!l)continue;for(let a of l)if(!o.has(a))o.add(a),s.push(a)}return t.filter((c)=\u003eo.has(c))}var Io=(t,e={})=\u003e{let r=t,n=r._internal_store;if(!n){n={counts:{},editCount:0},r._internal_store=n;for(let s of r){let o=s.type,c=s[`${o}_id`];if(!c)continue;let l=Number.parseInt(c.split(\"_\").pop());if(!Number.isNaN(l))n.counts[o]=Math.max(n.counts[o]??0,l)}}let i=new Proxy({},{get:(s,o)=\u003e{if(o===\"toArray\")return()=\u003e(r.editCount=n.editCount,r);if(o===\"editCount\")return n.editCount;if(o===\"subtree\")return(l)=\u003eIo(H1(r,l),e);if(o===\"insert\")return(l)=\u003e{let a=l.type;if(!a)throw Error(\"insert requires an element with a type\");n.counts[a]??=-1,n.counts[a]++;let p=n.counts[a],d={...l,type:a,[`${a}_id`]:`${a}_${p}`};if(e.validateInserts)(ei[a]??ti).parse(d);return r.push(d),n.editCount++,d};if(o===\"insertAll\")return(l)=\u003el.map((a)=\u003ei.insert(a));let c=o;return{get:(l)=\u003er.find((a)=\u003ea.type===c\u0026\u0026a[`${c}_id`]===l),getUsing:(l)=\u003e{let a=Object.keys(l);if(a.length!==1)throw Error(\"getUsing requires exactly one key, e.g. { pcb_component_id }\");let p=a[0],d=p.replace(\"_id\",\"\"),m=r.find((f)=\u003ef.type===d\u0026\u0026f[p]===l[p]);if(!m)return null;return r.find((f)=\u003ef.type===c\u0026\u0026f[`${c}_id`]===m[`${c}_id`])},getWhere:(l)=\u003e{let a=Object.keys(l);return r.find((p)=\u003ep.type===c\u0026\u0026a.every((d)=\u003ep[d]===l[d]))},list:(l)=\u003e{let a=!l?[]:Object.keys(l);return r.filter((p)=\u003ep.type===c\u0026\u0026a.every((d)=\u003ep[d]===l[d]))},insert:(l)=\u003e{n.counts[c]??=-1,n.counts[c]++;let a=n.counts[c],p={type:c,[`${c}_id`]:`${c}_${a}`,...l};if(e.validateInserts)(ei[c]??ti).parse(p);return r.push(p),n.editCount++,p},delete:(l)=\u003e{let a=r.find((p)=\u003ep[`${c}_id`]===l);if(!a)return;r.splice(r.indexOf(a),1),n.editCount++},update:(l,a)=\u003e{let p=r.find((d)=\u003ed.type===c\u0026\u0026d[`${c}_id`]===l);if(!p)return null;return Object.assign(p,a),n.editCount++,p},select:(l)=\u003e{if(c===\"source_component\")return r.find((a)=\u003ea.type===\"source_component\"\u0026\u0026a.name===l.replace(/\\./g,\"\"));else if(c===\"pcb_port\"||c===\"source_port\"||c===\"schematic_port\"){let[a,p]=l.replace(/\\./g,\"\").split(/[\\s\\\u003e]+/),d=r.find((f)=\u003ef.type===\"source_component\"\u0026\u0026f.name===a);if(!d)return null;let m=r.find((f)=\u003ef.type===\"source_port\"\u0026\u0026f.source_component_id===d.source_component_id\u0026\u0026(f.name===p||(f.port_hints??[]).includes(p)));if(!m)return null;if(c===\"source_port\")return m;if(c===\"pcb_port\")return r.find((f)=\u003ef.type===\"pcb_port\"\u0026\u0026f.source_port_id===m.source_port_id);else if(c===\"schematic_port\")return r.find((f)=\u003ef.type===\"schematic_port\"\u0026\u0026f.source_port_id===m.source_port_id)}}}}});return i};Io.unparsed=Io;var Kt=Io,wh=Io;function vh(t){let e=t.type;return`${e}:${t[`${e}_id`]}`}var Sh=(t,e={})=\u003e{let r=t._internal_store_indexed;if(!r){r={counts:{},editCount:0,indexes:{}};for(let o of t){let c=o.type,l=o[`${c}_id`];if(!l)continue;let a=Number.parseInt(l.split(\"_\").pop()||\"\");if(!Number.isNaN(a))r.counts[c]=Math.max(r.counts[c]??0,a)}let i=e.indexConfig||{},s=r.indexes;if(i.byId)s.byId=new Map;if(i.byType)s.byType=new Map;if(i.byRelation)s.byRelation=new Map;if(i.bySubcircuit)s.bySubcircuit=new Map;if(i.byCustomField\u0026\u0026i.byCustomField.length\u003e0){s.byCustomField=new Map;for(let o of i.byCustomField)s.byCustomField.set(o,new Map)}for(let o of t){if(i.byId){let c=vh(o);s.byId.set(c,o)}if(i.byType){let c=s.byType.get(o.type)||[];c.push(o),s.byType.set(o.type,c)}if(i.byRelation){let c=Object.entries(o);for(let[l,a]of c)if(l.endsWith(\"_id\")\u0026\u0026l!==`${o.type}_id`\u0026\u0026typeof a===\"string\"){let p=s.byRelation.get(l)||new Map,d=p.get(a)||[];d.push(o),p.set(a,d),s.byRelation.set(l,p)}}if(i.bySubcircuit\u0026\u0026\"subcircuit_id\"in o){let c=o.subcircuit_id;if(c\u0026\u0026typeof c===\"string\"){let l=s.bySubcircuit.get(c)||[];l.push(o),s.bySubcircuit.set(c,l)}}if(i.byCustomField\u0026\u0026s.byCustomField){for(let c of i.byCustomField)if(c in o){let l=o[c];if(l!==void 0\u0026\u0026(typeof l===\"string\"||typeof l===\"number\")){let a=String(l),p=s.byCustomField.get(c),d=p.get(a)||[];d.push(o),p.set(a,d)}}}}t._internal_store_indexed=r}let n=new Proxy({},{get:(i,s)=\u003e{if(s===\"toArray\")return()=\u003e(t.editCount=r.editCount,t);if(s===\"editCount\")return r.editCount;if(s===\"insert\")return(c)=\u003e{let{type:l,...a}=c;if(!l)throw Error(\"insert requires an element with a type\");return delete a[`${l}_id`],n[l].insert(a)};if(s===\"insertAll\")return(c)=\u003ec.map((l)=\u003en.insert(l));if(s===\"subtree\")return(c)=\u003eSh(H1(t,c),e);let o=s;return{get:(c)=\u003e{let l=e.indexConfig||{};if(l.byId\u0026\u0026r.indexes.byId)return r.indexes.byId.get(`${o}:${c}`)||null;if(l.byType\u0026\u0026r.indexes.byType)return(r.indexes.byType.get(o)||[]).find((p)=\u003ep[`${o}_id`]===c)||null;return t.find((a)=\u003ea.type===o\u0026\u0026a[`${o}_id`]===c)||null},getUsing:(c)=\u003e{let l=e.indexConfig||{},a=Object.keys(c);if(a.length!==1)throw Error(\"getUsing requires exactly one key, e.g. { pcb_component_id }\");let p=a[0],d=p.replace(\"_id\",\"\");if(l.byRelation\u0026\u0026r.indexes.byRelation){let f=r.indexes.byRelation.get(p);if(f){let g=(f.get(c[p])||[]).find((S)=\u003eS.type===d);if(!g)return null;let y=g[`${o}_id`];if(l.byId\u0026\u0026r.indexes.byId)return r.indexes.byId.get(`${o}:${y}`)||null;if(l.byType\u0026\u0026r.indexes.byType)return(r.indexes.byType.get(o)||[]).find((P)=\u003eP[`${o}_id`]===y)||null;return t.find((S)=\u003eS.type===o\u0026\u0026S[`${o}_id`]===y)||null}}let m=t.find((f)=\u003ef.type===d\u0026\u0026f[p]===c[p]);if(!m)return null;return t.find((f)=\u003ef.type===o\u0026\u0026f[`${o}_id`]===m[`${o}_id`])||null},getWhere:(c)=\u003e{let l=e.indexConfig||{},a=Object.keys(c);if(a.length===1\u0026\u0026l.byCustomField\u0026\u0026r.indexes.byCustomField){let p=a[0],d=r.indexes.byCustomField.get(p);if(d){let m=String(c[p]);return(d.get(m)||[]).find((_)=\u003e_.type===o)||null}}if(\"subcircuit_id\"in c\u0026\u0026l.bySubcircuit\u0026\u0026r.indexes.bySubcircuit){let p=c.subcircuit_id;return(r.indexes.bySubcircuit.get(p)||[]).find((m)=\u003em.type===o\u0026\u0026a.every((f)=\u003em[f]===c[f]))||null}if(l.byType\u0026\u0026r.indexes.byType)return(r.indexes.byType.get(o)||[]).find((d)=\u003ea.every((m)=\u003ed[m]===c[m]))||null;return t.find((p)=\u003ep.type===o\u0026\u0026a.every((d)=\u003ep[d]===c[d]))||null},list:(c)=\u003e{let l=e.indexConfig||{},a=!c?[]:Object.keys(c);if(a.length===0\u0026\u0026l.byType\u0026\u0026r.indexes.byType)return(r.indexes.byType.get(o)||[]).slice();if(a.length===1\u0026\u0026a[0]===\"subcircuit_id\"\u0026\u0026l.bySubcircuit\u0026\u0026r.indexes.bySubcircuit){let d=c.subcircuit_id;return(r.indexes.bySubcircuit.get(d)||[]).filter((f)=\u003ef.type===o)}let p;if(l.byType\u0026\u0026r.indexes.byType)p=r.indexes.byType.get(o)||[];else p=t.filter((d)=\u003ed.type===o);if(a.length\u003e0)return p.filter((d)=\u003ea.every((m)=\u003ed[m]===c[m]));return p.slice()},insert:(c)=\u003e{r.counts[o]??=-1,r.counts[o]++;let l=r.counts[o],a={type:o,[`${o}_id`]:`${o}_${l}`,...c};if(e.validateInserts)(ei[o]??ti).parse(a);t.push(a),r.editCount++;let p=e.indexConfig||{};if(p.byId\u0026\u0026r.indexes.byId){let d=vh(a);r.indexes.byId.set(d,a)}if(p.byType\u0026\u0026r.indexes.byType){let d=r.indexes.byType.get(o)||[];d.push(a),r.indexes.byType.set(o,d)}if(p.byRelation\u0026\u0026r.indexes.byRelation){let d=Object.entries(a);for(let[m,f]of d)if(m.endsWith(\"_id\")\u0026\u0026m!==`${a.type}_id`\u0026\u0026typeof f===\"string\"){let _=r.indexes.byRelation.get(m)||new Map,g=_.get(f)||[];g.push(a),_.set(f,g),r.indexes.byRelation.set(m,_)}}if(p.bySubcircuit\u0026\u0026r.indexes.bySubcircuit\u0026\u0026\"subcircuit_id\"in a){let d=a.subcircuit_id;if(d\u0026\u0026typeof d===\"string\"){let m=r.indexes.bySubcircuit.get(d)||[];m.push(a),r.indexes.bySubcircuit.set(d,m)}}if(p.byCustomField\u0026\u0026r.indexes.byCustomField){for(let d of p.byCustomField)if(d in a){let m=a[d];if(m!==void 0\u0026\u0026(typeof m===\"string\"||typeof m===\"number\")){let f=String(m),_=r.indexes.byCustomField.get(d),g=_.get(f)||[];g.push(a),_.set(f,g)}}}return a},delete:(c)=\u003e{let l=e.indexConfig||{},a;if(l.byId\u0026\u0026r.indexes.byId)a=r.indexes.byId.get(`${o}:${c}`);else if(l.byType\u0026\u0026r.indexes.byType)a=(r.indexes.byType.get(o)||[]).find((m)=\u003em[`${o}_id`]===c);else a=t.find((d)=\u003ed[`${o}_id`]===c);if(!a)return;let p=t.indexOf(a);if(p\u003e=0)t.splice(p,1),r.editCount++;if(l.byId\u0026\u0026r.indexes.byId){let d=vh(a);r.indexes.byId.delete(d)}if(l.byType\u0026\u0026r.indexes.byType){let m=(r.indexes.byType.get(o)||[]).filter((f)=\u003ef[`${o}_id`]!==c);r.indexes.byType.set(o,m)}if(l.byRelation\u0026\u0026r.indexes.byRelation)for(let[d,m]of r.indexes.byRelation.entries())for(let[f,_]of m.entries()){let g=_.filter((y)=\u003ey!==a);if(g.length===0)m.delete(f);else m.set(f,g)}if(l.bySubcircuit\u0026\u0026r.indexes.bySubcircuit\u0026\u0026\"subcircuit_id\"in a){let d=a.subcircuit_id;if(d){let f=(r.indexes.bySubcircuit.get(d)||[]).filter((_)=\u003e_!==a);if(f.length===0)r.indexes.bySubcircuit.delete(d);else r.indexes.bySubcircuit.set(d,f)}}if(l.byCustomField\u0026\u0026r.indexes.byCustomField)for(let d of r.indexes.byCustomField.values())for(let[m,f]of d.entries()){let _=f.filter((g)=\u003eg!==a);if(_.length===0)d.delete(m);else d.set(m,_)}},update:(c,l)=\u003e{let a=e.indexConfig||{},p;if(a.byId\u0026\u0026r.indexes.byId)p=r.indexes.byId.get(`${o}:${c}`);else if(a.byType\u0026\u0026r.indexes.byType)p=(r.indexes.byType.get(o)||[]).find((m)=\u003em[`${o}_id`]===c);else p=t.find((d)=\u003ed.type===o\u0026\u0026d[`${o}_id`]===c);if(!p)return null;if(a.byRelation\u0026\u0026r.indexes.byRelation){let d=Object.entries(p);for(let[m,f]of d)if(m.endsWith(\"_id\")\u0026\u0026m!==`${p.type}_id`\u0026\u0026typeof f===\"string\"){if(m in l\u0026\u0026l[m]!==f){let _=r.indexes.byRelation.get(m);if(_){let y=(_.get(f)||[]).filter((S)=\u003eS!==p);if(y.length===0)_.delete(f);else _.set(f,y)}}}}if(a.bySubcircuit\u0026\u0026r.indexes.bySubcircuit\u0026\u0026\"subcircuit_id\"in p\u0026\u0026\"subcircuit_id\"in l){let d=p.subcircuit_id,m=l.subcircuit_id;if(d!==m){let _=(r.indexes.bySubcircuit.get(d)||[]).filter((g)=\u003eg!==p);if(_.length===0)r.indexes.bySubcircuit.delete(d);else r.indexes.bySubcircuit.set(d,_)}}if(a.byCustomField\u0026\u0026r.indexes.byCustomField){for(let d of a.byCustomField)if(d in p\u0026\u0026d in l\u0026\u0026p[d]!==l[d]){let m=r.indexes.byCustomField.get(d);if(m){let f=String(p[d]),g=(m.get(f)||[]).filter((y)=\u003ey!==p);if(g.length===0)m.delete(f);else m.set(f,g)}}}if(Object.assign(p,l),r.editCount++,a.byRelation\u0026\u0026r.indexes.byRelation){let d=Object.entries(p);for(let[m,f]of d)if(m.endsWith(\"_id\")\u0026\u0026m!==`${p.type}_id`\u0026\u0026typeof f===\"string\"){if(m in l){let _=r.indexes.byRelation.get(m)||new Map,g=_.get(f)||[];if(!g.includes(p))g.push(p),_.set(f,g),r.indexes.byRelation.set(m,_)}}}if(a.bySubcircuit\u0026\u0026r.indexes.bySubcircuit\u0026\u0026\"subcircuit_id\"in p\u0026\u0026\"subcircuit_id\"in l){let d=p.subcircuit_id;if(d\u0026\u0026typeof d===\"string\"){let m=r.indexes.bySubcircuit.get(d)||[];if(!m.includes(p))m.push(p),r.indexes.bySubcircuit.set(d,m)}}if(a.byCustomField\u0026\u0026r.indexes.byCustomField){for(let d of a.byCustomField)if(d in p\u0026\u0026d in l){let m=p[d];if(m!==void 0\u0026\u0026(typeof m===\"string\"||typeof m===\"number\")){let f=String(m),_=r.indexes.byCustomField.get(d),g=_.get(f)||[];if(!g.includes(p))g.push(p),_.set(f,g)}}}return p},select:(c)=\u003e{if(o===\"source_component\")return t.find((l)=\u003el.type===\"source_component\"\u0026\u0026l.name===c.replace(/\\./g,\"\"))||null;else if(o===\"pcb_port\"||o===\"source_port\"||o===\"schematic_port\"){let[l,a]=c.replace(/\\./g,\"\").split(/[\\s\\\u003e]+/),p=t.find((m)=\u003em.type===\"source_component\"\u0026\u0026m.name===l);if(!p)return null;let d=t.find((m)=\u003em.type===\"source_port\"\u0026\u0026m.source_component_id===p.source_component_id\u0026\u0026(m.name===a||(m.port_hints??[]).includes(a)));if(!d)return null;if(o===\"source_port\")return d;if(o===\"pcb_port\")return t.find((m)=\u003em.type===\"pcb_port\"\u0026\u0026m.source_port_id===d.source_port_id)||null;else if(o===\"schematic_port\")return t.find((m)=\u003em.type===\"schematic_port\"\u0026\u0026m.source_port_id===d.source_port_id)||null}return null}}}});return n};Sh.unparsed=Sh;var $A={leftside_top:{side:\"leftside\",alignment:\"top\"},leftside_bottom:{side:\"leftside\",alignment:\"bottom\"},rightside_top:{side:\"rightside\",alignment:\"top\"},rightside_bottom:{side:\"rightside\",alignment:\"bottom\"},topside_left:{side:\"topside\",alignment:\"left\"},topside_right:{side:\"topside\",alignment:\"right\"},bottomside_left:{side:\"bottomside\",alignment:\"left\"},bottomside_right:{side:\"bottomside\",alignment:\"right\"}},xK=Object.keys($A);var di=(t)=\u003e{let e=new Map;for(let r of t)if(r.type===\"schematic_sheet\"\u0026\u0026r.name)e.set(r.schematic_sheet_id,r.name);return e};var jA=(t)=\u003et.type===\"schematic_box\",Q1=(t)=\u003et.type===\"schematic_component\",Ah=(t)=\u003et.schematic_sheet_id,XA=(t,e)=\u003e{if(!e)return;return wh(t).source_component.get(e)?.name},DA=(t,e)=\u003e{if(!t.schematic_component_id)return{};let r=wh(e),n=r.schematic_component.get(t.schematic_component_id);if(!n?.source_component_id)return{};let i=r.source_component.get(n.source_component_id);return{sourceComponentId:n.source_component_id,sourceComponentName:i?.name}},VA=(t,e,r,n)=\u003e{let i=Ah(t);if(i===void 0\u0026\u0026n)i=Ah(n);let s;if(i)s=r.get(i);let o={lineItemType:\"SchematicBoxPlacement\",positionAnchor:\"center\",schX:t.center.x,schY:t.center.y,width:n?.width??t.size.width,height:n?.height??t.size.height,sourceComponentId:t.source_component_id,sourceComponentName:XA(e,t.source_component_id),schematicComponentId:t.schematic_component_id,schematicSymbolId:n?.schematic_symbol_id??t.schematic_symbol_id,subcircuitId:t.subcircuit_id??n?.subcircuit_id};if(i)o.schematicSheetId=i;if(s)o.schematicSheetName=s;return o},zA=(t,e,r)=\u003e{let n=Ah(t),i;if(n)i=r.get(n);let s={lineItemType:\"SchematicBoxPlacement\",positionAnchor:\"center\",schX:t.x+t.width/2,schY:t.y+t.height/2,width:t.width,height:t.height,...DA(t,e),schematicComponentId:t.schematic_component_id,schematicSymbolId:t.schematic_symbol_id,subcircuitId:t.subcircuit_id};if(n)s.schematicSheetId=n;if(i)s.schematicSheetName=i;return s},Z1=(t)=\u003e{let e=t.filter(jA).filter((s)=\u003es.schematic_component_id||s.schematic_symbol_id),r=di(t),n=new Set(t.filter(Q1).map((s)=\u003es.schematic_component_id)),i=[...t.filter(Q1).map((s)=\u003eVA(s,t,r,e.find((o)=\u003eo.schematic_component_id===s.schematic_component_id))),...e.filter((s)=\u003e!s.schematic_component_id||!n.has(s.schematic_component_id)).map((s)=\u003ezA(s,t,r))];return{circuitJson:t,componentPlacements:i}};class Ws extends U{params;constructor(t){super();this.params=t}_step(){let t=new tt(this.params.ctx);for(let e of tp(t)){let{resistor:r,switchBox:n,signalPort:i,signalSchY:s,pullDirection:o}=e;if(e.horizontalPushbutton)continue;let c=t.connected(i.source_port_id);if(t.portsByNet.get(c)?.length!==2)continue;if(i.needs_external_pullup||i.needs_external_pulldown)continue;let l=o===\"up\"?s-(r.schY+r.height/2):r.schY-r.height/2-s;if(l\u003c=1.5)continue;let a=o===\"up\"?\"above\":\"below\";this.params.issues.push({lineItemType:\"PullResistorOnWrongSide\",resistorSchematicBox:r,hostSchematicBox:n,signalSourcePortId:i.source_port_id,signalPinName:i.name,signalSchY:s,pullDirection:o,preferredSide:a,wrongSideGap:l,maxRecommendedWrongSideGap:1.5,message:`place ${r.sourceComponentName} ${a} ${n.sourceComponentName} so the pull-${o} branch reads toward ${o===\"up\"?\"power\":\"ground\"}`})}this.solved=!0}}function $s(t,e){let r=t.find((l)=\u003el.type===\"source_trace\"\u0026\u0026l.source_trace_id===e.source_trace_id);if(r?.type===\"source_trace\"\u0026\u0026r.name)return r.name;let n=e.edges[0],i=e.edges.at(-1),s=(l,a)=\u003e{let p=t.filter((S)=\u003eS.type===\"schematic_port\"\u0026\u0026S.schematic_sheet_id===e.schematic_sheet_id\u0026\u0026(a?S.schematic_port_id===a:Math.hypot(S.center.x-l.x,S.center.y-l.y)\u003c=0.01));if(p.length!==1||p[0]?.type!==\"schematic_port\")return;let d=p[0],m=t.find((S)=\u003eS.type===\"source_port\"\u0026\u0026S.source_port_id===d.source_port_id),f=t.find((S)=\u003eS.type===\"schematic_component\"\u0026\u0026S.schematic_component_id===d.schematic_component_id),_=m?.type===\"source_port\"?m.source_component_id:f?.type===\"schematic_component\"?f.source_component_id:void 0,g=t.find((S)=\u003eS.type===\"source_component\"\u0026\u0026S.source_component_id===_);if(g?.type!==\"source_component\"||!g.name)return;let y=m?.type===\"source_port\"\u0026\u0026m.name?m.name:d.pin_number!==void 0?`pin${d.pin_number}`:d.display_pin_label;return y?`${g.name}.${y}`:g.name},o=n\u0026\u0026s(n.from,n.from_schematic_port_id),c=i\u0026\u0026s(i.to,i.to_schematic_port_id);if(o\u0026\u0026c)return`${o} to ${c}`;return r?.type===\"source_trace\"\u0026\u0026r.display_name||o||c||\"trace\"}var q1=(t,e,r)=\u003e{let n=[{x:t.x,y:t.y}],i=(t.x+e.x)/2,s=(t.y+e.y)/2,o={x:e.x,y:e.y};switch(e.facingDirection){case\"x+\":o.x+=r;break;case\"x-\":o.x-=r;break;case\"y+\":o.y+=r;break;case\"y-\":o.y-=r;break}let c=t.facingDirection??\"none\",l=e.facingDirection??\"none\",a=(m)=\u003e{let f=n[n.length-1];if(f.x!==m.x||f.y!==m.y)n.push(m)},p=Math.abs(t.y-e.y)\u003c=Math.max(0.000001,r*0.1),d=Math.abs(t.x-e.x)\u003c=Math.max(0.000001,r*0.1);if(c===\"none\"\u0026\u0026l===\"none\")globalThis.__DEBUG_CALCULATE_ELBOW_CASE=1,a({x:i,y:t.y}),a({x:i,y:e.y});else if(c===\"x+\"\u0026\u0026l===\"y+\")if(globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2,t.x\u003ee.x\u0026\u0026t.y\u003ce.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.1,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:e.y+r}),a({x:e.x,y:e.y+r});else if(!d\u0026\u0026!p\u0026\u0026t.x\u003ce.x\u0026\u0026t.y\u003ee.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.2,a({x:e.x,y:t.y});else if(d)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.3,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:e.y+r}),a({x:e.x,y:e.y+r});else if(t.x\u003ce.x)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.4,a({x:i,y:t.y}),a({x:i,y:o.y}),a({x:e.x,y:o.y});else if(t.y\u003c=e.y+r)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.5,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y+r}),a({x:e.x,y:t.y+r}),a({x:e.x,y:e.y});else globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.6,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:(t.y+e.y)/2}),a({x:e.x,y:(t.y+e.y)/2});else if(c===\"x+\"\u0026\u0026l===\"x+\"\u0026\u0026!p){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=3;let m=Math.max(t.x+r,o.x);a({x:m,y:t.y}),a({x:m,y:e.y})}else if(c===\"x+\"\u0026\u0026l===\"x+\"\u0026\u0026p)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=3.1,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y+r}),a({x:e.x+r,y:t.y+r}),a({x:e.x+r,y:e.y});else if(c===\"x+\"\u0026\u0026l===\"y-\")if(d\u0026\u0026t.y\u003c=e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.11,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:s}),a({x:e.x,y:s});else if(d\u0026\u0026t.y\u003ee.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.12,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:e.y-r}),a({x:e.x,y:e.y-r});else if(t.x\u003ce.x\u0026\u0026t.y\u003ce.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.2,a({x:e.x,y:t.y});else if(t.x\u003ee.x\u0026\u0026t.y\u003ce.y){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.3;let m=t.x+r;a({x:m,y:t.y}),a({x:m,y:s}),a({x:e.x,y:s})}else if(t.x\u003ee.x\u0026\u0026t.y\u003ee.y){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.4;let m=t.x+r;a({x:m,y:t.y}),a({x:m,y:o.y}),a({x:e.x,y:o.y})}else if(t.y===e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.5,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y-r}),a({x:e.x,y:t.y-r});else globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.6,a({x:i,y:t.y}),a({x:i,y:o.y}),a({x:e.x,y:o.y});else if(c===\"x+\"\u0026\u0026l===\"x-\"\u0026\u0026t.x+r\u003e=e.x-r\u0026\u0026!p){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=5;let m=t.x+r;a({x:m,y:t.y}),a({x:m,y:s}),a({x:o.x,y:s}),a({x:o.x,y:o.y})}else if(c===\"x+\"\u0026\u0026l===\"x-\"\u0026\u0026p\u0026\u0026e.x\u003et.x);else if(c===\"x+\"\u0026\u0026l===\"x-\"\u0026\u0026p)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=7,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y+r}),a({x:e.x-r,y:t.y+r}),a({x:e.x-r,y:t.y});else{if(globalThis.__DEBUG_CALCULATE_ELBOW_CASE=8,c===\"x+\")a({x:t.x+r,y:t.y});a({x:i,y:n[n.length-1].y}),a({x:i,y:o.y}),a({x:o.x,y:o.y})}return a({x:e.x,y:e.y}),n};var Ph=(t,e,r={})=\u003e{let n=t,i=e,s=!1;if(n.x\u003ei.x||n.x===i.x\u0026\u0026n.y\u003ei.y)s=!0,[n,i]=[i,n];let o=n.facingDirection===\"x-\",c=n.facingDirection===\"y-\",l=(P)=\u003e{let b=o?n.x-(P.x-n.x):P.x,C=c?n.y-(P.y-n.y):P.y,L=P.facingDirection;if(o){if(L===\"x+\")L=\"x-\";else if(L===\"x-\")L=\"x+\"}if(c){if(L===\"y+\")L=\"y-\";else if(L===\"y-\")L=\"y+\"}return{x:b,y:C,facingDirection:L}},a=(P,b)=\u003e{let C=P.x-b.x,L=P.y-b.y,B=b.x+L,k=b.y-C,I=P.facingDirection;switch(I){case\"x+\":I=\"y-\";break;case\"y-\":I=\"x-\";break;case\"x-\":I=\"y+\";break;case\"y+\":I=\"x+\";break}return{x:B,y:k,facingDirection:I}},p=(P,b)=\u003e{let C=P.x-b.x,L=P.y-b.y;return{x:b.x-L,y:b.y+C}},d=o||c?l(n):n,m=o||c?l(i):i,f=d,_=m,g=!1;if(d.facingDirection===\"y+\")g=!0,f={...d,facingDirection:\"x+\"},_=a(m,d);let y=r?.overshoot??0.1*Math.max(Math.abs(f.x-_.x),Math.abs(f.y-_.y)),S=q1(f,_,y);if(g)S=S.map((P)=\u003ep(P,f));if(o||c)S=S.map(({x:P,y:b})=\u003e({x:o?n.x-(P-n.x):P,y:c?n.y-(b-n.y):b}));return s?S.reverse():S};class de extends U{static EPSILON=0.01;ctx;out;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e}_step(){let t=this.ctx.circuitJson.filter((i)=\u003ei.type===\"schematic_port\"),e=new Map(t.map((i)=\u003e[i.schematic_port_id,i])),r=new Map(this.ctx.componentPlacements.flatMap((i)=\u003ei.schematicComponentId?[[i.schematicComponentId,i]]:[])),n=new Set;for(let i of this.ctx.circuitJson.filter((s)=\u003es.type===\"schematic_trace\")){let s=this.getTracePoints(i),o=this.countTurns(s);if(o!==3)continue;let c=[this.getCandidate({trace:i,points:s,atStart:!0,currentTurnCount:o,ports:t,portsById:e,placementsByComponentId:r}),this.getCandidate({trace:i,points:s,atStart:!1,currentTurnCount:o,ports:t,portsById:e,placementsByComponentId:r})].filter((a)=\u003eBoolean(a));for(let a of[...c]){if(!a.target.sourceComponentName?.startsWith(\"U\"))continue;for(let p of[s[0],s.at(-1)]){let d=this.findPortAtPoint(t,p,i.schematic_sheet_id),m=d?.schematic_component_id?r.get(d.schematic_component_id):void 0;if(!m||!/^[CR]/.test(m.sourceComponentName??\"\"))continue;c.push({target:m,deltaSchX:-a.deltaSchX,deltaSchY:-a.deltaSchY,currentTurnCount:o,suggestedTurnCount:a.suggestedTurnCount})}}let l=(a)=\u003e/^[CR]/.test(a.target.sourceComponentName??\"\")?0:a.target.sourceComponentName?.startsWith(\"U\")?2:1;c.sort((a,p)=\u003el(a)-l(p));for(let a of c){if(this.wouldOverlapAnotherComponent(a))continue;if(!this.validateMove(i,a,t))continue;let p=[a.target.schematicComponentId,a.deltaSchX.toFixed(3),a.deltaSchY.toFixed(3)].join(\"\\x00\");if(n.has(p))break;n.add(p),this.out.push(this.makeIssue(i,a));break}}this.solved=!0}getCandidate({trace:t,points:e,atStart:r,currentTurnCount:n,ports:i,portsById:s,placementsByComponentId:o}){if(e.length\u003c4)return;let c=r?0:e.length-1,l=r?1:e.length-2,a=r?2:e.length-3,p=r?3:e.length-4,d=e[c],m=e[l],f=e[a],_=e[p],g=r?t.edges[0]:t.edges.at(-1);if(!g)return;let y=r?g.from_schematic_port_id:g.to_schematic_port_id,S=y?s.get(y):this.findPortAtPoint(i,d,t.schematic_sheet_id);if(!S?.schematic_component_id||!S.facing_direction)return;let P=this.getAxis(d,m),b=this.getAxis(m,f),C=this.getAxis(f,_),L=S.facing_direction===\"left\"||S.facing_direction===\"right\"?\"horizontal\":\"vertical\";if(!P||!b||!C)return;if(P!==L||b===L||C!==L)return;if(!this.isPointInFacingDirection(d,m,S.facing_direction)||!this.isPointInFacingDirection(f,_,S.facing_direction))return;let B=o.get(S.schematic_component_id);if(!B)return;let k=f.x-m.x,I=f.y-m.y;if(Math.abs(k)\u003c=de.EPSILON\u0026\u0026Math.abs(I)\u003c=de.EPSILON)return;let j={x:d.x+k,y:d.y+I},Q=r?[j,...e.slice(2)]:[...e.slice(0,-2),j],lt=this.countTurns(Q);if(lt===void 0||lt!==1||lt\u003e=n)return;return{target:B,deltaSchX:k,deltaSchY:I,currentTurnCount:n,suggestedTurnCount:lt}}validateMove(t,e,r){let n=e.target.schematicComponentId,i=e.target.schematicSheetId,s=r.filter((b)=\u003eb.schematic_sheet_id===i),o=s.filter((b)=\u003eb.schematic_component_id===n),c=this.ctx.circuitJson.filter((b)=\u003eb.type===\"schematic_trace\"\u0026\u0026b.schematic_sheet_id===i),l=(b,C)=\u003eb.edges.some((L)=\u003eL.from_schematic_port_id===C.schematic_port_id||L.to_schematic_port_id===C.schematic_port_id||this.pointsEqual(L.from,C.center)||this.pointsEqual(L.to,C.center)),a=c.filter((b)=\u003eo.some((C)=\u003el(b,C)));if(!a.includes(t))return!1;if(this.ctx.circuitJson.some((b)=\u003eb.type===\"schematic_net_label\"\u0026\u0026b.schematic_sheet_id===i\u0026\u0026o.some((C)=\u003ethis.pointsEqual(b.anchor_position??b.center,C.center))))return!1;let p=(b)=\u003e({x:b.x+e.deltaSchX,y:b.y+e.deltaSchY}),d={left:\"x-\",right:\"x+\",up:\"y+\",down:\"y-\"},m=(b,C)=\u003e({...C\u0026\u0026b.schematic_component_id===n?p(b.center):b.center,facingDirection:d[b.facing_direction]}),f=(b)=\u003eb.slice(1).reduce((C,L,B)=\u003eC+Math.abs(L.x-b[B].x)+Math.abs(L.y-b[B].y),0),_=(b)=\u003eb.slice(1).map((C,L)=\u003e({from:b[L],to:C})),g=zt(e.target.schX+e.deltaSchX,e.target.schY+e.deltaSchY,e.target.width,e.target.height),y=c.filter((b)=\u003e!a.includes(b));if(y.some((b)=\u003eb.edges.some((C)=\u003ehn(C.from,C.to,tr(g)))))return!1;let S=this.ctx.circuitJson.flatMap((b)=\u003e{if(b.type===\"schematic_net_label\"\u0026\u0026b.schematic_sheet_id===i)return[tr(Ke(b))];if(b.type!==\"schematic_text\"||b.schematic_sheet_id!==i)return[];return br(b.schematic_component_id===n?{...b,position:p(b.position)}:b)});if(S.some((b)=\u003eDi(b,tr(g))))return!1;let P=[];for(let b of a){let C=this.getTracePoints(b);if(C.length\u003c2||b.junctions?.length)return!1;let L=(z,N)=\u003e{let at=s.filter((ot)=\u003eN?ot.schematic_port_id===N:this.pointsEqual(ot.center,z));return at.length===1\u0026\u0026this.pointsEqual(at[0].center,z)?at[0]:void 0},B=L(C[0],b.edges[0].from_schematic_port_id),k=L(C.at(-1),b.edges.at(-1).to_schematic_port_id);if(!B?.facing_direction||!k?.facing_direction)return!1;if(o.some((z)=\u003el(b,z)\u0026\u0026z!==B\u0026\u0026z!==k))return!1;let I=(z)=\u003e!this.pointsEqual(z,B.center)\u0026\u0026!this.pointsEqual(z,k.center)\u0026\u0026_(C).some(({from:N,to:at})=\u003eMath.abs(Math.hypot(z.x-N.x,z.y-N.y)+Math.hypot(z.x-at.x,z.y-at.y)-Math.hypot(at.x-N.x,at.y-N.y))\u003c0.000001);if(c.some((z)=\u003ez!==b\u0026\u0026z.edges.some((N)=\u003eI(N.from)||I(N.to))))return!1;if(this.ctx.circuitJson.some((z)=\u003ez.type===\"schematic_net_label\"\u0026\u0026z.schematic_sheet_id===i\u0026\u0026I(z.anchor_position??z.center)))return!1;let j=Ph(m(B,!0),m(k,!0)).filter((z,N,at)=\u003eN===0||!this.pointsEqual(z,at[N-1])),Q=this.countTurns(j),lt=this.countTurns(C);if(j.length\u003c2||Q===void 0||lt===void 0||Q\u003elt||f(j)\u003ef(C)+0.000001)return!1;if(!this.isPointInFacingDirection(j[0],j[1],B.facing_direction)||!this.isPointInFacingDirection(j.at(-1),j.at(-2),k.facing_direction))return!1;if(b===t){let z=this.countTurns(Ph(m(B,!1),m(k,!1)));if(Q\u003e=lt||z===void 0||Q\u003e=z)return!1;e.suggestedTurnCount=Q}for(let z of _(j)){if(S.some((ot)=\u003ehn(z.from,z.to,ot)))return!1;if(this.ctx.componentPlacements.some((ot)=\u003e{if(ot.schematicSheetId!==i)return!1;let et=ot.schematicComponentId===n?g:zt(ot.schX,ot.schY,ot.width,ot.height);return hn(z.from,z.to,tr(et))}))return!1;let N=Vi(z.from,z.to);if(!N)continue;if([...y.flatMap((ot)=\u003eot.edges),...P.flatMap((ot)=\u003e_(ot.points))].some((ot)=\u003e{if([B,k].some((D)=\u003eD.schematic_component_id!==n\u0026\u0026[z.from,z.to].some((it)=\u003ethis.pointsEqual(it,D.center))\u0026\u0026[ot.from,ot.to].some((it)=\u003ethis.pointsEqual(it,D.center)))\u0026\u0026this.getAxis(z.from,z.to)!==this.getAxis(ot.from,ot.to))return!1;let et=Vi(ot.from,ot.to);return et\u0026\u0026Di(N,et)}))return!1}P.push({schematicTraceId:b.schematic_trace_id,points:j})}return e.suggestedTraces=P,!0}getTracePoints(t){let e=t.edges[0];if(!e)return[];let r=[e.from];for(let n of t.edges){let i=r.at(-1);if(!this.pointsEqual(i,n.from))return[];r.push(n.to)}return r}countTurns(t){let e=[];for(let[r,n]of t.slice(1).entries()){let i=t[r];if(this.pointsEqual(i,n))continue;let s=this.getAxis(i,n);if(!s)return;e.push(s)}return e.slice(1).filter((r,n)=\u003er!==e[n]).length}pointsEqual(t,e){let{EPSILON:r}=de;return Math.abs(t.x-e.x)\u003c=r\u0026\u0026Math.abs(t.y-e.y)\u003c=r}getAxis(t,e){let r=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),{EPSILON:i}=de;if(r\u003c=i\u0026\u0026n\u003ei)return\"vertical\";if(n\u003c=i\u0026\u0026r\u003ei)return\"horizontal\";return}isPointInFacingDirection(t,e,r){let{EPSILON:n}=de;switch(r){case\"left\":return e.x\u003ct.x-n;case\"right\":return e.x\u003et.x+n;case\"up\":return e.y\u003et.y+n;case\"down\":return e.y\u003ct.y-n}}findPortAtPoint(t,e,r){let{EPSILON:n}=de;return t.find((i)=\u003ei.schematic_sheet_id===r\u0026\u0026Math.abs(i.center.x-e.x)\u003c=n\u0026\u0026Math.abs(i.center.y-e.y)\u003c=n)}wouldOverlapAnotherComponent(t){let e=zt(t.target.schX+t.deltaSchX,t.target.schY+t.deltaSchY,t.target.width,t.target.height);return this.ctx.componentPlacements.some((r)=\u003e{if(r===t.target)return!1;if(r.schematicSheetId!==t.target.schematicSheetId)return!1;return Boolean(xr(e,zt(r.schX,r.schY,r.width,r.height)))})}makeIssue(t,e){let r=e.target.sourceComponentName||\"component\",n=this.getMoveDirection(e.deltaSchX,e.deltaSchY),i=Math.abs(e.deltaSchX||e.deltaSchY),s=e.target.schX+e.deltaSchX,o=e.target.schY+e.deltaSchY;return{lineItemType:\"TraceCanBeSimplifiedByMovingComponent\",schematicTraceId:t.schematic_trace_id,traceName:$s(this.ctx.circuitJson,t),targetComponent:e.target,deltaSchX:e.deltaSchX,deltaSchY:e.deltaSchY,newSchX:s,newSchY:o,currentTurnCount:e.currentTurnCount,suggestedTurnCount:e.suggestedTurnCount,suggestedTraces:e.suggestedTraces,message:`move ${r} ${n} by ${Hr(i)} (to schX=${Hr(s)}, schY=${Hr(o)}) to reduce this trace from ${e.currentTurnCount} turns to ${e.suggestedTurnCount}`}}getMoveDirection(t,e){if(Math.abs(t)\u003ede.EPSILON)return t\u003e0?\"right\":\"left\";return e\u003e0?\"up\":\"down\"}static issueToString(t){let e=[];return v(e,\"traceName\",t.traceName),v(e,\"targetComponentName\",t.targetComponent.sourceComponentName),v(e,\"deltaSchX\",t.deltaSchX,{formatDelta:!0}),v(e,\"deltaSchY\",t.deltaSchY,{formatDelta:!0}),v(e,\"newSchX\",t.newSchX),v(e,\"newSchY\",t.newSchY),v(e,\"currentTurnCount\",t.currentTurnCount),v(e,\"suggestedTurnCount\",t.suggestedTurnCount),v(e,\"message\",t.message),`\u003cTraceCanBeSimplifiedByMovingComponent ${e.join(\" \")} /\u003e`}}function J1(t){let e=new Set,r=new Map;for(let s of t){if(s.type!==\"source_net\"\u0026\u0026s.type!==\"source_port\")continue;let o=s.type===\"source_net\"?s.source_net_id:s.source_port_id;if(s.type===\"source_net\"?s.is_power||s.is_ground||s.is_positive_voltage_source:s.provides_power||s.requires_power||s.provides_ground||s.requires_ground)e.add(o);let l=s.subcircuit_connectivity_map_key;if(l!==void 0){let a=r.get(l)??[];a.push(o),r.set(l,a)}}let n=cs(t),i=Kl([...Object.values(n.netMap),...r.values()]);for(let s of Object.values(i))if(s.some((o)=\u003ee.has(o)))for(let o of s)e.add(o);return e}class me extends U{static EPSILON=0.01;ctx;out;powerOrGroundConnectionIds;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e,this.powerOrGroundConnectionIds=J1(t.circuitJson)}_step(){let t=this.ctx.circuitJson.filter((s)=\u003es.type===\"schematic_port\"),e=new Map(t.map((s)=\u003e[s.schematic_port_id,s])),r=new Map;for(let s of t){if(!s.schematic_component_id)continue;let o=r.get(s.schematic_component_id)??[];o.push(s),r.set(s.schematic_component_id,o)}let n=new Map(this.ctx.componentPlacements.flatMap((s)=\u003es.schematicComponentId?[[s.schematicComponentId,s]]:[])),i=new Map;for(let s of this.ctx.circuitJson.filter((o)=\u003eo.type===\"schematic_trace\")){let o=this.getTracePoints(s),c=this.countTurns(o);if(c===void 0||c\u003c2)continue;let l=this.getTraceEndpoints(s,o,t,e);if(!l)continue;for(let[a,p]of[l,[l[1],l[0]]]){let d=this.getFlipCandidate({trace:s,targetEndpoint:a,connectedEndpoint:p,currentTurnCount:c,portsByComponentId:r,placementsByComponentId:n});if(!d)continue;let m=d.targetPort.schematic_component_id,f=i.get(m);if(!f||this.isBetterCandidate(d,f))i.set(m,d)}}for(let s of i.values())this.out.push(this.makeIssue(s));this.solved=!0}getFlipCandidate({trace:t,targetEndpoint:e,connectedEndpoint:r,currentTurnCount:n,portsByComponentId:i,placementsByComponentId:s}){let o=e.port,c=r.port,l=o.schematic_component_id,a=c.schematic_component_id;if(!l||!a||l===a||o.schematic_sheet_id!==c.schematic_sheet_id)return;let p=i.get(l);if(p?.length!==2)return;if(p.some((b)=\u003eb.source_port_id\u0026\u0026this.powerOrGroundConnectionIds.has(b.source_port_id)))return;if((i.get(a)??[]).length\u003c=2)return;let m=p.find((b)=\u003eb.schematic_port_id!==o.schematic_port_id);if(!m||!this.areOppositePorts(o,m))return;let f=o.facing_direction,_=m.facing_direction;if(!f||!_)return;if(!this.traceLeavesPortInFacingDirection(e))return;let g=c.center;if(this.isPointInFacingDirection(o.center,g,f)||!this.isPointInFacingDirection(m.center,g,_)||!c.facing_direction||!this.isPointInFacingDirection(g,m.center,c.facing_direction))return;let y=this.getMinimumTurnCount(m.center,g,_);if(y\u003e=n)return;let S=s.get(l),P=s.get(a);if(!S||!P)return;return{trace:t,targetPort:o,targetPlacement:S,connectedPlacement:P,suggestedFacingDirection:_,currentTurnCount:n,suggestedTurnCount:y,traceLength:this.getTraceLength(e.pointsFromEndpoint)}}getTraceEndpoints(t,e,r,n){let i=t.edges[0],s=t.edges.at(-1);if(!i||!s||e.length\u003c2)return;let o=i.from_schematic_port_id?n.get(i.from_schematic_port_id):this.findPortAtPoint(r,e[0],t.schematic_sheet_id),c=s.to_schematic_port_id?n.get(s.to_schematic_port_id):this.findPortAtPoint(r,e.at(-1),t.schematic_sheet_id);if(!o||!c)return;return[{port:o,pointsFromEndpoint:e},{port:c,pointsFromEndpoint:[...e].reverse()}]}getTracePoints(t){let e=t.edges[0];if(!e)return[];let r=[e.from];for(let n of t.edges){if(!this.pointsEqual(r.at(-1),n.from))return[];r.push(n.to)}return r}countTurns(t){let e=[];for(let[r,n]of t.slice(1).entries()){let i=t[r];if(this.pointsEqual(i,n))continue;let s=this.getAxis(i,n);if(!s)return;if(e.at(-1)!==s)e.push(s)}return Math.max(0,e.length-1)}traceLeavesPortInFacingDirection(t){let e=t.pointsFromEndpoint.find((r)=\u003e!this.pointsEqual(r,t.port.center));return Boolean(e\u0026\u0026t.port.facing_direction\u0026\u0026this.isPointInFacingDirection(t.port.center,e,t.port.facing_direction))}areOppositePorts(t,e){let r=(t.facing_direction===\"left\"\u0026\u0026e.facing_direction===\"right\"||t.facing_direction===\"right\"\u0026\u0026e.facing_direction===\"left\")\u0026\u0026Math.abs(t.center.y-e.center.y)\u003c=me.EPSILON,n=(t.facing_direction===\"up\"\u0026\u0026e.facing_direction===\"down\"||t.facing_direction===\"down\"\u0026\u0026e.facing_direction===\"up\")\u0026\u0026Math.abs(t.center.x-e.center.x)\u003c=me.EPSILON;return r||n}getMinimumTurnCount(t,e,r){return(r===\"left\"||r===\"right\"?Math.abs(t.y-e.y)\u003c=me.EPSILON:Math.abs(t.x-e.x)\u003c=me.EPSILON)?0:1}isPointInFacingDirection(t,e,r){let{EPSILON:n}=me;switch(r){case\"left\":return e.x\u003ct.x-n;case\"right\":return e.x\u003et.x+n;case\"up\":return e.y\u003et.y+n;case\"down\":return e.y\u003ct.y-n}}getAxis(t,e){let r=Math.abs(t.x-e.x),n=Math.abs(t.y-e.y),{EPSILON:i}=me;if(r\u003c=i\u0026\u0026n\u003ei)return\"vertical\";if(n\u003c=i\u0026\u0026r\u003ei)return\"horizontal\";return}pointsEqual(t,e){let{EPSILON:r}=me;return Math.abs(t.x-e.x)\u003c=r\u0026\u0026Math.abs(t.y-e.y)\u003c=r}findPortAtPoint(t,e,r){return t.find((n)=\u003en.schematic_sheet_id===r\u0026\u0026this.pointsEqual(n.center,e))}getTraceLength(t){return t.slice(1).reduce((e,r,n)=\u003e{let i=t[n];return e+Math.abs(r.x-i.x)+Math.abs(r.y-i.y)},0)}isBetterCandidate(t,e){let r=t.currentTurnCount-t.suggestedTurnCount,n=e.currentTurnCount-e.suggestedTurnCount;return r\u003en||r===n\u0026\u0026t.traceLength\u003ee.traceLength}makeIssue(t){let e=t.targetPlacement.sourceComponentName||\"component\",r=t.connectedPlacement.sourceComponentName||\"component\",n=t.targetPort.pin_number?`pin${t.targetPort.pin_number}`:t.targetPort.display_pin_label;return{lineItemType:\"TwoPinComponentCouldBeFlipped\",schematicTraceId:t.trace.schematic_trace_id,traceName:$s(this.ctx.circuitJson,t.trace),targetComponent:t.targetPlacement,connectedComponent:t.connectedPlacement,targetPin:n,currentFacingDirection:t.targetPort.facing_direction,suggestedFacingDirection:t.suggestedFacingDirection,deltaSchRotation:180,currentTurnCount:t.currentTurnCount,suggestedTurnCount:t.suggestedTurnCount,message:`rotate ${e} by 180° so ${n??\"its connected pin\"} faces ${r} and reduce this trace from ${t.currentTurnCount} turns to ${t.suggestedTurnCount}`}}static issueToString(t){let e=[];return v(e,\"traceName\",t.traceName),v(e,\"targetComponentName\",t.targetComponent.sourceComponentName),v(e,\"connectedComponentName\",t.connectedComponent.sourceComponentName),v(e,\"targetPin\",t.targetPin),v(e,\"currentFacingDirection\",t.currentFacingDirection),v(e,\"suggestedFacingDirection\",t.suggestedFacingDirection),v(e,\"deltaSchRotation\",t.deltaSchRotation),v(e,\"currentTurnCount\",t.currentTurnCount),v(e,\"suggestedTurnCount\",t.suggestedTurnCount),v(e,\"message\",t.message),`\u003cTwoPinComponentCouldBeFlipped ${e.join(\" \")} /\u003e`}}class mi extends U{params;VERBOSE_NET_LABEL_MESSAGE=\"Create trace with schDisplayLabel\";netLabels;tokenToInvolvedPin;schematicSheetNameById;currentIndex=0;seen=new Set;constructor(t){super();this.params=t;let{circuitJson:e}=t.ctx;this.netLabels=e.filter((r)=\u003ethis.isSchematicNetLabel(r)),this.tokenToInvolvedPin=this.buildTokenToInvolvedPinMap(e),this.schematicSheetNameById=di(e),this.solved=this.netLabels.length===0}_step(){let t=this.netLabels[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex\u003e=this.netLabels.length;let e=`${t.schematic_sheet_id??\"\"}:${t.text}`;if(!t.text.includes(\"/\")||this.seen.has(e))return;this.seen.add(e);let r;if(t.schematic_sheet_id)r=this.schematicSheetNameById.get(t.schematic_sheet_id);let n={lineItemType:\"VerboseSchematicNetLabel\",schematicNetLabelId:t.schematic_net_label_id,sourceNetId:t.source_net_id,schematicSheetId:t.schematic_sheet_id,schematicSheetName:r,text:t.text,involvedPins:this.getInvolvedPins(t.text,this.tokenToInvolvedPin),schX:t.center.x,schY:t.center.y,message:this.VERBOSE_NET_LABEL_MESSAGE};this.params.issues.push(n)}static issueToString(t){let e=[];return v(e,\"message\",t.message),v(e,\"text\",t.text),v(e,\"involvedPins\",t.involvedPins.join(\",\")),v(e,\"schSheetName\",t.schematicSheetName),v(e,\"schX\",t.schX),v(e,\"schY\",t.schY),`\u003cVerboseSchematicNetLabel ${e.join(\" \")} /\u003e`}isSchematicNetLabel(t){return t.type===\"schematic_net_label\"}isSourcePort(t){return t.type===\"source_port\"}getSourceComponentWithName(t){if(t.type!==\"source_component\"||!(\"source_component_id\"in t)||!(\"name\"in t)||typeof t.source_component_id!==\"string\"||typeof t.name!==\"string\")return null;return{source_component_id:t.source_component_id,name:t.name}}getSourcePortNameCandidates(t){return[t.most_frequently_referenced_by_name,t.name,...t.port_hints??[],t.pin_number===void 0?void 0:String(t.pin_number)].filter((e)=\u003eBoolean(e))}getBestSourcePortName(t){return t.most_frequently_referenced_by_name??t.name??(t.pin_number===void 0?\"\":`pin${t.pin_number}`)}buildTokenToInvolvedPinMap(t){let e=new Map(t.flatMap((n)=\u003e{let i=this.getSourceComponentWithName(n);return i?[i]:[]}).map((n)=\u003e[n.source_component_id,n])),r=new Map;for(let n of t.filter((i)=\u003ethis.isSourcePort(i))){if(!n.source_component_id)continue;let i=e.get(n.source_component_id);if(!i?.name)continue;let s=`${i.name}.${this.getBestSourcePortName(n)}`;for(let o of this.getSourcePortNameCandidates(n))r.set(`${i.name}_${o}`,s)}return r}getInvolvedPins(t,e){let r=new Set;for(let n of t.split(\"/\")){let i=e.get(n);if(i)r.add(i)}return Array.from(r)}}class ui extends U{params;texts;obstacles;sheetNames;index=0;constructor(t){super();this.params=t;let{ctx:e}=t;this.sheetNames=di(e.circuitJson);let r=new Set(e.circuitJson.flatMap((i)=\u003ei.type===\"schematic_component\"\u0026\u0026i.is_box_with_pins===!1\u0026\u0026!i.symbol_name?[i.schematic_component_id]:[])),n=new Set;this.texts=e.circuitJson.flatMap((i)=\u003e{if(i.type!==\"schematic_text\")return[];if(i.schematic_component_id||i.schematic_symbol_id)return[];let s=br(i);if(!s.length)return[];let o=i.schematic_sheet_id,c=JSON.stringify([o,i.text,i.position.x,i.position.y,i.font_size,i.anchor,i.rotation,i.color]);if(n.has(c))return[];return n.add(c),[{text:i,isTraceLabel:Boolean(\"source_trace_id\"in i\u0026\u0026i.source_trace_id),polygons:s,sheetId:o,object:{type:\"text\",id:i.schematic_text_id,text:i.text}}]}),this.obstacles=[...e.componentPlacements.flatMap((i)=\u003ei.schematicComponentId\u0026\u0026!r.has(i.schematicComponentId)?[{object:{type:\"component\",id:i.schematicComponentId,componentName:i.sourceComponentName,schematicComponentId:i.schematicComponentId},polygons:[tr(zt(i.schX,i.schY,i.width,i.height))],sheetId:i.schematicSheetId}]:[]),...e.circuitJson.flatMap((i)=\u003ei.type===\"schematic_trace\"?[{object:{type:\"trace\",id:i.schematic_trace_id},sheetId:i.schematic_sheet_id,segments:i.edges,polygons:i.edges.flatMap((s)=\u003e{let o=Vi(s.from,s.to);return o?[o]:[]})}]:[])],this.solved=this.texts.length===0}_step(){let t=this.texts[this.index],r=[...this.obstacles,...this.texts.slice(this.index+1)].filter((n)=\u003ethis.collides(t,n));if(r.length){let n=t.isTraceLabel?void 0:this.findClearPosition(t);for(let i of r){let s=i.object.componentName??i.object.text;this.params.issues.push({lineItemType:\"SchematicTextCollision\",schematicSheetId:t.sheetId,schematicSheetName:t.sheetId?this.sheetNames.get(t.sheetId):void 0,schematicTextId:t.text.schematic_text_id,text:t.text.text,collidingObject:i.object,textBounds:zi(t.polygons),collidingObjectBounds:zi(i.polygons),suggestedMove:n,message:`Text \"${t.text.text}\" overlaps ${i.object.type}${s?` ${s}`:\"\"}; ${t.isTraceLabel?\"adjust the owning trace's label placement or remove stale duplicates to leave the visible text area clear.\":\"reposition the text to leave its visible area clear.\"}`})}}this.index++,this.solved=this.index\u003e=this.texts.length}collides(t,e){if(t.sheetId!==e.sheetId)return!1;return t.polygons.some((r)=\u003ee.segments?e.segments.some((n)=\u003ehn(n.from,n.to,r)):e.polygons.some((n)=\u003eDi(r,n)))}findClearPosition(t){let e=[...this.obstacles,...this.texts.filter((n)=\u003en!==t)],r=Math.max(0.1,t.text.font_size/2);for(let n=r;n\u003c=Math.max(4,t.text.font_size*8);n+=r)for(let[i,s]of[[0,n],[0,-n],[-n,0],[n,0]]){let o=Math.round((t.text.position.x+i)*1000)/1000,c=Math.round((t.text.position.y+s)*1000)/1000,l={...t,polygons:br({...t.text,position:{x:o,y:c}})};if(e.every((a)=\u003e!this.collides(l,a)))return{newSchX:o,newSchY:c}}return}static issueToString(t){let e=[];return v(e,\"text\",t.text),v(e,\"collidingObjectType\",t.collidingObject.type),v(e,\"collidingText\",t.collidingObject.text),v(e,\"newSchX\",t.suggestedMove?.newSchX),v(e,\"newSchY\",t.suggestedMove?.newSchY),v(e,\"message\",t.message),`\u003cSchematicTextCollision ${e.join(\" \")} /\u003e`}}class Xr extends U{params;static MIN_DISTANCE=6;networks;index=0;constructor(t){super();this.params=t;this.networks=this.findNetworks(t.ctx),this.solved=this.networks.length===0}_step(){let t=this.networks[this.index],e=t.members.slice(0,2),r=Math.max(Xr.MIN_DISTANCE,...e.map((i)=\u003e3*Math.max(i.width,i.height))),n=e.map((i)=\u003eMath.hypot(Math.max(0,Math.abs(i.schX-t.pinPosition.x)-i.width/2),Math.max(0,Math.abs(i.schY-t.pinPosition.y)-i.height/2)));if(n.some((i)=\u003ei\u003er)){let i=t.host.sourceComponentName||\"component\",s=K1(t.pin),o=e.map((c)=\u003ec.sourceComponentName||\"component\").join(\", \");this.params.issues.push({lineItemType:\"ResetNetworkNotGrouped\",hostSchematicBox:t.host,resetSourcePortId:t.pin.source_port_id,resetPinName:s,supportNetworkComponents:t.members,maxDistanceFromResetPin:Math.round(Math.max(...n)*100)/100,maxRecommendedDistance:r,message:`Group ${o} near ${i}.${s} so the reset pull-up and capacitor can be read together. Preserve all net connections; associated test points may remain in a debug area.`})}this.index++,this.solved=this.index\u003e=this.networks.length}findNetworks(t){let e=Zo(t.circuitJson),r=t.circuitJson.filter((_)=\u003e_.type===\"source_component\"),n=new Map(r.map((_)=\u003e[_.source_component_id,_])),i=t.circuitJson.filter((_)=\u003e_.type===\"source_port\"),s=new Map,o=new Map,c=new Set,l=new Set;for(let _ of i){if(!_.source_component_id)continue;let g=s.get(_.source_component_id)??[];g.push(_),s.set(_.source_component_id,g);let y=e(_.source_port_id),S=o.get(y)??[];if(S.push(_),o.set(y,S),_.provides_power||_.requires_power)c.add(y);if(_.provides_ground||_.requires_ground)l.add(y)}for(let _ of t.circuitJson){if(_.type!==\"source_net\")continue;if(_.is_power||_.is_positive_voltage_source)c.add(e(_.source_net_id));if(_.is_ground)l.add(e(_.source_net_id))}let a=new Map(t.componentPlacements.flatMap((_)=\u003e_.sourceComponentId?[[_.sourceComponentId,_]]:[])),p=t.circuitJson.filter((_)=\u003e_.type===\"schematic_port\"),d=new Map(t.circuitJson.filter((_)=\u003e_.type===\"schematic_component\").map((_)=\u003e[_.schematic_component_id,_])),m=[],f=new Set;for(let _ of i){if(!_.source_component_id||!K1(_)||_.do_not_connect)continue;if(n.get(_.source_component_id)?.ftype!==\"simple_chip\")continue;let g=e(_.source_port_id);if(f.has(g)||c.has(g)||l.has(g))continue;f.add(g);let y=o.get(g)??[];if(new Set(y.filter((Q)=\u003eQ.source_component_id\u0026\u0026n.get(Q.source_component_id)?.ftype===\"simple_chip\").map((Q)=\u003eQ.source_component_id)).size!==1)continue;let P=a.get(_.source_component_id),b=p.find((Q)=\u003eQ.source_port_id===_.source_port_id\u0026\u0026Q.schematic_component_id===P?.schematicComponentId);if(!P||!b||b.schematic_sheet_id!==P.schematicSheetId)continue;let C=[],L=[],B=[],k=!1;for(let Q of new Set(y.map((lt)=\u003elt.source_component_id))){if(!Q||Q===_.source_component_id)continue;let lt=n.get(Q)?.ftype,z=s.get(Q)??[],N=a.get(Q);if(lt===\"simple_connector\"||lt===\"simple_pin_header\")continue;if(!N){k=!0;break}if(lt===\"simple_test_point\"\u0026\u0026z.length===1){B.push(N);continue}if(z.length!==2){k=!0;break}let at=z.find((et)=\u003ee(et.source_port_id)!==g);if(!at){k=!0;break}let ot=e(at.source_port_id);if(lt===\"simple_resistor\"\u0026\u0026c.has(ot)\u0026\u0026!l.has(ot))C.push(N);else if(lt===\"simple_capacitor\"\u0026\u0026l.has(ot)\u0026\u0026!c.has(ot))L.push(N);else{k=!0;break}}if(k||C.length!==1||L.length!==1)continue;let I=[...C,...L,...B],j=P.schematicComponentId?d.get(P.schematicComponentId)?.schematic_group_id:void 0;if(I.some((Q)=\u003e{let lt=Q.schematicComponentId?d.get(Q.schematicComponentId)?.schematic_group_id:void 0;return Q.schematicSheetId!==P.schematicSheetId||Q.subcircuitId!==P.subcircuitId||lt!==j}))continue;m.push({host:P,pin:_,pinPosition:b.center,members:I})}return m}static issueToString(t){let e=[];return v(e,\"hostComponentName\",t.hostSchematicBox.sourceComponentName),v(e,\"resetPin\",t.resetPinName),v(e,\"supportNetworkComponents\",t.supportNetworkComponents.map((r)=\u003er.sourceComponentName||\"component\").join(\",\")),v(e,\"maxDistanceFromResetPin\",t.maxDistanceFromResetPin),v(e,\"maxRecommendedDistance\",t.maxRecommendedDistance),v(e,\"message\",t.message),`\u003cResetNetworkNotGrouped ${e.join(\" \")} /\u003e`}}var K1=(t)=\u003e[t.name,...t.port_hints??[]].find((e)=\u003e/^N?(RESET|RST)(N|B)?$/.test(e.toUpperCase().replace(/[_\\-!~#/]/g,\"\")));var UA={FuseConnectorNotAligned:[Qr],TransistorLedNotAligned:[Zr],TransistorResistorNotAligned:[qr],PotentiometerHasIncorrectRailOrientation:[Jr],CapacitorSeparatedFromResistorDivider:[Kr],SeriesResistorsNotAligned:[tn],FuseDiodeNotAligned:[nn],InductorSeparatedFromChipPins:[on],SwitchMatrixDiodeSeparatedFromSwitch:[vr],SwitchMatrixBranchesTooSpreadOut:[vr],TransistorHasIncorrectRailOrientation:[xn],ParallelLedBranchesDrawnInline:[cn],SeriesLedChainNotOrdered:[wn],RailPathTooSpreadOut:[Fn],ResistorSeparatedFromChipPin:[Pn],InductorSeparatedFromChipPin:[bn],CapacitorSeparatedFromChipPins:[Mn],CrystalSeparatedFromChipPins:[fn],SharedNodeDiodesInline:[vn],DiodeCapacitorJunctionTooSpreadOut:[Sn],PiFilterComponentsNotGrouped:[Cn],MosfetGateNetworkNotGrouped:[kn],FlybackDiodeSeparatedFromRelayCoil:[Nn],ComponentOverlap:[Pr],SchematicBoxHasALotOfSurroundingWhitespace:[],CapacitorSymbolHorizontal:[le,_e],VerboseSchematicNetLabel:[mi],PinHeaderSchematicBoxTooWide:[Br],GenericSchematicBoxTooWide:[Br],SchematicBoxInnerLabelCollision:[$n],SchematicBoxInnerLabelOutOfBounds:[gn],SchematicPinPaddingToEdgeTooLarge:[jn],DiodeResistorNotAligned:[Ae],HighPassRcFilterComponentsNotGrouped:[sn],SeriesRcFilterComponentsNotGrouped:[dn],SwitchRcNetworkNotGrouped:[pn],ParallelResistorsDrawnInline:[mn],ResistorSeparatedFromCrystal:[ln],ParallelCapacitorsDrawnInline:[un],ParallelRcNotAligned:[An],ParallelDiodeResistorNotAligned:[Bn],ParallelDiodesNotAligned:[en],SeriesRcBranchNotGrouped:[rn],ParallelDiodeCapacitorNotAligned:[an],ComponentPinsWouldAlignWithVerticalShift:[sr],TraceCanBeSimplifiedByMovingComponent:[de],CrystalNotCenteredOverLoadCapacitors:[Oe],ComponentNetLabelCollision:[or],ComponentBoxNetLabelCollision:[or],NetLabelCollision:[or],FeedbackNetworkNotCompact:[Ar],PullResistorOnWrongSide:[ar,Ws],SchematicTextCollision:[ui],ResetNetworkNotGrouped:[Xr],TwoPinComponentCouldBeFlipped:[me],TwoPinComponentShouldBeVertical:[_e],TwoPinComponentHasInvertedRails:[_e],DecouplingCapacitorsNotCloseTogether:[Re],ConnectorPositionCausesTraceDetours:[Rn],LowSideTransistorNotAlignedWithLoad:[On],UsbSeriesResistorsNotAligned:[Wn],CurrentSenseShuntSeparatedFromInputs:[Yn],VoltageDividerSupplyResistorBelowGroundResistor:[Ln],RegulatorCapacitorsOnWrongSides:[Tn]};class Bh extends ly{ctx;issues=[];pipelineDef=[mt(\"FuseConnectorAlignmentSolver\",Qr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"TransistorLedAlignmentSolver\",Zr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"TransistorResistorAlignmentSolver\",qr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"PotentiometerRailOrientationSolver\",Jr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ResistorDividerCapacitorPlacementSolver\",Kr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SeriesResistorAlignmentSolver\",tn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"FuseDiodeAlignmentSolver\",nn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SwitchRcNetworkGroupingSolver\",pn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SwitchMatrixDiodePlacementSolver\",vr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ParallelResistorPlacementSolver\",mn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ParallelLedBranchPlacementSolver\",cn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SeriesLedChainPlacementSolver\",wn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ParallelRcPlacementSolver\",An,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ParallelDiodeResistorPlacementSolver\",Bn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ParallelDiodeAlignmentSolver\",en,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SeriesRcBranchGroupingSolver\",rn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ParallelDiodeCapacitorAlignmentSolver\",an,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SchematicTextClearanceSolver\",ui,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ResetNetworkGroupingSolver\",Xr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SchematicBoxOverlapSolver\",Pr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"CapacitorOrientationSolver\",le,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"VerboseNetLabelSolver\",mi,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SchematicBoxTooWideSolver\",Br,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SchematicPinPaddingToEdgeSolver\",jn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SchematicBoxInnerLabelBoundsSolver\",gn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SchematicBoxInnerLabelCollisionSolver\",$n,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"DiodeResistorAlignmentSolver\",Ae,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ComponentPinAlignmentSolver\",sr,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"TraceSimplificationSolver\",de,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"CrystalLoadCapacitorPlacementSolver\",Oe,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"TwoPinComponentOrientationSolver\",me,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"FeedbackNetworkPlacementSolver\",Ar,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"TransistorRailOrientationSolver\",xn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"TwoPinComponentRailOrientationSolver\",_e,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"PullResistorPlacementSolver\",ar,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SwitchPullResistorPlacementSolver\",Ws,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ComponentNetLabelCollisionSolver\",or,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"DecouplingCapacitorGroupingSolver\",Re,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ConnectorPlacementSolver\",Rn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"LowSideTransistorPlacementSolver\",On,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"UsbSeriesResistorPlacementSolver\",Wn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"RegulatorInputOutputCapacitorPlacementSolver\",Tn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"VoltageDividerPlacementSolver\",Ln,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"CurrentSenseShuntPlacementSolver\",Yn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"RelayFlybackDiodePlacementSolver\",Nn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SharedNodeDiodePlacementSolver\",vn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"DiodeCapacitorStagePlacementSolver\",Sn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"PiFilterPlacementSolver\",Cn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"MosfetGateNetworkPlacementSolver\",kn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ChipSupplyInductorPlacementSolver\",bn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ChipPinResistorPlacementSolver\",Pn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ChipPinPairCapacitorPlacementSolver\",Mn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ChipPinCrystalPlacementSolver\",fn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"RailPathVisibilitySolver\",Fn,(t)=\u003e[{ctx:t.ctx,issues:t.issues,maxSpan:t.railPathVisibility?.maxSpan,maxLength:t.railPathVisibility?.maxPathLength}]),mt(\"HighPassRcFilterPlacementSolver\",sn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"SeriesRcFilterPlacementSolver\",dn,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"CrystalResistorPlacementSolver\",ln,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ParallelCapacitorAlignmentSolver\",un,(t)=\u003e[{ctx:t.ctx,issues:t.issues}]),mt(\"ChipPinPairInductorPlacementSolver\",on,(t)=\u003e[{ctx:t.ctx,issues:t.issues}])];selectedIssueTypes;railPathVisibility;constructor(t,e={}){super(t);if(this.railPathVisibility=e.railPathVisibility,e.issueTypes!==void 0){this.selectedIssueTypes=new Set(e.issueTypes);let r=new Set(e.issueTypes.flatMap((n)=\u003eUA[n]));this.pipelineDef=this.pipelineDef.filter((n)=\u003er.has(n.solverClass))}}_setup(){this.ctx=Z1(this.inputProblem)}getOutput(){let t=new Set(this.issues.flatMap((e)=\u003ee.lineItemType===\"TwoPinComponentShouldBeVertical\"\u0026\u0026e.schematicBox.schematicComponentId?[e.schematicBox.schematicComponentId]:[]));return{issues:this.issues.filter((e)=\u003ee.lineItemType!==\"CapacitorSymbolHorizontal\"||!t.has(e.schematicBox.schematicComponentId??\"\")).filter((e)=\u003ethis.selectedIssueTypes===void 0||this.selectedIssueTypes.has(e.lineItemType)),componentPlacements:this.ctx.componentPlacements}}}var js=({issues:t,componentPlacements:e,circuitJson:r})=\u003e{let n=new Set,i=new Map(e.flatMap((l)=\u003el.schematicComponentId?[[l.schematicComponentId,l]]:[])),s=new Map;for(let l of e){if(!l.sourceComponentName)continue;let a=s.get(l.sourceComponentName);if(a)a.push(l);else s.set(l.sourceComponentName,[l])}let o=(l)=\u003e{if(!l)return;let a=l.schematicComponentId?i.get(l.schematicComponentId):e.find((p)=\u003ep.sourceComponentId===l.sourceComponentId\u0026\u0026p.schX===l.schX\u0026\u0026p.schY===l.schY);if(a)n.add(a)},c=(l,a)=\u003e{if(!l)return;for(let p of s.get(l)??[])if(a===void 0||p.schematicSheetId===a)n.add(p)};for(let l of t)switch(l.lineItemType){case\"FuseConnectorNotAligned\":o(l.fuseSchematicBox),o(l.connectorSchematicBox);break;case\"TransistorLedNotAligned\":o(l.transistorSchematicBox),o(l.ledSchematicBox);break;case\"TransistorResistorNotAligned\":o(l.transistorSchematicBox),o(l.resistorSchematicBox);break;case\"PotentiometerHasIncorrectRailOrientation\":o(l.schematicBox);break;case\"CapacitorSeparatedFromResistorDivider\":o(l.capacitorSchematicBox);for(let a of l.resistorSchematicBoxes)o(a);break;case\"SeriesResistorsNotAligned\":o(l.firstResistorSchematicBox),o(l.secondResistorSchematicBox);break;case\"FuseDiodeNotAligned\":o(l.fuseSchematicBox),o(l.diodeSchematicBox);break;case\"InductorSeparatedFromChipPins\":o(l.hostSchematicBox),o(l.inductorSchematicBox);break;case\"ParallelLedBranchesDrawnInline\":case\"SwitchMatrixBranchesTooSpreadOut\":for(let a of l.branchSchematicBoxes)o(a);break;case\"SwitchMatrixDiodeSeparatedFromSwitch\":o(l.switchSchematicBox),o(l.diodeSchematicBox);break;case\"SeriesLedChainNotOrdered\":for(let a of l.ledSchematicBoxes)o(a);break;case\"InductorSeparatedFromChipPin\":o(l.hostSchematicBox),o(l.inductorSchematicBox);break;case\"ResistorSeparatedFromChipPin\":o(l.hostSchematicBox),o(l.resistorSchematicBox);break;case\"CrystalSeparatedFromChipPins\":o(l.hostSchematicBox),o(l.crystalSchematicBox);break;case\"CapacitorSeparatedFromChipPins\":o(l.hostSchematicBox),o(l.capacitorSchematicBox);break;case\"TransistorHasIncorrectRailOrientation\":o(l.transistorSchematicBox),o(l.supplyResistorSchematicBox),o(l.groundResistorSchematicBox);break;case\"SharedNodeDiodesInline\":for(let a of l.diodeSchematicBoxes)o(a);break;case\"DiodeCapacitorJunctionTooSpreadOut\":o(l.capacitorSchematicBox);for(let a of l.diodeSchematicBoxes)o(a);break;case\"PiFilterComponentsNotGrouped\":o(l.inductorSchematicBox),o(l.firstCapacitorSchematicBox),o(l.secondCapacitorSchematicBox);break;case\"MosfetGateNetworkNotGrouped\":o(l.mosfetSchematicBox),o(l.seriesGateResistorSchematicBox),o(l.gateSourceResistorSchematicBox);break;case\"FlybackDiodeSeparatedFromRelayCoil\":o(l.relaySchematicBox),o(l.diodeSchematicBox);break;case\"CurrentSenseShuntSeparatedFromInputs\":o(l.amplifierSchematicBox),o(l.shuntSchematicBox);break;case\"VoltageDividerSupplyResistorBelowGroundResistor\":o(l.supplyResistorSchematicBox),o(l.groundResistorSchematicBox);break;case\"RegulatorCapacitorsOnWrongSides\":o(l.regulatorSchematicBox),o(l.inputCapacitorSchematicBox),o(l.outputCapacitorSchematicBox);break;case\"UsbSeriesResistorsNotAligned\":o(l.positiveResistorSchematicBox),o(l.negativeResistorSchematicBox);break;case\"LowSideTransistorNotAlignedWithLoad\":o(l.transistorSchematicBox),o(l.loadSchematicBox),o(l.baseResistorSchematicBox),o(l.clampDiodeSchematicBox);break;case\"DecouplingCapacitorsNotCloseTogether\":for(let a of l.capacitorSchematicBoxes)o(a);break;case\"ConnectorPositionCausesTraceDetours\":o(l.connectorSchematicBox);for(let a of l.connectedComponents)o(a);break;case\"ResetNetworkNotGrouped\":o(l.hostSchematicBox);for(let a of l.supportNetworkComponents)o(a);break;case\"SchematicTextCollision\":if(l.collidingObject.schematicComponentId)o(i.get(l.collidingObject.schematicComponentId));if(l.collidingObject.type===\"trace\")for(let a of t2({schematicTraceId:l.collidingObject.id,circuitJson:r,placementByComponentId:i}))o(a);break;case\"ComponentOverlap\":o(l.firstComponent),o(l.secondComponent);break;case\"SchematicBoxHasALotOfSurroundingWhitespace\":case\"CapacitorSymbolHorizontal\":case\"PinHeaderSchematicBoxTooWide\":case\"GenericSchematicBoxTooWide\":case\"SchematicBoxInnerLabelCollision\":case\"SchematicBoxInnerLabelOutOfBounds\":case\"SchematicPinPaddingToEdgeTooLarge\":o(l.schematicBox);break;case\"VerboseSchematicNetLabel\":for(let a of l.involvedPins)c(GA(a),l.schematicSheetId);break;case\"SwitchRcNetworkNotGrouped\":if(o(l.switchSchematicBox),o(l.capacitorSchematicBox),l.resistorSchematicBox)o(l.resistorSchematicBox);break;case\"ResistorSeparatedFromCrystal\":o(l.crystalSchematicBox),o(l.resistorSchematicBox);break;case\"ParallelCapacitorsDrawnInline\":o(l.firstCapacitorSchematicBox),o(l.secondCapacitorSchematicBox);break;case\"ParallelResistorsDrawnInline\":o(l.firstResistorSchematicBox),o(l.secondResistorSchematicBox);break;case\"HighPassRcFilterComponentsNotGrouped\":case\"SeriesRcFilterComponentsNotGrouped\":case\"ParallelRcNotAligned\":o(l.resistorSchematicBox),o(l.capacitorSchematicBox);break;case\"ParallelDiodesNotAligned\":o(l.firstDiodeSchematicBox),o(l.secondDiodeSchematicBox);break;case\"SeriesRcBranchNotGrouped\":o(l.resistorSchematicBox),o(l.capacitorSchematicBox);break;case\"ParallelDiodeCapacitorNotAligned\":o(l.diodeSchematicBox),o(l.capacitorSchematicBox);break;case\"ParallelDiodeResistorNotAligned\":case\"DiodeResistorNotAligned\":o(l.diodeSchematicBox),o(l.resistorSchematicBox);break;case\"ComponentPinsWouldAlignWithVerticalShift\":o(l.firstComponent),o(l.secondComponent),o(l.targetComponent);break;case\"TraceCanBeSimplifiedByMovingComponent\":o(l.targetComponent);for(let a of t2({schematicTraceId:l.schematicTraceId,circuitJson:r,placementByComponentId:i}))n.add(a);break;case\"CrystalNotCenteredOverLoadCapacitors\":o(l.crystalSchematicBox),o(l.firstLoadCapacitorSchematicBox),o(l.secondLoadCapacitorSchematicBox);break;case\"TwoPinComponentCouldBeFlipped\":o(l.targetComponent),o(l.connectedComponent);break;case\"FeedbackNetworkNotCompact\":o(l.amplifierSchematicBox);for(let a of l.feedbackComponents)o(a);break;case\"TwoPinComponentShouldBeVertical\":case\"TwoPinComponentHasInvertedRails\":o(l.schematicBox);break;case\"RailPathTooSpreadOut\":o(l.hostSchematicBox);for(let a of l.supportSchematicBoxes)o(a);break;case\"PullResistorOnWrongSide\":o(l.resistorSchematicBox),o(l.hostSchematicBox);break;case\"ComponentNetLabelCollision\":o(l.firstComponent),o(l.secondComponent);break;case\"ComponentBoxNetLabelCollision\":o(l.boxComponent),o(l.labelComponent);break;case\"NetLabelCollision\":for(let a of l.pairs)c(a.comp1Name,l.schematicSheetId),c(a.comp2Name,l.schematicSheetId);for(let a of l.moves)c(a.componentName,l.schematicSheetId);break}return e.filter((l)=\u003en.has(l))},Dr=(t)=\u003e{if(\"schematicSheetId\"in t||\"schematicSheetName\"in t){let e=\"schematicSheetId\"in t\u0026\u0026typeof t.schematicSheetId===\"string\"?t.schematicSheetId:void 0,r=\"schematicSheetName\"in t\u0026\u0026typeof t.schematicSheetName===\"string\"?t.schematicSheetName:void 0;if(e||r)return{schematicSheetId:e,schematicSheetName:r}}for(let e of Object.values(t).flat())if(HA(e))return{schematicSheetId:e.schematicSheetId,schematicSheetName:e.schematicSheetName};return{}},GA=(t)=\u003e{let e=t.lastIndexOf(\".\");return e===-1?t:t.slice(0,e)},HA=(t)=\u003eBoolean(t\u0026\u0026typeof t===\"object\"\u0026\u0026\"positionAnchor\"in t\u0026\u0026t.positionAnchor===\"center\"\u0026\u0026\"schX\"in t\u0026\u0026\"schY\"in t\u0026\u0026\"width\"in t\u0026\u0026\"height\"in t),t2=({schematicTraceId:t,circuitJson:e,placementByComponentId:r})=\u003e{let n=e.find((a)=\u003ea.type===\"schematic_trace\"\u0026\u0026a.schematic_trace_id===t),i=n?.edges[0],s=n?.edges.at(-1);if(!n||!i||!s)return[];let o=e.filter((a)=\u003ea.type===\"schematic_port\"),c=new Map(o.map((a)=\u003e[a.schematic_port_id,a]));return[i.from_schematic_port_id?c.get(i.from_schematic_port_id):e2(o,i.from,n.schematic_sheet_id),s.to_schematic_port_id?c.get(s.to_schematic_port_id):e2(o,s.to,n.schematic_sheet_id)].flatMap((a)=\u003e{let p=a?.schematic_component_id?r.get(a.schematic_component_id):void 0;return p?[p]:[]})},e2=(t,e,r)=\u003et.find((n)=\u003en.schematic_sheet_id===r\u0026\u0026Math.abs(n.center.x-e.x)\u003c=0.01\u0026\u0026Math.abs(n.center.y-e.y)\u003c=0.01);class Ih{lineItems;groupBySchematicSheet;constructor(t,e=!1){this.lineItems=t;this.groupBySchematicSheet=e}getLineItems(){return this.lineItems}getIssues(t={}){return this.lineItems.flatMap((e)=\u003ee.lineItemType===\"SchematicPlacementIssues\"?e.issues:[]).filter((e)=\u003e(t.issueTypes===void 0||t.issueTypes.includes(e.lineItemType))\u0026\u0026(t.schematicSheetId===void 0||(Dr(e).schematicSheetId??\"\")===t.schematicSheetId))}getIssueCounts(t={}){let e={FuseConnectorNotAligned:0,TransistorLedNotAligned:0,TransistorResistorNotAligned:0,PotentiometerHasIncorrectRailOrientation:0,CapacitorSeparatedFromResistorDivider:0,SeriesResistorsNotAligned:0,FuseDiodeNotAligned:0,InductorSeparatedFromChipPins:0,TransistorHasIncorrectRailOrientation:0,FlybackDiodeSeparatedFromRelayCoil:0,ComponentOverlap:0,SchematicBoxHasALotOfSurroundingWhitespace:0,CapacitorSymbolHorizontal:0,VerboseSchematicNetLabel:0,PinHeaderSchematicBoxTooWide:0,GenericSchematicBoxTooWide:0,SchematicBoxInnerLabelCollision:0,SchematicBoxInnerLabelOutOfBounds:0,SchematicPinPaddingToEdgeTooLarge:0,DiodeResistorNotAligned:0,HighPassRcFilterComponentsNotGrouped:0,SeriesRcFilterComponentsNotGrouped:0,SwitchRcNetworkNotGrouped:0,ParallelResistorsDrawnInline:0,ResistorSeparatedFromCrystal:0,ParallelCapacitorsDrawnInline:0,ParallelRcNotAligned:0,ParallelDiodeResistorNotAligned:0,ParallelDiodesNotAligned:0,SeriesRcBranchNotGrouped:0,ParallelDiodeCapacitorNotAligned:0,ComponentPinsWouldAlignWithVerticalShift:0,TraceCanBeSimplifiedByMovingComponent:0,CrystalNotCenteredOverLoadCapacitors:0,ComponentNetLabelCollision:0,ComponentBoxNetLabelCollision:0,NetLabelCollision:0,FeedbackNetworkNotCompact:0,PullResistorOnWrongSide:0,SchematicTextCollision:0,ResetNetworkNotGrouped:0,TwoPinComponentCouldBeFlipped:0,TwoPinComponentShouldBeVertical:0,TwoPinComponentHasInvertedRails:0,DecouplingCapacitorsNotCloseTogether:0,ConnectorPositionCausesTraceDetours:0,LowSideTransistorNotAlignedWithLoad:0,UsbSeriesResistorsNotAligned:0,RegulatorCapacitorsOnWrongSides:0,VoltageDividerSupplyResistorBelowGroundResistor:0,CurrentSenseShuntSeparatedFromInputs:0,DiodeCapacitorJunctionTooSpreadOut:0,SharedNodeDiodesInline:0,PiFilterComponentsNotGrouped:0,MosfetGateNetworkNotGrouped:0,CapacitorSeparatedFromChipPins:0,CrystalSeparatedFromChipPins:0,ResistorSeparatedFromChipPin:0,InductorSeparatedFromChipPin:0,RailPathTooSpreadOut:0,SwitchMatrixDiodeSeparatedFromSwitch:0,SwitchMatrixBranchesTooSpreadOut:0,ParallelLedBranchesDrawnInline:0,SeriesLedChainNotOrdered:0};for(let r of this.getIssues(t))e[r.lineItemType]++;return e}getString(){return this.toString()}schematicBoxPlacementsToString(t){let e=[];return v(e,\"componentName\",t.sourceComponentName),v(e,\"positionAnchor\",t.positionAnchor),v(e,\"schX\",t.schX),v(e,\"schY\",t.schY),v(e,\"width\",t.width),v(e,\"height\",t.height),`\u003cSchematicBoxPlacement ${e.join(\" \")} /\u003e`}schematicIssuesToString(t){switch(t.lineItemType){case\"FuseConnectorNotAligned\":return Qr.issueToString(t);case\"TransistorLedNotAligned\":return Zr.issueToString(t);case\"TransistorResistorNotAligned\":return qr.issueToString(t);case\"PotentiometerHasIncorrectRailOrientation\":return Jr.issueToString(t);case\"CapacitorSeparatedFromResistorDivider\":return Kr.issueToString(t);case\"SeriesResistorsNotAligned\":return tn.issueToString(t);case\"FuseDiodeNotAligned\":return nn.issueToString(t);case\"InductorSeparatedFromChipPins\":return on.issueToString(t);case\"TransistorHasIncorrectRailOrientation\":return xn.issueToString(t);case\"SwitchMatrixBranchesTooSpreadOut\":case\"SwitchMatrixDiodeSeparatedFromSwitch\":return vr.issueToString(t);case\"ParallelLedBranchesDrawnInline\":return cn.issueToString(t);case\"SeriesLedChainNotOrdered\":return wn.issueToString(t);case\"InductorSeparatedFromChipPin\":return bn.issueToString(t);case\"ResistorSeparatedFromChipPin\":return Pn.issueToString(t);case\"CrystalSeparatedFromChipPins\":return fn.issueToString(t);case\"CapacitorSeparatedFromChipPins\":return Mn.issueToString(t);case\"SharedNodeDiodesInline\":return vn.issueToString(t);case\"DiodeCapacitorJunctionTooSpreadOut\":return Sn.issueToString(t);case\"PiFilterComponentsNotGrouped\":return Cn.issueToString(t);case\"MosfetGateNetworkNotGrouped\":return kn.issueToString(t);case\"CurrentSenseShuntSeparatedFromInputs\":return Yn.issueToString(t);case\"ComponentOverlap\":return Pr.issueToString(t);case\"CapacitorSymbolHorizontal\":return le.issueToString(t);case\"DecouplingCapacitorsNotCloseTogether\":return Re.issueToString(t);case\"VerboseSchematicNetLabel\":return mi.issueToString(t);case\"PinHeaderSchematicBoxTooWide\":case\"GenericSchematicBoxTooWide\":return Br.issueToString(t);case\"SchematicBoxInnerLabelOutOfBounds\":return gn.issueToString(t);case\"SchematicBoxInnerLabelCollision\":return $n.issueToString(t);case\"SchematicPinPaddingToEdgeTooLarge\":return jn.issueToString(t);case\"HighPassRcFilterComponentsNotGrouped\":return sn.issueToString(t);case\"SeriesRcFilterComponentsNotGrouped\":return dn.issueToString(t);case\"SwitchRcNetworkNotGrouped\":return pn.issueToString(t);case\"ResistorSeparatedFromCrystal\":return ln.issueToString(t);case\"ParallelCapacitorsDrawnInline\":return un.issueToString(t);case\"ParallelResistorsDrawnInline\":return mn.issueToString(t);case\"ParallelRcNotAligned\":return An.issueToString(t);case\"ParallelDiodesNotAligned\":return en.issueToString(t);case\"SeriesRcBranchNotGrouped\":return rn.issueToString(t);case\"ParallelDiodeCapacitorNotAligned\":return an.issueToString(t);case\"ParallelDiodeResistorNotAligned\":return Bn.issueToString(t);case\"DiodeResistorNotAligned\":return Ae.issueToString(t);case\"ComponentPinsWouldAlignWithVerticalShift\":return sr.issueToString(t);case\"TraceCanBeSimplifiedByMovingComponent\":return de.issueToString(t);case\"CrystalNotCenteredOverLoadCapacitors\":return Oe.issueToString(t);case\"TwoPinComponentCouldBeFlipped\":return me.issueToString(t);case\"FeedbackNetworkNotCompact\":return Ar.issueToString(t);case\"TwoPinComponentShouldBeVertical\":case\"TwoPinComponentHasInvertedRails\":return _e.issueToString(t);case\"RailPathTooSpreadOut\":return Fn.issueToString(t);case\"PullResistorOnWrongSide\":return ar.issueToString(t);case\"NetLabelCollision\":return or.netLabelCollisionToString(t);case\"SchematicTextCollision\":return ui.issueToString(t);case\"ResetNetworkNotGrouped\":return Xr.issueToString(t);case\"ConnectorPositionCausesTraceDetours\":return Rn.issueToString(t);case\"LowSideTransistorNotAlignedWithLoad\":return On.issueToString(t);case\"FlybackDiodeSeparatedFromRelayCoil\":return Nn.issueToString(t);case\"VoltageDividerSupplyResistorBelowGroundResistor\":return Ln.issueToString(t);case\"RegulatorCapacitorsOnWrongSides\":return Tn.issueToString(t);case\"UsbSeriesResistorsNotAligned\":return Wn.issueToString(t);default:return\"\"}}toString(){let t=this.lineItems.filter((i)=\u003ei.lineItemType===\"SchematicBoxPlacement\"),e=this.lineItems.flatMap((i)=\u003ei.lineItemType===\"SchematicPlacementIssues\"?i.issues:[]);if(e.length===0)return\"\";if(!this.groupBySchematicSheet)return this.issueContextToLines(t,e).join(`\n`);let r=new Map,n=(i)=\u003e{let s=i.schematicSheetId??i.schematicSheetName??\"__default__\",o=r.get(s);if(o)return o;let c={...i,placements:[],issues:[]};return r.set(s,c),c};for(let i of e)n(Dr(i)).issues.push(i);for(let i of t)n({schematicSheetId:i.schematicSheetId,schematicSheetName:i.schematicSheetName}).placements.push(i);return[...r.values()].flatMap((i)=\u003e{let s=[];return v(s,\"name\",i.schematicSheetName),v(s,\"id\",i.schematicSheetId),[`\u003cSchematicSheet${s.length\u003e0?` ${s.join(\" \")}`:\"\"}\u003e`,...this.issueContextToLines(i.placements,i.issues),\"\u003c/SchematicSheet\u003e\"]}).join(`\n`)}issueContextToLines(t,e){return[...t.length\u003e0?[\"\u003cSchematicBoxPositions\u003e\",...t.map(this.schematicBoxPlacementsToString),\"\u003c/SchematicBoxPositions\u003e\"]:[],\"\u003cSchematicPlacementIssues\u003e\",...e.map(this.schematicIssuesToString),\"\u003c/SchematicPlacementIssues\u003e\"]}}var Fh=(t,e={})=\u003e{let r=new Bh(t,e);r.solve();let{issues:n,componentPlacements:i}=r.getOutput(),o=[...js({issues:n,componentPlacements:i,circuitJson:t}),...n.length\u003e0?[{lineItemType:\"SchematicPlacementIssues\",issues:n}]:[]],c=new Set(t.flatMap((l)=\u003e(\"schematic_sheet_id\"in l)\u0026\u0026typeof l.schematic_sheet_id===\"string\"?[l.schematic_sheet_id]:[]));return new Ih(o,c.size\u003e1)};function QA(t){let e=t.match(/\u003csvg([^\u003e]*)\u003e/);if(!e)throw Error(\"Invalid SVG string: No \u003csvg\u003e tag found\");let r={},n={},i=e[1]??\"\",s=/([A-Za-z_:][A-Za-z0-9_.:-]*)=(?:\"([^\"]*)\"|'([^']*)')/g,o;while((o=s.exec(i))!==null){let y=o[1],S=o[2]??o[3];if(!y||S===void 0)continue;if(y===\"xmlns\"||y.startsWith(\"xmlns:\"))n[y]=S;r[y]=S}let c=0,l=0,a,p,d,m,f;if(r.viewBox){a=r.viewBox;let y=a.trim().split(/[\\s,]+/).map((S)=\u003eNumber.parseFloat(S));if(Number.isFinite(y[0]))p=y[0];if(Number.isFinite(y[1]))d=y[1];if(Number.isFinite(y[2]))m=y[2];if(Number.isFinite(y[3]))f=y[3];if(!r.width\u0026\u0026Number.isFinite(m))c=m;if(!r.height\u0026\u0026Number.isFinite(f))l=f}if(r.width){let y=Number.parseFloat(r.width);if(Number.isFinite(y))c=y}if(r.height){let y=Number.parseFloat(r.height);if(Number.isFinite(y))l=y}if(!Number.isFinite(c))c=0;if(!Number.isFinite(l))l=0;let g=t.match(/\u003csvg[^\u003e]*\u003e([\\s\\S]*)\u003c\\/svg\u003e/)?.[1]?.trim()??\"\";return{width:c,height:l,viewBox:a,viewBoxMinX:p,viewBoxMinY:d,viewBoxWidth:m,viewBoxHeight:f,content:g,attributes:r,xmlnsAttributes:n}}function ZA(t,e,r){let n=[];if(n.push(`translate(${e}, ${r})`),t.viewBoxMinX!==void 0\u0026\u0026t.viewBoxMinY!==void 0\u0026\u0026t.viewBoxWidth\u0026\u0026t.viewBoxHeight){let{viewBoxMinX:s,viewBoxMinY:o}=t,c=t.width||t.viewBoxWidth,l=t.height||t.viewBoxHeight,a=c/t.viewBoxWidth,p=l/t.viewBoxHeight;n.push(`scale(${a}, ${p})`),n.push(`translate(${-s}, ${-o})`)}return n.join(\" \")}function qA(t,e){let r=new Map,n=/\\bid=\"([^\"]+)\"/g,i;while((i=n.exec(t))!==null){let o=i[1];if(!o)continue;let c=`${o}${e}`;r.set(o,c)}if(r.size===0)return t;let s=t.replace(n,(o,c)=\u003e`id=\"${r.get(c)||c}\"`);return s=s.replace(/url\\(#([^)]+)\\)/g,(o,c)=\u003er.has(c)?`url(#${r.get(c)})`:o),s=s.replace(/(xlink:href|href)=\"#([^\"]+)\"/g,(o,c,l)=\u003er.has(l)?`${c}=\"#${r.get(l)}\"`:o),s=s.replace(/style=\"([^\"]*)\"/g,(o,c)=\u003e`style=\"${c.replace(/url\\(#([^)]+)\\)/g,(a,p)=\u003er.has(p)?`url(#${r.get(p)})`:a)}\"`),s}function JA(t,e){if(t.length===0)return t;let r=0;for(let i of t){let s=Math.max(i.width,i.height);if(s\u003er)r=s}if(r===0)return t;let n=e??r;return t.map((i)=\u003e{let s=Math.max(i.width,i.height);if(s===0)return i;let o=n/s;return{...i,width:i.width*o,height:i.height*o}})}function KA(t){let e={};e.xmlns=\"http://www.w3.org/2000/svg\";for(let r of t)for(let[n,i]of Object.entries(r.xmlnsAttributes))if(!e[n])e[n]=i;return e}function tP(t){return Object.entries(t).map(([e,r])=\u003e`${e}=\"${r}\"`).join(\" \")}function r2(t,e={}){let r=e.gap??0;if(!Number.isFinite(r))r=0;let n=e.normalizeSize??!0;if(t.length===0)return'\u003csvg width=\"0\" height=\"0\" viewBox=\"0 0 0 0\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003c/svg\u003e';let i=t.map((f,_)=\u003e{try{return QA(f)}catch(g){throw Error(`Failed to parse SVG at index ${_}: ${g.message}`)}}),s=n?JA(i,e.targetSize):i,o=Math.max(...s.map((f)=\u003ef.width)),c=s.reduce((f,_)=\u003ef+_.height,0)+r*(s.length-1),l=0,a=[];for(let f=0;f\u003cs.length;f++){let _=s[f];if(!_)continue;let g=(o-_.width)/2,y=f===0?_.content:qA(_.content,`__stack${f}`),S=ZA(_,g,l);a.push(` \u003cg transform=\"${S}\"\u003e\n ${y}\n \u003c/g\u003e`),l+=_.height+r}let p=KA(s),d={width:o.toString(),height:c.toString(),viewBox:`0 0 ${o} ${c}`,...p,...e.rootAttributes||{}};return`\u003csvg ${tP(d)}\u003e\n${a.join(`\n`)}\n\u003c/svg\u003e`}var n2=\"T1RUTwAJAIAAAwAQQ0ZGIFhQSpcAAAcwAABJ3U9TLzJqmmVhAAABAAAAAGBjbWFwFN0WswAABEwAAALEaGVhZC1P1HwAAACcAAAANmhoZWEDrgI1AAAA1AAAACRobXR44xAAAAAAURAAAAFQbWF4cABUUAAAAAD4AAAABm5hbWUZQ94BAAABYAAAAutwb3N0AAMAAAAABxAAAAAgAAEAAAABAADb+Z65Xw889QADA+gAAAAA5e9IsgAAAADl70iy/9P/PwKHAvkAAAADAAIAAAAAAAAAAQAAA6z/LAAAArQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAFQAAFAAAFQAAAADArQB9AAFAAACigK7AAAAjAKKArsAAAHfADEBAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAABYWFhYAEAAIQB6A6z/LAAAAvkAwQAAAAEAAAAAAiwC1wAAAAAAAAAAACIBngABAAAAAAAAAAEAWQABAAAAAAABABEAAAABAAAAAAACAAcAMwABAAAAAAADABsA/AABAAAAAAAEABkASAABAAAAAAAFAAsA2wABAAAAAAAGABgAkwABAAAAAAAHAAEAWQABAAAAAAAIAAEAWQABAAAAAAAJAAEAWQABAAAAAAAKAAEAWQABAAAAAAALAAEAWQABAAAAAAAMAAEAWQABAAAAAAANAAEAWQABAAAAAAAOAAEAWQABAAAAAAAQABEAAAABAAAAAAARAAcAMwADAAEECQAAAAIAgwADAAEECQABACIAEQADAAEECQACAA4AOgADAAEECQADADYBFwADAAEECQAEADIAYQADAAEECQAFABYA5gADAAEECQAGADAAqwADAAEECQAHAAIAgwADAAEECQAIAAIAgwADAAEECQAJAAIAgwADAAEECQAKAAIAgwADAAEECQALAAIAgwADAAEECQAMAAIAgwADAAEECQANAAIAgwADAAEECQAOAAIAgwADAAEECQAQACIAEQADAAEECQARAA4AOlRzY2lyY3VpdEFscGhhYmV0AFQAcwBjAGkAcgBjAHUAaQB0AEEAbABwAGgAYQBiAGUAdFJlZ3VsYXIAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0IFJlZ3VsYXIAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgBUAHMAYwBpAHIAYwB1AGkAdABBAGwAcABoAGEAYgBlAHQAUgBlAGcAdQBsAGEAclZlcnNpb24gMC4xAFYAZQByAHMAaQBvAG4AIAAwAC4AMSA6VHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhcgAgADoAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAcgAAAAABAAMAAQAAAAwABAK4AAAAqgCAAAYAKgAAACEAIgAjACQAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA8AD0APgBBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGEAYgBjAGQAZQBmAGcAaABpAGoAawBsAG0AbgBvAHAAcQByAHMAdAB1AHYAdwB4AHkAev//AAAAAAAhACIAIwAkACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAPAA9AD4AQQBCAEMARABFAEYARwBIAEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAVgBXAFgAWQBaAFsAXABdAF4AXwBhAGIAYwBkAGUAZgBnAGgAaQBqAGsAbABtAG4AbwBwAHEAcgBzAHQAdQB2AHcAeAB5AHr//wAA/+D/4P/g/+D/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/c/9z/3P/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2QABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEABAEAAQEBGVRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgABAQEo+BsA+BwC+B0D+B4Ei/tV+kD5SAUdAAABOQ8dAAAB4BGLHQAASd0SAFcBAQwlNj0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkFZlcnNpb24gMC4xVHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhclRzY2lyY3VpdEFscGhhYmV0UmVndWxhciEiIyQnKCkqKywtLi8wMTIzNDU2Nzg5PD0+QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2FiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6AAAAAYsBjAGNAY4BjwGQAZEBkgGTAZQBlQGWAZcBmAGZAZoBmwGcAZ0BngGfAaABoQGiAaMBpAGlAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AbUBtgG3AbgBuQG6AbsBvAG9Ab4BvwHAAcEBwgHDAcQBxQHGAccByAHJAcoBywHMAc0BzgHPAdAB0QHSAdMB1AHVAdYB1wHYAdkB2gHbAdwB3QBUAgABAAQAeADuAgwFUgWPBmUHOwffCGMIzwkMCUgJhQq1CzwMhg5ADwwQUBHfEt8U3hYZFqIXFxeiGEIZtBsIHCccsh0sHpIfGh9XIC8gtiEFIjwjJSRTJWUmviftKXQp2CqzK0gsfS0ILW8uPy6iLuAvQy+2L/IxEDItM0A0XjWWNlQ39zjFOTk59zp9Oro76Dy1Pd8+/EAaQJVCDELOQ49EGEVZReRGgUdR+UgO+Uj37vlBFYv8VgWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+FYFjpsFlZkFmpQFnI8FnIcFmoIFlX0FL/z3Fe+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBSeLBXqOBX2UBYGZBYebBY+bBZWZBZmUBQ75SPdm+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQX3p3sVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj3XvcoFYAiBYZ7BYB/BXyDBXmJBXqQBX6VBYOaBYmbBZPgBSR/BXqMBXuSBX+YBYaaBYycBZOaBZiVBZyRBfcPmgWe91QFKH8FeYwFfJIFf5gFhZoFjZwFkpkFmZYFm5EF9wyZBZ33RgWQmgWWmAWakwWdjQWchgWYgQWUfAWMewV7+zIF9zifBZr3JgWQmgWWmAWbkwWcjQWchgWZgQWTfAWNewV++xMF8JcFnIoFm4QFl34FkHwFinoFg30FfoAFeoUF+w19BXj7VQXslwWdigWahAWXfwWRewWKegWDfQV+gAV6hgX7CnwFfvscBYZ7BX9/BXyDBXqJBXqQBX2VBYOaBYmbBZf3CQX7MM0V9zifBZ/3VAX7OHcFDvlI9/T5XhWL/awFiHoFgX4FfIEFeogFeo4FfJUFgpgFh5wFi/msBY+bBZSZBZqUBZyOBZyIBZqCBZV9BfcB+2YVNd0FgpkFiJsFjpsFlZkFmpQFnI4FnIcFmoIF4DkFlX0FjnoFh3sFgX4FfYIFeYgFeo4FQ9sV+z+bBXuQBX2VBYOaBYmbBZCbBZeYBZqTBZ2MBfc+ewWchgWZgAWTfQWMegWGfAWAfgV8gwX7LqUVKjgFe4MFeogFeo8FfZUFgpkFiJwFkJsFlZgF7d4FmpMFnI0FnIcFmYEFlH0FjnsFh3sFLD4VZvsHBYN8BX2BBXqGBXqMBXuTBYCYBYabBY2bBa/3CAWTmQWZlgWckAWciQWbgwWWfwWQewVkIRWkSQWNegWHewWAfgV8gwV6iQV6jwV9lQWCmQVyzQWJmwWPmwWWmQWakwWcjQWchwWZgQWdTxXUWgWXfwWRewWKewWEfAV+fwV7hgV5iwV7kgVCvQV/lwWFmgWLnAWTmgWYlgWbkQWdigXTWhX3fFkFm4QFl38FkXwFi3oFhHwFfoAFe4UFeYwF+3y8BXuSBX+XBYWaBYycBZKaBZeWBZyRBfedUhXVWgWWfwWSewWKewWEfAV+fwV6hgV6iwV7kgVCvAV/mAWFmgWLnAWTmgWXlgWckQWcigX2PBWjOAWMewWGewV/fgV8hAV5igV6kAV+lgWDmQVz3gWKmwWQmwWXmAWakgWdjAWbhgWZgAWp+xAVW/sHBYF9BX2BBXqIBXmOBX2UBYGYBYebBY6cBbz3BwWUmQWalQWcjgWciAWaggWVfQWPewU/+y8V+w5aBXqHBXmOBX2UBYGZBYebBY6bBZWZBZmUBfcOvQWcjgWciAWaggWVfgWPewWIewWBfQX7M00V+zObBXuQBX2WBYOZBYqcBZCaBZaYBZuTBZyMBfczewWchgWYgAWTfAWNewWFewWAfwV7gwX7VqAVNb0Ff5YFg5oFi5sFkZsFl5cFm5IFnIsFnIYF4FkFmIAFknwFjHoFhXwFf38Fe4QFeYoF+wzZFWbuBYmbBY+bBZaYBZqUBZyNBZyHBZmBBZR9BbAnBY17BYd7BYB+BXyDBXmIBXqQBX2VBQ75SPfu+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj4Ko0VsmUFlX0FjnsFh3sFgX0FfYIFeYgFeo8FfZQFYrMFio0FiYwFY7sFiowFiowFYsMFiowFiowFY8oFio4FiY0FbcoFio4FiY4Fd8oFi44Fio0FgcMFi5IFi5IFlcMFjI0Fi44Fn8oFjY4FjI4FqcoFjY0FjI4Fs8oFjIwFjIwFtMMFjIwFjIwFs7sFjYwFjI0FtLMFmZQFnI8FnYgFmYIFlX0Fj3sFiHsFgX0FZGUFZV4FZFUFZE8Fb1AFeFEFg10Fk10FnlEFp1AFsk8FslUFDvlI95tWFYqJBWJjBX2CBXqHBXmOBX2UBYGZBYebBY6bBZWZBbKxBbG4BbLBBbLHBafGBZ7FBZO5BYO5BXjFBW/GBWTHBWTBBWW4BWSxBYGZBYibBY+bBZWZBZqUBZyOBZyHBZmCBbRjBYyJBY2KBbRbBYuKBY2KBbNTBYyKBYyKBbRMBYuIBY2JBapMBYuIBY2IBZ9MBYuIBYyJBZVTBYuEBYuEBYFTBYqJBYuIBXdMBYmIBYuIBWxMBYmJBYuIBWJMBYqKBYqKBWNTBYmKBYuKBWJbBQ75SPeU+FUV+zRWBXqIBXqPBX2VBYKZBYicBY+bBZaYBZqTBfc5wgUh9yQFhJoFi5sFkZsFmJYFm5IFnIsFm4UFmIAF8fsfBfH3HwWYlgWbkQWciwWchAWXgAWRewWLewWEfAUh+yQF9zlUBZqDBZZ+BY97BYh6BYJ9BX2BBXqHBXqOBfs0wAWL+yoFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFDvlI95T39hWL90sFjpwFlZgFmpUFnI4FnIgFmoEFlX4FjnoFi/tLBfdpiwWciAWaggWVfQWOewWIegWBfgV8ggV6hwX7aYsFi/tLBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3SwX7aYsFeo8FfJQFgZgFiJwFjpsFlZkFmpQFnI4FDvlI96puFcJVBZV9BY56BYd7BYF+BXyCBXqIBXqOBX2VBTXfBYeRBYaRBYuMBYqMBYqSBYmSBYyMBYqMBY2SBYyTBYyLBYuMBZCRBY+RBfc/9zwFmpUFnI4FnIgFmoMFlX0Fj3sFiHsFgX0FDvlI90L35RX3kosFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogF+5KLBXqOBXyUBYGZBYibBY6bBZWZBZqUBQ75SPf/7RX7D4sFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9w+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBQ75SKOAFfhx+WMFl5cFm5EFnYwFm4UFmIAFknwFjHoFhXwF/HH9YwV/fwV7hQV5igV7kQV+lgWEmgWKnAUO+Uj4CfkPFUOeBUN4BUZQBWMvBYH7JQWj+wwFxi0F2F0FyYsF2LkFxukFo/cMBYH3JQVj5wVq9x4VjYoFkYgFkYgFjIoFjYoF4EEFi4sFjIoFj4UFkIUFi4oFjIoFuSEFjIQFjYUFlvsyBYqGBYuGBXH7GQWIhQWJhAVH+wIFiYoFiokFhocFh4YFiYoFiooFKVEFh4kFiIkFhooFh4oFh4sFh4oFM4sFh4wFh4sFh4wFhowFiI0Fh40FKcUFiowFiYwFh5AFho8Fio0FiowFRvcCBYmSBYiRBXH3GQWLkAWKkAWW9zIFjZEFjJIFufUFjIwFi4wFkJEFj5EFjIwFjIsF39UFjYwFjIwFkY4FkY4FjYwFjYsF6aMFjowFjowFkYoFkYwFjooFjooF6XMFDvlI9/v5ZRWQjgWNjAWNjAWSiwWSjQWMigWNiwWSigWSiQWMigWNiwWRhwWQhwWMigWNigWOhQWPhQWMigWLiQWMhQWNhAWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/i2BTRFBXuDBXqJBXqPBX2WBYOZBYmbBY+bBZaYBfc19xUFDvlI90rmFffoiwWdiAWZggWVfQWOewWIewWBfQV9ggV5iAX8TosFg4wFg4wFiowFiosFhY8FhI8Fi4sFiowFhpEFh5EFi4wFiowFipIFiZIFi4wFi4wFjJIFjJIFjIwFi4wFj5EFj5EF9zn3PgX3L/dKBcTlBZezBYueBYOqBXeiBV6dBUaQBWaGBVBzBWttBX9mBYN9BX6ABXqGBXmNBXyTBYCYBYaaBYycBZu6BYuMBYyNBY+QBY6RBYyMBYyNBbi2BYuLBYuLBZOQBZKQBYuLBYuLBdWoBZCNBZGMBbqSBZCKBZCMBd2FBZKJBZKKBclxBYyKBY2LBZCHBZGHBYyKBY2JBaxlBYyKBYuKBY+FBY6EBYuKBYyKBZdeBYuFBYyGBYptBYqGBYuGBX1ZBYiFBYmGBUwpBYmJBYqJBfsy+04FiooFiooFDvlI9wqUFYeMBVObBXySBX+YBYabBY2bBZOaBZmVBZuQBZ2KBcB8BdeABeiJBb2WBdGxBbW2BZy5BYOvBWWzBUStBTSiBT2UBYiMBYiLBYWOBYaMBYmNBYiNBYePBYeOBYmOBYmNBYmQBYmQBYuOBYqOBYuQBYuRBYyNBYuOBY2QBY2QBY2NBY2OBY+PBY+PBY6MBY2NBZCNBZGNBY6LBY6MBduVBeKdBdGpBauoBZGqBXWtBV2uBUagBTyPBUp2BVZxBWhxBXyEBXmKBXuQBX2WBYOZBYqcBZCaBZeYBbCnBY+MBY6OBceoBY6MBY6NBdikBZOMBZSMBemGBZCKBZGKBd1yBZKIBZOHBcVeBZCGBZCGBa9UBY2EBY6FBYuKBYyKBYqEBYuDBYBQBYmHBYqHBYmIBYmHBYiIBYiHBVxfBYWGBYSHBUduBdFqBZGGBZKHBcBUBYyIBY6JBY2GBY6HBYuIBY2HBZZQBYuJBYyIBYqFBYuGBYqIBYuJBXNKBYuLBYuLBYeEBYaEBYuLBYuLBVZUBYWHBYaHBTlfBYWJBYWIBU19BYWLBYWKBSeNBYiMBYiLBTmWBQ75SPgF98IVi+oFj5sFlJgFmpUFnI4FnIgFmoEFlX4FjnsFiywF6YsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogFLYsFi/s9BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3PQX71IsFhIwFhYwFiYwFiYsFhY8FhY0Fio0FiYwFh5AFh5AFi40FiY0FipEFiZEFi40Fi40FjJEFjJEFjI0Fi40Fj5EFjpAF+Ab4PgWYlgWcjwWcigWbgwWWfgWQfAWKegWCfQX7yfv5BQ75SKn5QRWOmwWVmQWalAWcjwX4WIsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogF/CuLBYv7dwX3HakFk4sFk4wF9x57BZOIBZOJBcJuBZGGBZGHBbFiBYyJBYyKBY6FBY+FBYuKBYyJBaj7BAWLigWLigWLhAWMhAWKigWLiQV9UQWLiwWLigWHhAWIhAWLiwWKigVnXgWFhQWFhgVFYQWFiQWFiAU5dQWGigWGigU+hwWFjAWGiwVKlwWGjQWGjAVWogWGjgWFjwVUugWAmAWHmwWOmwWUmQWZlQWcjwWciQWaggW9YQW0eQXCgQXNjgXSngXFrgWlqwWUswVz5wVxpwVjoAX7DZkF+01iBYaLBYaKBYeMBYiKBYaNBYaMBYiNBYeMBYePBYeNBYmOBYiNBYmQBYiPBYuOBYmPBYuPBYqQBQ75SPch96QVi4sFi4sFbW4FioMFnlkFm24FtWEFtHIFzoEF2o8FxaMFsqoFnrMFjaoFf7MFeKwFcqQFZ5sFUJcFU44FU4MFU28F+yxcFYqPBYyRBYy5BYuLBYuLBY7cBY2RBYyRBafaBYyNBYuNBbTfBZCSBZCRBcC7BY6NBY2NBdC4BZGOBZCOBdykBYyLBYuLBeKlBZ2NBZuGBZmBBZN8BY17BYZ7BYB+BXyDBTRyBUFzBU9kBV5jBWdABXJEBYp7BZGOBZCPBdGtBZKNBZKOBc6UBZCLBY+LBcuJBY+KBY+LBc58BZCKBZCJBbt2BZKGBZKHBa5oBY6GBY+GBaNhBYyHBY2HBZpZBYyEBYyFBYlbBYuLBYuLBYmDBYmDBYuLBYuLBW9UBYuKBYqKBYaGBYeFBYqKBYqLBVhiBYaIBYaIBUNtBYOJBYOJBS+GBYeMBYaLBTmXBYqLBYqLBYSOBYOOBYuLBYqLBVasBYiPBYaNBVq8BYeQBYeQBXaxBYqOBYqOBXXHBYqSBYmTBQ75SPfP90gVg/saBYd7BYF+BXyCBXmJBXqPBX2VBYKZBYmbBZL3HAWMjQWLjQWc9wcFi4wFjI0Fms0FjI0Fi4wFnsYFjIwFi40FoL4FjIwFi40ForcFjIwFi40Fo7EFjIwFjI0FoqoFjI0FjIwFoqYFjYwF+96LBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfhfiwWQigWQigWOigWPigWPiAWQiQWOiQWNiQWOhwWPhwWMiAWNiAWMhgWNhgWLiAWMiAWJhgWLhgWKiAWKiAWIhwWJhgWIiQWJiAWHiAWHiAVqeQV9gQVkaAV3dAV2bgV1aAV2YgV4WwV5UwV8TAUO+Uj3pvf2FUR0BUpaBXBZBYleBaZdBcVnBdlzBciJBeCmBb6wBaLEBYLEBWK1BTi2BVKfBdH3sxU4kQVLgAVXcwVrXQWVaQW4ZQW/bAXDeAWwlgXetQWdpgWMwwV1rwVr9wEVi4sFk4gFk4kFi4sFjIsF0GgFjokFj4kFjocFj4gFjYgFjYgFrVIFjIkFjYgFjIYFjYYFiogFjIgFiTwFi4gFi4kFiYUFioYFiYkFiogFbVwFiYkFiYgFh4gFh4cFiIoFiYkFUm4F0mYFkIcFkYcFw1IFjYcFj4gFjIcFjYgFjIYFjIcFmDoFi4kFi4kFioUFi4UFiokFiokFbDwFiYcFiogFh4cFiYgFiIgFiIkFR1sFhYgFhYcFJ2sFg4oFg4oFP40FhY0FhIsFMqcFho4FhY0FQ7gFio0FiYwFho8Fh5AFio0FiYwFZc0Fio4Fio4FipAFiZAFjI4Fio4Fjs0Fi4wFi4sFjZMFjZIFi4wFi4sFr80Fi4wFjIwFkJAFkJEFi4wFjIsF2sYFkY4Fko8FmI8FaZ8FiI4Fh40FUrwFiY0FiI4FiY8FiI8Fio4FiY4FeMsFi40Fi4wFipIFi5IFi4wFi4wFjpIFjZIFjIsFjI0Fu9IFjo4FjY4Fj44Fj44Fjo0Fjo0F0KsFkYwFkY0F15gFkIsFkYwF7YQFDvlI+Fr4mBWVnQV8xwVwqwVfoAVIkwVHgwVTdAVnagV+XwWYYAWvaQXDdAXMhAXMmgW8qgVf/BoVi4oFZ0IFgX4FfIIFeYgFeo8FfZUFgpkFiJsFj5sFr9QFtuoFwPcXBYuLBYuMBZKcBT55BYOKBYKLBTuUBYWNBYWMBUWoBYSPBYSQBVm6BYqNBYmMBYiQBYeQBYuOBYqNBXfNBYqOBYqOBYyQBYqQBYyOBYyPBZ/NBYyNBYuNBY+QBY6QBY2NBYyNBb26BZKPBZKQBdGnBZGMBZGNBduVBZGKBZGMBduBBZKJBZKJBcdvBYyKBYyLBZGGBZGHBYuKBYyKBbNcBYyKBYyKBY6FBY6FBYuJBYyKBZ83BYuFBYyEBYqJBYuJBYmFBYmGBYqHBUH7SAVW+xgFi4oFiooFXysFDvlI9y/3yxX4OvtDBZqBBZR9BY57BYd7BYF9BXyCBXqJBXqOBfyY92oFhI8FhY8FiowFiowFh5EFh5EFi4wFiosFipMFiZIFi4wFi4wFjZIFjJIFjIwFi4wFj5EFj5EFjIwFjIsFkY8Fko8F+Jj3agWcjwWciAWaggWVfgWPewWIegWCfQV8ggUO+Ui2+GkV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAWc+4gV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj44/fpFYyKBY+FBY+FBYuKBYyKBYyEBY2EBYuKBYuKBYmEBYqDBYqLBYuKBYeFBYeFBYqKBYqKBYWHBYSHBfyY+2oFeogFeo0FfJQFgZkFh5sFjpsFlJkFmpUF+Dv3QwX8O/dDBXyUBYKZBYicBY+bBZWYBZqUBZyOBZyHBfiY+2oFkocFkYcFDvlI+Ev3kxWGigX7q4sFi4sFLPtyBYF9BX2CBXqIBXmOBX2UBYGYBYecBY6bBfek+REFkJIFkJIFi4sFi4sFko8FkpAFi4sFjIsFk40Fk40FjIsFi4sFk4kFlIoFi4sFi4sFkoYFkocFjIsFi4sFkIQFj4QF97r9EQWPewWIegWBfgV9gQV6iAV5jgV9lAWBmAX7IvfIFfsB94AFJvuABQ75SPe++GUV2bYFlMsFTL8F+weeBSmGBYv7VgX32vxEFYSJBYmLBYmLBfv7hwWKiwWLiwWDjAWCjQWLiwWLiwWEjwWEkAWKiwWLiwWGkgWHkQWLjAWKiwWKkwWJkgWLjAWLiwWL+QoFjJIFjZIFi4wFi4wFkJEFjpEFjIwFjIwFkY8FkY8FjYsFjIwFkowFk40F9yWTBZCKBZCLBfcZdQWOigWPigWQiQWQiQWNiQWOiQXlQQWNiAWPiQWNhwWOhwWMhwWNiAWLhgWMhwWLhwWLhwV9+wAFiokFi4gFiIYFiYYFiYkFiogFh4cFh4cFiIoFiYkFSGYF9wJmBY6JBY+KBY+IBY+JBY2IBY6IBdE3BY6GBY6FBYyJBYuKBYyEBYyEBYX7AAWLiQWLiQWJhQWJhQWKiQWKiQVsWwWIiQWKiAWHiAWHhwWIigWIiQU+ZAWJigWJigVu3BXEqAWeqAWP3QVYyQX7JLsF+1CWBYv7nAUO+Uj4ZPclFaDbBZOZBZiXBZuQBZ2KBZuEBZd/BZF7BYp7BXIwBYqIBYqHBYiHBYmHBYiIBYmIBUNLBYiJBYmJBYaJBYaIBYiLBYiJBSl1BYuLBYuLBYOLBYKLBYuLBYuLBfsEnAWJiwWKjAWEjQWEjgWKjAWKiwVRsQWFkQWFkQVU3QWLiwWLiwWIkwWIkgWLiwWLiwVm918Fi5MFi5MFuvdeBYyMBYuNBY+RBY2RBY2MBYyNBc7XBYyMBYuLBZGQBZKQBYuLBYuLBdGsBZKNBZKOBdqVBYyLBYyLBZOKBZKLBYyKBY2LBfVqBYyLBYyLBZKHBZGHBYyLBYyKBcNZBYyLBYuKBZCFBY+FBYyKBYuLBapEBY57BYh7BYF9BXyCBXqIBXqOBXyVBYGYBXDJBWKwBTSlBU6EBVVxBVRNBWD7TAWt+04FuUgFtG8F6H0F2JwFDvlI93uVFYaKBfs1iAWLiwWKiwWDjAWDjQWKiwWLiwWEjwWEjwWLjAWKiwWHkgWGkQWLjAWLiwWJkwWJkgWMjAWKiwWT+QQFjJAFi5EFjY0Fi48Fj48FjY8FjY4FjY0FkI4Fj44Fjo0FjowFkIwFkY0F7pgFj4sFjowF14kFkYoFkIsF9xBrBYuLBYuLBZOHBZKIBYyLBYuKBeZIBYyKBYuLBZCFBZGFBYuLBYuKBb8wBY2FBY6GBaAsBYuHBYyHBY1EBYqHBYuIBYJOBYmHBYqHBXhXBYeFBYmGBUw8BYWGBYWGBTdZBYWJBYWIBfsdaAV53hX3EasF0rUFwM4Fm7UFlMAFicsFeOAFXtoFPsQF+wGnBUiMBVGDBYX8tAUO+Uj3EeUV+CGLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfxOiwV6jgV8lAWCmQWHmwWL99MFi/fSBY+bBZSZBZqUBZyPBfhOiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX8IYsFi/t+BfeciwWdiAWZggWVfQWOewWIegWBfgV9ggV5hwX7nIsFDvlI9xf32hWL+6oFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBYyKBfgviwWciAWZggWVfQWPewWHewWBfQV9ggV6iAX8FYsFi/t4BffQiwWdiAWZggWVfQWOewWIewWBfQV9ggV5hwUO+Uj4fve0Ffs1iwV6jwV9lAWBmQWImwWOmwWVmQWZlAWdjgX3bIsFj4oFkIsFj4kFj4oFj4kFj4kFjogFj4kFjYgFjocFjYgFjYcFjIcFjYcFi4cFjIcFiocFi4cFXvtaBYqJBYuIBYiGBYiGBYmJBYqJBUtGBYmKBYqJBYWIBYaHBYmKBYmKBTpwBYqLBYuKBYOKBYOKBYqLBYqLBTWSBYSNBYSNBTmuBYWOBYaOBUfCBYaQBYaQBV/QBYuMBYqMBYmRBYiSBYuMBYuMBXf3UgWLkQWLkgWx90IFjIwFi40FjpEFjpEFjIwFjI0FzdsFjIwFi4wFkZAFkY8FjIwFjIsF37QFi4sFi4sFk40Fk44Fi4sFi4sF9xeVBZKKBZGLBfcQcQWbhQWXfwWRfAWLegWEfAV+gAV7hQV5iwX7CKMF+weCBUhrBVZJBWj7MwWe+0IFrlUFxFwF0W4Fz4UFx6AFvL8FDvlI+H74OhWL95sFj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3tgX8DosFi/u2BYd7BYJ9BXyCBXqIBXqOBXyUBYGZBYibBYv34AWL98UFjpsFlZkFmpQFnI8FnIcFmoIFlH0Fj3sFi/ubBQ75SPfu+UEVi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5EQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Ui/9z4Vio4Fia8FjpsFlJkFmZUFnY4FnIkFmoIFlX4Fj3sFjGsFkXIFlXYFmXkFnX0FunoFzoQFu5EFwp8FoJkFnJ0Fl6EFk70FivhxBY6bBZWZBZqUBZyPBZyHBZqCBZR+BY96BYz8dAWKiAWLiAWCTgWJhQWJhAV5awWHhgWIhwVycQWHiAWIiAVtdwWGiQWGiAVKcwWGigWFigVRhAWGiwWGiwU8kwWFjAWFjAVRoQWFjwWFjQVvoQWHjwWHjgV2pQWJkAWIjwV+qAWKkAWJjwWEqwUO+Uj3Uff3FfsBOQWL+3UFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBZmCBZV9BY57BYv7xAX4Hve7BZuSBZyNBZyGBZiABZR8BYx7BYZ7BX9/Bfui+14F9+b70AWVfQWPewWHewWCfQV8ggV6iAV6jgV8lAUO+Uj3DOUV+CuLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfxYiwV6jgV9lAWBmQWHmwWL+REFj5sFlZkFmZQFnI8FnYcFmYIFlX0FjnsFDvlI+KH5WxWOjwWNjQWNjQWRjQWPjgWOjAWOjAWRjAWRjAWOigWOiwWQiQWRigWNigWOigWQhwWPiAWNiQWNiQWOhgWOhgWMiQWMiAWLhgWNhQWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h1BftD+6wFiYkFiokFhocFh4cFiYkFiYoFhYkFhYgFiYsFiIoFhYwFhYoFiIwFiYsFhY4FhY0FiYwFiY0Fh48Fho8Fio0FiY0F+0P3rAWL/HUFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY2RBYuQBYyOBYyNBY6QBY6QBY2NBY2NBY+OBZCPBY6MBY2MBZGMBZCNBY6LBY6MBZGKBZGKBY6KBY6KBY+IBZGJBY2JBY2JBY6HBY+HBfdw+/UF93D39QUO+Uj4e/dPFYT4hgWOmwWVmQWZlAWcjwWdiAWZggWVfQWPewWU/REFioYFi4cFiocFiocFiYgFiYcFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4oFhosFh4oFhosFh4sFh40Fh4wFh40Fh4wFiI4Fh44FiI4FiI4F/BT4oQWL/IkFh3sFgn0FfIIFeogFeo4FfJQFgZkFiJsFi/kRBYyPBYuPBYyPBYyPBY6PBYyOBY6OBY6PBY6NBY6OBZCNBY+NBY+MBY6NBZCLBZCMBY+KBY+LBY+JBZCKBY+JBY6KBY+IBY+IBY2IBY6IBQ75SPgblBWFiAWJiwWJiwUzgAWKiwWKigWEjAWDjAWKiwWKiwUypQWJjAWIjAWGjgWGjgWJjQWJjAU62gWJjgWIjgWJjwWIjwWLjwWJjgVP96AFi40Fi4wFi5IFi5IFjIwFi40FxPddBY2PBYyPBY6OBY2PBY6NBY6PBdHEBYyMBYyMBZKOBZGOBY2LBYyMBfcOqQWPiwWPjAWQigWPjAWPiQWPiwX3B2cFjIoFjYsFkYcFkYgFjIoFjYkFzkoFjYgFjYkFjocFjYYFjIgFjIgFxfuJBYuDBYuDBW/7LgWIhAWJhQVYMgWKiQWLigWGhgWGhgWKigWKigUwTgWJigWKigUg0BXOkwXUvAW11gWl9x8FVvd1BVm8BTCoBShzBVdgBVj7RgXD+4sFy00FDvlI93j3xxWJigX7AooFi/uVBYd7BYF9BX2CBXqIBXmOBX2UBYGZBYibBYv5BQWMkQWMkgWMjAWLjQWPkQWOkAWNjAWMjQWQjwWRjwWNiwWMjAWSjQWRjAX3HZcFjosFj4sF9w6EBY+KBZCLBdp2BY+KBY+KBa96BZCIBZCIBcRbBYuKBYuLBZCFBZCEBYuLBYyLBaRXBY2EBY2EBZA/BYuJBYuJBYqFBYqFBYqJBYuJBXRcBYqJBYqJBYeHBYeFBYmKBYqKBWhxBYWIBYWIBVN2BYeKBYeJBTp8BYiLBYmLBfsCggWF4BX1kwXWmQW5nAWgmwWZpwWGxAV6sAVesQVxlwVEnQX7BpIFL4MFi/uJBQ75SPiTtRXQOQWTfAWNewWFewWAfwV7gwV6igV6kAV+lQVRzwVUYAWIigWJiQWGiQWGiAWHiwWIigU1fgWJjAWJigWEjAWFiwWJjAWIiwU0qQWJjAWIjAWGjgWGjgWJjgWJjAU75AWKjgWJjQWJkAWIkAWLjgWKjQVQ98MFi4sFi4sFi5MFi5MFi4sFi4wFw/d2BY2OBYyPBY2PBY6PBY2OBY2OBdDLBY2MBYyNBZGOBZGOBY2MBY2MBfcLrAWRjAWRjAWNigWOjAWRiQWRigX3BGMFjYoFjooFj4cFkYgFjIkFjYoFzUEFjIkFjYkFjYYFjoYFjIgFjIkFw/uoBYuEBYuEBW/7QgWJhQWJhQX7K0AVMfUFg5oFipsFkJsFlpcFm5MFnIwFnIYFmIEF0zcFmqkFpfc1BVb3lgVZxAU0qgUucQVXWgVY+2IFwvuvBctDBcx2BcmUBQ75SPfz+EoV3JcFrpgFoJsFlqIFjLMFfbkFgZYFd5gFcZUFQZsF+xSQBfsofgWL+10F90g8FftIhQWL+7cFh3oFgn4FfIEFeogFeo4FfJUFgZgFiJwFi/j8BYyRBYyRBYyNBYuNBY+QBY6RBY2MBYyNBZGOBZCPBY2MBY2MBZGMBZKNBfdUmwWOiwWOjAX3G4UFj4oFj4sF3HoFj4kFj4sFrX0Fj4kFj4kFp3kFj4cFkIgFoHQFi4oFjIsFjoQFj4UFi4oFjIoFnU0FjIUFjIUFiVQFi4sFiYMFiYMFi4sFeWQFiooFi4oFhoUFhoUFiosFi4oFaXAFhIgFhYcFXXoFhooFhokFNX8F94H7rQWTfQWNegWGewV/fwV8gwV5igV6kAV+lgX7nPfLBYOaBQ75SOXBFYaOBYqNBYiNBYmQBYeQBVr3AQWHnAWOmwWVmQWZlAWcjgWdiAWZggWVfgW3KgXNaQX3IIcF7bgFq/AFdsUFS68F+4ezBYiNBYiLBYaNBYaNBYmOBYiMBUu+BYiPBYiOBYmOBYiOBYqQBYmOBXrHBYuPBYqOBYuQBYuPBYyPBYyPBbT3DAWOkAWNkAWNjQWMjQWQjwWPjwXvzAWRjgWQjgWOiwWNjAWRiwWRjAX3R4IFjYoFjIwFkogFkooFjIoFjYoFkIcFkYcFjIoFjIoF1zAFknwFjXoFhXwFgH4Fe4QFeYoFe5AFfpYFTNYF+yOTBUBaBWssBZVoBbZoBfeDYwWTiQWTiAXfWgWQhwWQhwWNiQWMigWOhQWOhgWrNgWLhgWNhwWLhwWLiAWKhgWKhgVi+xgFi4oFiooFh4UFiIQFiosFiooFhYYFhYcFiosFiooF+xJRBYmLBYqKBYSKBYSJBYmLBYmLBfs2jwWJjAWJiwWFjQWEjAWJjAWJjAUzuQUO+Uj3yflsFfeiiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX7dYsFi/znBYh7BYF9BX2CBXmIBXqOBXyUBYKZBYebBYv45wX7hYsFeo4FfJQFgZkFiJsFjpsFlZkFmpQFnI8FDvlI+HT3hxWQ+E4Fj5sFlZkFmZQFnY4FnIcFmYIFlX0FjnsFhvxQBYqIBYyJBYFHBYqHBYqGBXdYBYmIBYmHBX53BYiHBYiIBW1sBYWHBYaHBVhxBYSJBYSJBU2BBYWLBYSLBTOUBYaNBYWMBUWlBYWPBYWOBVyvBYeQBYWQBWjCBYiRBYiRBXnSBYqPBYqOBYTsBYuNBYuMBYr39wWOmwWVmQWalAWcjwWchwWaggWVfgWOegWM+/UFki8Fm00Fp2EFr28FxXYF14IFu5MFsJ4FoqIFk5cFnLYFDvlI99H3NRX3a/ivBZSZBZqVBZyPBZyIBZqCBZV+BY97BYh6BfuS/REFi4sFi4oFhoUFh4QFi4sFiooFhIcFhYYFiosFi4sFg4kFg4oFiosFi4sFg4wFgowFi4wFiosFhI8FhI8Fi4sFi4wFhpEFhpEFi4wFi4sF+7j5EgWHmwWOmwWVmQWZlAWcjwWciAWaggWVfQUO+Uj4dvdYFdf4gwWQmwWXlwWbkgWcjAWchgWYgAWTfAWMegUq/REFiYcFioYFiYgFiocFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4kFh4sFhooFh4sFh4sFho0Fh4sFh40Fh40FiI4Fh40FiI4FiI4FiY8FiI4F+0b3/wX7Ofv2BYiHBYiGBYmJBYmJBYaIBYeHBYiKBYiKBYaKBYWJBYiLBYiLBYWMBYaLBYiNBYiLBYaOBYaOBYmNBYiNBYiPBYiPBYqOBYmOBYqQBYmQBTv5CQWNnAWTmQWYlgWckAWcigWbhAWWfgWRewXH/G8F9x/3vgWPkAWPkQWMjAWMjAWRjwWRjwWNiwWMjAWSjAWSjQWNiwWMiwWSiQWTigWMiwWMigWRhwWSiAWMigWMigWPhQWPhQUO+Uj3/Pf/FfeZ+7QFlH0FjXsFhnsFgH4FfIMFeYkFeo8FfpYF+5D3qQX7kPupBX6ABXqHBXmNBXyTBYCYBYabBY2bBZSZBfeZ97QF+5/3uwWCmQWJnAWQmwWWlwWalAWdjAWchwWYgQX3lvuxBfeW97EFmZUFm48FnYoFmoIFln8FkHsFiXoFgn0FDvlI9+j4EhWV++EFiHsFgn0FfYEFeogFeY0FfJQFgZkFh5sFgffjBfud96cFgpkFiJsFj5sFlpkFmpMFnI4FnIcFmYEF94n7kQX3k/eQBZqVBZyPBZyIBZqCBZV+BY96BYh7BYJ9BQ75SPci5RX4KosFnYgFmYIFlX0FjnsFiHsFgX0FfYIFeYgF/IKLBYWMBYaLBYiMBYeMBYeOBYaNBYmNBYiNBYiPBYePBYqOBYmOBYqQBYmPBYuPBYuOBYyQBYuQBYyOBYyOBY6PBY2QBfhP+M4F/CqLBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfiCiwWRigWQigWOigWPigWPiQWQiAWNiQWOiQWOhwWPhwWMiAWNiAWMhwWNhgWLiAWLhwWKhgWLhgWKiAWKiAWIhwWJhgUO+Uj3h3QV9zaLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqHBftjiwV5jwV9lAWBmQWImwWL+Z8FjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfs2iwUO+Ujw+VgV+HH9YwWRfAWKegWEfAV+gAV7hQV5jAV7kQV/lwX8cfljBYWaBYycBZKaBZiWBZuRBZ2KBZuFBQ75SPhWShWHewWBfQV9ggV6hwX7Y4sFeY8FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9zaLBYv5SwX7NosFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BQ75SPeo+WQVko8FjIsFjIwFkowFk40FjIoFjIwFk4kFkooFjIoFjIsFkocFkYcF9577ggWVfgWPewWIegWBfQV9ggV6hwV6jgV8lAX7f/dmBft/+2YFfIIFeogFeo8FfZQFgZkFiJwFj5sFlZgF9573ggUO+UiL+wEV+O6LBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfzuiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj4POoVxcIFi/eQBVLBBVCnBS+LBVBvBUxQBWsvBYtQBaswBcpPBcdvBeaLBfcIZhWHiAWFhwVAZwWKigWJigWEigWFiQWJjAWJigX7BYsFiYwFiYoFhI0FhYwFiYwFiYwFQK8FhY8FhY8FP9MFiowFiowFiJEFh5EFiowFiowFZvYFipIFipIFi9IFjJIFjJEFsPcABYyNBYyMBY+RBY6RBYyMBYyMBdfTBZGPBZGPBdeuBYyMBY2MBZKMBZKNBYyKBY2MBfcFiwWMigWNjAWSiQWSigWMigWNigXWaAWQhwWQiAWLjwWPnAWUmAWalQWcjgWciAWagQWVfgWOegWL/IoFiHsFgX4FfIEFeogFeo4FfJUFgpgFh5sFDvlI9xOvFYaOBYuKBYd6BYF+BX2CBXqHBXmPBX2UBYGYBYicBYv5OAWOmwWVmQWZlAWdjgWciAWZggWVfQWPewWL+3YFkI4FkY8F1asFjIsFjIsFko0Fk40FjIoFjIwF9wSLBYyLBYuLBZOJBZOJBYyLBYuLBddrBZCHBZKIBdZKBYyKBY2KBY6FBY+GBYyJBYyKBbApBYyEBYyEBYtLBYqEBYqDBWYrBYqKBYqJBYeGBYiFBYmKBYqJBUBLBYWIBYWHBUBqBYqLBYqLBYSJBYOJBYqLBYqLBfsEiwWKjAWKigWDjQWEjQWKiwWKiwVBrAWA9w0VwlwFxnEF54sFx6UFycAFqdoFi70FbdsFTcAFT6QFL4sFUHIFVFwFDvlI+DLqFczNBZqVBZyPBZyIBZqDBZV9BY97BYl7BYF9BUVDBYWHBYWHBUZmBYiLBYmJBYWKBYWJBYiMBYmKBSGLBYmMBYiKBYWNBYWMBYmNBYmLBUSwBYWPBYWPBUXTBYqMBYqMBYeRBYeRBYuMBYqMBWn2BYqRBYqSBYvSBYyRBYySBa33AAWMjAWLjAWPkQWPkQWMjAWMjAXR0wWRjwWRjwXSrwWNiwWNjQWRjAWSjQWNigWNjAX1iwWNigWNjAWSiQWRigWNiQWNiwXRZwWRhwWRhwXRQwWVfQWNewWHewWBfQV8gwV6iAV6jwV8lQVKzQVWpgU3iwVVcAVRUAVtLgWLUAWoLwXGUAXCbwXdiwUO+Uj4PfUVwroFi/dxBVS6BVCkBS+LBU9yBU1WBW07BYtZBak8BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKiwWEiQWDiQWKjAWKigX7BIsFiosFiosFhI0Fg40FiosFiosFQKwFhY8Fho4FP8sFio0FiYwFiJEFh5AFio0FiowFZusFipMFipIFi8sFjJIFjJIFsO0FjIwFjI0Fj5AFjpEFjYwFjIwF18wFkY4FkI8F16sFi4sFjIsFk40Fk40Fi4sFjIsF9wSLBYyKBYyMBZOJBZKJBYyLBYyLBdVrBZGHBZCIBYv3dgWPmwWVmQWZlAWcjgWdiAWZggWVfQWOewWL/TgFiHoFgX4FfYIFeYcFeo8FfZQFgZgFh5wFDvlI9x74IBV8YQX4GIsFg5QFZs0FbaYFS6cFJosFSm8F93r7/BXXzgWZlAWdjgWchwWZggWVfQWNegWIewWAfgU6QwWGiAWFhwU8ZgWJiwWKigWEigWEiQWJiwWKiwX7DYsFiosFiosFg40FhIwFiowFiosFOrAFhY8FhY4FO9MFiYwFiowFh5EFh5AFi40Fio0FY/YFipIFipIFi9IFjJIFjJIFs/cABYyNBYuNBY+QBY+QBYyNBY2MBdvTBZKOBZCPBdyvBYyLBYyMBZOMBZKNBYyLBYyLBfcNiwWMiwWMiwWTiQWSigWMigWMiwXbZwWQhwWRiAW1ZwWPhQWQhQWyRAWQewWJegWDfQV/ggWUhQWVfgWOegWIewWBfQV9ggV5iAX8SYsFi3UFrDAFz08FzG4F8IsFDvlI97n4VhWL/CQFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/gkBfsGiwV6jgV8lQWCmAWHmwWPnAWUmAWalQWcjgX3BosFi8AFi40Fi40FjZEFjJEFjY0Fi4wFwOoFkZEFkJEFi4sFi4wFk44Fko8F9asFkowFkowF9YsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFKIsFOXIFZEUFi2EF9zuLBZyIBZqBBZV+BY56BYh7BYF+BXyBBXqIBQ75SPg99yMVwroFi/dxBVS7BVCkBS+LBU9yBU1WBW06BYtaBak7BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKigWEigWDiQWKiwWKiwX7BIsFiosFiosFg40FhIwFiowFiosFQKwFhY8FhY4FQMwFiowFiYwFiJEFh5AFio0FiowFZuwFipIFipIFi8wFjJIFjJIFsOwFjI0FjI0Fj5AFjpAFjY0FjIwF1swFko4FkI8F16sFi4sFjIwFk4wFk40Fi4sFjIsF9wSLBYyLBYyLBZOJBZKKBYyKBYyLBdVrBZGHBZCIBYuLBY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYv8mAWKhAWKhAVmKgWKigWKiQWHhgWIhQWJigWKiQVlawWFhwWFhwVBbAWKigWKiwWEiQWDigWKiwWKiwX7BIsFiosFi4sFg4wFg40FiosFi4sFP6sFho8FhI8FQMsFio0FiYwFiJAFh5AFio0Fio0FZuwFiZwFj5sFlZgFm5QFnI0FnIcFmYEFlH0FrDQFyVYFx3EF54sFxqUFpKAFqdoFDvlI+L34CRWNhAWL+9AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/fIBW7TBVqfBSyLBU1yBS49BYv7vQWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+SwFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/uSBbKsBZGOBZGPBdeqBYyLBYuMBZOMBZONBYyLBYuLBfcGiwWMiwWLiwWTiQWTigWMigWLiwXXbAWLiwWLiwWShgWShwWLigWMiwWPhAWQhQWLigWLiwWxLAUO+Uj3mfmIFduLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBTuLBXqOBXyUBYGZBYibBY6bBZWZBZqUBfH7mRWL/E4FiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/hOBY6cBZWYBZqVBZyOBZyIBZqBBZV+BQ75SPgV+YgVyYsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFTYsFeo4FfJQFgpkFh5sFj5sFlJkFmpQF+wn+MhWGigWIjQWHiwUpqQV8kwWAmAWGmwWNmwWUmQWZlgWbjwWdiQXhcQXpoQWhyQWL+I4Fj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/yVBYqEBYqFBWswBYiGBYmHBYmIBYmIBYeIBYeIBYiJBYiJBYaKBYaJBfsXbQWIiwWHigUO+Uj3f/eMFfsRLwWLIQWIewWBfQV8ggV6iAV6jgV8lAWCmQWHmwWL+SwFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/xXBff495sFm5IFnIwFnIYFmIEFk3wFjHoFhnwFgH4F+2v7MgX3mPtwBZV+BZB7BYh7BYJ9BX2BBXqHBXqNBXyTBQ75SPfu+WMVi/0xBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5MQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj43/iYFZCGBYuKBYyJBYyFBY2EBYuKBYyJBYv8WwWHewWBfQV9ggV6iAV5jgV9lAWBmQWImwWL+EgFfJYFXIsFdHgFVDEFi/vmBYh7BYF9BX2CBXmIBXqOBX2UBYGZBYebBYv36gVo4wV1nAVdiwVzeAVVMQWL++YFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h9BY6cBZWYBZmVBZ2OBZyIBZmBBZV+BY2ABa2mBZGOBZGPBY2LBYyMBZKLBZKNBduLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyJBY2KBY+GBY+GBYuJBY2JBZN1BZynBZCQBZCRBbWtBZGPBZGPBY2LBYyMBZKLBZKNBdyLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyKBYyKBQ75SPi++B0VjIUFi/vyBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv36wVt3QVaoQUtiwVPcAUsMwWL++AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/h9BY6cBZWYBZqVBZyOBZyIBZqBBZV+BY56BYtlBbCtBZKPBZCPBdiuBYyLBYyMBZKMBZONBYyLBYyLBfcGiwWMiwWNiwWSiQWSigWMigWNiwXWaAWMiwWLiwWShgWRhgWMiwWLiwWPhAWPhAWLiwWLiwWyIQUO+Uj37Ph4FTWLBVRwBU9PBWwvBYtQBaowBcdPBcNvBeCLBcKnBcfHBarmBYvGBWznBU/HBWH3AxWNjAWRiQWSigWNiQWNiwXTaAWRhgWRhwXTQwWLigWMiwWPhAWPhQWLigWMigWv+wAFjIUFjIQFi0QFioQFioUFZyAFiooFi4oFh4QFh4UFiosFi4oFQ0MFhYcFhYcFQ2YFiYsFiYkFhYoFhIkFiYwFiYoF+wCLBYmMBYmKBYSNBYWMBYmNBYmLBUOwBYWPBYWPBUPTBYuMBYqLBYeRBYeSBYuMBYqMBWf2BYqRBYqSBYvSBYySBYyRBa/3AAWMjAWLjAWPkQWPkgWMiwWLjAXT0wWSjwWQkAXTrgWNiwWNjQWSjAWRjQWNigWNjAX3AIsFDvlI9xTXFYWPBYv7dQWHewWCfQV8ggV6iAV6jgV8lAWBmQWImwWL+TMFjpwFlZgFmpUFnI4FnIgFmoEFlH4Fj3oFi4sFkY8FkI4F1asFjIsFjIwFk4wFko0FjIsFjIsF9wSLBYyLBYuLBZOJBZOKBYyKBYuLBdZsBZGHBZGHBdZLBY2KBYyJBY+GBY+GBYuJBY2JBa8rBY2EBYyDBYtLBYqEBYmEBWYsBYqJBYuJBYeGBYeFBYqKBYmKBUBLBYWHBYaIBUBqBYqLBYqKBYOKBYSJBYqLBYqLBfsEiwWKiwWKiwWDjQWEjAWKjAWKiwVBrAWA9w0VwlwFxnEF54sFx6UFyb8FqdoFi7wFbdsFTb8FT6QFL4sFUHIFVFwFDvlI+D33JRXCugWL924FVLoFUKQFL4sFT3IFTVcFbTsFi1oFqTwFyVcFx3EF54sF9wZiFYaIBYWHBUFqBYqLBYqLBYSJBYOJBYqMBYqKBfsEiwWKjAWKigWEjQWDjQWKiwWKiwVArAWGjgWFjwVAywWJjAWKjQWHkAWHkAWLjQWKjQVm6gWJkgWKkwWLywWMkgWNkgWw6wWMjQWLjQWPkAWPkQWMjAWNjAXWywWRjwWRjwXWqgWLiwWMjAWTjAWTjQWLiwWMiwX3BIsFjIsFjIsFkokFk4oFjIoFjIsF1WwFkIcFkYgFi4sFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/00BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBQ75SPfp+MsVk40F9yaLBZyIBZmBBZV+BY96BYd7BYF+BX2BBXqIBfsdiwU4bgU5TwViNAWL+6MFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/h9BY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYtWBdTABZGNBZGPBeutBQ75SO6nFYSQBYuLBYuMBYeSBYeSBXLSBYmcBY+bBZaYBZuTBZyNBZyGBZmBBZN9BZ9TBbt0BfWLBeSsBbuhBYuoBVHCBfsBygX7BIsFiYsFiosFhI0FhIwFiowFiYwFQK8FhY8Fho8FiowFiYwFiJEFh5EFi4wFio0FipEFipIFi9IFjJMFjZMFi4sFi4wFkJEFj5IF1tMFjIsFjIwFkY8Fko8FjIsFi4wF764Fk4wFk40F9xGLBYyKBY2MBZKJBZKKBYyKBY2KBdZoBZmBBZN8BY17BYd7BYB+BXyDBXmJBXqPBUqqBSGLBTluBVRWBYtuBbN4BfcGiwWOigWPiwWQiQWQigWOigWPiQX3EEQFj4cFkIgF1kQFj4QFkIQFi4sFi4sFjYMFjIMFi0MFioUFioQFiooFi4kFh4UFiIYFiYoFiokFhYgFhoYFQGgFiYsFiYkFJ2cFg4oFg4kF+xGLBYmMBYmKBYWNBYSMBYmMBYqMBUCvBQ75SPdd+DEV+wyLBXqOBXyUBYGZBYibBY6bBZWZBZqUBZyOBfcMiwWL9zcFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/s3BfdDiwWciAWaggWVfQWOewWIewWBfQV8ggV6iAX7Q4sFi/uCBbNMBeF0BfOLBZyHBZqCBZV9BY57BYh7BYF9BXyCBXqIBfsCiwWFjAWFjAX7AqgFg48FhI4Fi4sFiowFhpEFhZAFVOIFio4FiY4FipAFiZAFjI4Fio4FDvlI+GX3SRWL9+AFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/x9BYh6BYF+BXyBBXqIBXqOBXyVBYGYBYicBYuyBWZpBYWHBYWHBT9oBYmKBYqKBYSKBYSJBYmMBYqKBfsGiwWJjAWKigWEjQWEjAWJjAWKjAU/rgWEkAWEkAWLiwWLiwWHkgWHkgVk9AWKkgWKkQWL9/IFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/vrBak6Bb10BeeLBcinBQ75SPfB9xcV92j4JgWWmAWakwWcjQWchwWZgQWUfQWNegWHewX7kfxyBYiHBYiGBYiJBYqJBYaIBYaIBYiKBYiKBYaKBYWKBYiLBYiLBYWMBYaMBYiMBYiMBYaOBYaOBYqNBYiNBYiQBYiPBfuQ+HIFhpsFjZwFlJkFmZUFnI8FnIkFmoMFln4FDvlI+Fj3TRX29+kFk5oFmZUFm5AFnYoFmoMFl34FkHsFiXsF+yr8cgWIhwWKhwWIiAWKhwWHiQWIhwWHiQWIiQWGiQWHiQWHiwWHigWHiwWGiwWHjAWHiwWHjQWGjQWIjQWHjQWIjwWIjQWJjwWIjgWKjwWIjwUg9+kFIPvpBYiHBYqHBYiIBYmHBYiJBYiHBYeJBYiJBYaJBYeJBYeLBYeKBYeLBYaLBYeMBYeLBYeNBYaNBYiNBYeNBYiPBYiNBYmPBYiOBYqPBYiPBfsq+HIFiZsFkJsFl5gFmpMFnYwFm4YFmYEFk3wF9wD76QX29+kFjY8FjI8Fjo4FjY8Fj44Fjo4Fjo0Fj40Fj40Fj40Fj4sFj4wFkIsFkIsFj4oFj4sFj4kFkIkFjokFjokFjogFj4gFjYcFjogFjIcFjYcFDvlI+AL3pxX3evtlBZV+BY97BYh7BYF9BX2BBXqIBXmOBX2UBft992YF+337ZgV9ggV5iAV6jgV9lQWBmQWImwWPmwWVmAX3evdlBft692UFgZgFh5sFjpwFlZgFmZUFnI4FnYgFmYMF9337ZwX3ffdnBZmTBZ2OBZyIBZmBBZV+BY56BYd7BYF+BQ75SOj7TxWDigWLiwWLiwVjiwV6jgV8lAWBmQWImwWOmwWVmQWalAWcjgWqiwXLpQXOwQXJ7gX7dfg4BYebBY2bBZSaBZiVBZyPBZ2JBZqDBZZ+BfdX/AEF91n4AQWWmAWakwWdjQWbhwWZgQWUfAWNewWGewX7gfxMBYuKBYqJBT37EQWGhQWGhgU9TAWEiAWGhwU8bAWLiwWLiwUO+Uj3UtkV98+LBZ2IBZmCBZV9BY57BYh7BYF9BX2CBXmIBfwsiwWEjAWFiwWJjQWIiwWGjgWGjgWJjQWJjAWHkAWHkAWKjQWKjQWKkQWJkAWLjgWLjQWMkQWLkQWNjQWLjQWPkAWOkQX38vguBfvPiwV5jgV9lAWBmQWImwWOmwWVmQWZlAWdjgX4LIsFkooFkYsFjYoFjooFkIgFkYgFjIkFjYoFj4YFj4YFjIkFjIkFjIUFjYYFi4gFi4kFioUFi4UFiYkFi4kFh4YFiIYFDgAAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAA==\";var Rw=ae(ce(),1);var Vit=ae(ce(),1);var Ow=ae(c2(),1);var qot=ae(ce(),1);var sst=ae(ce(),1);var ust=ae(ce(),1);var wst=ae(ce(),1);function ue(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function l2(t){return typeof t\u003e\"u\"}function p2(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function Mc(...t){t=Array.isArray(t[0])?t[0]:t;let e=(r,n)=\u003e({a:r.a*n.a+r.c*n.b,c:r.a*n.c+r.c*n.d,e:r.a*n.e+r.c*n.f+r.e,b:r.b*n.a+r.d*n.b,d:r.b*n.c+r.d*n.d,f:r.b*n.e+r.d*n.f+r.f});switch(t.length){case 0:throw Error(\"no matrices provided\");case 1:return t[0];case 2:return e(t[0],t[1]);default:{let[r,n,...i]=t,s=e(r,n);return Mc(s,...i)}}}var{cos:bP,sin:vP,PI:Trt}=Math;function SP(t,e,r){let n=bP(t),i=vP(t),s={a:n,c:-i,e:0,b:i,d:n,f:0};return l2(e)||l2(r)?s:Mc([p2(e,r),s,p2(-e,-r)])}var{tan:Ert}=Math;function wP(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Cc(t,e,r,n){var i=Error.call(this,t);return Object.setPrototypeOf\u0026\u0026Object.setPrototypeOf(i,Cc.prototype),i.expected=e,i.found=r,i.location=n,i.name=\"SyntaxError\",i}wP(Cc,Error);function Ch(t,e,r){return r=r||\" \",t.length\u003ee?t:(e-=t.length,r+=r.repeat(e),t+r.slice(0,e))}Cc.prototype.format=function(t){var e=\"Error: \"+this.message;if(this.location){var r=null,n;for(n=0;n\u003ct.length;n++)if(t[n].source===this.location.source){r=t[n].text.split(/\\r\\n|\\n|\\r/g);break}var i=this.location.start,s=this.location.source\u0026\u0026typeof this.location.source.offset==\"function\"?this.location.source.offset(i):i,o=this.location.source+\":\"+s.line+\":\"+s.column;if(r){var c=this.location.end,l=Ch(\"\",s.line.toString().length,\" \"),a=r[i.line-1],p=i.line===c.line?c.column:a.length+1,d=p-i.column||1;e+=`\n --\u003e `+o+`\n`+l+` |\n`+s.line+\" | \"+a+`\n`+l+\" | \"+Ch(\"\",i.column-1,\" \")+Ch(\"\",d,\"^\")}else e+=`\n at `+o}return e};Cc.buildMessage=function(t,e){var r={literal:function(a){return'\"'+i(a.text)+'\"'},class:function(a){var p=a.parts.map(function(d){return Array.isArray(d)?s(d[0])+\"-\"+s(d[1]):s(d)});return\"[\"+(a.inverted?\"^\":\"\")+p.join(\"\")+\"]\"},any:function(){return\"any character\"},end:function(){return\"end of input\"},other:function(a){return a.description}};function n(a){return a.charCodeAt(0).toString(16).toUpperCase()}function i(a){return a.replace(/\\\\/g,\"\\\\\\\\\").replace(/\"/g,\"\\\\\\\"\").replace(/\\0/g,\"\\\\0\").replace(/\\t/g,\"\\\\t\").replace(/\\n/g,\"\\\\n\").replace(/\\r/g,\"\\\\r\").replace(/[\\x00-\\x0F]/g,function(p){return\"\\\\x0\"+n(p)}).replace(/[\\x10-\\x1F\\x7F-\\x9F]/g,function(p){return\"\\\\x\"+n(p)})}function s(a){return a.replace(/\\\\/g,\"\\\\\\\\\").replace(/\\]/g,\"\\\\]\").replace(/\\^/g,\"\\\\^\").replace(/-/g,\"\\\\-\").replace(/\\0/g,\"\\\\0\").replace(/\\t/g,\"\\\\t\").replace(/\\n/g,\"\\\\n\").replace(/\\r/g,\"\\\\r\").replace(/[\\x00-\\x0F]/g,function(p){return\"\\\\x0\"+n(p)}).replace(/[\\x10-\\x1F\\x7F-\\x9F]/g,function(p){return\"\\\\x\"+n(p)})}function o(a){return r[a.type](a)}function c(a){var p=a.map(o),d,m;if(p.sort(),p.length\u003e0){for(d=1,m=1;d\u003cp.length;d++)p[d-1]!==p[d]\u0026\u0026(p[m]=p[d],m++);p.length=m}switch(p.length){case 1:return p[0];case 2:return p[0]+\" or \"+p[1];default:return p.slice(0,-1).join(\", \")+\", or \"+p[p.length-1]}}function l(a){return a?'\"'+i(a)+'\"':\"end of input\"}return\"Expected \"+c(t)+\" but \"+l(e)+\" found.\"};function He(t){if(t.length===0)return{minX:0,maxX:0,minY:0,maxY:0};let e=1/0,r=-1/0,n=1/0,i=-1/0,s=(o)=\u003e{e=Math.min(e,o.x),r=Math.max(r,o.x),n=Math.min(n,o.y),i=Math.max(i,o.y)};return t.forEach((o)=\u003e{switch(o.type){case\"path\":o.points.forEach(s);break;case\"text\":s({x:o.x,y:o.y});break;case\"circle\":{let{x:c,y:l,radius:a}=o;s({x:c-a,y:l-a}),s({x:c+a,y:l+a});break}case\"box\":{let{x:c,y:l,width:a,height:p}=o,d=a/2,m=p/2;s({x:c-d,y:l-m}),s({x:c+d,y:l+m});break}}}),{minX:e,maxX:r,minY:n,maxY:i}}var AP=(t,e=\"right\")=\u003e{switch(e){case\"down\":switch(t){case\"middle_top\":return\"middle_right\";case\"middle_bottom\":return\"middle_left\";case\"middle_left\":return\"middle_bottom\";case\"middle_right\":return\"middle_top\"}break;case\"up\":switch(t){case\"middle_top\":return\"middle_left\";case\"middle_bottom\":return\"middle_right\";case\"middle_left\":return\"middle_top\";case\"middle_right\":return\"middle_bottom\"}break;case\"left\":switch(t){case\"middle_top\":return\"middle_bottom\";case\"middle_bottom\":return\"middle_top\";case\"middle_left\":return\"middle_right\";case\"middle_right\":return\"middle_left\"}break;case\"right\":return t}return t},Si=(t,e)=\u003e{let{primitives:r,center:n,ports:i,size:s}=t,o=Mc({a:1,b:0,c:0,d:-1,e:0,f:2*n.y}),c=r.map((a)=\u003e{switch(a={...a},a.type){case\"path\":return{...a,points:a.points.map((f)=\u003eue(o,f))};case\"text\":let p=ue(o,{x:a.x,y:a.y}),d={top_left:\"bottom_left\",top_right:\"bottom_right\",bottom_left:\"top_left\",bottom_right:\"top_right\",center:\"center\",middle_top:\"middle_bottom\",middle_bottom:\"middle_top\",middle_left:\"middle_left\",middle_right:\"middle_right\"};return{...a,x:p.x,y:p.y,anchor:d[a.anchor]};case\"circle\":case\"box\":let m=ue(o,{x:a.x,y:a.y});return{...a,x:m.x,y:m.y}}}),l=i.map((a)=\u003e({...a,...ue(o,a)}));return{primitives:c,center:n,ports:l,size:s,...e}},wi=(t,e)=\u003e{let{primitives:r,center:n,ports:i,size:s}=t,o=Mc({a:-1,b:0,c:0,d:1,e:0,f:2*n.x}),c=r.map((a)=\u003e{switch(a={...a},a.type){case\"path\":return{...a,points:a.points.map((f)=\u003eue(o,f))};case\"text\":let p=ue(o,{x:a.x,y:a.y}),d={top_left:\"top_right\",top_right:\"top_left\",bottom_left:\"bottom_right\",bottom_right:\"bottom_left\",center:\"center\",middle_top:\"middle_top\",middle_bottom:\"middle_bottom\",middle_left:\"middle_right\",middle_right:\"middle_left\"};return{...a,x:p.x,y:p.y,anchor:d[a.anchor]};case\"circle\":case\"box\":let m=ue(o,{x:a.x,y:a.y});return{...a,x:m.x,y:m.y}}}),l=i.map((a)=\u003e({...a,...ue(o,a)}));return{primitives:c,center:n,ports:l,size:s,...e}},Lo=(t,e)=\u003e{let{newOrientation:r,overrides:n}=e,i={up:Math.PI/2,right:0,down:-Math.PI/2,left:-Math.PI},s=SP(r?i[r]:Math.PI/2,t.center.x,t.center.y),{primitives:o,center:c,size:l,ports:a}=t,p=o.map((f)=\u003e{switch(f={...f},f.type){case\"path\":return{...f,points:f.points.map((S)=\u003eue(s,S))};case\"text\":let _=ue(s,{x:f.x,y:f.y});return f.anchor=AP(f.anchor,r??\"right\"),{...f,x:_.x,y:_.y};case\"circle\":let g=ue(s,{x:f.x,y:f.y});return{...f,x:g.x,y:g.y};case\"box\":let y=ue(s,{x:f.x,y:f.y});return{...f,x:y.x,y:y.y,width:f.height,height:f.width}}}),d=a.map((f)=\u003e({...f,...ue(s,f)})),m=He(p);return{primitives:p,center:c,ports:d,size:{width:m.maxX-m.minX,height:m.maxY-m.minY},...n}},Z=(t,e=\"down\",r={})=\u003eLo(t,{newOrientation:e,overrides:r}),PP=class{symbol;constructor(t){this.symbol=JSON.parse(JSON.stringify(t)),this.symbol.size=this.computeSize()}changeTextAnchor(t,e,r){return this.symbol={...this.symbol,primitives:this.symbol.primitives.map((n)=\u003en.type===\"text\"\u0026\u0026n.text===t?{...n,anchor:e,...r?{x:n.x+r.x,y:n.y+r.y}:{}}:n)},this}labelPort(t,e){return this.symbol={...this.symbol,ports:this.symbol.ports.map((r)=\u003er.labels.includes(t)?{...r,labels:e}:r)},this}rotateRightFacingSymbol(t){return this.symbol=Lo(this.symbol,{newOrientation:t}),this}computeSize(){let t=He(this.symbol.primitives);return{width:t.maxX-t.minX,height:t.maxY-t.minY}}build(){return{...this.symbol,size:this.computeSize()}}},Y=(t)=\u003e{let e=t.primitives??[...Object.values(t.paths??{}),...Object.values(t.texts??{}),...Object.values(t.circles??{}),...Object.values(t.rects??{})],r=t.ports??Object.entries(t.refblocks).flatMap(([i,s])=\u003e[{...s,labels:[i]}]),n=t.center??{x:t.bounds.centerX,y:t.bounds.centerY};return r.length===2\u0026\u0026(n={x:(r[0].x+r[1].x)/2,y:(r[0].y+r[1].y)/2}),new PP({...t,primitives:e,ports:r,center:n})},Ai={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.04}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0.04},{x:0.54,y:0.04}],color:\"primary\",fill:!1},\"path11-5-5\":{type:\"path\",points:[{x:0.1,y:0.13},{x:0,y:-0.06},{x:-0.11,y:0.13}],color:\"primary\",fill:!1},path17:{type:\"path\",points:[{x:0,y:-0.13},{x:0.07,y:-0.11}],color:\"primary\",fill:!1},path18:{type:\"path\",points:[{x:0.07,y:-0.11},{x:0.14,y:-0.13}],color:\"primary\",fill:!1},path19:{type:\"path\",points:[{x:-0.15,y:-0.13},{x:-0.07,y:-0.11}],color:\"primary\",fill:!1},path20:{type:\"path\",points:[{x:-0.07,y:-0.11},{x:0,y:-0.13}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.17,y:0.4},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:-0.4}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.79,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0.04,radius:0.29,color:\"primary\",fill:!1}}},{paths:BP,texts:Rrt,bounds:Vs,refblocks:h2,circles:IP}=Ai,FP=Y({primitives:[...Object.values(BP),...Object.values(IP),{type:\"text\",text:\"{REF}\",x:-0.15,y:0.3894553499999995},{type:\"text\",text:\"{VAL}\",x:0.15,y:0.3894553499999995}],ports:[{...h2.left1,labels:[\"1\"]},{...h2.right1,labels:[\"2\"]}],size:{width:Vs.width,height:Vs.height},center:{x:Vs.centerX,y:Vs.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:MP,texts:Ort,bounds:zs,refblocks:d2,circles:CP}=Ai,kP=Y({primitives:[...Object.values(MP),...Object.values(CP),{type:\"text\",text:\"{REF}\",x:-0,y:0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.4094553499999995}],ports:[{...d2.left1,labels:[\"1\"]},{...d2.right1,labels:[\"2\"]}],size:{width:zs.width,height:zs.height},center:{x:zs.centerX,y:zs.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:NP,texts:Wrt,bounds:Us,refblocks:m2,circles:YP}=Ai,LP=Y({primitives:[...Object.values(NP),...Object.values(YP),{type:\"text\",text:\"{REF}\",x:-0,y:-0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:0.4094553499999995}],ports:[{...m2.left1,labels:[\"1\"]},{...m2.right1,labels:[\"2\"]}],size:{width:Us.width,height:Us.height},center:{x:Us.centerX,y:Us.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:TP,texts:$rt,bounds:Gs,refblocks:u2,circles:EP}=Ai,RP=Y({primitives:[...Object.values(TP),...Object.values(EP),{type:\"text\",text:\"{REF}\",x:-0,y:0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.4094553499999995}],ports:[{...u2.left1,labels:[\"1\"]},{...u2.right1,labels:[\"2\"]}],size:{width:Gs.width,height:Gs.height},center:{x:Gs.centerX,y:Gs.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:OP,texts:jrt,bounds:Hs,refblocks:f2,circles:WP}=Ai,$P=Y({primitives:[...Object.values(OP),...Object.values(WP),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...f2.left1,labels:[\"1\"]},{...f2.right1,labels:[\"2\"]}],size:{width:Hs.width,height:Hs.height},center:{x:Hs.centerX,y:Hs.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:jP,texts:Xrt,bounds:Qs,refblocks:y2,circles:XP}=Ai,DP=Y({primitives:[...Object.values(jP),...Object.values(XP),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...y2.left1,labels:[\"1\"]},{...y2.right1,labels:[\"2\"]}],size:{width:Qs.width,height:Qs.height},center:{x:Qs.centerX,y:Qs.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Pi={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1},\"path43-8\":{type:\"path\",points:[{x:0.14,y:0.18},{x:0.08,y:0.2}],color:\"primary\",fill:!1},\"path43-8-3\":{type:\"path\",points:[{x:0.21,y:-0.11},{x:0.15,y:-0.09}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:VP,texts:Drt,bounds:Zs,refblocks:_2,circles:zP}=Pi,UP=Y({primitives:[...Object.values(VP),...Object.values(zP),{type:\"text\",text:\"{REF}\",x:-0.15,y:0.3294553499999995},{type:\"text\",text:\"{VAL}\",x:0.15,y:0.3294553499999995}],ports:[{..._2.left1,labels:[\"1\"]},{..._2.right1,labels:[\"2\"]}],size:{width:Zs.width,height:Zs.height},center:{x:Zs.centerX,y:Zs.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),GP=Y(Pi).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\",\"neg\"]).labelPort(\"right1\",[\"2\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:HP,texts:Vrt,bounds:qs,refblocks:g2,circles:QP}=Pi,ZP=Y({primitives:[...Object.values(HP),...Object.values(QP),{type:\"text\",text:\"{REF}\",x:-0,y:-0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:0.3294553499999995}],ports:[{...g2.left1,labels:[\"1\"]},{...g2.right1,labels:[\"2\"]}],size:{width:qs.width,height:qs.height},center:{x:qs.centerX,y:qs.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),qP=Y(Pi).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\",\"neg\"]).labelPort(\"right1\",[\"2\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),kc={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.07000000000000006,y:0.1399999999999999},{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001},{x:0.16999999999999993,y:-0.1399999999999999}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},JP={boxresistor:{horizontalOffset:0.16,horizontalHeight:0.65,verticalX:0.16,verticalRefY:0.16,verticalValY:-0.16,verticalWidth:0.9},capacitor:{horizontalOffset:0.24,horizontalHeight:0.65,verticalX:0.2,verticalRefY:0.095,verticalValY:-0.095,verticalWidth:0.9},led:{horizontalOffset:0.38,horizontalHeight:0.9,verticalX:0.38,verticalRefY:0.14,verticalValY:-0.14,verticalWidth:1.1},diode:{horizontalOffset:0.22,horizontalHeight:0.65,verticalX:0.2,verticalRefY:0.14,verticalValY:-0.14,verticalWidth:0.9},resistor:{horizontalOffset:0.22,horizontalHeight:0.65,verticalX:0.2,verticalRefY:0.14,verticalValY:-0.14,verticalWidth:0.9}},yt=(t,{kind:e,orientation:r,pin1Labels:n=[\"1\"],pin2Labels:i=[\"2\"]})=\u003e{let s=JP[e],o=Y({...t,texts:{}}).rotateRightFacingSymbol(r).labelPort(\"left1\",n).labelPort(\"right1\",i).build(),c=r===\"right\"||r===\"left\",l=c?[{type:\"text\",text:\"{REF}\",x:0,y:s.horizontalOffset,anchor:\"middle_bottom\"},{type:\"text\",text:\"{VAL}\",x:0,y:-s.horizontalOffset,anchor:\"middle_top\"}]:[{type:\"text\",text:\"{REF}\",x:s.verticalX,y:s.verticalRefY,anchor:\"middle_left\"},{type:\"text\",text:\"{VAL}\",x:s.verticalX,y:s.verticalValY,anchor:\"middle_left\"}],[a,p]=o.ports,d=Math.hypot(p.x-a.x,p.y-a.y);return{...o,primitives:[...o.primitives,...l],size:c?{width:d,height:s.horizontalHeight}:{width:s.verticalWidth,height:d}}},KP=yt(kc,{kind:\"diode\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),tB=yt(kc,{kind:\"diode\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),eB=yt(kc,{kind:\"diode\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),rB=yt(kc,{kind:\"diode\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),{paths:nB,texts:zrt,bounds:Js,refblocks:x2,circles:iB}=Pi,oB=Y({primitives:[...Object.values(nB),...Object.values(iB),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2294553499999995}],ports:[{...x2.left1,labels:[\"1\"]},{...x2.right1,labels:[\"2\"]}],size:{width:Js.width,height:Js.height},center:{x:Js.centerX,y:Js.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:sB,texts:Urt,bounds:Ks,refblocks:b2,circles:aB}=Pi,cB=Y({primitives:[...Object.values(sB),...Object.values(aB),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2294553499999995}],ports:[{...b2.left1,labels:[\"1\"]},{...b2.right1,labels:[\"2\"]}],size:{width:Ks.width,height:Ks.height},center:{x:Ks.centerX,y:Ks.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Nc={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.050000000000000044,y:0.11999999999999988},{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009},{x:0.15000000000000013,y:-0.1200000000000001}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.25,maxY:0.25,width:0.34999999999999987,height:0.5,centerX:0.00000000000000011102230246251565,centerY:0},circles:{}},lB=yt(Nc,{kind:\"diode\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),pB=yt(Nc,{kind:\"diode\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),hB=yt(Nc,{kind:\"diode\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),dB=yt(Nc,{kind:\"diode\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),Yc={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.52,y:0.04}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1},\"path43-8\":{type:\"path\",points:[{x:0.18,y:0.18},{x:0.11,y:0.18}],color:\"primary\",fill:!1},\"path43-8-8\":{type:\"path\",points:[{x:0.18,y:-0.09},{x:0.11,y:-0.09}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:mB,texts:Grt,bounds:ta,refblocks:v2,circles:uB}=Yc,fB=Y({primitives:[...Object.values(mB),...Object.values(uB),{type:\"text\",text:\"{REF}\",x:-0.16,y:0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:0.16,y:0.2294553499999995}],ports:[{...v2.left1,labels:[\"1\"]},{...v2.right1,labels:[\"2\"]}],size:{width:ta.width,height:ta.height},center:{x:ta.centerX,y:ta.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),{paths:yB,texts:Hrt,bounds:ea,refblocks:S2,circles:_B}=Yc,Wv=Y({primitives:[...Object.values(yB),...Object.values(_B),{type:\"text\",text:\"{REF}\",x:-0.0001118,y:-0.18},{type:\"text\",text:\"{VAL}\",x:0.0001118,y:0.2738453}],ports:[{...S2.left1,labels:[\"1\"]},{...S2.right1,labels:[\"2\"]}],size:{width:ea.width,height:ea.height},center:{x:ea.centerX,y:ea.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"2\"]).labelPort(\"right1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:gB,texts:Qrt,bounds:ra,refblocks:w2,circles:xB}=Yc,bB=Y({primitives:[...Object.values(gB),...Object.values(xB),{type:\"text\",text:\"{REF}\",x:-0.0050250999999996715,y:0.27384529999999985,anchor:\"middle_left\"},{type:\"text\",text:\"{VAL}\",x:-0.00011179999999999524,y:-0.27384530000000007,anchor:\"middle_left\"}],ports:[{...w2.left1,labels:[\"1\"]},{...w2.right1,labels:[\"2\"]}],size:{width:ra.width,height:ra.height},center:{x:ra.centerX,y:ra.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"right1\",[\"2\"]).labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:Zrt,texts:qrt,bounds:Jrt,refblocks:Krt,circles:tnt}=Yc,ad=Z(Wv,\"down\"),cd=ad.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),ld=ad.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");cd.anchor=\"middle_left\";ld.anchor=\"middle_left\";cd.x=0.25;cd.y+=0.21;ld.y-=0.21;ld.x=0.25;var vB=ad,To={paths:{path43:{type:\"path\",points:[{x:-0.06,y:0.19},{x:-0.06,y:-0.12}],color:\"primary\",fill:!1},\"path43-6\":{type:\"path\",points:[{x:0.02,y:0.13},{x:0.02,y:-0.06}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.06,y:0.03},{x:-0.5,y:0.03}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.5,y:0.03},{x:0.03,y:0.03}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.03,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.03,y:-0.28}},refblocks:{left1:{x:-0.5,y:0.03},right1:{x:0.5,y:0.03}},bounds:{minX:-0.5,maxX:0.5,minY:-0.38,maxY:0.27,width:1,height:0.29,centerX:0,centerY:0.06},circles:{}},{paths:SB,bounds:A2,refblocks:P2,circles:wB}=To,AB=Y({primitives:[...Object.values(SB),...Object.values(wB),{type:\"text\",text:\"{REF}\",x:-0.2,y:0.31},{type:\"text\",text:\"{VAL}\",x:0.2,y:0.31}],ports:[{...P2.left1,labels:[\"1\"]},{...P2.right1,labels:[\"2\"]}],center:{x:A2.centerX,y:A2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"down\").changeTextAnchor(\"{REF}\",\"middle_left\").build(),PB={...AB,size:{width:1,height:0.9}};function Yt(t){let e=t.size;if(!e){let r=He(t.primitives);e={width:r.maxX-r.minX,height:r.maxY-r.minY}}return{...t,size:e}}var{paths:BB,texts:B2,bounds:na,refblocks:I2,circles:IB}=To,$v=Yt({primitives:[...Object.values(BB),...Object.values(IB),{...B2.top1,anchor:\"middle_bottom\"},{...B2.bottom1,anchor:\"middle_top\"}],ports:[{...I2.left1,labels:[\"1\"]},{...I2.right1,labels:[\"2\"]}],size:{width:na.width,height:na.height},center:{x:na.centerX,y:na.centerY}}),{paths:FB,bounds:F2,refblocks:M2,circles:MB}=To,CB=Y({primitives:[...Object.values(FB),...Object.values(MB),{type:\"text\",text:\"{REF}\",x:0,y:-0.22},{type:\"text\",text:\"{VAL}\",x:0,y:0.28}],ports:[{...M2.left1,labels:[\"1\"]},{...M2.right1,labels:[\"2\"]}],center:{x:F2.centerX,y:F2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),kB={...CB,size:{width:1,height:0.65}},{paths:NB,bounds:C2,refblocks:k2,circles:YB}=To,LB=Y({primitives:[...Object.values(NB),...Object.values(YB),{type:\"text\",text:\"{REF}\",x:0,y:0.28},{type:\"text\",text:\"{VAL}\",x:0,y:-0.22}],ports:[{...k2.left1,labels:[\"1\"]},{...k2.right1,labels:[\"2\"]}],center:{x:C2.centerX,y:C2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),TB={...LB,size:{width:1,height:0.65}},{paths:EB,bounds:N2,refblocks:Y2,circles:RB}=To,OB=Y({primitives:[...Object.values(EB),...Object.values(RB),{type:\"text\",text:\"{REF}\",x:0.2,y:-0.25},{type:\"text\",text:\"{VAL}\",x:-0.2,y:-0.25}],ports:[{...Y2.left1,labels:[\"1\"]},{...Y2.right1,labels:[\"2\"]}],center:{x:N2.centerX,y:N2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"up\").changeTextAnchor(\"{REF}\",\"middle_left\").build(),WB={...OB,size:{width:1,height:0.9}},$B=Lo($v,{newOrientation:\"up\"}),Lc={paths:{path1:{type:\"path\",points:[{x:-0.3,y:0},{x:-0.19998,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},path2:{type:\"path\",points:[{x:0.19998,y:0},{x:0.3,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},path3:{type:\"path\",points:[{x:-0.19998,y:0.07998},{x:0.19998,y:0.07998},{x:0.19998,y:-0.07998},{x:-0.19998,y:-0.07998},{x:-0.19998,y:0.07998}],color:\"primary\",fill:!1,strokeWidth:0.012}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.3,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.45,anchor:\"middle_bottom\"}},refblocks:{left1:{x:-0.3,y:0},right1:{x:0.3,y:0}},bounds:{minX:-0.3,maxX:0.3,minY:-0.45,maxY:0.3,width:0.6,height:0.75,centerX:0,centerY:0},circles:{}},{paths:jB,texts:ent,bounds:L2,refblocks:T2,circles:XB}=Lc,DB=Y({primitives:[...Object.values(jB),...Object.values(XB),{type:\"text\",text:\"{REF}\",x:-0.16,y:0.16},{type:\"text\",text:\"{VAL}\",x:0.16,y:0.16}],ports:[{...T2.left1,labels:[\"1\"]},{...T2.right1,labels:[\"2\"]}],center:{x:L2.centerX,y:L2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),VB={...DB,size:{width:0.9,height:0.6}},{paths:zB,texts:rnt,bounds:E2,refblocks:R2,circles:UB}=Lc,GB=Y({primitives:[...Object.values(zB),...Object.values(UB),{type:\"text\",text:\"{REF}\",x:0,y:-0.16},{type:\"text\",text:\"{VAL}\",x:0,y:0.16}],ports:[{...R2.left1,labels:[\"1\"]},{...R2.right1,labels:[\"2\"]}],center:{x:E2.centerX,y:E2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),HB={...GB,size:{width:0.6,height:0.65}},{paths:QB,texts:nnt,bounds:O2,refblocks:W2,circles:ZB}=Lc,qB=Y({primitives:[...Object.values(QB),...Object.values(ZB),{type:\"text\",text:\"{REF}\",x:0,y:0.16},{type:\"text\",text:\"{VAL}\",x:0,y:-0.16}],ports:[{...W2.left1,labels:[\"1\"]},{...W2.right1,labels:[\"2\"]}],center:{x:O2.centerX,y:O2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),JB={...qB,size:{width:0.6,height:0.65}},Tc={paths:{\"left-lead\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.175,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},body:{type:\"path\",points:[{x:-0.175,y:0.075},{x:0.175,y:0.075},{x:0.175,y:-0.075},{x:-0.175,y:-0.075},{x:-0.175,y:0.075}],color:\"primary\",fill:!1,strokeWidth:0.012},\"right-lead\":{type:\"path\",points:[{x:0.175,y:0},{x:0.25,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},KB=yt(Tc,{kind:\"boxresistor\",orientation:\"down\"}),t8=yt(Tc,{kind:\"boxresistor\",orientation:\"left\"}),e8=yt(Tc,{kind:\"boxresistor\",orientation:\"right\"}),r8=yt(Tc,{kind:\"boxresistor\",orientation:\"up\"}),Ec={paths:{path2:{type:\"path\",points:[{x:0.15,y:-0.01},{x:0.55,y:-0.01}],color:\"primary\",fill:!0},\"path2-5\":{type:\"path\",points:[{x:-0.15,y:0.06},{x:0.14,y:0.06}],color:\"primary\",fill:!0},\"path2-5-1\":{type:\"path\",points:[{x:0.14,y:0.06},{x:0.14,y:-0.08}],color:\"primary\",fill:!0},\"path2-5-1-6\":{type:\"path\",points:[{x:-0.16,y:0.06},{x:-0.16,y:-0.08}],color:\"primary\",fill:!0},\"path2-5-4\":{type:\"path\",points:[{x:-0.15,y:-0.08},{x:0.14,y:-0.08}],color:\"primary\",fill:!0},\"path2-9\":{type:\"path\",points:[{x:-0.55,y:-0.01},{x:-0.17,y:-0.01}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.17},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.17}},refblocks:{left1:{x:-0.55,y:-0.01},right1:{x:0.55,y:-0.01}},bounds:{minX:-0.58,maxX:0.58,minY:-0.17,maxY:0.17,width:1.16,height:0.35,centerX:0,centerY:0},circles:{}},{paths:n8,texts:int,bounds:ia,refblocks:$2,circles:i8}=Ec,o8=Y({primitives:[...Object.values(n8),...Object.values(i8),{type:\"text\",text:\"{REF}\",x:-0.2,y:0.1404553499999995},{type:\"text\",text:\"{VAL}\",x:0.2,y:0.1494553499999995}],ports:[{...$2.left1,labels:[\"1\"]},{...$2.right1,labels:[\"2\"]}],size:{width:ia.width,height:ia.height},center:{x:ia.centerX,y:ia.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:s8,texts:ont,bounds:oa,refblocks:j2,circles:a8}=Ec,c8=Y({primitives:[...Object.values(s8),...Object.values(a8),{type:\"text\",text:\"{REF}\",x:0,y:-0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:0.1704553499999995}],ports:[{...j2.left1,labels:[\"1\"]},{...j2.right1,labels:[\"2\"]}],size:{width:oa.width,height:oa.height},center:{x:oa.centerX,y:oa.centerY}}).rotateRightFacingSymbol(\"left\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:l8,texts:snt,bounds:sa,refblocks:X2,circles:p8}=Ec,h8=Y({primitives:[...Object.values(l8),...Object.values(p8),{type:\"text\",text:\"{REF}\",x:0,y:0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.1704553499999995}],ports:[{...X2.left1,labels:[\"1\"]},{...X2.right1,labels:[\"2\"]}],size:{width:sa.width,height:sa.height},center:{x:sa.centerX,y:sa.centerY}}).rotateRightFacingSymbol(\"right\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:d8,texts:ant,bounds:aa,refblocks:D2,circles:m8}=Ec,u8=Y({primitives:[...Object.values(d8),...Object.values(m8),{type:\"text\",text:\"{REF}\",x:0.2,y:-0.1404553499999995},{type:\"text\",text:\"{VAL}\",x:-0.2,y:-0.1494553499999995}],ports:[{...D2.left1,labels:[\"1\"]},{...D2.right1,labels:[\"2\"]}],size:{width:aa.width,height:aa.height},center:{x:aa.centerX,y:aa.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:f8,texts:cnt,bounds:V2,refblocks:z2,circles:y8}=Lc,_8=Y({primitives:[...Object.values(f8),...Object.values(y8),{type:\"text\",text:\"{REF}\",x:0.16,y:-0.16},{type:\"text\",text:\"{VAL}\",x:-0.16,y:-0.16}],ports:[{...z2.left1,labels:[\"1\"]},{...z2.right1,labels:[\"2\"]}],center:{x:V2.centerX,y:V2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),g8={..._8,size:{width:0.9,height:0.6}},Rc={paths:{\"left-lead\":{type:\"path\",points:[{x:-0.175,y:0},{x:-0.14,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},body:{type:\"path\",points:[{x:-0.14,y:0.065},{x:0.14,y:0.065},{x:0.14,y:-0.065},{x:-0.14,y:-0.065},{x:-0.14,y:0.065}],color:\"primary\",fill:!1,strokeWidth:0.012},\"right-lead\":{type:\"path\",points:[{x:0.14,y:0},{x:0.175,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.175,y:0},right1:{x:0.175,y:0}},bounds:{minX:-0.175,maxX:0.175,minY:-0.25,maxY:0.25,width:0.35,height:0.5,centerX:0,centerY:0},circles:{}},x8=yt(Rc,{kind:\"boxresistor\",orientation:\"down\"}),b8=yt(Rc,{kind:\"boxresistor\",orientation:\"left\"}),v8=yt(Rc,{kind:\"boxresistor\",orientation:\"right\"}),S8=yt(Rc,{kind:\"boxresistor\",orientation:\"up\"}),pd={paths:{\"horizontal-bar\":{type:\"path\",points:[{x:-0.4,y:0},{x:0.4,y:0}],color:\"primary\",fill:!1},\"middle-dash-1\":{type:\"path\",points:[{x:0,y:0.2},{x:0,y:0.07}],color:\"primary\",fill:!1},\"middle-dash-2\":{type:\"path\",points:[{x:0,y:0.01},{x:0,y:-0.12}],color:\"primary\",fill:!1},\"middle-dash-3\":{type:\"path\",points:[{x:0,y:-0.18},{x:0,y:-0.31}],color:\"primary\",fill:!1},\"left-vertical\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.25,y:-0.2}],color:\"primary\",fill:!1},\"right-vertical\":{type:\"path\",points:[{x:0.25,y:0},{x:0.25,y:-0.2}],color:\"primary\",fill:!1},\"left-ground\":{type:\"path\",points:[{x:-0.3,y:-0.2},{x:-0.25,y:-0.3},{x:-0.2,y:-0.2},{x:-0.3,y:-0.2}],color:\"primary\",fill:!1},\"right-ground\":{type:\"path\",points:[{x:0.2,y:-0.2},{x:0.25,y:-0.3},{x:0.3,y:-0.2},{x:0.2,y:-0.2}],color:\"primary\",fill:!1}},refblocks:{left1:{x:-0.4,y:0},right1:{x:0.4,y:0}},texts:{ref:{type:\"text\",text:\"{REF}\",x:0,y:0.35}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.35,width:0.8,height:0.75,centerX:0,centerY:-0.02},circles:{}},{paths:w8,texts:lnt,bounds:U2,refblocks:G2,circles:A8}=pd,P8=Y({primitives:[...Object.values(w8),...Object.values(A8),{type:\"text\",text:\"{REF}\",x:0,y:0.2594553499999995}],ports:[{...G2.left1,labels:[\"1\"]},{...G2.right1,labels:[\"2\"]}],center:{x:U2.centerX,y:U2.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),{paths:B8,texts:pnt,bounds:H2,refblocks:Q2,circles:I8}=pd,jv=Y({primitives:[...Object.values(B8),...Object.values(I8),{type:\"text\",text:\"{REF}\",x:0,y:0.2594553499999995}],ports:[{...Q2.left1,labels:[\"1\"]},{...Q2.right1,labels:[\"2\"]}],center:{x:H2.centerX,y:H2.centerY}}).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),F8=wi(jv),{paths:M8,texts:hnt,bounds:Z2,refblocks:q2,circles:C8}=pd,k8=Y({primitives:[...Object.values(M8),...Object.values(C8),{type:\"text\",text:\"{REF}\",x:0,y:0.2594553499999995}],ports:[{...q2.left1,labels:[\"1\"]},{...q2.right1,labels:[\"2\"]}],center:{x:Z2.centerX,y:Z2.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_right\").build(),Oc={paths:{path27:{type:\"path\",points:[{x:0.3,y:0},{x:0.06,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},path28:{type:\"path\",points:[{x:-0.06,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},path29:{type:\"path\",points:[{x:0.06,y:0.16002},{x:0.06,y:-0.16002}],color:\"primary\",fill:!1,strokeWidth:0.012},path30:{type:\"path\",points:[{x:-0.06,y:0.16002},{x:-0.06,y:-0.16002}],color:\"primary\",fill:!1,strokeWidth:0.012}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.24,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.24,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.3,y:0},right1:{x:0.3,y:0}},bounds:{minX:-0.3,maxX:0.3,minY:-0.24,maxY:0.24,width:0.6,height:0.48,centerX:0,centerY:0},circles:{}},{paths:N8,texts:dnt,bounds:ca,refblocks:J2,circles:Y8}=Oc,L8=Y({primitives:[...Object.values(N8),...Object.values(Y8),{type:\"text\",text:\"{REF}\",x:-0.2,y:0.115},{type:\"text\",text:\"{VAL}\",x:0.2,y:0.115}],ports:[{...J2.left1,labels:[\"1\"]},{...J2.right1,labels:[\"2\"]}],size:{width:ca.width,height:ca.height},center:{x:ca.centerX,y:ca.centerY}}).changeTextAnchor(\"{VAL}\",\"top_left\").rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"bottom_left\").build(),T8={...L8,size:{width:0.9,height:0.6}},E8=Y(Oc).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"right1\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),R8={...E8,size:{width:0.6,height:0.65}},Wc={paths:{path27:{type:\"path\",points:[{x:0.3,y:0},{x:0.000657,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},path28:{type:\"path\",points:[{x:-0.038683,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},path30:{type:\"path\",points:[{x:-0.074255,y:0.16002},{x:-0.074255,y:0.16002},{x:-0.069544,y:0.149352},{x:-0.065126,y:0.138684},{x:-0.061005,y:0.128016},{x:-0.057182,y:0.117348},{x:-0.053663,y:0.10668},{x:-0.05045,y:0.096012},{x:-0.047547,y:0.085344},{x:-0.044957,y:0.074676},{x:-0.042684,y:0.064008},{x:-0.040732,y:0.05334},{x:-0.039103,y:0.042672},{x:-0.037801,y:0.032004},{x:-0.03683,y:0.021336},{x:-0.036193,y:0.010668},{x:-0.035893,y:0},{x:-0.036193,y:-0.010668},{x:-0.03683,y:-0.021336},{x:-0.037801,y:-0.032004},{x:-0.039103,y:-0.042672},{x:-0.040732,y:-0.05334},{x:-0.042684,y:-0.064008},{x:-0.044957,y:-0.074676},{x:-0.047547,y:-0.085344},{x:-0.05045,y:-0.096012},{x:-0.053663,y:-0.10668},{x:-0.057182,y:-0.117348},{x:-0.061005,y:-0.128016},{x:-0.065126,y:-0.138684},{x:-0.069544,y:-0.149352},{x:-0.074255,y:-0.16002},{x:-0.074255,y:-0.16002}],color:\"primary\",fill:!1,strokeWidth:0.012},\"path30-7\":{type:\"path\",points:[{x:-0.000385,y:0.16002},{x:-0.000385,y:-0.16002}],color:\"primary\",fill:!1,strokeWidth:0.012},\"path30-9-2\":{type:\"path\",points:[{x:0.156026,y:0.2},{x:0.085846,y:0.2}],color:\"primary\",fill:!1,strokeWidth:0.012},\"path30-9-2-9\":{type:\"path\",points:[{x:0.120936,y:0.16491},{x:0.120936,y:0.23509}],color:\"primary\",fill:!1,strokeWidth:0.012}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.42,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.42,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.3,y:0},right1:{x:0.3,y:0}},bounds:{minX:-0.3,maxX:0.3,minY:-0.55,maxY:0.55,width:0.6,height:1.1,centerX:0,centerY:0},circles:{\"viewbox-padding-min\":{type:\"circle\",x:-0.3,y:-0.55,radius:0,fill:!1,color:\"transparent\"},\"viewbox-padding-max\":{type:\"circle\",x:0.3,y:0.55,radius:0,fill:!1,color:\"transparent\"}}},O8=Y(Wc).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"right1\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0.7,y:0.3}).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:-0.12,y:-0.3}).build(),W8=Y(Wc).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"right1\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),$8=Y(Wc).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"right1\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\",{x:0,y:0.78}).changeTextAnchor(\"{VAL}\",\"middle_top\",{x:0,y:-0.78}).build(),j8=Y(Wc).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"right1\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_left\",{x:-0.12,y:0.3}).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0.72,y:-0.3}).build(),X8=Y(Oc).rotateRightFacingSymbol(\"right\").changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),D8={...X8,size:{width:0.6,height:0.65}},$c={paths:{\"left-lead\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.06,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},\"left-plate\":{type:\"path\",points:[{x:-0.06,y:0.16},{x:-0.06,y:-0.16}],color:\"primary\",fill:!1,strokeWidth:0.012},\"right-plate\":{type:\"path\",points:[{x:0.06,y:0.16},{x:0.06,y:-0.16}],color:\"primary\",fill:!1,strokeWidth:0.012},\"right-lead\":{type:\"path\",points:[{x:0.06,y:0},{x:0.25,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},V8=yt($c,{kind:\"capacitor\",orientation:\"down\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),z8=yt($c,{kind:\"capacitor\",orientation:\"left\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),U8=yt($c,{kind:\"capacitor\",orientation:\"right\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),G8=yt($c,{kind:\"capacitor\",orientation:\"up\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),{paths:H8,texts:mnt,bounds:la,refblocks:K2,circles:Q8}=Oc,Z8=Y({primitives:[...Object.values(H8),...Object.values(Q8),{type:\"text\",text:\"{REF}\",x:0.2,y:-0.095},{type:\"text\",text:\"{VAL}\",x:-0.2,y:-0.095}],ports:[{...K2.left1,labels:[\"1\"]},{...K2.right1,labels:[\"2\"]}],size:{width:la.width,height:la.height},center:{x:la.centerX,y:la.centerY}}).changeTextAnchor(\"{VAL}\",\"top_left\").rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"bottom_left\").build(),q8={...Z8,size:{width:0.9,height:0.6}},jc={paths:{\"left-lead\":{type:\"path\",points:[{x:-0.175,y:0},{x:-0.05,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012},\"left-plate\":{type:\"path\",points:[{x:-0.05,y:0.14},{x:-0.05,y:-0.14}],color:\"primary\",fill:!1,strokeWidth:0.012},\"right-plate\":{type:\"path\",points:[{x:0.05,y:0.14},{x:0.05,y:-0.14}],color:\"primary\",fill:!1,strokeWidth:0.012},\"right-lead\":{type:\"path\",points:[{x:0.05,y:0},{x:0.175,y:0}],color:\"primary\",fill:!1,strokeWidth:0.012}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.175,y:0},right1:{x:0.175,y:0}},bounds:{minX:-0.175,maxX:0.175,minY:-0.25,maxY:0.25,width:0.35,height:0.5,centerX:0,centerY:0},circles:{}},J8=yt(jc,{kind:\"capacitor\",orientation:\"down\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),K8=yt(jc,{kind:\"capacitor\",orientation:\"left\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),tI=yt(jc,{kind:\"capacitor\",orientation:\"right\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),eI=yt(jc,{kind:\"capacitor\",orientation:\"up\",pin1Labels:[\"1\",\"pos\"],pin2Labels:[\"2\",\"neg\"]}),Bi={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.03}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0.03},{x:0.54,y:0.03}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.29,y:0.29},{x:0.29,y:-0.23}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.02,y:0.37},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:-0.37}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.03}},bounds:{minX:-0.57,maxX:0.57,minY:-0.37,maxY:0.37,width:1.14,height:0.74,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0.04,radius:0.29,color:\"primary\",fill:!1}}},{paths:rI,texts:unt,bounds:pa,refblocks:t9,circles:nI}=Bi,iI=Y({primitives:[...Object.values(rI),...Object.values(nI),{type:\"text\",text:\"{REF}\",x:-0.15,y:0.3894553499999995},{type:\"text\",text:\"{VAL}\",x:0.15,y:0.3894553499999995}],ports:[{...t9.left1,labels:[\"1\"]},{...t9.right1,labels:[\"2\"]}],size:{width:pa.width,height:pa.height},center:{x:pa.centerX,y:pa.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),oI=Y(Bi).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:sI,texts:fnt,bounds:ha,refblocks:e9,circles:aI}=Bi,cI=Y({primitives:[...Object.values(sI),...Object.values(aI),{type:\"text\",text:\"{REF}\",x:-0,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:0.3894553499999995}],ports:[{...e9.left1,labels:[\"1\"]},{...e9.right1,labels:[\"2\"]}],size:{width:ha.width,height:ha.height},center:{x:ha.centerX,y:ha.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),lI=Y(Bi).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\",\"neg\"]).labelPort(\"right1\",[\"2\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:pI,texts:ynt,bounds:da,refblocks:r9,circles:hI}=Bi,dI=Y({primitives:[...Object.values(pI),...Object.values(hI),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...r9.left1,labels:[\"1\"]},{...r9.right1,labels:[\"2\"]}],size:{width:da.width,height:da.height},center:{x:da.centerX,y:da.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:mI,texts:_nt,bounds:ma,refblocks:n9,circles:uI}=Bi,fI=Y({primitives:[...Object.values(mI),...Object.values(uI),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...n9.left1,labels:[\"1\"]},{...n9.right1,labels:[\"2\"]}],size:{width:ma.width,height:ma.height},center:{x:ma.centerX,y:ma.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Xc={paths:{path27:{type:\"path\",points:[{x:0.54,y:-0.01},{x:0.13,y:-0.01}],color:\"primary\",fill:!1},path29:{type:\"path\",points:[{x:0.13,y:0.25},{x:0.13,y:-0.27}],color:\"primary\",fill:!1},\"path29-2\":{type:\"path\",points:[{x:0.07,y:0.25},{x:0.07,y:-0.28}],color:\"primary\",fill:!1},path30:{type:\"path\",points:[{x:-0.14,y:0.25},{x:-0.14,y:-0.27}],color:\"primary\",fill:!1},\"path29-5\":{type:\"path\",points:[{x:-0.08,y:0.26},{x:-0.08,y:-0.27}],color:\"primary\",fill:!1},\"path29-2-7\":{type:\"path\",points:[{x:0.07,y:0.26},{x:-0.08,y:0.26}],color:\"primary\",fill:!1},\"path29-2-7-6\":{type:\"path\",points:[{x:0.07,y:-0.28},{x:-0.08,y:-0.28}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:-0.21,y:0.32},{x:0.2,y:0.32}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0,y:0.71},{x:0,y:0.33},{x:0,y:0.32}],color:\"primary\",fill:!1},\"path43-8\":{type:\"path\",points:[{x:-0.21,y:0.32},{x:-0.21,y:0.25}],color:\"primary\",fill:!1},\"path43-8-8\":{type:\"path\",points:[{x:0.2,y:0.32},{x:0.2,y:0.25}],color:\"primary\",fill:!1},\"path43-9\":{type:\"path\",points:[{x:0.19,y:-0.35},{x:-0.22,y:-0.35}],color:\"primary\",fill:!1},\"path44-0-5\":{type:\"path\",points:[{x:-0.02,y:-0.71},{x:-0.02,y:-0.36},{x:-0.02,y:-0.35}],color:\"primary\",fill:!1},\"path43-8-1\":{type:\"path\",points:[{x:0.19,y:-0.35},{x:0.19,y:-0.28}],color:\"primary\",fill:!1},\"path43-8-8-9\":{type:\"path\",points:[{x:-0.22,y:-0.35},{x:-0.22,y:-0.28}],color:\"primary\",fill:!1},path28:{type:\"path\",points:[{x:-0.14,y:-0.01},{x:-0.54,y:-0.01}],color:\"primary\",fill:!1}},texts:{left1:{type:\"text\",text:\"{REF}\",x:0.53,y:0.28},right1:{type:\"text\",text:\"{VAL}\",x:0.54,y:-0.28}},refblocks:{top1:{x:0,y:0.71},bottom1:{x:-0.02,y:-0.71},left1:{x:-0.54,y:-0.01},right1:{x:0.54,y:-0.01}},bounds:{minX:-0.57,maxX:0.57,minY:-0.74,maxY:0.74,width:1.14,height:1.48,centerX:0,centerY:0},circles:{}},{paths:yI,texts:gnt,bounds:ua,refblocks:fa,circles:_I}=Xc,gI=Y({primitives:[...Object.values(yI),...Object.values(_I),{type:\"text\",text:\"{REF}\",x:-0.4,y:0.4094554499999995},{type:\"text\",text:\"{VAL}\",x:0.4,y:0.4094553499999995}],ports:[{...fa.left1,labels:[\"1\"]},{...fa.right1,labels:[\"3\"]},{...fa.bottom1,labels:[\"2\"]},{...fa.top1,labels:[\"4\"]}],size:{width:ua.width,height:ua.height},center:{x:ua.centerX,y:ua.centerY}}).rotateRightFacingSymbol(\"down\").changeTextAnchor(\"{REF}\",\"bottom_left\").changeTextAnchor(\"{VAL}\",\"top_left\").build(),xI=Y(Xc).labelPort(\"top1\",[\"2\",\"gnd1\"]).labelPort(\"bottom1\",[\"4\",\"gnd2\"]).labelPort(\"left1\",[\"3\"]).labelPort(\"right1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"bottom_left\").changeTextAnchor(\"{VAL}\",\"top_left\").build(),bI=Y(Xc).labelPort(\"top1\",[\"4\",\"gnd1\"]).labelPort(\"bottom1\",[\"2\",\"gnd2\"]).labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"bottom_left\").changeTextAnchor(\"{VAL}\",\"top_left\").build(),{paths:vI,texts:xnt,bounds:ya,refblocks:_a,circles:SI}=Xc,wI=Y({primitives:[...Object.values(vI),...Object.values(SI),{type:\"text\",text:\"{VAL}\",x:-0.4,y:-0.4094554499999995},{type:\"text\",text:\"{REF}\",x:0.4,y:-0.4094553499999995}],ports:[{..._a.left1,labels:[\"1\"]},{..._a.right1,labels:[\"3\"]},{..._a.bottom1,labels:[\"2\"]},{..._a.top1,labels:[\"4\"]}],size:{width:ya.width,height:ya.height},center:{x:ya.centerX,y:ya.centerY}}).rotateRightFacingSymbol(\"up\").changeTextAnchor(\"{REF}\",\"bottom_left\").changeTextAnchor(\"{VAL}\",\"top_left\").build(),Dc={paths:{path27:{type:\"path\",points:[{x:0.55,y:-0.01},{x:0.13,y:-0.01}],color:\"primary\",fill:!1},path28:{type:\"path\",points:[{x:-0.14,y:-0.01},{x:-0.55,y:-0.01}],color:\"primary\",fill:!1},path29:{type:\"path\",points:[{x:0.13,y:-0.28},{x:0.13,y:0.25}],color:\"primary\",fill:!1},\"path29-2\":{type:\"path\",points:[{x:0.07,y:-0.28},{x:0.07,y:0.25}],color:\"primary\",fill:!1},path30:{type:\"path\",points:[{x:-0.14,y:-0.28},{x:-0.14,y:0.25}],color:\"primary\",fill:!1},\"path29-5\":{type:\"path\",points:[{x:-0.08,y:-0.28},{x:-0.08,y:0.25}],color:\"primary\",fill:!1},\"path29-2-7\":{type:\"path\",points:[{x:0.07,y:-0.28},{x:-0.08,y:-0.28}],color:\"primary\",fill:!1},\"path29-2-7-6\":{type:\"path\",points:[{x:0.07,y:0.26},{x:-0.08,y:0.26}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:-0.42},bottom1:{type:\"text\",text:\"{REF}\",x:0,y:0.43}},refblocks:{left1:{x:-0.55,y:-0.01},right1:{x:0.55,y:-0.01}},bounds:{minX:-0.58,maxX:0.58,minY:-0.52,maxY:0.43,width:1.16,height:1,centerX:0,centerY:-0.04},circles:{}},{paths:AI,texts:bnt,bounds:ga,refblocks:i9,circles:PI}=Dc,BI=Y({primitives:[...Object.values(AI),...Object.values(PI),{type:\"text\",text:\"{REF}\",x:-0.3,y:0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:0.3,y:0.3094553499999995}],ports:[{...i9.left1,labels:[\"1\"]},{...i9.right1,labels:[\"2\"]}],size:{width:ga.width,height:ga.height},center:{x:ga.centerX,y:ga.centerY}}).changeTextAnchor(\"{VAL}\",\"top_left\").rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"bottom_left\").build(),II=Y(Dc).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"right1\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),FI=Y(Dc).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:MI,texts:vnt,bounds:xa,refblocks:o9,circles:CI}=Dc,kI=Y({primitives:[...Object.values(MI),...Object.values(CI),{type:\"text\",text:\"{REF}\",x:0.3,y:-0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:-0.3094553499999995}],ports:[{...o9.left1,labels:[\"1\"]},{...o9.right1,labels:[\"2\"]}],size:{width:xa.width,height:xa.height},center:{x:xa.centerX,y:xa.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"bottom_left\").build(),Mo=0.6,kh=0.3,NI=[{type:\"path\",points:[{x:-Mo,y:0},{x:-kh,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:kh,y:0},{x:Mo,y:0}],color:\"primary\",fill:!1},{type:\"circle\",x:0,y:0,radius:kh,color:\"primary\",fill:!1},{type:\"path\",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:\"primary\",fill:!1}],YI=Y({primitives:[...NI,{type:\"text\",text:\"{REF}\",x:-0.2,y:0.35},{type:\"text\",text:\"{VAL}\",x:0.2,y:0.35}],ports:[{x:-Mo,y:0,labels:[\"1\"]},{x:Mo,y:0,labels:[\"2\"]}],center:{x:0,y:0},size:{width:Mo*2,height:0.9}}).rotateRightFacingSymbol(\"down\").changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Co=0.6,Nh=0.3,LI=[{type:\"path\",points:[{x:-Co,y:0},{x:-Nh,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:Nh,y:0},{x:Co,y:0}],color:\"primary\",fill:!1},{type:\"circle\",x:0,y:0,radius:Nh,color:\"primary\",fill:!1},{type:\"path\",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:\"primary\",fill:!1}],TI=Y({primitives:[...LI,{type:\"text\",text:\"{REF}\",x:0,y:-0.4},{type:\"text\",text:\"{VAL}\",x:0,y:0.4}],ports:[{x:-Co,y:0,labels:[\"1\"]},{x:Co,y:0,labels:[\"2\"]}],center:{x:0,y:0},size:{width:Co*2,height:0.9}}).rotateRightFacingSymbol(\"left\").changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),ko=0.6,Yh=0.3,EI=[{type:\"path\",points:[{x:-ko,y:0},{x:-Yh,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:Yh,y:0},{x:ko,y:0}],color:\"primary\",fill:!1},{type:\"circle\",x:0,y:0,radius:Yh,color:\"primary\",fill:!1},{type:\"path\",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:\"primary\",fill:!1}],RI=Y({primitives:[...EI,{type:\"text\",text:\"{REF}\",x:0,y:0.4},{type:\"text\",text:\"{VAL}\",x:0,y:-0.4}],ports:[{x:-ko,y:0,labels:[\"1\"]},{x:ko,y:0,labels:[\"2\"]}],center:{x:0,y:0},size:{width:ko*2,height:0.9}}).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),No=0.6,Lh=0.3,OI=[{type:\"path\",points:[{x:-No,y:0},{x:-Lh,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:Lh,y:0},{x:No,y:0}],color:\"primary\",fill:!1},{type:\"circle\",x:0,y:0,radius:Lh,color:\"primary\",fill:!1},{type:\"path\",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:\"primary\",fill:!1}],WI=Y({primitives:[...OI,{type:\"text\",text:\"{REF}\",x:0.2,y:-0.35},{type:\"text\",text:\"{VAL}\",x:-0.2,y:-0.35}],ports:[{x:-No,y:0,labels:[\"1\"]},{x:No,y:0,labels:[\"2\"]}],center:{x:0,y:0},size:{width:No*2,height:0.9}}).rotateRightFacingSymbol(\"up\").changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Ii={paths:{path11:{type:\"path\",points:[{x:1.99,y:-1.64},{x:2.1,y:-1.64}],color:\"primary\",fill:!1},\"path40-0\":{type:\"path\",points:[{x:2.1,y:-1.48},{x:2.1,y:-1.8}],color:\"primary\",fill:!1},\"path40-0-5\":{type:\"path\",points:[{x:2.22,y:-1.5},{x:2.11,y:-1.58}],color:\"primary\",fill:!1},\"path40-0-5-0\":{type:\"path\",points:[{x:2.23,y:-1.78},{x:2.11,y:-1.7}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:2.23,y:-1.49},{x:2.23,y:-1.14}],color:\"primary\",fill:!1},\"path12-1-5-3\":{type:\"path\",points:[{x:2.23,y:-1.97},{x:2.23,y:-1.79}],color:\"primary\",fill:!1},\"arrow-2\":{type:\"path\",points:[{x:2.17,y:-1.7},{x:2.13,y:-1.76},{x:2.19,y:-1.76},{x:2.17,y:-1.7}],color:\"primary\",fill:!0},path1:{type:\"path\",points:[{x:1.6,y:-1.5},{x:1.86,y:-1.5}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:1.87,y:-1.34},{x:1.87,y:-1.66}],color:\"primary\",fill:!1},path3:{type:\"path\",points:[{x:1.99,y:-1.36},{x:1.87,y:-1.44}],color:\"primary\",fill:!1},path4:{type:\"path\",points:[{x:1.99,y:-1.64},{x:1.88,y:-1.56}],color:\"primary\",fill:!1},\"arrow-1\":{type:\"path\",points:[{x:1.94,y:-1.56},{x:1.89,y:-1.62},{x:1.96,y:-1.62},{x:1.94,y:-1.56}],color:\"primary\",fill:!0},path9:{type:\"path\",points:[{x:1.99,y:-1.35},{x:2.23,y:-1.36}],color:\"primary\",fill:!1}},texts:{bottom1:{type:\"text\",text:\"{VAL}\",x:1.88,y:-1.94},right1:{type:\"text\",text:\"{REF}\",x:1.88,y:-1.14}},refblocks:{right1:{x:2.23,y:-1.97},right2:{x:1.6,y:-1.5},right3:{x:2.23,y:-1.14}},bounds:{minX:1.58,maxX:2.35,minY:-1.98,maxY:-1.12,width:0.77,height:0.86,centerX:1.96,centerY:-1.55},circles:{\"path1-0\":{type:\"circle\",x:2.05,y:-1.54,radius:0.3,color:\"primary\",fill:!1}}},$I=Y(Ii).rotateRightFacingSymbol(\"down\").labelPort(\"right2\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"3\"]).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0.8,y:-0.15}).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0,y:0.15}).build(),jI=Y(Ii).rotateRightFacingSymbol(\"right\").labelPort(\"right2\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"3\"]).changeTextAnchor(\"{VAL}\",\"middle_right\").changeTextAnchor(\"{REF}\",\"middle_right\").build(),XI=Y(Ii).rotateRightFacingSymbol(\"left\").labelPort(\"right2\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"3\"]).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0,y:-0.8}).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0,y:0.8}).build(),DI=Y(Ii).rotateRightFacingSymbol(\"right\").labelPort(\"right2\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"3\"]).changeTextAnchor(\"{VAL}\",\"middle_right\").changeTextAnchor(\"{REF}\",\"middle_right\").build(),VI=Y(Ii).rotateRightFacingSymbol(\"up\").labelPort(\"right2\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"3\"]).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0,y:-0.15}).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0.8,y:0.15}).build(),zI=Y(Ii).rotateRightFacingSymbol(\"up\").labelPort(\"right2\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"3\"]).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0,y:-0.15}).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0.8,y:0.15}).build(),UI={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:-0.12,y:0.09},{x:0.12,y:0.09}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.18,y:-0.45},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.35},left1:{type:\"text\",text:\"A\",x:0,y:-0.1}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:-0.09,maxY:0.09,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:s9,bounds:ba,refblocks:a9,circles:GI}=UI,Eo=Yt({primitives:[s9.path11,s9.path12,{type:\"path\",points:[{x:-0.12,y:0.14},{x:0.12,y:0.14}],color:\"primary\",fill:!1},...Object.values(GI),{type:\"text\",text:\"{REF}\",x:0,y:0.3594553499999995,anchor:\"middle_bottom\"},{type:\"text\",text:\"{VAL}\",x:0,y:-0.35,anchor:\"middle_top\"},{type:\"path\",points:[{x:-0.095,y:-0.16},{x:0,y:0.09}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:0,y:0.09},{x:0.095,y:-0.16}],color:\"primary\",fill:!1},{type:\"path\",points:[{x:-0.048,y:-0.045},{x:0.048,y:-0.045}],color:\"primary\",fill:!1}],ports:[{...a9.left1,labels:[\"1\"]},{...a9.right1,labels:[\"2\"]}],size:{width:ba.width,height:ba.height},center:{x:ba.centerX,y:ba.centerY}}),nd=structuredClone(Eo);nd.primitives=nd.primitives.map((t)=\u003et.type!==\"text\"?t:t.text===\"{REF}\"?{...t,x:-0.16,y:0.3594553499999995,anchor:\"middle_bottom\"}:t.text===\"{VAL}\"?{...t,x:0.16,y:0.35,anchor:\"middle_bottom\"}:t);var c9=Lo(nd,{newOrientation:\"down\"}),HI=wi(Eo),QI=Eo,id=structuredClone(Eo);id.primitives=id.primitives.map((t)=\u003et.type!==\"text\"?t:t.text===\"{REF}\"?{...t,x:0.16,y:-0.3594553499999995,anchor:\"middle_top\"}:t.text===\"{VAL}\"?{...t,x:-0.16,y:-0.35,anchor:\"middle_top\"}:t);var ZI=Lo(id,{newOrientation:\"up\"}),Fi={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.04}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0.04},{x:0.54,y:0.04}],color:\"primary\",fill:!1},\"path11-5-5\":{type:\"path\",points:[{x:0.1,y:0.13},{x:0,y:-0.06},{x:-0.11,y:0.13}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:-0.12,y:-0.14},{x:0.12,y:-0.14}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.17,y:0.4},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:-0.4}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.79,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0.04,radius:0.29,color:\"primary\",fill:!1}}},{paths:qI,texts:Snt,bounds:va,refblocks:l9,circles:JI}=Fi,KI=Y({primitives:[...Object.values(qI),...Object.values(JI),{type:\"text\",text:\"{REF}\",x:-0.15,y:0.3894553499999995},{type:\"text\",text:\"{VAL}\",x:0.15,y:0.3894553499999995}],ports:[{...l9.left1,labels:[\"1\"]},{...l9.right1,labels:[\"2\"]}],size:{width:va.width,height:va.height},center:{x:va.centerX,y:va.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:tF,texts:wnt,bounds:Sa,refblocks:p9,circles:eF}=Fi,rF=Y({primitives:[...Object.values(tF),...Object.values(eF),{type:\"text\",text:\"{REF}\",x:-0,y:0.3894553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.3294553499999995}],ports:[{...p9.left1,labels:[\"1\"]},{...p9.right1,labels:[\"2\"]}],size:{width:Sa.width,height:Sa.height},center:{x:Sa.centerX,y:Sa.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:nF,texts:Ant,bounds:wa,refblocks:h9,circles:iF}=Fi,oF=Y({primitives:[...Object.values(nF),...Object.values(iF),{type:\"text\",text:\"{REF}\",x:-0,y:-0.3294553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:0.4294553499999995}],ports:[{...h9.left1,labels:[\"1\"]},{...h9.right1,labels:[\"2\"]}],size:{width:wa.width,height:wa.height},center:{x:wa.centerX,y:wa.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:sF,texts:Pnt,bounds:Aa,refblocks:d9,circles:aF}=Fi,cF=Y({primitives:[...Object.values(sF),...Object.values(aF),{type:\"text\",text:\"{REF}\",x:-0,y:0.3894553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.3294553499999995}],ports:[{...d9.left1,labels:[\"1\"]},{...d9.right1,labels:[\"2\"]}],size:{width:Aa.width,height:Aa.height},center:{x:Aa.centerX,y:Aa.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:lF,texts:Bnt,bounds:Pa,refblocks:m9,circles:pF}=Fi,hF=Y({primitives:[...Object.values(lF),...Object.values(pF),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...m9.left1,labels:[\"1\"]},{...m9.right1,labels:[\"2\"]}],size:{width:Pa.width,height:Pa.height},center:{x:Pa.centerX,y:Pa.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:dF,texts:Int,bounds:Ba,refblocks:u9,circles:mF}=Fi,uF=Y({primitives:[...Object.values(dF),...Object.values(mF),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...u9.left1,labels:[\"1\"]},{...u9.right1,labels:[\"2\"]}],size:{width:Ba.width,height:Ba.height},center:{x:Ba.centerX,y:Ba.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Mi={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0.04},{x:-0.11,y:0.04}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.1,y:0.04},{x:0.54,y:0.04}],color:\"primary\",fill:!1},\"path11-0\":{type:\"path\",points:[{x:-0.09,y:-0.15},{x:-0.09,y:0.26}],color:\"primary\",fill:!1},\"path11-0-3\":{type:\"path\",points:[{x:0.09,y:-0.15},{x:0.09,y:0.26}],color:\"primary\",fill:!1},\"path11-0-9\":{type:\"path\",points:[{x:-0.08,y:0.06},{x:-0.08,y:-0.15},{x:0.09,y:-0.05},{x:-0.08,y:0.06}],color:\"primary\",fill:!0},\"path11-0-9-0\":{type:\"path\",points:[{x:0.08,y:0.26},{x:0.08,y:0.05},{x:-0.09,y:0.15},{x:0.07,y:0.26}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.03,y:0.42},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.03,y:-0.42}},refblocks:{left1:{x:-0.54,y:0.04},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.42,maxY:0.42,width:1.14,height:0.83,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0.05,radius:0.29,color:\"primary\",fill:!1}}},fF=Y(Mi).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\",{x:-0.03,y:0.2}).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0.8,y:-0.2}).build(),yF=Y(Mi).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\",{x:0,y:0.1}).changeTextAnchor(\"{VAL}\",\"middle_top\").build(),_F=Y(Mi).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\",{x:0,y:0.8}).changeTextAnchor(\"{VAL}\",\"middle_top\",{x:0,y:-0.9}).build(),gF=Y(Mi).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\",{x:0,y:0.1}).changeTextAnchor(\"{VAL}\",\"middle_top\").build(),xF=Y(Mi).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0.7,y:0.2}).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:-0.13,y:-0.2}).build(),bF=Y(Mi).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0.7,y:0.2}).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:-0.13,y:-0.2}).build(),Vc={paths:{triangle:{type:\"path\",points:[{x:-0.06,y:-0.09},{x:-0.06,y:0.09},{x:0.06,y:0},{x:-0.06,y:-0.09}],color:\"primary\",fill:!1},stem:{type:\"path\",points:[{x:-0.11,y:0},{x:-0.06,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.03}},refblocks:{left1:{x:-0.11,y:0}},bounds:{minX:-0.57,maxX:0.57,minY:-0.37,maxY:0.37,width:1.14,height:0.74,centerX:0,centerY:0},circles:{}},{paths:vF,bounds:f9,refblocks:SF}=Vc,wF=Y({primitives:[...Object.values(vF),{type:\"text\",text:\"{REF}\",x:-0.13,y:-0}],ports:[{...SF.left1,labels:[\"1\"]}],center:{x:f9.centerX,y:f9.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_top\").build(),{paths:AF,bounds:y9,refblocks:PF}=Vc,BF=Y({primitives:[...Object.values(AF),{type:\"text\",text:\"{REF}\",x:-0.13,y:0}],ports:[{...PF.left1,labels:[\"1\"]}],center:{x:y9.centerX,y:y9.centerY}}).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_right\").build(),{paths:IF,bounds:_9,refblocks:FF}=Vc,MF=Y({primitives:[...Object.values(IF),{type:\"text\",text:\"{REF}\",x:-0.13,y:-0}],ports:[{...FF.left1,labels:[\"1\"]}],center:{x:_9.centerX,y:_9.centerY}}).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),{paths:CF,bounds:g9,refblocks:kF}=Vc,NF=Y({primitives:[...Object.values(CF),{type:\"text\",text:\"{REF}\",x:-0.13,y:0}],ports:[{...kF.left1,labels:[\"1\"]}],center:{x:g9.centerX,y:g9.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),YF={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},zc=Y(YF).labelPort(\"left1\",[\"1\",\"pos\",\"anode\"]).labelPort(\"right1\",[\"2\",\"neg\",\"cathode\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),LF=Z(zc,\"down\"),TF=Z(zc,\"left\"),Uc={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},EF=yt(Uc,{kind:\"diode\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),RF=yt(Uc,{kind:\"diode\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),OF=yt(Uc,{kind:\"diode\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),WF=yt(Uc,{kind:\"diode\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),$F=Z(zc,\"up\"),Gc={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.25,maxY:0.25,width:0.34999999999999987,height:0.5,centerX:0.00000000000000011102230246251565,centerY:0},circles:{}},jF=yt(Gc,{kind:\"diode\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),XF=yt(Gc,{kind:\"diode\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),DF=yt(Gc,{kind:\"diode\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),VF=yt(Gc,{kind:\"diode\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),zF={paths:{path1:{type:\"path\",points:[{x:-0.37,y:0.22},{x:-0.13,y:0.22}],color:\"primary\",fill:!1},\"path-1-2\":{type:\"path\",points:[{x:-0.07,y:0.22},{x:0.11,y:0.16}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.1,y:0.13},{x:0.37,y:0.13}],color:\"primary\",fill:!1},path3:{type:\"path\",points:[{x:0.12,y:0.36},{x:0.37,y:0.36}],color:\"primary\",fill:!1},path4:{type:\"path\",points:[{x:-0.37,y:-0.18},{x:-0.13,y:-0.18}],color:\"primary\",fill:!1},\"path4-5\":{type:\"path\",points:[{x:-0.07,y:-0.19},{x:0.1,y:-0.24}],color:\"primary\",fill:!1},path5:{type:\"path\",points:[{x:0.1,y:-0.27},{x:0.37,y:-0.27}],color:\"primary\",fill:!1},path6:{type:\"path\",points:[{x:0.12,y:-0.04},{x:0.37,y:-0.04}],color:\"primary\",fill:!1},\"path1-4-join\":{type:\"path\",points:[{x:0,y:-0.2},{x:0,y:0.19}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.56},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.42}},refblocks:{left1:{x:-0.37,y:0.22},left2:{x:-0.37,y:-0.18},right1:{x:0.37,y:0.36},right2:{x:0.37,y:0.13},right3:{x:0.37,y:-0.04},right5:{x:0.37,y:-0.27}},bounds:{minX:-0.4,maxX:0.4,minY:-0.47,maxY:0.56,width:1,height:1.04,centerX:0,centerY:0.05},circles:{\"circle-2\":{type:\"circle\",x:0.08,y:0.13,radius:0.02,color:\"primary\",fill:!1},\"circle-5\":{type:\"circle\",x:0.08,y:-0.27,radius:0.02,color:\"primary\",fill:!1},\"circle-3\":{type:\"circle\",x:0.08,y:0.37,radius:0.02,color:\"primary\",fill:!1},\"circle-6\":{type:\"circle\",x:0.08,y:-0.04,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.1,y:0.22,radius:0.02,color:\"primary\",fill:!1},\"circle-4\":{type:\"circle\",x:-0.1,y:-0.18,radius:0.02,color:\"primary\",fill:!1}}},Hc=Y(zF).labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"3\"]).labelPort(\"right2\",[\"2\"]).labelPort(\"right3\",[\"6\"]).labelPort(\"left2\",[\"4\"]).labelPort(\"right5\",[\"5\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),hd=Z(Hc,\"down\"),dd=hd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),md=hd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");dd.anchor=\"middle_bottom\";md.anchor=\"middle_top\";dd.x=0;dd.y+=0.537;md.y-=0.5375;md.x=0;var UF=hd,ud=Z(Hc,\"left\"),fd=ud.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),yd=ud.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");fd.anchor=\"middle_bottom\";yd.anchor=\"middle_top\";fd.x=0;fd.y+=1;yd.y-=1;yd.x=0;var GF=ud,_d=Z(Hc,\"up\"),gd=_d.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),xd=_d.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");gd.anchor=\"middle_bottom\";xd.anchor=\"middle_top\";gd.x=0;gd.y+=0.537;xd.y-=0.5375;xd.x=0;var HF=_d,QF={paths:{path1:{type:\"path\",points:[{x:-0.37,y:0.22},{x:-0.13,y:0.22}],color:\"primary\",fill:!1},\"path-1-3\":{type:\"path\",points:[{x:-0.07,y:0.23},{x:0.11,y:0.33}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.1,y:0.13},{x:0.37,y:0.13}],color:\"primary\",fill:!1},path3:{type:\"path\",points:[{x:0.12,y:0.36},{x:0.37,y:0.36}],color:\"primary\",fill:!1},path4:{type:\"path\",points:[{x:-0.37,y:-0.18},{x:-0.13,y:-0.18}],color:\"primary\",fill:!1},\"path4-6\":{type:\"path\",points:[{x:-0.07,y:-0.18},{x:0.11,y:-0.07}],color:\"primary\",fill:!1},path5:{type:\"path\",points:[{x:0.1,y:-0.27},{x:0.37,y:-0.27}],color:\"primary\",fill:!1},path6:{type:\"path\",points:[{x:0.12,y:-0.04},{x:0.37,y:-0.04}],color:\"primary\",fill:!1},\"path1-4-join\":{type:\"path\",points:[{x:0,y:-0.12},{x:0,y:0.27}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.61},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.52}},refblocks:{left1:{x:-0.37,y:0.22},left2:{x:-0.37,y:-0.18},right1:{x:0.37,y:0.36},right2:{x:0.37,y:0.13},right3:{x:0.37,y:-0.04},right5:{x:0.37,y:-0.27}},bounds:{minX:-0.4,maxX:0.4,minY:-0.47,maxY:0.56,width:1,height:1.04,centerX:0,centerY:0.05},circles:{\"circle-2\":{type:\"circle\",x:0.08,y:0.13,radius:0.02,color:\"primary\",fill:!1},\"circle-5\":{type:\"circle\",x:0.08,y:-0.27,radius:0.02,color:\"primary\",fill:!1},\"circle-3\":{type:\"circle\",x:0.08,y:0.37,radius:0.02,color:\"primary\",fill:!1},\"circle-6\":{type:\"circle\",x:0.08,y:-0.04,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.1,y:0.22,radius:0.02,color:\"primary\",fill:!1},\"circle-4\":{type:\"circle\",x:-0.1,y:-0.18,radius:0.02,color:\"primary\",fill:!1}}},Qc=Y(QF).labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"3\"]).labelPort(\"right2\",[\"2\"]).labelPort(\"right3\",[\"6\"]).labelPort(\"left2\",[\"4\"]).labelPort(\"right5\",[\"5\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),bd=Z(Qc,\"down\"),vd=bd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Sd=bd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");vd.anchor=\"middle_bottom\";Sd.anchor=\"middle_top\";vd.x=0;vd.y+=0.565;Sd.y-=0.555;Sd.x=0;var ZF=bd,wd=Z(Qc,\"left\"),Ad=wd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Pd=wd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Ad.anchor=\"middle_bottom\";Pd.anchor=\"middle_top\";Ad.x=0;Ad.y+=1.09;Pd.y-=1.09;Pd.x=0;var qF=wd,Bd=Z(Qc,\"up\"),Id=Bd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Fd=Bd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Id.anchor=\"middle_bottom\";Fd.anchor=\"middle_top\";Id.x=0;Id.y+=0.565;Fd.y-=0.555;Fd.x=0;var JF=Bd,KF={paths:{path11:{type:\"path\",points:[{x:-0.38,y:0.06},{x:-0.14,y:0.06}],color:\"primary\",fill:!1},\"path11-0\":{type:\"path\",points:[{x:-0.09,y:0.07},{x:0.11,y:0.11}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.13,y:0.06},{x:0.38,y:0.06}],color:\"primary\",fill:!1},\"path11-5\":{type:\"path\",points:[{x:-0.38,y:-0.17},{x:-0.14,y:-0.17}],color:\"primary\",fill:!1},\"path11-0-3\":{type:\"path\",points:[{x:-0.09,y:-0.17},{x:0.11,y:-0.12}],color:\"primary\",fill:!1},\"path12-0\":{type:\"path\",points:[{x:0.13,y:-0.17},{x:0.38,y:-0.17}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.31},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.31}},refblocks:{left1:{x:-0.38,y:-0.17},left3:{x:-0.38,y:0.06},right1:{x:0.38,y:-0.17},right3:{x:0.38,y:0.06}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.81,height:0.79,centerX:0,centerY:0},circles:{\"circle-4\":{type:\"circle\",x:0.1,y:0.06,radius:0.02,color:\"primary\",fill:!1},\"circle-2\":{type:\"circle\",x:0.1,y:-0.17,radius:0.02,color:\"primary\",fill:!1},\"circle-3\":{type:\"circle\",x:-0.11,y:0.06,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.11,y:-0.17,radius:0.02,color:\"primary\",fill:!1}}},Zc=Y(KF).labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"4\"]).labelPort(\"left3\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),Md=Z(Zc,\"down\"),Cd=Md.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),kd=Md.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Cd.anchor=\"middle_bottom\";kd.anchor=\"middle_top\";Cd.x=0.4;Cd.y+=0.265;kd.y-=0.265;kd.x=0.4;var t6=Md,Nd=Z(Zc,\"left\"),Yd=Nd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Ld=Nd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Yd.anchor=\"middle_bottom\";Ld.anchor=\"middle_top\";Yd.x=0;Yd.y+=0.67;Ld.y-=0.67;Ld.x=0;var e6=Nd,Td=Z(Zc,\"up\"),Ed=Td.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Rd=Td.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Ed.anchor=\"middle_bottom\";Rd.anchor=\"middle_top\";Ed.x=0.46;Ed.y+=0.265;Rd.y-=0.265;Rd.x=0.46;var r6=Td,n6={paths:{path11:{type:\"path\",points:[{x:-0.38,y:0.06},{x:-0.14,y:0.06}],color:\"primary\",fill:!1},\"path11-0\":{type:\"path\",points:[{x:-0.09,y:0.07},{x:0.1,y:0.2}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.13,y:0.06},{x:0.38,y:0.06}],color:\"primary\",fill:!1},\"path11-5\":{type:\"path\",points:[{x:-0.38,y:-0.17},{x:-0.14,y:-0.17}],color:\"primary\",fill:!1},\"path11-0-3\":{type:\"path\",points:[{x:-0.09,y:-0.16},{x:0.1,y:-0.03}],color:\"primary\",fill:!1},\"path12-0\":{type:\"path\",points:[{x:0.13,y:-0.17},{x:0.38,y:-0.17}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.42},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.42}},refblocks:{left1:{x:-0.38,y:-0.17},left3:{x:-0.38,y:0.06},right1:{x:0.38,y:-0.17},right3:{x:0.38,y:0.06}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.81,height:0.79,centerX:0,centerY:0},circles:{\"circle-4\":{type:\"circle\",x:0.1,y:0.06,radius:0.02,color:\"primary\",fill:!1},\"circle-2\":{type:\"circle\",x:0.1,y:-0.17,radius:0.02,color:\"primary\",fill:!1},\"circle-3\":{type:\"circle\",x:-0.11,y:0.06,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.11,y:-0.17,radius:0.02,color:\"primary\",fill:!1}}},qc=Y(n6).labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"right3\",[\"4\"]).labelPort(\"left3\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),Od=Z(qc,\"down\"),Wd=Od.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),$d=Od.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Wd.anchor=\"middle_bottom\";$d.anchor=\"middle_top\";Wd.x=0.4;Wd.y+=0.295;$d.y-=0.295;$d.x=0.42;var i6=Od,jd=Z(qc,\"left\"),Xd=jd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Dd=jd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Xd.anchor=\"middle_bottom\";Dd.anchor=\"middle_top\";Xd.x=0;Xd.y+=0.795;Dd.y-=0.795;Dd.x=0;var o6=jd,Vd=Z(qc,\"up\"),zd=Vd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Ud=Vd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");zd.anchor=\"middle_bottom\";Ud.anchor=\"middle_top\";zd.x=0.46;zd.y+=0.315;Ud.y-=0.315;Ud.x=0.46;var s6=Vd,Xv={paths:{path5:{type:\"path\",points:[{x:-0.44,y:0},{x:-0.16,y:0}],color:\"primary\",fill:!1},path6:{type:\"path\",points:[{x:0.17,y:0},{x:0.44,y:0.01}],color:\"primary\",fill:!1},path9:{type:\"path\",points:[{x:-0.25,y:-0.16},{x:0.02,y:0.3},{x:0.25,y:0.17},{x:-0.02,y:-0.29},{x:-0.25,y:-0.16}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.37},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.37}},refblocks:{left1:{x:-0.44,y:0},right1:{x:0.44,y:0.01}},bounds:{minX:-0.57,maxX:0.57,minY:-0.25,maxY:0.25,width:1.13,height:0.5,centerX:0,centerY:0},circles:{}},{paths:a6,texts:Fnt,bounds:Ia,refblocks:x9,circles:c6}=Xv,Dv=Y({primitives:[...Object.values(a6),...Object.values(c6),{type:\"text\",text:\"{REF}\",x:0.18,y:-0.3204553499999995},{type:\"text\",text:\"{VAL}\",x:-0.25,y:-0.3294553499999995}],ports:[{...x9.left1,labels:[\"1\"]},{...x9.right1,labels:[\"2\"]}],size:{width:Ia.width,height:Ia.height},center:{x:Ia.centerX,y:Ia.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Gd=Si(Dv),Hd=Gd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Qd=Gd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Hd.anchor=\"middle_left\";Qd.anchor=\"middle_left\";Hd.y+=0.4;Hd.x=0.32;Qd.y-=0.45;Qd.x=0.32;var l6=Gd,Vv=Y(Xv).labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),p6=wi(Vv),Ci={paths:{path11:{type:\"path\",points:[{x:-0.56,y:0.04},{x:-0.22,y:0.04}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.14,y:0.05},{x:0.48,y:0.05}],color:\"primary\",fill:!1},\"path12-6\":{type:\"path\",points:[{x:0.14,y:-0.15},{x:0.14,y:0.25}],color:\"primary\",fill:!1},\"path11-0-9\":{type:\"path\",points:[{x:-0.22,y:0.25},{x:-0.21,y:-0.15},{x:0.14,y:0.05},{x:-0.22,y:0.25}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.09,y:0.38},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.07,y:-0.38},right1:{type:\"text\",text:\"\",x:0.59,y:-0.33}},refblocks:{left1:{x:-0.56,y:0.04},right1:{x:0.48,y:0.05}},bounds:{minX:-0.59,maxX:0.59,minY:-0.38,maxY:0.38,width:1.18,height:0.76,centerX:0,centerY:0},circles:{}},{paths:h6,texts:Mnt,bounds:Fa,refblocks:b9,circles:d6}=Ci,m6=Y({primitives:[...Object.values(h6),...Object.values(d6),{type:\"text\",text:\"{REF}\",x:-0.15,y:0.3294553499999995},{type:\"text\",text:\"{VAL}\",x:0.15,y:0.3294553499999995}],ports:[{...b9.left1,labels:[\"1\"]},{...b9.right1,labels:[\"2\"]}],size:{width:Fa.width,height:Fa.height},center:{x:Fa.centerX,y:Fa.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:u6,texts:Cnt,bounds:Ma,refblocks:v9,circles:f6}=Ci,y6=Y({primitives:[...Object.values(u6),...Object.values(f6),{type:\"text\",text:\"{REF}\",x:-0,y:0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.4094553499999995}],ports:[{...v9.left1,labels:[\"1\"]},{...v9.right1,labels:[\"2\"]}],size:{width:Ma.width,height:Ma.height},center:{x:Ma.centerX,y:Ma.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:_6,texts:knt,bounds:Ca,refblocks:S9,circles:g6}=Ci,x6=Y({primitives:[...Object.values(_6),...Object.values(g6),{type:\"text\",text:\"{REF}\",x:-0,y:-0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:0.4094553499999995}],ports:[{...S9.left1,labels:[\"1\"]},{...S9.right1,labels:[\"2\"]}],size:{width:Ca.width,height:Ca.height},center:{x:Ca.centerX,y:Ca.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_bottom\").rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:b6,texts:Nnt,bounds:ka,refblocks:w9,circles:v6}=Ci,S6=Y({primitives:[...Object.values(b6),...Object.values(v6),{type:\"text\",text:\"{REF}\",x:-0,y:0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.4094553499999995}],ports:[{...w9.left1,labels:[\"1\"]},{...w9.right1,labels:[\"2\"]}],size:{width:ka.width,height:ka.height},center:{x:ka.centerX,y:ka.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:w6,texts:Ynt,bounds:Na,refblocks:A9,circles:A6}=Ci,P6=Y({primitives:[...Object.values(w6),...Object.values(A6),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...A9.left1,labels:[\"1\"]},{...A9.right1,labels:[\"2\"]}],size:{width:Na.width,height:Na.height},center:{x:Na.centerX,y:Na.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:B6,texts:Lnt,bounds:Ya,refblocks:P9,circles:I6}=Ci,F6=Y({primitives:[...Object.values(B6),...Object.values(I6),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2894553499999995}],ports:[{...P9.left1,labels:[\"1\"]},{...P9.right1,labels:[\"2\"]}],size:{width:Ya.width,height:Ya.height},center:{x:Ya.centerX,y:Ya.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),M6={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.18,y:-0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.43},left1:{type:\"text\",text:\"Hz\",x:0,y:-0.04}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:-0.01,y:-0.01,radius:0.29,color:\"primary\",fill:!1}}},{paths:C6,texts:k6,bounds:La,refblocks:B9,circles:N6}=M6,Zd=Yt({primitives:[...Object.values(C6),...Object.values(N6),{type:\"text\",text:\"{REF}\",x:0,y:-0.3594553499999995,anchor:\"middle_top\"},{type:\"text\",text:\"{VAL}\",x:0,y:0.35,anchor:\"middle_bottom\"},{...k6.left1,x:0,y:0.01,anchor:\"center\",fontSize:0.2}],ports:[{...B9.left1,labels:[\"1\"]},{...B9.right1,labels:[\"2\"]}],size:{width:La.width,height:La.height},center:{x:La.centerX,y:La.centerY}}),{5:Y6,...L6}=Zd.primitives;function T6(t){return typeof t==\"object\"}var I9=Z({...Zd,primitives:Object.values(L6).filter(T6)}),E6={...I9,primitives:[...I9.primitives,Y6]},R6={paths:{path10:{type:\"path\",points:[{x:-0.53,y:0.04},{x:0.53,y:0.04}],color:\"primary\",fill:!1},path14:{type:\"path\",points:[{x:0,y:0.17},{x:0.27,y:0.17},{x:0.27,y:-0.1},{x:-0.26,y:-0.1},{x:-0.26,y:0.17},{x:0,y:0.17}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.24},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.17,y:-0.24}},refblocks:{left1:{x:-0.53,y:0.04},right1:{x:0.53,y:0.04}},bounds:{minX:-0.56,maxX:0.56,minY:-0.24,maxY:0.24,width:1.13,height:0.47,centerX:0,centerY:0},circles:{}},{paths:O6,texts:W6,bounds:Ta,refblocks:F9}=R6,zv=Yt({primitives:[...Object.values(O6),{...W6.top1,anchor:\"middle_bottom\"},{type:\"text\",text:\"{VAL}\",x:0,y:-0.2,anchor:\"middle_top\"}],ports:[{...F9.left1,labels:[\"1\"]},{...F9.right1,labels:[\"2\"]}],size:{width:Ta.width,height:Ta.height},center:{x:Ta.centerX,y:Ta.centerY}}),$6=Z(zv),ki={paths:{path1:{type:\"path\",points:[{x:-0.29,y:0.01},{x:0.04,y:0}],color:\"primary\",fill:!0},path2:{type:\"path\",points:[{x:0.04,y:-0.22},{x:0.04,y:0.22}],color:\"primary\",fill:!0},path3:{type:\"path\",points:[{x:0.12,y:-0.17},{x:0.12,y:0.17}],color:\"primary\",fill:!0},path4:{type:\"path\",points:[{x:0.19,y:-0.06},{x:0.19,y:0.06}],color:\"primary\",fill:!0}},texts:{right1:{type:\"text\",text:\"{REF}\",x:0.31,y:-0.02}},refblocks:{left1:{x:-0.29,y:0.01}},bounds:{minX:-0.31,maxX:0.31,minY:-0.22,maxY:0.22,width:0.62,height:0.45,centerX:0,centerY:0},circles:{}},j6=Y(ki).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_top\").build(),X6=Y(ki).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),D6=Y(ki).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_right\").build(),V6=Y(ki).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),z6=Y(ki).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),U6=Y(ki).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),qd={paths:{path11:{type:\"path\",points:[{x:-0.52,y:0.03},{x:-0.18,y:0.04}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.19,y:0.04},{x:0.52,y:0.04}],color:\"primary\",fill:!1},\"path11-0-9\":{type:\"path\",points:[{x:-0.31,y:0.2},{x:-0.31,y:-0.11},{x:-0.01,y:0.04},{x:-0.3,y:0.2}],color:\"primary\",fill:!0},\"path11-0-9-5\":{type:\"path\",points:[{x:0.33,y:0.2},{x:0.33,y:-0.1},{x:0.04,y:0.04},{x:0.33,y:0.2}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.04,y:0.32},bottom1:{type:\"text\",text:\"{VAL}\",x:0.04,y:-0.32}},refblocks:{left1:{x:-0.52,y:0.03},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.32,maxY:0.32,width:1.09,height:0.63,centerX:0,centerY:0},circles:{}},{paths:Tnt,texts:Ent,bounds:Rnt,refblocks:Ont,circles:Wnt}=qd,G6=Y(qd).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),H6=Y(qd).rotateRightFacingSymbol(\"down\").changeTextAnchor(\"{VAL}\",\"middle_right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),Q6={paths:{path45:{type:\"path\",points:[{x:0.14,y:0},{x:-0.13,y:-0.14}],color:\"primary\",fill:!1},\"path1-8\":{type:\"path\",points:[{x:0.13,y:0},{x:0.3,y:0}],color:\"primary\",fill:!1},path46:{type:\"path\",points:[{x:-0.13,y:0.13},{x:0.14,y:0}],color:\"primary\",fill:!1},path47:{type:\"path\",points:[{x:-0.13,y:-0.14},{x:-0.13,y:0.13}],color:\"primary\",fill:!1},path48:{type:\"path\",points:[{x:0.14,y:0.13},{x:0.14,y:-0.14}],color:\"primary\",fill:!1},path49:{type:\"path\",points:[{x:-0.13,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path25:{type:\"path\",points:[{x:0.16,y:0.29},{x:0.25,y:0.3},{x:0.22,y:0.21}],color:\"primary\",fill:!0},path78:{type:\"path\",points:[{x:0.08,y:0.17},{x:0.09,y:0.17},{x:0.21,y:0.27},{x:0.21,y:0.27}],color:\"primary\",fill:!1},\"path25-0\":{type:\"path\",points:[{x:-0.02,y:0.31},{x:0.08,y:0.32},{x:0.04,y:0.23}],color:\"primary\",fill:!0},\"path78-6\":{type:\"path\",points:[{x:-0.1,y:0.19},{x:-0.09,y:0.2},{x:0.04,y:0.29},{x:0.04,y:0.29}],color:\"primary\",fill:!1},box:{type:\"path\",points:[{x:-0.3,y:-0.4},{x:0.3,y:-0.4},{x:0.3,y:0.4},{x:-0.3,y:0.4},{x:-0.3,y:-0.4},{x:-0.3,y:0.4}],color:\"primary\",fill:!1},\"path48-1\":{type:\"path\",points:[{x:-0.3,y:0.13},{x:-0.54,y:0.13}],color:\"primary\",fill:!1},\"path48-2\":{type:\"path\",points:[{x:-0.3,y:-0.13},{x:-0.54,y:-0.13}],color:\"primary\",fill:!1},\"path48-3\":{type:\"path\",points:[{x:0.3,y:-0.13},{x:0.54,y:-0.13}],color:\"primary\",fill:!1},\"path48-4\":{type:\"path\",points:[{x:0.3,y:0.13},{x:0.54,y:0.13}],color:\"primary\",fill:!1}},texts:{bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.43},right1:{type:\"text\",text:\"{REF}\",x:0,y:0.43}},refblocks:{left1:{x:-0.54,y:0.13},left2:{x:-0.54,y:-0.13},right1:{x:0.54,y:-0.13},right2:{x:0.54,y:0.13}},bounds:{minX:-0.56,maxX:0.56,minY:-0.32,maxY:0.32,width:1.13,height:0.65,centerX:0,centerY:0},circles:{}},Jc=Y(Q6).labelPort(\"left1\",[\"1\",\"DIN\"]).labelPort(\"left2\",[\"2\",\"POWER\"]).labelPort(\"right1\",[\"3\",\"GND\"]).labelPort(\"right2\",[\"4\",\"DOUT\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),Z6=Z(Jc,\"down\"),q6=wi(Jc),Jd=Z(Jc,\"up\"),Kd=Jd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),tm=Jd.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Kd.anchor=\"middle_left\";tm.anchor=\"middle_left\";Kd.y+=0.21;Kd.x=0.44;tm.y-=0.21;tm.x=0.44;var J6=Jd,K6={paths:{path11:{type:\"path\",points:[{x:-0.4,y:0},{x:-0.01,y:0}],color:\"primary\",fill:!1},path40:{type:\"path\",points:[{x:0.07,y:0.19},{x:0.07,y:-0.18}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:0.01,y:-0.12},{x:0.01,y:0.14}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.28,y:-0.25},{x:0.28,y:-0.56}],color:\"primary\",fill:!1},\"path12-1\":{type:\"path\",points:[{x:0.28,y:0.56},{x:0.28,y:0.27}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.17,y:-0.22},{x:0.28,y:-0.23},{x:0.23,y:-0.14}],color:\"primary\",fill:!0},path17:{type:\"path\",points:[{x:0.08,y:-0.09},{x:0.23,y:-0.2}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.07,y:0.11},{x:0.28,y:0.26}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:0.02,y:-0.42}},refblocks:{top1:{x:0.28,y:0.56},bottom1:{x:0.28,y:-0.56},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.17,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.14,y:0.01,radius:0.29,color:\"primary\",fill:!1}}},Uv=Y(K6).changeTextAnchor(\"{VAL}\",\"middle_right\").labelPort(\"left1\",[\"3\"]).labelPort(\"top1\",[\"2\"]).labelPort(\"bottom1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_right\").build(),em=Z(Uv),rm=em.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Gv=em.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");rm.anchor=\"middle_left\";Gv.anchor=\"middle_right\";rm.x=0.45;rm.y+=0.065;Gv.y+=0.065;var t7=em,e7={paths:{\"path12-1-8-6-9\":{type:\"path\",points:[{x:0.02,y:-0.02},{x:0.02,y:-0.1}],color:\"primary\",fill:!1},\"path12-1-5-6\":{type:\"path\",points:[{x:-0.47,y:-0.19},{x:-0.17,y:-0.19}],color:\"primary\",fill:!1},\"path12-1-5-6-8\":{type:\"path\",points:[{x:0.02,y:0.17},{x:0.02,y:0.11}],color:\"primary\",fill:!1},\"path12-1-8-0\":{type:\"path\",points:[{x:-0.15,y:-0.03},{x:0.2,y:-0.19}],color:\"primary\",fill:!1},\"path12-1-0\":{type:\"path\",points:[{x:0.2,y:-0.19},{x:0.47,y:-0.19}],color:\"primary\",fill:!1},\"path12-1-8-6-9-4\":{type:\"path\",points:[{x:0.02,y:0.12},{x:0.02,y:0.02}],color:\"primary\",fill:!1},\"path12-1-8-6-9-4-3\":{type:\"path\",points:[{x:0.08,y:0.11},{x:0.08,y:0.05}],color:\"primary\",fill:!1},\"path12-1-8-6-9-4-3-1\":{type:\"path\",points:[{x:-0.04,y:0.11},{x:-0.04,y:0.05}],color:\"primary\",fill:!1},\"path12-1-8-6-9-4-4\":{type:\"path\",points:[{x:0.08,y:0.11},{x:-0.04,y:0.11}],color:\"primary\",fill:!1},\"path14-5\":{type:\"path\",points:[{x:-0.01,y:0.28},{x:0.01,y:0.25},{x:0.04,y:0.23},{x:0.06,y:0.2}],color:\"primary\",fill:!0},\"path14-5-3\":{type:\"path\",points:[{x:-0.01,y:0.2},{x:0.01,y:0.23},{x:0.04,y:0.25},{x:0.06,y:0.28}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.01,y:0.38},bottom1:{type:\"text\",text:\"{VAL}\",x:0.06,y:-0.38}},refblocks:{left1:{x:-0.47,y:-0.19},right1:{x:0.47,y:-0.19}},bounds:{minX:-0.5,maxX:0.5,minY:-0.38,maxY:0.38,width:1,height:0.76,centerX:0,centerY:0},circles:{path9:{type:\"circle\",x:0.02,y:0.24,radius:0.06,color:\"primary\",fill:!1}}},Hv=Y(e7).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),Qv=Z(Hv),Zv=Qv.primitives.filter((t)=\u003et.type===\"text\"),nm=Zv.find((t)=\u003et.text===\"{VAL}\");nm.x=-0.35;nm.y=0;nm.anchor=\"middle_right\";var im=Zv.find((t)=\u003et.text===\"{REF}\");im.y=0;im.x=0.35;im.anchor=\"middle_left\";var r7=Qv,Kc={paths:{path8698:{type:\"path\",points:[{x:-0.19796749999999919,y:-0.023826854587889912},{x:-0.2004570399999992,y:-0.018993393814014044},{x:-0.2029465799999992,y:-0.014174384106555204},{x:-0.20543611999999922,y:-0.009384187436300498},{x:-0.20792565999999923,y:-0.004636988132081332},{x:-0.21041519999999925,y:0.00005329457033053167},{x:-0.21290473999999926,y:0.004673092344940184},{x:-0.21539427999999927,y:0.009209271428771242},{x:-0.21788381999999928,y:0.013649213595881985},{x:-0.2203733599999993,y:0.01798089395292432},{x:-0.2228628999999993,y:0.022192955076609913},{x:-0.22535243999999932,y:0.02627477703600152},{x:-0.22784197999999933,y:0.030216542867918667},{x:-0.23033151999999935,y:0.03400929910178016},{x:-0.23282105999999936,y:0.03764501096072756},{x:-0.23531059999999937,y:0.04111661189869628},{x:-0.23780013999999938,y:0.04441804716802203},{x:-0.2402896799999994,y:0.04754431114897349},{x:-0.2427792199999994,y:0.05049147821106258},{x:-0.24526875999999942,y:0.053256726915861724},{x:-0.24775829999999943,y:0.05583835741211009},{x:-0.25024783999999944,y:0.05823580191586174},{x:-0.25273737999999946,y:0.060449628211062575},{x:-0.25522691999999947,y:0.0624815361489735},{x:-0.2577164599999995,y:0.06433434716802203},{x:-0.2602059999999995,y:0.06601198689869628},{x:-0.2626955399999995,y:0.06751946096072757},{x:-0.2651850799999995,y:0.06886282410178016},{x:-0.26767461999999953,y:0.07004914286791866},{x:-0.27016415999999954,y:0.0710864520360015},{x:-0.27265369999999955,y:0.07198370507660991},{x:-0.27514323999999957,y:0.07275071895292433},{x:-0.2776327799999996,y:0.07339811359588198},{x:-0.2801223199999996,y:0.07393724642877124},{x:-0.2826118599999996,y:0.07438014234494018},{x:-0.2851013999999996,y:0.07473941957033053},{x:-0.28759093999999963,y:0.07502821186791866},{x:-0.29008047999999964,y:0.07526008756369952},{x:-0.29257001999999965,y:0.07544896589344477},{x:-0.29505955999999967,y:0.07560903118598594},{x:-0.2975490999999997,y:0.07575464541211008},{x:-0.30003863749999965,y:0.07560903118598594},{x:-0.3025281749999997,y:0.07544896589344477},{x:-0.30501771249999965,y:0.07526008756369951},{x:-0.3075072499999996,y:0.07502821186791866},{x:-0.30999678749999965,y:0.07473941957033052},{x:-0.3124863249999996,y:0.07438014234494018},{x:-0.3149758624999996,y:0.07393724642877124},{x:-0.31746539999999956,y:0.07339811359588198},{x:-0.3199549374999996,y:0.07275071895292431},{x:-0.32244447499999956,y:0.07198370507660991},{x:-0.32493401249999954,y:0.0710864520360015},{x:-0.32742354999999956,y:0.07004914286791866},{x:-0.32991308749999954,y:0.06886282410178016},{x:-0.3324026249999995,y:0.06751946096072756},{x:-0.33489216249999954,y:0.06601198689869628},{x:-0.3373816999999995,y:0.06433434716802203},{x:-0.3398712374999995,y:0.06248153614897349},{x:-0.3423607749999995,y:0.06044962821106258},{x:-0.3448503124999994,y:0.05823580191586174},{x:-0.34733984999999945,y:0.05583835741211009},{x:-0.3498293874999995,y:0.053256726915861724},{x:-0.35231892499999945,y:0.050491478211062576},{x:-0.3548084624999994,y:0.0475443111489735},{x:-0.3572979999999994,y:0.04441804716802203},{x:-0.35978753749999937,y:0.04111661189869628},{x:-0.3622770749999994,y:0.03764501096072756},{x:-0.36476661249999937,y:0.03400929910178016},{x:-0.36725614999999934,y:0.030216542867918673},{x:-0.36974568749999936,y:0.02627477703600152},{x:-0.37223522499999934,y:0.022192955076609917},{x:-0.3747247624999993,y:0.017980893952924324},{x:-0.37721429999999934,y:0.013649213595881985},{x:-0.3797038374999993,y:0.00920927142877125},{x:-0.3821933749999993,y:0.004673092344940191},{x:-0.3846829124999993,y:0.00005329457033053514},{x:-0.3871724499999993,y:-0.004636988132081328},{x:-0.38966198749999925,y:-0.009384187436300498},{x:-0.3921515249999992,y:-0.014174384106555197},{x:-0.39464106249999925,y:-0.01899339381401404},{x:-0.3971305999999992,y:-0.023826854587889912}],color:\"primary\",fill:!1},path8700:{type:\"path\",points:[{x:0.0011955000000007932,y:-0.02382615458789039},{x:-0.00129403749999919,y:-0.01899269131401453},{x:-0.0037835749999991734,y:-0.014173679106555696},{x:-0.006273112499999156,y:-0.009383479936300985},{x:-0.00876264999999914,y:-0.004636278132081827},{x:-0.011252187499999122,y:0.00005400707033003174},{x:-0.013741724999999105,y:0.004673807344939681},{x:-0.016231262499999087,y:0.009209988928770731},{x:-0.018720799999999073,y:0.013649933595881476},{x:-0.021210337499999055,y:0.017981616452923805},{x:-0.023699874999999038,y:0.022193680076609393},{x:-0.026189412499999024,y:0.026275504536001},{x:-0.028678949999999002,y:0.030217272867918137},{x:-0.03116848749999899,y:0.034010031601779636},{x:-0.03365802499999897,y:0.03764574596072702},{x:-0.03614756249999895,y:0.04111734939869574},{x:-0.03863709999999894,y:0.04441878716802149},{x:-0.04112663749999892,y:0.04754505364897295},{x:-0.043616174999998904,y:0.05049222321106203},{x:-0.04610571249999888,y:0.05325747441586117},{x:-0.04859524999999887,y:0.055839107412109526},{x:-0.051084787499998854,y:0.05823655441586117},{x:-0.05357432499999884,y:0.06045038321106201},{x:-0.05606386249999881,y:0.06248229364897292},{x:-0.0585533999999988,y:0.06433510716802145},{x:-0.061042937499998784,y:0.0660127493986957},{x:-0.06353247499999877,y:0.06752022596072697},{x:-0.06602201249999876,y:0.06886359160177957},{x:-0.06851154999999873,y:0.07004991286791806},{x:-0.07100108749999871,y:0.07108722453600091},{x:-0.0734906249999987,y:0.0719844800766093},{x:-0.07598016249999869,y:0.07275149645292371},{x:-0.07846969999999867,y:0.07339889359588138},{x:-0.08095923749999864,y:0.07393802892877062},{x:-0.08344877499999863,y:0.07438092734493956},{x:-0.08593831249999861,y:0.07474020707032991},{x:-0.0884278499999986,y:0.07502900186791804},{x:-0.09091738749999859,y:0.07526088006369888},{x:-0.09340692499999856,y:0.07544976089344414},{x:-0.09589646249999854,y:0.0756098286859853},{x:-0.09838599999999853,y:0.07575544541210943},{x:-0.10087553999999854,y:0.0756098286859853},{x:-0.10336507999999855,y:0.07544976089344414},{x:-0.10585461999999857,y:0.07526088006369887},{x:-0.10834415999999858,y:0.07502900186791804},{x:-0.11083369999999859,y:0.0747402070703299},{x:-0.1133232399999986,y:0.07438092734493956},{x:-0.11581277999999862,y:0.07393802892877062},{x:-0.11830231999999863,y:0.07339889359588138},{x:-0.12079185999999864,y:0.07275149645292371},{x:-0.12328139999999865,y:0.0719844800766093},{x:-0.12577093999999867,y:0.07108722453600091},{x:-0.12826047999999868,y:0.07004991286791806},{x:-0.1307500199999987,y:0.06886359160177957},{x:-0.1332395599999987,y:0.06752022596072697},{x:-0.13572909999999871,y:0.0660127493986957},{x:-0.13821863999999873,y:0.06433510716802145},{x:-0.14070817999999874,y:0.06248229364897291},{x:-0.14319771999999875,y:0.06045038321106202},{x:-0.14568725999999876,y:0.05823655441586117},{x:-0.14817679999999878,y:0.055839107412109526},{x:-0.1506663399999988,y:0.05325747441586117},{x:-0.1531558799999988,y:0.05049222321106202},{x:-0.1556454199999988,y:0.047545053648972956},{x:-0.15813495999999883,y:0.04441878716802149},{x:-0.16062449999999884,y:0.04111734939869574},{x:-0.16311403999999885,y:0.03764574596072702},{x:-0.16560357999999886,y:0.034010031601779636},{x:-0.16809311999999887,y:0.03021727286791814},{x:-0.1705826599999989,y:0.026275504536001},{x:-0.1730721999999989,y:0.022193680076609396},{x:-0.1755617399999989,y:0.017981616452923805},{x:-0.17805127999999892,y:0.013649933595881474},{x:-0.18054081999999894,y:0.00920998892877074},{x:-0.18303035999999895,y:0.0046738073449396865},{x:-0.18551989999999896,y:0.00005400707033003521},{x:-0.18800943999999897,y:-0.004636278132081827},{x:-0.19049897999999899,y:-0.009383479936300985},{x:-0.192988519999999,y:-0.01417367910655569},{x:-0.19547805999999898,y:-0.018992691314014522},{x:-0.19796759999999902,y:-0.02382615458789039}],color:\"primary\",fill:!1},path8702:{type:\"path\",points:[{x:0.2003586000000006,y:-0.02382615458789039},{x:0.19786906000000057,y:-0.01899269131401453},{x:0.19537952000000058,y:-0.014173679106555696},{x:0.19288998000000057,y:-0.009383479936300985},{x:0.1904004400000006,y:-0.004636278132081827},{x:0.18791090000000055,y:0.00005400707033003174},{x:0.1854213600000005,y:0.004673807344939681},{x:0.18293182000000052,y:0.009209988928770731},{x:0.1804422800000005,y:0.013649933595881476},{x:0.17795274000000053,y:0.017981616452923805},{x:0.17546320000000049,y:0.022193680076609393},{x:0.17297366000000047,y:0.026275504536001},{x:0.17048412000000046,y:0.030217272867918137},{x:0.16799458000000045,y:0.034010031601779636},{x:0.16550504000000044,y:0.03764574596072702},{x:0.16301550000000042,y:0.04111734939869574},{x:0.1605259600000004,y:0.04441878716802149},{x:0.1580364200000004,y:0.04754505364897295},{x:0.1555468800000004,y:0.05049222321106203},{x:0.15305734000000037,y:0.05325747441586117},{x:0.15056780000000036,y:0.055839107412109526},{x:0.14807826000000035,y:0.05823655441586117},{x:0.14558872000000034,y:0.06045038321106201},{x:0.14309918000000033,y:0.06248229364897292},{x:0.1406096400000003,y:0.06433510716802145},{x:0.1381201000000003,y:0.0660127493986957},{x:0.1356305600000003,y:0.06752022596072697},{x:0.13314102000000028,y:0.06886359160177957},{x:0.13065148000000026,y:0.07004991286791806},{x:0.12816194000000025,y:0.07108722453600091},{x:0.12567240000000024,y:0.0719844800766093},{x:0.12318286000000023,y:0.07275149645292371},{x:0.12069332000000021,y:0.07339889359588138},{x:0.1182037800000002,y:0.07393802892877062},{x:0.11571424000000019,y:0.07438092734493956},{x:0.11322470000000018,y:0.07474020707032991},{x:0.11073516000000017,y:0.07502900186791804},{x:0.10824562000000015,y:0.07526088006369888},{x:0.10575608000000014,y:0.07544976089344414},{x:0.10326654000000013,y:0.0756098286859853},{x:0.10077700000000012,y:0.07575544541210943},{x:0.09828746250000013,y:0.0756098286859853},{x:0.09579792500000014,y:0.07544976089344414},{x:0.09330838750000017,y:0.07526088006369887},{x:0.09081885000000019,y:0.07502900186791804},{x:0.0883293125000002,y:0.0747402070703299},{x:0.08583977500000022,y:0.07438092734493956},{x:0.08335023750000023,y:0.07393802892877062},{x:0.08086070000000026,y:0.07339889359588138},{x:0.07837116250000027,y:0.07275149645292371},{x:0.07588162500000029,y:0.0719844800766093},{x:0.0733920875000003,y:0.07108722453600091},{x:0.07090255000000031,y:0.07004991286791806},{x:0.06841301250000034,y:0.06886359160177957},{x:0.06592347500000036,y:0.06752022596072697},{x:0.06343393750000037,y:0.0660127493986957},{x:0.060944400000000384,y:0.06433510716802145},{x:0.0584548625000004,y:0.06248229364897291},{x:0.05596532500000043,y:0.06045038321106202},{x:0.05347578750000044,y:0.05823655441586117},{x:0.050986250000000455,y:0.055839107412109526},{x:0.04849671250000047,y:0.05325747441586117},{x:0.04600717500000048,y:0.05049222321106202},{x:0.04351763750000051,y:0.047545053648972956},{x:0.041028100000000525,y:0.04441878716802149},{x:0.03853856250000054,y:0.04111734939869574},{x:0.036049025000000554,y:0.03764574596072702},{x:0.03355948750000057,y:0.034010031601779636},{x:0.031069950000000596,y:0.03021727286791814},{x:0.02858041250000061,y:0.026275504536001},{x:0.026090875000000624,y:0.022193680076609396},{x:0.023601337500000638,y:0.017981616452923805},{x:0.021111800000000652,y:0.013649933595881474},{x:0.01862226250000068,y:0.00920998892877074},{x:0.016132725000000694,y:0.0046738073449396865},{x:0.013643187500000709,y:0.00005400707033003521},{x:0.011153650000000723,y:-0.004636278132081827},{x:0.008664112500000737,y:-0.009383479936300985},{x:0.006174575000000764,y:-0.01417367910655569},{x:0.0036850375000007786,y:-0.018992691314014522},{x:0.0011955000000007932,y:-0.02382615458789039}],color:\"primary\",fill:!1},path8704:{type:\"path\",points:[{x:0.3995216000000006,y:-0.02382615458789039},{x:0.39703206250000056,y:-0.01899269131401453},{x:0.3945425250000006,y:-0.014173679106555696},{x:0.3920529875000006,y:-0.009383479936300985},{x:0.38956345000000064,y:-0.004636278132081827},{x:0.38707391250000067,y:0.00005400707033003174},{x:0.3845843750000007,y:0.004673807344939681},{x:0.38209483750000073,y:0.009209988928770731},{x:0.37960530000000076,y:0.013649933595881476},{x:0.3771157625000008,y:0.017981616452923805},{x:0.37462622500000076,y:0.022193680076609393},{x:0.37213668750000073,y:0.026275504536001},{x:0.36964715000000076,y:0.030217272867918137},{x:0.3671576125000008,y:0.034010031601779636},{x:0.3646680750000008,y:0.03764574596072702},{x:0.36217853750000084,y:0.04111734939869574},{x:0.3596890000000008,y:0.04441878716802149},{x:0.3571994625000009,y:0.04754505364897295},{x:0.35470992500000087,y:0.05049222321106203},{x:0.35222038750000095,y:0.05325747441586117},{x:0.3497308500000009,y:0.055839107412109526},{x:0.3472413125000009,y:0.05823655441586117},{x:0.344751775000001,y:0.06045038321106201},{x:0.34226223750000095,y:0.06248229364897292},{x:0.33977270000000104,y:0.06433510716802145},{x:0.337283162500001,y:0.0660127493986957},{x:0.334793625000001,y:0.06752022596072697},{x:0.33230408750000107,y:0.06886359160177957},{x:0.3298145500000011,y:0.07004991286791806},{x:0.32732501250000107,y:0.07108722453600091},{x:0.3248354750000011,y:0.0719844800766093},{x:0.3223459375000011,y:0.07275149645292371},{x:0.3198564000000011,y:0.07339889359588138},{x:0.3173668625000012,y:0.07393802892877062},{x:0.31487732500000115,y:0.07438092734493956},{x:0.3123877875000012,y:0.07474020707032991},{x:0.3098982500000012,y:0.07502900186791804},{x:0.30740871250000124,y:0.07526088006369888},{x:0.30491917500000126,y:0.07544976089344414},{x:0.30242963750000124,y:0.0756098286859853},{x:0.29994010000000126,y:0.07575544541210943},{x:0.29745056000000125,y:0.0756098286859853},{x:0.29496102000000124,y:0.07544976089344414},{x:0.2924714800000012,y:0.07526088006369887},{x:0.2899819400000012,y:0.07502900186791804},{x:0.2874924000000012,y:0.0747402070703299},{x:0.2850028600000012,y:0.07438092734493956},{x:0.2825133200000012,y:0.07393802892877062},{x:0.28002378000000117,y:0.07339889359588138},{x:0.27753424000000115,y:0.07275149645292371},{x:0.27504470000000114,y:0.0719844800766093},{x:0.27255516000000113,y:0.07108722453600091},{x:0.2700656200000011,y:0.07004991286791806},{x:0.2675760800000011,y:0.06886359160177957},{x:0.2650865400000011,y:0.06752022596072697},{x:0.2625970000000011,y:0.0660127493986957},{x:0.26010746000000107,y:0.06433510716802145},{x:0.25761792000000105,y:0.06248229364897291},{x:0.25512838000000104,y:0.06045038321106202},{x:0.25263884000000103,y:0.05823655441586117},{x:0.250149300000001,y:0.055839107412109526},{x:0.247659760000001,y:0.05325747441586117},{x:0.245170220000001,y:0.05049222321106202},{x:0.24268068000000098,y:0.047545053648972956},{x:0.24019114000000097,y:0.04441878716802149},{x:0.23770160000000096,y:0.04111734939869574},{x:0.23521206000000094,y:0.03764574596072702},{x:0.23272252000000093,y:0.034010031601779636},{x:0.23023298000000092,y:0.03021727286791814},{x:0.2277434400000009,y:0.026275504536001},{x:0.2252539000000009,y:0.022193680076609396},{x:0.22276436000000088,y:0.017981616452923805},{x:0.22027482000000087,y:0.013649933595881474},{x:0.21778528000000086,y:0.00920998892877074},{x:0.21529574000000085,y:0.0046738073449396865},{x:0.21280620000000083,y:0.00005400707033003521},{x:0.21031666000000082,y:-0.004636278132081827},{x:0.2078271200000008,y:-0.009383479936300985},{x:0.2053375800000008,y:-0.01417367910655569},{x:0.20284804000000078,y:-0.018992691314014522},{x:0.20035850000000077,y:-0.02382615458789039}],color:\"primary\",fill:!1},path8706:{type:\"path\",points:[{x:-0.40026109999999937,y:-0.022544054587890106},{x:-0.5272914999999991,y:-0.022544054587890106}],color:\"primary\",fill:!1},\"path8706-5\":{type:\"path\",points:[{x:0.5282280000000006,y:-0.027111054587890093},{x:0.4011975999999997,y:-0.027111054587890093}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.0020145999999989783,y:0.22997364541210996},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.002185205294839676,y:-0.22997364541210996}},refblocks:{left1:{x:-0.5279125,y:-0.021272154587890446},right1:{x:0.5279125,y:-0.026521254587889898}},bounds:{minX:-0.556070941,maxX:0.556070941,minY:-0.22997364541210996,maxY:0.22997364541210996,width:1.112141882,height:0.4599472908242199,centerX:0,centerY:0},circles:{}},n7=Y(Kc).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_right\",{x:-0.5,y:0}).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0.5,y:0}).build(),i7=Y(Kc).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\",{x:0,y:0.5}).changeTextAnchor(\"{VAL}\",\"middle_top\",{x:0,y:-0.5}).build(),o7=Y(Kc).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),s7=Y(Kc).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_right\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),qv={paths:{path11:{type:\"path\",points:[{x:-0.54,y:-0.06},{x:-0.15,y:-0.06}],color:\"primary\",fill:!1},path40:{type:\"path\",points:[{x:0.13,y:-0.05},{x:-0.13,y:-0.18}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.13,y:0.08},{x:0.13,y:-0.05}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.13,y:-0.18},{x:-0.13,y:0.08}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.13,y:0.08},{x:0.13,y:-0.18}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.14,y:-0.05},{x:0.54,y:-0.06}],color:\"primary\",fill:!1},\"path25-0-9-8\":{type:\"path\",points:[{x:-0.03,y:0.39},{x:-0.05,y:0.47},{x:-0.08,y:0.39}],color:\"primary\",fill:!0},\"path78-6-5-5\":{type:\"path\",points:[{x:-0.05,y:0.27},{x:-0.05,y:0.29},{x:-0.05,y:0.41},{x:-0.05,y:0.42}],color:\"primary\",fill:!1},\"path25-0-9-8-2\":{type:\"path\",points:[{x:0.07,y:0.39},{x:0.04,y:0.47},{x:0.02,y:0.39}],color:\"primary\",fill:!0},\"path78-6-5-5-7\":{type:\"path\",points:[{x:0.04,y:0.27},{x:0.04,y:0.29},{x:0.04,y:0.41},{x:0.04,y:0.42}],color:\"primary\",fill:!1},\"path43-1\":{type:\"path\",points:[{x:0.03,y:0.06},{x:0.03,y:-0.16}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.38,y:0.38},bottom1:{type:\"text\",text:\"{VAL}\",x:0.38,y:-0.47}},refblocks:{left1:{x:-0.54,y:-0.06},right1:{x:0.54,y:-0.06}},bounds:{minX:-0.57,maxX:0.57,minY:-0.47,maxY:0.47,width:1.14,height:0.93,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:-0.05,radius:0.29,color:\"primary\",fill:!1}}};qv.bounds.width+=0.2;var tl=Y(qv).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\",\"anode\",\"pos\"]).labelPort(\"right1\",[\"2\",\"cathode\",\"neg\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),om=Z(tl,\"down\"),sm=om.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),am=om.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");sm.anchor=\"middle_left\";am.anchor=\"middle_left\";sm.y+=0.9;sm.x=0.3;am.y-=0.1;am.x=0.3;var a7=om,cm=Z(tl,\"left\"),lm=cm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),pm=cm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");lm.anchor=\"middle_left\";pm.anchor=\"middle_left\";lm.y+=0.71;lm.x=0.44;pm.y-=0.71;pm.x=0.44;var c7=cm,hm=Z(tl,\"up\"),dm=hm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),mm=hm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");dm.anchor=\"middle_left\";mm.anchor=\"middle_left\";dm.y+=0.1;dm.x=0.3;mm.y-=0.71;mm.x=0.3;var l7=hm,p7={paths:{path45:{type:\"path\",points:[{x:0.14,y:0},{x:-0.13,y:-0.14}],color:\"primary\",fill:!1},\"path1-8\":{type:\"path\",points:[{x:0.13,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1},path46:{type:\"path\",points:[{x:-0.13,y:0.13},{x:0.14,y:0}],color:\"primary\",fill:!1},path47:{type:\"path\",points:[{x:-0.13,y:-0.14},{x:-0.13,y:0.13}],color:\"primary\",fill:!1},path48:{type:\"path\",points:[{x:0.14,y:0.13},{x:0.14,y:-0.14}],color:\"primary\",fill:!1},path49:{type:\"path\",points:[{x:-0.13,y:0},{x:-0.54,y:0}],color:\"primary\",fill:!1},path25:{type:\"path\",points:[{x:0.16,y:0.29},{x:0.25,y:0.3},{x:0.22,y:0.21}],color:\"primary\",fill:!0},path78:{type:\"path\",points:[{x:0.08,y:0.17},{x:0.09,y:0.17},{x:0.21,y:0.27},{x:0.21,y:0.27}],color:\"primary\",fill:!1},\"path25-0\":{type:\"path\",points:[{x:-0.02,y:0.31},{x:0.08,y:0.32},{x:0.04,y:0.23}],color:\"primary\",fill:!0},\"path78-6\":{type:\"path\",points:[{x:-0.1,y:0.19},{x:-0.09,y:0.2},{x:0.04,y:0.29},{x:0.04,y:0.29}],color:\"primary\",fill:!1}},texts:{bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.21},right1:{type:\"text\",text:\"{REF}\",x:0,y:0.41}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.56,maxX:0.56,minY:-0.32,maxY:0.32,width:1.13,height:0.65,centerX:0,centerY:0},circles:{}},{paths:h7,texts:M9,bounds:Ea,refblocks:C9,circles:d7}=p7,um=Yt({primitives:[...Object.values(h7),...Object.values(d7),{...M9.bottom1,anchor:\"middle_top\"},{...M9.right1,anchor:\"middle_bottom\"}],ports:[{...C9.left1,labels:[\"1\",\"anode\",\"pos\"]},{...C9.right1,labels:[\"2\",\"cathode\",\"neg\"]}],size:{width:Ea.width,height:Ea.height},center:{x:Ea.centerX,y:Ea.centerY}}),fm=Z(um,\"up\"),ym=fm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),_m=fm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");ym.anchor=\"middle_left\";_m.anchor=\"middle_left\";ym.y+=0.21;ym.x=0.21;_m.y-=0.21;_m.x=0.21;var Jv=fm,gm=Si(Jv),xm=gm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),bm=gm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");xm.anchor=\"middle_left\";bm.anchor=\"middle_left\";xm.y+=0.4;xm.x=0.2;bm.y-=0.41;bm.x=0.2;var m7=gm,u7=wi(um),el={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:\"primary\",fill:!1},\"emission-0-shaft\":{type:\"path\",points:[{x:-0.11999999999999988,y:0.15999999999999992},{x:-0.030000000000000027,y:0.29000000000000004}],color:\"primary\",fill:!1},\"emission-0-head\":{type:\"path\",points:[{x:-0.08499999999999996,y:0.2699999999999998},{x:-0.030000000000000027,y:0.29000000000000004},{x:-0.030000000000000027,y:0.22999999999999998}],color:\"primary\",fill:!1},\"emission-1-shaft\":{type:\"path\",points:[{x:0,y:0.15999999999999992},{x:0.09000000000000008,y:0.29000000000000004}],color:\"primary\",fill:!1},\"emission-1-head\":{type:\"path\",points:[{x:0.03500000000000014,y:0.2699999999999998},{x:0.09000000000000008,y:0.29000000000000004},{x:0.09000000000000008,y:0.22999999999999998}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.3999999999999999},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.40000000000000013}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.40000000000000013,maxY:0.3999999999999999,width:0.5,height:0.8,centerX:0,centerY:-0.00000000000000011102230246251565},circles:{}},f7=yt(el,{kind:\"led\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),y7=yt(el,{kind:\"led\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),_7=yt(el,{kind:\"led\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),g7=yt(el,{kind:\"led\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),rl={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:\"primary\",fill:!1},\"emission-0-shaft\":{type:\"path\",points:[{x:-0.11999999999999988,y:0.15999999999999992},{x:-0.030000000000000027,y:0.29000000000000004}],color:\"primary\",fill:!1},\"emission-0-head\":{type:\"path\",points:[{x:-0.08499999999999996,y:0.2699999999999998},{x:-0.030000000000000027,y:0.29000000000000004},{x:-0.030000000000000027,y:0.22999999999999998}],color:\"primary\",fill:!1},\"emission-1-shaft\":{type:\"path\",points:[{x:0,y:0.15999999999999992},{x:0.09000000000000008,y:0.29000000000000004}],color:\"primary\",fill:!1},\"emission-1-head\":{type:\"path\",points:[{x:0.03500000000000014,y:0.2699999999999998},{x:0.09000000000000008,y:0.29000000000000004},{x:0.09000000000000008,y:0.22999999999999998}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.3999999999999999},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.40000000000000013}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.40000000000000013,maxY:0.3999999999999999,width:0.34999999999999987,height:0.8,centerX:0.00000000000000011102230246251565,centerY:-0.00000000000000011102230246251565},circles:{}},x7=yt(rl,{kind:\"led\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),b7=yt(rl,{kind:\"led\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),v7=yt(rl,{kind:\"led\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),S7=yt(rl,{kind:\"led\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),w7={paths:{path11:{type:\"path\",points:[{x:-0.52,y:-0.01},{x:-0.18,y:-0.01}],color:\"primary\",fill:!1},\"path11-2\":{type:\"path\",points:[{x:-0.17,y:-0.11},{x:-0.17,y:0.08}],color:\"primary\",fill:!1},\"path11-5\":{type:\"path\",points:[{x:-0.17,y:-0.12},{x:0.16,y:-0.12}],color:\"primary\",fill:!1},\"path11-5-5\":{type:\"path\",points:[{x:-0.17,y:0.08},{x:0.16,y:0.08}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.17,y:-0.01},{x:0.52,y:-0.01}],color:\"primary\",fill:!1},\"path11-2-1\":{type:\"path\",points:[{x:0.16,y:-0.12},{x:0.16,y:0.08}],color:\"primary\",fill:!1},\"path25-0-9\":{type:\"path\",points:[{x:-0.4,y:-0.21},{x:-0.33,y:-0.18},{x:-0.34,y:-0.27}],color:\"primary\",fill:!0},\"path78-6-5\":{type:\"path\",points:[{x:-0.45,y:-0.34},{x:-0.44,y:-0.32},{x:-0.35,y:-0.22},{x:-0.35,y:-0.22}],color:\"primary\",fill:!1},\"path25-0-9-0\":{type:\"path\",points:[{x:-0.3,y:-0.34},{x:-0.22,y:-0.31},{x:-0.24,y:-0.4}],color:\"primary\",fill:!0},\"path78-6-5-9\":{type:\"path\",points:[{x:-0.35,y:-0.46},{x:-0.34,y:-0.45},{x:-0.25,y:-0.35},{x:-0.25,y:-0.35}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.17,y:-0.41},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.46}},refblocks:{left1:{x:-0.52,y:-0.01},right1:{x:0.52,y:-0.01}},bounds:{minX:-0.55,maxX:0.55,minY:-0.51,maxY:0.46,width:1.1,height:0.62,centerX:0,centerY:-0.02},circles:{path1:{type:\"circle\",x:0,y:-0.02,radius:0.28,color:\"primary\",fill:!1}}},{paths:A7,texts:k9,bounds:Ra,refblocks:N9,circles:P7}=w7,Kv=Yt({primitives:[...Object.values(A7),...Object.values(P7),{...k9.top1,anchor:\"middle_left\",x:0},{...k9.bottom1,anchor:\"middle_left\",x:0}],ports:[{...N9.left1,labels:[\"1\"]},{...N9.right1,labels:[\"2\"]}],size:{width:Ra.width,height:Ra.height},center:{x:Ra.centerX,y:Ra.centerY}}),tS=Z(Kv),eS=tS.primitives.filter((t)=\u003et.type===\"text\"),vm=eS.find((t)=\u003et.text===\"{VAL}\");vm.x=-0.35;vm.y=0;vm.anchor=\"middle_right\";var Sm=eS.find((t)=\u003et.text===\"{REF}\");Sm.y=0;Sm.x=0.35;Sm.anchor=\"middle_left\";var B7=tS,I7={paths:{path208:{type:\"path\",points:[{x:0.38,y:0.13},{x:0.52,y:-0.13}],color:\"primary\",fill:!1},path209:{type:\"path\",points:[{x:0.25,y:-0.13},{x:0.38,y:0.13}],color:\"primary\",fill:!1},path210:{type:\"path\",points:[{x:0.52,y:-0.13},{x:0.25,y:-0.13}],color:\"primary\",fill:!1},path211:{type:\"path\",points:[{x:0.25,y:0.13},{x:0.52,y:0.13}],color:\"primary\",fill:!1},path212:{type:\"path\",points:[{x:0.12,y:-0.4},{x:0.38,y:-0.4}],color:\"primary\",fill:!1},path213:{type:\"path\",points:[{x:0.38,y:0.4},{x:0.12,y:0.4}],color:\"primary\",fill:!1},path214:{type:\"path\",points:[{x:0.12,y:0.54},{x:0.12,y:0.18}],color:\"primary\",fill:!1},path215:{type:\"path\",points:[{x:0.12,y:-0.54},{x:0.12,y:0}],color:\"primary\",fill:!1},path216:{type:\"path\",points:[{x:0.38,y:-0.4},{x:0.38,y:0.4}],color:\"primary\",fill:!1},path217:{type:\"path\",points:[{x:-0.14,y:0.26},{x:-0.14,y:-0.27}],color:\"primary\",fill:!1},path218:{type:\"path\",points:[{x:-0.22,y:-0.27},{x:-0.22,y:0.26}],color:\"primary\",fill:!1},path219:{type:\"path\",points:[{x:-0.54,y:-0.27},{x:-0.22,y:-0.27}],color:\"primary\",fill:!1},path220:{type:\"path\",points:[{x:-0.14,y:-0.19},{x:0.12,y:-0.19}],color:\"primary\",fill:!1},path221:{type:\"path\",points:[{x:-0.14,y:0.18},{x:0.12,y:0.18}],color:\"primary\",fill:!1},path222:{type:\"path\",points:[{x:-0.07,y:0},{x:0.12,y:0}],color:\"primary\",fill:!1}},texts:{right1:{type:\"text\",text:\"{VAL}\",x:0.57,y:0.02},right2:{type:\"text\",text:\"{REF}\",x:0.57,y:0.21}},refblocks:{top1:{x:0.12,y:0.54},bottom1:{x:0.12,y:-0.54},left1:{x:-0.54,y:-0.27}},bounds:{minX:-0.57,maxX:0.57,minY:-0.57,maxY:0.57,width:1.14,height:1.14,centerX:0,centerY:0},circles:{}};function Ro(t,e){return{width:Math.max(...e.map((r)=\u003eMath.abs(r.x-t.x)))*2,height:Math.max(...e.map((r)=\u003eMath.abs(r.y-t.y)))*2}}var{paths:F7,texts:Y9,bounds:L9,refblocks:gi}=I7,T9={x:L9.centerX+0.2,y:L9.centerY},rS=Yt({primitives:[...Object.values(F7),{...Y9.right1,anchor:\"middle_left\"},{...Y9.right2,anchor:\"middle_left\"}],ports:[{...gi.top1,labels:[\"1\"]},{...gi.bottom1,labels:[\"2\"]},{...gi.left1,labels:[\"3\"]}],size:Ro(T9,[gi.top1,gi.bottom1,gi.left1]),center:T9}),wm=Z(rS),nS=wm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Am=wm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");nS.anchor=\"middle_top\";Am.anchor=\"middle_top\";nS.x=Am.x;Am.y+=0.15;var M7=wm,C7={paths:{\"path12-1-8-6-9\":{type:\"path\",points:[{x:0.01,y:0.07},{x:0.01,y:-0.01}],color:\"primary\",fill:!1},\"path12-1-5-6\":{type:\"path\",points:[{x:-0.47,y:-0.09},{x:-0.17,y:-0.09}],color:\"primary\",fill:!1},\"path12-1-8-0\":{type:\"path\",points:[{x:-0.16,y:-0.01},{x:0.17,y:-0.01}],color:\"primary\",fill:!1},\"path12-1-0\":{type:\"path\",points:[{x:0.2,y:-0.09},{x:0.47,y:-0.09}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:-0.1,y:0.06},{x:-0.1,y:0.06},{x:-0.1,y:0.07},{x:-0.1,y:0.07},{x:-0.1,y:0.07},{x:-0.1,y:0.08},{x:-0.1,y:0.08},{x:-0.1,y:0.08},{x:-0.1,y:0.09},{x:-0.09,y:0.09},{x:-0.09,y:0.09},{x:-0.09,y:0.1},{x:-0.09,y:0.1},{x:-0.09,y:0.1},{x:-0.09,y:0.1},{x:-0.09,y:0.11},{x:-0.09,y:0.11},{x:-0.08,y:0.11},{x:-0.08,y:0.12},{x:-0.08,y:0.12},{x:-0.08,y:0.12},{x:-0.08,y:0.12},{x:-0.07,y:0.13},{x:-0.07,y:0.13},{x:-0.07,y:0.13},{x:-0.07,y:0.13},{x:-0.06,y:0.14},{x:-0.06,y:0.14},{x:-0.06,y:0.14},{x:-0.06,y:0.14},{x:-0.05,y:0.14},{x:-0.05,y:0.15},{x:-0.05,y:0.15},{x:-0.04,y:0.15},{x:-0.04,y:0.15},{x:-0.04,y:0.15},{x:-0.04,y:0.15},{x:-0.03,y:0.16},{x:-0.03,y:0.16},{x:-0.03,y:0.16},{x:-0.02,y:0.16},{x:-0.02,y:0.16},{x:-0.02,y:0.16},{x:-0.01,y:0.16},{x:-0.01,y:0.16},{x:0,y:0.16},{x:0,y:0.16},{x:0,y:0.16},{x:0.01,y:0.16},{x:0.01,y:0.16},{x:0.01,y:0.16},{x:0.02,y:0.16},{x:0.02,y:0.16},{x:0.02,y:0.16},{x:0.03,y:0.16},{x:0.03,y:0.16},{x:0.03,y:0.16},{x:0.04,y:0.16},{x:0.04,y:0.16},{x:0.04,y:0.16},{x:0.05,y:0.15},{x:0.05,y:0.15},{x:0.05,y:0.15},{x:0.06,y:0.15},{x:0.06,y:0.15},{x:0.06,y:0.15},{x:0.06,y:0.14},{x:0.07,y:0.14},{x:0.07,y:0.14},{x:0.07,y:0.14},{x:0.08,y:0.14},{x:0.08,y:0.13},{x:0.08,y:0.13},{x:0.08,y:0.13},{x:0.09,y:0.13},{x:0.09,y:0.12},{x:0.09,y:0.12},{x:0.09,y:0.12},{x:0.09,y:0.12},{x:0.1,y:0.11},{x:0.1,y:0.11},{x:0.1,y:0.1},{x:0.1,y:0.1},{x:0.11,y:0.09},{x:0.11,y:0.09},{x:0.11,y:0.09},{x:0.11,y:0.08},{x:0.11,y:0.08},{x:0.11,y:0.08},{x:0.11,y:0.07},{x:0.11,y:0.07},{x:0.11,y:0.07},{x:0.11,y:0.06},{x:0.11,y:0.06},{x:0.1,y:0.06},{x:0.1,y:0.06},{x:0.09,y:0.06},{x:0.09,y:0.06},{x:0.08,y:0.06},{x:0.07,y:0.06},{x:0.07,y:0.06},{x:0.06,y:0.06},{x:0.05,y:0.06},{x:0.05,y:0.06},{x:0.04,y:0.06},{x:0.03,y:0.06},{x:0.03,y:0.06},{x:0.02,y:0.06},{x:0.01,y:0.06},{x:0.01,y:0.06},{x:0,y:0.06},{x:-0.01,y:0.06},{x:-0.01,y:0.06},{x:-0.02,y:0.06},{x:-0.03,y:0.06},{x:-0.03,y:0.06},{x:-0.04,y:0.06},{x:-0.05,y:0.06},{x:-0.05,y:0.06},{x:-0.06,y:0.06},{x:-0.07,y:0.06},{x:-0.07,y:0.06},{x:-0.08,y:0.06},{x:-0.09,y:0.06},{x:-0.09,y:0.06}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.16,y:-0.27}},refblocks:{left1:{x:-0.47,y:-0.09},right1:{x:0.47,y:-0.09}},bounds:{minX:-0.5,maxX:0.5,minY:-0.27,maxY:0.27,width:1,height:0.53,centerX:0,centerY:0},circles:{}},{paths:k7,texts:E9,bounds:Oa,refblocks:R9,circles:N7}=C7,iS=Yt({primitives:[...Object.values(k7),...Object.values(N7),{...E9.top1,anchor:\"middle_bottom\",x:0},{...E9.bottom1,anchor:\"middle_top\",x:0}],ports:[{...R9.left1,labels:[\"1\"]},{...R9.right1,labels:[\"2\"]}],size:{width:Oa.width,height:Oa.height},center:{x:Oa.centerX+0.006,y:Oa.centerY+0.06}}),Pm=Z(iS),Yo=Pm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Fc=Pm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Yo.anchor=\"middle_left\";Fc.anchor=\"middle_right\";Yo.x=Yo.x-0.03;Yo.y=Yo.y;Fc.x=Fc.x;Fc.y=0;var Y7=Pm,Lt=({horizontalSymbol:t,verticalSymbol:e,gateSide:r,drainSide:n})=\u003e{let i=r===\"left\"||r===\"right\",s=n===\"left\"||n===\"right\";if(i===s)throw Error(`Invalid MOSFET orientation: gate ${r}, drain ${n}. Gate and drain must be perpendicular.`);let o=i?t:e;return(r===\"right\"||s\u0026\u0026n===\"left\")\u0026\u0026(o=wi(o)),(r===\"bottom\"||!s\u0026\u0026n===\"bottom\")\u0026\u0026(o=Si(o)),o},L7={paths:{path11:{type:\"path\",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:\"primary\",fill:!1},path40:{type:\"path\",points:[{x:0.09,y:0.19},{x:0.09,y:-0.18}],color:\"primary\",fill:!1},\"path12-1\":{type:\"path\",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:\"primary\",fill:!1},\"path2-5\":{type:\"path\",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.27,y:-0.04},{x:0.27,y:0.03},{x:0.2,y:0},{x:0.27,y:-0.04}],color:\"primary\",fill:!0},\"path2-0\":{type:\"path\",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},\"path12-1-0\":{type:\"path\",points:[{x:0.05,y:0.17},{x:0.05,y:-0.11}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.13,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.16,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:T7,texts:O9,bounds:W9,refblocks:zr,circles:E7}=L7,oS={x:W9.centerX,y:W9.centerY},R7={x:oS.x,y:zr.left1.y},ke=Yt({primitives:[...Object.values(T7),...Object.values(E7),{...O9.top1,anchor:\"middle_right\",x:0},{...O9.bottom1,anchor:\"middle_right\",x:0}],ports:[{...zr.top1,labels:[\"1\",\"drain\"]},{...zr.bottom1,labels:[\"2\",\"source\"]},{...zr.left1,labels:[\"3\",\"gate\"]}],size:Ro(oS,[zr.top1,zr.bottom1,zr.left1]),center:R7}),sS=Z(ke),aS=sS.primitives.filter((t)=\u003et.type===\"text\"),Bm=aS.find((t)=\u003et.text===\"{VAL}\");Bm.x=-0.35;Bm.y=0;Bm.anchor=\"middle_right\";var Im=aS.find((t)=\u003et.text===\"{REF}\");Im.y=0;Im.x=0.35;Im.anchor=\"middle_left\";var Qe=sS,O7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"bottom\",drainSide:\"left\"}),W7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"bottom\",drainSide:\"right\"}),$7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"left\",drainSide:\"bottom\"}),j7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"left\",drainSide:\"top\"}),X7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"right\",drainSide:\"bottom\"}),D7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"right\",drainSide:\"top\"}),V7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"top\",drainSide:\"left\"}),z7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:\"top\",drainSide:\"right\"}),U7={paths:{path11:{type:\"path\",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:\"primary\",fill:!1},\"path12-1\":{type:\"path\",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:\"primary\",fill:!1},\"path2-8-3-7\":{type:\"path\",points:[{x:0.09,y:0.15},{x:0.09,y:0.07}],color:\"primary\",fill:!1},\"path2-5\":{type:\"path\",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:\"primary\",fill:!1},\"path2-8-3\":{type:\"path\",points:[{x:0.09,y:-0.08},{x:0.09,y:-0.15}],color:\"primary\",fill:!1},\"path2-8-3-2\":{type:\"path\",points:[{x:0.09,y:0.03},{x:0.09,y:-0.04}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.27,y:-0.04},{x:0.27,y:0.03},{x:0.2,y:0},{x:0.27,y:-0.04}],color:\"primary\",fill:!0},\"path2-0\":{type:\"path\",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},\"path12-1-0\":{type:\"path\",points:[{x:0.05,y:0.11},{x:0.05,y:-0.11}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.13,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.16,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:G7,texts:$9,bounds:j9,refblocks:xi,circles:H7}=U7,X9={x:j9.centerX,y:j9.centerY},Ne=Yt({primitives:[...Object.values(G7),...Object.values(H7),{...$9.top1,anchor:\"middle_right\",x:0},{...$9.bottom1,anchor:\"middle_right\",x:0}],ports:[{...xi.top1,labels:[\"1\",\"drain\"]},{...xi.bottom1,labels:[\"2\",\"source\"]},{...xi.left1,labels:[\"3\",\"gate\"]}],size:Ro(X9,[xi.top1,xi.bottom1,xi.left1]),center:X9}),cS=Z(Ne),lS=cS.primitives.filter((t)=\u003et.type===\"text\"),Fm=lS.find((t)=\u003et.text===\"{VAL}\");Fm.x=-0.35;Fm.y=0;Fm.anchor=\"middle_right\";var Mm=lS.find((t)=\u003et.text===\"{REF}\");Mm.y=0;Mm.x=0.35;Mm.anchor=\"middle_left\";var Ze=cS,Q7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"bottom\",drainSide:\"left\"}),Z7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"bottom\",drainSide:\"right\"}),q7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"left\",drainSide:\"bottom\"}),J7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"left\",drainSide:\"top\"}),K7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"right\",drainSide:\"bottom\"}),tM=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"right\",drainSide:\"top\"}),eM=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"top\",drainSide:\"left\"}),rM=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:\"top\",drainSide:\"right\"}),nM={paths:{path11:{type:\"path\",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:\"primary\",fill:!1},path40:{type:\"path\",points:[{x:0.07,y:0.19},{x:0.07,y:-0.18}],color:\"primary\",fill:!1},\"path12-1\":{type:\"path\",points:[{x:0.28,y:0.55},{x:0.28,y:0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.1}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.07,y:0.11},{x:0.29,y:0.11}],color:\"primary\",fill:!1},\"path2-5\":{type:\"path\",points:[{x:0.07,y:-0.1},{x:0.29,y:-0.1}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:-0.08,y:0.06},{x:-0.08,y:-0.07},{x:0.01,y:0},{x:-0.08,y:0.06}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.15,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:0.04,y:-0.42}},refblocks:{top1:{x:0.28,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.14,y:0,radius:0.29,color:\"primary\",fill:!1}}};var{paths:iM,texts:D9,bounds:Wa,refblocks:Th,circles:oM}=nM,pS=Yt({primitives:[...Object.values(iM),...Object.values(oM),{...D9.top1,anchor:\"middle_right\",x:0},{...D9.bottom1,anchor:\"middle_right\",x:0}],ports:[{...Th.top1,labels:[\"1\",\"drain\"]},{...Th.bottom1,labels:[\"2\",\"source\"]},{...Th.left1,labels:[\"3\",\"gate\"]}],size:{width:Wa.width,height:Wa.height},center:{x:Wa.centerX,y:Wa.centerY}}),hS=Z(pS),dS=hS.primitives.filter((t)=\u003et.type===\"text\"),Cm=dS.find((t)=\u003et.text===\"{VAL}\");Cm.x=-0.35;Cm.y=0;Cm.anchor=\"middle_right\";var km=dS.find((t)=\u003et.text===\"{REF}\");km.y=0;km.x=0.35;km.anchor=\"middle_left\";var sM=hS,aM={paths:{diag1:{type:\"path\",points:[{x:-0.1,y:-0.1},{x:0.1,y:0.1}],color:\"primary\",fill:!1},diag2:{type:\"path\",points:[{x:-0.1,y:0.1},{x:0.1,y:-0.1}],color:\"primary\",fill:!1},stem:{type:\"path\",points:[{x:-0.2,y:0},{x:0,y:0}],color:\"primary\",fill:!1}},texts:{},refblocks:{left1:{x:-0.2,y:0}},bounds:{minX:-0.19,maxX:0.2,minY:-0.12,maxY:0.12,width:0.39,height:0.24,centerX:0,centerY:0},circles:{}},{paths:cM,bounds:V9,refblocks:lM}=aM,nl=Y({primitives:[...Object.values(cM)],ports:[{...lM.left1,labels:[\"1\"]}],center:{x:V9.centerX,y:V9.centerY}}).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).build(),pM=Z(nl,\"down\"),hM=Z(nl,\"left\"),dM=Z(nl,\"up\"),Ni={paths:{path11:{type:\"path\",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:\"primary\",fill:!1},\"path40-0\":{type:\"path\",points:[{x:0.07,y:0.27},{x:0.07,y:-0.28}],color:\"primary\",fill:!1},\"path40-0-5\":{type:\"path\",points:[{x:0.28,y:0.24},{x:0.08,y:0.11}],color:\"primary\",fill:!1},\"path40-0-5-0\":{type:\"path\",points:[{x:0.29,y:-0.24},{x:0.09,y:-0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.29,y:0.25},{x:0.29,y:0.55}],color:\"primary\",fill:!1},\"path12-1-5-3\":{type:\"path\",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.25}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.19,y:-0.1},{x:0.12,y:-0.2},{x:0.22,y:-0.2},{x:0.19,y:-0.1}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.08,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.07,y:-0.41}},refblocks:{top1:{x:0.29,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{\"path1-0\":{type:\"circle\",x:0.14,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:mM,texts:$nt,bounds:$a,refblocks:Eh,circles:uM}=Ni,fM=Y({primitives:[...Object.values(mM),...Object.values(uM),{type:\"text\",text:\"{REF}\",x:-0.3,y:0.5094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:-0.5094553499999995}],ports:[{...Eh.top1,labels:[\"1\",\"collector\"]},{...Eh.bottom1,labels:[\"3\",\"emitter\"]},{...Eh.left1,labels:[\"2\",\"base\"]}],size:{width:$a.width,height:$a.height},center:{x:$a.centerX,y:$a.centerY}}).rotateRightFacingSymbol(\"right\").changeTextAnchor(\"{REF}\",\"middle_right\").changeTextAnchor(\"{VAL}\",\"middle_right\").build(),{paths:yM,texts:jnt,bounds:ja,refblocks:Rh,circles:_M}=Ni,gM=Y({primitives:[...Object.values(yM),...Object.values(_M),{type:\"text\",text:\"{REF}\",x:0.55,y:-0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:-0.4094553499999995}],ports:[{...Rh.top1,labels:[\"1\",\"collector\"]},{...Rh.bottom1,labels:[\"3\",\"emitter\"]},{...Rh.left1,labels:[\"2\",\"base\"]}],size:{width:ja.width,height:ja.height},center:{x:ja.centerX,y:ja.centerY}}).rotateRightFacingSymbol(\"up\").changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:xM,texts:Xnt,bounds:Xa,refblocks:Oh,circles:bM}=Ni,vM=Y({primitives:[...Object.values(xM),...Object.values(bM),{type:\"text\",text:\"{REF}\",x:-0.5,y:0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:0.55,y:0.3094553499999995}],ports:[{...Oh.top1,labels:[\"1\",\"collector\"]},{...Oh.bottom1,labels:[\"3\",\"emitter\"]},{...Oh.left1,labels:[\"2\",\"base\"]}],size:{width:Xa.width,height:Xa.height},center:{x:Xa.centerX,y:Xa.centerY}}).rotateRightFacingSymbol(\"down\").changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:SM,texts:Dnt,bounds:Da,refblocks:Wh,circles:wM}=Ni,AM=Y({primitives:[...Object.values(SM),...Object.values(wM),{type:\"text\",text:\"{REF}\",x:0.55,y:-0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:-0.4094553499999995}],ports:[{...Wh.top1,labels:[\"1\",\"collector\"]},{...Wh.bottom1,labels:[\"3\",\"emitter\"]},{...Wh.left1,labels:[\"2\",\"base\"]}],size:{width:Da.width,height:Da.height},center:{x:Da.centerX,y:Da.centerY}}).rotateRightFacingSymbol(\"up\").changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:PM,texts:Vnt,bounds:Va,refblocks:$h,circles:BM}=Ni,IM=Y({primitives:[...Object.values(PM),...Object.values(BM),{type:\"text\",text:\"{REF}\",x:-0.3,y:-0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:0.4094553499999995}],ports:[{...$h.top1,labels:[\"1\",\"collector\"]},{...$h.bottom1,labels:[\"3\",\"emitter\"]},{...$h.left1,labels:[\"2\",\"base\"]}],size:{width:Va.width,height:Va.height},center:{x:Va.centerX,y:Va.centerY}}).rotateRightFacingSymbol(\"left\").changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:FM,texts:znt,bounds:za,refblocks:jh,circles:MM}=Ni,CM=Y({primitives:[...Object.values(FM),...Object.values(MM),{type:\"text\",text:\"{REF}\",x:-0.3,y:-0.4094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:0.4094553499999995}],ports:[{...jh.top1,labels:[\"1\",\"collector\"]},{...jh.bottom1,labels:[\"3\",\"emitter\"]},{...jh.left1,labels:[\"2\",\"base\"]}],size:{width:za.width,height:za.height},center:{x:za.centerX,y:za.centerY}}).rotateRightFacingSymbol(\"left\").changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),kM={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.32,y:-0.21}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.32,y:0.31},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.32,y:-0.21},{x:-0.32,y:0.31}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.32,y:0.18},{x:-0.57,y:0.18}],color:\"primary\",fill:!1},path45:{type:\"path\",points:[{x:-0.32,y:-0.09},{x:-0.57,y:-0.09}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.43,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1},\"rect1577-3\":{type:\"path\",points:[{x:-0.19,y:-0.09},{x:-0.27,y:-0.09}],color:\"primary\",fill:!0},\"rect1577-4\":{type:\"path\",points:[{x:-0.19,y:0.18},{x:-0.27,y:0.18}],color:\"primary\",fill:!0},\"rect1577-4-7\":{type:\"path\",points:[{x:-0.23,y:0.14},{x:-0.23,y:0.22}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.42},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.3}},refblocks:{left1:{x:-0.57,y:0.18},left2:{x:-0.57,y:-0.09},right1:{x:0.43,y:0.04}},bounds:{minX:-0.57,maxX:0.43,minY:-0.38,maxY:0.27,width:1.09,height:0.3,centerX:-0.07,centerY:0.05},circles:{}},il=Y(kM).labelPort(\"left1\",[\"1\",\"inp1\"]).labelPort(\"left2\",[\"2\",\"inp2\"]).labelPort(\"right1\",[\"3\",\"out\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),NM=Z(il,\"down\"),YM=Si(Z(il,\"left\")),LM=Z(il,\"up\"),TM={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.32,y:-0.21}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.32,y:0.31},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.32,y:-0.21},{x:-0.32,y:0.31}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.32,y:0.18},{x:-0.57,y:0.18}],color:\"primary\",fill:!1},path45:{type:\"path\",points:[{x:-0.32,y:-0.09},{x:-0.57,y:-0.09}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.43,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1},\"path44-1\":{type:\"path\",points:[{x:-0.1,y:0.44},{x:-0.1,y:0.18}],color:\"primary\",fill:!1},\"path44-2\":{type:\"path\",points:[{x:-0.09,y:-0.34},{x:-0.09,y:-0.09}],color:\"primary\",fill:!1},\"rect1577-3\":{type:\"path\",points:[{x:-0.19,y:0.18},{x:-0.27,y:0.18}],color:\"primary\",fill:!0},\"rect1577-4\":{type:\"path\",points:[{x:-0.19,y:-0.09},{x:-0.27,y:-0.09}],color:\"primary\",fill:!0},\"rect1577-4-7\":{type:\"path\",points:[{x:-0.23,y:0.14},{x:-0.23,y:0.22}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.25,y:0.32},bottom1:{type:\"text\",text:\"{VAL}\",x:0.25,y:-0.24}},refblocks:{left1:{x:-0.57,y:0.18},left2:{x:-0.57,y:-0.09},right1:{x:0.43,y:0.04},top2:{x:-0.1,y:0.44},bottom1:{x:-0.09,y:-0.34}},bounds:{minX:-0.57,maxX:0.43,minY:-0.38,maxY:0.27,width:1.09,height:0.3,centerX:-0.07,centerY:0.05},circles:{}},ol=Y(TM).labelPort(\"left1\",[\"1\",\"inp1\"]).labelPort(\"left2\",[\"2\",\"inp2\"]).labelPort(\"right1\",[\"4\",\"out\"]).labelPort(\"top2\",[\"5\",\"V+\"]).labelPort(\"bottom1\",[\"3\",\"V-\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),EM=Z(ol,\"down\"),RM=Si(Z(ol,\"left\")),OM=Z(ol,\"up\"),WM={paths:{path11:{type:\"path\",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:\"primary\",fill:!1},path40:{type:\"path\",points:[{x:0.09,y:0.19},{x:0.09,y:-0.18}],color:\"primary\",fill:!1},\"path12-1\":{type:\"path\",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:\"primary\",fill:!1},\"path2-5\":{type:\"path\",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.2,y:0.03},{x:0.2,y:-0.04},{x:0.27,y:-0.01},{x:0.2,y:0.03}],color:\"primary\",fill:!0},\"path2-0\":{type:\"path\",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},\"path12-1-0\":{type:\"path\",points:[{x:0.05,y:0.17},{x:0.05,y:-0.11}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.13,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.16,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:$M,texts:z9,bounds:U9,refblocks:bi,circles:jM}=WM,G9={x:U9.centerX,y:U9.centerY},Ye=Yt({primitives:[...Object.values($M),...Object.values(jM),{...z9.top1,anchor:\"middle_right\",x:0},{...z9.bottom1,anchor:\"middle_right\",x:0}],ports:[{...bi.top1,labels:[\"1\",\"drain\"]},{...bi.bottom1,labels:[\"2\",\"source\"]},{...bi.left1,labels:[\"3\",\"gate\"]}],size:Ro(G9,[bi.top1,bi.bottom1,bi.left1]),center:G9}),mS=Z(Ye),uS=mS.primitives.filter((t)=\u003et.type===\"text\"),Nm=uS.find((t)=\u003et.text===\"{VAL}\");Nm.x=-0.35;Nm.y=0;Nm.anchor=\"middle_right\";var Ym=uS.find((t)=\u003et.text===\"{REF}\");Ym.y=0;Ym.x=0.35;Ym.anchor=\"middle_left\";var qe=mS,XM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"bottom\",drainSide:\"left\"}),DM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"bottom\",drainSide:\"right\"}),VM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"left\",drainSide:\"bottom\"}),zM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"left\",drainSide:\"top\"}),UM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"right\",drainSide:\"bottom\"}),GM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"right\",drainSide:\"top\"}),HM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"top\",drainSide:\"left\"}),QM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:\"top\",drainSide:\"right\"}),ZM={paths:{path11:{type:\"path\",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:\"primary\",fill:!1},\"path12-1\":{type:\"path\",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:\"primary\",fill:!1},\"path2-8-3-7\":{type:\"path\",points:[{x:0.09,y:0.15},{x:0.09,y:0.07}],color:\"primary\",fill:!1},\"path2-5\":{type:\"path\",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:\"primary\",fill:!1},\"path2-8-3\":{type:\"path\",points:[{x:0.09,y:-0.08},{x:0.09,y:-0.15}],color:\"primary\",fill:!1},\"path2-8-3-2\":{type:\"path\",points:[{x:0.09,y:0.03},{x:0.09,y:-0.04}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.2,y:0.03},{x:0.2,y:-0.04},{x:0.27,y:-0.01},{x:0.2,y:0.03}],color:\"primary\",fill:!0},\"path2-0\":{type:\"path\",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:\"primary\",fill:!1},\"path12-1-0\":{type:\"path\",points:[{x:0.05,y:0.11},{x:0.05,y:-0.11}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.13,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.16,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:qM,texts:H9,bounds:Q9,refblocks:vi,circles:JM}=ZM,Z9={x:Q9.centerX,y:Q9.centerY},Le=Yt({primitives:[...Object.values(qM),...Object.values(JM),{...H9.top1,anchor:\"middle_right\",x:0},{...H9.bottom1,anchor:\"middle_right\",x:0}],ports:[{...vi.top1,labels:[\"1\",\"drain\"]},{...vi.bottom1,labels:[\"2\",\"source\"]},{...vi.left1,labels:[\"3\",\"gate\"]}],size:Ro(Z9,[vi.top1,vi.bottom1,vi.left1]),center:Z9}),fS=Z(Le),yS=fS.primitives.filter((t)=\u003et.type===\"text\"),Lm=yS.find((t)=\u003et.text===\"{VAL}\");Lm.x=-0.35;Lm.y=0;Lm.anchor=\"middle_right\";var Tm=yS.find((t)=\u003et.text===\"{REF}\");Tm.y=0;Tm.x=0.35;Tm.anchor=\"middle_left\";var Je=fS,KM=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"bottom\",drainSide:\"left\"}),tC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"bottom\",drainSide:\"right\"}),eC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"left\",drainSide:\"bottom\"}),rC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"left\",drainSide:\"top\"}),nC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"right\",drainSide:\"bottom\"}),iC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"right\",drainSide:\"top\"}),oC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"top\",drainSide:\"left\"}),sC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:\"top\",drainSide:\"right\"}),aC={paths:{path11:{type:\"path\",points:[{x:-0.54,y:-0.01},{x:-0.15,y:-0.02}],color:\"primary\",fill:!1},path40:{type:\"path\",points:[{x:0.13,y:0},{x:-0.13,y:-0.13}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.13,y:0.13},{x:0.13,y:0}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.13,y:-0.13},{x:-0.13,y:0.13}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.13,y:0.13},{x:0.13,y:-0.13}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.14,y:0},{x:0.54,y:-0.01}],color:\"primary\",fill:!1},\"path25-0\":{type:\"path\",points:[{x:0.2,y:0.38},{x:0.16,y:0.28},{x:0.26,y:0.3}],color:\"primary\",fill:!0},\"path78-6\":{type:\"path\",points:[{x:0.33,y:0.43},{x:0.32,y:0.42},{x:0.21,y:0.31},{x:0.21,y:0.31}],color:\"primary\",fill:!1},\"path25-0-9\":{type:\"path\",points:[{x:0.35,y:0.35},{x:0.31,y:0.26},{x:0.41,y:0.27}],color:\"primary\",fill:!0},\"path78-6-5\":{type:\"path\",points:[{x:0.48,y:0.4},{x:0.47,y:0.39},{x:0.35,y:0.29},{x:0.35,y:0.29}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.1,y:0.35},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.43}},refblocks:{left1:{x:-0.54,y:-0.01},right1:{x:0.54,y:-0.01}},bounds:{minX:-0.57,maxX:0.57,minY:-0.43,maxY:0.43,width:1.14,height:0.85,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:-0.01,radius:0.29,color:\"primary\",fill:!1}}},_S=Y(aC).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),gS=Z(_S),cC=gS.primitives.filter((t)=\u003et.type===\"text\"),xS=cC.find((t)=\u003et.text===\"{REF}\");xS.y=0;xS.anchor=\"middle_left\";var lC=gS,pC={paths:{path11:{type:\"path\",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:\"primary\",fill:!1},path40:{type:\"path\",points:[{x:0.07,y:0.19},{x:0.07,y:-0.18}],color:\"primary\",fill:!1},\"path12-1\":{type:\"path\",points:[{x:0.28,y:0.55},{x:0.28,y:0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.1}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.07,y:0.11},{x:0.29,y:0.11}],color:\"primary\",fill:!1},\"path2-5\":{type:\"path\",points:[{x:0.07,y:-0.1},{x:0.29,y:-0.1}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.01,y:-0.07},{x:0.01,y:0.06},{x:-0.08,y:0},{x:0.01,y:-0.07}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.15,y:0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:0.04,y:-0.42}},refblocks:{top1:{x:0.28,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.14,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:hC,texts:q9,bounds:Ua,refblocks:Xh,circles:dC}=pC,bS=Yt({primitives:[...Object.values(hC),...Object.values(dC),{...q9.top1,anchor:\"middle_right\",x:0},{...q9.bottom1,anchor:\"middle_right\"}],ports:[{...Xh.top1,labels:[\"1\",\"drain\"]},{...Xh.bottom1,labels:[\"2\",\"source\"]},{...Xh.left1,labels:[\"3\",\"gate\"]}],size:{width:Ua.width,height:Ua.height},center:{x:Ua.centerX,y:Ua.centerY}}),vS=Z(bS),SS=vS.primitives.filter((t)=\u003et.type===\"text\"),Em=SS.find((t)=\u003et.text===\"{VAL}\");Em.x=-0.35;Em.y=0;Em.anchor=\"middle_right\";var Rm=SS.find((t)=\u003et.text===\"{REF}\");Rm.y=0;Rm.x=0.35;Rm.anchor=\"middle_left\";var mC=vS,Ur={paths:{path11:{type:\"path\",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:\"primary\",fill:!1},\"path40-0\":{type:\"path\",points:[{x:0.07,y:0.27},{x:0.07,y:-0.28}],color:\"primary\",fill:!1},\"path40-0-5\":{type:\"path\",points:[{x:0.28,y:0.24},{x:0.08,y:0.11}],color:\"primary\",fill:!1},\"path40-0-5-0\":{type:\"path\",points:[{x:0.29,y:-0.24},{x:0.09,y:-0.11}],color:\"primary\",fill:!1},\"path12-1-5\":{type:\"path\",points:[{x:0.29,y:0.25},{x:0.29,y:0.55}],color:\"primary\",fill:!1},\"path12-1-5-3\":{type:\"path\",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.25}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0.15,y:-0.23},{x:0.22,y:-0.12},{x:0.12,y:-0.12},{x:0.15,y:-0.23}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.08,y:0.37},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.07,y:-0.41}},refblocks:{top1:{x:0.29,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{\"path1-0\":{type:\"circle\",x:0.14,y:0,radius:0.29,color:\"primary\",fill:!1}}},{paths:uC,texts:Unt,bounds:Ga,refblocks:Dh,circles:fC}=Ur,yC=Y({primitives:[...Object.values(uC),...Object.values(fC),{type:\"text\",text:\"{REF}\",x:-0.1,y:0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.1,y:-0.3094553499999995}],ports:[{...Dh.top1,labels:[\"1\",\"collector\"]},{...Dh.bottom1,labels:[\"3\",\"emitter\"]},{...Dh.left1,labels:[\"2\",\"base\"]}],size:{width:Ga.width,height:Ga.height},center:{x:Ga.centerX,y:Ga.centerY}}).rotateRightFacingSymbol(\"right\").changeTextAnchor(\"{REF}\",\"middle_right\").changeTextAnchor(\"{VAL}\",\"middle_right\").build(),{paths:Gnt,texts:Hnt,bounds:Qnt,refblocks:Znt,circles:qnt}=Ur,_C=Y(Ur).rotateRightFacingSymbol(\"up\").changeTextAnchor(\"{VAL}\",\"middle_left\").labelPort(\"left1\",[\"2\",\"base\"]).labelPort(\"top1\",[\"1\",\"collector\"]).labelPort(\"bottom1\",[\"3\",\"emitter\"]).changeTextAnchor(\"{REF}\",\"middle_right\").build(),{paths:gC,texts:Jnt,bounds:Ha,refblocks:Vh,circles:xC}=Ur,bC=Y({primitives:[...Object.values(gC),...Object.values(xC),{type:\"text\",text:\"{REF}\",x:-0.1,y:-0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.1,y:0.3094553499999995}],ports:[{...Vh.top1,labels:[\"1\",\"collector\"]},{...Vh.bottom1,labels:[\"3\",\"emitter\"]},{...Vh.left1,labels:[\"2\",\"base\"]}],size:{width:Ha.width,height:Ha.height},center:{x:Ha.centerX,y:Ha.centerY}}).rotateRightFacingSymbol(\"down\").changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_bottom\").build(),{paths:vC,texts:Knt,bounds:Qa,refblocks:zh,circles:SC}=Ur,wC=Y({primitives:[...Object.values(vC),...Object.values(SC),{type:\"text\",text:\"{REF}\",x:-0.1,y:-0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.1,y:0.3094553499999995}],ports:[{...zh.top1,labels:[\"1\",\"collector\"]},{...zh.bottom1,labels:[\"3\",\"emitter\"]},{...zh.left1,labels:[\"2\",\"base\"]}],size:{width:Qa.width,height:Qa.height},center:{x:Qa.centerX,y:Qa.centerY}}).rotateRightFacingSymbol(\"up\").changeTextAnchor(\"{REF}\",\"middle_top\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:AC,texts:tit,bounds:Za,refblocks:Uh,circles:PC}=Ur,BC=Y({primitives:[...Object.values(AC),...Object.values(PC),{type:\"text\",text:\"{REF}\",x:-0.1,y:-0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.1,y:0.3094553499999995}],ports:[{...Uh.top1,labels:[\"1\",\"collector\"]},{...Uh.bottom1,labels:[\"3\",\"emitter\"]},{...Uh.left1,labels:[\"2\",\"base\"]}],size:{width:Za.width,height:Za.height},center:{x:Za.centerX,y:Za.centerY}}).rotateRightFacingSymbol(\"left\").changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:IC,texts:eit,bounds:qa,refblocks:Gh,circles:FC}=Ur,MC=Y({primitives:[...Object.values(IC),...Object.values(FC),{type:\"text\",text:\"{REF}\",x:-0.1,y:-0.3094553499999995},{type:\"text\",text:\"{VAL}\",x:-0.1,y:0.3094553499999995}],ports:[{...Gh.top1,labels:[\"1\",\"collector\"]},{...Gh.bottom1,labels:[\"3\",\"emitter\"]},{...Gh.left1,labels:[\"2\",\"base\"]}],size:{width:qa.width,height:qa.height},center:{x:qa.centerX,y:qa.centerY}}).rotateRightFacingSymbol(\"left\").changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),CC={paths:{path40:{type:\"path\",points:[{x:-0.19,y:0.33},{x:-0.26,y:0.14}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.38,y:0.26},{x:-0.19,y:0.33}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.26,y:0.14},{x:-0.38,y:0.26}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:-0.26,y:0.39},{x:-0.13,y:0.26}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.32,y:0.2},{x:-0.52,y:0}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0,y:0.52},{x:-0.19,y:0.33}],color:\"primary\",fill:!1},\"path40-4\":{type:\"path\",points:[{x:-0.19,y:-0.32},{x:-0.38,y:-0.26}],color:\"primary\",fill:!1},\"path41-1\":{type:\"path\",points:[{x:-0.26,y:-0.13},{x:-0.19,y:-0.32}],color:\"primary\",fill:!1},\"path42-7\":{type:\"path\",points:[{x:-0.38,y:-0.26},{x:-0.26,y:-0.13}],color:\"primary\",fill:!1},\"path43-1\":{type:\"path\",points:[{x:-0.13,y:-0.26},{x:-0.26,y:-0.39}],color:\"primary\",fill:!1},\"path44-8\":{type:\"path\",points:[{x:-0.32,y:-0.19},{x:-0.51,y:-0.01}],color:\"primary\",fill:!1},\"path44-0-7\":{type:\"path\",points:[{x:-0.01,y:-0.5},{x:-0.19,y:-0.32}],color:\"primary\",fill:!1},\"path40-4-0\":{type:\"path\",points:[{x:0.32,y:0.19},{x:0.13,y:0.26}],color:\"primary\",fill:!1},\"path41-1-2\":{type:\"path\",points:[{x:0.26,y:0.38},{x:0.32,y:0.19}],color:\"primary\",fill:!1},\"path42-7-1\":{type:\"path\",points:[{x:0.13,y:0.26},{x:0.26,y:0.38}],color:\"primary\",fill:!1},\"path43-1-8\":{type:\"path\",points:[{x:0.39,y:0.26},{x:0.26,y:0.13}],color:\"primary\",fill:!1},\"path44-8-7\":{type:\"path\",points:[{x:0.2,y:0.32},{x:0.01,y:0.51}],color:\"primary\",fill:!1},\"path44-0-7-1\":{type:\"path\",points:[{x:0.52,y:0},{x:0.32,y:0.19}],color:\"primary\",fill:!1},\"path40-4-8\":{type:\"path\",points:[{x:0.32,y:-0.19},{x:0.26,y:-0.38}],color:\"primary\",fill:!1},\"path41-1-4\":{type:\"path\",points:[{x:0.13,y:-0.26},{x:0.32,y:-0.19}],color:\"primary\",fill:!1},\"path42-7-0\":{type:\"path\",points:[{x:0.26,y:-0.38},{x:0.13,y:-0.26}],color:\"primary\",fill:!1},\"path43-1-0\":{type:\"path\",points:[{x:0.26,y:-0.13},{x:0.39,y:-0.26}],color:\"primary\",fill:!1},\"path44-8-9\":{type:\"path\",points:[{x:0.19,y:-0.32},{x:0,y:-0.52}],color:\"primary\",fill:!1},\"path44-0-7-3\":{type:\"path\",points:[{x:0.5,y:-0.01},{x:0.32,y:-0.19}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.29,y:0.46},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.29,y:-0.5}},refblocks:{top1:{x:0,y:0.52},bottom1:{x:0,y:-0.52},left1:{x:-0.52,y:0},right1:{x:0.52,y:0}},bounds:{minX:-0.55,maxX:0.55,minY:-0.55,maxY:0.55,width:1.09,height:1.09,centerX:0,centerY:0},circles:{}},{paths:kC,texts:J9,bounds:Ja,refblocks:K9}=CC,wS=Yt({primitives:[...Object.values(kC),{...J9.bottom1,y:0.35,anchor:\"middle_top\"},{...J9.top1,anchor:\"middle_left\"}],ports:[{...K9.left1,labels:[\"1\"]},{...K9.right1,labels:[\"2\"]}],size:{width:Ja.width+0.05,height:Ja.height},center:{x:Ja.centerX,y:Ja.centerY}}),NC=Z(wS),YC=NC,LC={paths:{path18:{type:\"path\",points:[{x:-0.53,y:0},{x:-0.27,y:0}],color:\"primary\",fill:!1},path19:{type:\"path\",points:[{x:0.26,y:0},{x:0.53,y:0}],color:\"primary\",fill:!1},path20:{type:\"path\",points:[{x:0,y:0.13},{x:0.26,y:0.13},{x:0.26,y:-0.13},{x:-0.27,y:-0.13},{x:-0.27,y:0.13},{x:0,y:0.13}],color:\"primary\",fill:!1},path24:{type:\"path\",points:[{x:0.29,y:-0.29},{x:0.26,y:-0.16},{x:0.16,y:-0.26},{x:0.29,y:-0.29}],color:\"primary\",fill:!0},path26:{type:\"path\",points:[{x:-0.3,y:0.29},{x:0.2,y:-0.2}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.06,y:0.2},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.1,y:-0.28}},refblocks:{left1:{x:-0.53,y:0},right1:{x:0.53,y:0}},bounds:{minX:-0.56,maxX:0.56,minY:-0.29,maxY:0.29,width:1.13,height:0.58,centerX:0,centerY:0},circles:{}},{paths:TC,texts:tv,bounds:Ka,refblocks:ev}=LC,sl=Yt({primitives:[...Object.values(TC),{...tv.bottom1,x:0,y:-0.35,anchor:\"middle_top\"},{...tv.top1,x:0,y:0.35,anchor:\"middle_bottom\"}],ports:[{...ev.left1,labels:[\"1\"]},{...ev.right1,labels:[\"2\"]}],size:{width:Ka.width+0.05,height:Ka.height},center:{x:Ka.centerX,y:Ka.centerY}}),Om=Z(sl,\"down\"),Wm=Om.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),$m=Om.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Wm.anchor=\"middle_left\";$m.anchor=\"middle_left\";Wm.y+=0.31;Wm.x=0.34;$m.y-=0.31;$m.x=0.34;var EC=Om,jm=Z(sl,\"left\"),Xm=jm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Dm=jm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Xm.anchor=\"middle_bottom\";Dm.anchor=\"middle_top\";Xm.y+=0.73;Xm.x=0;Dm.y-=0.7;Dm.x=0;var RC=jm,Vm=Z(sl,\"up\"),zm=Vm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Um=Vm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");zm.anchor=\"middle_left\";Um.anchor=\"middle_left\";zm.y+=0.21;zm.x=0.34;Um.y-=0.21;Um.x=0.34;var OC=Vm,al={paths:{path1:{type:\"path\",points:[{x:-0.42,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},\"path1-2-1\":{type:\"path\",points:[{x:-0.3,y:0},{x:-0.25,y:0.1},{x:-0.15,y:-0.1},{x:-0.05,y:0.1},{x:0.05,y:-0.1},{x:0.15,y:0.1},{x:0.25,y:-0.1},{x:0.3,y:0}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.3,y:0},{x:0.42,y:0}],color:\"primary\",fill:!1},path3:{type:\"path\",points:[{x:0,y:-0.17},{x:0,y:-0.4}],color:\"primary\",fill:!1},path15:{type:\"path\",points:[{x:0,y:-0.12},{x:0.05,y:-0.2},{x:-0.05,y:-0.2},{x:0,y:-0.12}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.3,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0.3,y:-0.25}},refblocks:{left:{x:-0.42,y:0},right:{x:0.42,y:0},bottom:{x:0,y:-0.4}},bounds:{minX:-0.42,maxX:0.42,minY:-0.2,maxY:0.2,width:0.84,height:0.4,centerX:0,centerY:0},circles:{}},{paths:WC,texts:rit,bounds:tc,refblocks:Hh,circles:$C}=al,jC=Y({primitives:[...Object.values(WC),...Object.values($C),{type:\"text\",text:\"{REF}\",x:-0.15,y:0.2394553499999995},{type:\"text\",text:\"{VAL}\",x:0.15,y:0.2394553499999995}],ports:[{...Hh.left,labels:[\"1\"]},{...Hh.right,labels:[\"3\"]},{...Hh.bottom,labels:[\"2\"]}],size:{width:tc.width,height:tc.height},center:{x:tc.centerX,y:tc.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).labelPort(\"bottom\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:XC,texts:nit,bounds:ec,refblocks:Qh,circles:DC}=al,VC=Y({primitives:[...Object.values(XC),...Object.values(DC),{type:\"text\",text:\"{REF}\",x:-0.3,y:-0.3894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:0.3194553499999995}],ports:[{...Qh.left,labels:[\"1\"]},{...Qh.right,labels:[\"3\"]},{...Qh.bottom,labels:[\"2\"]}],size:{width:ec.width,height:ec.height},center:{x:ec.centerX,y:ec.centerY}}).rotateRightFacingSymbol(\"left\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).labelPort(\"bottom\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),zC=Y(al).labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"3\"]).labelPort(\"bottom\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:UC,texts:iit,bounds:rc,refblocks:Zh,circles:GC}=al,HC=Y({primitives:[...Object.values(UC),...Object.values(GC),{type:\"text\",text:\"{REF}\",x:0.3,y:-0.2894553499999995},{type:\"text\",text:\"{VAL}\",x:-0.3,y:-0.2894553499999995}],ports:[{...Zh.left,labels:[\"1\"]},{...Zh.right,labels:[\"3\"]},{...Zh.bottom,labels:[\"2\"]}],size:{width:rc.width,height:rc.height},center:{x:rc.centerX,y:rc.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).labelPort(\"bottom\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),QC={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.03}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0.03},{x:0.54,y:0.03}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.16,y:0.4},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.4},left1:{type:\"text\",text:\"COS φ\",x:-0.15,y:0.01}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.03}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.79,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0.04,radius:0.29,color:\"primary\",fill:!1}}},{paths:ZC,texts:oit,bounds:nc,refblocks:rv,circles:qC}=QC,AS=Yt({primitives:[...Object.values(ZC),...Object.values(qC),{type:\"text\",text:\"{REF}\",x:0,y:0.43330070000000065,anchor:\"middle_bottom\"},{type:\"text\",text:\"{VAL}\",x:0,y:-0.43330070000000065,anchor:\"middle_top\"},{type:\"text\",text:\"COS φ\",x:0,y:0.014279000000000375,anchor:\"center\"}],ports:[{...rv.left1,labels:[\"1\"]},{...rv.right1,labels:[\"2\"]}],size:{width:nc.width,height:nc.height},center:{x:nc.centerX,y:nc.centerY}}),PS=Z(AS),Gm=PS.primitives.filter((t)=\u003et.type===\"text\"),od=Gm.find((t)=\u003et.text===\"{REF}\"),Hm=Gm.find((t)=\u003et.text===\"{VAL}\"),sd=Gm.find((t)=\u003et.text===\"COS φ\");od.x=0.35;od.y=0.4279000000000375,od.anchor=\"middle_left\";Hm.anchor=\"middle_left\";Hm.x=0.35;Hm.y=-0.4279000000000375,sd.x=0;sd.y=0.014279000000000375,sd.anchor=\"center\";var JC=PS,KC={paths:{\"path12-1-8-6-9-9\":{type:\"path\",points:[{x:0.01,y:0.03},{x:0.01,y:-0.09}],color:\"primary\",fill:!1},\"path12-1-5-6-4\":{type:\"path\",points:[{x:-0.47,y:-0.05},{x:-0.17,y:-0.05}],color:\"primary\",fill:!1},\"path12-1-8-0-0\":{type:\"path\",points:[{x:-0.16,y:-0.09},{x:0.18,y:-0.09}],color:\"primary\",fill:!1},\"path12-1-0-1\":{type:\"path\",points:[{x:0.2,y:-0.05},{x:0.47,y:-0.05}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.01,y:0.22},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.16,y:-0.22}},refblocks:{left1:{x:-0.47,y:-0.05},right1:{x:0.47,y:-0.05}},bounds:{minX:-0.5,maxX:0.5,minY:-0.22,maxY:0.22,width:1,height:0.45,centerX:0,centerY:0},circles:{\"circle-2\":{type:\"circle\",x:-0.14,y:-0.05,radius:0.02,color:\"primary\",fill:!1},circle:{type:\"circle\",x:0.17,y:-0.05,radius:0.02,color:\"primary\",fill:!1}}},{paths:tk,texts:nv,bounds:iv,refblocks:ov,circles:ek}=KC,BS=Yt({primitives:[...Object.values(tk),...Object.values(ek),{...nv.top1,anchor:\"middle_left\"},{...nv.bottom1,anchor:\"middle_left\"}],ports:[{...ov.left1,labels:[\"1\"]},{...ov.right1,labels:[\"2\"]}],center:{x:iv.centerX,y:iv.centerY}}),rk=Z(BS,\"up\"),IS={paths:{\"path12-1-8-6-9-9\":{type:\"path\",points:[{x:-0.05,y:0.09},{x:-0.05,y:0.04}],color:\"primary\",fill:!1},\"path12-1-8-7-9-9\":{type:\"path\",points:[{x:-0.05,y:0.09},{x:0.07,y:0.09}],color:\"primary\",fill:!1},\"path12-1-8-6-9-10\":{type:\"path\",points:[{x:0.07,y:0.09},{x:0.07,y:0.04}],color:\"primary\",fill:!1},\"path12-1-5-6-4\":{type:\"path\",points:[{x:-0.47,y:-0.05},{x:-0.17,y:-0.05}],color:\"primary\",fill:!1},\"path12-1-8-0-0\":{type:\"path\",points:[{x:-0.16,y:0.04},{x:0.18,y:0.04}],color:\"primary\",fill:!1},\"path12-1-0-1\":{type:\"path\",points:[{x:0.2,y:-0.05},{x:0.47,y:-0.05}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.01,y:0.29},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.16,y:-0.22}},refblocks:{left1:{x:-0.47,y:-0.05},right1:{x:0.47,y:-0.05}},bounds:{minX:-0.5,maxX:0.5,minY:-0.22,maxY:0.22,width:1,height:0.45,centerX:0,centerY:0},circles:{\"circle-2\":{type:\"circle\",x:-0.14,y:-0.05,radius:0.02,color:\"primary\",fill:!1},circle:{type:\"circle\",x:0.17,y:-0.05,radius:0.02,color:\"primary\",fill:!1}}},{paths:nk,texts:sv,bounds:ik,refblocks:qh,circles:ok}=IS,Oo=Yt({primitives:[...Object.values(nk),...Object.values(ok),{...sv.top1,x:0,y:0.3594553499999995,anchor:\"middle_bottom\"},{...sv.bottom1,x:0,y:-0.3594553499999995,anchor:\"middle_top\"}],ports:[{...qh.left1,labels:[\"1\"]},{...qh.right1,labels:[\"2\"]}],center:{x:ik.centerX,y:qh.left1.y}}),Qm=Z(Oo,\"down\"),Zm=Qm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),qm=Qm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Zm.anchor=\"middle_bottom\";qm.anchor=\"middle_top\";Zm.y=0.4;Zm.x=0.35;qm.y=-0.4;qm.x=0.35;var sk=Qm,{paths:ak,texts:av,bounds:ck,refblocks:Jh,circles:lk}=IS,pk=Yt({primitives:[...Object.values(ak),...Object.values(lk),{...av.top1,x:0,y:0.3594553499999995,anchor:\"middle_bottom\"},{...av.bottom1,x:0,y:-0.3594553499999995,anchor:\"middle_top\"}],ports:[{...Jh.left1,labels:[\"1\"]},{...Jh.right1,labels:[\"2\"]}],center:{x:ck.centerX,y:Jh.left1.y}}),Jm=Z(Oo,\"left\"),Km=Jm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),tu=Jm.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Km.anchor=\"middle_bottom\";tu.anchor=\"middle_top\";Km.y=0.4;Km.x=0;tu.y=-0.4;tu.x=0;var hk=Jm,eu=Z(Oo,\"up\"),ru=eu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),nu=eu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");ru.anchor=\"middle_left\";nu.anchor=\"middle_left\";ru.y+=0.4;ru.x=0.34;nu.y-=0.41;nu.x=0.34;var dk=eu,iu=Z(Oo,\"up\"),ou=iu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),su=iu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");ou.anchor=\"middle_left\";su.anchor=\"middle_left\";ou.y+=0.4;ou.x=0.34;su.y-=0.41;su.x=0.34;var mk=iu,cl={paths:{path12_rotated:{type:\"path\",points:[{x:-0.09,y:0.12},{x:-0.09,y:-0.12}],color:\"primary\",fill:!1},path2_rotated:{type:\"path\",points:[{x:-0.09,y:0},{x:0.09,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.03}},refblocks:{left1:{x:0.09,y:0}},bounds:{minX:-0.57,maxX:0.57,minY:-0.37,maxY:0.37,width:1.14,height:0.74,centerX:0,centerY:0},circles:{}},{paths:uk,texts:sit,bounds:cv,refblocks:fk,circles:yk}=cl,_k=Y({primitives:[...Object.values(uk),...Object.values(yk),{type:\"text\",text:\"{REF}\",x:-0.14,y:-0}],ports:[{...fk.left1,labels:[\"1\"]}],center:{x:cv.centerX,y:cv.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_top\").build(),{paths:gk,texts:ait,bounds:lv,refblocks:xk,circles:bk}=cl,vk=Y({primitives:[...Object.values(gk),...Object.values(bk),{type:\"text\",text:\"{REF}\",x:-0.13,y:0}],ports:[{...xk.left1,labels:[\"1\"]}],center:{x:lv.centerX,y:lv.centerY}}).changeTextAnchor(\"{VAL}\",\"middle_top\").rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_right\").build(),{paths:Sk,texts:cit,bounds:pv,refblocks:wk,circles:Ak}=cl,Pk=Y({primitives:[...Object.values(Sk),...Object.values(Ak),{type:\"text\",text:\"{REF}\",x:-0.14,y:-0}],ports:[{...wk.left1,labels:[\"1\"]}],center:{x:pv.centerX,y:pv.centerY}}).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),{paths:Bk,texts:lit,bounds:hv,refblocks:Ik}=cl,Fk=Y({primitives:[...Object.values(Bk),{type:\"text\",text:\"{REF}\",x:-0.14,y:0}],ports:[{...Ik.left1,labels:[\"1\"]}],center:{x:hv.centerX,y:hv.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),Mk={paths:{path40:{type:\"path\",points:[{x:-0.19,y:-0.33},{x:-0.26,y:-0.14}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.38,y:-0.26},{x:-0.19,y:-0.33}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.26,y:-0.14},{x:-0.38,y:-0.26}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:-0.26,y:-0.39},{x:-0.13,y:-0.26}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.32,y:-0.2},{x:-0.52,y:0}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0,y:-0.52},{x:-0.19,y:-0.33}],color:\"primary\",fill:!1},\"path40-4\":{type:\"path\",points:[{x:-0.19,y:0.32},{x:-0.38,y:0.26}],color:\"primary\",fill:!1},\"path41-1\":{type:\"path\",points:[{x:-0.26,y:0.13},{x:-0.19,y:0.32}],color:\"primary\",fill:!1},\"path42-7\":{type:\"path\",points:[{x:-0.38,y:0.26},{x:-0.26,y:0.13}],color:\"primary\",fill:!1},\"path43-1\":{type:\"path\",points:[{x:-0.13,y:0.26},{x:-0.26,y:0.39}],color:\"primary\",fill:!1},\"path44-8\":{type:\"path\",points:[{x:-0.32,y:0.19},{x:-0.51,y:0.01}],color:\"primary\",fill:!1},\"path44-0-7\":{type:\"path\",points:[{x:-0.01,y:0.5},{x:-0.19,y:0.32}],color:\"primary\",fill:!1},\"path40-4-0\":{type:\"path\",points:[{x:0.32,y:-0.19},{x:0.13,y:-0.26}],color:\"primary\",fill:!1},\"path41-1-2\":{type:\"path\",points:[{x:0.26,y:-0.38},{x:0.32,y:-0.19}],color:\"primary\",fill:!1},\"path42-7-1\":{type:\"path\",points:[{x:0.13,y:-0.26},{x:0.26,y:-0.38}],color:\"primary\",fill:!1},\"path43-1-8\":{type:\"path\",points:[{x:0.39,y:-0.26},{x:0.26,y:-0.13}],color:\"primary\",fill:!1},\"path44-8-7\":{type:\"path\",points:[{x:0.2,y:-0.32},{x:0.01,y:-0.51}],color:\"primary\",fill:!1},\"path44-0-7-1\":{type:\"path\",points:[{x:0.52,y:0},{x:0.32,y:-0.19}],color:\"primary\",fill:!1},\"path40-4-8\":{type:\"path\",points:[{x:0.32,y:0.19},{x:0.26,y:0.38}],color:\"primary\",fill:!1},\"path41-1-4\":{type:\"path\",points:[{x:0.13,y:0.26},{x:0.32,y:0.19}],color:\"primary\",fill:!1},\"path42-7-0\":{type:\"path\",points:[{x:0.26,y:0.38},{x:0.13,y:0.26}],color:\"primary\",fill:!1},\"path43-1-0\":{type:\"path\",points:[{x:0.26,y:0.13},{x:0.39,y:0.26}],color:\"primary\",fill:!1},\"path44-8-9\":{type:\"path\",points:[{x:0.19,y:0.32},{x:0,y:0.52}],color:\"primary\",fill:!1},\"path44-0-7-3\":{type:\"path\",points:[{x:0.5,y:0.01},{x:0.32,y:0.19}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.29,y:-0.46},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.29,y:0.5}},refblocks:{top1:{x:0,y:-0.52},bottom1:{x:0,y:0.52},left1:{x:-0.52,y:0},right1:{x:0.52,y:0}},bounds:{minX:-0.55,maxX:0.55,minY:-0.56,maxY:0.55,width:1.09,height:1.1,centerX:0,centerY:0},circles:{}},{paths:Ck,texts:dv,bounds:ic,refblocks:oc,circles:kk}=Mk,FS=Yt({primitives:[...Object.values(Ck),...Object.values(kk),{...dv.top1,anchor:\"middle_right\"},{...dv.bottom1,anchor:\"middle_right\"}],ports:[{...oc.top1,labels:[\"1\"]},{...oc.bottom1,labels:[\"2\"]},{...oc.left1,labels:[\"3\"]},{...oc.right1,labels:[\"4\"]}],size:{width:ic.width,height:ic.height},center:{x:ic.centerX,y:ic.centerY}}),au=Z(FS),Nk=au.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Yk=au.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Nk.anchor=\"middle_left\";Yk.anchor=\"middle_right\";var Lk=au,ll={paths:{path27:{type:\"path\",points:[{x:0.47,y:0.04},{x:0.21,y:0.04}],color:\"primary\",fill:!1},\"path27-0\":{type:\"path\",points:[{x:-0.21,y:0.04},{x:-0.47,y:0.04}],color:\"primary\",fill:!1},\"path27-8-2-4\":{type:\"path\",points:[{x:0.21,y:0.04},{x:0.19,y:-0.05}],color:\"primary\",fill:!1},\"path27-8-2-4-29\":{type:\"path\",points:[{x:-0.19,y:0.14},{x:-0.21,y:0.04}],color:\"primary\",fill:!1},\"path27-8-2-4-5\":{type:\"path\",points:[{x:0.19,y:-0.05},{x:0.13,y:0.14}],color:\"primary\",fill:!1},\"path27-8-2-4-5-1\":{type:\"path\",points:[{x:0.08,y:-0.05},{x:0.13,y:0.14}],color:\"primary\",fill:!1},\"path27-8-2-4-5-1-9\":{type:\"path\",points:[{x:0.08,y:-0.05},{x:0.03,y:0.14}],color:\"primary\",fill:!1},\"path27-8-2-4-5-1-9-2\":{type:\"path\",points:[{x:-0.03,y:-0.05},{x:0.03,y:0.14}],color:\"primary\",fill:!1},\"path27-8-2-4-5-1-9-2-1\":{type:\"path\",points:[{x:-0.03,y:-0.05},{x:-0.08,y:0.14}],color:\"primary\",fill:!1},\"path27-8-2-4-5-1-9-2-1-2\":{type:\"path\",points:[{x:-0.13,y:-0.05},{x:-0.08,y:0.14}],color:\"primary\",fill:!1},\"path27-8-2-4-5-1-9-2-1-2-2\":{type:\"path\",points:[{x:-0.13,y:-0.05},{x:-0.19,y:0.14}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.05,y:0.42},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.04,y:-0.42}},refblocks:{left1:{x:-0.47,y:0.04},right1:{x:0.47,y:0.04}},bounds:{minX:-0.49,maxX:0.49,minY:-0.42,maxY:0.42,width:0.99,height:0.84,centerX:0,centerY:0},circles:{}},{paths:Tk,texts:pit,bounds:sc,refblocks:mv,circles:Ek}=ll,Rk=Y({primitives:[...Object.values(Tk),...Object.values(Ek),{type:\"text\",text:\"{REF}\",x:-0.2,y:0.2194553499999995},{type:\"text\",text:\"{VAL}\",x:0.2,y:0.2194553499999995}],ports:[{...mv.left1,labels:[\"1\"]},{...mv.right1,labels:[\"2\"]}],size:{width:sc.width,height:sc.height},center:{x:sc.centerX,y:sc.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),{paths:Ok,texts:hit,bounds:ac,refblocks:uv,circles:Wk}=ll,$k=Y({primitives:[...Object.values(Ok),...Object.values(Wk),{type:\"text\",text:\"{REF}\",x:0,y:-0.1704553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:0.2294553499999995}],ports:[{...uv.left1,labels:[\"1\"]},{...uv.right1,labels:[\"2\"]}],size:{width:ac.width,height:ac.height},center:{x:ac.centerX,y:ac.centerY}}).rotateRightFacingSymbol(\"left\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),{paths:jk,texts:dit,bounds:cc,refblocks:fv,circles:Xk}=ll,Dk=Y({primitives:[...Object.values(jk),...Object.values(Xk),{type:\"text\",text:\"{REF}\",x:0,y:0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:0,y:-0.1704553499999995}],ports:[{...fv.left1,labels:[\"1\"]},{...fv.right1,labels:[\"2\"]}],size:{width:cc.width,height:cc.height},center:{x:cc.centerX,y:cc.centerY}}).rotateRightFacingSymbol(\"right\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),pl={paths:{\"left-lead\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.16,y:0}],color:\"primary\",fill:!1,strokeWidth:0.02},zigzag:{type:\"path\",points:[{x:-0.16,y:0},{x:-0.12,y:0.095},{x:-0.07,y:-0.095},{x:-0.02,y:0.095},{x:0.02,y:-0.095},{x:0.07,y:0.095},{x:0.12,y:-0.095},{x:0.16,y:0}],color:\"primary\",fill:!1,strokeWidth:0.02},\"right-lead\":{type:\"path\",points:[{x:0.16,y:0},{x:0.25,y:0}],color:\"primary\",fill:!1,strokeWidth:0.02}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},Vk=yt(pl,{kind:\"resistor\",orientation:\"down\"}),zk=yt(pl,{kind:\"resistor\",orientation:\"left\"}),Uk=yt(pl,{kind:\"resistor\",orientation:\"right\"}),Gk=yt(pl,{kind:\"resistor\",orientation:\"up\"}),{paths:Hk,texts:mit,bounds:lc,refblocks:yv,circles:Qk}=ll,Zk=Y({primitives:[...Object.values(Hk),...Object.values(Qk),{type:\"text\",text:\"{REF}\",x:0.2,y:-0.1404553499999995},{type:\"text\",text:\"{VAL}\",x:-0.2,y:-0.1494553499999995}],ports:[{...yv.left1,labels:[\"1\"]},{...yv.right1,labels:[\"2\"]}],size:{width:lc.width,height:lc.height},center:{x:lc.centerX,y:lc.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left\",[\"1\"]).labelPort(\"right\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),hl={paths:{\"left-lead\":{type:\"path\",points:[{x:-0.175,y:0},{x:-0.115,y:0}],color:\"primary\",fill:!1,strokeWidth:0.02},zigzag:{type:\"path\",points:[{x:-0.115,y:0},{x:-0.07,y:0.095},{x:-0.025,y:-0.095},{x:0.025,y:0.095},{x:0.07,y:-0.095},{x:0.115,y:0}],color:\"primary\",fill:!1,strokeWidth:0.02},\"right-lead\":{type:\"path\",points:[{x:0.115,y:0},{x:0.175,y:0}],color:\"primary\",fill:!1,strokeWidth:0.02}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25,anchor:\"middle_bottom\"},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25,anchor:\"middle_top\"}},refblocks:{left1:{x:-0.175,y:0},right1:{x:0.175,y:0}},bounds:{minX:-0.175,maxX:0.175,minY:-0.25,maxY:0.25,width:0.35,height:0.5,centerX:0,centerY:0},circles:{}},qk=yt(hl,{kind:\"resistor\",orientation:\"down\"}),Jk=yt(hl,{kind:\"resistor\",orientation:\"left\"}),Kk=yt(hl,{kind:\"resistor\",orientation:\"right\"}),tN=yt(hl,{kind:\"resistor\",orientation:\"up\"}),MS={paths:{path27:{type:\"path\",points:[{x:0.76,y:-0.28},{x:0.31,y:-0.28}],color:\"primary\",fill:!1},path28:{type:\"path\",points:[{x:-0.3,y:-0.02},{x:-0.77,y:-0.02}],color:\"primary\",fill:!1},path30:{type:\"path\",points:[{x:-0.3,y:0.35},{x:-0.3,y:-0.28}],color:\"primary\",fill:!1},\"path27-3\":{type:\"path\",points:[{x:0.77,y:0.35},{x:0.32,y:0.35}],color:\"primary\",fill:!1},\"path29-5\":{type:\"path\",points:[{x:-0.07,y:-0.28},{x:-0.3,y:-0.28}],color:\"primary\",fill:!1},\"path29-5-7\":{type:\"path\",points:[{x:0.33,y:-0.28},{x:0.11,y:-0.28}],color:\"primary\",fill:!1},\"path29-5-7-6\":{type:\"path\",points:[{x:-0.06,y:-0.17},{x:-0.06,y:-0.39}],color:\"primary\",fill:!1},\"path29-5-7-6-6\":{type:\"path\",points:[{x:0.09,y:-0.17},{x:0.09,y:-0.39}],color:\"primary\",fill:!1},\"path29-5-9\":{type:\"path\",points:[{x:-0.07,y:0.35},{x:-0.3,y:0.35}],color:\"primary\",fill:!1},\"path29-5-7-2\":{type:\"path\",points:[{x:0.33,y:0.35},{x:0.11,y:0.35}],color:\"primary\",fill:!1},\"path29-5-7-6-0\":{type:\"path\",points:[{x:-0.06,y:0.46},{x:-0.06,y:0.24}],color:\"primary\",fill:!1},\"path29-5-7-6-6-2\":{type:\"path\",points:[{x:0.09,y:0.46},{x:0.09,y:0.24}],color:\"primary\",fill:!1},\"path29-5-92\":{type:\"path\",points:[{x:0.33,y:0.13},{x:0.33,y:0.35}],color:\"primary\",fill:!1},\"path29-5-7-28\":{type:\"path\",points:[{x:0.33,y:-0.28},{x:0.33,y:-0.05}],color:\"primary\",fill:!1},\"path29-5-7-6-9\":{type:\"path\",points:[{x:0.44,y:0.11},{x:0.22,y:0.11}],color:\"primary\",fill:!1},\"path29-5-7-6-6-7\":{type:\"path\",points:[{x:0.44,y:-0.04},{x:0.22,y:-0.04}],color:\"primary\",fill:!1},\"path29-5-7-6-9-2\":{type:\"path\",points:[{x:0.44,y:0.07},{x:0.22,y:0.07}],color:\"primary\",fill:!1},\"path29-5-7-6-9-2-4\":{type:\"path\",points:[{x:0.44,y:0},{x:0.44,y:0.07}],color:\"primary\",fill:!1},\"path29-5-7-6-9-2-4-6\":{type:\"path\",points:[{x:0.22,y:0},{x:0.22,y:0.07}],color:\"primary\",fill:!1},\"path29-5-7-6-9-2-9\":{type:\"path\",points:[{x:0.44,y:0},{x:0.22,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.02,y:0.53},bottom1:{type:\"text\",text:\"{VAL}\",x:0.01,y:-0.54}},refblocks:{left1:{x:-0.77,y:-0.02},right1:{x:0.76,y:-0.28},right2:{x:0.77,y:0.35}},bounds:{minX:-0.79,maxX:0.79,minY:-0.54,maxY:0.54,width:1.59,height:1.07,centerX:0,centerY:0},circles:{}},{paths:eN,texts:_v,bounds:pc,refblocks:Kh,circles:rN}=MS,dl=Yt({primitives:[...Object.values(eN),...Object.values(rN),{..._v.top1,anchor:\"middle_bottom\"},{..._v.bottom1,anchor:\"middle_top\"}],ports:[{...Kh.left1,labels:[\"1\"]},{...Kh.right1,labels:[\"2\"]},{...Kh.right2,labels:[\"3\"]}],size:{width:pc.width,height:pc.height},center:{x:pc.centerX,y:pc.centerY}}),cu=Z(dl,\"down\"),lu=cu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),pu=cu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");lu.anchor=\"middle_bottom\";pu.anchor=\"middle_top\";lu.y+=0.3;lu.x+=0.101;pu.y-=0.49999;pu.x+=1.19999;var nN=cu,{paths:iN,texts:uit,bounds:hc,refblocks:td,circles:oN}=MS,CS=Yt({primitives:[...Object.values(iN),...Object.values(oN),{type:\"text\",text:\"{REF}\",x:0.01596175000000022,y:-0.5308501500000009,anchor:\"middle_top\"},{type:\"text\",text:\"{VAL}\",x:0.013116750000000454,y:0.5408501499999989,anchor:\"middle_bottom\"}],ports:[{...td.left1,labels:[\"1\"]},{...td.right1,labels:[\"2\"]},{...td.right2,labels:[\"3\"]}],size:{width:hc.width,height:hc.height},center:{x:hc.centerX,y:hc.centerY}}),hu=Z(dl,\"left\"),du=hu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),mu=hu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");du.anchor=\"middle_bottom\";mu.anchor=\"middle_top\";du.y+=0.99;du.x-=0;mu.y-=1.10999;mu.x=0;var sN=hu,uu=Z(dl,\"up\"),fu=uu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),yu=uu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");fu.anchor=\"middle_bottom\";yu.anchor=\"middle_top\";fu.y+=0.499;fu.x=0.62;yu.y-=0.29999;yu.x+=0.1;var aN=uu,cN=Z(CS),lN={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1},\"path43-7\":{type:\"path\",points:[{x:0.21,y:0.18},{x:0.14,y:0.18}],color:\"primary\",fill:!1},\"path43-7-9\":{type:\"path\",points:[{x:0.21,y:0.13},{x:0.21,y:0.18}],color:\"primary\",fill:!1},\"path43-7-2\":{type:\"path\",points:[{x:0.08,y:-0.09},{x:0.14,y:-0.09}],color:\"primary\",fill:!1},\"path43-7-9-3\":{type:\"path\",points:[{x:0.08,y:-0.04},{x:0.08,y:-0.09}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},ml=Y(lN).labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{VAL}\",\"middle_top\").changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),_u=Z(ml,\"down\"),gu=_u.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),xu=_u.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");gu.anchor=\"middle_left\";xu.anchor=\"middle_left\";gu.y+=0.3;gu.x=0.3;xu.y-=0.3;xu.x=0.3;var pN=_u,bu=Z(ml,\"left\"),vu=bu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Su=bu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");vu.anchor=\"middle_bottom\";Su.anchor=\"middle_top\";vu.y+=0.5;vu.x=0;Su.y-=0.55;Su.x=0;var hN=bu,wu=Z(ml,\"up\"),Au=wu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Pu=wu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Au.anchor=\"middle_left\";Pu.anchor=\"middle_left\";Au.y+=0.3;Au.x=0.3;Pu.y-=0.3;Pu.x=0.3;var dN=wu,kS={paths:{path11:{type:\"path\",points:[{x:-0.52,y:0.04},{x:-0.18,y:0.04}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.19,y:0.05},{x:0.52,y:0.05}],color:\"primary\",fill:!1},\"path12-6\":{type:\"path\",points:[{x:0.18,y:-0.15},{x:0.18,y:0.25}],color:\"primary\",fill:!1},\"path12-2\":{type:\"path\",points:[{x:0.19,y:0},{x:0.35,y:-0.14}],color:\"primary\",fill:!1},\"path12-2-9\":{type:\"path\",points:[{x:0.35,y:-0.14},{x:0.34,y:-0.35}],color:\"primary\",fill:!1},\"path11-0-9\":{type:\"path\",points:[{x:-0.17,y:0.27},{x:-0.17,y:-0.15},{x:0.18,y:0.05},{x:-0.17,y:0.27}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.22,y:0.38},bottom1:{type:\"text\",text:\"{VAL}\",x:0.11,y:-0.38}},refblocks:{bottom1:{x:0.34,y:-0.35},left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.05}},bounds:{minX:-0.55,maxX:0.55,minY:-0.38,maxY:0.38,width:1.09,height:0.77,centerX:0,centerY:0},circles:{}},{paths:fit,texts:yit,bounds:_it,refblocks:git,circles:xit}=kS,NS=Y(kS).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"bottom1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),YS=Z(NS),mN=YS.primitives.filter((t)=\u003et.type===\"text\"),LS=mN.find((t)=\u003et.text===\"{REF}\");LS.y=0;LS.anchor=\"middle_left\";var uN=YS,TS={paths:{path44:{type:\"path\",points:[{x:-0.195,y:-0.025},{x:-0.45,y:-0.025}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.45,y:-0.025},{x:0.195,y:-0.025}],color:\"primary\",fill:!1},\"path44-0-7\":{type:\"path\",points:[{x:0.07,y:-0.025},{x:-0.07,y:-0.025}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.07,y:0.1},{x:0.07,y:-0.15}],color:\"primary\",fill:!0},\"path2-8\":{type:\"path\",points:[{x:-0.07,y:0.1},{x:-0.07,y:-0.15}],color:\"primary\",fill:!0},\"path8704-1\":{type:\"path\",points:[{x:-0.07,y:0.1},{x:-0.082252,y:0.099398},{x:-0.094386,y:0.097598},{x:-0.106286,y:0.094618},{x:-0.117835,y:0.090485},{x:-0.128925,y:0.08524},{x:-0.139446,y:0.078934},{x:-0.149299,y:0.071626},{x:-0.158388,y:0.063388},{x:-0.166626,y:0.054299},{x:-0.173934,y:0.044446},{x:-0.18024,y:0.033925},{x:-0.185485,y:0.022835},{x:-0.189618,y:0.011286},{x:-0.192598,y:-0.000614},{x:-0.194398,y:-0.012748},{x:-0.195,y:-0.025},{x:-0.194398,y:-0.037252},{x:-0.192598,y:-0.049386},{x:-0.189618,y:-0.061286},{x:-0.185485,y:-0.072835},{x:-0.18024,y:-0.083925},{x:-0.173934,y:-0.094446},{x:-0.166626,y:-0.104299},{x:-0.158388,y:-0.113388},{x:-0.149299,y:-0.121626},{x:-0.139446,y:-0.128934},{x:-0.128925,y:-0.13524},{x:-0.117835,y:-0.140485},{x:-0.106286,y:-0.144618},{x:-0.094386,y:-0.147598},{x:-0.082252,y:-0.149398},{x:-0.07,y:-0.15}],color:\"primary\",fill:!1},\"path8704-1-7\":{type:\"path\",points:[{x:0.07,y:0.1},{x:0.082252,y:0.099398},{x:0.094386,y:0.097598},{x:0.106286,y:0.094618},{x:0.117835,y:0.090485},{x:0.128925,y:0.08524},{x:0.139446,y:0.078934},{x:0.149299,y:0.071626},{x:0.158388,y:0.063388},{x:0.166626,y:0.054299},{x:0.173934,y:0.044446},{x:0.18024,y:0.033925},{x:0.185485,y:0.022835},{x:0.189618,y:0.011286},{x:0.192598,y:-0.000614},{x:0.194398,y:-0.012748},{x:0.195,y:-0.025},{x:0.194398,y:-0.037252},{x:0.192598,y:-0.049386},{x:0.189618,y:-0.061286},{x:0.185485,y:-0.072835},{x:0.18024,y:-0.083925},{x:0.173934,y:-0.094446},{x:0.166626,y:-0.104299},{x:0.158388,y:-0.113388},{x:0.149299,y:-0.121626},{x:0.139446,y:-0.128934},{x:0.128925,y:-0.13524},{x:0.117835,y:-0.140485},{x:0.106286,y:-0.144618},{x:0.094386,y:-0.147598},{x:0.082252,y:-0.149398},{x:0.07,y:-0.15}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.020635199999998965,y:0.15414649999999952}},refblocks:{left1:{x:-0.4458008,y:-0.025023700000000426},right1:{x:0.4458008,y:-0.02514810000000045}},bounds:{minX:-0.45,maxX:0.45,minY:-0.15,maxY:0.1,width:0.9,height:0.25,centerX:0,centerY:-0.025},circles:{}},fN=Y(TS).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),Bu=Y(TS).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),ES=Z(Bu,\"left\"),Iu=ES.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Iu.anchor=\"middle_bottom\";Iu.y+=0.4;Iu.x=0;var yN=ES,RS=Z(Bu,\"up\"),Fu=RS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Fu.anchor=\"middle_left\";Fu.y+=0;Fu.x=0.2;var _N=RS,OS={paths:{path44:{type:\"path\",points:[{x:-0.195,y:-0.025},{x:-0.45,y:-0.025}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.45,y:-0.025},{x:0.195,y:-0.025}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.07,y:0.1},{x:0.07,y:-0.15}],color:\"primary\",fill:!0},\"path2-8\":{type:\"path\",points:[{x:-0.07,y:0.1},{x:-0.07,y:-0.15}],color:\"primary\",fill:!0},\"path8704-1\":{type:\"path\",points:[{x:-0.07,y:0.1},{x:-0.082252,y:0.099398},{x:-0.094386,y:0.097598},{x:-0.106286,y:0.094618},{x:-0.117835,y:0.090485},{x:-0.128925,y:0.08524},{x:-0.139446,y:0.078934},{x:-0.149299,y:0.071626},{x:-0.158388,y:0.063388},{x:-0.166626,y:0.054299},{x:-0.173934,y:0.044446},{x:-0.18024,y:0.033925},{x:-0.185485,y:0.022835},{x:-0.189618,y:0.011286},{x:-0.192598,y:-0.000614},{x:-0.194398,y:-0.012748},{x:-0.195,y:-0.025},{x:-0.194398,y:-0.037252},{x:-0.192598,y:-0.049386},{x:-0.189618,y:-0.061286},{x:-0.185485,y:-0.072835},{x:-0.18024,y:-0.083925},{x:-0.173934,y:-0.094446},{x:-0.166626,y:-0.104299},{x:-0.158388,y:-0.113388},{x:-0.149299,y:-0.121626},{x:-0.139446,y:-0.128934},{x:-0.128925,y:-0.13524},{x:-0.117835,y:-0.140485},{x:-0.106286,y:-0.144618},{x:-0.094386,y:-0.147598},{x:-0.082252,y:-0.149398},{x:-0.07,y:-0.15}],color:\"primary\",fill:!1},\"path8704-1-7\":{type:\"path\",points:[{x:0.07,y:0.1},{x:0.082252,y:0.099398},{x:0.094386,y:0.097598},{x:0.106286,y:0.094618},{x:0.117835,y:0.090485},{x:0.128925,y:0.08524},{x:0.139446,y:0.078934},{x:0.149299,y:0.071626},{x:0.158388,y:0.063388},{x:0.166626,y:0.054299},{x:0.173934,y:0.044446},{x:0.18024,y:0.033925},{x:0.185485,y:0.022835},{x:0.189618,y:0.011286},{x:0.192598,y:-0.000614},{x:0.194398,y:-0.012748},{x:0.195,y:-0.025},{x:0.194398,y:-0.037252},{x:0.192598,y:-0.049386},{x:0.189618,y:-0.061286},{x:0.185485,y:-0.072835},{x:0.18024,y:-0.083925},{x:0.173934,y:-0.094446},{x:0.166626,y:-0.104299},{x:0.158388,y:-0.113388},{x:0.149299,y:-0.121626},{x:0.139446,y:-0.128934},{x:0.128925,y:-0.13524},{x:0.117835,y:-0.140485},{x:0.106286,y:-0.144618},{x:0.094386,y:-0.147598},{x:0.082252,y:-0.149398},{x:0.07,y:-0.15}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.020635199999998965,y:0.15414649999999952}},refblocks:{left1:{x:-0.44,y:-0.02},right1:{x:0.4458008,y:-0.02514810000000045}},bounds:{minX:-0.45,maxX:0.45,minY:-0.15,maxY:0.1,width:0.9,height:0.25,centerX:0,centerY:-0.025},circles:{}},gN=Y(OS).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),Mu=Y(OS).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),WS=Z(Mu,\"left\"),Cu=WS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Cu.anchor=\"middle_bottom\";Cu.y+=0.4;Cu.x=0;var xN=WS,$S=Z(Mu,\"up\"),ku=$S.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");ku.anchor=\"middle_left\";ku.y+=0.05;ku.x=0.2;var bN=$S,jS={paths:{path44:{type:\"path\",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:\"primary\",fill:!1},\"path44-5\":{type:\"path\",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:\"primary\",fill:!0},\"path2-88\":{type:\"path\",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5\":{type:\"path\",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5-1\":{type:\"path\",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:\"primary\",fill:!0},\"path2-88-5-1-6\":{type:\"path\",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-8\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:\"primary\",fill:!0},\"path8704-1\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:\"primary\",fill:!1},\"path8704-1-7\":{type:\"path\",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:\"primary\",fill:!1},path1:{type:\"path\",points:[{x:-0.045,y:0.1},{x:-0.125,y:0.1}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.020635199999998965,y:0.28075747049999955}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},vN=Y(jS).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),Nu=Y(jS).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),XS=Z(Nu,\"left\"),Yu=XS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Yu.anchor=\"middle_left\";Yu.y+=0.5;Yu.x=0.2;var SN=XS,DS=Z(Nu,\"up\"),Lu=DS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Lu.anchor=\"middle_left\";Lu.y+=0.3;Lu.x=0.2;var wN=DS,VS={paths:{path44:{type:\"path\",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:\"primary\",fill:!1},\"path44-5\":{type:\"path\",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:\"primary\",fill:!0},\"path2-88\":{type:\"path\",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5\":{type:\"path\",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5-1\":{type:\"path\",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:\"primary\",fill:!0},\"path2-88-5-1-6\":{type:\"path\",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-8\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:\"primary\",fill:!0},\"path8704-1\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:\"primary\",fill:!1},\"path8704-1-7\":{type:\"path\",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:\"primary\",fill:!1},path1:{type:\"path\",points:[{x:-0.045,y:0.1},{x:-0.125,y:0.1}],color:\"primary\",fill:!1},\"path44-0-7\":{type:\"path\",points:[{x:0.125,y:0.1},{x:0.045,y:0.1}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.28}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},AN=Y(VS).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),Tu=Y(VS).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),zS=Z(Tu,\"left\"),Eu=zS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Eu.anchor=\"middle_left\";Eu.y+=0.5;Eu.x=0.2;var PN=zS,US=Z(Tu,\"up\"),Ru=US.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Ru.anchor=\"middle_left\";Ru.y+=0.4;Ru.x=0.2;var BN=US,GS={paths:{path44:{type:\"path\",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:\"primary\",fill:!1},\"path44-5\":{type:\"path\",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:\"primary\",fill:!0},\"path2-88\":{type:\"path\",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5\":{type:\"path\",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5-1\":{type:\"path\",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:\"primary\",fill:!0},\"path2-88-5-1-6\":{type:\"path\",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-8\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:\"primary\",fill:!0},\"path8704-1\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:\"primary\",fill:!1},\"path8704-1-7\":{type:\"path\",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:\"primary\",fill:!1},\"path44-0-7\":{type:\"path\",points:[{x:0.125,y:0.1},{x:0.045,y:0.1}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.28}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},IN=Y(GS).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),Ou=Y(GS).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),HS=Z(Ou,\"left\"),Wu=HS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Wu.anchor=\"middle_left\";Wu.y+=0.6;Wu.x=0.3;var FN=HS,QS=Z(Ou,\"up\"),$u=QS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");$u.anchor=\"middle_left\";$u.y+=0.4;$u.x=0.2;var MN=QS,ZS={paths:{path44:{type:\"path\",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:\"primary\",fill:!1},\"path44-5\":{type:\"path\",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:\"primary\",fill:!0},\"path2-88\":{type:\"path\",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5\":{type:\"path\",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-88-5-1\":{type:\"path\",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:\"primary\",fill:!0},\"path2-88-5-1-6\":{type:\"path\",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:\"primary\",fill:!0},\"path2-8\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:\"primary\",fill:!0},\"path8704-1\":{type:\"path\",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:\"primary\",fill:!1},\"path8704-1-7\":{type:\"path\",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.020635199999998965,y:0.28075747049999955}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},CN=Y(ZS).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),ju=Y(ZS).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"bottom1\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),qS=Z(ju,\"left\"),Xu=qS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Xu.anchor=\"middle_left\";Xu.y+=0.5;Xu.x=0.3;var kN=qS,JS=Z(ju,\"up\"),Du=JS.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");Du.anchor=\"middle_left\";Du.y+=0.3;Du.x=0.2;var NN=JS,YN={paths:{path1:{type:\"path\",points:[{x:-0.37,y:0.03},{x:-0.13,y:0.03}],color:\"primary\",fill:!1},\"path-1-3\":{type:\"path\",points:[{x:-0.07,y:0.03},{x:0.11,y:-0.03}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.1,y:-0.06},{x:0.37,y:-0.06}],color:\"primary\",fill:!1},path3:{type:\"path\",points:[{x:0.12,y:0.17},{x:0.37,y:0.17}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.37},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.37}},refblocks:{left1:{x:-0.37,y:0.03},right1:{x:0.37,y:-0.06},right2:{x:0.37,y:0.17}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.79,height:0.79,centerX:0,centerY:0},circles:{\"circle-3\":{type:\"circle\",x:0.08,y:-0.07,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.1,y:0.03,radius:0.02,color:\"primary\",fill:!1},\"circle-2\":{type:\"circle\",x:0.08,y:0.17,radius:0.02,color:\"primary\",fill:!1}}},ul=Y(YN).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right2\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),Vu=Z(ul,\"down\"),zu=Vu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Uu=Vu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");zu.anchor=\"middle_bottom\";Uu.anchor=\"middle_top\";zu.x=0.44;zu.y+=0.28;Uu.y-=0.28;Uu.x=0.44;var LN=Vu,Gu=Z(ul,\"left\"),Hu=Gu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Qu=Gu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Hu.anchor=\"middle_bottom\";Qu.anchor=\"middle_top\";Hu.x=0;Hu.y+=0.625;Qu.y-=0.695;Qu.x=0;var TN=Gu,Zu=Z(ul,\"up\"),qu=Zu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Ju=Zu.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");qu.anchor=\"middle_bottom\";Ju.anchor=\"middle_top\";qu.x=0.4;qu.y+=0.28;Ju.y-=0.28;Ju.x=0.4;var EN=Zu,RN={paths:{path1:{type:\"path\",points:[{x:-0.37,y:0.03},{x:-0.13,y:0.03}],color:\"primary\",fill:!1},\"path-1-3\":{type:\"path\",points:[{x:-0.07,y:0.03},{x:0.11,y:0.14}],color:\"primary\",fill:!1},path2:{type:\"path\",points:[{x:0.1,y:-0.06},{x:0.37,y:-0.06}],color:\"primary\",fill:!1},path3:{type:\"path\",points:[{x:0.12,y:0.17},{x:0.37,y:0.17}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.4},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.4}},refblocks:{left1:{x:-0.37,y:0.03},right1:{x:0.37,y:-0.06},right3:{x:0.37,y:0.17}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.79,height:0.79,centerX:0,centerY:0},circles:{\"circle-3\":{type:\"circle\",x:0.08,y:-0.07,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.1,y:0.03,radius:0.02,color:\"primary\",fill:!1},\"circle-2\":{type:\"circle\",x:0.08,y:0.17,radius:0.02,color:\"primary\",fill:!1}}},fl=Y(RN).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right3\",[\"2\"]).labelPort(\"right1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),Ku=Z(fl,\"down\"),tf=Ku.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),ef=Ku.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");tf.anchor=\"middle_bottom\";ef.anchor=\"middle_top\";tf.x=0.44;tf.y+=0.28;ef.y-=0.28;ef.x=0.44;var ON=Ku,rf=Z(fl,\"left\"),nf=rf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),of=rf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");nf.anchor=\"middle_bottom\";of.anchor=\"middle_top\";nf.x=0;nf.y+=0.625;of.y-=0.695;of.x=0;var WN=rf,sf=Z(fl,\"up\"),af=sf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),cf=sf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");af.anchor=\"middle_bottom\";cf.anchor=\"middle_top\";af.x=0.4;af.y+=0.28;cf.y-=0.28;cf.x=0.4;var $N=sf,Yi={paths:{\"lead-positive\":{type:\"path\",points:[{x:-0.4,y:0.19999999999999996},{x:-0.20000000000000007,y:0.19999999999999996}],color:\"primary\",fill:!1},\"lead-negative\":{type:\"path\",points:[{x:-0.4,y:-0.20000000000000018},{x:-0.20000000000000007,y:-0.20000000000000018}],color:\"primary\",fill:!1},\"voice-coil\":{type:\"path\",points:[{x:-0.20000000000000007,y:0.19999999999999996},{x:0,y:0.19999999999999996},{x:0,y:-0.20000000000000018},{x:-0.20000000000000007,y:-0.20000000000000018},{x:-0.20000000000000007,y:0.19999999999999996}],color:\"primary\",fill:!1},cone:{type:\"path\",points:[{x:0,y:0.19999999999999996},{x:0.3999999999999999,y:0.3999999999999999},{x:0.3999999999999999,y:-0.40000000000000013},{x:0,y:-0.20000000000000018},{x:0,y:0.19999999999999996}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.6},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.6000000000000001}},refblocks:{left1:{x:-0.4,y:-0.20000000000000018},left2:{x:-0.4,y:0.19999999999999996}},bounds:{minX:-0.4,maxX:0.3999999999999999,minY:-0.6000000000000001,maxY:0.6,width:0.7999999999999999,height:1.2000000000000002,centerX:-0.00000000000000005551115123125783,centerY:-0.00000000000000005551115123125783},circles:{}},KS=Y(Yi).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"left2\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),dc=He(KS.primitives),jN={...KS,center:{x:(dc.minX+dc.maxX)/2,y:(dc.minY+dc.maxY)/2}},tw=Y(Yi).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"left2\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),mc=He(tw.primitives),XN={...tw,center:{x:(mc.minX+mc.maxX)/2,y:(mc.minY+mc.maxY)/2}},ew=Y(Yi).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"left2\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),uc=He(ew.primitives),DN={...ew,center:{x:(uc.minX+uc.maxX)/2,y:(uc.minY+uc.maxY)/2}},rw=Y(Yi).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"left2\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),fc=He(rw.primitives),VN={...rw,center:{x:(fc.minX+fc.maxX)/2,y:(fc.minY+fc.maxY)/2}},nw=Y(Yi).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"left2\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),yc=He(nw.primitives),zN={...nw,center:{x:(yc.minX+yc.maxX)/2,y:(yc.minY+yc.maxY)/2}},iw=Y(Yi).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"2\",\"neg\"]).labelPort(\"left2\",[\"1\",\"pos\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),_c=He(iw.primitives),UN={...iw,center:{x:(_c.minX+_c.maxX)/2,y:(_c.minY+_c.maxY)/2}},yl={paths:{path11:{type:\"path\",points:[{x:-0.38,y:0},{x:-0.12,y:-0.01}],color:\"primary\",fill:!1},\"path11-0\":{type:\"path\",points:[{x:-0.07,y:0},{x:0.11,y:0.05}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.12,y:-0.01},{x:0.38,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.31},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.28}},refblocks:{left1:{x:-0.12,y:-0.01},left2:{x:-0.38,y:0},right1:{x:0.12,y:-0.01},right2:{x:0.38,y:0}},bounds:{minX:-0.4,maxX:0.4,minY:-0.25,maxY:0.25,width:0.81,height:0.5,centerX:0,centerY:0},circles:{\"circle-2\":{type:\"circle\",x:0.1,y:0,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.1,y:0,radius:0.02,color:\"primary\",fill:!1}}};delete yl.refblocks.left1;delete yl.refblocks.right1;yl.bounds.width+=0.2;var _l=Y(yl).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left2\",[\"1\"]).labelPort(\"right2\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),lf=Z(_l,\"down\"),pf=lf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),hf=lf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");pf.anchor=\"middle_bottom\";hf.anchor=\"middle_top\";pf.x=0.3;pf.y+=0.265;hf.y-=0.265;hf.x=0.3;var GN=lf,df=Z(_l,\"left\"),mf=df.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),uf=df.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");mf.anchor=\"middle_bottom\";uf.anchor=\"middle_top\";mf.x=0;mf.y+=0.57;uf.y-=0.57;uf.x=0;var HN=df,ff=Z(_l,\"up\"),yf=ff.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),_f=ff.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");yf.anchor=\"middle_bottom\";_f.anchor=\"middle_top\";yf.x=0.3;yf.y+=0.265;_f.y-=0.265;_f.x=0.3;var QN=ff,gl={paths:{path11:{type:\"path\",points:[{x:-0.38,y:0},{x:-0.12,y:-0.01}],color:\"primary\",fill:!1},\"path11-0\":{type:\"path\",points:[{x:-0.07,y:0.01},{x:0.1,y:0.14}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.12,y:-0.01},{x:0.38,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25}},refblocks:{left1:{x:-0.12,y:-0.01},left2:{x:-0.38,y:0},right1:{x:0.12,y:-0.01},right2:{x:0.38,y:0}},bounds:{minX:-0.4,maxX:0.4,minY:-0.25,maxY:0.25,width:0.81,height:0.5,centerX:0,centerY:0},circles:{\"circle-2\":{type:\"circle\",x:0.1,y:0,radius:0.02,color:\"primary\",fill:!1},\"circle-1\":{type:\"circle\",x:-0.1,y:0,radius:0.02,color:\"primary\",fill:!1}}};delete gl.refblocks.left1;delete gl.refblocks.right1;gl.bounds.width+=0.2;var xl=Y(gl).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left2\",[\"1\"]).labelPort(\"right2\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),gf=Z(xl,\"down\"),xf=gf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),bf=gf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");xf.anchor=\"middle_bottom\";bf.anchor=\"middle_top\";xf.x=0.3;xf.y+=0.265;bf.y-=0.265;bf.x=0.3;var ZN=gf,vf=Z(xl,\"left\"),Sf=vf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),wf=vf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Sf.anchor=\"middle_bottom\";wf.anchor=\"middle_top\";Sf.x=0;Sf.y+=0.57;wf.y-=0.57;wf.x=0;var qN=vf,Af=Z(xl,\"up\"),Pf=Af.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Bf=Af.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Pf.anchor=\"middle_bottom\";Bf.anchor=\"middle_top\";Pf.x=0.3;Pf.y+=0.265;Bf.y-=0.265;Bf.x=0.3;var JN=Af,bl={paths:{path44:{type:\"path\",points:[{x:-0.16845120000000047,y:0.02621170000000017},{x:-0.4458008,y:0.02709619999999968}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.4458008,y:0.026971799999999657},{x:0.1677968999999997,y:0.027926399999999685}],color:\"primary\",fill:!1},\"path8704-1\":{type:\"path\",points:[{x:-0.0040837000000002455,y:-0.13467459999999964},{x:-0.0040837000000002455,y:-0.13467459999999964},{x:-0.017668143940740948,y:-0.1311205263185182},{x:-0.03043520885925943,y:-0.12727072121481456},{x:-0.04240966440000013,y:-0.1231399985999998},{x:-0.05361628020740751,y:-0.11874317238518502},{x:-0.064079825925926,y:-0.11409505648148131},{x:-0.07382507120000005,y:-0.10921046479999987},{x:-0.0828767856740741,y:-0.10410421125185171},{x:-0.0912597389925926,y:-0.09879110974814802},{x:-0.09899870079999995,y:-0.0932859741999998},{x:-0.10611844074074069,y:-0.08760361851851838},{x:-0.11264372845925916,y:-0.0817588566148146},{x:-0.11859933359999993,y:-0.07576650239999982},{x:-0.12401002580740728,y:-0.06964136978518495},{x:-0.12890057472592584,y:-0.06339827268148127},{x:-0.13329574999999985,y:-0.05705202499999972},{x:-0.13722032127407394,y:-0.05061744065185156},{x:-0.14069905819259243,y:-0.04410933354814783},{x:-0.14375673039999987,y:-0.03754251759999966},{x:-0.14641810754074058,y:-0.030931806718518143},{x:-0.1487079592592591,y:-0.0242920148148144},{x:-0.15065105519999983,y:-0.017637955799999563},{x:-0.15227216500740723,y:-0.01098444358518472},{x:-0.15359605832592574,y:-0.004346292081480994},{x:-0.1546475047999998,y:0.00226168480000051},{x:-0.15545127407407386,y:0.008824673148148676},{x:-0.1560321357925924,y:0.015327859051852397},{x:-0.1564148595999998,y:0.02175642860000056},{x:-0.1566242151407405,y:0.028095567881482052},{x:-0.15668497205925902,y:0.03433046298518576},{x:-0.15662189999999976,y:0.04044630000000058},{x:-0.15662189999999976,y:0.0404463000000006},{x:-0.15662189999999976,y:0.0404463000000006},{x:-0.15622857394444417,y:0.04717166472222282},{x:-0.1553217675555553,y:0.05388046444444503},{x:-0.15392183849999977,y:0.060558907500000585},{x:-0.1520491444444442,y:0.0671932022222228},{x:-0.1497240430555553,y:0.07376955694444502},{x:-0.14696689199999974,y:0.08027418000000058},{x:-0.14379804894444415,y:0.0866932797222228},{x:-0.1402378715555553,y:0.09301306444444506},{x:-0.13630671749999965,y:0.09921974250000057},{x:-0.13202494444444415,y:0.10529952222222282},{x:-0.12741291005555522,y:0.11123861194444501},{x:-0.1224909719999997,y:0.1170232200000006},{x:-0.11727948794444407,y:0.12263955472222278},{x:-0.11179881555555524,y:0.12807382444444504},{x:-0.10606931249999965,y:0.13331223750000057},{x:-0.1001113364444441,y:0.13834100222222284},{x:-0.09394524505555521,y:0.14314632694444504},{x:-0.08759139599999967,y:0.14771442000000062},{x:-0.08107014694444413,y:0.15203148972222283},{x:-0.07440185555555523,y:0.15608374444444503},{x:-0.0676068794999997,y:0.15985739250000058},{x:-0.06070557644444415,y:0.16333864222222283},{x:-0.05371830405555529,y:0.16651370194444504},{x:-0.04666541999999976,y:0.1693687800000006},{x:-0.03956728194444424,y:0.1718900847222228},{x:-0.03244424755555539,y:0.17406382444444501},{x:-0.025316674499999876,y:0.17587620750000055},{x:-0.01820492044444437,y:0.17731344222222278},{x:-0.01112934305555553,y:0.178361736944445},{x:-0.004110300000000034,y:0.17900730000000054},{x:-0.004110300000000011,y:0.17900730000000054}],color:\"primary\",fill:!1},\"path8704-1-9\":{type:\"path\",points:[{x:0.004158700000000071,y:-0.1355885000000001},{x:0.004158700000000071,y:-0.1355885000000001},{x:0.017743143940740766,y:-0.1320344263185187},{x:0.03051020885925925,y:-0.12818462121481505},{x:0.042484664399999955,y:-0.12405389860000024},{x:0.053691280207407335,y:-0.11965707238518546},{x:0.0641548259259258,y:-0.11500895648148178},{x:0.07390007119999986,y:-0.1101243648000003},{x:0.0829517856740739,y:-0.10501811125185218},{x:0.0913347389925924,y:-0.09970500974814848},{x:0.09907370079999973,y:-0.09419987420000027},{x:0.10619344074074046,y:-0.08851751851851883},{x:0.11271872845925893,y:-0.08267275661481507},{x:0.11867433359999968,y:-0.07668040240000029},{x:0.12408502580740703,y:-0.0705552697851854},{x:0.12897557472592555,y:-0.06431217268148172},{x:0.13337074999999957,y:-0.05796592500000018},{x:0.13729532127407365,y:-0.05153134065185202},{x:0.14077405819259214,y:-0.045023233548148286},{x:0.14383173039999952,y:-0.038456417600000126},{x:0.14649310754074024,y:-0.03184570671851861},{x:0.14878295925925875,y:-0.02520591481481487},{x:0.1507260551999995,y:-0.01855185580000003},{x:0.15234716500740686,y:-0.011898343585185192},{x:0.15367105832592537,y:-0.005260192081481464},{x:0.15472250479999944,y:0.001347784800000043},{x:0.1555262740740735,y:0.007910773148148207},{x:0.156107135792592,y:0.01441395905185193},{x:0.1564898595999994,y:0.020842528600000094},{x:0.15669921514074014,y:0.02718166788148159},{x:0.15675997205925862,y:0.03341656298518529},{x:0.15669689999999936,y:0.03953240000000011},{x:0.15669689999999936,y:0.039532400000000134},{x:0.15669689999999936,y:0.039532400000000134},{x:0.1563035739444438,y:0.04625776472222235},{x:0.15539676755555493,y:0.05296656444444457},{x:0.15399683849999934,y:0.05964500750000013},{x:0.1521241444444438,y:0.06627930222222234},{x:0.14979904305555491,y:0.07285565694444456},{x:0.14704189199999937,y:0.07936028000000013},{x:0.1438730489444438,y:0.08577937972222234},{x:0.1403128715555549,y:0.09209916444444458},{x:0.13638171749999925,y:0.0983058425000001},{x:0.13209994444444376,y:0.10438562222222235},{x:0.12748791005555482,y:0.11032471194444453},{x:0.12256597199999929,y:0.11610932000000013},{x:0.1173544879444437,y:0.1217256547222223},{x:0.11187381555555485,y:0.12715992444444457},{x:0.10614431249999925,y:0.1323983375000001},{x:0.10018633644444369,y:0.13742710222222235},{x:0.09402024505555481,y:0.14223242694444457},{x:0.08766639599999927,y:0.14680052000000016},{x:0.08114514694444372,y:0.15111758972222236},{x:0.07447685555555483,y:0.15516984444444457},{x:0.06768187949999929,y:0.15894349250000012},{x:0.06078057644444377,y:0.16242474222222236},{x:0.053793304055554894,y:0.16559980194444457},{x:0.046740419999999366,y:0.16845488000000014},{x:0.039642281944443844,y:0.17097618472222234},{x:0.03251924755555499,y:0.17314992444444455},{x:0.02539167449999948,y:0.17496230750000008},{x:0.018279920444443973,y:0.17639954222222232},{x:0.011204343055555134,y:0.17744783694444452},{x:0.004185299999999637,y:0.17809340000000007},{x:0.004185299999999614,y:0.17809340000000007}],color:\"primary\",fill:!1},path4:{type:\"path\",points:[{x:-0.08039130000000005,y:0.0179576999999993},{x:-0.08039130000000005,y:0.09650599999999931}],color:\"primary\",fill:!0},\"path4-5\":{type:\"path\",points:[{x:0.01494479999999987,y:-0.055216500000000224},{x:0.01494479999999987,y:0.09691909999999937}],color:\"primary\",fill:!0},\"path4-5-8\":{type:\"path\",points:[{x:0.06871169999999927,y:-0.056870000000000864},{x:0.06871169999999927,y:0.018784499999999538}],color:\"primary\",fill:!0},\"path4-1\":{type:\"path\",points:[{x:-0.08179359999999969,y:0.09650570000000003},{x:0.015771699999999722,y:0.09650570000000003}],color:\"primary\",fill:!0},\"path4-1-6\":{type:\"path\",points:[{x:0.0117995999999998,y:-0.05594970000000088},{x:0.06843709999999925,y:-0.05594970000000088}],color:\"primary\",fill:!0},\"rect1577-4\":{type:\"path\",points:[{x:-0.17162450000000073,y:0.11125030000000025},{x:-0.2688274000000015,y:0.11125030000000025},{x:-0.2688274000000015,y:0.11469129999999961},{x:-0.17162450000000073,y:0.11469129999999961}],color:\"primary\",fill:!0},\"rect1577-4-7\":{type:\"path\",points:[{x:-0.2184661999999995,y:0.16159429999999997},{x:-0.2184661999999995,y:0.06439139999999943},{x:-0.22190719999999908,y:0.06439139999999943},{x:-0.22190719999999908,y:0.16159429999999997}],color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.0024445000000006267,y:0.23933980000000044},bottom1:{type:\"text\",text:\"{VAL}\",x:0.00341719999999901,y:-0.23933980000000066}},refblocks:{left1:{x:-0.4458008,y:0.02709619999999968},right1:{x:0.4458008,y:0.026971799999999657}},bounds:{minX:-0.473959241,maxX:0.473959241,minY:-0.23933980000000066,maxY:0.23933980000000044,width:0.947918482,height:0.4786796000000011,centerX:0,centerY:-0.00000000000000011102230246251565},circles:{}},KN=Y(bl).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0.02,y:0.2}).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0.5,y:-0.2}).build(),tY=Y(bl).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\",{x:0,y:0.45}).changeTextAnchor(\"{VAL}\",\"middle_top\",{x:0,y:-0.55}).build(),eY=Y(bl).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),rY=Y(bl).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\",\"pos\"]).labelPort(\"right1\",[\"2\",\"neg\"]).changeTextAnchor(\"{VAL}\",\"middle_left\",{x:0.02,y:-0.2}).changeTextAnchor(\"{REF}\",\"middle_left\",{x:0.5,y:0.2}).build(),ow={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1},\"path43-5\":{type:\"path\",points:[{x:0.19,y:-0.09},{x:0.15,y:-0.09}],color:\"primary\",fill:!1},\"path43-5-2\":{type:\"path\",points:[{x:0.19,y:-0.14},{x:0.19,y:-0.09}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:bit,texts:vit,bounds:Sit,refblocks:wit,circles:Ait}=ow,sw=Y(ow).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),nY=Z(sw),iY={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.18,y:-0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.43},left1:{type:\"text\",text:\"RPM\",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:-0.01,y:-0.01,radius:0.29,color:\"primary\",fill:!1}}},{paths:oY,texts:sY,bounds:gc,refblocks:gv,circles:aY}=iY,If=Yt({primitives:[...Object.values(oY),...Object.values(aY),{type:\"text\",text:\"{REF}\",x:0,y:-0.3594553499999995,anchor:\"middle_top\"},{type:\"text\",text:\"{VAL}\",x:0,y:0.35,anchor:\"middle_bottom\"},{...sY.left1,y:0.01,anchor:\"center\",fontSize:0.2}],ports:[{...gv.left1,labels:[\"1\"]},{...gv.right1,labels:[\"2\"]}],size:{width:gc.width,height:gc.height},center:{x:gc.centerX,y:gc.centerY}}),{5:cY,...lY}=If.primitives;function pY(t){return typeof t==\"object\"}var xv=Z({...If,primitives:Object.values(lY).filter(pY)}),hY={...xv,primitives:[...xv.primitives,cY]},vl=Yt({primitives:[{type:\"path\",points:[{x:-0.2,y:0},{x:0,y:0}],color:\"primary\",fill:!1},{type:\"path\",points:Array.from({length:32},(t,e)=\u003e{let r=Math.PI/2-e*Math.PI/31,n=0.1;return{x:0.1-n*Math.cos(r),y:n*Math.sin(r)}}),color:\"primary\",fill:!1},{type:\"text\",text:\"{REF}\",x:0.125,y:0,anchor:\"middle_left\"}],ports:[{x:-0.2,y:0,labels:[\"1\"]}],center:{x:0,y:0}}),aw=Z(vl,\"down\"),bv=aw.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");bv\u0026\u0026(bv.anchor=\"middle_top\");var dY=aw,mY=Z(vl,\"left\"),cw=Z(vl,\"up\"),vv=cw.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\");vv\u0026\u0026(vv.anchor=\"middle_bottom\");var uY=cw,fY={paths:{path40:{type:\"path\",points:[{x:0.44,y:0.04},{x:0.19,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:0.19,y:0.18},{x:0.44,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:0.19,y:-0.09},{x:0.19,y:0.18}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:0.19,y:0.04},{x:-0.11,y:0.04}],color:\"primary\",fill:!1},path45:{type:\"path\",points:[{x:-0.43,y:0.22},{x:-0.11,y:0.04}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{right1:{x:-0.43,y:0.22}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},Ff=Y(fY).labelPort(\"right1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").changeTextAnchor(\"{VAL}\",\"middle_top\").build(),Mf=Z(Ff,\"up\"),Cf=Mf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),kf=Mf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Cf.anchor=\"middle_bottom\";kf.anchor=\"middle_top\";Cf.x=0.4;Cf.y+=0.2;kf.y-=0.3;kf.x=0.4;var lw=Mf,Nf=Si(lw),Yf=Nf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Lf=Nf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Yf.anchor=\"middle_bottom\";Lf.anchor=\"middle_top\";Yf.x=0.35;Yf.y+=0.4;Lf.y-=0.4;Lf.x=0.35;var yY=Nf,Tf=Z(Ff,\"left\"),Ef=Tf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),Rf=Tf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");Ef.anchor=\"middle_bottom\";Rf.anchor=\"middle_top\";Ef.x=0;Ef.y+=0.5;Rf.y-=0.6;Rf.x=0;var _Y=Tf,pw={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0.04},{x:-0.11,y:0.04}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.1,y:0.04},{x:0.54,y:0.04}],color:\"primary\",fill:!1},\"path11-0\":{type:\"path\",points:[{x:-0.09,y:-0.15},{x:-0.09,y:0.26}],color:\"primary\",fill:!1},\"path11-0-3\":{type:\"path\",points:[{x:0.09,y:-0.15},{x:0.09,y:0.26}],color:\"primary\",fill:!1},\"path11-0-9\":{type:\"path\",points:[{x:-0.08,y:0.06},{x:-0.08,y:-0.15},{x:0.09,y:-0.05},{x:-0.08,y:0.06}],color:\"primary\",fill:!0},\"path11-0-9-0\":{type:\"path\",points:[{x:0.08,y:0.26},{x:0.08,y:0.05},{x:-0.09,y:0.15},{x:0.07,y:0.26}],color:\"primary\",fill:!0},\"path12-2\":{type:\"path\",points:[{x:0.09,y:-0.06},{x:0.27,y:-0.17}],color:\"primary\",fill:!1},\"path12-2-9\":{type:\"path\",points:[{x:0.27,y:-0.18},{x:0.27,y:-0.31}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0.01,y:0.42},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.03,y:-0.42}},refblocks:{bottom1:{x:0.27,y:-0.31},left1:{x:-0.54,y:0.04},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.42,maxY:0.42,width:1.14,height:0.83,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0.05,radius:0.29,color:\"primary\",fill:!1}}},{paths:Pit,texts:Bit,bounds:Iit,refblocks:Fit,circles:Mit}=pw,hw=Y(pw).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).labelPort(\"bottom1\",[\"3\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),dw=Z(hw),mw=dw.primitives.filter((t)=\u003et.type===\"text\"),gY=mw.find((t)=\u003et.text===\"{REF}\"),xY=mw.find((t)=\u003et.text===\"{VAL}\");gY.y=0;xY.y=0;var bY=dw,vY={paths:{path40:{type:\"path\",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:\"primary\",fill:!1},\"path43-8\":{type:\"path\",points:[{x:0.14,y:0.18},{x:0.08,y:0.18}],color:\"primary\",fill:!1},\"path43-8-8\":{type:\"path\",points:[{x:0.14,y:-0.09},{x:0.08,y:-0.09}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:SY,texts:Sv,bounds:xc,refblocks:wv,circles:wY}=vY,uw=Yt({primitives:[...Object.values(SY),...Object.values(wY),{...Sv.top1,anchor:\"middle_bottom\"},{...Sv.bottom1,anchor:\"middle_top\"}],ports:[{...wv.left1,labels:[\"1\"]},{...wv.right1,labels:[\"2\"]}],size:{width:xc.width,height:xc.height},center:{x:xc.centerX,y:xc.centerY}}),Of=Z(uw),AY=Of.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),PY=Of.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");AY.anchor=\"middle_left\";PY.anchor=\"middle_right\";var BY=Of,IY={paths:{path11:{type:\"path\",points:[{x:-0.34,y:0.22},{x:-0.02,y:0.01}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.23,y:0.13},{x:0.23,y:0.4}],color:\"primary\",fill:!1},\"path12-2\":{type:\"path\",points:[{x:0.23,y:-0.08},{x:0.23,y:-0.35}],color:\"primary\",fill:!1},\"path11-0\":{type:\"path\",points:[{x:-0.01,y:-0.18},{x:-0.01,y:0.23}],color:\"primary\",fill:!1},\"path11-0-3\":{type:\"path\",points:[{x:0.23,y:0.12},{x:-0.01,y:0.12}],color:\"primary\",fill:!1},\"path11-0-9\":{type:\"path\",points:[{x:-0.11,y:0.13},{x:-0.17,y:0.04},{x:-0.06,y:0.03},{x:-0.11,y:0.13}],color:\"primary\",fill:!0},\"path11-0-3-8\":{type:\"path\",points:[{x:0.23,y:-0.08},{x:-0.01,y:-0.08}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.2,y:0.39},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.03,y:-0.42}},refblocks:{top1:{x:0.23,y:0.4},bottom1:{x:0.23,y:-0.35},left1:{x:-0.34,y:0.22}},bounds:{minX:-0.37,maxX:0.37,minY:-0.42,maxY:0.42,width:0.74,height:0.85,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0.08,y:0.01,radius:0.29,color:\"primary\",fill:!1}}},{paths:FY,texts:Av,bounds:bc,refblocks:ed,circles:MY}=IY,fw=Yt({primitives:[...Object.values(FY),...Object.values(MY),{...Av.top1,anchor:\"middle_left\"},{...Av.bottom1,anchor:\"middle_right\"}],ports:[{...ed.top1,labels:[\"1\"]},{...ed.bottom1,labels:[\"2\"]},{...ed.left1,labels:[\"3\"]}],size:{width:bc.width,height:bc.height},center:{x:bc.centerX,y:bc.centerY}}),yw=Z(fw),_w=yw.primitives.filter((t)=\u003et.type===\"text\"),CY=_w.find((t)=\u003et.text===\"{REF}\");CY.y=0.1;var gw=_w.find((t)=\u003et.text===\"{VAL}\");gw.y=0.1;gw.x=-0.4;var kY=yw,NY={paths:{capsule_outer:{type:\"path\",points:[{x:-0.44,y:0.34},{x:-0.45,y:0.39},{x:-0.46,y:0.42},{x:-0.49,y:0.44},{x:-0.52,y:0.46},{x:-0.56,y:0.46},{x:-0.6,y:0.46},{x:-0.63,y:0.44},{x:-0.65,y:0.42},{x:-0.67,y:0.39},{x:-0.68,y:0.34},{x:-0.68,y:-0.34},{x:-0.67,y:-0.39},{x:-0.65,y:-0.42},{x:-0.63,y:-0.44},{x:-0.6,y:-0.45},{x:-0.56,y:-0.46},{x:-0.52,y:-0.45},{x:-0.49,y:-0.44},{x:-0.46,y:-0.42},{x:-0.45,y:-0.39},{x:-0.44,y:-0.34},{x:-0.44,y:0.34}],color:\"primary\",fill:!1},capsule_inner:{type:\"path\",points:[{x:-0.51,y:0.28},{x:-0.52,y:0.32},{x:-0.53,y:0.34},{x:-0.56,y:0.35},{x:-0.57,y:0.35},{x:-0.58,y:0.34},{x:-0.6,y:0.32},{x:-0.61,y:0.28},{x:-0.61,y:-0.28},{x:-0.6,y:-0.32},{x:-0.58,y:-0.34},{x:-0.57,y:-0.35},{x:-0.56,y:-0.35},{x:-0.53,y:-0.34},{x:-0.52,y:-0.32},{x:-0.51,y:-0.28},{x:-0.51,y:0.28}],color:\"primary\",fill:!0},usb_vertical:{type:\"path\",points:[{x:0.1,y:-0.4},{x:0.1,y:0.4}],color:\"primary\",fill:!1},usb_left_branch:{type:\"path\",points:[{x:0.1,y:-0.1},{x:-0.03,y:0.05},{x:-0.03,y:0.15}],color:\"primary\",fill:!1},usb_right_branch:{type:\"path\",points:[{x:0.1,y:0},{x:0.25,y:0.15},{x:0.25,y:0.25}],color:\"primary\",fill:!1},usb_arrow:{type:\"path\",points:[{x:0.05,y:0.4},{x:0.1,y:0.5},{x:0.15,y:0.4},{x:0.05,y:0.4}],color:\"primary\",fill:!0},usb_square:{type:\"path\",points:[{x:0.2,y:0.25},{x:0.3,y:0.25},{x:0.3,y:0.35},{x:0.2,y:0.35},{x:0.2,y:0.25}],color:\"primary\",fill:!0}},circles:{usb_base:{type:\"circle\",x:0.1,y:-0.4,radius:0.07,color:\"primary\",fill:!0},usb_tip_circle:{type:\"circle\",x:-0.03,y:0.15,radius:0.04,color:\"primary\",fill:!0}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.25,y:0.7}},refblocks:{},bounds:{minX:-0.75,maxX:0.35,minY:-0.6,maxY:0.75,width:1.1,height:1.35,centerX:-0.2,centerY:0.08}},YY=Y(NY).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),LY={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.18,y:-0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.43},left1:{type:\"text\",text:\"Var\",x:-0.19,y:0.07}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:-0.01,y:-0.01,radius:0.29,color:\"primary\",fill:!1}}},{paths:TY,texts:rd,bounds:vc,refblocks:Pv,circles:EY}=LY,xw=Yt({primitives:[...Object.values(TY),...Object.values(EY),{...rd.top1,x:0,y:-0.3594553499999995,anchor:\"middle_top\"},{...rd.bottom1,x:0,y:0.35,anchor:\"middle_bottom\"},{...rd.left1,x:-0.02,y:0.01,fontSize:0.2,anchor:\"center\"}],ports:[{...Pv.left1,labels:[\"1\"]},{...Pv.right1,labels:[\"2\"]}],size:{width:vc.width,height:vc.height},center:{x:vc.centerX,y:vc.centerY}}),RY=Z(xw),OY={paths:{path40:{type:\"path\",points:[{x:0.08,y:0.04},{x:-0.18,y:-0.09}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.18,y:0.18},{x:0.08,y:0.04}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.18,y:-0.09},{x:-0.18,y:0.18}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.09,y:0.17},{x:0.1,y:-0.09}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.2,y:0.04},{x:-0.52,y:0.04}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.52,y:0.04},{x:0.21,y:0.04}],color:\"primary\",fill:!1},\"path43-6\":{type:\"path\",points:[{x:0.19,y:0.17},{x:0.19,y:-0.09}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.01,y:0.27},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:WY,texts:Bv,bounds:Sc,refblocks:Iv,circles:$Y}=OY,bw=Yt({primitives:[...Object.values(WY),...Object.values($Y),{...Bv.top1,anchor:\"middle_bottom\"},{...Bv.bottom1,anchor:\"middle_top\"}],ports:[{...Iv.left1,labels:[\"1\"]},{...Iv.right1,labels:[\"2\"]}],size:{width:Sc.width,height:Sc.height},center:{x:Sc.centerX,y:Sc.centerY}}),Wf=Z(bw),jY=Wf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{REF}\"),XY=Wf.primitives.find((t)=\u003et.type===\"text\"\u0026\u0026t.text===\"{VAL}\");jY.anchor=\"middle_left\";XY.anchor=\"middle_right\";var DY=Wf,VY={paths:{path5:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.26,y:0}],color:\"primary\",fill:!1},path6:{type:\"path\",points:[{x:0.27,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1},path7:{type:\"path\",points:[{x:0.27,y:-0.23},{x:-0.26,y:0.24}],color:\"primary\",fill:!1},path8:{type:\"path\",points:[{x:0.38,y:-0.23},{x:0.27,y:-0.23}],color:\"primary\",fill:!1},path9:{type:\"path\",points:[{x:0,y:0.14},{x:0.27,y:0.14},{x:0.27,y:-0.13},{x:-0.26,y:-0.13},{x:-0.26,y:0.14},{x:0,y:0.14}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.06,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0.01,y:-0.25}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.57,maxX:0.57,minY:-0.25,maxY:0.25,width:1.13,height:0.5,centerX:0,centerY:0},circles:{}},{paths:zY,texts:Fv,bounds:wc,refblocks:Mv}=VY,vw=Yt({primitives:[...Object.values(zY),{...Fv.top1,x:0,anchor:\"middle_bottom\"},{...Fv.bottom1,x:0,anchor:\"middle_top\"}],ports:[{...Mv.left1,labels:[\"1\",\"-\"]},{...Mv.right1,labels:[\"2\",\"+\"]}],size:{width:wc.width,height:wc.height},center:{x:wc.centerX,y:wc.centerY}}),Sw=Z(vw),ww=Sw.primitives.filter((t)=\u003et.type===\"text\"),$f=ww.find((t)=\u003et.text===\"{REF}\"),jf=ww.find((t)=\u003et.text===\"{VAL}\");$f.x=0.3;$f.y=0.15;$f.anchor=\"middle_left\";jf.x=0.3;jf.y=-0.15;jf.anchor=\"middle_left\";var UY=Sw,GY={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.18,y:-0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.43},left1:{type:\"text\",text:\"Var\",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:-0.01,y:-0.01,radius:0.29,color:\"primary\",fill:!1}}},{paths:HY,texts:QY,bounds:Ac,refblocks:Cv,circles:ZY}=GY,Xf=Yt({primitives:[...Object.values(HY),...Object.values(ZY),{type:\"text\",text:\"{REF}\",x:0,y:-0.3594553499999995,anchor:\"middle_top\"},{type:\"text\",text:\"{VAL}\",x:0,y:0.35,anchor:\"middle_bottom\"},{...QY.left1,anchor:\"center\",y:0.02,fontSize:0.2}],ports:[{...Cv.left1,labels:[\"1\"]},{...Cv.right1,labels:[\"2\"]}],size:{width:Ac.width,height:Ac.height},center:{x:Ac.centerX,y:Ac.centerY}}),{5:qY,...JY}=Xf.primitives;function KY(t){return typeof t==\"object\"}var kv=Z({...Xf,primitives:Object.values(JY).filter(KY)}),tL={...kv,primitives:[...kv.primitives,qY]},Sl={paths:{\"path28-2\":{type:\"path\",points:[{x:0.19,y:0},{x:0,y:0.09}],color:\"primary\",fill:!1},\"path28-2-6\":{type:\"path\",points:[{x:0.19,y:0},{x:0,y:-0.09}],color:\"primary\",fill:!1},\"path29-3\":{type:\"path\",points:[{x:0.19,y:0},{x:-0.23,y:0}],color:\"primary\",fill:!1}},texts:{right1:{type:\"text\",text:\"{REF}\",x:0.25,y:0}},refblocks:{left1:{x:-0.23,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.09,maxY:0.09,width:0.5,height:0.19,centerX:0,centerY:0},circles:{}};function wl(t,e){let{width:r,height:n}=t.size,i=1,s=1;e.width!==void 0\u0026\u0026e.height!==void 0?(i=e.width/r,s=e.height/n):e.width!==void 0?i=s=e.width/r:e.height!==void 0\u0026\u0026(i=s=e.height/n);let o=t.primitives.map((c)=\u003e{switch(c.type){case\"path\":return{...c,points:c.points.map((l)=\u003e({x:l.x*i,y:l.y*s}))};case\"text\":return{...c,x:c.x*i,y:c.y*s,fontSize:c.fontSize?c.fontSize*i:void 0};case\"circle\":return{...c,x:c.x*i,y:c.y*s,radius:c.radius*i};case\"box\":return{...c,x:c.x*i,y:c.y*s,width:c.width*i,height:c.height*s};default:return c}});return{...t,primitives:o,center:{x:t.center.x*i,y:t.center.y*s},ports:t.ports.map((c)=\u003e({...c,x:c.x*i,y:c.y*s})),size:{width:r*i,height:n*s}}}var eL=Y(Sl).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_top\").build(),rL=wl(eL,{width:0.24,height:0.23}),nL=Y(Sl).rotateRightFacingSymbol(\"left\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_right\").build(),iL=wl(nL,{width:0.23,height:0.24}),oL=Y(Sl).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_left\").build(),sL=wl(oL,{width:0.23,height:0.24}),aL=Y(Sl).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),cL=wl(aL,{width:0.24,height:0.23}),Df={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.03}],color:\"primary\",fill:!1},\"path11-5-5\":{type:\"path\",points:[{x:0.1,y:0.13},{x:0,y:-0.06},{x:-0.11,y:0.13}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0.03},{x:0.54,y:0.03}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.02,y:0.4},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:-0.4}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.03}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.8,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:0,y:0.04,radius:0.29,color:\"primary\",fill:!1}}},{paths:Cit,texts:kit,bounds:Nit,circles:Yit,refblocks:Lit}=Df,lL=Y(Df).changeTextAnchor(\"{VAL}\",\"middle_top\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_bottom\").build(),{paths:pL,texts:Tit,bounds:Nv,circles:hL,refblocks:Yv}=Df,dL=Y({primitives:[...Object.values(pL),...Object.values(hL),{type:\"text\",text:\"{REF}\",x:-0.2,y:0.35},{type:\"text\",text:\"{VAL}\",x:0.2,y:0.35}],ports:[{...Yv.left1,labels:[\"left1\"]},{...Yv.right1,labels:[\"right1\"]}],center:{x:Nv.centerX,y:Nv.centerY}}).rotateRightFacingSymbol(\"down\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),mL=dL,uL={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.18,y:-0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.43},left1:{type:\"text\",text:\"Wh\",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:-0.01,y:-0.01,radius:0.29,color:\"primary\",fill:!1}}},{paths:fL,texts:yL,bounds:Pc,refblocks:Lv,circles:_L}=uL,Vf=Yt({primitives:[...Object.values(fL),...Object.values(_L),{type:\"text\",text:\"{REF}\",x:0,y:-0.3594553499999995,anchor:\"middle_top\"},{type:\"text\",text:\"{VAL}\",x:0,y:0.35,anchor:\"middle_bottom\"},{...yL.left1,anchor:\"center\",y:0.01,fontSize:0.2}],ports:[{...Lv.left1,labels:[\"1\"]},{...Lv.right1,labels:[\"2\"]}],size:{width:Pc.width,height:Pc.height},center:{x:Pc.centerX,y:Pc.centerY}}),{5:gL,...xL}=Vf.primitives;function bL(t){return typeof t==\"object\"}var Tv=Z({...Vf,primitives:Object.values(xL).filter(bL)}),vL={...Tv,primitives:[...Tv.primitives,gL]},SL={paths:{path11:{type:\"path\",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:\"primary\",fill:!1},path12:{type:\"path\",points:[{x:0.29,y:0},{x:0.54,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.18,y:-0.36},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.01,y:0.43},left1:{type:\"text\",text:\"W\",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:\"circle\",x:-0.01,y:-0.01,radius:0.29,color:\"primary\",fill:!1}}},{paths:wL,texts:AL,bounds:Bc,refblocks:Ev,circles:PL}=SL,zf=Yt({primitives:[...Object.values(wL),...Object.values(PL),{type:\"text\",text:\"{REF}\",x:0,y:-0.3594553499999995,anchor:\"middle_top\"},{type:\"text\",text:\"{VAL}\",x:0,y:0.35,anchor:\"middle_bottom\"},{...AL.left1,anchor:\"center\",y:0.01,fontSize:0.3}],ports:[{...Ev.left1,labels:[\"1\"]},{...Ev.right1,labels:[\"2\"]}],size:{width:Bc.width,height:Bc.height},center:{x:Bc.centerX,y:Bc.centerY}}),{5:BL,...IL}=zf.primitives;function FL(t){return typeof t==\"object\"}var Rv=Z({...zf,primitives:Object.values(IL).filter(FL)}),ML={...Rv,primitives:[...Rv.primitives,BL]},Aw={paths:{path40:{type:\"path\",points:[{x:0.14458890000000002,y:0.04403629999999992},{x:-0.1199943999999995,y:-0.08825540000000043}],color:\"primary\",fill:!1},path41:{type:\"path\",points:[{x:-0.1199943999999995,y:0.17632800000000026},{x:0.14458890000000002,y:0.04403629999999992}],color:\"primary\",fill:!1},path42:{type:\"path\",points:[{x:-0.1199943999999995,y:-0.0882553999999991},{x:-0.1199943999999995,y:0.17632800000000026}],color:\"primary\",fill:!1},path43:{type:\"path\",points:[{x:0.14458890000000002,y:0.17632800000000026},{x:0.14458890000000002,y:-0.0882553999999991}],color:\"primary\",fill:!1},path44:{type:\"path\",points:[{x:-0.12219909999999956,y:0.04403629999999992},{x:-0.5168693999999996,y:0.04403629999999992}],color:\"primary\",fill:!1},\"path44-0\":{type:\"path\",points:[{x:0.5233797000000002,y:0.043951100000000354},{x:0.1496715999999998,y:0.043951100000000354}],color:\"primary\",fill:!1},\"path43-8\":{type:\"path\",points:[{x:0.14458890000000002,y:0.17632800000000026},{x:0.21069330000000042,y:0.17632800000000026}],color:\"primary\",fill:!1},\"path43-8-8\":{type:\"path\",points:[{x:0.14458890000000002,y:-0.0882553999999991},{x:0.07848449999999962,y:-0.0882553999999991}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:-0.0050250999999996715,y:0.27384530000000007},bottom1:{type:\"text\",text:\"{VAL}\",x:-0.00011179999999977319,y:-0.27384529999999985}},refblocks:{left1:{x:-0.5191471000000001,y:0.044920700000000924},right1:{x:0.5191470999999999,y:0.04389609999999999}},bounds:{minX:-0.5473055410000001,maxX:0.5473055409999998,minY:-0.27384529999999985,maxY:0.27384530000000007,width:1.094611082,height:0.5476905999999999,centerX:-0.00000000000000011102230246251565,centerY:0.00000000000000011102230246251565},circles:{}},CL=Y(Aw).rotateRightFacingSymbol(\"right\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Al={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.16999999999999993,y:0.11999999999999988},{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001},{x:0.07000000000000006,y:-0.1200000000000001}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},kL=yt(Al,{kind:\"diode\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),NL=yt(Al,{kind:\"diode\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),YL=yt(Al,{kind:\"diode\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),LL=yt(Al,{kind:\"diode\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),{paths:TL,bounds:Ic,refblocks:Ov,circles:EL}=Aw,RL=Y({primitives:[...Object.values(TL),...Object.values(EL),{type:\"text\",text:\"{REF}\",x:0.15,y:-0.2294553499999995},{type:\"text\",text:\"{VAL}\",x:-0.15,y:-0.2294553499999995}],ports:[{...Ov.left1,labels:[\"1\"]},{...Ov.right1,labels:[\"2\"]}],size:{width:Ic.width,height:Ic.height},center:{x:Ic.centerX,y:Ic.centerY}}).rotateRightFacingSymbol(\"up\").labelPort(\"left1\",[\"1\"]).labelPort(\"right1\",[\"2\"]).changeTextAnchor(\"{REF}\",\"middle_left\").changeTextAnchor(\"{VAL}\",\"middle_left\").build(),Pl={paths:{\"anode-lead\":{type:\"path\",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:\"primary\",fill:!1},body:{type:\"path\",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:\"primary\",fill:!1},\"cathode-bar\":{type:\"path\",points:[{x:0.15000000000000013,y:0.09999999999999987},{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009},{x:0.050000000000000044,y:-0.10000000000000009}],color:\"primary\",fill:!1},\"cathode-lead\":{type:\"path\",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:\"primary\",fill:!1}},texts:{top1:{type:\"text\",text:\"{REF}\",x:0,y:0.25},bottom1:{type:\"text\",text:\"{VAL}\",x:0,y:-0.25}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.25,maxY:0.25,width:0.34999999999999987,height:0.5,centerX:0.00000000000000011102230246251565,centerY:0},circles:{}},OL=yt(Pl,{kind:\"diode\",orientation:\"down\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),WL=yt(Pl,{kind:\"diode\",orientation:\"left\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),$L=yt(Pl,{kind:\"diode\",orientation:\"right\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),jL=yt(Pl,{kind:\"diode\",orientation:\"up\",pin1Labels:[\"1\",\"pos\",\"anode\"],pin2Labels:[\"2\",\"neg\",\"cathode\"]}),Gr={ac_voltmeter_down:FP,ac_voltmeter_horz:kP,ac_voltmeter_left:LP,ac_voltmeter_right:RP,ac_voltmeter_up:$P,ac_voltmeter_vert:DP,avalanche_diode_down:UP,avalanche_diode_horz:GP,avalanche_diode_left:ZP,avalanche_diode_right:qP,avalanche_diode_sm_down:KP,avalanche_diode_sm_left:tB,avalanche_diode_sm_right:eB,avalanche_diode_sm_up:rB,avalanche_diode_up:oB,avalanche_diode_vert:cB,avalanche_diode_xs_down:lB,avalanche_diode_xs_left:pB,avalanche_diode_xs_right:hB,avalanche_diode_xs_up:dB,backward_diode_down:fB,backward_diode_left:Wv,backward_diode_right:bB,backward_diode_up:vB,battery_down:PB,battery_horz:$v,battery_left:kB,battery_right:TB,battery_up:WB,battery_vert:$B,boxresistor_down:VB,boxresistor_left:HB,boxresistor_right:JB,boxresistor_sm_down:KB,boxresistor_sm_left:t8,boxresistor_sm_right:e8,boxresistor_sm_up:r8,boxresistor_small_down:o8,boxresistor_small_left:c8,boxresistor_small_right:h8,boxresistor_small_up:u8,boxresistor_up:g8,boxresistor_xs_down:x8,boxresistor_xs_left:b8,boxresistor_xs_right:v8,boxresistor_xs_up:S8,bridged_ground_down:P8,bridged_ground_left:F8,bridged_ground_right:jv,bridged_ground_up:k8,capacitor_down:T8,capacitor_left:R8,capacitor_polarized_down:O8,capacitor_polarized_left:W8,capacitor_polarized_right:$8,capacitor_polarized_up:j8,capacitor_right:D8,capacitor_sm_down:V8,capacitor_sm_left:z8,capacitor_sm_right:U8,capacitor_sm_up:G8,capacitor_up:q8,capacitor_xs_down:J8,capacitor_xs_left:K8,capacitor_xs_right:tI,capacitor_xs_up:eI,constant_current_diode_down:iI,constant_current_diode_horz:oI,constant_current_diode_left:cI,constant_current_diode_right:lI,constant_current_diode_up:dI,constant_current_diode_vert:fI,crystal_4pin_down:gI,crystal_4pin_left:xI,crystal_4pin_right:bI,crystal_4pin_up:wI,crystal_down:BI,crystal_left:II,crystal_right:FI,crystal_up:kI,current_source_down:YI,current_source_left:TI,current_source_right:RI,current_source_up:WI,darlington_pair_transistor_down:$I,darlington_pair_transistor_horz:jI,darlington_pair_transistor_left:XI,darlington_pair_transistor_right:DI,darlington_pair_transistor_up:VI,darlington_pair_transistor_vert:zI,dc_ammeter_down:c9,dc_ammeter_horz:Eo,dc_ammeter_left:HI,dc_ammeter_right:QI,dc_ammeter_up:ZI,dc_ammeter_vert:c9,dc_voltmeter_down:KI,dc_voltmeter_horz:rF,dc_voltmeter_left:oF,dc_voltmeter_right:cF,dc_voltmeter_up:hF,dc_voltmeter_vert:uF,diac_down:fF,diac_horz:yF,diac_left:_F,diac_right:gF,diac_up:xF,diac_vert:bF,digital_ground_down:wF,digital_ground_left:BF,digital_ground_right:MF,digital_ground_up:NF,diode_down:LF,diode_left:TF,diode_right:zc,diode_sm_down:EF,diode_sm_left:RF,diode_sm_right:OF,diode_sm_up:WF,diode_up:$F,diode_xs_down:jF,diode_xs_left:XF,diode_xs_right:DF,diode_xs_up:VF,dpdt_normally_closed_switch_down:UF,dpdt_normally_closed_switch_left:GF,dpdt_normally_closed_switch_right:Hc,dpdt_normally_closed_switch_up:HF,dpdt_switch_down:ZF,dpdt_switch_left:qF,dpdt_switch_right:Qc,dpdt_switch_up:JF,dpst_normally_closed_switch_down:t6,dpst_normally_closed_switch_left:e6,dpst_normally_closed_switch_right:Zc,dpst_normally_closed_switch_up:r6,dpst_switch_down:i6,dpst_switch_left:o6,dpst_switch_right:qc,dpst_switch_up:s6,ferrite_bead_down:l6,ferrite_bead_left:p6,ferrite_bead_right:Vv,ferrite_bead_up:Dv,filled_diode_down:m6,filled_diode_horz:y6,filled_diode_left:x6,filled_diode_right:S6,filled_diode_up:P6,filled_diode_vert:F6,frequency_meter_horz:Zd,frequency_meter_vert:E6,fuse_horz:zv,fuse_vert:$6,ground_down:j6,ground_horz:X6,ground_left:D6,ground_right:V6,ground_up:z6,ground_vert:U6,gunn_diode_horz:G6,gunn_diode_vert:H6,icled_down:Z6,icled_left:q6,icled_right:Jc,icled_up:J6,igbt_transistor_horz:Uv,igbt_transistor_vert:t7,illuminated_push_button_normally_open_horz:Hv,illuminated_push_button_normally_open_vert:r7,inductor_down:n7,inductor_left:i7,inductor_right:o7,inductor_up:s7,laser_diode_down:a7,laser_diode_left:c7,laser_diode_right:tl,laser_diode_up:l7,led_down:m7,led_left:u7,led_right:um,led_sm_down:f7,led_sm_left:y7,led_sm_right:_7,led_sm_up:g7,led_up:Jv,led_xs_down:x7,led_xs_left:b7,led_xs_right:v7,led_xs_up:S7,light_dependent_resistor_horz:Kv,light_dependent_resistor_vert:B7,mosfet_depletion_normally_on_horz:rS,mosfet_depletion_normally_on_vert:M7,mushroom_head_normally_open_momentary_horz:iS,mushroom_head_normally_open_momentary_vert:Y7,n_channel_d_mosfet_transistor_gate_bottom_drain_left:O7,n_channel_d_mosfet_transistor_gate_bottom_drain_right:W7,n_channel_d_mosfet_transistor_gate_left_drain_bottom:$7,n_channel_d_mosfet_transistor_gate_left_drain_top:j7,n_channel_d_mosfet_transistor_gate_right_drain_bottom:X7,n_channel_d_mosfet_transistor_gate_right_drain_top:D7,n_channel_d_mosfet_transistor_gate_top_drain_left:V7,n_channel_d_mosfet_transistor_gate_top_drain_right:z7,n_channel_d_mosfet_transistor_horz:ke,n_channel_d_mosfet_transistor_vert:Qe,n_channel_e_mosfet_transistor_gate_bottom_drain_left:Q7,n_channel_e_mosfet_transistor_gate_bottom_drain_right:Z7,n_channel_e_mosfet_transistor_gate_left_drain_bottom:q7,n_channel_e_mosfet_transistor_gate_left_drain_top:J7,n_channel_e_mosfet_transistor_gate_right_drain_bottom:K7,n_channel_e_mosfet_transistor_gate_right_drain_top:tM,n_channel_e_mosfet_transistor_gate_top_drain_left:eM,n_channel_e_mosfet_transistor_gate_top_drain_right:rM,n_channel_e_mosfet_transistor_horz:Ne,n_channel_e_mosfet_transistor_vert:Ze,njfet_transistor_horz:pS,njfet_transistor_vert:sM,not_connected_down:pM,not_connected_left:hM,not_connected_right:nl,not_connected_up:dM,npn_bipolar_transistor_down:fM,npn_bipolar_transistor_horz:gM,npn_bipolar_transistor_left:vM,npn_bipolar_transistor_right:AM,npn_bipolar_transistor_up:IM,npn_bipolar_transistor_vert:CM,opamp_no_power_down:NM,opamp_no_power_left:YM,opamp_no_power_right:il,opamp_no_power_up:LM,opamp_with_power_down:EM,opamp_with_power_left:RM,opamp_with_power_right:ol,opamp_with_power_up:OM,p_channel_d_mosfet_transistor_gate_bottom_drain_left:XM,p_channel_d_mosfet_transistor_gate_bottom_drain_right:DM,p_channel_d_mosfet_transistor_gate_left_drain_bottom:VM,p_channel_d_mosfet_transistor_gate_left_drain_top:zM,p_channel_d_mosfet_transistor_gate_right_drain_bottom:UM,p_channel_d_mosfet_transistor_gate_right_drain_top:GM,p_channel_d_mosfet_transistor_gate_top_drain_left:HM,p_channel_d_mosfet_transistor_gate_top_drain_right:QM,p_channel_d_mosfet_transistor_horz:Ye,p_channel_d_mosfet_transistor_vert:qe,p_channel_e_mosfet_transistor_gate_bottom_drain_left:KM,p_channel_e_mosfet_transistor_gate_bottom_drain_right:tC,p_channel_e_mosfet_transistor_gate_left_drain_bottom:eC,p_channel_e_mosfet_transistor_gate_left_drain_top:rC,p_channel_e_mosfet_transistor_gate_right_drain_bottom:nC,p_channel_e_mosfet_transistor_gate_right_drain_top:iC,p_channel_e_mosfet_transistor_gate_top_drain_left:oC,p_channel_e_mosfet_transistor_gate_top_drain_right:sC,p_channel_e_mosfet_transistor_horz:Le,p_channel_e_mosfet_transistor_vert:Je,photodiode_horz:_S,photodiode_vert:lC,pjfet_transistor_horz:bS,pjfet_transistor_vert:mC,pnp_bipolar_transistor_down:yC,pnp_bipolar_transistor_horz:_C,pnp_bipolar_transistor_left:bC,pnp_bipolar_transistor_right:wC,pnp_bipolar_transistor_up:BC,pnp_bipolar_transistor_vert:MC,potentiometer_horz:wS,potentiometer_vert:YC,potentiometer2_down:EC,potentiometer2_left:RC,potentiometer2_right:sl,potentiometer2_up:OC,potentiometer3_down:jC,potentiometer3_left:VC,potentiometer3_right:zC,potentiometer3_up:HC,power_factor_meter_horz:AS,power_factor_meter_vert:JC,push_button_normally_closed_momentary_horz:BS,push_button_normally_closed_momentary_vert:rk,push_button_normally_open_momentary_down:sk,push_button_normally_open_momentary_horz:pk,push_button_normally_open_momentary_left:hk,push_button_normally_open_momentary_right:Oo,push_button_normally_open_momentary_up:dk,push_button_normally_open_momentary_vert:mk,rail_down:_k,rail_left:vk,rail_right:Pk,rail_up:Fk,rectifier_diode_horz:FS,rectifier_diode_vert:Lk,resistor_down:Rk,resistor_left:$k,resistor_right:Dk,resistor_sm_down:Vk,resistor_sm_left:zk,resistor_sm_right:Uk,resistor_sm_up:Gk,resistor_up:Zk,resistor_xs_down:qk,resistor_xs_left:Jk,resistor_xs_right:Kk,resistor_xs_up:tN,resonator_down:nN,resonator_horz:CS,resonator_left:sN,resonator_right:dl,resonator_up:aN,resonator_vert:cN,schottky_diode_down:pN,schottky_diode_left:hN,schottky_diode_right:ml,schottky_diode_up:dN,silicon_controlled_rectifier_horz:NS,silicon_controlled_rectifier_vert:uN,solderjumper2_bridged12_down:fN,solderjumper2_bridged12_left:yN,solderjumper2_bridged12_right:Bu,solderjumper2_bridged12_up:_N,solderjumper2_down:gN,solderjumper2_left:xN,solderjumper2_right:Mu,solderjumper2_up:bN,solderjumper3_bridged12_down:vN,solderjumper3_bridged12_left:SN,solderjumper3_bridged12_right:Nu,solderjumper3_bridged12_up:wN,solderjumper3_bridged123_down:AN,solderjumper3_bridged123_left:PN,solderjumper3_bridged123_right:Tu,solderjumper3_bridged123_up:BN,solderjumper3_bridged23_down:IN,solderjumper3_bridged23_left:FN,solderjumper3_bridged23_right:Ou,solderjumper3_bridged23_up:MN,solderjumper3_down:CN,solderjumper3_left:kN,solderjumper3_right:ju,solderjumper3_up:NN,spdt_normally_closed_switch_down:LN,spdt_normally_closed_switch_left:TN,spdt_normally_closed_switch_right:ul,spdt_normally_closed_switch_up:EN,spdt_switch_down:ON,spdt_switch_left:WN,spdt_switch_right:fl,spdt_switch_up:$N,speaker_down:jN,speaker_horz:XN,speaker_left:DN,speaker_right:VN,speaker_up:zN,speaker_vert:UN,spst_normally_closed_switch_down:GN,spst_normally_closed_switch_left:HN,spst_normally_closed_switch_right:_l,spst_normally_closed_switch_up:QN,spst_switch_down:ZN,spst_switch_left:qN,spst_switch_right:xl,spst_switch_up:JN,square_wave_down:KN,square_wave_left:tY,square_wave_right:eY,square_wave_up:rY,step_recovery_diode_horz:sw,step_recovery_diode_vert:nY,tachometer_horz:If,tachometer_vert:hY,testpoint_down:dY,testpoint_left:mY,testpoint_right:vl,testpoint_up:uY,tilted_ground_down:yY,tilted_ground_left:_Y,tilted_ground_right:Ff,tilted_ground_up:lw,triac_horz:hw,triac_vert:bY,tunnel_diode_horz:uw,tunnel_diode_vert:BY,unijunction_transistor_horz:fw,unijunction_transistor_vert:kY,usbc:YY,var_meter_horz:xw,var_meter_vert:RY,varactor_diode_horz:bw,varactor_diode_vert:DY,varistor_horz:vw,varistor_vert:UY,varmeter_horz:Xf,varmeter_vert:tL,vcc_down:rL,vcc_left:iL,vcc_right:sL,vcc_up:cL,volt_meter_horz:lL,volt_meter_vert:mL,watt_hour_meter_horz:Vf,watt_hour_meter_vert:vL,wattmeter_horz:zf,wattmeter_vert:ML,zener_diode_horz:CL,zener_diode_sm_down:kL,zener_diode_sm_left:NL,zener_diode_sm_right:YL,zener_diode_sm_up:LL,zener_diode_vert:RL,zener_diode_xs_down:OL,zener_diode_xs_left:WL,zener_diode_xs_right:$L,zener_diode_xs_up:jL};var Eit=Object.fromEntries(Object.keys(Gr).map((t)=\u003e[t,t]));var oat=ae(ce(),1);var lat=ae(ce(),1);var nE=ae(ce(),1);var iE=ae(ce(),1);var Fat=ae(ce(),1);var XL=\"TscircuitAlphabet\",Pw=\"data-tscircuit-alphabet-font\";function DL(t){let e=(n)=\u003e({...n,children:(n.children??[]).filter((i)=\u003e!(Pw in(i.attributes??{}))).map(e)}),r=e(t);return r.children.push({name:\"style\",type:\"element\",value:\"\",attributes:{[Pw]:\"\",type:\"text/css\"},children:[{name:\"\",type:\"text\",value:`@font-face { font-family: '${XL}'; src: url('data:font/ttf;base64,${n2}') format('truetype'); font-weight: normal; font-style: normal; }`,attributes:{},children:[]}]}),Rw.stringify(r)}var Ww=Ow.default(\"circuit-to-svg\"),Jit=Ww.extend(\"pcb\"),Kit=Ww.extend(\"sch\");var re={\"3d_viewer\":{background_bottom:\"rgb(102, 102, 128)\",background_top:\"rgb(204, 204, 230)\",board:\"rgb(51, 43, 23)\",copper:\"rgb(179, 156, 0)\",silkscreen_bottom:\"rgb(230, 230, 230)\",silkscreen_top:\"rgb(230, 230, 230)\",soldermask:\"rgb(20, 51, 36)\",solderpaste:\"rgb(128, 128, 128)\"},board:{anchor:\"rgb(255, 38, 226)\",aux_items:\"rgb(255, 255, 255)\",b_adhes:\"rgb(0, 0, 132)\",b_crtyd:\"rgb(255, 38, 226)\",b_fab:\"rgb(88, 93, 132)\",b_mask:\"rgba(2, 255, 238, 0.400)\",b_paste:\"rgb(0, 194, 194)\",b_silks:\"rgb(232, 178, 167)\",background:\"rgb(0, 16, 35)\",cmts_user:\"rgb(89, 148, 220)\",copper:{b:\"rgb(77, 127, 196)\",f:\"rgb(200, 52, 52)\",in1:\"rgb(127, 200, 127)\",in10:\"rgb(237, 124, 51)\",in11:\"rgb(91, 195, 235)\",in12:\"rgb(247, 111, 142)\",in13:\"rgb(167, 165, 198)\",in14:\"rgb(40, 204, 217)\",in15:\"rgb(232, 178, 167)\",in16:\"rgb(242, 237, 161)\",in17:\"rgb(237, 124, 51)\",in18:\"rgb(91, 195, 235)\",in19:\"rgb(247, 111, 142)\",in2:\"rgb(206, 125, 44)\",in20:\"rgb(167, 165, 198)\",in21:\"rgb(40, 204, 217)\",in22:\"rgb(232, 178, 167)\",in23:\"rgb(242, 237, 161)\",in24:\"rgb(237, 124, 51)\",in25:\"rgb(91, 195, 235)\",in26:\"rgb(247, 111, 142)\",in27:\"rgb(167, 165, 198)\",in28:\"rgb(40, 204, 217)\",in29:\"rgb(232, 178, 167)\",in3:\"rgb(79, 203, 203)\",in30:\"rgb(242, 237, 161)\",in4:\"rgb(219, 98, 139)\",in5:\"rgb(167, 165, 198)\",in6:\"rgb(40, 204, 217)\",in7:\"rgb(232, 178, 167)\",in8:\"rgb(242, 237, 161)\",in9:\"rgb(141, 203, 129)\"},cursor:\"rgb(255, 255, 255)\",drc:\"rgb(194, 194, 194)\",drc_error:\"rgba(215, 91, 107, 0.800)\",drc_exclusion:\"rgb(255, 255, 255)\",drc_warning:\"rgba(255, 208, 66, 0.902)\",dwgs_user:\"rgb(194, 194, 194)\",eco1_user:\"rgb(180, 219, 210)\",eco2_user:\"rgb(216, 200, 82)\",edge_cuts:\"rgb(208, 210, 205)\",f_adhes:\"rgb(132, 0, 132)\",f_crtyd:\"rgb(255, 0, 245)\",f_fab:\"rgb(175, 175, 175)\",f_mask:\"rgba(216, 100, 255, 0.400)\",f_paste:\"rgba(180, 160, 154, 0.902)\",f_silks:\"rgb(242, 237, 161)\",footprint_text_back:\"rgb(0, 0, 132)\",footprint_text_front:\"rgb(194, 194, 194)\",footprint_text_invisible:\"rgb(132, 132, 132)\",grid:\"rgb(132, 132, 132)\",grid_axes:\"rgb(194, 194, 194)\",margin:\"rgb(255, 38, 226)\",microvia:\"rgb(0, 132, 132)\",no_connect:\"rgb(0, 0, 132)\",pad_back:\"rgb(77, 127, 196)\",pad_front:\"rgb(200, 52, 52)\",pad_plated_hole:\"rgb(194, 194, 0)\",pad_through_hole:\"rgb(227, 183, 46)\",plated_hole:\"rgb(26, 196, 210)\",ratsnest:\"rgba(245, 255, 213, 0.702)\",select_overlay:\"rgb(4, 255, 67)\",through_via:\"rgb(236, 236, 236)\",user_1:\"rgb(194, 194, 194)\",user_2:\"rgb(89, 148, 220)\",user_3:\"rgb(180, 219, 210)\",user_4:\"rgb(216, 200, 82)\",user_5:\"rgb(194, 194, 194)\",user_6:\"rgb(89, 148, 220)\",user_7:\"rgb(180, 219, 210)\",user_8:\"rgb(216, 200, 82)\",user_9:\"rgb(232, 178, 167)\",via_blind_buried:\"rgb(187, 151, 38)\",via_hole:\"rgb(227, 183, 46)\",via_micro:\"rgb(0, 132, 132)\",via_through:\"rgb(236, 236, 236)\",worksheet:\"rgb(200, 114, 171)\"},gerbview:{axes:\"rgb(0, 0, 132)\",background:\"rgb(0, 0, 0)\",dcodes:\"rgb(255, 255, 255)\",grid:\"rgb(132, 132, 132)\",layers:[\"rgb(132, 0, 0)\",\"rgb(194, 194, 0)\",\"rgb(194, 0, 194)\",\"rgb(194, 0, 0)\",\"rgb(0, 132, 132)\",\"rgb(0, 132, 0)\",\"rgb(0, 0, 132)\",\"rgb(132, 132, 132)\",\"rgb(132, 0, 132)\",\"rgb(194, 194, 194)\",\"rgb(132, 0, 132)\",\"rgb(132, 0, 0)\",\"rgb(132, 132, 0)\",\"rgb(194, 194, 194)\",\"rgb(0, 0, 132)\",\"rgb(0, 132, 0)\",\"rgb(132, 0, 0)\",\"rgb(194, 194, 0)\",\"rgb(194, 0, 194)\",\"rgb(194, 0, 0)\",\"rgb(0, 132, 132)\",\"rgb(0, 132, 0)\",\"rgb(0, 0, 132)\",\"rgb(132, 132, 132)\",\"rgb(132, 0, 132)\",\"rgb(194, 194, 194)\",\"rgb(132, 0, 132)\",\"rgb(132, 0, 0)\",\"rgb(132, 132, 0)\",\"rgb(194, 194, 194)\",\"rgb(0, 0, 132)\",\"rgb(0, 132, 0)\",\"rgb(132, 0, 0)\",\"rgb(194, 194, 0)\",\"rgb(194, 0, 194)\",\"rgb(194, 0, 0)\",\"rgb(0, 132, 132)\",\"rgb(0, 132, 0)\",\"rgb(0, 0, 132)\",\"rgb(132, 132, 132)\",\"rgb(132, 0, 132)\",\"rgb(194, 194, 194)\",\"rgb(132, 0, 132)\",\"rgb(132, 0, 0)\",\"rgb(132, 132, 0)\",\"rgb(194, 194, 194)\",\"rgb(0, 0, 132)\",\"rgb(0, 132, 0)\",\"rgb(132, 0, 0)\",\"rgb(194, 194, 0)\",\"rgb(194, 0, 194)\",\"rgb(194, 0, 0)\",\"rgb(0, 132, 132)\",\"rgb(0, 132, 0)\",\"rgb(0, 0, 132)\",\"rgb(132, 132, 132)\",\"rgb(132, 0, 132)\",\"rgb(194, 194, 194)\",\"rgb(132, 0, 132)\",\"rgb(132, 0, 0)\"],negative_objects:\"rgb(132, 132, 132)\",worksheet:\"rgb(0, 0, 132)\"},meta:{filename:\"kicad_2020\",name:\"KiCad 2020\",version:2},simulation_palette:[\"#1f77b4\",\"#d62728\",\"#2ca02c\",\"#ff7f0e\",\"#9467bd\",\"#17becf\",\"#8c564b\",\"#e377c2\",\"#7f7f7f\",\"#bcbd22\"],palette:[\"rgb(132, 0, 0)\",\"rgb(194, 194, 0)\",\"rgb(194, 0, 194)\",\"rgb(194, 0, 0)\",\"rgb(0, 132, 132)\",\"rgb(0, 132, 0)\",\"rgb(0, 0, 132)\",\"rgb(132, 132, 132)\",\"rgb(132, 0, 132)\",\"rgb(194, 194, 194)\",\"rgb(132, 0, 132)\",\"rgb(132, 0, 0)\",\"rgb(132, 132, 0)\",\"rgb(194, 194, 194)\",\"rgb(0, 0, 132)\",\"rgb(0, 132, 0)\"],schematic:{aux_items:\"rgb(46, 46, 46)\",background:\"rgb(245, 241, 237)\",brightened:\"rgb(255, 0, 255)\",bus:\"rgb(0, 0, 132)\",bus_junction:\"rgb(0, 0, 132)\",component_body:\"rgb(255, 255, 194)\",component_outline:\"rgb(132, 0, 0)\",cursor:\"rgb(15, 15, 15)\",erc_error:\"rgba(230, 9, 13, 0.800)\",erc_warning:\"rgba(209, 146, 0, 0.800)\",fields:\"rgb(132, 0, 132)\",grid:\"rgb(181, 181, 181)\",grid_axes:\"rgb(0, 0, 132)\",hidden:\"rgb(194, 194, 194)\",junction:\"rgb(0, 150, 0)\",label_global:\"rgb(132, 0, 0)\",label_background:\"rgba(255, 255, 255, 0.6)\",label_hier:\"rgb(114, 86, 0)\",label_local:\"rgb(15, 15, 15)\",net_name:\"rgb(132, 132, 132)\",no_connect:\"rgb(132, 0, 0)\",note:\"rgb(0, 0, 194)\",override_item_colors:!1,pin:\"rgb(132, 0, 0)\",pin_name:\"rgb(0, 100, 100)\",pin_number:\"rgb(169, 0, 0)\",reference:\"rgb(0, 100, 100)\",shadow:\"rgba(102, 179, 255, 0.800)\",sheet:\"rgb(132, 0, 0)\",sheet_background:\"rgba(253, 255, 231, 0.000)\",sheet_fields:\"rgb(132, 0, 132)\",sheet_filename:\"rgb(114, 86, 0)\",sheet_label:\"rgb(0, 100, 100)\",sheet_name:\"rgb(0, 100, 100)\",table:\"rgb(102, 102, 102)\",value:\"rgb(0, 100, 100)\",wire:\"rgb(0, 150, 0)\",wire_crossing:\"rgb(30, 180, 30)\",worksheet:\"rgb(132, 0, 0)\"}};var sot=re.board.user_2;var cot=re.board.user_2,lot=re.board.user_2;var hot=re.board.user_2;var mot=re.board.user_2;var Bw=0.94,Bl=0.045,VL=Object.fromEntries(Object.entries(Wi).map(([t,e])=\u003e{let r=e.flatMap((i)=\u003e[i.x1,i.x2]),n=e.flatMap((i)=\u003e[i.y1,i.y2]);return[t,e.length?{minX:Math.min(...r)-Bl,maxX:Math.max(...r)+Bl,minY:-(Math.max(...n)+Bl)*Bw,maxY:-(Math.min(...n)-Bl)*Bw}:null]})),bot=Math.round(Math.max(...Object.values(VL).map((t)=\u003et?t.maxX-t.minX:0))*1000)/1000;var El={copper:{top:\"rgb(200, 52, 52)\",inner1:\"rgb(255, 140, 0)\",inner2:\"rgb(255, 215, 0)\",inner3:\"rgb(50, 205, 50)\",inner4:\"rgb(64, 224, 208)\",inner5:\"rgb(138, 43, 226)\",inner6:\"rgb(255, 105, 180)\",inner7:\"rgb(0, 191, 255)\",inner8:\"rgb(160, 82, 45)\",bottom:\"rgb(77, 127, 196)\"},soldermaskWithCopperUnderneath:{top:\"rgb(18, 82, 50)\",bottom:\"rgb(18, 82, 50)\"},soldermask:{top:\"rgb(12, 55, 33)\",bottom:\"rgb(12, 55, 33)\"},soldermaskOverCopper:{top:\"rgb(52, 135, 73)\",bottom:\"rgb(52, 135, 73)\"},substrate:\"rgb(201, 162, 110)\",drill:\"#FF26E2\",silkscreen:{top:\"#f2eda1\",bottom:\"#5da9e9\"},boardOutline:\"rgba(255, 255, 255, 0.5)\",courtyard:{top:\"#FF00FF\",bottom:\"rgb(38, 233, 255)\"},keepout:\"#FF6B6B\",debugComponent:{fill:null,stroke:null}},wot=El.drill,Aot=El.silkscreen.top,Pot=El.silkscreen.bottom,Bot={...El.copper};var zL=4;var $w=5;var UL=2,zot=$w+2,Uot=UL+2,Got=$w+zL+6;function GL(t){return t.find((r)=\u003er.type===\"project_software_metadata\"||r.type===\"source_project_metadata\")?.software_used_string}var HL={name:\"circuit-to-svg\",type:\"module\",version:\"0.0.426\",repository:{type:\"git\",url:\"https://github.com/tscircuit/circuit-to-svg.git\"},description:\"Convert Circuit JSON to SVG\",main:\"dist/index.js\",files:[\"dist\"],scripts:{start:\"cosmos\",prepublish:\"npm run build\",prepare:\"node scripts/prepare-git.cjs\",build:\"tsup-node ./lib/index.ts --format esm --dts --sourcemap --external tscircuit\",format:\"biome format . --write\",\"format:check\":\"biome format .\",cosmos:\"cosmos\",\"cosmos-export\":\"cosmos-export\"},license:\"ISC\",devDependencies:{\"@biomejs/biome\":\"^1.9.4\",\"@resvg/resvg-js\":\"^2.6.2\",\"@tscircuit/alphabet\":\"^0.0.27\",\"@tscircuit/checks-latest\":\"npm:@tscircuit/checks@0.0.179\",\"@types/bun\":\"^1.2.8\",\"@types/debug\":\"^4.1.12\",\"@vitejs/plugin-react\":\"5.0.0\",biome:\"^0.3.3\",\"bun-match-svg\":\"^0.0.12\",\"circuit-json\":\"^0.0.491\",esbuild:\"^0.20.2\",\"format-si-unit\":\"^0.0.12\",\"performance-now\":\"^2.1.0\",react:\"19.1.0\",\"react-cosmos\":\"7.0.0\",\"react-cosmos-plugin-vite\":\"7.0.0\",\"react-dom\":\"19.1.0\",tscircuit:\"^0.0.2018\",tsup:\"^8.0.2\",typescript:\"^5.4.5\",\"vite-tsconfig-paths\":\"^5.0.1\"},peerDependencies:{\"@tscircuit/alphabet\":\"*\"},dependencies:{\"@types/node\":\"^22.5.5\",\"bun-types\":\"^1.1.40\",\"calculate-elbow\":\"0.0.12\",debug:\"^4.4.3\",\"svg-path-commander\":\"^2.1.11\",svgson:\"^5.3.1\",\"transformation-matrix\":\"^2.16.1\"}},QL=HL.version;function ZL(t,e=\"error_text_overlay\"){let r=t.filter((s)=\u003es.type.endsWith(\"_error\"));if(r.length===0)return null;let n=r.map((s)=\u003es.message).filter((s)=\u003e!!s);if(n.length===0)return null;return{name:\"text\",type:\"element\",value:\"\",attributes:{x:\"10\",y:\"20\",fill:\"red\",\"font-family\":\"monospace\",\"font-size\":\"12px\",\"data-type\":e,\"data-layer\":\"global\"},children:n.map((s,o)=\u003e({name:\"tspan\",type:\"element\",value:\"\",attributes:{x:\"10\",dy:o===0?\"0\":\"1.2em\"},children:[{type:\"text\",value:s,name:\"\",attributes:{},children:[]}]}))}}var qL={pin_number:0.15,negated_pin_number:0.12,reference_designator:0.18,manufacturer_number:0.18,net_label:0.18,error:0.05},yr=(t,e)=\u003ee??qL[t],fe=(t,e,r)=\u003eMath.abs(t.a)*yr(e,r);function JL(t){let{minX:e,minY:r,maxX:n,maxY:i}=t.bounds,s=t.cellSize??1,o=t.labelCells??!1,c=[],l=(a,p)=\u003e{let[d,m]=O(t.transform,[a,p]);return{x:d,y:m}};for(let a=Math.floor(e);a\u003c=Math.ceil(n);a+=s){let p=l(a,r),d=l(a,i);c.push({name:\"line\",type:\"element\",attributes:{x1:p.x.toString(),y1:p.y.toString(),x2:d.x.toString(),y2:d.y.toString(),stroke:re.schematic.grid,\"stroke-width\":(0.01*Math.abs(t.transform.a)).toString(),\"stroke-opacity\":\"0.5\"}})}for(let a=Math.floor(r);a\u003c=Math.ceil(i);a+=s){let p=l(e,a),d=l(n,a);c.push({name:\"line\",type:\"element\",attributes:{x1:p.x.toString(),y1:p.y.toString(),x2:d.x.toString(),y2:d.y.toString(),stroke:re.schematic.grid,\"stroke-width\":(0.01*Math.abs(t.transform.a)).toString(),\"stroke-opacity\":\"0.5\"}})}if(o){let a=(p,d)=\u003e{if(s\u003c=0.1)return`${p.toFixed(1)},${d.toFixed(1)}`;return`${p},${d}`};for(let p=Math.floor(e);p\u003c=Math.ceil(n);p+=s)for(let d=Math.floor(r);d\u003c=Math.ceil(i);d+=s){let m=l(p,d);c.push({name:\"text\",type:\"element\",attributes:{x:(m.x-2.5).toString(),y:(m.y-5).toString(),fill:re.schematic.grid,\"font-size\":(s/5*Math.abs(t.transform.a)).toString(),\"fill-opacity\":\"0.5\",\"text-anchor\":\"middle\",\"dominant-baseline\":\"middle\",\"font-family\":\"sans-serif\"},children:[{type:\"text\",value:a(p,d),name:\"\",attributes:{},children:[]}]})}}return{name:\"g\",value:\"\",type:\"element\",attributes:{class:\"grid sch-grid\"},children:c}}function KL(t){let{points:e,transform:r}=t,n=[];for(let i of e){let[s,o]=O(r,[i.x-0.1,i.y-0.1]),[c,l]=O(r,[i.x+0.1,i.y+0.1]),[a,p]=O(r,[i.x-0.1,i.y+0.1]),[d,m]=O(r,[i.x+0.1,i.y-0.1]);n.push({name:\"path\",type:\"element\",attributes:{d:`M${s},${o} L${c},${l} M${a},${p} L${d},${m}`,stroke:re.schematic.grid,\"stroke-width\":(0.02*Math.abs(r.a)).toString(),\"stroke-opacity\":\"0.7\"}});let[f,_]=O(r,[i.x+0.15,i.y-0.15]);n.push({name:\"text\",type:\"element\",attributes:{x:f.toString(),y:_.toString(),fill:re.schematic.grid,\"font-size\":(0.1*Math.abs(r.a)).toString(),\"fill-opacity\":\"0.7\",\"text-anchor\":\"start\",\"font-family\":\"sans-serif\",\"dominant-baseline\":\"middle\"},children:[{type:\"text\",value:i.label||`(${i.x},${i.y})`,name:\"\",attributes:{},children:[]}]})}return{name:\"g\",value:\"\",type:\"element\",attributes:{class:\"labeled-points sch-labeled-points\"},children:n}}function tT(t){return t.reduce((e,r)=\u003e{if(!e)return r;if(r.sheet_index===void 0)return e;if(e.sheet_index===void 0)return r;return r.sheet_index\u003ce.sheet_index?r:e},void 0)}var Iw={\"0\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"1\":{width:13,height:27,ascent:22,descent:5,left:-3,right:9},\"2\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"3\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"4\":{width:13,height:27,ascent:22,descent:5,left:0,right:12},\"5\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"6\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"7\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"8\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"9\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\" \":{width:7,height:27,ascent:22,descent:5,left:0,right:0},\"!\":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},'\"':{width:9,height:27,ascent:22,descent:5,left:-1,right:7},\"#\":{width:13,height:27,ascent:22,descent:5,left:0,right:13},$:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"%\":{width:21,height:27,ascent:22,descent:5,left:-1,right:20},\"\u0026\":{width:16,height:27,ascent:22,descent:5,left:-1,right:15},\"'\":{width:5,height:27,ascent:22,descent:5,left:-1,right:3},\"(\":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},\")\":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},\"*\":{width:9,height:27,ascent:22,descent:5,left:-1,right:8},\"+\":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},\",\":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},\"-\":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},\".\":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},\"/\":{width:7,height:27,ascent:22,descent:5,left:0,right:7},\":\":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},\";\":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},\"\u003c\":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},\"=\":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},\"\u003e\":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},\"?\":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},\"@\":{width:24,height:27,ascent:22,descent:5,left:-1,right:23},A:{width:16,height:27,ascent:22,descent:5,left:0,right:16},B:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},C:{width:17,height:27,ascent:22,descent:5,left:-1,right:16},D:{width:17,height:27,ascent:22,descent:5,left:-2,right:16},E:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},F:{width:15,height:27,ascent:22,descent:5,left:-2,right:14},G:{width:19,height:27,ascent:22,descent:5,left:-1,right:17},H:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},I:{width:7,height:27,ascent:22,descent:5,left:-2,right:5},J:{width:12,height:27,ascent:22,descent:5,left:-1,right:10},K:{width:16,height:27,ascent:22,descent:5,left:-2,right:16},L:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},M:{width:20,height:27,ascent:22,descent:5,left:-2,right:18},N:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},O:{width:19,height:27,ascent:22,descent:5,left:-1,right:18},P:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},Q:{width:19,height:27,ascent:22,descent:5,left:-1,right:18},R:{width:17,height:27,ascent:22,descent:5,left:-2,right:17},S:{width:16,height:27,ascent:22,descent:5,left:-1,right:15},T:{width:15,height:27,ascent:22,descent:5,left:-1,right:14},U:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},V:{width:16,height:27,ascent:22,descent:5,left:0,right:16},W:{width:23,height:27,ascent:22,descent:5,left:0,right:22},X:{width:16,height:27,ascent:22,descent:5,left:0,right:16},Y:{width:16,height:27,ascent:22,descent:5,left:0,right:16},Z:{width:15,height:27,ascent:22,descent:5,left:0,right:14},\"[\":{width:7,height:27,ascent:22,descent:5,left:-2,right:6},\"\\\\\":{width:7,height:27,ascent:22,descent:5,left:0,right:7},\"]\":{width:7,height:27,ascent:22,descent:5,left:0,right:5},\"^\":{width:11,height:27,ascent:22,descent:5,left:-1,right:11},_:{width:13,height:27,ascent:22,descent:5,left:0,right:14},\"`\":{width:8,height:27,ascent:22,descent:5,left:-1,right:5},a:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},b:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},c:{width:12,height:27,ascent:22,descent:5,left:-1,right:12},d:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},e:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},f:{width:7,height:27,ascent:22,descent:5,left:0,right:8},g:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},h:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},i:{width:5,height:27,ascent:22,descent:5,left:-2,right:4},j:{width:5,height:27,ascent:22,descent:5,left:1,right:4},k:{width:12,height:27,ascent:22,descent:5,left:-2,right:12},l:{width:5,height:27,ascent:22,descent:5,left:-2,right:4},m:{width:20,height:27,ascent:22,descent:5,left:-2,right:18},n:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},o:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},p:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},q:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},r:{width:8,height:27,ascent:22,descent:5,left:-2,right:8},s:{width:12,height:27,ascent:22,descent:5,left:-1,right:11},t:{width:7,height:27,ascent:22,descent:5,left:0,right:6},u:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},v:{width:12,height:27,ascent:22,descent:5,left:0,right:12},w:{width:17,height:27,ascent:22,descent:5,left:0,right:17},x:{width:12,height:27,ascent:22,descent:5,left:0,right:12},y:{width:12,height:27,ascent:22,descent:5,left:0,right:12},z:{width:12,height:27,ascent:22,descent:5,left:0,right:11},\"{\":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},\"|\":{width:6,height:27,ascent:22,descent:5,left:-2,right:4},\"}\":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},\"~\":{width:14,height:27,ascent:22,descent:5,left:-1,right:13}},Do=(t)=\u003e{if(!t)return 0;let e=0;for(let r of t){let n=Iw[r];if(n)e+=n.width;else e+=Iw[\"?\"].width}return e/27},jw=0.65,Xw=0.08;function Ll(t){return Do(t.text||\"\")+(t.display_superscript?Xw+Do(t.display_superscript)*jw:0)}function Hf(t,e,r,n=\"central\"){let i=[{type:\"text\",value:t,name:\"\",attributes:{},children:[]}];if(e)i.push({type:\"element\",name:\"tspan\",value:\"\",attributes:{class:\"sch-net-label-superscript\",\"font-size\":`${r*jw}px`,dx:`${r*Xw}`,dy:`${-r*(n===\"ideographic\"?0.5:0.25)}`},children:[{type:\"text\",value:e,name:\"\",attributes:{},children:[]}]});return i}var Oi=(t)=\u003e{switch(t){case\"top\":return{x:0,y:-1};case\"bottom\":return{x:0,y:1};case\"left\":return{x:1,y:0};case\"right\":return{x:-1,y:0}}throw Error(`Invalid side: ${t}`)},fr=0.3,Ei=0.3,Ri=0.06,Dw=0.2,Vw=(t)=\u003e({\"data-circuit-json-type\":\"schematic_net_label\",\"data-schematic-net-label-id\":t.schematic_net_label_id}),eT={top_left:\"start\",top_right:\"end\",middle_left:\"start\",middle_right:\"end\",bottom_left:\"start\",bottom_right:\"end\",center:\"middle\",middle_top:\"middle\",middle_bottom:\"middle\"},Fw={top_left:\"hanging\",top_right:\"hanging\",bottom_left:\"ideographic\",bottom_right:\"ideographic\",center:\"middle\",middle_left:\"middle\",middle_right:\"middle\",middle_top:\"hanging\",middle_bottom:\"ideographic\"};function rT(t){return{left:180,top:90,bottom:-90,right:0}[t]??0}function nT(t,e,r){let n=r+fr*2+Ri*t.text.length+Ei,i=Oi(t.anchor_side);return t.anchor_position??{x:t.center.x-i.x*n*e/2,y:t.center.y-i.y*n*e/2}}var iT=(t,e)=\u003e{let r=t\u003c0?t+2*Math.PI:t,n=e\u003c0?e+2*Math.PI:e,i=Math.abs(r-n);if(i\u003eMath.PI)i=2*Math.PI-i;return i},zw=({schPorts:t,symbol:e,schComponent:r})=\u003e{let n=t.map((c)=\u003e{let l=c.center.x-r.center.x,a=c.center.y-r.center.y;return{port:c,angle:Math.atan2(a,l)}}),i=e.ports.map((c)=\u003e{let l=c.x-e.center.x,a=c.y-e.center.y;return{port:c,angle:Math.atan2(a,l)}});n.sort((c,l)=\u003ec.angle-l.angle),i.sort((c,l)=\u003ec.angle-l.angle);let s=[],o=new Set;for(let c of n){let l=null;for(let a of i){if(o.has(a.port))continue;let p=iT(c.angle,a.angle);if(l===null||p\u003cl.angleDiff)l={symbolPort:a.port,angleDiff:p}}if(l\u0026\u0026l.angleDiff\u003cMath.PI/4)s.push({schPort:c.port,symbolPort:l.symbolPort}),o.add(l.symbolPort)}return s};function Uw(t,e,r,n){let i=Math.sqrt((r.x-t.x)**2+(r.y-t.y)**2),o=Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)/i,c=e.x-o*t.x,l=e.y-o*t.y,a=Rt(c,l),p=oe(o,o);return Ct(a,p)}function oT(t){let e=[],r=new Map,n=new Map,i=null;for(let s of t)if(s.type===\"schematic_component\")e.push(s);else if(s.type===\"schematic_port\"\u0026\u0026s.schematic_component_id){let o=r.get(s.schematic_component_id)??[];o.push(s),r.set(s.schematic_component_id,o)}else if(s.type===\"source_component\")n.set(s.source_component_id,s);for(let s of e){let o=sT({component:s,schematicPorts:r.get(s.schematic_component_id)??[],sourceComponent:s.source_component_id?n.get(s.source_component_id):void 0});if(!o)continue;i=i?Gw(i,o):o}return i}function sT({component:t,schematicPorts:e,sourceComponent:r}){if(!t.symbol_name)return null;let n=Gr[t.symbol_name];if(!n)return null;let i=zw({schPorts:e,symbol:n,schComponent:t});if(!i[0])return null;let s=Uw(i[1]?.symbolPort??n.center,i[1]?.schPort.center??t.center,i[0].symbolPort,i[0].schPort.center),o=null;for(let c of n.primitives){if(c.type!==\"text\")continue;let l=aT({primitive:c,component:t,sourceComponent:r});if(!l)continue;let a=O(s,c),p=yr(\"reference_designator\"),d=cT({x:a.x,y:a.y,width:Do(l)*p,height:p,anchor:c.anchor});o=o?Gw(o,d):d}return o}function aT({primitive:t,component:e,sourceComponent:r}){if(t.text===\"{REF}\")return r?.display_name??r?.name??\"\";if(t.text===\"{VAL}\")return e.symbol_display_value??\"\";return\"\"}function cT({x:t,y:e,width:r,height:n,anchor:i}){let s=t,o=t,c=e-n/2,l=e+n/2;if(i.includes(\"left\"))o=t+r;else if(i.includes(\"right\"))s=t-r;else s=t-r/2,o=t+r/2;if(i.includes(\"top\"))c=e-n,l=e;else if(i.includes(\"bottom\"))c=e,l=e+n;return{minX:s,minY:c,maxX:o,maxY:l}}function Gw(t,e){return{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}var Hw=(t,e)=\u003e{if(t.column_widths\u0026\u0026t.column_widths.length\u003e0\u0026\u0026t.row_heights\u0026\u0026t.row_heights.length\u003e0){let p=(d)=\u003e{if(typeof d===\"number\")return d;if(d.endsWith(\"mm\"))return parseFloat(d);if(d.endsWith(\"in\"))return parseFloat(d)*25.4;return parseFloat(d)};return{column_widths:t.column_widths.map(p),row_heights:t.row_heights.map(p)}}let r=e.filter((p)=\u003ep.type===\"schematic_table_cell\"\u0026\u0026p.schematic_table_id===t.schematic_table_id);if(r.length===0)return{column_widths:[],row_heights:[]};let n=r.reduce((p,d)=\u003eMath.max(p,d.end_column_index),-1)+1,i=r.reduce((p,d)=\u003eMath.max(p,d.end_row_index),-1)+1,{cell_padding:s=0.2}=t,o=Array(n).fill(0),c=Array(i).fill(0),l={},a={};for(let p of r){let d=yr(\"reference_designator\",p.font_size),f=Do(p.text??\"\")*d+2*s,_=d*1.2+2*s,g=`${p.start_row_index}-${p.start_column_index}`;l[g]=f,a[g]=_}for(let p=0;p\u003ci;p++)for(let d=0;d\u003cn;d++){let m=`${p}-${d}`;if(l[m]\u0026\u0026l[m]\u003eo[d])o[d]=l[m];if(a[m]\u0026\u0026a[m]\u003ec[p])c[p]=a[m]}for(let p of r){if(p.start_column_index===p.end_column_index\u0026\u0026p.start_row_index===p.end_row_index)continue;let d=`${p.start_row_index}-${p.start_column_index}`,m=l[d],f=a[d];if(m===void 0||f===void 0)continue;let _=0;for(let y=p.start_column_index;y\u003c=p.end_column_index;y++)_+=o[y];if(m\u003e_){let S=(m-_)/(p.end_column_index-p.start_column_index+1);for(let P=p.start_column_index;P\u003c=p.end_column_index;P++)o[P]+=S}let g=0;for(let y=p.start_row_index;y\u003c=p.end_row_index;y++)g+=c[y];if(f\u003eg){let S=(f-g)/(p.end_row_index-p.start_row_index+1);for(let P=p.start_row_index;P\u003c=p.end_row_index;P++)c[P]+=S}}return{column_widths:o,row_heights:c}},lT=10.16,pT=1.1,_r=lT/pT,hT=297/_r,dT=210/_r,Vst=20/_r,Il=5/_r;function Qf(t={}){let e=t.center??{x:0,y:0},r=t.sheet_width===void 0?hT:t.sheet_width/_r,n=t.sheet_height===void 0?dT:t.sheet_height/_r,i=e.x-r/2,s=e.x+r/2,o=e.y-n/2,c=e.y+n/2;return{center:e,width:r,height:n,minX:i,maxX:s,minY:o,maxY:c,innerMinX:i+Il,innerMaxX:s-Il,innerMinY:o+Il,innerMaxY:c-Il}}function mT(t,e=0.5){let{POSITIVE_INFINITY:r,POSITIVE_INFINITY:n,NEGATIVE_INFINITY:i,NEGATIVE_INFINITY:s}=Number,o=0.2;for(let a of t)if(a.type===\"schematic_sheet\"){let p=Qf(a);l(p.center,{width:p.width,height:p.height},0)}else if(a.type===\"schematic_component\")l(a.center,a.size,0);else if(a.type===\"schematic_port\")l(a.center,{width:o,height:o},0);else if(a.type===\"schematic_debug_object\"){if(a.shape===\"rect\")l(a.center,a.size,0);else if(a.shape===\"line\")l(a.start,{width:0.1,height:0.1},0),l(a.end,{width:0.1,height:0.1},0)}else if(a.type===\"schematic_net_label\"){let p=yr(\"net_label\"),d=Ll(a),f=(d+fr*2+Ri*(a.text?.length||0)+Ei)*p,_=Dw,g=rT(a.anchor_side)/180*Math.PI,y=nT(a,p,d),S=Oi(a.anchor_side),P={x:y.x+S.x*f/2,y:y.y+S.y*f/2};l(P,{width:f,height:_},g)}else if(a.type===\"schematic_trace\")for(let p of a.edges)l(p.from,{width:0.1,height:0.1},0),l(p.to,{width:0.1,height:0.1},0);else if(a.type===\"schematic_text\"){let d=yr(\"reference_designator\",a.font_size)??0.18,m=a.text??\"\",f=a.display_superscript;if(f){let _=m.split(`\n`),g=Math.max(..._.map((B,k)=\u003eLl({text:B,display_superscript:k===_.length-1?f:void 0})))*d,y=a.anchor,S=y===\"left\"||y.endsWith(\"_left\")?g/2:y===\"right\"||y.endsWith(\"_right\")?-g/2:0,P=y===\"top\"||y.startsWith(\"top_\")?0:y===\"bottom\"||y.startsWith(\"bottom_\")?-d:-d/2,b=(_.length+0.3)*d,C=-(P-0.3*d+b/2),L=-(a.rotation??0)*Math.PI/180;l({x:a.position.x+S*Math.cos(L)-C*Math.sin(L),y:a.position.y+S*Math.sin(L)+C*Math.cos(L)},{width:g,height:b},L)}else{let _=m.length*d,g=d;l(a.position,{width:_,height:g},a.rotation??0)}}else if(a.type===\"schematic_voltage_probe\"){if(l(a.position,{width:0.2,height:0.4},0),a.name){let p=yr(\"net_label\"),d=Do(a.name)*p,m=p,f=0.3,_=a.label_alignment??\"top_right\",g=a.position.x,y=a.position.y;if(_.includes(\"top\"))y+=0.3+m/2;else if(_.includes(\"bottom\"))y-=0.3+m/2;if(_.includes(\"right\"))g+=0.3+d/2;else if(_.includes(\"left\"))g-=0.3+d/2;l({x:g,y},{width:d,height:m},0)}}else if(a.type===\"schematic_box\")l({x:a.x+a.width/2,y:a.y+a.height/2},{width:a.width,height:a.height},0);else if(a.type===\"schematic_table\"){let{column_widths:p,row_heights:d}=Hw(a,t),m=p.reduce((b,C)=\u003eb+C,0),f=d.reduce((b,C)=\u003eb+C,0),_=a.anchor??\"center\",g=a.anchor_position.x,y=a.anchor_position.y;if(_.includes(\"center\"))g-=m/2;else if(_.includes(\"right\"))g-=m;if(_.includes(\"center\"))y+=f/2;else if(_.includes(\"bottom\"))y+=f;let S=g+m/2,P=y-f/2;l({x:S,y:P},{width:m,height:f},0)}else if(a.type===\"schematic_line\")l({x:a.x1,y:a.y1},{width:0.02,height:0.02},0),l({x:a.x2,y:a.y2},{width:0.02,height:0.02},0);else if(a.type===\"schematic_circle\")l(a.center,{width:a.radius*2,height:a.radius*2},0);else if(a.type===\"schematic_rect\")l(a.center,{width:a.width,height:a.height},a.rotation);else if(a.type===\"schematic_arc\")l(a.center,{width:a.radius*2,height:a.radius*2},0);else if(a.type===\"schematic_path\"){if(a.points\u0026\u0026a.points.length\u003e0)for(let p of a.points)l(p,{width:0.02,height:0.02},0)}if(!Number.isFinite(r))r=-1,n=-1,i=1,s=1;r-=e,n-=e,i+=e,s+=e;let c=oT(t);if(c){if(c.minX\u003cr)r=c.minX-e;if(c.minY\u003cn)n=c.minY-e;if(c.maxX\u003ei)i=c.maxX+e;if(c.maxY\u003es)s=c.maxY+e}return{minX:r,minY:n,maxX:i,maxY:s};function l(a,p,d){let m=[{x:-p.width/2,y:-p.height/2},{x:p.width/2,y:-p.height/2},{x:p.width/2,y:p.height/2},{x:-p.width/2,y:p.height/2}];for(let f of m){let _=f.x*Math.cos(d)-f.y*Math.sin(d)+a.x,g=f.x*Math.sin(d)+f.y*Math.cos(d)+a.y;r=Math.min(r,_),n=Math.min(n,g),i=Math.max(i,_),s=Math.max(s,g)}}}function Fl(t){if(!Number.isFinite(t))return\"0\";return Number.parseFloat(t.toFixed(6)).toString()}var Vo=\"image/svg+xml\";function uT({schematicGraphic:t,viewport:e}){let r=fT(t);return{name:\"g\",type:\"element\",value:\"\",attributes:{class:\"schematic-graphic\",\"pointer-events\":\"none\",\"data-circuit-json-type\":\"schematic_graphic\",\"data-schematic-graphic-id\":t.schematic_graphic_id,...t.schematic_sheet_id?{\"data-schematic-sheet-id\":t.schematic_sheet_id}:{}},children:[{name:\"image\",type:\"element\",value:\"\",attributes:{href:r,x:Fl(e.x),y:Fl(e.y),width:Fl(e.width),height:Fl(e.height),preserveAspectRatio:\"xMidYMid meet\",overflow:\"hidden\",\"pointer-events\":\"none\"},children:[]}]}}function fT(t){let e=`Unable to render schematic graphic \"${t.schematic_graphic_id}\"`,{asset:r,svg_content:n}=t;if(!r){if(n!==void 0)return Mw(n);throw Error(`${e}: asset or svg_content is required`)}if(Qw(r.mimetype)!==Vo)throw Error(`${e}: asset.mimetype must be \"${Vo}\" (received ${JSON.stringify(r.mimetype)})`);let i=r.url.trim();if(i.toLowerCase().startsWith(\"data:\"))return yT(i,e),i;if(n!==void 0)return Mw(n);throw Error(`${e}: asset.url must be an inline SVG data URL because circuit-to-svg cannot synchronously load ${JSON.stringify(r.url)}`)}function yT(t,e){let r=t.match(/^data:([^,]*),(.*)$/is);if(!r)throw Error(`${e}: asset.url is not a valid SVG data URL`);let n=r[1].split(\";\").map((l)=\u003el.trim());if(Qw(n.shift()??\"\")!==Vo)throw Error(`${e}: asset.url must use the \"${Vo}\" media type`);let s=r[2],o=n.findIndex((l)=\u003el.toLowerCase()===\"base64\"),c=o!==-1;if(c\u0026\u0026o!==n.length-1)throw Error(`${e}: asset.url must place \"base64\" as its final metadata token`);if(c){let l=s.replace(/\\s+/g,\"\");if(!/^(?:[a-z\\d+/]{4})*(?:[a-z\\d+/]{2}==|[a-z\\d+/]{3}=)?$/i.test(l))throw Error(`${e}: asset.url is not a valid SVG data URL`);return}if(s.includes(\"#\"))throw Error(`${e}: asset.url must percent-encode \"#\" in a non-base64 SVG data URL`);try{decodeURIComponent(s)}catch(l){throw Error(`${e}: asset.url is not a valid SVG data URL`,{cause:l})}}function Mw(t){let e=new TextEncoder().encode(t),r=\"\",n=32768;for(let i=0;i\u003ce.length;i+=n)r+=String.fromCharCode(...e.subarray(i,i+n));return`data:${Vo};base64,${btoa(r)}`}function Qw(t){return(t.split(\";\",1)[0]??\"\").trim().toLowerCase()}var Gt=(t)=\u003eMath.abs(t.a)*0.02,Gf=({text:t,realCenter:e,realToScreenTransform:r})=\u003e{let n=O(r,e);return{type:\"element\",name:\"text\",value:\"\",attributes:{x:n.x.toString(),y:n.y.toString(),fill:\"red\",\"text-anchor\":\"middle\",\"dominant-baseline\":\"middle\",\"font-family\":\"sans-serif\",\"font-size\":`${fe(r,\"error\")}px`},children:[{type:\"text\",value:t,name:\"\",attributes:{},children:[]}]}},_T=({schNetLabel:t,realToScreenTransform:e,colorMap:r})=\u003e{if(!t.text)return[];let n=t.text.startsWith(\"N_\"),i=n?t.text.slice(2):t.text,s=Vw(t),o=[],c=Gr[t.symbol_name];if(!c){let et=Gf({text:`Symbol not found: ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e});return et.attributes={...et.attributes,...s},o.push(et),o}let l=c.primitives.filter((et)=\u003eet.type===\"path\"),a=c.primitives.filter((et)=\u003eet.type===\"text\"),p=c.primitives.filter((et)=\u003eet.type===\"circle\"),d=c.primitives.filter((et)=\u003eet.type===\"box\"),m={minX:Math.min(...l.flatMap((et)=\u003eet.points.map((D)=\u003eD.x))),maxX:Math.max(...l.flatMap((et)=\u003eet.points.map((D)=\u003eD.x))),minY:Math.min(...l.flatMap((et)=\u003eet.points.map((D)=\u003eD.y))),maxY:Math.max(...l.flatMap((et)=\u003eet.points.map((D)=\u003eD.y)))},f=yr(\"net_label\"),g=Ll({...t,text:i})+fr*2+Ri*i.length+Ei,y=Oi(t.anchor_side),S=t.anchor_position??{x:t.center.x-y.x*g*f/2,y:t.center.y-y.y*g*f/2},b=Se(0/180*Math.PI),C={minX:Math.min(...c.primitives.flatMap((et)=\u003eet.type===\"path\"?et.points.map((D)=\u003eD.x):[])),maxX:Math.max(...c.primitives.flatMap((et)=\u003eet.type===\"path\"?et.points.map((D)=\u003eD.x):[])),minY:Math.min(...c.primitives.flatMap((et)=\u003eet.type===\"path\"?et.points.map((D)=\u003eD.y):[])),maxY:Math.max(...c.primitives.flatMap((et)=\u003eet.type===\"path\"?et.points.map((D)=\u003eD.y):[]))},L=c.ports?.[0]?{x:c.ports[0].x,y:c.ports[0].y}:{x:C.minX,y:(C.minY+C.maxY)/2},B=O(b,L),k=Ct(Rt(S.x-B.x,S.y-B.y),b,oe(1)),[I,j]=O(Ct(e,k),[m.minX,m.minY]),[Q,lt]=O(Ct(e,k),[m.maxX,m.maxY]),z=Math.abs(lt-j),N=Math.min(j,lt),at=Math.abs(Q-I),ot=Math.min(I,Q);o.push({name:\"rect\",type:\"element\",value:\"\",attributes:{class:\"component-overlay sch-component-overlay sch-net-label-overlay\",...s,x:ot.toString(),y:N.toString(),width:at.toString(),height:z.toString(),fill:\"transparent\"},children:[]});for(let et of l){let D=et.points.map((it,rt)=\u003e{let[G,H]=O(Ct(e,k),[it.x,it.y]);return`${rt===0?\"M\":\"L\"} ${G} ${H}`}).join(\" \");o.push({name:\"path\",type:\"element\",attributes:{class:\"sch-net-label-symbol-path\",...s,d:D+(et.closed?\" Z\":\"\"),stroke:r.schematic.component_outline,fill:\"none\",\"stroke-width\":`${Gt(e)}px`,\"stroke-linecap\":\"round\"},value:\"\",children:[]})}for(let et of a){let D=O(Ct(e,k),et),it=et.text;if(it===\"{REF}\")it=i||\"\";else if(it===\"{VAL}\")it=\"\";let G=Math.abs(e.a)*0.1,H={x:D.x,y:D.y};o.push({name:\"text\",type:\"element\",attributes:{class:\"sch-net-label-symbol-text\",...s,x:H.x.toString(),y:H.y.toString(),fill:r.schematic.label_local,\"font-family\":\"sans-serif\",\"text-anchor\":eT[et.anchor],\"dominant-baseline\":Fw[et.anchor],\"font-size\":`${fe(e,\"reference_designator\")}px`,...n\u0026\u0026it===i?{style:\"text-decoration: overline;\"}:{}},children:Hf(it,et.text===\"{REF}\"?t.display_superscript:void 0,fe(e,\"reference_designator\"),Fw[et.anchor]),value:\"\"})}for(let et of d){let D=O(Ct(e,k),et),it=Ct(e,k).a;o.push({name:\"rect\",type:\"element\",attributes:{class:\"sch-net-label-symbol-box\",...s,x:D.x.toString(),y:D.y.toString(),width:(et.width*it).toString(),height:(et.height*it).toString(),fill:\"red\"},value:\"\",children:[]})}for(let et of p){let D=O(Ct(e,k),et),it=Ct(e,k).a;o.push({name:\"circle\",type:\"element\",attributes:{class:\"sch-net-label-symbol-circle\",...s,cx:D.x.toString(),cy:D.y.toString(),r:(et.radius*it).toString(),fill:\"none\",stroke:r.schematic.component_outline,\"stroke-width\":`${Gt(e)}px`},value:\"\",children:[]})}return o},gT=({schNetLabel:t,realToScreenTransform:e,colorMap:r})=\u003e{if(!t.text)return[];let n=t.text;if(t.symbol_name)return _T({schNetLabel:t,realToScreenTransform:e,colorMap:r});let i=Vw(t),s=[],o=fe(e,\"net_label\"),c=yr(\"net_label\"),l=Dw/c/2,a=Ll({...t,text:n}),p=O(e,t.center),d=Oi(t.anchor_side),m={...d};m.y*=-1;let f=a+fr*2+Ri*n.length+Ei,_=t.anchor_position?O(e,t.anchor_position):{x:p.x-m.x*f*o/2,y:p.y-m.y*f*o/2},g=t.anchor_position??{x:t.center.x-d.x*f*c/2,y:t.center.y-d.y*f*c/2},y={left:0,top:-90,bottom:90,right:180}[t.anchor_side],S=[{x:0,y:0},{x:fr,y:l},{x:fr*2+Ei+Ri*n.length+a,y:l},{x:fr*2+Ei+Ri*n.length+a,y:-l},{x:fr,y:-l}].map((B)=\u003eO(Ct(e,Rt(g.x,g.y),oe(c),Se(y/180*Math.PI)),B)),P=`\n M ${S[0].x},${S[0].y}\n L ${S[1].x},${S[1].y}\n L ${S[2].x},${S[2].y}\n L ${S[3].x},${S[3].y}\n L ${S[4].x},${S[4].y}\n Z\n `;s.push({name:\"path\",type:\"element\",attributes:{class:\"net-label sch-net-label\",...i,d:P,fill:r.schematic.label_background,stroke:r.schematic.label_global,\"stroke-width\":`${Gt(e)}px`},value:\"\",children:[]});let b={x:_.x+m.x*o*0.5,y:_.y+m.y*o*0.5},C={left:\"start\",top:\"start\",bottom:\"start\",right:\"end\"}[t.anchor_side],L={left:\"\",right:\"\",top:`rotate(90 ${b.x} ${b.y})`,bottom:`rotate(-90 ${b.x} ${b.y})`}[t.anchor_side];return s.push({name:\"text\",type:\"element\",attributes:{class:\"net-label-text sch-net-label-text\",...i,x:b.x.toString(),y:b.y.toString(),fill:r.schematic.label_global,\"text-anchor\":C,\"dominant-baseline\":\"central\",\"font-family\":\"sans-serif\",\"font-variant-numeric\":\"tabular-nums\",\"font-size\":`${o}px`,transform:L},children:Hf(n,t.display_superscript,o),value:\"\"}),s},xT=0.02,bT=({schPort:t,transform:e})=\u003e{let r=O(e,t.center),n=Math.abs(e.a)*xT*2;return[{name:\"g\",type:\"element\",value:\"\",attributes:{class:\"schematic-port-hover sch-port-hover\",\"data-schematic-port-id\":t.source_port_id,...t.schematic_sheet_id?{\"data-schematic-sheet-id\":t.schematic_sheet_id}:{}},children:[{name:\"circle\",type:\"element\",value:\"\",attributes:{cx:r.x.toString(),cy:r.y.toString(),r:n.toString(),fill:\"red\",opacity:\"0\"},children:[]}]}]},vT=({component:t,transform:e,circuitJson:r})=\u003e{let n=Kt(r).schematic_port.list({schematic_component_id:t.schematic_component_id}),i=[];for(let s of n)i.push(...bT({schPort:s,transform:e}));return i},ST=({schPort:t,transform:e,colorMap:r})=\u003e{let{x:i,y:s}=t.center,o=[-1,1].map((c)=\u003e{let l=O(e,{x:i-0.05,y:s-c*0.05}),a=O(e,{x:i+0.05,y:s+c*0.05});return`M ${l.x} ${l.y} L ${a.x} ${a.y}`}).join(\" \");return{name:\"path\",type:\"element\",value:\"\",attributes:{class:\"sch-port-no-connect\",\"data-schematic-port-id\":t.schematic_port_id,\"data-source-port-id\":t.source_port_id,d:o,fill:\"none\",stroke:r.schematic.no_connect,\"stroke-width\":`${Gt(e)}px`,\"stroke-linecap\":\"round\"},children:[]}},Cw=0.02,wT=({schPort:t,transform:e,circuitJson:r,colorMap:n})=\u003e{let i=[],s=Math.abs(e.a)*Cw,o=Math.abs(e.a)*Cw,c=O(e,t.center),l=r.find((p)=\u003ep.type===\"source_port\"\u0026\u0026p.source_port_id===t.source_port_id);if(!l?.do_not_connect)i.push({name:\"circle\",type:\"element\",value:\"\",attributes:{class:\"component-pin sch-component-pin sch-port-indicator\",cx:c.x.toString(),cy:c.y.toString(),r:s.toString(),fill:\"none\",stroke:n.schematic.component_outline,\"stroke-width\":o.toString(),\"data-schematic-port-id\":t.schematic_port_id},children:[]});let a=t.display_pin_label??l?.name;if(a){let p={...t.center},d=t.distance_from_component_edge??0,m=0.05,f=\"middle\",_=\"\";switch(t.facing_direction){case\"left\":p.x+=d/2,p.y+=0.05,f=\"start\";break;case\"right\":p.x-=d/2,p.y+=0.05,f=\"end\";break;case\"up\":p.y-=d/2,p.x-=0.05,f=\"middle\";break;case\"down\":p.y+=d/2,p.x-=0.05,f=\"middle\";break}let g=O(e,p),y=fe(e,\"pin_number\");if(t.facing_direction===\"up\"||t.facing_direction===\"down\")_=`rotate(-90 ${g.x} ${g.y})`;i.push({name:\"text\",type:\"element\",value:\"\",attributes:{class:\"port-indicator-label sch-port-label\",x:g.x.toString(),y:g.y.toString(),fill:n.schematic.component_outline,\"font-family\":\"sans-serif\",\"font-size\":`${y*0.7}px`,\"text-anchor\":f,\"dominant-baseline\":\"middle\",..._\u0026\u0026{transform:_}},children:[{type:\"text\",value:a,name:\"\",attributes:{},children:[]}]})}return i},Zw=(t)=\u003e({type:\"element\",name:\"tspan\",value:\"\",attributes:t.is_overlined?{\"text-decoration\":\"overline\"}:{},children:[{type:\"text\",name:\"\",value:t.text,attributes:{},children:[]}]}),AT=(t)=\u003et.filter((e)=\u003ee.text).map(Zw),PT=(t)=\u003e{let e=[[]];for(let r of t)r.text.split(`\n`).forEach((n,i)=\u003e{if(i\u003e0)e.push([]);if(n)e.at(-1).push(Zw({...r,text:n}))});return e},Zf=({elm:t,transform:e,colorMap:r})=\u003e{let n=O(e,t.position),i={center:\"middle\",center_right:\"end\",bottom_left:\"start\",bottom_center:\"middle\",bottom_right:\"end\",left:\"start\",right:\"end\",top:\"middle\",bottom:\"middle\",top_left:\"start\",top_center:\"middle\",top_right:\"end\",center_left:\"start\"},s={center:\"middle\",center_right:\"middle\",bottom_left:\"ideographic\",bottom_center:\"ideographic\",bottom_right:\"ideographic\",left:\"middle\",right:\"middle\",top:\"hanging\",bottom:\"ideographic\",top_left:\"hanging\",top_center:\"hanging\",top_right:\"hanging\",center_left:\"middle\"},o=t.text.split(`\n`),c=PT(t.text_parts??[]),l=o.length===1?t.text_parts?.length?c[0]:[{type:\"text\",value:t.text,name:t.schematic_text_id,attributes:{},children:[]}]:o.map((a,p)=\u003e({type:\"element\",name:\"tspan\",value:\"\",attributes:{x:n.x.toString(),...p\u003e0?{dy:\"1em\"}:{}},children:t.text_parts?.length?c[p]??[]:[{type:\"text\",value:a,name:p===0?t.schematic_text_id:\"\",attributes:{},children:[]}]}));if(t.display_superscript)(o.length===1?l:l[l.length-1].children).push(...Hf(\"\",t.display_superscript,fe(e,\"reference_designator\",t.font_size),s[t.anchor]).slice(1));return{type:\"element\",name:\"text\",value:\"\",attributes:{class:\"sch-text\",x:n.x.toString(),y:n.y.toString(),fill:t.color??r.schematic.sheet_label,\"text-anchor\":i[t.anchor],\"dominant-baseline\":s[t.anchor],\"font-family\":\"sans-serif\",\"font-size\":`${fe(e,\"reference_designator\",t.font_size)}px`,transform:`rotate(${t.rotation}, ${n.x}, ${n.y})`},children:l}};function qw({schArc:t,transform:e,colorMap:r}){let n=O(e,t.center),i=Math.abs(e.a)*t.radius,s=t.stroke_width??0.02,o=Math.abs(e.a)*s,c=t.start_angle_degrees*Math.PI/180,l=t.end_angle_degrees*Math.PI/180,a=n.x+i*Math.cos(c),p=n.y+i*Math.sin(c),d=n.x+i*Math.cos(l),m=n.y+i*Math.sin(l),f=t.end_angle_degrees-t.start_angle_degrees;if(t.direction===\"clockwise\")f=-f;if(f\u003c0)f+=360;let _=f\u003e180?1:0,g=t.direction===\"clockwise\"?1:0;return[{name:\"path\",type:\"element\",attributes:{class:\"sch-arc\",d:`M ${a} ${p} A ${i} ${i} 0 ${_} ${g} ${d} ${m}`,fill:\"none\",stroke:t.color,\"stroke-width\":o.toString(),...t.is_dashed\u0026\u0026{\"stroke-dasharray\":(o*3).toString()},\"data-schematic-arc-id\":t.schematic_arc_id,...t.schematic_component_id\u0026\u0026{\"data-schematic-component-id\":t.schematic_component_id}},children:[],value:\"\"}]}var BT=({schematicBox:t,transform:e,colorMap:r})=\u003e{let n=O(e,{x:t.x,y:t.y}),i=O(e,{x:t.x+t.width,y:t.y+t.height}),s=Math.min(n.y,i.y),o=Math.max(n.y,i.y),c=Math.min(n.x,i.x),l=Math.max(n.x,i.x),a=Gt(e),p={class:\"schematic-box sch-box\",x:c.toString(),y:s.toString(),width:(l-c).toString(),height:(o-s).toString(),\"stroke-width\":`${a}px`,stroke:r.schematic.component_outline||\"black\",fill:\"transparent\"};if(t.is_dashed){let d=8*a,m=4*a;p[\"stroke-dasharray\"]=`${d} ${m}`}return[{name:\"rect\",type:\"element\",value:\"\",attributes:p,children:[]}]};function Jw({schCircle:t,transform:e,colorMap:r}){let n=O(e,t.center),i=Math.abs(e.a)*t.radius,s=t.stroke_width??0.02,o=Math.abs(e.a)*s;return[{name:\"circle\",type:\"element\",attributes:{class:\"sch-circle\",cx:n.x.toString(),cy:n.y.toString(),r:i.toString(),fill:t.is_filled?t.fill_color??t.color:\"none\",stroke:t.color,\"stroke-width\":o.toString(),...t.is_dashed\u0026\u0026{\"stroke-dasharray\":(o*3).toString()},\"data-schematic-circle-id\":t.schematic_circle_id,...t.schematic_component_id\u0026\u0026{\"data-schematic-component-id\":t.schematic_component_id}},children:[],value:\"\"}]}var Kw=(t,e)=\u003e{for(let r of t){if(r.type!==\"source_trace\")continue;let n=r;if(Array.isArray(n.connected_source_port_ids)\u0026\u0026n.connected_source_port_ids.includes(e))return!0}return!1},IT={top_left:\"start\",top_right:\"end\",middle_left:\"start\",middle_right:\"end\",bottom_left:\"start\",bottom_right:\"end\",center:\"middle\",middle_top:\"middle\",middle_bottom:\"middle\"},FT={top_left:\"hanging\",top_right:\"hanging\",bottom_left:\"ideographic\",bottom_right:\"ideographic\",center:\"middle\",middle_left:\"middle\",middle_right:\"middle\",middle_top:\"hanging\",middle_bottom:\"ideographic\"},MT=({component:t,transform:e,circuitJson:r,colorMap:n})=\u003e{let i=[],s=Gr[t.symbol_name];if(!s)return[Gf({text:`Symbol not found: ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e})];let o=Kt(r).schematic_port.list({schematic_component_id:t.schematic_component_id}),c=Kt(r).source_component.get(t.source_component_id),l=zw({schPorts:o,symbol:s,schComponent:t});if(!l[0])return[Gf({text:`Could not match ports for symbol ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e})];let a=Uw(l[1]?.symbolPort??s.center,l[1]?.schPort.center??t.center,l[0].symbolPort,l[0].schPort.center),p=s.primitives.filter((I)=\u003eI.type===\"path\"),d=s.primitives.filter((I)=\u003eI.type===\"text\"),m=s.primitives.filter((I)=\u003eI.type===\"circle\"),f=s.primitives.filter((I)=\u003eI.type===\"box\"),_=new Set;for(let I of l)if(Kw(r,I.schPort.source_port_id)||Kt(r).source_port.get(I.schPort.source_port_id)?.do_not_connect)_.add(I.symbolPort);let g={minX:Math.min(...p.flatMap((I)=\u003eI.points.map((j)=\u003ej.x))),maxX:Math.max(...p.flatMap((I)=\u003eI.points.map((j)=\u003ej.x))),minY:Math.min(...p.flatMap((I)=\u003eI.points.map((j)=\u003ej.y))),maxY:Math.max(...p.flatMap((I)=\u003eI.points.map((j)=\u003ej.y)))},[y,S]=O(Ct(e,a),[g.minX,g.minY]),[P,b]=O(Ct(e,a),[g.maxX,g.maxY]),C=Math.abs(b-S),L=Math.min(S,b),B=Math.abs(P-y),k=Math.min(y,P);i.push({name:\"rect\",type:\"element\",value:\"\",attributes:{class:\"component-overlay sch-component-overlay\",x:k.toString(),y:L.toString(),width:B.toString(),height:C.toString(),fill:\"transparent\"},children:[]});for(let I of p){let{points:j,color:Q,closed:lt,fill:z}=I;i.push({type:\"element\",name:\"path\",attributes:{class:\"sch-component-symbol-path\",d:j.map((N,at)=\u003e{let[ot,et]=O(Ct(e,a),[N.x,N.y]);return`${at===0?\"M\":\"L\"} ${ot} ${et}`}).join(\" \")+(lt?\" Z\":\"\"),stroke:n.schematic.component_outline,fill:\"none\",\"stroke-width\":`${Gt(e)}px`,\"stroke-linecap\":\"round\"},value:\"\",children:[]})}for(let I of d){let j=O(Ct(e,a),I),Q=\"\",lt=I.text===\"{REF}\";if(lt)Q=c?.display_name??c?.name??\"\";else if(I.text===\"{VAL}\")Q=t.symbol_display_value??\"\";let z=FT[I.anchor];i.push({name:\"text\",type:\"element\",attributes:{class:lt?\"sch-component-name sch-component-text\":\"sch-component-text\",x:j.x.toString(),y:j.y.toString(),...lt?{stroke:n.schematic.background,\"stroke-width\":`${Gt(e)}px`,\"paint-order\":\"stroke\"}:{},fill:n.schematic.label_local,\"font-family\":\"sans-serif\",\"text-anchor\":IT[I.anchor],\"dominant-baseline\":z,\"font-size\":`${fe(e,\"reference_designator\")}px`},value:\"\",children:[{type:\"text\",value:Q,name:\"\",attributes:{},children:[]}]})}for(let I of f){let j=O(Ct(e,a),I),Q=Ct(e,a).a;i.push({name:\"rect\",type:\"element\",attributes:{class:\"sch-component-symbol-box\",x:j.x.toString(),y:j.y.toString(),width:(I.width*Q).toString(),height:(I.height*Q).toString(),fill:\"red\"},value:\"\",children:[]})}for(let I of s.ports){if(_.has(I))continue;let j=O(Ct(e,a),I);i.push({type:\"element\",name:\"circle\",attributes:{class:\"component-pin sch-component-pin\",cx:j.x.toString(),cy:j.y.toString(),r:`${Math.abs(e.a)*0.02}px`,\"stroke-width\":`${Gt(e)}px`,fill:\"none\",stroke:n.schematic.component_outline},value:\"\",children:[]})}for(let I of m){let j=O(Ct(e,a),I),Q=Math.abs(I.radius*e.a);i.push({type:\"element\",name:\"circle\",attributes:{class:\"sch-component-symbol-circle\",cx:j.x.toString(),cy:j.y.toString(),r:`${Q}px`,\"stroke-width\":`${Gt(e)}px`,fill:\"none\",stroke:n.schematic.component_outline},value:\"\",children:[]})}return i},Wo=0.02,kw=(t,e,r,n,i)=\u003e{let s=Math.PI/6,o={x:t.x-r*Math.cos(e-s),y:t.y-r*Math.sin(e-s)},c={x:t.x-r*Math.cos(e+s),y:t.y-r*Math.sin(e+s)};return{name:\"polygon\",type:\"element\",attributes:{points:`${t.x},${t.y} ${o.x},${o.y} ${c.x},${c.y}`,fill:\"white\",stroke:n,\"stroke-width\":`${i}px`},value:\"\",children:[]}},CT=({schPort:t,schComponent:e,transform:r,circuitJson:n})=\u003e{let i=[],s=Kt(n).source_port.get(t.source_port_id),o={x:t.center.x,y:t.center.y},c=t.distance_from_component_edge??0.4;switch(t.side_of_component){case\"left\":o.x+=c;break;case\"right\":o.x-=c;break;case\"top\":o.y-=c;break;case\"bottom\":o.y+=c;break}let l=O(r,t.center),a=O(r,o),p=s!=null\u0026\u0026s.source_component_id==null\u0026\u0026typeof t.is_connected===\"boolean\"?t.is_connected:Kw(n,t.source_port_id),d=t.is_drawn_with_inversion_circle??!1,m=0.06,f={...t.center};if(!p\u0026\u0026!s?.do_not_connect)switch(t.side_of_component){case\"left\":f.x+=Wo;break;case\"right\":f.x-=Wo;break;case\"top\":f.y-=Wo;break;case\"bottom\":f.y+=Wo;break}let _=O(r,f);if(d){let b=Math.abs(r.a)*m,C={...a};switch(t.side_of_component){case\"left\":C.x-=b,a.x-=b*2;break;case\"right\":C.x+=b,a.x+=b*2;break;case\"top\":C.y-=b,a.y-=b*2;break;case\"bottom\":C.y+=b,a.y+=b*2;break}i.push({name:\"circle\",type:\"element\",attributes:{class:\"component-pin sch-component-pin sch-inversion-bubble\",cx:C.x.toString(),cy:C.y.toString(),r:b.toString(),fill:\"white\",stroke:re.schematic.component_outline,\"stroke-width\":`${Gt(r)}px`},value:\"\",children:[]})}i.push({name:\"line\",type:\"element\",attributes:{class:\"component-pin sch-component-pin sch-port-line\",x1:a.x.toString(),y1:a.y.toString(),x2:_.x.toString(),y2:_.y.toString(),\"stroke-width\":`${Gt(r)}px`},value:\"\",children:[]});let g=Math.abs(r.a)*Wo,y=[];if(!p\u0026\u0026!s?.do_not_connect)y.push({name:\"circle\",type:\"element\",attributes:{class:\"component-pin sch-component-pin sch-port-terminal\",cx:l.x.toString(),cy:l.y.toString(),r:g.toString(),\"stroke-width\":`${Gt(r)}px`},value:\"\",children:[]});y.push({name:\"rect\",type:\"element\",attributes:{x:(l.x-g).toString(),y:(l.y-g).toString(),width:(g*2).toString(),height:(g*2).toString(),opacity:\"0\"},value:\"\",children:[]}),i.push({name:\"g\",type:\"element\",value:\"\",attributes:{class:\"sch-port\",\"data-schematic-port-id\":t.source_port_id},children:y});let{has_input_arrow:S,has_output_arrow:P}=t;if((S||P)\u0026\u0026t.side_of_component){let b=Math.abs(r.a)*0.1,C=re.schematic.component_outline,L=b*Math.cos(Math.PI/6),B=Gt(r)/3,k=0,I=0;if(t.side_of_component===\"left\")k=0,I=Math.PI;else if(t.side_of_component===\"right\")k=Math.PI,I=0;else if(t.side_of_component===\"top\")k=Math.PI/2,I=-Math.PI/2;else if(t.side_of_component===\"bottom\")k=-Math.PI/2,I=Math.PI/2;let j=S\u0026\u0026P,Q={...a},lt={...a};if(j){let z=L;if(t.side_of_component===\"left\")lt.x-=z;else if(t.side_of_component===\"right\")lt.x+=z;else if(t.side_of_component===\"top\")lt.y-=z;else if(t.side_of_component===\"bottom\")lt.y+=z}if(S)i.push(kw(Q,k,b,C,B));if(P){let z={x:lt.x+b*Math.cos(I),y:lt.y+b*Math.sin(I)};i.push(kw(z,I,b,C,B))}}return i},kT=(t)=\u003e{let e=[],{schPort:r,schComponent:n,transform:i,circuitJson:s}=t,o={x:r.center.x,y:r.center.y};if(!r.side_of_component)return[];let c=Oi(r.side_of_component),l=r.distance_from_component_edge??0.4;if(o.x+=c.x*l/2,o.y+=c.y*l/2,r.side_of_component===\"top\"||r.side_of_component===\"bottom\")o.x-=0.02;else o.y+=0.02;let a=O(i,o);return e.push({name:\"text\",type:\"element\",attributes:{class:\"pin-number sch-pin-number\",x:a.x.toString(),y:a.y.toString(),style:\"font-family: sans-serif;\",fill:re.schematic.pin_number,\"text-anchor\":\"middle\",\"dominant-baseline\":\"auto\",\"font-size\":`${fe(i,\"pin_number\")}px`,transform:r.side_of_component===\"top\"||r.side_of_component===\"bottom\"?`rotate(-90 ${a.x} ${a.y})`:\"\"},children:[{type:\"text\",value:r.pin_number?.toString()||\"\",name:\"\",attributes:{},children:[]}],value:\"\"}),e},Nw=0.1,t4=(t)=\u003e{let e=[],{schPort:r,schComponent:n,transform:i,labelColor:s=re.schematic.pin_number,labelClassName:o=\"pin-number sch-pin-label\"}=t,c={x:r.center.x,y:r.center.y};if(!r.side_of_component)return[];let l=Oi(r.side_of_component),a=r.distance_from_component_edge??0.4;c.x+=l.x*(a+Nw),c.y+=l.y*(a+Nw);let p=O(i,c),d=r.display_pin_label??n.port_labels?.[`${r.pin_number}`];if(!d)return[];let m=d.startsWith(\"N_\"),f=m?d.slice(2):d,_=r.display_pin_label_text_parts,g=r.is_drawn_with_inversion_circle??!1,y=fe(i,m||g?\"negated_pin_number\":\"pin_number\",r.display_pin_label_font_size);return e.push({name:\"text\",type:\"element\",attributes:{class:o,x:p.x.toString(),y:p.y.toString(),style:`font-family: sans-serif;${m\u0026\u0026!_?.length?\" text-decoration: overline;\":\"\"}`,fill:s,\"text-anchor\":r.side_of_component===\"left\"||r.side_of_component===\"bottom\"?\"start\":\"end\",\"dominant-baseline\":\"middle\",\"font-size\":`${y}px`,transform:r.side_of_component===\"top\"||r.side_of_component===\"bottom\"?`rotate(-90 ${p.x} ${p.y})`:\"\"},children:_?.length?AT(_):[{type:\"text\",value:f||\"\",name:\"\",attributes:{},children:[]}],value:\"\"}),e},NT=(t)=\u003e{let e=[],{schPort:r,schComponent:n,transform:i,circuitJson:s}=t;return e.push(...CT(t)),e.push(...kT(t)),e.push(...t4(t)),e},YT=({component:t,transform:e,circuitJson:r,colorMap:n})=\u003e{let i=[],s=O(e,{x:t.center.x-t.size.width/2,y:t.center.y+t.size.height/2}),o=O(e,{x:t.center.x+t.size.width/2,y:t.center.y-t.size.height/2}),c=o.x-s.x,l=o.y-s.y;i.push({name:\"rect\",type:\"element\",value:\"\",attributes:{class:\"component chip sch-component-body\",x:s.x.toString(),y:s.y.toString(),width:c.toString(),height:l.toString(),\"stroke-width\":`${Gt(e)}px`,fill:n.schematic.component_body,stroke:n.schematic.component_outline},children:[]}),i.push({name:\"rect\",type:\"element\",value:\"\",attributes:{class:\"component-overlay sch-component-overlay\",x:s.x.toString(),y:s.y.toString(),width:c.toString(),height:l.toString(),fill:\"transparent\"},children:[]});let a=Kt(r).schematic_text.list();for(let d of a)if(d.schematic_component_id===t.schematic_component_id)i.push(Zf({elm:d,transform:e,colorMap:n}));let p=Kt(r).schematic_port.list({schematic_component_id:t.schematic_component_id});for(let d of p)i.push(...NT({schPort:d,schComponent:t,transform:e,circuitJson:r}));return i};function e4({isDashed:t,dashLength:e,dashGap:r,strokeWidth:n,transform:i}){if(!t)return;let s=Math.abs(i.a),o=n*s*3,c=e!==void 0?e*s:o,l=r!==void 0?r*s:o;return`${c} ${l}`}function r4({schLine:t,transform:e,colorMap:r}){let n=O(e,{x:t.x1,y:t.y1}),i=O(e,{x:t.x2,y:t.y2}),s=t.stroke_width??0.02,o=Math.abs(e.a)*s,c=e4({isDashed:t.is_dashed,dashLength:t.dash_length,dashGap:t.dash_gap,strokeWidth:s,transform:e});return[{name:\"line\",type:\"element\",attributes:{class:\"sch-line\",x1:n.x.toString(),y1:n.y.toString(),x2:i.x.toString(),y2:i.y.toString(),stroke:t.color,\"stroke-width\":o.toString(),...c\u0026\u0026{\"stroke-dasharray\":c},\"data-schematic-line-id\":t.schematic_line_id,...t.schematic_component_id\u0026\u0026{\"data-schematic-component-id\":t.schematic_component_id}},children:[],value:\"\"}]}function n4({schRect:t,transform:e,colorMap:r}){let n=O(e,t.center),i=Math.abs(e.a)*t.width,s=Math.abs(e.d)*t.height,o=t.stroke_width??0.02,c=Math.abs(e.a)*o,l=n.x-i/2,a=n.y-s/2;return[{name:\"rect\",type:\"element\",attributes:{class:\"sch-rect\",x:l.toString(),y:a.toString(),width:i.toString(),height:s.toString(),fill:t.is_filled?t.fill_color??t.color:\"none\",stroke:t.color,\"stroke-width\":c.toString(),...t.is_dashed\u0026\u0026{\"stroke-dasharray\":(c*3).toString()},...t.rotation!==0\u0026\u0026{transform:`rotate(${t.rotation} ${n.x} ${n.y})`},\"data-schematic-rect-id\":t.schematic_rect_id,...t.schematic_component_id\u0026\u0026{\"data-schematic-component-id\":t.schematic_component_id}},children:[],value:\"\"}]}function i4({schPath:t,transform:e,colorMap:r}){let n=t.stroke_color??r.schematic.component_outline,i=t.fill_color??\"none\",s=t.stroke_width??0.02,o=Math.abs(e.a)*s,c=e4({isDashed:t.is_dashed,dashLength:t.dash_length,dashGap:t.dash_gap,strokeWidth:s,transform:e});if(!t.points||t.points.length\u003c2)return[];return[{name:\"path\",type:\"element\",attributes:{class:\"sch-path\",d:t.points.map((p)=\u003eO(e,{x:p.x,y:p.y})).map((p,d)=\u003e`${d===0?\"M\":\"L\"} ${p.x} ${p.y}`).join(\" \"),stroke:n,\"stroke-width\":o.toString(),fill:t.is_filled?i:\"none\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\",...c\u0026\u0026{\"stroke-dasharray\":c},...t.schematic_component_id\u0026\u0026{\"data-schematic-component-id\":t.schematic_component_id}},children:[],value:\"\"}]}var LT=({component:t,transform:e,circuitJson:r,colorMap:n})=\u003e{let i=[],s=t.schematic_component_id;for(let o of r){if(!(\"schematic_component_id\"in o)||o.schematic_component_id!==s)continue;if(o.type===\"schematic_text\"\u0026\u0026t.is_box_with_pins===!1)i.push(Zf({elm:o,transform:e,colorMap:n}));else if(o.type===\"schematic_line\")i.push(...r4({schLine:o,transform:e,colorMap:n}));else if(o.type===\"schematic_circle\")i.push(...Jw({schCircle:o,transform:e,colorMap:n}));else if(o.type===\"schematic_rect\")i.push(...n4({schRect:o,transform:e,colorMap:n}));else if(o.type===\"schematic_arc\")i.push(...qw({schArc:o,transform:e,colorMap:n}));else if(o.type===\"schematic_path\")i.push(...i4({schPath:o,transform:e,colorMap:n}))}if(t.is_box_with_pins===!1){let o=r.filter((l)=\u003el.type===\"schematic_line\"\u0026\u0026l.schematic_component_id===s),c=r.filter((l)=\u003el.type===\"schematic_port\"\u0026\u0026l.schematic_component_id===s);for(let l of c){let a=o.find((g)=\u003eg.x1===l.center.x\u0026\u0026g.y1===l.center.y||g.x2===l.center.x\u0026\u0026g.y2===l.center.y);if(!a)continue;let p=a.x1===l.center.x\u0026\u0026a.y1===l.center.y?{x:a.x2,y:a.y2}:{x:a.x1,y:a.y1},d=p.x-l.center.x,m=p.y-l.center.y,f=Math.abs(d)\u003eMath.abs(m)?d\u003e0?\"left\":\"right\":m\u003e0?\"bottom\":\"top\",_=Math.max(Math.abs(d),Math.abs(m));i.push(...t4({schPort:{...l,side_of_component:f,distance_from_component_edge:_},schComponent:t,transform:e,circuitJson:r,labelClassName:\"port-label sch-pin-label\",labelColor:n.schematic.pin_name}))}}return i};function TT(t){let{component:e}=t,r=[];if(e.is_box_with_pins!==!1)if(e.symbol_name)r=MT(t);else r=YT(t);let n=LT(t),i=[...r,...n];return[{type:\"element\",name:\"g\",attributes:{class:\"sch-component\",\"data-circuit-json-type\":\"schematic_component\",\"data-schematic-component-id\":e.schematic_component_id,...e.schematic_sheet_id?{\"data-schematic-sheet-id\":e.schematic_sheet_id}:{}},children:i,value:\"\"}]}function ET({debugObject:t,transform:e}){if(t.shape===\"rect\"){let[r,n]=O(e,[t.center.x-t.size.width/2,t.center.y-t.size.height/2]),[i,s]=O(e,[t.center.x+t.size.width/2,t.center.y+t.size.height/2]);[n,s]=[Math.min(n,s),Math.max(n,s)];let o=Math.abs(i-r),c=Math.abs(s-n),[l,a]=O(e,[t.center.x,t.center.y]);return[{name:\"rect\",type:\"element\",value:\"\",attributes:{x:r.toString(),y:n.toString(),width:o.toString(),height:c.toString(),fill:\"none\",stroke:\"red\",\"stroke-width\":(0.02*Math.abs(e.a)).toString(),\"stroke-dasharray\":\"5,5\"},children:t.label?[{name:\"text\",type:\"element\",value:\"\",attributes:{x:l.toString(),y:(a-10).toString(),\"text-anchor\":\"middle\",\"font-size\":(0.2*Math.abs(e.a)).toString(),fill:\"red\"},children:[{type:\"text\",value:t.label,name:\"\",attributes:{},children:[]}]}]:[]}]}if(t.shape===\"line\"){let[r,n]=O(e,[t.start.x,t.start.y]),[i,s]=O(e,[t.end.x,t.end.y]),o=(r+i)/2,c=(n+s)/2;return[{name:\"line\",type:\"element\",value:\"\",attributes:{x1:r.toString(),y1:n.toString(),x2:i.toString(),y2:s.toString(),stroke:\"red\",\"stroke-width\":(0.02*Math.abs(e.a)).toString(),\"stroke-dasharray\":\"5,5\"},children:t.label?[{name:\"text\",type:\"element\",value:\"\",attributes:{x:o.toString(),y:(c-10).toString(),\"text-anchor\":\"middle\",\"font-size\":(0.2*Math.abs(e.a)).toString(),fill:\"red\"},children:[{type:\"text\",value:t.label,name:\"\",attributes:{},children:[]}]}]:[]}]}return[]}var o4=0.2/_r,RT=3/_r,Ml=[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"],$o=[\"A\",\"B\",\"C\",\"D\"];function OT({schematicSheet:t,transform:e,colorMap:r}){let n=Qf(t),i=r.schematic.sheet,s=r.schematic.net_name,o=[Yw({id:`${t.schematic_sheet_id}_outer`,center:n.center,width:n.width,height:n.height,transform:e,color:i}),Yw({id:`${t.schematic_sheet_id}_inner`,center:n.center,width:n.innerMaxX-n.innerMinX,height:n.innerMaxY-n.innerMinY,transform:e,color:i})];for(let c=1;c\u003cMl.length;c++){let l=n.innerMinX+(n.innerMaxX-n.innerMinX)*c/Ml.length;o.push(Cl({id:`${t.schematic_sheet_id}_top_column_${c}`,x1:l,y1:n.maxY,x2:l,y2:n.innerMaxY,transform:e,color:i}),Cl({id:`${t.schematic_sheet_id}_bottom_column_${c}`,x1:l,y1:n.minY,x2:l,y2:n.innerMinY,transform:e,color:i}))}for(let c=1;c\u003c$o.length;c++){let l=n.innerMinY+(n.innerMaxY-n.innerMinY)*c/$o.length;o.push(Cl({id:`${t.schematic_sheet_id}_left_row_${c}`,x1:n.minX,y1:l,x2:n.innerMinX,y2:l,transform:e,color:i}),Cl({id:`${t.schematic_sheet_id}_right_row_${c}`,x1:n.maxX,y1:l,x2:n.innerMaxX,y2:l,transform:e,color:i}))}return Ml.forEach((c,l)=\u003e{let a=n.innerMinX+(n.innerMaxX-n.innerMinX)*(l+0.5)/Ml.length;o.push(kl({text:c,x:a,y:(n.maxY+n.innerMaxY)/2,transform:e,color:s}),kl({text:c,x:a,y:(n.minY+n.innerMinY)/2,transform:e,color:s}))}),$o.forEach((c,l)=\u003e{let a=n.innerMinY+(n.innerMaxY-n.innerMinY)*($o.length-l-0.5)/$o.length;o.push(kl({text:c,x:(n.minX+n.innerMinX)/2,y:a,transform:e,color:s}),kl({text:c,x:(n.maxX+n.innerMaxX)/2,y:a,transform:e,color:s}))}),[{name:\"g\",type:\"element\",value:\"\",attributes:{class:\"schematic-sheet\",\"data-circuit-json-type\":\"schematic_sheet\",\"data-schematic-sheet-id\":t.schematic_sheet_id},children:o}]}function Yw({id:t,center:e,width:r,height:n,transform:i,color:s}){let o=O(i,e),c=Math.abs(i.a)*r,l=Math.abs(i.d)*n;return{name:\"rect\",type:\"element\",value:\"\",attributes:{class:\"sch-rect\",x:(o.x-c/2).toString(),y:(o.y-l/2).toString(),width:c.toString(),height:l.toString(),fill:\"none\",stroke:s,\"stroke-width\":(Math.abs(i.a)*o4).toString(),\"data-schematic-rect-id\":t},children:[]}}function Cl({id:t,x1:e,y1:r,x2:n,y2:i,transform:s,color:o}){let c=O(s,{x:e,y:r}),l=O(s,{x:n,y:i});return{name:\"line\",type:\"element\",value:\"\",attributes:{class:\"sch-line\",x1:c.x.toString(),y1:c.y.toString(),x2:l.x.toString(),y2:l.y.toString(),stroke:o,\"stroke-width\":(Math.abs(s.a)*o4).toString(),\"data-schematic-line-id\":t},children:[]}}function kl({text:t,x:e,y:r,transform:n,color:i}){let s=O(n,{x:e,y:r});return{type:\"element\",name:\"text\",value:\"\",attributes:{class:\"sch-text\",x:s.x.toString(),y:s.y.toString(),fill:i,\"text-anchor\":\"middle\",\"dominant-baseline\":\"middle\",\"font-family\":\"sans-serif\",\"font-size\":`${fe(n,\"reference_designator\",RT)}px`,transform:`rotate(0, ${s.x}, ${s.y})`},children:[{type:\"text\",value:t,name:\"\",attributes:{},children:[]}]}}var WT=({schematicTable:t,transform:e,colorMap:r,circuitJson:n})=\u003e{let{anchor_position:i,border_width:s=0.05,anchor:o=\"center\"}=t,{column_widths:c,row_heights:l}=Hw(t,n),a=c.reduce((k,I)=\u003ek+I,0),p=l.reduce((k,I)=\u003ek+I,0),{x:d,y:m}=i;if(o.includes(\"center\"))d-=a/2;else if(o.includes(\"right\"))d-=a;if(o.includes(\"center\"))m+=p/2;else if(o.includes(\"bottom\"))m+=p;let f=[],_=s*Math.abs(e.a),g=Gt(e),[y,S]=O(e,[d,m]),[P,b]=O(e,[d+a,m-p]);f.push({name:\"rect\",type:\"element\",attributes:{class:\"sch-table-border\",x:y.toString(),y:S.toString(),width:(P-y).toString(),height:(b-S).toString(),fill:\"none\",stroke:r.schematic.table,\"stroke-width\":_.toString()},children:[],value:\"\"});let C=n.filter((k)=\u003ek.type===\"schematic_table_cell\"\u0026\u0026k.schematic_table_id===t.schematic_table_id),L=d;for(let k=0;k\u003cc.length-1;k++){L+=c[k];let I=m;for(let j=0;j\u003cl.length;j++){let Q=I-l[j];if(!C.some((z)=\u003ez.start_column_index\u003c=k\u0026\u0026z.end_column_index\u003ek\u0026\u0026z.start_row_index\u003c=j\u0026\u0026z.end_row_index\u003e=j)){let z=O(e,{x:L,y:I}),N=O(e,{x:L,y:Q});f.push({name:\"line\",type:\"element\",attributes:{class:\"sch-table-grid-line\",x1:z.x.toString(),y1:z.y.toString(),x2:N.x.toString(),y2:N.y.toString(),stroke:r.schematic.table,\"stroke-width\":g.toString()},children:[],value:\"\"})}I=Q}}let B=m;for(let k=0;k\u003cl.length-1;k++){B-=l[k];let I=d;for(let j=0;j\u003cc.length;j++){let Q=I+c[j];if(!C.some((z)=\u003ez.start_row_index\u003c=k\u0026\u0026z.end_row_index\u003ek\u0026\u0026z.start_column_index\u003c=j\u0026\u0026z.end_column_index\u003e=j)){let z=O(e,{x:I,y:B}),N=O(e,{x:Q,y:B});f.push({name:\"line\",type:\"element\",attributes:{class:\"sch-table-grid-line\",x1:z.x.toString(),y1:z.y.toString(),x2:N.x.toString(),y2:N.y.toString(),stroke:r.schematic.table,\"stroke-width\":g.toString()},children:[],value:\"\"})}I=Q}}for(let k of C)if(k.text){let I=c.slice(k.start_column_index,k.end_column_index+1).reduce((G,H)=\u003eG+H,0),j=l.slice(k.start_row_index,k.end_row_index+1).reduce((G,H)=\u003eG+H,0),Q=d+c.slice(0,k.start_column_index).reduce((G,H)=\u003eG+H,0),lt=m-l.slice(0,k.start_row_index).reduce((G,H)=\u003eG+H,0),{cell_padding:z=0.2}=t,N=k.horizontal_align??\"center\",at=k.vertical_align??\"middle\",ot={x:Q+I/2,y:lt-j/2};if(N===\"left\")ot.x=Q+z;else if(N===\"right\")ot.x=Q+I-z;if(at===\"top\")ot.y=lt-z;else if(at===\"bottom\")ot.y=lt-j+z;let et=O(e,ot),D=fe(e,\"reference_designator\",k.font_size),it={left:\"start\",center:\"middle\",right:\"end\"},rt={top:\"hanging\",middle:\"middle\",bottom:\"ideographic\"};f.push({name:\"text\",type:\"element\",attributes:{class:\"sch-table-text\",x:et.x.toString(),y:et.y.toString(),\"font-size\":`${D}px`,\"text-anchor\":it[N],\"dominant-baseline\":rt[at],fill:r.schematic.table,\"font-family\":\"sans-serif\"},children:[{type:\"text\",value:k.text,name:\"\",attributes:{},children:[]}],value:\"\"})}return[{name:\"g\",type:\"element\",attributes:{class:\"sch-table\",\"data-schematic-table-id\":t.schematic_table_id},children:f,value:\"\"}]};function $T({trace:t,transform:e,colorMap:r}){let n=t.edges;if(n.length===0)return[];let i=[],s=[],o=\"\";for(let c=0;c\u003cn.length;c++){let l=n[c];if(l.is_crossing)continue;let[a,p]=O(e,[l.from.x,l.from.y]),[d,m]=O(e,[l.to.x,l.to.y]);if(c===0||n[c-1]?.is_crossing)o+=`M ${a} ${p} L ${d} ${m}`;else o+=` L ${d} ${m}`}if(o)i.push({name:\"path\",type:\"element\",attributes:{d:o,class:\"trace-invisible-hover-outline sch-trace-hitbox\",stroke:r.schematic.wire,fill:\"none\",\"stroke-width\":`${Gt(e)*8}px`,\"stroke-linecap\":\"round\",opacity:\"0\",\"stroke-linejoin\":\"round\"},value:\"\",children:[]}),i.push({name:\"path\",type:\"element\",attributes:{class:\"sch-trace-path\",d:o,stroke:r.schematic.wire,fill:\"none\",\"stroke-width\":`${Gt(e)}px`,\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\"},value:\"\",children:[]});for(let c of n){if(!c.is_crossing)continue;let[l,a]=O(e,[c.from.x,c.from.y]),[p,d]=O(e,[c.to.x,c.to.y]),m=(l+p)/2,f=(a+d)/2,_=p-l,g=d-a,y=Math.sqrt(_*_+g*g),S=y*0.7,P=-g/y*S,b=_/y*S,C=m+P,L=f-Math.abs(b);s.push({name:\"path\",type:\"element\",attributes:{class:\"trace-crossing-outline sch-trace-crossing-outline\",d:`M ${l} ${a} Q ${C} ${L} ${p} ${d}`,stroke:r.schematic.background,fill:\"none\",\"stroke-width\":`${Gt(e)*1.5}px`,\"stroke-linecap\":\"butt\"},value:\"\",children:[]}),s.push({name:\"path\",type:\"element\",attributes:{class:\"sch-trace-crossing-path\",d:`M ${l} ${a} Q ${C} ${L} ${p} ${d}`,stroke:r.schematic.wire,fill:\"none\",\"stroke-width\":`${Gt(e)}px`,\"stroke-linecap\":\"round\"},value:\"\",children:[]})}if(t.junctions)for(let c of t.junctions){let[l,a]=O(e,[c.x,c.y]);s.push({name:\"circle\",type:\"element\",attributes:{cx:l.toString(),cy:a.toString(),r:(Math.abs(e.a)*0.03).toString(),class:\"trace-junction sch-trace-junction\",fill:r.schematic.junction},value:\"\",children:[]})}return[{name:\"g\",type:\"element\",value:\"\",attributes:{class:\"trace sch-trace\",\"data-layer\":\"base\",\"data-circuit-json-type\":\"schematic_trace\",\"data-schematic-trace-id\":t.schematic_trace_id,...t.subcircuit_connectivity_map_key\u0026\u0026{\"data-subcircuit-connectivity-map-key\":t.subcircuit_connectivity_map_key}},children:i},{name:\"g\",type:\"element\",value:\"\",attributes:{class:\"trace-overlays sch-trace-overlays\",\"data-layer\":\"overlay\",\"data-circuit-json-type\":\"schematic_trace\",\"data-schematic-trace-id\":t.schematic_trace_id,...t.subcircuit_connectivity_map_key\u0026\u0026{\"data-subcircuit-connectivity-map-key\":t.subcircuit_connectivity_map_key}},children:s}]}function jT({probe:t,transform:e,colorMap:r,fallbackColor:n}){let[i,s]=O(e,[t.position.x,t.position.y]),o=t.color??n??r.schematic.reference,c=Math.abs(e.a)*0.6,l=Math.abs(e.a)*0.28,a=t.label_alignment??\"top_right\",p,d,m,f;switch(a){case\"top_left\":p=-135*Math.PI/180,d=\"end\",m=-8,f=-8;break;case\"top_center\":p=-90*Math.PI/180,d=\"middle\",m=0,f=-8;break;case\"top_right\":p=-45*Math.PI/180,d=\"start\",m=8,f=-8;break;case\"center_left\":p=180*Math.PI/180,d=\"end\",m=-8,f=0;break;case\"center\":p=-90*Math.PI/180,d=\"middle\",m=0,f=-8;break;case\"center_right\":p=0*Math.PI/180,d=\"start\",m=8,f=0;break;case\"bottom_left\":p=135*Math.PI/180,d=\"end\",m=-8,f=8;break;case\"bottom_center\":p=90*Math.PI/180,d=\"middle\",m=0,f=8;break;case\"bottom_right\":p=45*Math.PI/180,d=\"start\",m=8,f=8;break;default:p=-50*Math.PI/180,d=\"start\",m=8,f=0}let _=i+c*Math.cos(p),g=s+c*Math.sin(p),y=i,S=s,P=[`M ${_},${g}`,`L ${y},${S}`,`M ${y},${S}`,`L ${y-l*Math.cos((p*180/Math.PI+150)*Math.PI/180)},${S-l*Math.sin((p*180/Math.PI+150)*Math.PI/180)}`,`L ${y-l*Math.cos((p*180/Math.PI+210)*Math.PI/180)},${S-l*Math.sin((p*180/Math.PI+210)*Math.PI/180)}`,\"Z\"].join(\" \"),b=(_+m).toString(),C=(g+f).toString(),L=[];if(t.name\u0026\u0026t.voltage!==void 0)L.push({type:\"element\",name:\"tspan\",value:\"\",attributes:{x:b},children:[{type:\"text\",value:t.name,name:\"\",attributes:{},children:[]}]}),L.push({type:\"element\",name:\"tspan\",value:\"\",attributes:{x:b,dy:\"1.2em\"},children:[{type:\"text\",value:`${t.voltage}V`,name:\"\",attributes:{},children:[]}]});else{let B=[];if(t.name)B.push(t.name);if(t.voltage!==void 0)B.push(`${t.voltage}V`);L.push({type:\"text\",value:B.join(\" \"),name:\"\",attributes:{},children:[]})}return[{name:\"path\",type:\"element\",attributes:{class:\"sch-voltage-probe\",d:P,stroke:o,fill:o,\"stroke-width\":`${Gt(e)}px`},value:\"\",children:[]},{type:\"element\",name:\"text\",value:\"\",attributes:{class:\"sch-voltage-probe-label\",x:b,y:C,fill:o,\"text-anchor\":d,\"dominant-baseline\":\"middle\",\"font-family\":\"sans-serif\",\"font-size\":`${fe(e,\"reference_designator\")}px`,\"font-weight\":\"bold\",\"data-schematic-voltage-probe-id\":t.schematic_voltage_probe_id},children:L}]}var Xo=6,Nl=12,te=12,Li=6,Lw=14,Yl=11,Tw=280,XT=140,s4=(t)=\u003et.type===\"schematic_component_overlap_warning\"||t.type===\"schematic_component_styling_warning\"||t.type===\"schematic_element_outside_sheet_warning\"||t.type===\"schematic_manual_edit_conflict_warning\";function DT({circuitJson:t,transform:e,svgWidth:r,svgHeight:n,colorMap:i}){let s=i.schematic.erc_warning,o=[];return t.filter(s4).flatMap((c)=\u003e{let l=VT(c,t,e);if(!l)return[];let a=Math.max(1,r-te*2),p=qT(c.message,Math.max(12,Math.floor((Math.min(Tw,a)-Li*2)/(Yl*0.56)))),d=Math.max(...p.map((b)=\u003eb.length)),m=Math.min(Tw,a,Math.max(Math.min(XT,a),d*Yl*0.56+Li*2)),f=Li*2+p.length*Lw,_=HT({targetBounds:l,calloutWidth:m,calloutHeight:f,svgWidth:r,svgHeight:n,occupiedCalloutBounds:o});o.push(_);let g=ZT(c),y=Tl(l,Xo),S=QT(_,y);return[{name:\"g\",type:\"element\",value:\"\",attributes:{class:\"schematic-warning\",\"data-type\":c.type,\"data-warning-id\":g,role:\"note\",\"aria-label\":c.message},children:[{name:\"rect\",type:\"element\",value:\"\",attributes:{x:y.minX.toString(),y:y.minY.toString(),width:(y.maxX-y.minX).toString(),height:(y.maxY-y.minY).toString(),rx:\"6\",fill:\"none\",stroke:s,\"stroke-width\":\"1\",\"stroke-dasharray\":\"4,3\",\"data-warning-reference\":\"target\"},children:[]},{name:\"line\",type:\"element\",value:\"\",attributes:{x1:S.from.x.toString(),y1:S.from.y.toString(),x2:S.to.x.toString(),y2:S.to.y.toString(),stroke:s,\"stroke-width\":\"1\",\"data-warning-reference\":\"leader\"},children:[]},{name:\"rect\",type:\"element\",value:\"\",attributes:{x:_.minX.toString(),y:_.minY.toString(),width:m.toString(),height:f.toString(),fill:\"rgba(255, 250, 235, 0.97)\",stroke:s,\"stroke-width\":\"1\",\"data-warning-reference\":\"callout\"},children:[]},{name:\"text\",type:\"element\",value:\"\",attributes:{x:(_.minX+Li).toString(),y:(_.minY+Li+Yl).toString(),fill:\"#5c4300\",\"font-family\":\"sans-serif\",\"font-size\":Yl.toString()},children:p.map((b,C)=\u003e({name:\"tspan\",type:\"element\",value:\"\",attributes:{x:(_.minX+Li).toString(),dy:C===0?\"0\":Lw.toString()},children:[tE(b)]}))}]}]})}function VT(t,e,r){let i=zT(t).map((s)=\u003eUT(e,s)).filter((s)=\u003eBoolean(s)).map((s)=\u003eGT(s,r)).filter((s)=\u003eBoolean(s));if(i.length===0)return null;return i.reduce(JT)}function zT(t){switch(t.type){case\"schematic_component_overlap_warning\":return t.schematic_component_ids;case\"schematic_component_styling_warning\":return[t.schematic_component_id,...t.schematic_port_ids??[]];case\"schematic_manual_edit_conflict_warning\":return[t.schematic_component_id];case\"schematic_element_outside_sheet_warning\":return[t.schematic_element_id]}}function UT(t,e){return t.find((r)=\u003e{if(!r.type.startsWith(\"schematic_\"))return!1;let n=`${r.type}_id`;return r[n]===e})}function GT(t,e){if(t.type===\"schematic_component\"){let r=O(e,{x:t.center.x-t.size.width/2,y:t.center.y+t.size.height/2}),n=O(e,{x:t.center.x+t.size.width/2,y:t.center.y-t.size.height/2});return Uf([r,n])}if(t.type===\"schematic_port\"){let r=O(e,t.center);return Tl(Uf([r]),4)}if(t.type===\"schematic_net_label\"){let r=O(e,t.anchor_position??t.center),n=Math.max(28,t.text.length*8);return{minX:r.x-n/2,minY:r.y-10,maxX:r.x+n/2,maxY:r.y+10}}if(t.type===\"schematic_trace\"){let r=t.edges.flatMap((n)=\u003e[O(e,n.from),O(e,n.to)]);if(r.length===0)return null;return Tl(Uf(r),4)}return null}function HT({targetBounds:t,calloutWidth:e,calloutHeight:r,svgWidth:n,svgHeight:i,occupiedCalloutBounds:s}){let o=(t.minX+t.maxX)/2,c=(t.minY+t.maxY)/2,l=t.minY-Xo-Nl-r,a=t.maxY+Xo+Nl,p=t.minX-Xo-Nl-e,d=t.maxX+Xo+Nl,m=[];if(l\u003e=te)m.push(jo({x:Ti(o-e/2,te,n-te-e),y:l,width:e,height:r,side:\"top\"}));if(a+r\u003c=i-te)m.push(jo({x:Ti(o-e/2,te,n-te-e),y:a,width:e,height:r,side:\"bottom\"}));if(d+e\u003c=n-te)m.push(jo({x:d,y:Ti(c-r/2,te,i-te-r),width:e,height:r,side:\"right\"}));if(p\u003e=te)m.push(jo({x:p,y:Ti(c-r/2,te,i-te-r),width:e,height:r,side:\"left\"}));let f=m.find((_)=\u003es.every((g)=\u003e!KT(Tl(_,4),g)));if(f)return f;if(m[0])return m[0];return jo({x:Ti(o-e/2,te,n-te-e),y:Ti(l,te,i-te-r),width:e,height:r,side:\"top\"})}function QT(t,e){let r=(e.minX+e.maxX)/2,n=(e.minY+e.maxY)/2,i=(t.minX+t.maxX)/2,s=(t.minY+t.maxY)/2;switch(t.side){case\"top\":return{from:{x:i,y:t.maxY},to:{x:r,y:e.minY}};case\"bottom\":return{from:{x:i,y:t.minY},to:{x:r,y:e.maxY}};case\"left\":return{from:{x:t.maxX,y:s},to:{x:e.minX,y:n}};case\"right\":return{from:{x:t.minX,y:s},to:{x:e.maxX,y:n}}}}function ZT(t){switch(t.type){case\"schematic_component_overlap_warning\":return t.schematic_component_overlap_warning_id;case\"schematic_component_styling_warning\":return t.schematic_component_styling_warning_id;case\"schematic_element_outside_sheet_warning\":return t.schematic_element_outside_sheet_warning_id;case\"schematic_manual_edit_conflict_warning\":return t.schematic_manual_edit_conflict_warning_id}}function qT(t,e){let r=t.trim().split(/\\s+/),n=[],i=\"\";for(let s of r){let o=i?`${i} ${s}`:s;if(o.length\u003c=e||i.length===0){i=o;continue}n.push(i),i=s}if(i)n.push(i);return n.length\u003e0?n:[\"Warning\"]}function Uf(t){return{minX:Math.min(...t.map((e)=\u003ee.x)),minY:Math.min(...t.map((e)=\u003ee.y)),maxX:Math.max(...t.map((e)=\u003ee.x)),maxY:Math.max(...t.map((e)=\u003ee.y))}}function JT(t,e){return{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}function Tl(t,e){return{minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e}}function KT(t,e){return!(t.maxX\u003c=e.minX||t.minX\u003e=e.maxX||t.maxY\u003c=e.minY||t.minY\u003e=e.maxY)}function jo({x:t,y:e,width:r,height:n,side:i}){return{minX:t,minY:e,maxX:t+r,maxY:e+n,side:i}}function Ti(t,e,r){if(r\u003ce)return(e+r)/2;return Math.min(Math.max(t,e),r)}function tE(t){return{name:\"\",type:\"text\",value:t,attributes:{},children:[]}}function a4(t,e){let r=t.filter((V)=\u003eV.type===\"schematic_sheet\"),n=tT(r),i=n;if(e?.schematicSheetId!==void 0)i=r.find((V)=\u003eV.schematic_sheet_id===e.schematicSheetId)??n;else if(e?.schematicSheetIndex!==void 0)i=r.find((V)=\u003eV.sheet_index===e.schematicSheetIndex)??n;let s=i?t.filter((V)=\u003e!V.type.startsWith(\"schematic_\")||s4(V)||(\"schematic_sheet_id\"in V)\u0026\u0026V.schematic_sheet_id===i.schematic_sheet_id):t,o=mT(s),c=o.maxX-o.minX,l=o.maxY-o.minY,a=e?.width??1200,p=e?.height??600,d=e?.colorOverrides,m={...re,schematic:{...re.schematic,...d?.schematic??{}}},f=c/l,_=a/p,g;if(f\u003e_){let V=a/f;g={x:0,y:(p-V)/2}}else{let V=p*f;g={x:(a-V)/2,y:0}}let y=Vb([{x:o.minX,y:o.maxY},{x:o.maxX,y:o.maxY},{x:o.maxX,y:o.minY}],[{x:g.x,y:g.y},{x:a-g.x,y:g.y},{x:a-g.x,y:p-g.y}]),S=[];if(S.push({name:\"rect\",type:\"element\",attributes:{class:\"boundary\",x:\"0\",y:\"0\",width:a.toString(),height:p.toString()},children:[],value:\"\"}),e?.grid){let V=typeof e.grid===\"object\"?e.grid:{};S.push(JL({bounds:o,transform:y,...V}))}let P=[],b=[],C=[],L=[],B=[],k=[],I=[],j=[],Q=[],lt=[],z=[],N=[],at=[],ot=[],et=[],D=[],it=[],rt=eE({transform:y,svgWidth:a,svgHeight:p,schematicSheet:i}),G=Array.isArray(m.simulation_palette)?m.simulation_palette:Array.isArray(m.palette)?m.palette:[],H=0;for(let V of s)if(V.type===\"schematic_sheet\")D.push(...OT({schematicSheet:V,transform:y,colorMap:m}));else if(V.type===\"schematic_graphic\")it.push(uT({schematicGraphic:V,viewport:rE({availableViewport:rt,schematicGraphic:V,transform:y})}));else if(V.type===\"schematic_debug_object\")P.push(...ET({debugObject:V,transform:y}));else if(V.type===\"schematic_component\")b.push(...TT({component:V,transform:y,circuitJson:s,colorMap:m})),Q.push(...vT({component:V,transform:y,circuitJson:s}));else if(V.type===\"schematic_box\")I.push(...BT({schematicBox:V,transform:y,colorMap:m}));else if(V.type===\"schematic_trace\")C.push(...$T({trace:V,transform:y,colorMap:m}));else if(V.type===\"schematic_net_label\")L.push(...gT({schNetLabel:V,realToScreenTransform:y,colorMap:m}));else if(V.type===\"schematic_text\"\u0026\u0026!V.schematic_component_id)B.push(Zf({elm:V,transform:y,colorMap:m}));else if(V.type===\"schematic_voltage_probe\"){let ft=G.length\u003e0?G[H%G.length]:void 0;H+=1,k.push(...jT({probe:V,transform:y,colorMap:m,fallbackColor:ft}))}else if(V.type===\"schematic_table\")j.push(...WT({schematicTable:V,transform:y,colorMap:m,circuitJson:s}));else if(V.type===\"schematic_line\"){if(V.schematic_component_id)continue;z.push(...r4({schLine:V,transform:y,colorMap:m}))}else if(V.type===\"schematic_circle\"){if(V.schematic_component_id)continue;N.push(...Jw({schCircle:V,transform:y,colorMap:m}))}else if(V.type===\"schematic_rect\"){if(V.schematic_component_id)continue;at.push(...n4({schRect:V,transform:y,colorMap:m}))}else if(V.type===\"schematic_arc\"){if(V.schematic_component_id)continue;ot.push(...qw({schArc:V,transform:y,colorMap:m}))}else if(V.type===\"schematic_path\"){if(V.schematic_component_id)continue;et.push(...i4({schPath:V,transform:y,colorMap:m}))}else if(V.type===\"schematic_port\"){let ft=s.find((Pt)=\u003ePt.type===\"source_port\"\u0026\u0026Pt.source_port_id===V.source_port_id);if(ft?.type===\"source_port\"\u0026\u0026ft.do_not_connect===!0)lt.push(ST({schPort:V,transform:y,colorMap:m}));if(e?.drawPorts)lt.push(...wT({schPort:V,transform:y,circuitJson:s,colorMap:m}))}let J=C.filter((V)=\u003eV.attributes?.[\"data-layer\"]!==\"overlay\"),q=C.filter((V)=\u003eV.attributes?.[\"data-layer\"]===\"overlay\");if(S.push(...it,...P,...D,...J,...q,...z,...N,...at,...ot,...et,...b,...Q,...lt,...L,...B,...I,...k,...j),e?.labeledPoints)S.push(KL({points:e.labeledPoints,transform:y}));if(e?.shouldDrawWarnings)S.push(...DT({circuitJson:s,transform:y,svgWidth:a,svgHeight:p,colorMap:m}));let st=GL(t),bt=QL;if(e?.showErrorsInTextOverlay){let V=ZL(t);if(V)S.push(V)}let xt={name:\"svg\",type:\"element\",attributes:{xmlns:\"http://www.w3.org/2000/svg\",class:[\"tscircuit-schematic\",e?.className].filter(Boolean).join(\" \"),width:a.toString(),height:p.toString(),style:`background-color: ${m.schematic.background}`,\"data-real-to-screen-transform\":Xb(y),...st\u0026\u0026{\"data-software-used-string\":st},...e?.includeVersion\u0026\u0026{\"data-circuit-to-svg-version\":bt}},children:[{name:\"style\",type:\"element\",children:[{type:\"text\",value:`\n .boundary { fill: ${m.schematic.background}; }\n .schematic-boundary { fill: none; stroke: #fff; }\n .component { fill: none; stroke: ${m.schematic.component_outline}; }\n .chip { fill: ${m.schematic.component_body}; stroke: ${m.schematic.component_outline}; }\n .component-pin { fill: none; stroke: ${m.schematic.component_outline}; }\n .text { font-family: sans-serif; fill: ${m.schematic.wire}; }\n .pin-number { fill: ${m.schematic.pin_number}; }\n .port-label { fill: ${m.schematic.reference}; }\n .component-name { fill: ${m.schematic.reference}; }\n ${e?.css??\"\"}\n `,name:\"\",attributes:{},children:[]}],value:\"\",attributes:{}},...S],value:\"\"};return DL(xt)}function eE({transform:t,svgWidth:e,svgHeight:r,schematicSheet:n}){if(!n)return{x:0,y:0,width:e,height:r};let i=Qf(n),s=O(t,{x:i.innerMinX,y:i.innerMaxY}),o=O(t,{x:i.innerMaxX,y:i.innerMinY});return{x:Math.min(s.x,o.x),y:Math.min(s.y,o.y),width:Math.abs(o.x-s.x),height:Math.abs(o.y-s.y)}}function rE({availableViewport:t,schematicGraphic:e,transform:r}){if(e.width===void 0\u0026\u0026e.height===void 0)return t;let n=e.width===void 0?t.width:Ew(e.width*Math.hypot(r.a,r.b),t.width),i=e.height===void 0?t.height:Ew(e.height*Math.hypot(r.c,r.d),t.height);return{x:t.x+(t.width-n)/2,y:t.y+(t.height-i)/2,width:n,height:i}}function Ew(t,e){if(!Number.isFinite(t))return e;return Math.max(0,Math.min(t,e))}var qf=11;function c4(t,e=1){let r=12*e,n=26*e,i=t.left+r,s=t.right-r,o=t.top+r,c=t.bottom-r,l=[],a=Math.ceil(Math.max(t.right-t.left,t.bottom-t.top)/n);return(p)=\u003e{let d={x:Math.max(i,Math.min(s,p.x)),y:Math.max(o,Math.min(c,p.y))};for(let m=0;m\u003c=a;m++)for(let f=-m;f\u003c=m;f++)for(let _=-m;_\u003c=m;_++){if(Math.max(Math.abs(f),Math.abs(_))!==m)continue;let g={x:d.x+f*n,y:d.y+_*n};if(g.x\u003ci||g.x\u003es||g.y\u003co||g.y\u003ec)continue;if(l.some((y)=\u003eMath.hypot(y.x-g.x,y.y-g.y)\u003cn-0.000001*e))continue;return l.push(g),g}throw Error(\"Not enough room for issue markers; increase the schematic width or height\")}}function oE(t){return[...new Set(t.flatMap((r)=\u003er.type.startsWith(\"schematic_\")\u0026\u0026!r.type.endsWith(\"_warning\")\u0026\u0026!r.type.endsWith(\"_error\")\u0026\u0026r.type!==\"schematic_symbol\"\u0026\u0026!(r.type===\"schematic_group\"\u0026\u0026r.is_subcircuit\u0026\u0026!r.show_as_schematic_box)?[(\"schematic_sheet_id\"in r?r.schematic_sheet_id:void 0)??\"\"]:[]))].map((r)=\u003e{let n=t.find((i)=\u003ei.type===\"schematic_sheet\"\u0026\u0026i.schematic_sheet_id===r);return{id:r,name:n?.type===\"schematic_sheet\"?n.name||r:r||\"Unassigned sheet\"}})}var Jf=(t)=\u003et.replaceAll(\"\u0026\",\"\u0026amp;\").replaceAll(\"\u003c\",\"\u0026lt;\").replaceAll('\"',\"\u0026quot;\").replaceAll(\"\u003e\",\"\u0026gt;\"),zo=(t)=\u003ezt(t.schX,t.schY,t.width,t.height);function l4(t){let{circuitJson:e,analysis:r}=t,n=t.schematicSheetId??oE(e)[0]?.id??\"\",i=e.filter((N)=\u003e!N.type.startsWith(\"schematic_\")||N.type===\"schematic_symbol\"||((\"schematic_sheet_id\"in N?N.schematic_sheet_id:void 0)??\"\")===n),s=a4(i,{width:t.width??1400,height:t.height??900}),o=s.match(/data-real-to-screen-transform=\"matrix\\(([^)]+)\\)\"/);if(!o)throw Error(\"Schematic renderer did not provide its coordinate transform\");let c=o[1].split(/[\\s,]+/).map(Number);if(c.length!==6||c.some((N)=\u003e!Number.isFinite(N)))throw Error(\"Invalid schematic transform\");let[l,a,p,d,m,f]=c,_=(N,at)=\u003e({x:l*N+p*at+m,y:a*N+d*at+f}),g=[],y=[],S=(N)=\u003e{g.push(N);for(let at of[N.left,N.right])for(let ot of[N.bottom,N.top])y.push(_(at,ot))},P=r.getLineItems().filter((N)=\u003eN.lineItemType===\"SchematicBoxPlacement\"),b=new Set,C=r.getIssues().flatMap((N,at)=\u003e{if((Dr(N).schematicSheetId??\"\")!==n||t.issueTypes!==void 0\u0026\u0026!t.issueTypes.includes(N.lineItemType)||t.issueIndex!==void 0\u0026\u0026at!==t.issueIndex)return[];let ot=js({issues:[N],componentPlacements:P,circuitJson:e}),et=[],D,it=new Map,rt=(J,q=!1,st)=\u003e{S(J),D??={x:J.left,y:J.top};let bt=[q?\"context\":\"issue\",J.left,J.bottom,J.right,J.top].join(\":\");if(!q)it.set(bt,{x:J.left,y:J.top});if(b.has(bt))return;b.add(bt);let xt=st?` class=\"pin-label-collision-highlight\" data-highlight-schematic-port-id=\"${Jf(st.schematicPortId)}\" data-highlight-label=\"${Jf(st.text)}\"`:\"\",V=st?wy(st):J,ft=`\u003crect${xt} x=\"${V.left}\" y=\"${V.bottom}\" width=\"${V.right-V.left}\" height=\"${V.top-V.bottom}\" fill=\"${q?\"none\":\"#ef444433\"}\" stroke=\"${q?\"#2563eb\":\"#dc2626\"}\" stroke-width=\"${q?0.35:0.5}\" ${q?'stroke-dasharray=\"5 3\"':\"\"} vector-effect=\"non-scaling-stroke\" /\u003e`;et.push(ft)};for(let J of ot)rt(zo(J),!0);switch(D=void 0,N.lineItemType){case\"RailPathTooSpreadOut\":{S(N.pathBounds),D=N.pathPoints[0],et.push(`\u003cpolyline points=\"${N.pathPoints.map((J)=\u003e`${J.x},${J.y}`).join(\" \")}\" fill=\"none\" stroke=\"#dc2626\" stroke-width=\"3\" stroke-opacity=\"0.75\" vector-effect=\"non-scaling-stroke\" /\u003e`);break}case\"ComponentOverlap\":{let J=zo(N.firstComponent),q=zo(N.secondComponent);rt({left:Math.max(J.left,q.left),right:Math.min(J.right,q.right),top:Math.min(J.top,q.top),bottom:Math.max(J.bottom,q.bottom)});break}case\"NetLabelCollision\":for(let J of N.collisionBounds??[])rt(J);break;case\"SchematicTextCollision\":rt(N.textBounds),rt(N.collidingObjectBounds);break;case\"SchematicBoxInnerLabelOutOfBounds\":for(let J of N.overflowingLabels)rt(J.bounds,!1,J);break;case\"SchematicBoxInnerLabelCollision\":if(N.labelPairs?.length)for(let J of N.labelPairs)rt(J.firstLabel.bounds,!1,J.firstLabel),rt(J.secondLabel.bounds,!1,J.secondLabel);else for(let J of ot)rt(zo(J));break;case\"ComponentNetLabelCollision\":rt(N.overlappingLabel1Bounds),rt(N.overlappingLabel2Bounds);break;case\"ComponentBoxNetLabelCollision\":rt(N.boxBounds),rt(N.labelBounds);break;case\"VerboseSchematicNetLabel\":{D={x:N.schX,y:N.schY},S(zt(D.x,D.y,18/Math.abs(l),18/Math.abs(d))),et.push(`\u003ccircle cx=\"${D.x}\" cy=\"${D.y}\" r=\"${9/Math.abs(l)}\" fill=\"#ef444433\" stroke=\"#dc2626\" stroke-width=\"0.5\" vector-effect=\"non-scaling-stroke\" /\u003e`);break}case\"TraceCanBeSimplifiedByMovingComponent\":{if(N.suggestedTraces){let q=zt(N.newSchX,N.newSchY,N.targetComponent.width,N.targetComponent.height);S(q),et.push(`\u003crect x=\"${q.left}\" y=\"${q.bottom}\" width=\"${q.right-q.left}\" height=\"${q.top-q.bottom}\" fill=\"#16a34a22\" stroke=\"#16a34a\" stroke-width=\"1.5\" vector-effect=\"non-scaling-stroke\" /\u003e`);for(let st of N.suggestedTraces)for(let[bt,xt]of st.points.slice(1).entries()){let V=st.points[bt];S({left:Math.min(V.x,xt.x),right:Math.max(V.x,xt.x),bottom:Math.min(V.y,xt.y),top:Math.max(V.y,xt.y)}),et.push(`\u003cline x1=\"${V.x}\" y1=\"${V.y}\" x2=\"${xt.x}\" y2=\"${xt.y}\" stroke=\"#16a34a\" stroke-width=\"1.5\" vector-effect=\"non-scaling-stroke\" /\u003e`)}}let J=i.find((q)=\u003eq.type===\"schematic_trace\"\u0026\u0026q.schematic_trace_id===N.schematicTraceId);if(J?.type===\"schematic_trace\")for(let q of J.edges)S({left:Math.min(q.from.x,q.to.x),right:Math.max(q.from.x,q.to.x),bottom:Math.min(q.from.y,q.to.y),top:Math.max(q.from.y,q.to.y)}),D??=q.from,et.push(`\u003cline x1=\"${q.from.x}\" y1=\"${q.from.y}\" x2=\"${q.to.x}\" y2=\"${q.to.y}\" stroke=\"#dc2626\" stroke-width=\"0.5\" vector-effect=\"non-scaling-stroke\" /\u003e`);break}default:for(let J of ot)rt(zo(J))}D??=ot[0]?{x:ot[0].schX,y:ot[0].schY}:void 0;let G=(it.size?[...it.values()]:D?[D]:[]).map((J)=\u003e_(J.x,J.y)),H=Jf(`#${at+1} ${N.lineItemType}\n${r.schematicIssuesToString(N)}`);return[{index:at,points:G,title:H,geometry:`\u003ctitle\u003e${H}\u003c/title\u003e\u003cg transform=\"matrix(${c.join(\" \")})\"\u003e${et.join(\"\")}\u003c/g\u003e`,issueType:N.lineItemType}]}),L=s,B=1,k={left:0,top:0,right:t.width??1400,bottom:t.height??900};if(t.viewportBounds){y.length=0;for(let N of[t.viewportBounds.left,t.viewportBounds.right])for(let at of[t.viewportBounds.bottom,t.viewportBounds.top])y.push(_(N,at))}if(!t.showFullSchematic\u0026\u0026y.length\u003e0){let N=Math.min(...y.map((st)=\u003est.x)),at=Math.max(...y.map((st)=\u003est.x)),ot=Math.min(...y.map((st)=\u003est.y)),et=Math.max(...y.map((st)=\u003est.y)),D=t.viewportBounds?0:Math.max((at-N)/2,12),it=t.viewportBounds?0:Math.max((et-ot)/2,12),rt=at-N+D*2,G=et-ot+it*2;k={left:N-D,top:ot-it,right:at+D,bottom:et+it};let H=`${k.left} ${k.top} ${rt} ${G}`;L=s.replace(/^\u003csvg\\b[^\u003e]*\u003e/,(st)=\u003est.replace(/\\sviewBox=\"[^\"]*\"/,\"\").replace(/\u003e$/,` viewBox=\"${H}\"\u003e`)),B=Math.max(rt/(t.width??1400),G/(t.height??900));let J=(t.width??1400)*B,q=(t.height??900)*B;k={left:(N+at-J)/2,right:(N+at+J)/2,top:(ot+et-q)/2,bottom:(ot+et+q)/2}}let I=g.length?{left:Math.min(...g.map((N)=\u003eN.left)),right:Math.max(...g.map((N)=\u003eN.right)),top:Math.max(...g.map((N)=\u003eN.top)),bottom:Math.min(...g.map((N)=\u003eN.bottom))}:void 0;if(t.showOverlay===!1)return{svg:L,bounds:I};let j=c4(k,B),Q=[],lt=[],z=C.map(({index:N,points:at,title:ot,geometry:et,issueType:D})=\u003e{for(let it of at){let rt={x:it.x,y:it.y-(qf+1)*B},G=j(rt);if(G.x!==rt.x||G.y!==rt.y)Q.push(`\u003cline x1=\"${it.x}\" y1=\"${it.y}\" x2=\"${G.x}\" y2=\"${G.y}\" stroke=\"#b91c1c\" stroke-width=\"0.5\" /\u003e`);lt.push(`\u003cg data-issue-number=\"${N+1}\" data-issue-type=\"${D}\" transform=\"translate(${G.x} ${G.y}) scale(${B})\"\u003e\u003ctitle\u003e${ot}\u003c/title\u003e\u003ccircle r=\"${qf}\" fill=\"#b91c1c\" /\u003e\u003ctext y=\"4\" text-anchor=\"middle\" fill=\"white\" font-family=\"sans-serif\" font-size=\"11\"\u003e${N+1}\u003c/text\u003e\u003c/g\u003e`)}return t.showIssueGeometry===!1?\"\":`\u003cg data-issue-index=\"${N}\" data-issue-type=\"${D}\"\u003e${et}\u003c/g\u003e`});return{bounds:I,svg:L.replace(/\u003c\\/svg\u003e\\s*$/,`\u003cg class=\"placement-issue-overlays\"\u003e${z.join(`\n`)}${Q.join(`\n`)}${lt.join(`\n`)}\u003c/g\u003e\u003c/svg\u003e`)}}function p4(t,e,r=[]){let n=Math.max(20,Math.floor((e-(r.length?70:36))/10)),i=[],s=[],o=[...r],c=0,l;for(let f of t?t.split(`\n`):[]){if(f.startsWith(\"\u003cSchematicSheet \"))l=f.match(/\\bid=\"([^\"]*)\"/)?.[1];let _=o.findIndex((g)=\u003eg.text\u0026\u0026t.startsWith(g.text,c)\u0026\u0026(l===void 0||l===g.sheetId));if(_!==-1){let[g]=o.splice(_,1);s.push({number:g.number,lineIndex:i.length})}i.push(...aE(f,Math.min(96,n))),c+=f.length+1}let a=22,p=18,d=s.length?52:p,m=p*2+i.length*a;return[`\u003csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"${e}\" height=\"${m}\" viewBox=\"0 0 ${e} ${m}\"\u003e`,'\u003crect width=\"100%\" height=\"100%\" fill=\"#fff\" /\u003e',`\u003ctext x=\"${d}\" y=\"${p+a}\" fill=\"#d00\" font-family=\"Menlo, Consolas, monospace\" font-size=\"16\"\u003e`,...i.map((f,_)=\u003e`\u003ctspan x=\"${d}\" dy=\"${_===0?0:a}\"\u003e${sE(f)}\u003c/tspan\u003e`),\"\u003c/text\u003e\",...s.map(({number:f,lineIndex:_})=\u003e{let g=p+(_+1)*a-5;return`\u003cg data-listing-issue-number=\"${f}\"\u003e\u003ccircle cx=\"${p+6}\" cy=\"${g}\" r=\"11\" fill=\"#b91c1c\" /\u003e\u003ctext x=\"${p+6}\" y=\"${g}\" dy=\"0.35em\" text-anchor=\"middle\" font-family=\"sans-serif\" font-size=\"11\" fill=\"white\"\u003e${f}\u003c/text\u003e\u003c/g\u003e`}),\"\u003c/svg\u003e\"].join(`\n`)}function sE(t){return t.replaceAll(\"\u0026\",\"\u0026amp;\").replaceAll(\"\u003c\",\"\u0026lt;\").replaceAll(\"\u003e\",\"\u0026gt;\").replaceAll('\"',\"\u0026quot;\").replaceAll(\"'\",\"\u0026apos;\")}function aE(t,e){if(t.length\u003c=e)return[t];let r=[],n=t;while(n.length\u003ee){let i=n.lastIndexOf(\" \",e),s=i\u003e0?i:e;r.push(n.slice(0,s)),n=` ${n.slice(s).trimStart()}`}return r.push(n),r}function cE(t,e={}){let r=e.width??1400,n=e.height??900;if(!Number.isFinite(r)||r\u003c320||!Number.isFinite(n)||n\u003c=0)throw Error(\"Artifact width must be at least 320 and height must be positive (finite pixels)\");let i=e.analysis??Fh(t),s=i.getIssues();return i.getIssues(e).map((o)=\u003e{let c=s.indexOf(o),{schematicSheetId:l}=Dr(o),{svg:a,bounds:p}=l4({circuitJson:t,analysis:i,issueIndex:c,schematicSheetId:l??\"\",width:r,height:n}),d=i.schematicIssuesToString(o)||`\u003c${o.lineItemType} details=\"${Xl(JSON.stringify(o))}\" /\u003e`,m=r2([`\u003csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"${r}\" height=\"${n}\"\u003e${a}\u003c/svg\u003e`,p4(d,r)],{normalizeSize:!1,gap:0}).replace(/[ \\t]+$/gm,\"\");return{issueIndex:c,issue:o,schematicSheetId:l,bounds:p,descriptionXml:d,fileName:`issue-${String(c+1).padStart(4,\"0\")}-${o.lineItemType}.svg`,contentType:\"image/svg+xml\",content:m}})}export{Ih as SchematicPlacementAnalysis,Fh as analyzeSchematicPlacement,cE as createSchematicPlacementIssueArtifacts};\n","content_mimetype":"text/javascript","created_at":"2026-10-30T05:46:58.707Z"}; window.SSR_PACKAGE_BUILDS = []; window.SSR_RELATED_PACKAGES = [{"package_id":"b956dcd0-e37b-4022-a655-c93ee2f70790","creator_account_id":"9f398687-69d0-4ef4-a48c-bb6dc990e7df","latest_package_release_id":"05cd794e-886e-4afb-bce4-2057190a6e7b","last_built_release_id":"05cd794e-886e-4afb-bce4-2057190a6e7b","latest_package_release_fs_sha":"md5-02368e63f555bf5f853432c70765cb04","latest_pcb_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=05cd794e-886e-4afb-bce4-2057190a6e7b\u0026file_path=dist%2Findex%2Fpcb.svg","latest_sch_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=05cd794e-886e-4afb-bce4-2057190a6e7b\u0026file_path=dist%2Findex%2Fschematic.svg","latest_cad_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=05cd794e-886e-4afb-bce4-2057190a6e7b\u0026file_path=dist%2Findex%2F3d.png","latest_version":"0.1.5","license":"unset","owner_org_id":"f154d4e0-ac63-47a3-948e-a13da34df910","org_owner_tscircuit_handle":"seveibar","owner_github_username":"seveibar","github_repo_full_name":null,"is_source_from_github":false,"description":null,"name":"seveibar/am3352-dev-board-4layer-dogbone","unscoped_name":"am3352-dev-board-4layer-dogbone","star_count":0,"created_at":"2026-09-19T20:54:27.568Z","updated_at":"2026-09-21T23:56:14.470Z","ai_description":"Defines PCB footprints and pin mappings for a TI AM3352ZCZ100 processor, JST GH connectors, and assembly-part lookup helpers for capacitors, resistors, and headers.","ai_usage_instructions":null,"is_private":false,"is_unlisted":false,"is_public":true,"public_dist_enabled":false,"has_public_dist":true,"starred_at":null,"default_view":"files","website":null,"github_installation_id":null,"allow_pr_previews":false,"related_type":"same_author","thumbnail_url":"https://api.tscircuit.com/package_files/view?package_release_id=05cd794e-886e-4afb-bce4-2057190a6e7b\u0026file_path=dist%2Findex%2Fpcb.svg"},{"package_id":"37d3dd71-d7bb-4e34-8473-4e7de953f753","creator_account_id":"d8c33e0e-c5b9-42bf-a973-49b9132e4d39","latest_package_release_id":"77afff2e-4287-4faa-91c2-347ac418458b","last_built_release_id":"77afff2e-4287-4faa-91c2-347ac418458b","latest_package_release_fs_sha":"md5-ea65486bc390a58bf32350323fc6942d","latest_pcb_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=77afff2e-4287-4faa-91c2-347ac418458b\u0026file_path=dist%2Fassembly-reviewed%2Fpcb.svg","latest_sch_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=77afff2e-4287-4faa-91c2-347ac418458b\u0026file_path=dist%2Fassembly-reviewed%2Fschematic.svg","latest_cad_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=77afff2e-4287-4faa-91c2-347ac418458b\u0026file_path=dist%2Fcontroller%2F3d.png","latest_version":"0.1.0","license":"unset","owner_org_id":"a6bd85cf-cefd-4cb9-874e-ed21daca3f5d","org_owner_tscircuit_handle":"mohan-bee","owner_github_username":"mohan-bee","github_repo_full_name":null,"is_source_from_github":false,"description":null,"name":"mohan-bee/gimbal-one-budget-pcb","unscoped_name":"gimbal-one-budget-pcb","star_count":0,"created_at":"2026-10-22T07:24:04.021Z","updated_at":"2026-10-22T07:33:40.220Z","ai_description":"A 4-layer STM32-based gimbal controller PCB with an onboard LSM6DS3TR-C IMU, three DRV8313 3-phase motor drivers, protected 3S battery input, 3.3 V buck regulation, and SWD/UART control interfaces.","ai_usage_instructions":null,"is_private":false,"is_unlisted":false,"is_public":true,"public_dist_enabled":false,"has_public_dist":true,"starred_at":null,"default_view":"files","website":null,"github_installation_id":null,"allow_pr_previews":false,"related_type":"random","thumbnail_url":"https://api.tscircuit.com/package_files/view?package_release_id=77afff2e-4287-4faa-91c2-347ac418458b\u0026file_path=dist%2Fassembly-reviewed%2Fpcb.svg"}]; window.SSR_PACKAGE_ROUTE = {"author":"seveibar","packageName":"nema17-rp2040-stepper-controller","packageNameWithScope":"seveibar/nema17-rp2040-stepper-controller","version":null,"isLegacyRoute":false,"kind":"file","filePath":"vendor/schematic-style-analysis.js"};

seveibar/nema17-rp2040-stepper-controller

A tscircuit package created by seveibar.

Version
0.3.1
License
unset
Stars
0

vendor/schematic-style-analysis.js

// Official @tscircuit/circuit-json-schematic-placement-analysis latest browser bundle.
// Retrieved 2026-10-22 from https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/latest/dist/browser.js
// SHA256 (without this header): 1dbf67eb1325c53ce5804bd551a6c48995bd57a940cbd5a38a987567ee1261ef
// MIT licensed; see schematic-style-analysis.LICENSE.
var d4=Object.create;var{getPrototypeOf:m4,defineProperty:Rl,getOwnPropertyNames:u4}=Object;var Kf=Object.prototype.hasOwnProperty;function f4(t){return this[t]}var y4,_4,ae=(t,e,r)=>{var n=t!=null&&typeof t==="object";if(n){var i=e?y4??=new WeakMap:_4??=new WeakMap,s=i.get(t);if(s)return s}r=t!=null?d4(m4(t)):{};let o=e||!t||!t.__esModule||!Kf.call(t,"default")?Rl(r,"default",{value:t,enumerable:!0}):r;if(t&&typeof t==="object"||typeof t==="function"){for(let c of u4(t))if(!Kf.call(o,c))Rl(o,c,{get:f4.bind(t,c),enumerable:!0})}if(n)i.set(t,o);return o};var Go=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var g4=(t)=>t;function x4(t,e){this[t]=g4.bind(null,e)}var b4=(t,e)=>{for(var r in e)Rl(t,r,{get:e[r],enumerable:!0,configurable:!0,set:x4.bind(e,r)})};var ce=Go(function(Wl,$l){(function(t,e){typeof Wl==="object"&&typeof $l<"u"?$l.exports=e():typeof define==="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.svgson=e())})(Wl,function(){/*!
   * Determine if an object is a Buffer
   *
   * @author   Feross Aboukhadijeh <https://feross.org>
   * @license  MIT
   */var t=function(rt){return rt!=null&&(e(rt)||r(rt)||!!rt._isBuffer)};function e(rt){return!!rt.constructor&&typeof rt.constructor.isBuffer==="function"&&rt.constructor.isBuffer(rt)}function r(rt){return typeof rt.readFloatLE==="function"&&typeof rt.slice==="function"&&e(rt.slice(0,0))}var n=Object.prototype.toString,i=function(G){if(typeof G>"u")return"undefined";if(G===null)return"null";if(G===!0||G===!1||G instanceof Boolean)return"boolean";if(typeof G==="string"||G instanceof String)return"string";if(typeof G==="number"||G instanceof Number)return"number";if(typeof G==="function"||G instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(G))return"array";if(G instanceof RegExp)return"regexp";if(G instanceof Date)return"date";var H=n.call(G);if(H==="[object RegExp]")return"regexp";if(H==="[object Date]")return"date";if(H==="[object Arguments]")return"arguments";if(H==="[object Error]")return"error";if(t(G))return"buffer";if(H==="[object Set]")return"set";if(H==="[object WeakSet]")return"weakset";if(H==="[object Map]")return"map";if(H==="[object WeakMap]")return"weakmap";if(H==="[object Symbol]")return"symbol";if(H==="[object Int8Array]")return"int8array";if(H==="[object Uint8Array]")return"uint8array";if(H==="[object Uint8ClampedArray]")return"uint8clampedarray";if(H==="[object Int16Array]")return"int16array";if(H==="[object Uint16Array]")return"uint16array";if(H==="[object Int32Array]")return"int32array";if(H==="[object Uint32Array]")return"uint32array";if(H==="[object Float32Array]")return"float32array";if(H==="[object Float64Array]")return"float64array";return"object"};function s(rt,G){return G={exports:{}},rt(G,G.exports),G.exports}var o=s(function(rt){(function(){function G(H,J){if(typeof J!=="function")return H;var q={};for(var st in H)if(Object.prototype.hasOwnProperty.call(H,st))q[J(st,H[st])||st]=H[st];return q}if(rt.exports)rt.exports=G;else window.rename=G})()}),c=function rt(G,H){var J=i(G);if(J!=="object"&&J!=="array")throw Error("expected an object");var q=[];if(J==="object")G=o(G,H),q={};for(var st in G)if(G.hasOwnProperty(st)){var bt=G[st];if(i(bt)==="object"||i(bt)==="array")q[st]=rt(bt,H);else q[st]=bt}return q},l=s(function(rt){var G=Object.prototype.hasOwnProperty,H="~";function J(){}if(Object.create){if(J.prototype=Object.create(null),!new J().__proto__)H=!1}function q(bt,xt,V){this.fn=bt,this.context=xt,this.once=V||!1}function st(){this._events=new J,this._eventsCount=0}st.prototype.eventNames=function(){var xt=[],V,ft;if(this._eventsCount===0)return xt;for(ft in V=this._events)if(G.call(V,ft))xt.push(H?ft.slice(1):ft);if(Object.getOwnPropertySymbols)return xt.concat(Object.getOwnPropertySymbols(V));return xt},st.prototype.listeners=function(xt,V){var ft=H?H+xt:xt,Pt=this._events[ft];if(V)return!!Pt;if(!Pt)return[];if(Pt.fn)return[Pt.fn];for(var St=0,Xt=Pt.length,At=Array(Xt);St<Xt;St++)At[St]=Pt[St].fn;return At},st.prototype.emit=function(xt,V,ft,Pt,St,Xt){var At=H?H+xt:xt;if(!this._events[At])return!1;var _t=this._events[At],jt=arguments.length,qt,Bt;if(_t.fn){if(_t.once)this.removeListener(xt,_t.fn,void 0,!0);switch(jt){case 1:return _t.fn.call(_t.context),!0;case 2:return _t.fn.call(_t.context,V),!0;case 3:return _t.fn.call(_t.context,V,ft),!0;case 4:return _t.fn.call(_t.context,V,ft,Pt),!0;case 5:return _t.fn.call(_t.context,V,ft,Pt,St),!0;case 6:return _t.fn.call(_t.context,V,ft,Pt,St,Xt),!0}for(Bt=1,qt=Array(jt-1);Bt<jt;Bt++)qt[Bt-1]=arguments[Bt];_t.fn.apply(_t.context,qt)}else{var Te=_t.length,ye;for(Bt=0;Bt<Te;Bt++){if(_t[Bt].once)this.removeListener(xt,_t[Bt].fn,void 0,!0);switch(jt){case 1:_t[Bt].fn.call(_t[Bt].context);break;case 2:_t[Bt].fn.call(_t[Bt].context,V);break;case 3:_t[Bt].fn.call(_t[Bt].context,V,ft);break;case 4:_t[Bt].fn.call(_t[Bt].context,V,ft,Pt);break;default:if(!qt)for(ye=1,qt=Array(jt-1);ye<jt;ye++)qt[ye-1]=arguments[ye];_t[Bt].fn.apply(_t[Bt].context,qt)}}}return!0},st.prototype.on=function(xt,V,ft){var Pt=new q(V,ft||this),St=H?H+xt:xt;if(!this._events[St])this._events[St]=Pt,this._eventsCount++;else if(!this._events[St].fn)this._events[St].push(Pt);else this._events[St]=[this._events[St],Pt];return this},st.prototype.once=function(xt,V,ft){var Pt=new q(V,ft||this,!0),St=H?H+xt:xt;if(!this._events[St])this._events[St]=Pt,this._eventsCount++;else if(!this._events[St].fn)this._events[St].push(Pt);else this._events[St]=[this._events[St],Pt];return this},st.prototype.removeListener=function(xt,V,ft,Pt){var St=H?H+xt:xt;if(!this._events[St])return this;if(!V){if(--this._eventsCount===0)this._events=new J;else delete this._events[St];return this}var Xt=this._events[St];if(Xt.fn){if(Xt.fn===V&&(!Pt||Xt.once)&&(!ft||Xt.context===ft))if(--this._eventsCount===0)this._events=new J;else delete this._events[St]}else{for(var At=0,_t=[],jt=Xt.length;At<jt;At++)if(Xt[At].fn!==V||Pt&&!Xt[At].once||ft&&Xt[At].context!==ft)_t.push(Xt[At]);if(_t.length)this._events[St]=_t.length===1?_t[0]:_t;else if(--this._eventsCount===0)this._events=new J;else delete this._events[St]}return this},st.prototype.removeAllListeners=function(xt){var V;if(xt){if(V=H?H+xt:xt,this._events[V])if(--this._eventsCount===0)this._events=new J;else delete this._events[V]}else this._events=new J,this._eventsCount=0;return this},st.prototype.off=st.prototype.removeListener,st.prototype.addListener=st.prototype.on,st.prototype.setMaxListeners=function(){return this},st.prefixed=H,st.EventEmitter=st,rt.exports=st});function a(rt,G,H){if(G in rt)Object.defineProperty(rt,G,{value:H,enumerable:!0,configurable:!0,writable:!0});else rt[G]=H;return rt}var p=function(){},d={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},m={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},f={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},_={" ":m.space,"\t":m.space,"\n":m.space,"\r":m.space,"<":m.lt,">":m.gt,'"':m.quote,"'":m.quote,"=":m.equal,"/":m.slash},g=function(G){return _[G]||m.char},y=function(G){var H,J,q,st,bt,xt,V,ft,Pt,St;G=Object.assign({debug:!1},G);var Xt=new l,At=d.data,_t="",jt="",qt="",Bt="",Te="",ye="",Dt=function(gr,Ee){if(jt[0]==="?"||jt[0]==="!")return;var Uo={type:gr,value:Ee};if(G.debug)console.log("emit:",Uo);Xt.emit("data",Uo)};Xt.stateMachine=(St={},a(St,d.data,(H={},a(H,m.lt,function(){if(_t.trim())Dt(f.text,_t);jt="",Te=!1,At=d.tagBegin}),a(H,m.char,function(Nt){_t+=Nt}),H)),a(St,d.cdata,a({},m.char,function(Nt){if(_t+=Nt,_t.substr(-3)==="]]>")Dt(f.text,_t.slice(0,-3)),_t="",At=d.data})),a(St,d.tagBegin,(J={},a(J,m.space,p),a(J,m.char,function(Nt){jt=Nt,At=d.tagName}),a(J,m.slash,function(){jt="",Te=!0}),J)),a(St,d.tagName,(q={},a(q,m.space,function(){if(Te)At=d.tagEnd;else At=d.attributeNameStart,Dt(f.openTag,jt)}),a(q,m.gt,function(){if(Te)Dt(f.closeTag,jt);else Dt(f.openTag,jt);_t="",At=d.data}),a(q,m.slash,function(){At=d.tagEnd,Dt(f.openTag,jt)}),a(q,m.char,function(Nt){if(jt+=Nt,jt==="![CDATA[")At=d.cdata,_t="",jt=""}),q)),a(St,d.tagEnd,(st={},a(st,m.gt,function(){Dt(f.closeTag,jt),_t="",At=d.data}),a(st,m.char,p),st)),a(St,d.attributeNameStart,(bt={},a(bt,m.char,function(Nt){qt=Nt,At=d.attributeName}),a(bt,m.gt,function(){_t="",At=d.data}),a(bt,m.space,p),a(bt,m.slash,function(){Te=!0,At=d.tagEnd}),bt)),a(St,d.attributeName,(xt={},a(xt,m.space,function(){At=d.attributeNameEnd}),a(xt,m.equal,function(){Dt(f.attributeName,qt),At=d.attributeValueBegin}),a(xt,m.gt,function(){Bt="",Dt(f.attributeName,qt),Dt(f.attributeValue,Bt),_t="",At=d.data}),a(xt,m.slash,function(){Te=!0,Bt="",Dt(f.attributeName,qt),Dt(f.attributeValue,Bt),At=d.tagEnd}),a(xt,m.char,function(Nt){qt+=Nt}),xt)),a(St,d.attributeNameEnd,(V={},a(V,m.space,p),a(V,m.equal,function(){Dt(f.attributeName,qt),At=d.attributeValueBegin}),a(V,m.gt,function(){Bt="",Dt(f.attributeName,qt),Dt(f.attributeValue,Bt),_t="",At=d.data}),a(V,m.char,function(Nt){Bt="",Dt(f.attributeName,qt),Dt(f.attributeValue,Bt),qt=Nt,At=d.attributeName}),V)),a(St,d.attributeValueBegin,(ft={},a(ft,m.space,p),a(ft,m.quote,function(Nt){ye=Nt,Bt="",At=d.attributeValue}),a(ft,m.gt,function(){Bt="",Dt(f.attributeValue,Bt),_t="",At=d.data}),a(ft,m.char,function(Nt){ye="",Bt=Nt,At=d.attributeValue}),ft)),a(St,d.attributeValue,(Pt={},a(Pt,m.space,function(Nt){if(ye)Bt+=Nt;else Dt(f.attributeValue,Bt),At=d.attributeNameStart}),a(Pt,m.quote,function(Nt){if(ye===Nt)Dt(f.attributeValue,Bt),At=d.attributeNameStart;else Bt+=Nt}),a(Pt,m.gt,function(Nt){if(ye)Bt+=Nt;else Dt(f.attributeValue,Bt),_t="",At=d.data}),a(Pt,m.slash,function(Nt){if(ye)Bt+=Nt;else Dt(f.attributeValue,Bt),Te=!0,At=d.tagEnd}),a(Pt,m.char,function(Nt){Bt+=Nt}),Pt)),St);var h4=function(gr){if(G.debug)console.log(At,gr);var Ee=Xt.stateMachine[At],Uo=Ee[g(gr)]||Ee[m.error]||Ee[m.char];Uo(gr)};return Xt.write=function(Nt){var gr=Nt.length;for(var Ee=0;Ee<gr;Ee++)h4(Nt[Ee])},Xt},S={State:d,Action:m,Type:f,create:y},P=S.Type,b={element:"element",text:"text"},C=function(G){return Object.assign({name:"",type:b.element,value:"",parent:null,attributes:{},children:[]},G)},L=function(G){G=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},G);var H=void 0,J=void 0,q=void 0,st=void 0,bt=new l,xt=function(ft){switch(ft.type){case P.openTag:if(q===null)q=J,q.name=ft.value;else{var Pt=C({name:ft.value,parent:q});q.children.push(Pt),q=Pt}break;case P.closeTag:var St=q.parent;if(!G.parentNodes)q.parent=null;if(q.name!==ft.value)break;if(G.stream&&St===J)J.children=[],q.parent=null;if(!G.emitTopLevelOnly||St===J)bt.emit(G.tagPrefix+q.name,q),bt.emit("tag",q.name,q);if(q===J)H.removeAllListeners("data"),bt.emit(G.doneEvent,q),J=null;q=St;break;case P.text:if(q)q.children.push(C({type:b.text,value:ft.value,parent:G.parentNodes?q:null}));break;case P.attributeName:st=ft.value,q.attributes[st]="";break;case P.attributeValue:q.attributes[st]=ft.value;break}};return bt.reset=function(){H=S.create({debug:G.debug}),H.on("data",xt),J=C(),q=null,st="",bt.parse=H.write},bt.reset(),bt},B=function(G,H){H=Object.assign({},H,{stream:!1,tagPrefix:":"});var J=L(H),q=void 0;return J.on("done",function(st){q=st}),J.parse(G),q},k={parseSync:B,create:L,NodeType:b},I=k.parseSync,j=function(G){var H=I("<root>".concat(G,"</root>"),{parentNodes:!1}),J=H.children&&H.children.length>0&&H.children.every(function(q){return q.name==="svg"});if(J)return H.children.length===1?H.children[0]:H.children;else throw Error("nothing to parse")},Q=function(G){return c(G,function(H){if(!z(H))return lt(H);return H})},lt=function(G){return G.replace(/[-|:]([a-z])/gi,function(H,J){return J.toUpperCase()})},z=function(G){return/^(data|aria)(-\w+)/.test(G)},N=function(G){if(G){var H=String(G);return/[&<>]/.test(H)?"<![CDATA[".concat(H.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):H}return""},at=function(G){return String(G).replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},ot=function(G){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=H.transformNode,q=J===void 0?function(V){return V}:J,st=H.camelcase,bt=st===void 0?!1:st,xt=function(ft){var Pt=q(ft);if(bt)Pt=Q(Pt);return Pt};return xt(j(G))};function et(){for(var rt=arguments.length,G=Array(rt),H=0;H<rt;H++)G[H]=arguments[H];return new Promise(function(J,q){try{var st=ot.apply(void 0,G);J(st)}catch(bt){q(bt)}})}var D=function rt(G){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=H.transformAttr,q=J===void 0?function(At,_t,jt){return"".concat(At,'="').concat(jt(_t),'"')}:J,st=H.transformNode,bt=st===void 0?function(At){return At}:st,xt=H.selfClose,V=xt===void 0?!0:xt;if(Array.isArray(G))return G.map(function(At){return rt(At,{transformAttr:q,selfClose:V,transformNode:bt})}).join("");var ft=bt(G);if(ft.type==="text")return N(ft.value);var Pt="";for(var St in ft.attributes){var Xt=q(St,ft.attributes[St],at,ft.name);Pt+=Xt?" ".concat(Xt):""}return ft.children&&ft.children.length>0||!V?"<".concat(ft.name).concat(Pt,">").concat(rt(ft.children,{transformAttr:q,transformNode:bt,selfClose:V}),"</").concat(ft.name,">"):"<".concat(ft.name).concat(Pt,"/>")},it=Object.assign({},{parse:et,parseSync:ot,stringify:D});return it})});var o2=Go(function(krt,i2){var fi=1000,yi=fi*60,_i=yi*60,Vr=_i*24,eP=Vr*7,rP=Vr*365.25;i2.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return nP(t);else if(r==="number"&&isFinite(t))return e.long?oP(t):iP(t);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function nP(t){if(t=String(t),t.length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*rP;case"weeks":case"week":case"w":return r*eP;case"days":case"day":case"d":return r*Vr;case"hours":case"hour":case"hrs":case"hr":case"h":return r*_i;case"minutes":case"minute":case"mins":case"min":case"m":return r*yi;case"seconds":case"second":case"secs":case"sec":case"s":return r*fi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}function iP(t){var e=Math.abs(t);if(e>=Vr)return Math.round(t/Vr)+"d";if(e>=_i)return Math.round(t/_i)+"h";if(e>=yi)return Math.round(t/yi)+"m";if(e>=fi)return Math.round(t/fi)+"s";return t+"ms"}function oP(t){var e=Math.abs(t);if(e>=Vr)return Xs(t,e,Vr,"day");if(e>=_i)return Xs(t,e,_i,"hour");if(e>=yi)return Xs(t,e,yi,"minute");if(e>=fi)return Xs(t,e,fi,"second");return t+" ms"}function Xs(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var a2=Go(function(Nrt,s2){function sP(t){r.debug=r,r.default=r,r.coerce=l,r.disable=o,r.enable=i,r.enabled=c,r.humanize=o2(),r.destroy=a,Object.keys(t).forEach((p)=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let d=0;for(let m=0;m<p.length;m++)d=(d<<5)-d+p.charCodeAt(m),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(p){let d,m=null,f,_;function g(...y){if(!g.enabled)return;let S=g,P=Number(new Date),b=P-(d||P);if(S.diff=b,S.prev=d,S.curr=P,d=P,y[0]=r.coerce(y[0]),typeof y[0]!=="string")y.unshift("%O");let C=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(B,k)=>{if(B==="%%")return"%";C++;let I=r.formatters[k];if(typeof I==="function"){let j=y[C];B=I.call(S,j),y.splice(C,1),C--}return B}),r.formatArgs.call(S,y),(S.log||r.log).apply(S,y)}if(g.namespace=p,g.useColors=r.useColors(),g.color=r.selectColor(p),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(m!==null)return m;if(f!==r.namespaces)f=r.namespaces,_=r.enabled(p);return _},set:(y)=>{m=y}}),typeof r.init==="function")r.init(g);return g}function n(p,d){let m=r(this.namespace+(typeof d>"u"?":":d)+p);return m.log=this.log,m}function i(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let d=(typeof p==="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let m of d)if(m[0]==="-")r.skips.push(m.slice(1));else r.names.push(m)}function s(p,d){let m=0,f=0,_=-1,g=0;while(m<p.length)if(f<d.length&&(d[f]===p[m]||d[f]==="*"))if(d[f]==="*")_=f,g=m,f++;else m++,f++;else if(_!==-1)f=_+1,g++,m=g;else return!1;while(f<d.length&&d[f]==="*")f++;return f===d.length}function o(){let p=[...r.names,...r.skips.map((d)=>"-"+d)].join(",");return r.enable(""),p}function c(p){for(let d of r.skips)if(s(p,d))return!1;for(let d of r.names)if(s(p,d))return!0;return!1}function l(p){if(p instanceof Error)return p.stack||p.message;return p}function a(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}s2.exports=sP});var c2=Go(function(Mh,Ds){Mh.formatArgs=cP;Mh.save=lP;Mh.load=pP;Mh.useColors=aP;Mh.storage=hP();Mh.destroy=(()=>{let t=!1;return()=>{if(!t)t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();Mh.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function aP(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function cP(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ds.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(i)=>{if(i==="%%")return;if(r++,i==="%c")n=r}),t.splice(n,0,e)}Mh.log=console.debug||console.log||(()=>{});function lP(t){try{if(t)Mh.storage.setItem("debug",t);else Mh.storage.removeItem("debug")}catch(e){}}function pP(){let t;try{t=Mh.storage.getItem("debug")||Mh.storage.getItem("DEBUG")}catch(e){}if(!t&&typeof process<"u"&&"env"in process)t=process.env.DEBUG;return t}function hP(){try{return localStorage}catch(t){}}Ds.exports=a2()(Mh);var{formatters:dP}=Ds.exports;dP.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ei={};b4(ei,{all_layers:()=>K_,any_circuit_element:()=>$b,any_soup_element:()=>ti,any_source_component:()=>V_,asset:()=>_o,base_circuit_json_error:()=>Mt,battery_capacity:()=>u_,brep_shape:()=>Hp,cadModelDefaultDirectionMap:()=>w3,cad_cable:()=>nb,cad_collision_error:()=>rb,cad_component:()=>eb,cad_model_axis_directions:()=>tb,cad_model_formats:()=>S3,cad_reference_surface:()=>ob,capacitance:()=>_p,circle_shape:()=>gp,circuit_json_footprint_load_error:()=>Px,current:()=>hr,distance:()=>R,duration_ms:()=>Jn,experiment_type:()=>db,external_footprint_load_error:()=>Ax,frequency:()=>kr,getRotationBetweenPcbPin1Locations:()=>Q5,getSimulationReturnCurrentGridJsonSchema:()=>I3,getZodPrefixedIdWithDefault:()=>T,inductance:()=>d_,insertionDirectionToCanonical:()=>G0,insertionDirectionToVector:()=>G5,insertion_direction:()=>H0,kicadAt:()=>As,kicadEffects:()=>f_,kicadFont:()=>bp,kicadFootprintAttributes:()=>__,kicadFootprintMetadata:()=>b_,kicadFootprintModel:()=>x_,kicadFootprintPad:()=>g_,kicadFootprintProperties:()=>y_,kicadProperty:()=>fo,kicadSymbolEffects:()=>w_,kicadSymbolMetadata:()=>P_,kicadSymbolPinNames:()=>S_,kicadSymbolPinNumbers:()=>v_,kicadSymbolProperties:()=>A_,kicadSymbolProperty:()=>pr,layer_ref:()=>gt,layer_string:()=>hp,length:()=>K,manufacturing_drc_properties:()=>q0,ms:()=>Qt,ninePointAnchor:()=>Ve,parseAndConvertSiUnit:()=>se,pcbRenderLayer:()=>V5,pcb_autorouting_error:()=>Ix,pcb_bend:()=>Rg,pcb_board:()=>Eg,pcb_breakout_point:()=>Lx,pcb_bus_length_skew_error:()=>Pg,pcb_bus_routing_constraint_error:()=>Fg,pcb_bus_routing_constraint_warning:()=>Mg,pcb_component:()=>J0,pcb_component_invalid_layer_error:()=>Vx,pcb_component_missing_courtyard_warning:()=>kx,pcb_component_not_on_board_edge_error:()=>Dx,pcb_component_outside_board_error:()=>Xx,pcb_connector_not_in_accessible_orientation_warning:()=>Cx,pcb_copper_pour:()=>jx,pcb_copper_pour_brep:()=>Wx,pcb_copper_pour_polygon:()=>$x,pcb_copper_pour_rect:()=>Ox,pcb_copper_text:()=>qg,pcb_courtyard_circle:()=>Jx,pcb_courtyard_outline:()=>Zx,pcb_courtyard_overlap_error:()=>ux,pcb_courtyard_pill:()=>Kx,pcb_courtyard_polygon:()=>qx,pcb_courtyard_rect:()=>Qx,pcb_cutout:()=>Sx,pcb_cutout_circle:()=>xx,pcb_cutout_path:()=>vx,pcb_cutout_polygon:()=>bx,pcb_cutout_rect:()=>gx,pcb_debug_line:()=>tg,pcb_debug_object:()=>rg,pcb_debug_object_base:()=>Is,pcb_debug_point:()=>eg,pcb_debug_rect:()=>K0,pcb_fabrication_note_dimension:()=>ax,pcb_fabrication_note_path:()=>ox,pcb_fabrication_note_rect:()=>sx,pcb_fabrication_note_text:()=>ix,pcb_fabricator_extra_charge_warning:()=>Yx,pcb_footprint_overlap_error:()=>mx,pcb_ground_plane:()=>Tx,pcb_ground_plane_region:()=>Ex,pcb_group:()=>Bx,pcb_hole:()=>lg,pcb_hole_circle_or_square_shape:()=>K5,pcb_hole_circle_shape:()=>q5,pcb_hole_oval_shape:()=>t3,pcb_hole_pill_shape:()=>e3,pcb_hole_rect_shape:()=>J5,pcb_hole_rotated_pill_shape:()=>r3,pcb_keepout:()=>yx,pcb_keepout_outline:()=>fx,pcb_keepout_overlap_warning:()=>_x,pcb_manual_edit_conflict_warning:()=>Mx,pcb_missing_footprint_error:()=>wx,pcb_net:()=>Lg,pcb_note_dimension:()=>dx,pcb_note_line:()=>hx,pcb_note_path:()=>px,pcb_note_rect:()=>lx,pcb_note_text:()=>cx,pcb_packing_error:()=>zg,pcb_pad_pad_clearance_error:()=>Gx,pcb_pad_trace_clearance_error:()=>Hx,pcb_panel:()=>Dg,pcb_panelization_placement_error:()=>Ug,pcb_pin1_location:()=>mp,pcb_placement_error:()=>Vg,pcb_plated_hole:()=>pg,pcb_port:()=>hg,pcb_port_not_connected_error:()=>Yg,pcb_port_not_matched_error:()=>Ng,pcb_preflight_routing_error:()=>Fx,pcb_route_hint:()=>Q0,pcb_route_hints:()=>Z5,pcb_silkscreen_circle:()=>Kg,pcb_silkscreen_graphic:()=>rx,pcb_silkscreen_graphic_brep:()=>ex,pcb_silkscreen_line:()=>Hg,pcb_silkscreen_oval:()=>tx,pcb_silkscreen_path:()=>Qg,pcb_silkscreen_pill:()=>nx,pcb_silkscreen_rect:()=>Jg,pcb_silkscreen_text:()=>Zg,pcb_smtpad:()=>mg,pcb_smtpad_pill:()=>dg,pcb_solder_paste:()=>ug,pcb_soldermask_opening:()=>fg,pcb_stiffener:()=>Xg,pcb_stiffener_polygon:()=>jg,pcb_stiffener_rect:()=>$g,pcb_text:()=>yg,pcb_thermal_spoke:()=>Rx,pcb_trace:()=>vg,pcb_trace_error:()=>Cg,pcb_trace_hint:()=>Gg,pcb_trace_missing_error:()=>kg,pcb_trace_route_point:()=>bg,pcb_trace_route_point_through_pad:()=>xg,pcb_trace_route_point_via:()=>gg,pcb_trace_route_point_wire:()=>_g,pcb_trace_style_warning:()=>wg,pcb_trace_too_long_error:()=>Ag,pcb_trace_too_long_warning:()=>Bg,pcb_trace_too_many_vias_warning:()=>Ig,pcb_trace_warning:()=>Sg,pcb_via:()=>Tg,pcb_via_clearance_error:()=>zx,pcb_via_trace_clearance_error:()=>Ux,point:()=>nt,point3:()=>ge,point_with_bulge:()=>U0,polygon_shape:()=>yo,port_arrangement:()=>y0,position:()=>$5,position3:()=>j5,rect_shape:()=>ws,resistance:()=>vs,ring:()=>dp,rotated_rect_shape:()=>xp,rotation:()=>Et,route_hint_point:()=>Z0,schematic_arc:()=>S0,schematic_box:()=>h0,schematic_circle:()=>v0,schematic_component:()=>_0,schematic_component_overlap_warning:()=>T0,schematic_component_port_arrangement_by_sides:()=>f0,schematic_component_port_arrangement_by_size:()=>u0,schematic_component_styling_warning:()=>E0,schematic_debug_line:()=>C0,schematic_debug_object:()=>N0,schematic_debug_object_base:()=>Bs,schematic_debug_point:()=>k0,schematic_debug_rect:()=>M0,schematic_element_outside_sheet_warning:()=>O0,schematic_error:()=>I0,schematic_graphic:()=>W0,schematic_group:()=>$0,schematic_layout_error:()=>F0,schematic_line:()=>x0,schematic_manual_edit_conflict_warning:()=>L0,schematic_missing_sheet_warning:()=>z0,schematic_net_label:()=>B0,schematic_path:()=>d0,schematic_pin_styles:()=>m0,schematic_port:()=>P0,schematic_rect:()=>b0,schematic_sheet:()=>V0,schematic_sheet_size:()=>D0,schematic_sheet_styling_warning:()=>R0,schematic_symbol:()=>g0,schematic_table:()=>j0,schematic_table_cell:()=>X0,schematic_text:()=>A0,schematic_text_part:()=>Gp,schematic_trace:()=>w0,schematic_voltage_probe:()=>Y0,simulation_ac_current_source:()=>pb,simulation_ac_sweep_current_graph:()=>Ib,simulation_ac_sweep_voltage_graph:()=>Bb,simulation_ac_voltage_source:()=>ab,simulation_complex_sample:()=>Jp,simulation_current_probe:()=>xb,simulation_current_source:()=>hb,simulation_dc_current_source:()=>lb,simulation_dc_operating_point_current:()=>wb,simulation_dc_operating_point_voltage:()=>Sb,simulation_dc_sweep_current_graph:()=>Pb,simulation_dc_sweep_unit:()=>Ms,simulation_dc_sweep_voltage_graph:()=>Ab,simulation_dc_voltage_source:()=>sb,simulation_experiment:()=>ub,simulation_op_amp:()=>Fb,simulation_oscilloscope_trace:()=>Cb,simulation_parameter_sweep:()=>vb,simulation_parameter_sweep_coordinate:()=>ze,simulation_parameter_type:()=>B3,simulation_parameter_unit:()=>qp,simulation_pcb_return_current_field:()=>Eb,simulation_pcb_return_current_heatmap:()=>Ob,simulation_pcb_return_current_marker:()=>Wb,simulation_pcb_return_current_result:()=>Nb,simulation_return_current_contact:()=>fp,simulation_return_current_excitation:()=>kb,simulation_return_current_field_asset:()=>Lb,simulation_return_current_grid_json:()=>Rb,simulation_return_current_image_asset:()=>Tb,simulation_spice_subcircuit:()=>Mb,simulation_switch:()=>_b,simulation_terminal_port:()=>yp,simulation_transient_current_graph:()=>yb,simulation_transient_voltage_graph:()=>fb,simulation_unknown_experiment_error:()=>bb,simulation_voltage_probe:()=>gb,simulation_voltage_source:()=>cb,size:()=>Ss,source_ambiguous_port_reference:()=>q_,source_board:()=>Z_,source_bus:()=>l0,source_component_availability_warning:()=>Vp,source_component_base:()=>Tt,source_component_internal_connection:()=>U_,source_component_misconfigured_error:()=>Up,source_component_pins_underspecified_warning:()=>i0,source_confusing_net_name_warning:()=>c0,source_failed_to_create_component_error:()=>W_,source_group:()=>H_,source_i2c_misconfigured_error:()=>zp,source_interconnect:()=>X_,source_invalid_component_property_error:()=>Wp,source_manually_placed_via:()=>t0,source_missing_manufacturer_part_number_warning:()=>Xp,source_missing_property_error:()=>O_,source_motor:()=>C_,source_net:()=>Q_,source_no_ground_pin_defined_warning:()=>n0,source_no_power_pin_defined_warning:()=>r0,source_part_not_found_warning:()=>a0,source_pcb_ground_plane:()=>J_,source_pin_attributes:()=>L_,source_pin_missing_trace_warning:()=>jp,source_pin_must_be_connected_error:()=>o0,source_port:()=>z_,source_printed_part:()=>F_,source_project_metadata:()=>Op,source_property_ignored_warning:()=>$_,source_refdes_convention_warning:()=>Dp,source_runtime_error:()=>p0,source_simple_ammeter:()=>Y_,source_simple_battery:()=>Bp,source_simple_capacitor:()=>vp,source_simple_chip:()=>Ap,source_simple_connector:()=>R_,source_simple_connector_standards:()=>E_,source_simple_crystal:()=>T_,source_simple_current_source:()=>k_,source_simple_diode:()=>Ps,source_simple_fiducial:()=>B_,source_simple_fuse:()=>N_,source_simple_ground:()=>I_,source_simple_inductor:()=>Ip,source_simple_led:()=>wp,source_simple_mosfet:()=>Tp,source_simple_op_amp:()=>Ep,source_simple_pin_header:()=>Cp,source_simple_pinout:()=>kp,source_simple_potentiometer:()=>Mp,source_simple_power_source:()=>Pp,source_simple_push_button:()=>Fp,source_simple_resistor:()=>Sp,source_simple_resonator:()=>Np,source_simple_switch:()=>Rp,source_simple_test_point:()=>Lp,source_simple_transistor:()=>Yp,source_simple_voltage_probe:()=>j_,source_simple_voltage_source:()=>D_,source_subassembly:()=>M_,source_trace:()=>G_,source_trace_not_connected_error:()=>$p,source_unnamed_trace_warning:()=>e0,spice_simulation_options:()=>mb,standard_shape:()=>X5,supplier_footprint_mismatch_warning:()=>Nx,supplier_name:()=>Kn,time:()=>W5,timestamp:()=>m_,unknown_error_finding_part:()=>s0,visible_layer:()=>Ut,voltage:()=>xe,wave_shape:()=>Zp});var ty={"0":"M0.301025 0.257813 L0.206593 0.283385 L0.122042 0.361307 L0.075923 0.474441 L0.064942 0.642221 L0.091296 0.78289 L0.159376 0.899463 L0.257104 0.961214 L0.344948 0.961214 L0.442678 0.899463 L0.510757 0.78289 L0.537111 0.642221 L0.526131 0.474441 L0.480012 0.361307 L0.39546 0.283385 L0.301025 0.257813","1":"M0.220426 0.40845 L0.381626 0.270996 L0.381626 0.948966","2":"M0.110409 0.39212 L0.125621 0.342293 L0.170571 0.295823 L0.244237 0.26431 L0.291518 0.257813 L0.373319 0.263799 L0.434683 0.290705 L0.468239 0.331966 L0.480292 0.379913 L0.479492 0.411806 L0.465088 0.465192 L0.402571 0.568988 L0.245134 0.766438 L0.07959 0.948045 L0.522462 0.948045","3":"M0.081606 0.345073 L0.119154 0.315633 L0.178996 0.284091 L0.255265 0.257813 L0.349133 0.263062 L0.43127 0.289348 L0.48994 0.336662 L0.525141 0.394491 L0.513407 0.457577 L0.466472 0.504892 L0.384334 0.541692 L0.290464 0.56272 L0.20833 0.573235 L0.290464 0.583749 L0.384334 0.610035 L0.466472 0.652092 L0.519274 0.709922 L0.531007 0.773007 L0.50754 0.841351 L0.454738 0.899179 L0.3726 0.946494 L0.310412 0.961214 L0.209503 0.959111 L0.127367 0.946494 L0.071046 0.929671","4":"M0.418494 0.270996 L0.048828 0.724199 L0.553224 0.724199 M0.414181 0.578167 L0.414181 0.94897","5":"M0.074951 0.270996 L0.074951 0.614701 L0.267655 0.5695 L0.405247 0.586502 L0.460002 0.617189 L0.498028 0.660731 L0.527101 0.779401 L0.513352 0.841049 L0.477274 0.889568 L0.406378 0.93463 L0.324445 0.958337 L0.247399 0.962139 L0.182516 0.949767 L0.130068 0.925508 L0.074951 0.875607 M0.074951 0.270996 L0.527101 0.270996","6":"M0.428549 0.257813 L0.341433 0.285053 L0.26073 0.312099 L0.192188 0.360182 L0.138902 0.410969 L0.098219 0.500422 L0.070249 0.584267 L0.067264 0.670716 L0.065164 0.756863 L0.087163 0.820973 L0.108168 0.861042 L0.157916 0.913131 L0.210981 0.948192 L0.29279 0.961214 L0.384548 0.956206 L0.456409 0.924151 L0.507262 0.881077 L0.5349 0.821975 L0.537111 0.771889 L0.521634 0.718798 L0.498418 0.67372 L0.463042 0.636657 L0.414398 0.613617 L0.34696 0.598591 L0.28284 0.595587 L0.215403 0.605604 L0.145756 0.641665 L0.109274 0.678729 L0.064942 0.724006","7":"M0.071534 0.270996 L0.530519 0.270996 L0.495935 0.291702 L0.477752 0.305407 L0.435186 0.346112 L0.412067 0.374136 L0.388565 0.40796 L0.365315 0.448098 L0.342943 0.495062 L0.322081 0.549366 L0.303364 0.611524 L0.287416 0.68205 L0.270077 0.80465 L0.26253 0.94897","8":"M0.286761 0.257813 L0.210684 0.27162 L0.1414 0.305622 L0.092494 0.382125 L0.111513 0.450128 L0.16857 0.502193 L0.228345 0.539382 L0.377781 0.594635 L0.470161 0.645637 L0.52586 0.706203 L0.538087 0.792269 L0.506841 0.87621 L0.438915 0.927212 L0.339743 0.961214 L0.263666 0.959089 L0.174004 0.929337 L0.102003 0.881523 L0.063965 0.811395 L0.066682 0.741266 L0.102003 0.671139 L0.180797 0.608448 L0.259591 0.580822 L0.358762 0.548945 L0.456576 0.49688 L0.486463 0.446941 L0.487822 0.362999 L0.453859 0.302434 L0.384574 0.265245 L0.286761 0.257813","9":"M0.511026 0.437812 L0.491026 0.347812 L0.451026 0.297812 L0.391026 0.267812 L0.311026 0.257813 L0.231026 0.267812 L0.161026 0.297812 L0.111026 0.347812 L0.091026 0.417812 L0.111026 0.487812 L0.161026 0.537812 L0.231026 0.567812 L0.311026 0.577812 L0.391026 0.557812 L0.451026 0.517812 L0.491026 0.477812 L0.511026 0.437812 M0.510026 0.438812 L0.434026 0.636812 L0.381026 0.777812 L0.337026 0.879812 L0.301026 0.957812","!":"M0.301026 0.270996 L0.301026 0.749566 M0.251466 0.94897 L0.350587 0.94897",'"':"M0.16504 0.270996 L0.16504 0.523022 M0.437013 0.270996 L0.437013 0.523022","#":"M0.20958 0.282227 L0.146515 0.949754 M0.461844 0.282227 L0.398779 0.949754 M0.032999 0.526969 L0.600587 0.452796 M0.001465 0.82366 L0.569055 0.749486",$:"M0.307121 0.240234 L0.307121 1.083502 M0.490031 0.415915 L0.404676 0.328075 L0.23396 0.310507 L0.136407 0.398347 L0.099828 0.521324 L0.124213 0.591596 L0.197379 0.644299 L0.429061 0.697003 L0.502224 0.749708 L0.526613 0.837547 L0.477836 0.960526 L0.355897 1.013228 L0.197379 0.99566 L0.112021 0.942957 L0.07544 0.837547","'":"M0.301026 0.270996 L0.301026 0.523022","(":"M0.413087 0.241211 L0.372337 0.28347 L0.331589 0.334184 L0.290838 0.393349 L0.25009 0.460965 L0.219528 0.528584 L0.199153 0.5962 L0.188966 0.655364 L0.199153 0.714529 L0.219528 0.782146 L0.25009 0.849764 L0.290838 0.91738 L0.331589 0.976544 L0.372337 1.027258 L0.413087 1.069491",")":"M0.188966 0.241211 L0.229716 0.28347 L0.270466 0.334184 L0.311213 0.393349 L0.351964 0.460965 L0.382526 0.528584 L0.4029 0.5962 L0.413087 0.655364 L0.4029 0.714529 L0.382526 0.782146 L0.351964 0.849764 L0.311213 0.91738 L0.270466 0.976544 L0.229716 1.027258 L0.188966 1.069491","*":"M0.301026 0.458702 L0.301026 0.681942 M0.301026 0.458702 L0.520997 0.536834 M0.301026 0.458702 L0.439954 0.257813 M0.301026 0.458702 L0.162098 0.257813 M0.301026 0.458702 L0.081055 0.536834","+":"M0.042969 0.66845 L0.559083 0.66845 M0.301023 0.428223 L0.301023 0.908661",",":"M0.38672 0.852051 L0.215333 1.030661 L0.301025 1.119971","-":"M0.173829 0.686035 L0.428224 0.686035",".":"M0.362549 0.851074 L0.239503 0.851074","/":"M0.062501 1.035249 L0.539551 0.270996","<":"M0.559083 0.441895 L0.042969 0.66939 L0.042969 0.66939 L0.559083 0.896902","=":"M0.042969 0.545898 L0.559083 0.545898 M0.042969 0.80837 L0.559083 0.80837",">":"M0.042969 0.441895 L0.559083 0.66939 L0.559083 0.66939 L0.042969 0.896902",A:"M0.018067 0.94897 L0.290179 0.270996 L0.583986 0.94897 M0.155303 0.684521 L0.433548 0.684521",B:"M0.063965 0.94897 L0.063965 0.278953 L0.209356 0.270996 L0.342486 0.294394 L0.432179 0.37292 L0.418224 0.48773 L0.312686 0.549166 L0.084728 0.575531 L0.306377 0.589434 L0.468877 0.647456 L0.538087 0.736658 L0.5324 0.85202 L0.501247 0.902983 L0.42355 0.944398 L0.063965 0.94897",C:"M0.529054 0.419847 L0.498425 0.345196 L0.442238 0.292341 L0.33583 0.257813 L0.257199 0.268357 L0.187906 0.303748 L0.120243 0.385432 L0.072998 0.599844 L0.110073 0.815385 L0.165381 0.902183 L0.222883 0.942801 L0.334904 0.961214 L0.43253 0.937679 L0.504816 0.868999 L0.529054 0.772065",D:"M0.064454 0.94897 L0.071838 0.285078 L0.171217 0.270996 L0.247348 0.272633 L0.37101 0.306078 L0.462461 0.378304 L0.514748 0.475555 L0.535591 0.576392 L0.537599 0.652313 L0.528065 0.717381 L0.508562 0.772419 L0.445948 0.855695 L0.362356 0.90871 L0.225203 0.945862 L0.064454 0.94897",E:"M0.080078 0.270996 L0.080078 0.94897 M0.080078 0.270996 L0.521974 0.270996 M0.080078 0.609981 L0.389405 0.609981 M0.080078 0.94897 L0.521974 0.94897",F:"M0.086426 0.270996 L0.086426 0.94897 M0.091304 0.275607 L0.515626 0.275607 M0.091304 0.607677 L0.447344 0.607677",G:"M0.498034 0.284943 L0.374621 0.257813 L0.244219 0.268648 L0.160577 0.311997 L0.094556 0.398116 L0.056397 0.58404 L0.076752 0.785532 L0.120865 0.858197 L0.188947 0.916734 L0.271008 0.953591 L0.357069 0.961214 L0.43715 0.932047 L0.501262 0.858539 L0.545656 0.648611 L0.329595 0.648131",H:"M0.066895 0.270996 L0.066895 0.94897 M0.066895 0.595658 L0.530009 0.595658 M0.535157 0.270996 L0.535157 0.94897",I:"M0.301026 0.270996 L0.301026 0.94897",J:"M0.506839 0.270996 L0.507814 0.782193 L0.498468 0.846168 L0.480733 0.880789 L0.455864 0.90832 L0.426095 0.929408 L0.360746 0.954812 L0.302508 0.962139 L0.223573 0.953638 L0.16538 0.930312 L0.137072 0.907715 L0.116428 0.880312 L0.102822 0.848819 L0.095633 0.813947 L0.094239 0.776413",K:"M0.035401 0.270996 L0.035401 0.94897 M0.502258 0.316194 L0.035401 0.687823 M0.212484 0.582361 L0.566652 0.933903",L:"M0.07544 0.270996 L0.07544 0.94897 L0.526613 0.94897",M:"M0.042481 0.94897 L0.042481 0.270996 L0.301027 0.712492 L0.559571 0.270996 L0.559571 0.94897",N:"M0.067871 0.94897 L0.067871 0.270996 L0.534181 0.94897 L0.525031 0.270996",O:"M0.287293 0.961214 L0.19843 0.933567 L0.1172 0.849451 L0.057129 0.563945 L0.114348 0.350255 L0.18455 0.289392 L0.306101 0.257813 L0.42054 0.29572 L0.487543 0.365003 L0.544923 0.625294 L0.516366 0.789624 L0.465476 0.884596 L0.375084 0.949287 L0.287293 0.961214",P:"M0.070557 0.94897 L0.070557 0.28379 L0.20704 0.270996 L0.329134 0.278993 L0.408525 0.300514 L0.444022 0.317908 L0.500637 0.368929 L0.525796 0.423728 L0.531496 0.50384 L0.508934 0.554205 L0.473724 0.582043 L0.417577 0.604365 L0.336375 0.620372 L0.226014 0.629268 L0.082368 0.630258",Q:"M0.282435 1.050813 L0.195447 1.019646 L0.115933 0.924817 L0.057129 0.602943 L0.113139 0.362034 L0.18186 0.293418 L0.300844 0.257813 L0.412868 0.300553 L0.478457 0.37866 L0.534625 0.672103 L0.506671 0.857367 L0.456855 0.964437 L0.368371 1.037368 L0.282435 1.050813 M0.341225 0.815559 L0.544923 1.070653",R:"M0.034912 0.944112 L0.034912 0.288556 L0.227127 0.270996 L0.362038 0.276867 L0.443423 0.294907 L0.477644 0.309614 L0.505809 0.328757 L0.526616 0.352817 L0.544963 0.418061 L0.543241 0.475921 L0.524463 0.517817 L0.49076 0.546518 L0.444265 0.564799 L0.355195 0.578739 L0.047653 0.589627 M0.303054 0.617306 L0.56714 0.94897",S:"M0.483037 0.364333 L0.407613 0.267477 L0.22883 0.257813 L0.128623 0.327565 L0.087712 0.455539 L0.104656 0.518727 L0.168054 0.573307 L0.41928 0.617318 L0.503796 0.669342 L0.535157 0.759324 L0.493846 0.900055 L0.367668 0.961214 L0.205436 0.956661 L0.116711 0.907038 L0.066895 0.790334",T:"M0.022949 0.270996 L0.579103 0.270996 M0.309284 0.270996 L0.309284 0.94897",U:"M0.072022 0.270996 L0.07308 0.648875 L0.080372 0.75167 L0.099024 0.827813 L0.134786 0.885729 L0.181571 0.924023 L0.251464 0.95168 L0.339655 0.962139 L0.401553 0.951668 L0.45232 0.924086 L0.482701 0.891771 L0.495745 0.870529 L0.515699 0.81637 L0.525014 0.744626 L0.530031 0.272017",V:"M0.027832 0.270996 L0.320083 0.94897 L0.57422 0.270996",W:"M0 0.270996 L0.079799 0.940377 L0.285198 0.472884 L0.505255 0.94897 L0.602052 0.270996",X:"M0.009034 0.270996 L0.586805 0.94897 M0.593019 0.270996 L0.015246 0.94897",Y:"M0.018067 0.270996 L0.293132 0.574135 M0.583986 0.271959 L0.294954 0.57606 L0.305277 0.94897",Z:"M0.053711 0.270996 L0.548341 0.270996 L0.053711 0.94897 L0.548341 0.94897","[":"M0.404542 0.240234 L0.197511 0.240234 L0.197511 1.069424 L0.404542 1.069424","\\":"M0.062501 0.270996 L0.539551 1.035249","]":"M0.19751 0.240234 L0.404542 0.240234 L0.404542 1.069424 L0.19751 1.069424","^":"M0.035156 0.523931 L0.301024 0.270996 L0.566896 0.523931",_:"M0 1.160601 L0.602052 1.160601",a:"M0.527101 0.439941 L0.527101 0.973965 M0.527101 0.553824 L0.451366 0.477535 L0.376759 0.439941 L0.263722 0.439941 L0.187989 0.477535 L0.112255 0.553824 L0.074951 0.66881 L0.074951 0.745099 L0.112255 0.85898 L0.187989 0.93527 L0.263722 0.973965 L0.376759 0.973965 L0.451366 0.93527 L0.527101 0.85898",b:"M0.07666 0.240234 L0.07666 0.959985 M0.07666 0.582737 L0.151822 0.514237 L0.225865 0.480483 L0.338045 0.480483 L0.413211 0.514237 L0.488374 0.582737 L0.525392 0.685983 L0.525392 0.754485 L0.488374 0.856739 L0.413211 0.92524 L0.338045 0.959985 L0.225865 0.959985 L0.151822 0.92524 L0.07666 0.856739",c:"M0.512452 0.553823 L0.441624 0.477535 L0.371854 0.439941 L0.26614 0.439941 L0.195312 0.477535 L0.124486 0.553823 L0.0896 0.668808 L0.0896 0.745099 L0.124486 0.858979 L0.195312 0.93527 L0.26614 0.973965 L0.371854 0.973965 L0.441624 0.93527 L0.512452 0.858979",d:"M0.525392 0.240234 L0.525392 0.959985 M0.525392 0.582737 L0.450232 0.514237 L0.376189 0.480483 L0.264006 0.480483 L0.188844 0.514237 L0.11368 0.582737 L0.076661 0.685983 L0.076661 0.754485 L0.11368 0.856739 L0.188844 0.92524 L0.264006 0.959985 L0.376189 0.959985 L0.450232 0.92524 L0.525392 0.856739",e:"M0.059571 0.668808 L0.542482 0.668808 M0.542482 0.592521 L0.502641 0.516231 L0.461594 0.477535 L0.381914 0.439941 L0.261186 0.439941 L0.180299 0.477535 L0.099412 0.553823 L0.059571 0.668808 L0.059571 0.745099 L0.099412 0.858979 L0.180299 0.93527 L0.261186 0.973965 L0.381914 0.973965 L0.461594 0.93527 L0.542482 0.858979",f:"M0.512941 0.240234 L0.406984 0.240234 L0.301026 0.274346 L0.248047 0.374731 L0.248047 0.946817 M0.089112 0.476088 L0.459965 0.476088",g:"M0.525392 0.439941 L0.525392 0.989395 L0.488373 1.091918 L0.45023 1.126757 L0.376189 1.160601 L0.264004 1.160601 L0.188844 1.126757 L0.113681 1.058075 L0.076661 0.954555 M0.525392 0.542467 L0.45023 0.473786 L0.376189 0.439941 L0.264004 0.439941 L0.188844 0.473786 L0.113681 0.542467 L0.076661 0.645988 L0.076661 0.714669 L0.113681 0.817193 L0.188844 0.885875 L0.264004 0.920713 L0.376189 0.920713 L0.45023 0.885875 L0.525392 0.817193",h:"M0.092041 0.240234 L0.092041 0.946817 M0.092041 0.61058 L0.205937 0.509225 L0.282214 0.476086 L0.396109 0.476086 L0.47187 0.509225 L0.510011 0.61058 L0.510011 0.946817",i:"M0.261026 0.240234 L0.341026 0.240234 M0.300978 0.476089 L0.300978 0.946817",j:"M0.3853 0.240234 L0.447023 0.240234 M0.416159 0.465708 L0.416159 1.011689 L0.383887 1.108586 L0.252832 1.140264 L0.15503 1.108586",k:"M0.065186 0.240234 L0.065186 0.946817 M0.493824 0.476086 L0.065186 0.812323 M0.236758 0.677829 L0.536867 0.946817",l:"M0.301026 0.234863 L0.301026 0.946441",m:"M0.050538 0.439941 L0.050538 0.960796 M0.050538 0.588758 L0.114405 0.476607 L0.157178 0.439941 L0.236864 0.439941 L0.279637 0.476607 L0.32241 0.588758 L0.32241 0.960796 M0.32241 0.588758 L0.386281 0.476607 L0.428467 0.439941 L0.50874 0.439941 L0.551515 0.476607 L0.551515 0.960796",n:"M0.092041 0.439941 L0.092041 0.960796 M0.092041 0.588758 L0.205936 0.476607 L0.282216 0.439941 L0.396113 0.439941 L0.471871 0.476607 L0.510011 0.588758 L0.510011 0.960796",o:"M0.247175 0.439941 L0.175178 0.477535 L0.103186 0.553823 L0.066895 0.668808 L0.066895 0.745099 L0.103186 0.858979 L0.175178 0.93527 L0.247175 0.973965 L0.354874 0.973965 L0.426872 0.93527 L0.498866 0.858979 L0.535157 0.745099 L0.535157 0.668808 L0.498866 0.553823 L0.426872 0.477535 L0.354874 0.439941 L0.247175 0.439941",p:"M0.076904 0.439941 L0.076904 1.154244 M0.076904 0.541563 L0.151986 0.473487 L0.225944 0.439941 L0.338005 0.439941 L0.413087 0.473487 L0.488166 0.541563 L0.525148 0.644169 L0.525148 0.712246 L0.488166 0.813866 L0.413087 0.881942 L0.338005 0.916471 L0.225944 0.916471 L0.151986 0.881942 L0.076904 0.813866",q:"M0.525148 0.441895 L0.525148 1.156195 M0.525148 0.5435 L0.450067 0.47544 L0.376106 0.441895 L0.264042 0.441895 L0.188966 0.47544 L0.113885 0.5435 L0.076905 0.646108 L0.076905 0.714187 L0.113885 0.815809 L0.188966 0.883886 L0.264042 0.918418 L0.376106 0.918418 L0.450067 0.883886 L0.525148 0.815809",r:"M0.107422 0.439941 L0.107422 0.960796 M0.107422 0.663164 L0.155824 0.551014 L0.252626 0.476607 L0.349428 0.439941 L0.49463 0.439941",s:"M0.475556 0.477535 L0.400757 0.439941 L0.276092 0.439941 L0.176361 0.477535 L0.101563 0.553823 L0.101563 0.630112 L0.176361 0.668808 L0.301024 0.668808 L0.425688 0.745099 L0.50049 0.821387 L0.50049 0.897677 L0.425688 0.93527 L0.325956 0.973965 L0.201295 0.973965 L0.126496 0.93527 L0.101563 0.858979",t:"M0.246032 0.297852 L0.246032 0.826549 L0.301023 0.919323 L0.411011 0.950848 L0.520997 0.950848 M0.081055 0.515799 L0.466004 0.515799",u:"M0.092041 0.454102 L0.092041 0.826134 L0.13018 0.937211 L0.205936 0.974954 L0.319832 0.974954 L0.396113 0.937211 L0.510011 0.826134 M0.510011 0.454102 L0.510011 0.974954",v:"M0.048828 0.453125 L0.301026 0.961719 M0.553224 0.453125 L0.301026 0.961719",w:"M0 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.150512 0.961719 M0.301024 0.453125 L0.451539 0.961719 M0.602052 0.453125 L0.451539 0.961719",x:"M0.03711 0.453125 L0.564943 0.961719 M0.564943 0.453125 L0.03711 0.961719",y:"M0.084618 0.453125 L0.320232 0.921476 M0.55713 0.453125 L0.320232 0.921476 L0.242119 1.055289 L0.163369 1.122196 L0.084618 1.155166 L0.044922 1.155166",z:"M0.505373 0.452148 L0.09668 0.961651 M0.09668 0.452148 L0.505373 0.452148 M0.09668 0.961651 L0.505373 0.961651"},Wi={};for(let t in ty){Wi[t]=[];let e=ty[t].split("M").slice(1).map((r)=>r.split("L").map((n)=>n.trim().split(" ").map(parseFloat)));for(let r of e)for(let n=0;n<r.length-1;n++)Wi[t].push({x1:r[n][0],y1:1-r[n][1],x2:r[n+1][0],y2:1-r[n+1][1]})}var SE=(()=>{let t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),wE={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};var v4=[];for(let t=0;t<256;t++){let e=t;for(let r=0;r<8;r++)if(e&1)e=3988292384^e>>>1;else e=e>>>1;v4[t]=e}var I4=new Uint16Array([255]),F4=new Uint8Array(I4.buffer),kE=F4[0]===255;var M4=new Uint16Array([255]),C4=new Uint8Array(M4.buffer),LE=C4[0]===255,TE=new Uint8Array(0);var RE=Uint8Array.of(137,80,78,71,13,10,26,10);var $E=new TextDecoder("latin1");var{cos:VR,sin:zR,PI:UR}=Math;var{tan:KR}=Math;var D4=ae(ce(),1);var Qo=(t,e)=>({...t,rects:[...t.rects??[],...e.rects??[]],points:[...t.points??[],...e.points??[]],lines:[...t.lines??[],...e.lines??[]],infiniteLines:[...t.infiniteLines??[],...e.infiniteLines??[]],polygons:[...t.polygons??[],...e.polygons??[]],circles:[...t.circles??[],...e.circles??[]],arrows:[...t.arrows??[],...e.arrows??[]],texts:[...t.texts??[],...e.texts??[]]});function Xi(t,e){if(t.points)for(let r of t.points)r.step=e;if(t.lines)for(let r of t.lines)r.step=e;if(t.infiniteLines)for(let r of t.infiniteLines)r.step=e;if(t.polygons)for(let r of t.polygons)r.step=e;if(t.rects)for(let r of t.rects)r.step=e;if(t.circles)for(let r of t.circles)r.step=e;if(t.texts)for(let r of t.texts)r.step=e;return t}var U=class{MAX_ITERATIONS=1e5;solved=!1;failed=!1;iterations=0;progress=0;error=null;activeSubSolver;failedSubSolvers;timeToSolve;stats={};_setupDone=!1;getSolverName(){return this.constructor.name}setup(){if(this._setupDone)return;this._setup(),this._setupDone=!0}_setup(){}step(){if(!this._setupDone)this.setup();if(this.solved)return;if(this.failed)return;this.iterations++;try{this._step()}catch(t){throw this.error=`${this.getSolverName()} error: ${t}`,this.failed=!0,t}if(!this.solved&&this.iterations>=this.MAX_ITERATIONS)this.tryFinalAcceptance();if(!this.solved&&this.iterations>=this.MAX_ITERATIONS)this.error=`${this.getSolverName()} ran out of iterations`,this.failed=!0;if("computeProgress"in this)this.progress=this.computeProgress()}_step(){}getConstructorParams(){throw Error("getConstructorParams not implemented")}getOutput(){return null}solve(){let t=Date.now();while(!this.solved&&!this.failed)this.step();let e=Date.now();this.timeToSolve=e-t}visualize(){return{lines:[],points:[],rects:[],circles:[]}}tryFinalAcceptance(){}preview(){return{lines:[],points:[],rects:[],circles:[]}}};function mt(t,e,r,n={}){return{solverName:t,solverClass:e,getConstructorParams:r,onSolved:n.onSolved}}var ly=class extends U{startTimeOfStage={};endTimeOfStage={};timeSpentOnStage={};firstIterationOfStage={};currentPipelineStageIndex=0;inputProblem;pipelineOutputs={};constructor(t){super();this.inputProblem=t,this.MAX_ITERATIONS=1e6}_step(){let t=this.pipelineDef[this.currentPipelineStageIndex];if(!t){this.solved=!0;return}if(this.activeSubSolver){if(this.activeSubSolver.step(),this.activeSubSolver.solved){this.endTimeOfStage[t.solverName]=performance.now(),this.timeSpentOnStage[t.solverName]=this.endTimeOfStage[t.solverName]-this.startTimeOfStage[t.solverName];let r=this.activeSubSolver.getOutput();if(r!==null)this.pipelineOutputs[t.solverName]=r;t.onSolved?.(this),this.activeSubSolver=null,this.currentPipelineStageIndex++}else if(this.activeSubSolver.failed)this.error=this.activeSubSolver?.error,this.failed=!0,this.activeSubSolver=null;return}let e=t.getConstructorParams(this);this.activeSubSolver=new t.solverClass(...e),this[t.solverName]=this.activeSubSolver,this.timeSpentOnStage[t.solverName]=0,this.startTimeOfStage[t.solverName]=performance.now(),this.firstIterationOfStage[t.solverName]=this.iterations}solveUntilStage(t){while(this.getCurrentStageName().toLowerCase()!==t.toLowerCase())if(this.step(),this.failed||this.solved)break}getCurrentStageName(){return this.pipelineDef[this.currentPipelineStageIndex]?.solverName??"none"}getStageProgress(){let t=this.pipelineDef.length;if(t===0)return 1;let e=this.activeSubSolver?.progress??0;return(this.currentPipelineStageIndex+e)/t}getStageStats(){let t={};for(let e of this.pipelineDef){let r=this.timeSpentOnStage[e.solverName]||0,n=this.firstIterationOfStage[e.solverName]||0,i=this.iterations,s=e.solverName===this.getCurrentStageName()?i-n:0,o=this.currentPipelineStageIndex>this.pipelineDef.findIndex((c)=>c.solverName===e.solverName);t[e.solverName]={timeSpent:r,iterations:s,completed:o}}return t}initialVisualize(){return null}finalVisualize(){return null}visualize(){if(!this.solved&&this.activeSubSolver)return this.activeSubSolver.visualize();let t=0,e=this.initialVisualize();if(e)Xi(e,0),t=1;let r=null;if(this.solved)r=this.finalVisualize();let n=[e].filter(Boolean).concat(this.pipelineDef.map((i,s)=>{let c=this[i.solverName]?.visualize();if(!c)return null;return Xi(c,s+t),c}).filter(Boolean));if(n.length===0)return{points:[],rects:[],lines:[],circles:[],texts:[]};if(this.solved&&r)Xi(r,n.length+t+1),n.push(r);if(n.length===1)return n[0];return{points:n.flatMap((i)=>i.points||[]),rects:n.flatMap((i)=>i.rects||[]),lines:n.flatMap((i)=>i.lines||[]),circles:n.flatMap((i)=>i.circles||[]),texts:n.flatMap((i)=>i.texts||[])}}preview(){if(this.activeSubSolver)return this.activeSubSolver.preview();return super.preview()}computeProgress(){return this.getStageProgress()}getStageOutput(t){return this.pipelineOutputs[t]}getAllOutputs(){return{...this.pipelineOutputs}}hasStageOutput(t){return t in this.pipelineOutputs}getSolver(t){return this[t]}};var Hr=(t)=>{if(Number.isInteger(t))return String(t);return t.toFixed(3).replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1")},jl=(t)=>{let e=Hr(t);return t>0?`+${e}`:e},Xl=(t)=>t.replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;"),v=(t,e,r,n)=>{if(r===void 0)return;let i=typeof r==="number"?n?.formatDelta?jl(r):Hr(r):Xl(r);t.push(`${e}="${i}"`)};function Zo(t){let e=new Map,r=(i)=>{let s=e.get(i);if(s===void 0||s===i)return i;let o=r(s);return e.set(i,o),o},n=(i)=>{let s=i[0];if(!s)return;let o=r(s);for(let c of i.slice(1))e.set(r(c),o)};for(let i of t){if(i.type==="source_port"||i.type==="source_net"){let s=i.type==="source_port"?i.source_port_id:i.source_net_id;if(i.subcircuit_connectivity_map_key)n([s,`connectivity:${i.subcircuit_connectivity_map_key}`])}if(i.type==="source_trace")n([...i.connected_source_port_ids,...i.connected_source_net_ids,...i.subcircuit_connectivity_map_key?[`connectivity:${i.subcircuit_connectivity_map_key}`]:[]]);if(i.type==="source_component_internal_connection")n(i.source_port_ids);if(i.type==="source_component")for(let s of i.internally_connected_source_port_ids??[])n(s)}return r}class tt{connected;components=new Map;portsByComponent=new Map;portsByNet=new Map;powerNets=new Set;groundNets=new Set;placements=new Map;schematicComponents=new Map;schematicPorts=new Map;constructor(t){this.connected=Zo(t.circuitJson);for(let e of t.componentPlacements)if(e.sourceComponentId)qo(this.placements,e.sourceComponentId,e);for(let e of t.circuitJson){if(e.type==="source_component")this.components.set(e.source_component_id,e);if(e.type==="source_port"&&e.source_component_id)qo(this.portsByComponent,e.source_component_id,e),qo(this.portsByNet,this.connected(e.source_port_id),e);if(e.type==="source_net"){let r=this.connected(e.source_net_id);if(e.is_power||e.is_positive_voltage_source)this.powerNets.add(r);if(e.is_ground)this.groundNets.add(r)}if(e.type==="schematic_component")this.schematicComponents.set(e.schematic_component_id,e);if(e.type==="schematic_port"&&e.source_port_id)qo(this.schematicPorts,e.source_port_id,e)}}placement(t){let e=this.placements.get(t);return e?.length===1?e[0]:void 0}port(t){let e=this.placement(t.source_component_id),r=this.schematicPorts.get(t.source_port_id)?.filter((n)=>n.schematic_component_id===e?.schematicComponentId);return r?.length===1?r[0]:void 0}namedPort(t,e){let r=this.portsByComponent.get(t)?.filter((n)=>n.name===e||n.port_hints?.includes(e));return r?.length===1?r[0]:void 0}twoTerminalNets(t){let e=this.portsByComponent.get(t);if(e?.length!==2)return;let r=this.connected(e[0].source_port_id),n=this.connected(e[1].source_port_id);if(r!==n)return[r,n]}isRail(t){return this.powerNets.has(t)||this.groundNets.has(t)}isDirectOpAmpFeedback(t){let e=this.twoTerminalNets(t);if(!e||e.some((r)=>this.isRail(r)))return!1;return e.some((r)=>(this.portsByNet.get(r)??[]).some((n)=>{let i=n.source_component_id;if(this.components.get(i)?.ftype!=="simple_op_amp")return!1;if(this.namedPort(i,"output")?.source_port_id!==n.source_port_id)return!1;return["inverting_input","non_inverting_input"].some((o)=>{let c=this.namedPort(i,o);if(!c)return!1;let l=this.connected(c.source_port_id);return l!==r&&e.includes(l)})}))}sameLocalScope(t,e){if(t.schematicSheetId!==e.schematicSheetId||t.subcircuitId!==e.subcircuitId)return!1;let r=this.schematicComponents.get(t.schematicComponentId??""),n=this.schematicComponents.get(e.schematicComponentId??"");if(!r||!n||r.schematic_group_id!==n.schematic_group_id)return!1;let i=this.components.get(t.sourceComponentId??""),s=this.components.get(e.sourceComponentId??"");return i?.source_group_id===s?.source_group_id&&i?.subcircuit_id===s?.subcircuit_id}}function qo(t,e,r){let n=t.get(e);if(n)n.push(r);else t.set(e,[r])}var Dl={up:[0,1],down:[0,-1],left:[-1,0],right:[1,0]};class Qr extends U{params;index;unpopulated=new Set;nets;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.nets=[...this.index.portsByNet.keys()],this.solved=this.nets.length===0}_step(){let t=this.nets[this.currentIndex++];if(this.solved=this.currentIndex>=this.nets.length,!t)return;let e=this.index,r=e.portsByNet.get(t);if(e.groundNets.has(t)||r.length!==2)return;let n=r.find((p)=>e.components.get(p.source_component_id)?.ftype==="simple_fuse"),i=r.find((p)=>e.components.get(p.source_component_id)?.ftype==="simple_pin_header");if(!n||!i)return;let s=this.validPlacement(n.source_component_id,2),o=this.validPlacement(i.source_component_id,2),c=e.twoTerminalNets(n.source_component_id),l=e.twoTerminalNets(i.source_component_id);if(!s||!o||!e.sameLocalScope(s,o)||!c||!l)return;let a=l.find((p)=>p!==t);if(!e.groundNets.has(a)||e.powerNets.has(a)||c.some((p)=>e.groundNets.has(p)))return;if(!this.isSeparated(s,o,n,i))return;this.params.issues.push({lineItemType:"FuseConnectorNotAligned",fuseSchematicBox:s,connectorSchematicBox:o,fuseSourcePortId:n.source_port_id,connectorSourcePortId:i.source_port_id,message:`Align ${s.sourceComponentName||"the fuse"} with its connected terminal on ${o.sourceComponentName||"the connector"}, facing their pins toward each other along a straight wire. Preserve connector pin order and all connections, leave room for labels and neighboring parts, and reroute affected traces.`})}isSeparated(t,e,r,n){if(Math.abs(t.schX-e.schX)<(t.width+e.width)/2&&Math.abs(t.schY-e.schY)<(t.height+e.height)/2)return!1;let i=this.index.port(r),s=this.index.port(n),o=Dl[i.facing_direction],c=Dl[s.facing_direction],l=s.center.x-i.center.x,a=s.center.y-i.center.y,p=Math.max(2,2*Math.max(t.width,t.height));if(Math.hypot(l,a)<=p)return!1;return!(o[0]*c[0]+o[1]*c[1]===-1&&l*o[0]+a*o[1]>0&&Math.abs(l*o[1]-a*o[0])<=0.15)}validPlacement(t,e){let r=this.index.placement(t),n=this.index.portsByComponent.get(t);if(this.unpopulated.has(t)||!r||n?.length!==e||![r.schX,r.schY,r.width,r.height].every(Number.isFinite)||r.width<=0||r.height<=0||n.some((i)=>!this.validPort(i,r.schematicSheetId)))return;return r}validPort(t,e){let r=this.index.port(t);return!t.do_not_connect&&r&&r.schematic_sheet_id===e&&[r.center.x,r.center.y].every(Number.isFinite)&&r.facing_direction&&r.facing_direction in Dl}static issueToString(t){let e=[];return v(e,"fuseName",t.fuseSchematicBox.sourceComponentName),v(e,"connectorName",t.connectorSchematicBox.sourceComponentName),v(e,"message",t.message),`<FuseConnectorNotAligned ${e.join(" ")} />`}}var Vl={up:[0,1],down:[0,-1],left:[-1,0],right:[1,0]};class Zr extends U{params;index;unpopulated=new Set;nets;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.nets=[...this.index.portsByNet.keys()],this.solved=this.nets.length===0}_step(){let t=this.nets[this.currentIndex++];if(this.solved=this.currentIndex>=this.nets.length,!t)return;let e=this.index,r=e.portsByNet.get(t);if(e.isRail(t)||r.length!==2)return;let n=r.find((b)=>e.components.get(b.source_component_id)?.ftype==="simple_led"),i=r.find((b)=>e.components.get(b.source_component_id)?.ftype==="simple_transistor");if(!n||!i)return;let s=e.components.get(i.source_component_id);if(s?.ftype!=="simple_transistor"||!["npn","pnp"].includes(s.transistor_type))return;let o=this.validPlacement(n.source_component_id,2),c=this.validPlacement(i.source_component_id,3);if(!o||!c||!e.sameLocalScope(o,c)||!e.twoTerminalNets(n.source_component_id))return;let l=e.portsByComponent.get(i.source_component_id).map((b)=>e.connected(b.source_port_id));if(new Set(l).size!==3)return;let a=e.portsByComponent.get(n.source_component_id).find((b)=>b!==n),p=e.connected(a.source_port_id);if(e.isRail(p))return;let d=e.portsByNet.get(p);if(d?.length!==2)return;let m=d.find((b)=>e.components.get(b.source_component_id)?.ftype==="simple_resistor");if(!m)return;let f=e.components.get(m.source_component_id),_=this.validPlacement(m.source_component_id,2),g=e.twoTerminalNets(m.source_component_id);if(f?.ftype!=="simple_resistor"||!Number.isFinite(f.resistance)||f.resistance<=0||!_||!e.sameLocalScope(o,_)||!g)return;let y=g.find((b)=>b!==p),S=l.filter((b)=>e.isRail(b));if(S.length!==1||!e.isRail(y)||l.includes(y)||l.includes(p))return;let P=S[0];if([y,P].some((b)=>e.powerNets.has(b)&&e.groundNets.has(b)))return;if(!(e.groundNets.has(y)&&e.powerNets.has(P))&&!(e.powerNets.has(y)&&e.groundNets.has(P)))return;if(!this.isSeparated(o,c,n,i))return;this.params.issues.push({lineItemType:"TransistorLedNotAligned",transistorSchematicBox:c,ledSchematicBox:o,transistorSourcePortId:i.source_port_id,ledSourcePortId:n.source_port_id,message:`Align ${o.sourceComponentName||"the LED"} with its connected terminal on ${c.sourceComponentName||"the transistor"} so their separated connection reads along a straight wire. Preserve every pin connection and LED/transistor polarity, leave room for labels and neighboring parts, and reroute affected traces.`})}isSeparated(t,e,r,n){if(Math.abs(t.schX-e.schX)<(t.width+e.width)/2&&Math.abs(t.schY-e.schY)<(t.height+e.height)/2)return!1;let i=this.index.port(r),s=this.index.port(n),o=Vl[i.facing_direction],c=Vl[s.facing_direction],l=s.center.x-i.center.x,a=s.center.y-i.center.y,p=Math.max(2,2*Math.max(t.width,t.height));if(Math.hypot(l,a)<=p)return!1;return!(o[0]*c[0]+o[1]*c[1]===-1&&l*o[0]+a*o[1]>0&&Math.abs(l*o[1]-a*o[0])<=0.15)}validPlacement(t,e){let r=this.index.placement(t),n=this.index.portsByComponent.get(t);if(this.unpopulated.has(t)||!r||n?.length!==e||![r.schX,r.schY,r.width,r.height].every(Number.isFinite)||r.width<=0||r.height<=0||n.some((i)=>!this.validPort(i,r.schematicSheetId)))return;return r}validPort(t,e){let r=this.index.port(t);return!t.do_not_connect&&r&&r.schematic_sheet_id===e&&[r.center.x,r.center.y].every(Number.isFinite)&&r.facing_direction&&r.facing_direction in Vl}static issueToString(t){let e=[];return v(e,"transistorName",t.transistorSchematicBox.sourceComponentName),v(e,"ledName",t.ledSchematicBox.sourceComponentName),v(e,"message",t.message),`<TransistorLedNotAligned ${e.join(" ")} />`}}var zl={up:[0,1],down:[0,-1],left:[-1,0],right:[1,0]};class qr extends U{params;index;unpopulated=new Set;nets;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.nets=[...this.index.portsByNet.keys()],this.solved=this.nets.length===0}_step(){let t=this.nets[this.currentIndex++];if(this.solved=this.currentIndex>=this.nets.length,!t)return;let e=this.index,r=e.portsByNet.get(t);if(e.isRail(t)||r.length!==2)return;let n=r.find((b)=>e.components.get(b.source_component_id)?.ftype==="simple_resistor"),i=r.find((b)=>e.components.get(b.source_component_id)?.ftype==="simple_transistor");if(!n||!i)return;let s=e.components.get(n.source_component_id),o=e.components.get(i.source_component_id);if(s?.ftype!=="simple_resistor"||!Number.isFinite(s.resistance)||s.resistance<=0||o?.ftype!=="simple_transistor"||!["npn","pnp"].includes(o.transistor_type))return;let c=this.validPlacement(n.source_component_id,2),l=this.validPlacement(i.source_component_id,3),a=e.twoTerminalNets(n.source_component_id);if(!c||!l||!e.sameLocalScope(c,l)||!a||a.some((b)=>e.isRail(b)))return;let p=e.portsByComponent.get(i.source_component_id).map((b)=>e.connected(b.source_port_id));if(new Set(p).size!==3||p.includes(a.find((b)=>b!==t)))return;if(Math.abs(c.schX-l.schX)<(c.width+l.width)/2&&Math.abs(c.schY-l.schY)<(c.height+l.height)/2)return;let d=e.port(n),m=e.port(i),f=zl[d.facing_direction],_=zl[m.facing_direction],g=m.center.x-d.center.x,y=m.center.y-d.center.y,S=Math.max(2,2*Math.max(c.width,c.height));if(Math.hypot(g,y)<=S)return;let P=Math.abs(g*f[1]-y*f[0]);if(f[0]*_[0]+f[1]*_[1]===-1&&g*f[0]+y*f[1]>0&&P<=0.15)return;this.params.issues.push({lineItemType:"TransistorResistorNotAligned",transistorSchematicBox:l,resistorSchematicBox:c,transistorSourcePortId:i.source_port_id,resistorSourcePortId:n.source_port_id,message:`Align ${c.sourceComponentName||"the resistor"} with its connected terminal on ${l.sourceComponentName||"the transistor"} so the separated pair reads along a straight wire. Preserve all pin connections and transistor polarity, leave room for labels and neighboring parts, and reroute affected traces.`})}validPlacement(t,e){let r=this.index.placement(t),n=this.index.portsByComponent.get(t);if(this.unpopulated.has(t)||!r||n?.length!==e||![r.schX,r.schY,r.width,r.height].every(Number.isFinite)||r.width<=0||r.height<=0||n.some((i)=>!this.validPort(i,r.schematicSheetId)))return;return r}validPort(t,e){let r=this.index.port(t);return!t.do_not_connect&&r&&r.schematic_sheet_id===e&&[r.center.x,r.center.y].every(Number.isFinite)&&r.facing_direction&&r.facing_direction in zl}static issueToString(t){let e=[];return v(e,"transistorName",t.transistorSchematicBox.sourceComponentName),v(e,"resistorName",t.resistorSchematicBox.sourceComponentName),v(e,"message",t.message),`<TransistorResistorNotAligned ${e.join(" ")} />`}}var Jo={up:[0,1],down:[0,-1],left:[-1,0],right:[1,0]};class Jr extends U{params;index;positive=new Set;unpopulated=new Set;ids;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_net"&&e.is_positive_voltage_source)this.positive.add(this.index.connected(e.source_net_id));if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.ids=[...this.index.components.values()].filter((e)=>e.ftype==="simple_potentiometer").map((e)=>e.source_component_id),this.solved=this.ids.length===0}_step(){let t=this.ids[this.currentIndex++];if(this.solved=this.currentIndex>=this.ids.length,!t||this.unpopulated.has(t))return;let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.portsByComponent.get(t);if(r?.ftype!=="simple_potentiometer"||!Number.isFinite(r.max_resistance)||r.max_resistance<=0||!n||i?.length!==3)return;if(![n.schX,n.schY,n.width,n.height].every(Number.isFinite)||n.width<=0||n.height<=0||i.some((C)=>!this.validPort(C,n.schematicSheetId)))return;let s=i.map((C)=>e.connected(C.source_port_id));if(new Set(s).size!==3||s.some((C)=>e.powerNets.has(C)&&e.groundNets.has(C)))return;let o=i.filter((C)=>this.positive.has(e.connected(C.source_port_id))),c=i.filter((C)=>e.groundNets.has(e.connected(C.source_port_id)));if(o.length!==1||c.length!==1)return;let l=o[0],a=c[0],p=i.find((C)=>C!==l&&C!==a);if(e.isRail(e.connected(p.source_port_id)))return;let d=e.port(l),m=e.port(a),f=e.port(p),_=Jo[d.facing_direction],g=Jo[m.facing_direction],y=Jo[f.facing_direction];if(_[0]!==-g[0]||_[1]!==-g[1]||_[0]*y[0]+_[1]*y[1]!==0)return;let S=d.center.x-m.center.x,P=d.center.y-m.center.y;if(Math.abs(S*_[1]-P*_[0])>0.01||S*_[0]+P*_[1]<=0.01)return;if(d.facing_direction==="up")return;let b={right:90,down:180,left:270}[d.facing_direction];this.params.issues.push({lineItemType:"PotentiometerHasIncorrectRailOrientation",schematicBox:n,supplySourcePortId:l.source_port_id,groundSourcePortId:a.source_port_id,deltaSchRotation:b,message:`Rotate ${n.sourceComponentName||"the potentiometer"} by ${b}° so its positive-supply terminal faces up and its ground terminal faces down, with the third terminal at the side. Preserve all pin connections and reroute attached traces.`})}validPort(t,e){let r=this.index.port(t);return!t.do_not_connect&&r&&r.schematic_sheet_id===e&&[r.center.x,r.center.y].every(Number.isFinite)&&r.facing_direction&&r.facing_direction in Jo}static issueToString(t){let e=[];return v(e,"componentName",t.schematicBox.sourceComponentName),v(e,"deltaSchRotation",t.deltaSchRotation),v(e,"message",t.message),`<PotentiometerHasIncorrectRailOrientation ${e.join(" ")} />`}}class Kr extends U{params;index;capacitorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.capacitorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_capacitor").map((e)=>e.source_component_id),this.solved=this.capacitorIds.length===0}_step(){let t=this.capacitorIds[this.currentIndex++];this.solved=this.currentIndex>=this.capacitorIds.length;let e=this.index,r=this.part(t),n=e.components.get(t);if(n?.ftype!=="simple_capacitor"||!Number.isFinite(n.capacitance)||n.capacitance<=0||!r||r.nets.some((y)=>e.isRail(y)))return;let i=r.ports.flatMap((y)=>{let S=this.dividerAt(y);return S?[{...S,capPort:y}]:[]});if(i.length!==1)return;let{resistors:s,resistorPorts:o,capPort:c,input:l}=i[0],a=r.nets.find((y)=>y!==e.connected(c.source_port_id));if(a===l)return;let p=new Set((e.portsByNet.get(l)??[]).filter((y)=>["simple_chip","simple_op_amp"].includes(e.components.get(y.source_component_id)?.ftype??"")).map((y)=>y.source_component_id));if((e.portsByNet.get(a)??[]).some((y)=>p.has(y.source_component_id)))return;let d=[r.box,...s.map((y)=>y.box)];if(!d.every((y)=>e.sameLocalScope(r.box,y)))return;for(let y=0;y<d.length;y++)for(let S=y+1;S<d.length;S++){let P=d[y],b=d[S];if(Math.abs(P.schX-b.schX)<(P.width+b.width)/2&&Math.abs(P.schY-b.schY)<(P.height+b.height)/2)return}let m=e.port(c),f=o.map((y)=>e.port(y)),_=Math.min(...f.map((y)=>Math.hypot(m.center.x-y.center.x,m.center.y-y.center.y))),g=Math.max(4,3*Math.max(...d.flatMap((y)=>[y.width,y.height])));if(_<=g)return;this.params.issues.push({lineItemType:"CapacitorSeparatedFromResistorDivider",capacitorSchematicBox:r.box,resistorSchematicBoxes:s.map((y)=>y.box),capacitorSourcePortId:c.source_port_id,resistorSourcePortIds:o.map((y)=>y.source_port_id),signalPinDistance:_,maxRecommendedSignalPinDistance:g,message:`Place ${r.box.sourceComponentName||"the capacitor"} beside the shared junction of ${s.map((y)=>y.box.sourceComponentName||"resistor").join(" and ")} so the divider and capacitor read together. Preserve all connections and leave space for labels and neighboring parts; exact alignment is not required.`})}dividerAt(t){let e=this.index,r=e.connected(t.source_port_id),n=e.portsByNet.get(r)??[];if(n.length!==3||e.isRail(r)||n.some((l)=>l.do_not_connect))return;let i=n.filter((l)=>e.components.get(l.source_component_id)?.ftype==="simple_resistor");if(i.length!==2||new Set(n.map((l)=>l.source_component_id)).size!==3)return;let s=this.part(i[0].source_component_id),o=this.part(i[1].source_component_id);if(!s||!o)return;for(let l of i){let a=e.components.get(l.source_component_id);if(a?.ftype!=="simple_resistor"||!Number.isFinite(a.resistance)||a.resistance<=0)return}let c=[s,o].map((l)=>l.nets.find((a)=>a!==r));if(c.filter((l)=>e.groundNets.has(l)).length!==1||c.some((l)=>e.powerNets.has(l)))return;return{resistors:[s,o],resistorPorts:i,input:c.find((l)=>!e.groundNets.has(l))}}part(t){let e=this.index,r=e.placement(t),n=e.twoTerminalNets(t),i=e.portsByComponent.get(t);if(this.unpopulated.has(t)||!r||!n||i?.length!==2||![r.schX,r.schY,r.width,r.height].every(Number.isFinite)||r.width<=0||r.height<=0)return;if(i.some((s)=>{let o=e.port(s);return s.do_not_connect||!o||o.schematic_sheet_id!==r.schematicSheetId||![o.center.x,o.center.y].every(Number.isFinite)}))return;return{box:r,nets:n,ports:i}}static issueToString(t){let e=[];return v(e,"capacitorName",t.capacitorSchematicBox.sourceComponentName),v(e,"resistorNames",t.resistorSchematicBoxes.map((r)=>r.sourceComponentName).join(",")),v(e,"signalPinDistance",t.signalPinDistance),v(e,"maxRecommendedSignalPinDistance",t.maxRecommendedSignalPinDistance),v(e,"message",t.message),`<CapacitorSeparatedFromResistorDivider ${e.join(" ")} />`}}var py={left:[-1,0],right:[1,0],up:[0,1],down:[0,-1]};class tn extends U{params;index;nets;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.nets=[...this.index.portsByNet.keys()],this.solved=this.nets.length===0}_step(){let t=this.nets[this.currentIndex++];this.solved=this.currentIndex>=this.nets.length;let e=this.index,r=e.portsByNet.get(t);if(e.isRail(t)||r.length!==2)return;let[n,i]=r;if(n.source_component_id===i.source_component_id)return;let s=this.resistor(n.source_component_id),o=this.resistor(i.source_component_id);if(!s||!o||!e.sameLocalScope(s.box,o.box))return;if(s.nets.filter((S)=>o.nets.includes(S)).length!==1)return;let c=s.box,l=o.box;if(Math.abs(c.schX-l.schX)<(c.width+l.width)/2&&Math.abs(c.schY-l.schY)<(c.height+l.height)/2)return;let a=e.port(n),p=e.port(i),d=a.facing_direction&&py[a.facing_direction],m=p.facing_direction&&py[p.facing_direction];if(!d||!m)return;let f=p.center.x-a.center.x,_=p.center.y-a.center.y,g=Math.max(2,2*Math.max(c.width,c.height,l.width,l.height));if(Math.hypot(f,_)<=g)return;let y=Math.abs(f*d[1]-_*d[0]);if(d[0]*m[0]+d[1]*m[1]===-1&&f*d[0]+_*d[1]>0&&y<=0.15)return;this.params.issues.push({lineItemType:"SeriesResistorsNotAligned",firstResistorSchematicBox:c,secondResistorSchematicBox:l,firstSourcePortId:n.source_port_id,secondSourcePortId:i.source_port_id,message:`Align ${c.sourceComponentName||"the first resistor"} and ${l.sourceComponentName||"the second resistor"} so their private connection reads end-to-end. Preserve pin connections, leave room for labels and neighboring parts, and reroute the trace.`})}resistor(t){let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.twoTerminalNets(t);if(r?.ftype!=="simple_resistor"||!Number.isFinite(r.resistance)||r.resistance<=0||this.unpopulated.has(t)||!n||!i)return;if(![n.schX,n.schY,n.width,n.height].every(Number.isFinite)||n.width<=0||n.height<=0)return;if(e.portsByComponent.get(t).some((s)=>!this.validPort(s,n.schematicSheetId)))return;return{box:n,nets:i}}validPort(t,e){let r=this.index.port(t);return!t.do_not_connect&&r&&r.schematic_sheet_id===e&&[r.center.x,r.center.y].every(Number.isFinite)}static issueToString(t){let e=[];return v(e,"firstResistorName",t.firstResistorSchematicBox.sourceComponentName),v(e,"secondResistorName",t.secondResistorSchematicBox.sourceComponentName),v(e,"message",t.message),`<SeriesResistorsNotAligned ${e.join(" ")} />`}}class en extends U{params;index;banks;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;let e=this.index=new tt(t.ctx);for(let n of t.ctx.circuitJson){if(n.type==="pcb_component"&&n.do_not_place)this.unpopulated.add(n.source_component_id);if(n.type!=="source_port")continue;let i=e.connected(n.source_port_id);if(n.requires_power||n.provides_power||n.requires_voltage!==void 0||n.provides_voltage!==void 0)e.powerNets.add(i);if(n.requires_ground||n.provides_ground)e.groundNets.add(i)}let r=new Map;for(let n of e.components.values()){if(n.ftype!=="simple_diode")continue;let i=e.twoTerminalNets(n.source_component_id)?.sort();if(!i||i.every((c)=>e.isRail(c)))continue;let s=JSON.stringify(i),o=r.get(s)??[];o.push(n.source_component_id),r.set(s,o)}this.banks=[...r.values()],this.solved=this.banks.length===0}_step(){let t=this.banks[this.currentIndex++];if(this.solved=this.currentIndex>=this.banks.length,t.length!==2)return;let e=this.member(t[0]),r=this.member(t[1]);if(!e||!r||!this.index.sameLocalScope(e.box,r.box))return;let n=e.box,i=r.box;if(Math.hypot(n.schX-i.schX,n.schY-i.schY)>6*Math.max(n.width,n.height,i.width,i.height))return;if(Math.abs(n.schX-i.schX)<(n.width+i.width)/2&&Math.abs(n.schY-i.schY)<(n.height+i.height)/2)return;let s=hy(e.pins);if(!s||s!==hy(r.pins))return;let o=s==="horizontal"?"x":"y",[c,l]=e.pins,[a,p]=r.pins;if((l.center[o]-c.center[o])*(p.center[o]-a.center[o])>=0)return;this.params.issues.push({lineItemType:"ParallelDiodesNotAligned",firstDiodeSchematicBox:n,secondDiodeSchematicBox:i,message:`Align ${n.sourceComponentName||"the first diode"} and ${i.sourceComponentName||"the second diode"} so their shared nets appear at matching ends. Rotate or move the symbols without changing pin connections or diode polarity, leave room for labels, and reroute the wires.`})}member(t){let e=this.index.placement(t),r=this.index.portsByComponent.get(t);if(!e||r?.length!==2||this.unpopulated.has(t)||r.some((c)=>c.do_not_connect)||![e.schX,e.schY,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0)return;let i=this.index.twoTerminalNets(t).sort().map((c)=>this.index.port(r.find((l)=>this.index.connected(l.source_port_id)===c))),[s,o]=i;if(!s||!o||i.some((c)=>c?.schematic_sheet_id!==e.schematicSheetId)||![s.center.x,s.center.y,o.center.x,o.center.y].every(Number.isFinite))return;return{box:e,pins:[s,o]}}static issueToString(t){let e=[];return v(e,"firstDiodeName",t.firstDiodeSchematicBox.sourceComponentName),v(e,"secondDiodeName",t.secondDiodeSchematicBox.sourceComponentName),v(e,"message",t.message),`<ParallelDiodesNotAligned ${e.join(" ")} />`}}function hy([t,e]){let r=new Set([t.facing_direction,e.facing_direction]);if(r.has("left")&&r.has("right")&&Math.abs(t.center.y-e.center.y)<0.01&&Math.abs(t.center.x-e.center.x)>0.01)return"horizontal";if(r.has("up")&&r.has("down")&&Math.abs(t.center.x-e.center.x)<0.01&&Math.abs(t.center.y-e.center.y)>0.01)return"vertical"}class rn extends U{params;index;resistorIds;capacitorsByNets=new Map;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;let e=this.index=new tt(t.ctx);for(let r of t.ctx.circuitJson){if(r.type==="pcb_component"&&r.do_not_place)this.unpopulated.add(r.source_component_id);if(r.type!=="source_port")continue;let n=e.connected(r.source_port_id);if(r.requires_power||r.provides_power||r.requires_voltage!==void 0||r.provides_voltage!==void 0)e.powerNets.add(n);if(r.requires_ground||r.provides_ground)e.groundNets.add(n)}this.resistorIds=[];for(let r of e.components.values()){if(r.ftype==="simple_resistor")this.resistorIds.push(r.source_component_id);if(r.ftype!=="simple_capacitor")continue;let n=e.twoTerminalNets(r.source_component_id);if(!n)continue;let i=dy(n),s=this.capacitorsByNets.get(i)??[];s.push(r.source_component_id),this.capacitorsByNets.set(i,s)}this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];this.solved=this.currentIndex>=this.resistorIds.length;let e=this.part(t);if(!e)return;let r=e.ports.flatMap((n)=>{let i=this.branchAt(n);return i?[i]:[]});for(let{capacitor:n,parallel:i,resistorPort:s,capacitorPort:o}of r){let c=e.box,l=n.box;if(!this.index.sameLocalScope(c,l)||!this.index.sameLocalScope(c,i.box))continue;if(Math.abs(c.schX-l.schX)<(c.width+l.width)/2&&Math.abs(c.schY-l.schY)<(c.height+l.height)/2)continue;let a=this.index.port(s),p=this.index.port(o),d=Math.hypot(a.center.x-p.center.x,a.center.y-p.center.y),m=Math.max(4,3*Math.max(c.width,c.height,l.width,l.height));if(d<=m)continue;this.params.issues.push({lineItemType:"SeriesRcBranchNotGrouped",resistorSchematicBox:c,capacitorSchematicBox:l,parallelCapacitorSchematicBox:i.box,resistorSourcePortId:s.source_port_id,capacitorSourcePortId:o.source_port_id,sharedPinDistance:d,maxRecommendedSharedPinDistance:m,message:`Group ${c.sourceComponentName||"the resistor"} and ${l.sourceComponentName||"the series capacitor"} at their private shared node so this series branch is easy to follow beside the parallel capacitor. Preserve pin connections, leave room for labels, and reroute the wires; exact alignment is not required.`})}}branchAt(t){let e=this.index,r=e.connected(t.source_port_id),n=e.portsByNet.get(r);if(e.isRail(r)||n?.length!==2)return;let i=n.find((p)=>p.source_component_id!==t.source_component_id);if(!i||e.components.get(i.source_component_id)?.ftype!=="simple_capacitor")return;let s=this.part(i.source_component_id);if(!s)return;let o=e.twoTerminalNets(t.source_component_id)?.find((p)=>p!==r),c=e.twoTerminalNets(i.source_component_id)?.find((p)=>p!==r);if(!o||!c||o===c||[o,c].every((p)=>e.isRail(p)))return;let l=this.capacitorsByNets.get(dy([o,c]));if(l?.length!==1)return;let a=this.part(l[0]);if(!a)return;return{capacitor:s,parallel:a,resistorPort:t,capacitorPort:i}}part(t){let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.portsByComponent.get(t),s=r?.ftype==="simple_resistor"?r.resistance:r?.ftype==="simple_capacitor"?r.capacitance:void 0;if(s===void 0||!Number.isFinite(s)||s<=0||!n||i?.length!==2||this.unpopulated.has(t)||!e.twoTerminalNets(t)||![n.schX,n.schY,n.width,n.height].every(Number.isFinite)||n.width<=0||n.height<=0)return;let o=i.map((c)=>e.port(c));if(i.some((c)=>c.do_not_connect)||o.some((c)=>!c||c.schematic_sheet_id!==n.schematicSheetId||!Number.isFinite(c.center.x)||!Number.isFinite(c.center.y)))return;if(Math.hypot(o[0].center.x-o[1].center.x,o[0].center.y-o[1].center.y)<0.01)return;return{box:n,ports:i}}static issueToString(t){let e=[];return v(e,"resistorName",t.resistorSchematicBox.sourceComponentName),v(e,"capacitorName",t.capacitorSchematicBox.sourceComponentName),v(e,"parallelCapacitorName",t.parallelCapacitorSchematicBox.sourceComponentName),v(e,"sharedPinDistance",t.sharedPinDistance),v(e,"maxRecommendedSharedPinDistance",t.maxRecommendedSharedPinDistance),v(e,"message",t.message),`<SeriesRcBranchNotGrouped ${e.join(" ")} />`}}function dy(t){return JSON.stringify(t.toSorted())}var my={left:[-1,0],right:[1,0],up:[0,1],down:[0,-1]};class nn extends U{params;index;fuseIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);this.fuseIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_fuse").map((e)=>e.source_component_id),this.solved=this.fuseIds.length===0}_step(){let t=this.fuseIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.fuseIds.length,!t||this.unpopulated.has(t))return;let e=this.index,r=e.placement(t),n=e.twoTerminalNets(t);if(!r||!n)return;for(let i of n){let s=e.portsByNet.get(i)??[];if(s.length!==2)continue;let o=s.find((L)=>L.source_component_id!==t),c=s.find((L)=>L.source_component_id===t);if(!o||!c)continue;let l=o.source_component_id;if(e.components.get(l)?.ftype!=="simple_diode"||this.unpopulated.has(l))continue;let a=e.placement(l),p=e.twoTerminalNets(l);if(!a||!p||!e.sameLocalScope(r,a))continue;if(p.filter((L)=>n.includes(L)).length!==1)continue;let d=[...e.portsByComponent.get(t),...e.portsByComponent.get(l)];if(d.some((L)=>L.do_not_connect))continue;if([r,a].some((L)=>![L.schX,L.schY,L.width,L.height].every(Number.isFinite)||L.width<=0||L.height<=0))continue;if(d.some((L)=>{let B=e.port(L);return!B||B.schematic_sheet_id!==r.schematicSheetId||![B.center.x,B.center.y].every(Number.isFinite)}))continue;if(Math.abs(r.schX-a.schX)<(r.width+a.width)/2&&Math.abs(r.schY-a.schY)<(r.height+a.height)/2)continue;let m=e.port(c),f=e.port(o),_=m.facing_direction&&my[m.facing_direction],g=f.facing_direction&&my[f.facing_direction];if(!_||!g)continue;let y=f.center.x-m.center.x,S=f.center.y-m.center.y;if(Math.hypot(y,S)<0.3)continue;let P=_[0]*g[0]+_[1]*g[1]===-1,b=Math.abs(y*_[1]-S*_[0]),C=y*_[0]+S*_[1]>0;if(P&&C&&b<=0.15)continue;this.params.issues.push({lineItemType:"FuseDiodeNotAligned",fuseSchematicBox:r,diodeSchematicBox:a,fuseSourcePortId:c.source_port_id,diodeSourcePortId:o.source_port_id,message:`Align ${r.sourceComponentName||"fuse"} and ${a.sourceComponentName||"diode"} so their connected pins face each other along one straight path. Preserve pin connections and diode polarity, leave room for labels, and reroute the trace.`})}}static issueToString(t){let e=[];return v(e,"fuseName",t.fuseSchematicBox.sourceComponentName),v(e,"diodeName",t.diodeSchematicBox.sourceComponentName),v(e,"message",t.message),`<FuseDiodeNotAligned ${e.join(" ")} />`}}class on extends U{params;index;inductorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);this.inductorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_inductor").map((e)=>e.source_component_id),this.solved=this.inductorIds.length===0}_step(){let t=this.inductorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.inductorIds.length,!t||this.unpopulated.has(t))return;let e=this.index,r=e.placement(t),n=e.twoTerminalNets(t),i=e.portsByComponent.get(t)??[];if(!r||!n||n.some((P)=>e.isRail(P))||i.some((P)=>P.do_not_connect||uy(P)))return;let s=n.map((P)=>{let b=e.portsByNet.get(P)??[];return b.length===2?b.find((C)=>C.source_component_id!==t):void 0}),[o,c]=s;if(!o||!c||o.source_component_id!==c.source_component_id||[o,c].some((P)=>P.do_not_connect||uy(P)))return;let l=o.source_component_id,a=e.placement(l);if(e.components.get(l)?.ftype!=="simple_chip"||(e.portsByComponent.get(l)?.length??0)<3||this.unpopulated.has(l)||!a||!e.sameLocalScope(a,r))return;let p=[e.port(o),e.port(c)],d=i.map((P)=>e.port(P));if([...p,...d].some((P)=>!P||P.schematic_sheet_id!==a.schematicSheetId||![P.center.x,P.center.y].every(Number.isFinite))||[a,r].some((P)=>![P.schX,P.schY,P.width,P.height].every(Number.isFinite)||P.width<=0||P.height<=0))return;if(Math.abs(a.schX-r.schX)<(a.width+r.width)/2&&Math.abs(a.schY-r.schY)<(a.height+r.height)/2)return;let m=p[0],f=p[1],_=m.facing_direction;if(!_||_!==f.facing_direction)return;let g=Math.hypot(m.center.x-f.center.x,m.center.y-f.center.y);if(g<0.01)return;let y=Math.max(...p.map((P,b)=>Math.hypot(P.center.x-d[b].center.x,P.center.y-d[b].center.y))),S=Math.max(3,2*Math.max(r.width,r.height),2*g);if(y<=S)return;this.params.issues.push({lineItemType:"InductorSeparatedFromChipPins",hostSchematicBox:a,inductorSchematicBox:r,chipSourcePortIds:[o.source_port_id,c.source_port_id],maxPinDistance:y,maxRecommendedPinDistance:S,message:`Place ${r.sourceComponentName||"inductor"} beside its two connected pins on the ${_} side of ${a.sourceComponentName||"chip"} so the connections can be read together. Preserve pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}static issueToString(t){let e=[];return v(e,"hostComponentName",t.hostSchematicBox.sourceComponentName),v(e,"inductorName",t.inductorSchematicBox.sourceComponentName),v(e,"maxPinDistance",t.maxPinDistance),v(e,"maxRecommendedPinDistance",t.maxRecommendedPinDistance),v(e,"message",t.message),`<InductorSeparatedFromChipPins ${e.join(" ")} />`}}function uy(t){return Boolean(t.requires_power||t.provides_power||t.requires_ground||t.provides_ground||t.requires_voltage!==void 0||t.provides_voltage!==void 0)}class sn extends U{params;index;capacitorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type!=="source_port")continue;let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}this.capacitorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_capacitor").map((e)=>e.source_component_id),this.solved=this.capacitorIds.length===0}_step(){let t=this.capacitorIds[this.currentIndex++];this.solved=this.currentIndex>=this.capacitorIds.length;let e=this.index.components.get(t),r=this.localPart(t),n=this.index.twoTerminalNets(t);if(e?.ftype!=="simple_capacitor"||!Number.isFinite(e.capacitance)||e.capacitance<=0||!r||!n||n.some((P)=>this.index.isRail(P)))return;let i=r.ports.flatMap((P)=>{let b=this.pairAt(P);return b?[{...b,capacitorPort:P}]:[]});if(i.length!==1)return;let{resistor:s,resistorPort:o,capacitorPort:c,hostId:l}=i[0],a=this.index,p=a.connected(c.source_port_id),d=n.find((P)=>P!==p);if((a.portsByNet.get(d)??[]).some((P)=>P.source_component_id===l))return;if(!a.sameLocalScope(r.placement,s.placement))return;let m=r.placement,f=s.placement;if(Math.abs(m.schX-f.schX)<(m.width+f.width)/2&&Math.abs(m.schY-f.schY)<(m.height+f.height)/2)return;let _=a.port(c),g=a.port(o),y=Math.hypot(_.center.x-g.center.x,_.center.y-g.center.y),S=Math.max(4,3*Math.max(m.width,m.height,f.width,f.height));if(y<=S)return;this.params.issues.push({lineItemType:"HighPassRcFilterComponentsNotGrouped",capacitorSchematicBox:m,resistorSchematicBox:f,capacitorSourcePortId:c.source_port_id,resistorSourcePortId:o.source_port_id,signalPinDistance:y,maxRecommendedSignalPinDistance:S,message:`Group ${m.sourceComponentName||"the capacitor"} and ${f.sourceComponentName||"the resistor"} at their shared node so the series capacitor and grounded resistor can be read together. Preserve pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}pairAt(t){let e=this.index,r=t.source_component_id,n=e.portsByNet.get(e.connected(t.source_port_id))??[];if(n.length!==3||n.some((g)=>g.do_not_connect))return;let i=n.filter((g)=>e.components.get(g.source_component_id)?.ftype==="simple_resistor");if(i.length!==1)return;let s=i[0],o=s.source_component_id,c=e.components.get(o),l=this.localPart(o);if(c?.ftype!=="simple_resistor"||!Number.isFinite(c.resistance)||c.resistance<=0||!l)return;let p=e.twoTerminalNets(o)?.find((g)=>g!==e.connected(s.source_port_id));if(!p||!e.groundNets.has(p)||e.powerNets.has(p))return;let d=n.find((g)=>g.source_component_id!==r&&g.source_component_id!==o);if(!d)return;let m=d.source_component_id,f=e.placement(m),_=e.components.get(m)?.ftype;if(_!=="simple_chip"&&_!=="simple_op_amp"||(e.portsByComponent.get(m)?.length??0)<3||this.unpopulated.has(m)||!f||!e.sameLocalScope(l.placement,f)||!this.validPin(d,f.schematicSheetId))return;return{resistor:l,resistorPort:s,hostId:m}}localPart(t){let e=this.index.placement(t),r=this.index.portsByComponent.get(t);if(this.unpopulated.has(t)||!e||r?.length!==2||![e.schX,e.schY,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0||r.some((n)=>!this.validPin(n,e.schematicSheetId)))return;return{placement:e,ports:r}}validPin(t,e){let r=this.index.port(t);return!t.do_not_connect&&r&&r.schematic_sheet_id===e&&Number.isFinite(r.center.x)&&Number.isFinite(r.center.y)}static issueToString(t){let e=[];return v(e,"capacitorName",t.capacitorSchematicBox.sourceComponentName),v(e,"resistorName",t.resistorSchematicBox.sourceComponentName),v(e,"signalPinDistance",t.signalPinDistance),v(e,"maxRecommendedSignalPinDistance",t.maxRecommendedSignalPinDistance),v(e,"message",t.message),`<HighPassRcFilterComponentsNotGrouped ${e.join(" ")} />`}}class an extends U{params;banks=[];bankIndex=0;index;constructor(t){super();this.params=t;let e=this.index=new tt(t.ctx);for(let i of t.ctx.circuitJson){if(i.type!=="source_port")continue;let s=e.connected(i.source_port_id);if(i.requires_power||i.provides_power)e.powerNets.add(s);if(i.requires_ground||i.provides_ground)e.groundNets.add(s)}let r=new Set(t.ctx.circuitJson.flatMap((i)=>i.type==="pcb_component"&&i.do_not_place?[i.source_component_id]:[])),n=new Map;for(let i of e.components.values()){let s=i.ftype==="simple_diode";if(!s&&i.ftype!=="simple_capacitor")continue;let o=i.source_component_id,c=e.twoTerminalNets(o)?.sort();if(!c)continue;if(c.every((y)=>e.isRail(y)))continue;let l=e.placement(o),a={diode:s,box:l},p=JSON.stringify(c),d=n.get(p)??[];if(d.push(a),n.set(p,d),!l||r.has(o))continue;if(i.ftype==="simple_capacitor"&&(!Number.isFinite(i.capacitance)||i.capacitance<=0))continue;let m=e.portsByComponent.get(o);if(m.some((y)=>y.do_not_connect))continue;let f=c.map((y)=>e.port(m.find((S)=>e.connected(S.source_port_id)===y))),[_,g]=f;if(!_||!g||f.some((y)=>y?.schematic_sheet_id!==l.schematicSheetId))continue;a.pins=[_,g],a.axis=H4(_,g)}this.banks.push(...n.values()),this.solved=this.banks.length===0}_step(){let t=this.banks[this.bankIndex++];if(this.solved=this.bankIndex>=this.banks.length,t.length!==2)return;let e=t.find((c)=>c.diode),r=t.find((c)=>!c.diode);if(!e?.box||!e.pins||!e.axis||!r?.box||!r.pins||!r.axis)return;let n=e.box,i=r.box;if(!this.index.sameLocalScope(n,i))return;if([n.width,n.height,i.width,i.height].some((c)=>!Number.isFinite(c)||c<=0))return;let s=Math.hypot(n.schX-i.schX,n.schY-i.schY);if(!Number.isFinite(s)||s>6*Math.max(n.width,n.height,i.width,i.height))return;if(Math.abs(n.schX-i.schX)<(n.width+i.width)/2&&Math.abs(n.schY-i.schY)<(n.height+i.height)/2)return;let o;if(e.axis!==r.axis)o="different_axes";else{let c=e.axis==="horizontal"?"x":"y",l=e.pins.map((p)=>p.center[c]),a=r.pins.map((p)=>p.center[c]);if((l[1]-l[0])*(a[1]-a[0])<0)o="crossed_connections";else{if(Math.min(Math.max(...l),Math.max(...a))-Math.max(Math.min(...l),Math.min(...a))>0.01)return;o="staggered"}}this.params.issues.push({lineItemType:"ParallelDiodeCapacitorNotAligned",diodeSchematicBox:n,capacitorSchematicBox:i,reason:o,message:`Draw ${n.sourceComponentName||"the diode"} and ${i.sourceComponentName||"the capacitor"} as adjacent parallel rows or columns with their shared nets at matching ends. Preserve every pin connection and diode polarity, leave room for labels, and reroute the affected wires.`})}static issueToString(t){let e=[];return v(e,"diodeComponentName",t.diodeSchematicBox.sourceComponentName),v(e,"capacitorComponentName",t.capacitorSchematicBox.sourceComponentName),v(e,"reason",t.reason),v(e,"message",t.message),`<ParallelDiodeCapacitorNotAligned ${e.join(" ")} />`}}function H4(t,e){if(![t.center.x,t.center.y,e.center.x,e.center.y].every(Number.isFinite))return;let r=new Set([t.facing_direction,e.facing_direction]);if(r.has("left")&&r.has("right")&&Math.abs(t.center.y-e.center.y)<0.01&&Math.abs(t.center.x-e.center.x)>0.01)return"horizontal";if(r.has("up")&&r.has("down")&&Math.abs(t.center.x-e.center.x)<0.01&&Math.abs(t.center.y-e.center.y)>0.01)return"vertical"}class cn extends U{params;index;banks;bankIndex=0;constructor(t){super();this.params=t;let e=this.index=new tt(t.ctx),r=new Set(t.ctx.circuitJson.flatMap((i)=>i.type==="pcb_component"&&i.do_not_place?[i.source_component_id]:[]));for(let i of e.portsByComponent.values())for(let s of i){let o=e.connected(s.source_port_id);if(s.requires_power||s.provides_power)e.powerNets.add(o);if(s.requires_ground||s.provides_ground)e.groundNets.add(o)}let n=new Map;for(let i of e.components.values()){if(i.ftype!=="simple_resistor")continue;let s=i.source_component_id,o=e.portsByComponent.get(s);if(o?.length!==2)continue;for(let c of o){let l=e.connected(c.source_port_id),a=e.portsByNet.get(l);if(e.isRail(l)||a?.length!==2)continue;let p=a.find((C)=>C.source_component_id!==s),d=p&&e.components.get(p.source_component_id);if(!p||d?.ftype!=="simple_led")continue;let m=d.source_component_id,f=e.portsByComponent.get(m);if(f?.length!==2)continue;let _=o.find((C)=>C!==c),g=f.find((C)=>C!==p),y=[e.connected(_.source_port_id),e.connected(g.source_port_id)];if(y[0]===y[1]||y.includes(l))continue;let S={resistorId:s,ledId:m,nets:y,ports:[...o,...f],resistor:e.placement(s),led:e.placement(m),valid:Number.isFinite(i.resistance)&&i.resistance>0&&!r.has(s)&&!r.has(m)},P=JSON.stringify([...y].sort()),b=n.get(P)??[];b.push(S),n.set(P,b),S.geometry=Q4(e,S)}}this.banks=[...n.values()],this.solved=this.banks.length===0}_step(){let t=this.banks[this.bankIndex++];if(this.solved=this.bankIndex>=this.banks.length,t.length<3||t.some((s)=>!s.valid||!s.geometry||!s.resistor||!s.led))return;let e=t[0];if(t.some((s)=>!this.index.sameLocalScope(e.resistor,s.resistor)))return;let r=new Set(t.flatMap((s)=>[s.resistorId,s.ledId]));if(!e.nets.some((s)=>{if(this.index.isRail(s))return!1;let o=(this.index.portsByNet.get(s)??[]).filter((c)=>!r.has(c.source_component_id));return o.length<=1&&o.every((c)=>{let l=this.index.placement(c.source_component_id);return l&&this.index.sameLocalScope(e.resistor,l)})}))return;if(!t.some((s,o)=>t.slice(o+1).some((c)=>{let l=s.geometry,a=c.geometry;if(l.axis!==a.axis||Math.abs(l.cross-a.cross)>=(l.thickness+a.thickness)/2)return!1;return Math.min(l.high,a.high)-Math.max(l.low,a.low)<-0.1})))return;this.params.issues.push({lineItemType:"ParallelLedBranchesDrawnInline",branchSchematicBoxes:t.flatMap((s)=>[s.resistor,s.led]),branchCount:t.length,message:`Draw these ${t.length} parallel resistor/LED branches beside each other, with their shared end nodes at corresponding ends, rather than end-to-end in the same row or column. Preserve every pin connection and LED polarity, leave room for labels, and reroute the affected wires.`})}static issueToString(t){let e=[];return v(e,"componentNames",t.branchSchematicBoxes.map((r)=>r.sourceComponentName).filter(Boolean).join(", ")),v(e,"branchCount",t.branchCount),v(e,"message",t.message),`<ParallelLedBranchesDrawnInline ${e.join(" ")} />`}}function Q4(t,e){let{resistor:r,led:n,ports:i}=e;if(!r||!n||!t.sameLocalScope(r,n)||i.some((y)=>y.do_not_connect))return;if([r,n].some((y)=>![y.schX,y.schY,y.width,y.height].every(Number.isFinite)||y.width<=0||y.height<=0))return;let s=i.map((y)=>t.port(y));if(s.some((y)=>!y||y.schematic_sheet_id!==r.schematicSheetId||!Number.isFinite(y.center.x)||!Number.isFinite(y.center.y)))return;let[o,c,l,a]=s,p=fy(o,c);if(!p||fy(l,a)!==p)return;let d=p==="x"?"y":"x",m=s.map((y)=>y.center[d]);if(Math.max(...m)-Math.min(...m)>0.01)return;let f=[o.center[p],c.center[p]],_=[l.center[p],a.center[p]];if(Math.min(Math.max(...f),Math.max(..._))-Math.max(Math.min(...f),Math.min(..._))>0.01)return;let g=s.map((y)=>y.center[p]);return{axis:p,low:Math.min(...g),high:Math.max(...g),cross:m[0],thickness:Math.max(p==="x"?r.height:r.width,p==="x"?n.height:n.width)}}function fy(t,e){let r=new Set([t.facing_direction,e.facing_direction]);if(r.has("left")&&r.has("right")&&Math.abs(t.center.y-e.center.y)<0.01&&Math.abs(t.center.x-e.center.x)>0.01)return"x";if(r.has("up")&&r.has("down")&&Math.abs(t.center.x-e.center.x)<0.01&&Math.abs(t.center.y-e.center.y)>0.01)return"y"}class ln extends U{params;index;crystalIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.crystalIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_crystal").map((e)=>e.source_component_id),this.solved=this.crystalIds.length===0}_step(){let t=this.crystalIds[this.currentIndex++];this.solved=this.currentIndex>=this.crystalIds.length;let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.portsByComponent.get(t)??[];if(r?.ftype!=="simple_crystal"||!Number.isFinite(r.frequency)||r.frequency<=0||this.unpopulated.has(t)||!n||!yy(n)||![2,4].includes(i.length)||i.some((c)=>c.do_not_connect))return;if(i.some((c)=>e.powerNets.has(e.connected(c.source_port_id))))return;let s=i.filter((c)=>!e.groundNets.has(e.connected(c.source_port_id)));if(s.length!==2)return;let o=s.map((c)=>e.connected(c.source_port_id));if(o[0]===o[1])return;for(let[c,l]of s.entries()){let a=o[c],p=e.portsByNet.get(a)??[],d=p.filter((z)=>e.components.get(z.source_component_id)?.ftype==="simple_resistor");if(d.length!==1)continue;let m=d[0],f=m.source_component_id,_=e.components.get(f),g=e.placement(f),y=e.portsByComponent.get(f)??[],S=e.twoTerminalNets(f);if(_?.ftype!=="simple_resistor"||!Number.isFinite(_.resistance)||_.resistance<=0||this.unpopulated.has(f)||!g||!yy(g)||!e.sameLocalScope(n,g)||!S||y.some((z)=>z.do_not_connect)||S.some((z)=>e.isRail(z)))continue;let P=S.find((z)=>z!==a),b=o[1-c];if(!P||P===b)continue;let C=(e.portsByNet.get(P)??[]).filter((z)=>z.source_component_id!==f);if(C.length!==1)continue;let L=C[0],B=L.source_component_id;if(L.do_not_connect||e.components.get(B)?.ftype!=="simple_chip"||this.unpopulated.has(B))continue;let k=e.portsByNet.get(b)??[];if(k.filter((z)=>z.source_component_id===B).length!==1)continue;if(p.some((z)=>z.do_not_connect||![t,f].includes(z.source_component_id)&&!this.isGroundedLoadCapacitor(z,a)))continue;if(k.some((z)=>z.do_not_connect||![t,B].includes(z.source_component_id)&&!this.isGroundedLoadCapacitor(z,b)))continue;let I=e.port(l),j=e.port(m);if(!I||!j||[I,j].some((z)=>z.schematic_sheet_id!==n.schematicSheetId||!Number.isFinite(z.center.x)||!Number.isFinite(z.center.y)))continue;let Q=Math.hypot(I.center.x-j.center.x,I.center.y-j.center.y),lt=Math.max(4,3*Math.max(n.width,n.height,g.width,g.height));if(Q<=lt)continue;this.params.issues.push({lineItemType:"ResistorSeparatedFromCrystal",crystalSchematicBox:n,resistorSchematicBox:g,pinDistance:Q,maxRecommendedPinDistance:lt,message:`Place ${g.sourceComponentName||"the series resistor"} beside ${n.sourceComponentName||"the crystal"} so their shared signal branch is easy to follow. Preserve the original pin connections, leave room for labels and load capacitors, and reroute the affected wires.`})}}isGroundedLoadCapacitor(t,e){if(!t.source_component_id||this.unpopulated.has(t.source_component_id))return!1;let r=this.index.components.get(t.source_component_id),n=this.index.twoTerminalNets(t.source_component_id);return r?.ftype==="simple_capacitor"&&Number.isFinite(r.capacitance)&&r.capacitance>0&&!(this.index.portsByComponent.get(t.source_component_id)??[]).some((i)=>i.do_not_connect)&&Boolean(n?.some((i)=>i!==e&&this.index.groundNets.has(i)))}static issueToString(t){let e=[];return v(e,"crystalName",t.crystalSchematicBox.sourceComponentName),v(e,"resistorName",t.resistorSchematicBox.sourceComponentName),v(e,"pinDistance",t.pinDistance),v(e,"maxRecommendedPinDistance",t.maxRecommendedPinDistance),v(e,"message",t.message),`<ResistorSeparatedFromCrystal ${e.join(" ")} />`}}function yy(t){return[t.schX,t.schY,t.width,t.height].every(Number.isFinite)&&t.width>0&&t.height>0}class pn extends U{params;constructor(t){super();this.params=t}_step(){let{ctx:t,issues:e}=this.params,r=new tt(t),n=new Set(t.circuitJson.flatMap((s)=>s.type==="pcb_component"&&s.do_not_place?[s.source_component_id]:[])),i=(s)=>{let o=r.placement(s),c=r.portsByComponent.get(s);return o&&[o.schX,o.schY,o.width,o.height].every(Number.isFinite)&&o.width>0&&o.height>0&&!n.has(s)&&c?.length===2&&c.every((l)=>{let a=r.port(l);return!l.do_not_connect&&a&&a.schematic_sheet_id===o.schematicSheetId})?o:void 0};for(let s of r.components.values()){if(s.ftype!=="simple_push_button"&&s.ftype!=="simple_switch")continue;let o=s.source_component_id,c=r.twoTerminalNets(o),l=i(o);if(!l||!c||c.filter((N)=>r.groundNets.has(N)).length!==1)continue;let a=c.find((N)=>!r.groundNets.has(N));if(c.some((N)=>r.powerNets.has(N)))continue;let p=r.portsByNet.get(a)??[],d=p.filter((N)=>{let at=r.components.get(N.source_component_id)?.ftype;return at==="simple_switch"||at==="simple_push_button"}),m=p.filter((N)=>r.components.get(N.source_component_id)?.ftype==="simple_capacitor");if(d.length!==1||m.length!==1)continue;let f=m[0].source_component_id,_=r.twoTerminalNets(f),g=i(f);if(!g||!_?.every((N)=>c.includes(N))||!r.sameLocalScope(l,g))continue;let y=new Set([o,f]),S;if(!p.every((N)=>{if(y.has(N.source_component_id))return!0;if(N.do_not_connect)return!1;let at=N.source_component_id,ot=r.placement(at);if(!ot)return!1;if(ot.schematicSheetId!==l.schematicSheetId)return!0;let et=r.components.get(at),it=r.twoTerminalNets(at)?.find((rt)=>rt!==a);if(et?.ftype!=="simple_resistor"||!Number.isFinite(et.resistance)||et.resistance<=0||!i(at)||!r.sameLocalScope(l,ot)||!it||!r.powerNets.has(it)||r.groundNets.has(it)||S!==void 0)return!1;return S=ot,y.add(at),!0}))continue;let b=Ko(l,g),C=_y(l,g),L=b>C,B=S&&Ko(S,g)<Ko(S,l)?g:l,k=S?Ko(S,B):void 0,I=S?_y(S,B):void 0,j=k!==void 0&&k>I;if(!L&&!j)continue;if([...L?[[l,g]]:[],...j?[[B,S]]:[]].some(([N,at])=>t.componentPlacements.some((ot)=>!y.has(ot.sourceComponentId??"")&&ot.schematicSheetId===l.schematicSheetId&&Z4(ot,N,at))))continue;let lt=[l.sourceComponentName||"the switch",g.sourceComponentName||"the capacitor",...S?[S.sourceComponentName||"the pull resistor"]:[]],z=[...L?[g.sourceComponentName||"the capacitor"]:[],...j?[S.sourceComponentName||"the pull resistor"]:[]];e.push({lineItemType:"SwitchRcNetworkNotGrouped",switchSchematicBox:l,capacitorSchematicBox:g,resistorSchematicBox:S,switchCapacitorBodyGap:b,maxRecommendedSwitchCapacitorBodyGap:C,resistorBodyGap:k,maxRecommendedResistorBodyGap:I,message:`Group ${lt.join(", ")} together; ${z.join(" and ")} ${z.length===1?"is":"are"} too far from the local network. Keep the switch and capacitor as adjacent parallel branches, leave room for labels and wires, and preserve every pin connection.`})}this.solved=!0}static issueToString(t){let e=[];return v(e,"switchName",t.switchSchematicBox.sourceComponentName),v(e,"capacitorName",t.capacitorSchematicBox.sourceComponentName),v(e,"resistorName",t.resistorSchematicBox?.sourceComponentName),v(e,"message",t.message),`<SwitchRcNetworkNotGrouped ${e.join(" ")} />`}}function Z4(t,e,r){return t.schX+t.width/2>Math.min(e.schX,r.schX)&&t.schX-t.width/2<Math.max(e.schX,r.schX)+0.01&&t.schY+t.height/2>Math.min(e.schY,r.schY)&&t.schY-t.height/2<Math.max(e.schY,r.schY)+0.01}function Ko(t,e){return Math.hypot(Math.max(0,Math.abs(t.schX-e.schX)-(t.width+e.width)/2),Math.max(0,Math.abs(t.schY-e.schY)-(t.height+e.height)/2))}function _y(t,e){return Math.max(4,2*Math.max(t.width,t.height,e.width,e.height))}function zt(t,e,r,n){return{left:t-r/2,right:t+r/2,top:e+n/2,bottom:e-n/2}}function xr(t,e){let r=Math.min(t.right,e.right)-Math.max(t.left,e.left),n=Math.min(t.top,e.top)-Math.max(t.bottom,e.bottom);return r>0&&n>0?{ow:r,oh:n}:null}function Ke(t){let e=t.anchor_side;if(e==="top"||e==="bottom"){let l=t.anchor_position?.y??t.center.y,a=(t.text?.length??8)*0.13/2+0.1,p=t.center.x-0.1,d=t.center.x+0.1;if(e==="top")return{left:p,right:d,top:l,bottom:l-a*2};return{left:p,right:d,top:l+a*2,bottom:l}}let n=t.anchor_position?.x??t.center.x,s=Math.abs(t.center.x-n)+0.1,o=t.center.y+0.1,c=t.center.y-0.1;if(t.center.x>=n)return{left:n,right:t.center.x+s,top:o,bottom:c};return{left:t.center.x-s,right:n,top:o,bottom:c}}var tr=(t)=>[{x:t.left,y:t.bottom},{x:t.right,y:t.bottom},{x:t.right,y:t.top},{x:t.left,y:t.top}],q4=(t)=>{if(/\s/.test(t))return 0.28;if(/[ilI.,:;!'|]/.test(t))return 0.25;if(/[MW@%]/.test(t))return 0.9;if(/[mw]/.test(t))return 0.8;if(/[A-Z]/.test(t))return 0.67;return 0.56},ts=(t)=>Array.from(t).reduce((e,r)=>e+q4(r),0),gy=(t,e)=>ts(t)*e;function br(t){let e=t.font_size;if(!Number.isFinite(e)||e<=0||!Number.isFinite(t.rotation)||!Number.isFinite(t.position.x)||!Number.isFinite(t.position.y))return[];let r=t.anchor,n=r.includes("left")?0:r.includes("right")?1:0.5,i=r.includes("top")?0:r.includes("bottom")?e:e/2,s=-t.rotation*Math.PI/180,o=Math.cos(s),c=Math.sin(s);return t.text.split(`
`).flatMap((l,a)=>{let p=l.trim();if(!p)return[];let d=l.length-l.trimStart().length,m=(ts(l.slice(0,d))-ts(l)*n)*e;return[tr({left:m,right:m+ts(p)*e,top:i-a*e-e*0.05,bottom:i-(a+1)*e+e*0.05}).map(({x:_,y:g})=>({x:t.position.x+_*o-g*c,y:t.position.y+_*c+g*o}))]})}function Di(t,e){for(let r of[t,e])for(let n=0;n<r.length;n++){let i=r[n],s=r[(n+1)%r.length],o=Math.hypot(s.x-i.x,s.y-i.y);if(o<0.000000001)continue;let c=-(s.y-i.y)/o,l=(s.x-i.x)/o,a=(m)=>m.map(({x:f,y:_})=>f*c+_*l),p=a(t),d=a(e);if(Math.min(Math.max(...p),Math.max(...d))-Math.max(Math.min(...p),Math.min(...d))<=0.000001)return!1}return!0}function Vi(t,e){let r=Math.hypot(e.x-t.x,e.y-t.y);if(r<0.000000001)return;let n=-(e.y-t.y)/r*0.01,i=(e.x-t.x)/r*0.01;return[{x:t.x+n,y:t.y+i},{x:e.x+n,y:e.y+i},{x:e.x-n,y:e.y-i},{x:t.x-n,y:t.y-i}]}function hn(t,e,r){if(Math.hypot(e.x-t.x,e.y-t.y)<0.000000001)return!1;let n=0,i=1;for(let s=0;s<r.length;s++){let o=r[s],c=r[(s+1)%r.length],l=Math.hypot(c.x-o.x,c.y-o.y);if(l<0.000000001)continue;let a=-(c.y-o.y)/l,p=(c.x-o.x)/l,d=(t.x-o.x)*a+(t.y-o.y)*p-0.000001,m=(e.x-o.x)*a+(e.y-o.y)*p-0.000001;if(d<=0&&m<=0)return!1;if(d<=0)n=Math.max(n,-d/(m-d));if(m<=0)i=Math.min(i,-d/(m-d));if(i<=n)return!1}return i>n}var zi=(t)=>{let e=t.flat();return{left:Math.min(...e.map((r)=>r.x)),right:Math.max(...e.map((r)=>r.x)),top:Math.max(...e.map((r)=>r.y)),bottom:Math.min(...e.map((r)=>r.y))}};class vr extends U{params;index;branches;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let r of t.ctx.circuitJson){if(r.type==="pcb_component"&&r.do_not_place)this.unpopulated.add(r.source_component_id);if(r.type!=="source_port")continue;let n=this.index.connected(r.source_port_id);if(r.requires_ground||r.provides_ground)this.index.groundNets.add(n);if(r.requires_power||r.provides_power||r.requires_voltage!==void 0||r.provides_voltage!==void 0)this.index.powerNets.add(n)}let e=this.findBranches();this.branches=e.filter((r)=>{let n=e.filter((i)=>this.index.sameLocalScope(r.switchBox,i.switchBox));return n.some((i)=>i.switchBus===r.switchBus&&i.diodeBus!==r.diodeBus)&&n.some((i)=>i.diodeBus===r.diodeBus&&i.switchBus!==r.switchBus)}),this.solved=this.branches.length===0}_step(){if(this.currentIndex===this.branches.length){this.findMatrixSpacingIssues(),this.solved=!0;return}let t=this.branches[this.currentIndex++],{connectedPinDistance:e,maxRecommendedPinDistance:r,overlapping:n}=this.pairGeometry(t);if(n||e<=r)return;let{switchBox:i,diodeBox:s}=t;this.params.issues.push({lineItemType:"SwitchMatrixDiodeSeparatedFromSwitch",switchSchematicBox:i,diodeSchematicBox:s,switchSourcePortId:t.switchPort.source_port_id,diodeSourcePortId:t.diodePort.source_port_id,connectedPinDistance:e,maxRecommendedPinDistance:r,message:`Place ${s.sourceComponentName||"the series diode"} beside ${i.sourceComponentName||"its switch"} so their private matrix connection is short and easy to follow. Preserve diode polarity and all pin connections, leave room for labels and shared bus connections, and reroute affected traces. Exact alignment is not required.`})}pairGeometry(t){let{switchBox:e,diodeBox:r}=t,n=this.index.port(t.switchPort),i=this.index.port(t.diodePort);return{overlapping:Math.abs(e.schX-r.schX)<(e.width+r.width)/2&&Math.abs(e.schY-r.schY)<(e.height+r.height)/2,connectedPinDistance:Math.hypot(n.center.x-i.center.x,n.center.y-i.center.y),maxRecommendedPinDistance:Math.max(4,3*Math.max(e.width,e.height,r.width,r.height))}}findMatrixSpacingIssues(){let t=new Set(this.branches);while(t.size){let e=[t.values().next().value];t.delete(e[0]);for(let l of e)for(let a of t)if(this.index.sameLocalScope(l.switchBox,a.switchBox)&&(l.switchBus===a.switchBus||l.diodeBus===a.diodeBus))e.push(a),t.delete(a);if(e.some((l)=>{let a=this.pairGeometry(l);return a.overlapping||a.connectedPinDistance>a.maxRecommendedPinDistance}))continue;let r=new Set(e.map((l)=>l.switchBus)),n=new Set(e.map((l)=>l.diodeBus));if(r.size<2||n.size<2||e.length!==r.size*n.size||[...r].some((l)=>n.has(l))||e.some((l,a)=>e.slice(a+1).some((p)=>l.switchBus===p.switchBus&&l.diodeBus===p.diodeBus)))continue;let i=e.flatMap((l)=>[l.switchBox,l.diodeBox]),s=(l)=>({left:Math.min(...l.map((a)=>a.schX-a.width/2)),right:Math.max(...l.map((a)=>a.schX+a.width/2)),bottom:Math.min(...l.map((a)=>a.schY-a.height/2)),top:Math.max(...l.map((a)=>a.schY+a.height/2))}),o=this.occupiedBounds(i[0].schematicSheetId),c;for(let l of["x","y"]){let a=l==="x"?"left":"bottom",p=l==="x"?"right":"top",d=l==="x"?"bottom":"left",m=l==="x"?"top":"right",f=Math.max(4,3*Math.max(...i.map((_)=>l==="x"?_.width:_.height)));for(let _ of["switchBus","diodeBus"]){let g=[...new Set(e.map((y)=>y[_]))].map((y)=>s(e.filter((S)=>S[_]===y).flatMap((S)=>[S.switchBox,S.diodeBox]))).sort((y,S)=>y[a]-S[a]);if(g.some((y,S)=>S>0&&y[a]<g[S-1][p]))continue;for(let y=1;y<g.length;y++){let S=g[y-1],P=g[y];if(Math.min(S[m],P[m])<=Math.max(S[d],P[d]))continue;let b=S[p],C=P[a],L=o.filter((I)=>I[m]>=Math.min(S[d],P[d])&&I[d]<=Math.max(S[m],P[m])&&I[p]>b&&I[a]<C).map((I)=>[Math.max(b,I[a]),Math.min(C,I[p])]).sort((I,j)=>I[0]-j[0]),B=b,k=0;for(let[I,j]of[...L,[C,C]])k=Math.max(k,I-B),B=Math.max(B,j);if(k<=f||c&&k/f<=c.emptyGap/c.maxRecommendedEmptyGap)continue;c={lineItemType:"SwitchMatrixBranchesTooSpreadOut",branchSchematicBoxes:i,axis:l,emptyGap:k,maxRecommendedEmptyGap:f,message:`Bring the connected switch/diode ${l==="x"?"columns":"rows"} closer together by reducing the unused space between them. Keep room for symbols, labels and intervening circuitry; preserve all pin connections and reroute the shared buses. Exact alignment and equal spacing are not required.`}}}}if(c)this.params.issues.push(c)}}occupiedBounds(t){let e=[],r=new Map(this.params.ctx.componentPlacements.map((n)=>[n.schematicComponentId,n.schematicSheetId]));for(let n of this.params.ctx.circuitJson){let i=[];if(n.type==="schematic_component"&&n.schematic_sheet_id===t)i=[zt(n.center.x,n.center.y,n.size.width,n.size.height)];if(n.type==="schematic_port"&&n.schematic_sheet_id===t)i=[zt(n.center.x,n.center.y,0,0)];if(n.type==="schematic_net_label"&&n.schematic_sheet_id===t)i=[Ke(n)];if(n.type==="schematic_text"&&(n.schematic_sheet_id??r.get(n.schematic_component_id))===t)i=br(n).map((s)=>zi([s]));for(let s of i){if(!Object.values(s).every(Number.isFinite))continue;e.push({left:s.left-0.5,right:s.right+0.5,bottom:s.bottom-0.5,top:s.top+0.5})}}return e}findBranches(){let t=this.index,e=[];for(let r of t.components.values()){if(r.ftype!=="simple_push_button"&&r.ftype!=="simple_switch")continue;let n=r.source_component_id,i=this.localPart(n);if(!i)continue;let s=i.ports.flatMap((o)=>{let c=t.connected(o.source_port_id),l=t.portsByNet.get(c)??[];if(l.length!==2)return[];let a=l.find((f)=>f.source_component_id!==n);if(!a||t.components.get(a.source_component_id)?.ftype!=="simple_diode")return[];let p=this.localPart(a.source_component_id);if(!p||!t.sameLocalScope(i.box,p.box))return[];let d=i.nets.find((f)=>f!==c),m=p.nets.find((f)=>f!==c);if(d===m||[c,d,m].some((f)=>t.isRail(f))||[d,m].some((f)=>(t.portsByNet.get(f)?.length??0)<2))return[];return[{switchBox:i.box,diodeBox:p.box,switchPort:o,diodePort:a,switchBus:d,diodeBus:m}]});if(s.length===1)e.push(s[0])}return e}localPart(t){let e=this.index,r=e.placement(t),n=e.portsByComponent.get(t),i=e.twoTerminalNets(t);if(this.unpopulated.has(t)||!r||n?.length!==2||!i||![r.schX,r.schY,r.width,r.height].every(Number.isFinite)||r.width<=0||r.height<=0||n.some((s)=>{let o=e.port(s);return s.do_not_connect||!o||o.schematic_sheet_id!==r.schematicSheetId||!Number.isFinite(o.center.x)||!Number.isFinite(o.center.y)}))return;return{box:r,ports:n,nets:i}}static issueToString(t){let e=[];if(t.lineItemType==="SwitchMatrixBranchesTooSpreadOut")return v(e,"axis",t.axis),v(e,"emptyGap",t.emptyGap),v(e,"maxRecommendedEmptyGap",t.maxRecommendedEmptyGap),v(e,"message",t.message),`<SwitchMatrixBranchesTooSpreadOut ${e.join(" ")} />`;return v(e,"switchName",t.switchSchematicBox.sourceComponentName),v(e,"diodeName",t.diodeSchematicBox.sourceComponentName),v(e,"connectedPinDistance",t.connectedPinDistance),v(e,"maxRecommendedPinDistance",t.maxRecommendedPinDistance),v(e,"message",t.message),`<SwitchMatrixDiodeSeparatedFromSwitch ${e.join(" ")} />`}}class dn extends U{params;index;resistorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type!=="source_port")continue;let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}this.resistorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_resistor").map((e)=>e.source_component_id),this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];this.solved=this.currentIndex>=this.resistorIds.length;let e=this.index,r=e.components.get(t),n=this.localPart(t),i=e.twoTerminalNets(t);if(r?.ftype!=="simple_resistor"||!Number.isFinite(r.resistance)||r.resistance<=0||!n||!i||i.some((k)=>e.isRail(k)))return;let s=i.flatMap((k)=>{let I=e.portsByNet.get(k)??[];if(I.length!==2||I.some((N)=>N.do_not_connect))return[];let Q=I.find((N)=>N.source_component_id!==t).source_component_id,lt=e.placement(Q),z=e.components.get(Q)?.ftype;if(z!=="simple_chip"&&z!=="simple_op_amp"||(e.portsByComponent.get(Q)?.length??0)<3||this.unpopulated.has(Q)||!lt||!e.sameLocalScope(n.placement,lt))return[];return[{net:k,hostId:Q}]});if(s.length!==1)return;let o=s[0],c=i.find((k)=>k!==o.net),l=e.portsByNet.get(c)??[];if(l.some((k)=>k.do_not_connect||k.source_component_id===o.hostId))return;let a=l.filter((k)=>e.components.get(k.source_component_id)?.ftype==="simple_capacitor");if(a.length!==1)return;let p=a[0],d=p.source_component_id,m=e.components.get(d),f=this.localPart(d),g=e.twoTerminalNets(d)?.find((k)=>k!==c);if(m?.ftype!=="simple_capacitor"||!Number.isFinite(m.capacitance)||m.capacitance<=0||!f||!g||!e.groundNets.has(g)||e.powerNets.has(g)||!e.sameLocalScope(n.placement,f.placement))return;if(l.some((k)=>{if(k.source_component_id===t||k.source_component_id===d)return!1;let I=e.components.get(k.source_component_id)?.ftype;if(I==="simple_chip"||I==="simple_op_amp")return!1;let j=e.placement(k.source_component_id);return!j||j.schematicSheetId===n.placement.schematicSheetId}))return;let y=n.placement,S=f.placement;if(Math.abs(y.schX-S.schX)<(y.width+S.width)/2&&Math.abs(y.schY-S.schY)<(y.height+S.height)/2)return;let P=n.ports.find((k)=>e.connected(k.source_port_id)===c),b=e.port(P),C=e.port(p),L=Math.hypot(b.center.x-C.center.x,b.center.y-C.center.y),B=Math.max(4,3*Math.max(y.width,y.height,S.width,S.height));if(L<=B)return;this.params.issues.push({lineItemType:"SeriesRcFilterComponentsNotGrouped",resistorSchematicBox:y,capacitorSchematicBox:S,resistorSourcePortId:P.source_port_id,capacitorSourcePortId:p.source_port_id,signalPinDistance:L,maxRecommendedSignalPinDistance:B,message:`Group ${y.sourceComponentName||"the resistor"} and ${S.sourceComponentName||"the capacitor"} so the series signal path and its grounded capacitor can be read together. Preserve all pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}localPart(t){let e=this.index.placement(t),r=this.index.portsByComponent.get(t);if(this.unpopulated.has(t)||!e||r?.length!==2||![e.schX,e.schY,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0||r.some((n)=>!this.validPin(n,e.schematicSheetId)))return;return{placement:e,ports:r}}validPin(t,e){let r=this.index.port(t);return!t.do_not_connect&&r&&r.schematic_sheet_id===e&&Number.isFinite(r.center.x)&&Number.isFinite(r.center.y)}static issueToString(t){let e=[];return v(e,"resistorName",t.resistorSchematicBox.sourceComponentName),v(e,"capacitorName",t.capacitorSchematicBox.sourceComponentName),v(e,"signalPinDistance",t.signalPinDistance),v(e,"maxRecommendedSignalPinDistance",t.maxRecommendedSignalPinDistance),v(e,"message",t.message),`<SeriesRcFilterComponentsNotGrouped ${e.join(" ")} />`}}class mn extends U{params;index;banks;bankIndex=0;constructor(t){super();this.params=t;let e=this.index=new tt(t.ctx),r=new Set(t.ctx.circuitJson.flatMap((i)=>i.type==="pcb_component"&&i.do_not_place?[i.source_component_id]:[])),n=new Map;for(let i of e.components.values()){if(i.ftype!=="simple_resistor")continue;let s=i.source_component_id,o=e.twoTerminalNets(s)?.sort();if(!o)continue;let c=JSON.stringify(o),l=n.get(c)??{nets:o,members:[]},a={id:s,box:e.placement(s)};if(l.members.push(a),n.set(c,l),!a.box||r.has(s)||!Number.isFinite(i.resistance)||i.resistance<=0)continue;let p=e.portsByComponent.get(s);if(p.some((f)=>f.do_not_connect))continue;let[d,m]=p.map((f)=>e.port(f));if(!d||!m||[d,m].some((f)=>f.schematic_sheet_id!==a.box.schematicSheetId))continue;a.pins=[d,m],a.axis=J4(d,m)}this.banks=[...n.values()],this.solved=this.banks.length===0}_step(){let{nets:t,members:e}=this.banks[this.bankIndex++];if(this.solved=this.bankIndex>=this.banks.length,e.length!==2)return;let[r,n]=e;if(!r?.box||!n?.box||!r.pins||!n.pins||!r.axis||r.axis!==n.axis)return;let i=r.box,s=n.box;if(!this.index.sameLocalScope(i,s))return;if(!t.some((f)=>{if(this.index.isRail(f))return!1;let _=(this.index.portsByNet.get(f)??[]).filter((g)=>g.source_component_id!==r.id&&g.source_component_id!==n.id);return _.length<=1&&_.every((g)=>{let y=this.index.placement(g.source_component_id);return y&&this.index.sameLocalScope(i,y)})}))return;let c=r.axis;if((c==="x"?(i.height+s.height)/2-Math.abs(i.schY-s.schY):(i.width+s.width)/2-Math.abs(i.schX-s.schX))<=0.01)return;if((c==="x"?(i.width+s.width)/2-Math.abs(i.schX-s.schX):(i.height+s.height)/2-Math.abs(i.schY-s.schY))>0)return;let p=r.pins.map((f)=>f.center[c]),d=n.pins.map((f)=>f.center[c]);if(Math.min(Math.max(...p),Math.max(...d))-Math.max(Math.min(...p),Math.min(...d))>0.01)return;this.params.issues.push({lineItemType:"ParallelResistorsDrawnInline",firstResistorSchematicBox:i,secondResistorSchematicBox:s,message:`Draw ${i.sourceComponentName||"the first resistor"} and ${s.sourceComponentName||"the second resistor"} beside each other as two parallel branches between their shared nets. Preserve both resistors' connections, leave room for labels, and reroute the affected wires.`})}static issueToString(t){let e=[];return v(e,"firstResistorName",t.firstResistorSchematicBox.sourceComponentName),v(e,"secondResistorName",t.secondResistorSchematicBox.sourceComponentName),v(e,"message",t.message),`<ParallelResistorsDrawnInline ${e.join(" ")} />`}}function J4(t,e){let r=new Set([t.facing_direction,e.facing_direction]);if(r.has("left")&&r.has("right")&&Math.abs(t.center.y-e.center.y)<0.01&&Math.abs(t.center.x-e.center.x)>0.01)return"x";if(r.has("up")&&r.has("down")&&Math.abs(t.center.x-e.center.x)<0.01&&Math.abs(t.center.y-e.center.y)>0.01)return"y"}class un extends U{params;index;banks;bankIndex=0;constructor(t){super();this.params=t;let e=this.index=new tt(t.ctx),r=new Set(t.ctx.circuitJson.flatMap((i)=>i.type==="pcb_component"&&i.do_not_place?[i.source_component_id]:[])),n=new Map;for(let i of e.components.values()){if(i.ftype!=="simple_capacitor")continue;let s=i.source_component_id,o=e.twoTerminalNets(s)?.sort();if(!o)continue;let c=JSON.stringify(o),l=n.get(c)??[],a={box:e.placement(s)};if(l.push(a),n.set(c,l),!a.box||r.has(s)||!Number.isFinite(i.capacitance)||i.capacitance<=0)continue;let p=e.portsByComponent.get(s);if(p.some((f)=>f.do_not_connect))continue;let[d,m]=p.map((f)=>e.port(f));if(!d||!m||[d,m].some((f)=>f.schematic_sheet_id!==a.box.schematicSheetId))continue;a.pins=[d,m],a.axis=K4(d,m)}this.banks=[...n.values()],this.solved=this.banks.length===0}_step(){let t=this.banks[this.bankIndex++];if(this.solved=this.bankIndex>=this.banks.length,t.length!==2)return;let[e,r]=t;if(!e?.box||!r?.box||!e.pins||!r.pins||!e.axis||e.axis!==r.axis)return;let n=e.box,i=r.box;if(!this.index.sameLocalScope(n,i))return;if([n.width,n.height,i.width,i.height].some((_)=>!Number.isFinite(_)||_<=0))return;let s=Math.max(n.width,n.height,i.width,i.height);if(!Number.isFinite(s)||s<=0)return;let o=e.axis,c=Math.abs(o==="x"?n.schX-i.schX:n.schY-i.schY),l=Math.abs(o==="x"?n.schY-i.schY:n.schX-i.schX);if(!Number.isFinite(c)||!Number.isFinite(l))return;if(c<s||c>3*s||l>s/4)return;if((o==="x"?(n.height+i.height)/2-Math.abs(n.schY-i.schY):(n.width+i.width)/2-Math.abs(n.schX-i.schX))<=0.01)return;if((o==="x"?(n.width+i.width)/2-Math.abs(n.schX-i.schX):(n.height+i.height)/2-Math.abs(n.schY-i.schY))>0)return;let d=e.pins.map((_)=>_.center[o]),m=r.pins.map((_)=>_.center[o]);if(Math.min(Math.max(...d),Math.max(...m))-Math.max(Math.min(...d),Math.min(...m))>0.01)return;this.params.issues.push({lineItemType:"ParallelCapacitorsDrawnInline",firstCapacitorSchematicBox:n,secondCapacitorSchematicBox:i,message:`Draw ${n.sourceComponentName||"the first capacitor"} and ${i.sourceComponentName||"the second capacitor"} beside each other as two parallel branches between their shared nets. Preserve both capacitors' connections, leave room for labels, and reroute the affected wires.`})}static issueToString(t){let e=[];return v(e,"firstCapacitorName",t.firstCapacitorSchematicBox.sourceComponentName),v(e,"secondCapacitorName",t.secondCapacitorSchematicBox.sourceComponentName),v(e,"message",t.message),`<ParallelCapacitorsDrawnInline ${e.join(" ")} />`}}function K4(t,e){if(![t.center.x,t.center.y,e.center.x,e.center.y].every(Number.isFinite))return;let r=new Set([t.facing_direction,e.facing_direction]);if(r.has("left")&&r.has("right")&&Math.abs(t.center.y-e.center.y)<0.01&&Math.abs(t.center.x-e.center.x)>0.01)return"x";if(r.has("up")&&r.has("down")&&Math.abs(t.center.x-e.center.x)<0.01&&Math.abs(t.center.y-e.center.y)>0.01)return"y"}class fn extends U{params;index;crystalIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);this.crystalIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_crystal").map((e)=>e.source_component_id),this.solved=this.crystalIds.length===0}_step(){let t=this.crystalIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.crystalIds.length,!t||this.unpopulated.has(t))return;let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.portsByComponent.get(t)??[],s=e.twoTerminalNets(t);if(r?.ftype!=="simple_crystal"||!Number.isFinite(r.frequency)||r.frequency<=0||!n||!s||s.some((I)=>e.isRail(I))||i.some((I)=>I.do_not_connect||Ul(I)))return;let o=s.map((I)=>{let j=e.portsByNet.get(I)??[];if(j.length!==2)return;return j.find((Q)=>Q.source_component_id!==t)}),[c,l]=o;if(!c||!l||c.source_component_id!==l.source_component_id||c.do_not_connect||l.do_not_connect||Ul(c)||Ul(l))return;let a=c.source_component_id,p=e.placement(a);if(e.components.get(a)?.ftype!=="simple_chip"||this.unpopulated.has(a)||!p||!e.sameLocalScope(p,n))return;let d=[c,l],m=d.map((I)=>e.port(I)),f=i.map((I)=>e.port(I));if([...m,...f].some((I)=>!I||I.schematic_sheet_id!==p.schematicSheetId||!Number.isFinite(I.center.x)||!Number.isFinite(I.center.y))||[p,n].some((I)=>![I.schX,I.schY,I.width,I.height].every(Number.isFinite)||I.width<=0||I.height<=0))return;let _=m[0],g=m[1],y=_.facing_direction;if(!y||y!==g.facing_direction)return;let S=y==="left"||y==="right",P=y==="left"||y==="down"?-1:1,b=Math.hypot(_.center.x-g.center.x,_.center.y-g.center.y);if(b<0.01)return;let C=-P*(S?n.schX-p.schX:n.schY-p.schY),L=S?(p.width+n.width)/2:(p.height+n.height)/2;if(C<=L+0.2)return;let B=Math.max(...m.map((I,j)=>Math.hypot(I.center.x-f[j].center.x,I.center.y-f[j].center.y))),k=Math.max(4,3*Math.max(n.width,n.height),2*b);if(B<=k)return;this.params.issues.push({lineItemType:"CrystalSeparatedFromChipPins",hostSchematicBox:p,crystalSchematicBox:n,chipSourcePortIds:[d[0].source_port_id,d[1].source_port_id],maxPinDistance:B,maxRecommendedPinDistance:k,message:`Place ${n.sourceComponentName||"component"} beside its two connected pins on the ${y} side of ${p.sourceComponentName||"component"} so their connections can be read together. Preserve pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}static issueToString(t){let e=[];return v(e,"hostComponentName",t.hostSchematicBox.sourceComponentName),v(e,"crystalName",t.crystalSchematicBox.sourceComponentName),v(e,"maxPinDistance",t.maxPinDistance),v(e,"maxRecommendedPinDistance",t.maxRecommendedPinDistance),v(e,"message",t.message),`<CrystalSeparatedFromChipPins ${e.join(" ")} />`}}function Ul(t){return Boolean(t.requires_power||t.provides_power||t.requires_ground||t.provides_ground||t.requires_voltage!==void 0||t.provides_voltage!==void 0)}function er(t){return new Set(t.flatMap((e)=>e.type==="schematic_component"&&e.is_box_with_pins!==!1&&!e.symbol_name&&!e.schematic_symbol_id?[e.schematic_component_id]:[]))}var Gl=(t)=>{switch(t){case"up":return{x:0,y:1};case"down":return{x:0,y:-1};case"left":return{x:-1,y:0};case"right":return{x:1,y:0}}};var es=0.1,Sy=0.15,yn=0.02,be=0.1,e5=0.000000001;function we(t,e){if(!t)return 0;let n=Gl(t==="top"?"up":t==="bottom"?"down":t);return(e==="width"?n.x:n.y)/2}function ns(t){if(t.display_pin_label_text_parts?.length)return t.display_pin_label_text_parts.map((r)=>r.text).join("");let e=t.display_pin_label??"";return e.startsWith("N_")?e.slice(2):e}function is(t){return t.display_pin_label_font_size??((t.display_pin_label??"").startsWith("N_")||t.is_drawn_with_inversion_circle?Sy*0.8:Sy)}var _n=(t)=>gy(ns(t),is(t));function Sr(t,e,r){let n={left:t.schX-t.width/2,right:t.schX+t.width/2,top:t.schY+t.height/2,bottom:t.schY-t.height/2},i=[];for(let s of e){if(!s.side_of_component)continue;if(!s.display_pin_label)continue;let o=ns(s),c=is(s);if(!o||!Number.isFinite(c)||c<=0)continue;let l=r(s),a=c/2,p={text:o,schematicPortId:s.schematic_port_id};switch(s.side_of_component){case"left":{let d=n.left+es;i.push({...p,side:s.side_of_component,xMin:d,xMax:d+l,yMin:s.center.y-a,yMax:s.center.y+a});break}case"right":{let d=n.right-es;i.push({...p,side:s.side_of_component,xMin:d-l,xMax:d,yMin:s.center.y-a,yMax:s.center.y+a});break}case"top":{let d=n.top-es;i.push({...p,side:s.side_of_component,xMin:s.center.x-a,xMax:s.center.x+a,yMin:d-l,yMax:d});break}case"bottom":{let d=n.bottom+es;i.push({...p,side:s.side_of_component,xMin:s.center.x-a,xMax:s.center.x+a,yMin:d,yMax:d+l});break}}}return i}function wy(t){let{bounds:e,side:r}=t,i=(r==="left"||r==="right"?e.top-e.bottom:e.right-e.left)*0.2;return{left:e.left-i,right:e.right+i,top:e.top+i,bottom:e.bottom-i}}function wr(t,e,r=yn){return rs(t.xMin,t.xMax,e.xMin,e.xMax,r)&&rs(t.yMin,t.yMax,e.yMin,e.yMax,r)}function rs(t,e,r,n,i=yn){return Math.min(e,n)-Math.max(t,r)+i>e5}var Hl=0.000000001,Ay=0.1;class gn extends U{params;entries;currentIndex=0;constructor(t){super();this.params=t;let e=er(t.ctx.circuitJson),r=new Map;for(let n of t.ctx.circuitJson){if(n.type!=="schematic_port")continue;let i=n.schematic_component_id;if(!i)continue;let s=r.get(i)??[];s.push(n),r.set(i,s)}this.entries=t.ctx.componentPlacements.flatMap((n)=>n.schematicComponentId&&e.has(n.schematicComponentId)?[[n,r.get(n.schematicComponentId)??[]]]:[]),this.solved=this.entries.length===0}_step(){let t=this.entries[this.currentIndex++];if(this.solved=this.currentIndex>=this.entries.length,!t)return;let[e,r]=t,n=Sr(e,r,_n),i=n.flatMap((o)=>{let c=this.getEdgeOverflows(e,o).filter(([,l])=>l>Hl).map(([l])=>l);return c.length?[{schematicPortId:o.schematicPortId,text:o.text,side:o.side,bounds:{left:o.xMin,right:o.xMax,bottom:o.yMin,top:o.yMax},outsideEdges:c}]:[]});if(!i.length)return;let s=this.getSuggestedDimensions(e,n);this.params.issues.push({lineItemType:"SchematicBoxInnerLabelOutOfBounds",schematicBox:e,overflowingLabels:i,...s,message:`Inner pin labels extend outside the schematic box. Increase ${s.suggestedSchWidth&&s.suggestedSchHeight?"schWidth and schHeight":s.suggestedSchWidth?"schWidth":"schHeight"} to contain the labels with ${Ay} schematic units of edge clearance.`})}getEdgeOverflows(t,e){return[["left",t.schX-t.width/2-e.xMin],["right",e.xMax-(t.schX+t.width/2)],["bottom",t.schY-t.height/2-e.yMin],["top",e.yMax-(t.schY+t.height/2)]]}getSuggestedDimensions(t,e){let r={width:0,height:0};for(let i of e)for(let[s,o]of this.getEdgeOverflows(t,i)){let c=s==="left"||s==="right"?"width":"height",a=0.5-(s==="left"||s==="bottom"?-1:1)*we(i.side,c);if(a<=0)continue;r[c]=Math.max(r[c],(o+Ay)/a)}let n=(i,s)=>s>Hl?Math.ceil((i+s)*1000-Hl)/1000:void 0;return{suggestedSchWidth:n(t.width,r.width),suggestedSchHeight:n(t.height,r.height)}}static issueToString(t){let e=[];v(e,"message",t.message),v(e,"componentName",t.schematicBox.sourceComponentName),v(e,"currentSchWidth",t.schematicBox.width),v(e,"currentSchHeight",t.schematicBox.height),v(e,"suggestedSchWidth",t.suggestedSchWidth),v(e,"suggestedSchHeight",t.suggestedSchHeight);let r=t.overflowingLabels.map((n)=>{let i=[];return v(i,"text",n.text),v(i,"port",n.schematicPortId),v(i,"side",n.side),v(i,"outsideEdges",n.outsideEdges.join(",")),`  <PinLabel ${i.join(" ")} />`});return`<SchematicBoxInnerLabelOutOfBounds ${e.join(" ")}>
${r.join(`
`)}
</SchematicBoxInnerLabelOutOfBounds>`}}var Ql={up:"down",down:"up",left:"right",right:"left"};class xn extends U{params;index;positiveNets=new Set;groundNets=new Set;unpopulated=new Set;transistorIds;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.groundNets=new Set(this.index.groundNets);for(let e of t.ctx.circuitJson){if(e.type==="source_net"&&e.is_positive_voltage_source)this.positiveNets.add(this.index.connected(e.source_net_id));if(e.type==="source_port"&&(e.requires_ground||e.provides_ground))this.groundNets.add(this.index.connected(e.source_port_id));if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id)}this.transistorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_transistor"&&(e.transistor_type==="npn"||e.transistor_type==="pnp")).map((e)=>e.source_component_id),this.solved=this.transistorIds.length===0}_step(){let t=this.transistorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.transistorIds.length,!t)return;let e=this.index,r=this.validPlacement(t),n=e.portsByComponent.get(t);if(!r||n?.length!==3||n.some((b)=>b.do_not_connect||!this.validPort(b)))return;let i=n.map((b)=>e.connected(b.source_port_id));if(new Set(i).size!==3||i.some((b)=>e.isRail(b)||this.groundNets.has(b)))return;let s=n.flatMap((b)=>this.resistorBranches(b)),o=s.flatMap((b)=>b.kind!=="positive"?[]:s.flatMap((C)=>{if(C.kind!=="ground"||C.pin.source_port_id===b.pin.source_port_id)return[];if(Ql[b.geometry.facing_direction]!==C.geometry.facing_direction)return[];return[{supply:b,ground:C}]}));if(o.length!==1)return;let{supply:c,ground:l}=o[0],a=c.geometry.facing_direction,p=a==="up"||a==="down",d=c.geometry.center.x-l.geometry.center.x,m=c.geometry.center.y-l.geometry.center.y,f=p?m:d,_=p?d:m,g=a==="up"||a==="right"?1:-1;if(Math.abs(_)>0.01||f*g<=0.01)return;if(a==="up")return;let y=n.find((b)=>b.source_port_id!==c.pin.source_port_id&&b.source_port_id!==l.pin.source_port_id),S=this.validPort(y).facing_direction;if(S===a||S===Ql[a])return;let P={right:90,down:180,left:270}[a];this.params.issues.push({lineItemType:"TransistorHasIncorrectRailOrientation",transistorSchematicBox:r,supplyResistorSchematicBox:c.box,groundResistorSchematicBox:l.box,supplyConnectedSourcePortId:c.pin.source_port_id,groundConnectedSourcePortId:l.pin.source_port_id,deltaSchRotation:P,message:`Rotate ${r.sourceComponentName||"the transistor"} by ${P}° so its pin connected through ${c.box.sourceComponentName||"the supply resistor"} to the positive supply faces up and its pin connected through ${l.box.sourceComponentName||"the ground resistor"} to ground faces down. Arrange these resistor branches above and below it, preserve all pin connections, and reroute affected traces.`})}resistorBranches(t){let e=this.index,r=e.placement(t.source_component_id),n=this.validPort(t),i=e.connected(t.source_port_id);return(e.portsByNet.get(i)??[]).flatMap((s)=>{let o=e.components.get(s.source_component_id);if(o?.ftype!=="simple_resistor"||!Number.isFinite(o.resistance)||o.resistance<=0)return[];let c=this.validPlacement(o.source_component_id),l=e.twoTerminalNets(o.source_component_id),a=e.portsByComponent.get(o.source_component_id);if(!c||!l||!a||!e.sameLocalScope(r,c)||a.some((f)=>f.do_not_connect||!this.validPort(f)))return[];let p=l.find((f)=>f!==i),d=this.positiveNets.has(p),m=this.groundNets.has(p);if(d===m||m&&e.powerNets.has(p))return[];return[{pin:t,geometry:n,box:c,kind:d?"positive":"ground"}]})}validPlacement(t){if(this.unpopulated.has(t))return;let e=this.index.placement(t);if(!e||![e.schX,e.schY,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0)return;return e}validPort(t){let e=this.index.placement(t.source_component_id),r=this.index.port(t);if(!e||!r||r.schematic_sheet_id!==e.schematicSheetId||!Number.isFinite(r.center.x)||!Number.isFinite(r.center.y)||!r.facing_direction||!(r.facing_direction in Ql))return;return r}static issueToString(t){let e=[];return v(e,"transistorName",t.transistorSchematicBox.sourceComponentName),v(e,"supplyResistorName",t.supplyResistorSchematicBox.sourceComponentName),v(e,"groundResistorName",t.groundResistorSchematicBox.sourceComponentName),v(e,"deltaSchRotation",t.deltaSchRotation),v(e,"message",t.message),`<TransistorHasIncorrectRailOrientation ${e.join(" ")} />`}}class bn extends U{params;index;inductorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_power||e.provides_power)this.index.powerNets.add(r);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r)}}this.inductorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_inductor").map((e)=>e.source_component_id),this.solved=this.inductorIds.length===0}_step(){let t=this.inductorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.inductorIds.length,!t||this.unpopulated.has(t))return;let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.twoTerminalNets(t),s=e.portsByComponent.get(t)??[];if(r?.ftype!=="simple_inductor"||!n||!i||s.some((b)=>b.do_not_connect))return;let o=i.filter((b)=>e.powerNets.has(b));if(o.length!==1||i.some((b)=>e.groundNets.has(b)))return;let c=o[0],l=i.find((b)=>b!==c),a=e.portsByNet.get(l)??[];if(a.length!==2)return;let p=a.find((b)=>b.source_component_id!==t),d=a.find((b)=>b.source_component_id===t);if(!p||!d||p.do_not_connect)return;let m=p.source_component_id,f=e.placement(m);if(e.components.get(m)?.ftype!=="simple_chip"||(e.portsByComponent.get(m)?.length??0)<3||this.unpopulated.has(m)||!f||!e.sameLocalScope(f,n))return;let _=(e.portsByNet.get(c)??[]).filter((b)=>b.source_component_id===m);if(_.length===0||_.some((b)=>b.do_not_connect))return;let g=e.port(p),y=e.port(d);if(!g||!y||[f,n].some((b)=>![b.schX,b.schY,b.width,b.height].every(Number.isFinite)||b.width<=0||b.height<=0)||[g,y].some((b)=>b.schematic_sheet_id!==f.schematicSheetId||!Number.isFinite(b.center.x)||!Number.isFinite(b.center.y)))return;let S=Math.hypot(g.center.x-y.center.x,g.center.y-y.center.y),P=Math.max(6,3*Math.max(n.width,n.height));if(S<=P)return;this.params.issues.push({lineItemType:"InductorSeparatedFromChipPin",hostSchematicBox:f,inductorSchematicBox:n,chipSourcePortId:p.source_port_id,inductorSourcePortId:d.source_port_id,powerSourcePortIds:_.map((b)=>b.source_port_id),pinDistance:S,maxRecommendedPinDistance:P,message:`Place ${n.sourceComponentName||"inductor"} near its directly connected pin on ${f.sourceComponentName||"chip"} so the inductor and its supply return to the chip can be read together. Preserve pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}static issueToString(t){let e=[];return v(e,"hostComponentName",t.hostSchematicBox.sourceComponentName),v(e,"inductorName",t.inductorSchematicBox.sourceComponentName),v(e,"pinDistance",t.pinDistance),v(e,"maxRecommendedPinDistance",t.maxRecommendedPinDistance),v(e,"message",t.message),`<InductorSeparatedFromChipPin ${e.join(" ")} />`}}class vn extends U{params;index;nets;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_power||e.provides_power)this.index.powerNets.add(r);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r)}}this.nets=[...this.index.powerNets],this.solved=this.nets.length===0}_step(){let t=this.nets[this.currentIndex++];if(this.solved=this.currentIndex>=this.nets.length,!t||this.index.groundNets.has(t))return;let e=this.index,r=(e.portsByNet.get(t)??[]).filter((y)=>e.components.get(y.source_component_id)?.ftype==="simple_diode");if(r.length!==2||r[0].source_component_id===r[1].source_component_id)return;let n=this.diode(r[0].source_component_id),i=this.diode(r[1].source_component_id);if(!n||!i)return;let s=n.nets.find((y)=>y!==t),o=i.nets.find((y)=>y!==t);if(!s||!o||s===o||e.groundNets.has(s)||e.groundNets.has(o))return;if(n.box.schematicSheetId!==i.box.schematicSheetId||n.box.subcircuitId!==i.box.subcircuitId)return;if(!n.box.schematicSheetId&&!e.sameLocalScope(n.box,i.box))return;let c=e.port(r[0]),l=e.port(r[1]);if(!c||!l||c.schematic_sheet_id!==n.box.schematicSheetId||l.schematic_sheet_id!==i.box.schematicSheetId)return;let a=c.facing_direction;if(!a||a!==l.facing_direction||!["up","down","left","right"].includes(a))return;let p=a==="up"||a==="down",d=Math.abs(p?c.center.y-l.center.y:c.center.x-l.center.x),m=Math.abs(p?c.center.x-l.center.x:c.center.y-l.center.y),f=Math.max(p?n.box.height:n.box.width,p?i.box.height:i.box.width),_=Math.max(p?n.box.width:n.box.height,p?i.box.width:i.box.height);if(d<=Math.max(2,2*f)||d>12||m>=_)return;let g=[n.box,i.box].map((y)=>y.sourceComponentName||"diode");this.params.issues.push({lineItemType:"SharedNodeDiodesInline",diodeSchematicBoxes:[n.box,i.box],sharedSourcePortIds:[c.source_port_id,l.source_port_id],inlinePinSeparation:d,message:`Place ${g.join(" and ")} in adjacent ${p?"columns":"rows"} so their shared power connection reads as two branches. Preserve orientations and pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}diode(t){if(this.unpopulated.has(t))return;let e=this.index,r=e.placement(t),n=e.twoTerminalNets(t),i=e.portsByComponent.get(t);if(!r||!n||!i||i.some((o)=>o.do_not_connect))return;if(![r.schX,r.schY,r.width,r.height].every(Number.isFinite)||r.width<=0||r.height<=0)return;if(i.map((o)=>e.port(o)).some((o)=>!o||!Number.isFinite(o.center.x)||!Number.isFinite(o.center.y)))return;return{box:r,nets:n}}static issueToString(t){let e=[];return v(e,"diodeNames",t.diodeSchematicBoxes.map((r)=>r.sourceComponentName).join(",")),v(e,"inlinePinSeparation",t.inlinePinSeparation),v(e,"message",t.message),`<SharedNodeDiodesInline ${e.join(" ")} />`}}class Sn extends U{params;index;nets;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power)this.index.powerNets.add(r)}}this.nets=[...this.index.portsByNet.keys()],this.solved=this.nets.length===0}_step(){let t=this.nets[this.currentIndex++];if(this.solved=this.currentIndex>=this.nets.length,!t||this.index.isRail(t))return;let e=this.index,r=e.portsByNet.get(t);if(r.length!==3||new Set(r.map((B)=>B.source_component_id)).size!==3)return;let n=r.map((B)=>this.localPart(B.source_component_id));if(n.some((B)=>!B))return;let i=n.filter((B)=>B.component.ftype==="simple_diode"),s=n.filter((B)=>B.component.ftype==="simple_capacitor");if(i.length!==2||s.length!==1)return;let o=s[0],c=i[0],l=i[1];if(![c,l].every((B)=>e.sameLocalScope(o.placement,B.placement)))return;let a=(B)=>B.nets.find((k)=>k!==t),p=[a(c),a(l)],d=p.filter((B)=>e.groundNets.has(B));if(d.length!==1)return;let m=d[0],f=p.find((B)=>B!==m),_=a(o);if(_===f||_===m||e.isRail(_))return;let y=[...new Set((e.portsByNet.get(f)??[]).filter((B)=>e.components.get(B.source_component_id)?.ftype==="simple_capacitor").map((B)=>B.source_component_id))].filter((B)=>e.twoTerminalNets(B)?.includes(m));if(!y.length||y.some((B)=>{let k=this.localPart(B);return!k||!e.sameLocalScope(o.placement,k.placement)}))return;let S=[o.placement,c.placement,l.placement],P=r.map((B)=>e.port(B)),b=Math.max(...P.flatMap((B,k)=>P.slice(k+1).map((I)=>Math.hypot(B.center.x-I.center.x,B.center.y-I.center.y)))),C=Math.max(4,...S.map((B)=>3*Math.max(B.width,B.height)));if(b<=C)return;let L=S.map((B)=>B.sourceComponentName||"component");this.params.issues.push({lineItemType:"DiodeCapacitorJunctionTooSpreadOut",capacitorSchematicBox:o.placement,diodeSchematicBoxes:[c.placement,l.placement],maxJunctionPinDistance:b,maxRecommendedJunctionPinDistance:C,message:`Bring ${L.join(", ")} closer together so their shared junction can be read as one local diode-capacitor stage. Preserve pin connections, leave room for labels, and reroute affected traces.`})}localPart(t){let e=this.index.components.get(t),r=this.index.placement(t),n=this.index.portsByComponent.get(t),i=this.index.twoTerminalNets(t);if(!e||!r||!i||this.unpopulated.has(t)||n?.length!==2||![r.width,r.height].every((s)=>Number.isFinite(s)&&s>0)||e.ftype==="simple_capacitor"&&(!Number.isFinite(e.capacitance)||e.capacitance<=0)||n.some((s)=>{let o=this.index.port(s);return s.do_not_connect||!o||o.schematic_sheet_id!==r.schematicSheetId||!Number.isFinite(o.center.x)||!Number.isFinite(o.center.y)}))return;return{component:e,placement:r,ports:n,nets:i}}static issueToString(t){let e=[];return v(e,"capacitorName",t.capacitorSchematicBox.sourceComponentName),v(e,"diodeNames",t.diodeSchematicBoxes.map((r)=>r.sourceComponentName).join(",")),v(e,"maxJunctionPinDistance",t.maxJunctionPinDistance),v(e,"maxRecommendedJunctionPinDistance",t.maxRecommendedJunctionPinDistance),v(e,"message",t.message),`<DiodeCapacitorJunctionTooSpreadOut ${e.join(" ")} />`}}class wn extends U{params;index;ledIds;visited=new Set;unpopulated=new Set;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.ledIds=new Set([...this.index.components.values()].filter((e)=>e.ftype==="simple_led").map((e)=>e.source_component_id));for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);this.solved=this.ledIds.size===0}_step(){let t=[...this.ledIds].find((a)=>!this.visited.has(a));if(!t){this.solved=!0;return}let e=[t];this.visited.add(t);let r=new Map;for(let a=0;a<e.length;a++){let p=e[a],d=new Set;for(let m of this.index.portsByComponent.get(p)??[])for(let f of this.index.portsByNet.get(this.index.connected(m.source_port_id))??[]){let _=f.source_component_id;if(_===p||!this.ledIds.has(_))continue;if(d.add(_),!this.visited.has(_))this.visited.add(_),e.push(_)}r.set(p,d)}if(this.solved=this.visited.size===this.ledIds.size,e.length<3)return;let n=e.filter((a)=>r.get(a).size===1);if(n.length!==2||e.some((a)=>r.get(a).size>2))return;let i=[n.sort()[0]];while(i.length<e.length){let a=i.at(-1),p=i.at(-2),d=[...r.get(a)].find((m)=>m!==p);if(!d||i.includes(d))return;i.push(d)}let s=i.map((a)=>this.index.placement(a));if(s.some((a)=>!a))return;let o=s.filter((a)=>a!==void 0);if(o.some((a)=>!this.index.sameLocalScope(o[0],a)||![a.schX,a.schY,a.width,a.height].every(Number.isFinite)||a.width<=0||a.height<=0))return;for(let a of i){let p=this.index.portsByComponent.get(a)??[];if(this.unpopulated.has(a)||!this.index.twoTerminalNets(a)||p.some((m)=>m.do_not_connect))return;let d=this.index.placement(a);for(let m of p){let f=this.index.port(m);if(!f||f.schematic_sheet_id!==d.schematicSheetId||!Number.isFinite(f.center.x)||!Number.isFinite(f.center.y)||!f.facing_direction)return}}let c=[];for(let a=1;a<i.length;a++){let p=i[a-1],d=i[a],m=this.index.twoTerminalNets(p),f=this.index.twoTerminalNets(d).filter((k)=>m.includes(k));if(f.length!==1||this.index.isRail(f[0]))return;let _=this.index.portsByNet.get(f[0])??[];if(_.length!==2)return;let g=_.find((k)=>k.source_component_id===p),y=_.find((k)=>k.source_component_id===d),S=this.index.port(g),P=this.index.port(y),b=P.center.x-S.center.x,C=P.center.y-S.center.y,L=Math.hypot(b,C),B=Math.max(o[a-1].width,o[a-1].height,o[a].width,o[a].height);if(L>Math.max(4,3*B)&&(Py(S,b,C)<-B||Py(P,-b,-C)<-B))c.push({firstSourcePortId:g.source_port_id,secondSourcePortId:y.source_port_id,pinDistance:L})}if(!c.length)return;let l=o.map((a)=>a.sourceComponentName||"LED").join(", ");this.params.issues.push({lineItemType:"SeriesLedChainNotOrdered",ledSchematicBoxes:o,backtrackingConnections:c,message:`Arrange ${l} in their connected series order so adjacent LEDs do not require long connections behind their pins. Move or rotate the symbols while preserving anode/cathode connections; allow space for labels and reroute affected traces. A horizontal, vertical, or clearly connected folded chain is acceptable.`})}static issueToString(t){let e=[];return v(e,"ledComponents",t.ledSchematicBoxes.map((r)=>r.sourceComponentName).join(",")),v(e,"backtrackingConnections",t.backtrackingConnections.length),v(e,"maxPinDistance",Math.max(...t.backtrackingConnections.map((r)=>r.pinDistance))),v(e,"message",t.message),`<SeriesLedChainNotOrdered ${e.join(" ")} />`}}function Py(t,e,r){switch(t.facing_direction){case"left":return-e;case"right":return e;case"up":return r;case"down":return-r;default:return 0}}class An extends U{params;index;resistorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson){if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);if(e.type==="source_port"){let r=this.index.connected(e.source_port_id);if(e.requires_ground||e.provides_ground)this.index.groundNets.add(r);if(e.requires_power||e.provides_power||e.requires_voltage!==void 0||e.provides_voltage!==void 0)this.index.powerNets.add(r)}}this.resistorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_resistor").map((e)=>e.source_component_id),this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];this.solved=this.currentIndex>=this.resistorIds.length;let e=this.index,r=e.components.get(t),n=e.twoTerminalNets(t);if(r?.ftype!=="simple_resistor"||!Number.isFinite(r.resistance)||r.resistance<=0||!n)return;let i=n.filter((B)=>e.groundNets.has(B)&&!e.powerNets.has(B));if(i.length!==1)return;let s=i[0],o=n.find((B)=>B!==s);if(e.isRail(o))return;let c=e.portsByNet.get(o)??[];if(c.length!==3||c.some((B)=>B.do_not_connect))return;let l=c.find((B)=>e.components.get(B.source_component_id)?.ftype==="simple_capacitor"),a=c.find((B)=>e.components.get(B.source_component_id)?.ftype==="simple_chip");if(!l||!a)return;let p=l.source_component_id,d=e.components.get(p);if(d?.ftype!=="simple_capacitor"||!Number.isFinite(d.capacitance)||d.capacitance<=0||!e.twoTerminalNets(p)?.includes(s))return;let m=a.source_component_id;if((e.portsByComponent.get(m)?.length??0)<3)return;let f=e.placement(t),_=e.placement(p),g=e.placement(m);if(!f||!_||!g||[t,p,m].some((B)=>this.unpopulated.has(B)))return;if([f,_].some((B)=>B.schematicSheetId!==g.schematicSheetId||B.subcircuitId!==g.subcircuitId))return;if([f,_,g].some((B)=>![B.schX,B.schY,B.width,B.height].every(Number.isFinite)||B.width<=0||B.height<=0))return;let y=e.port(a);if(!y||y.schematic_sheet_id!==g.schematicSheetId)return;let S=this.pins(t,o,s,f),P=this.pins(p,o,s,_);if(!S||!P)return;let b=By(...S),C=By(...P);if(!b||!C)return;if(Math.abs(f.schX-_.schX)<(f.width+_.width)/2&&Math.abs(f.schY-_.schY)<(f.height+_.height)/2)return;let L;if(b!==C)L="different_axes";else{let B=b==="horizontal"?"x":"y",k=S.map((j)=>j.center[B]),I=P.map((j)=>j.center[B]);if((k[1]-k[0])*(I[1]-I[0])<0)L="crossed_connections";else{if(Math.min(Math.max(...k),Math.max(...I))-Math.max(Math.min(...k),Math.min(...I))>0.01)return;L="staggered"}}this.params.issues.push({lineItemType:"ParallelRcNotAligned",resistorSchematicBox:f,capacitorSchematicBox:_,chipSourcePortId:a.source_port_id,reason:L,message:`Draw ${f.sourceComponentName||"the resistor"} and ${_.sourceComponentName||"the capacitor"} as adjacent parallel branches with their shared nets at matching ends. Preserve all pin connections and capacitor polarity, leave room for labels, and reroute affected wires.`})}pins(t,e,r,n){let i=this.index.portsByComponent.get(t)??[];if(i.length!==2||i.some((l)=>l.do_not_connect))return;let s=[e,r].map((l)=>{let a=i.find((p)=>this.index.connected(p.source_port_id)===l);return a&&this.index.port(a)}),[o,c]=s;if(!o||!c||s.some((l)=>l.schematic_sheet_id!==n.schematicSheetId||!Number.isFinite(l.center.x)||!Number.isFinite(l.center.y)))return;return[o,c]}static issueToString(t){let e=[];return v(e,"resistorComponentName",t.resistorSchematicBox.sourceComponentName),v(e,"capacitorComponentName",t.capacitorSchematicBox.sourceComponentName),v(e,"reason",t.reason),v(e,"message",t.message),`<ParallelRcNotAligned ${e.join(" ")} />`}}function By(t,e){let r=new Set([t.facing_direction,e.facing_direction]);if(r.has("left")&&r.has("right")&&Math.abs(t.center.y-e.center.y)<0.01&&Math.abs(t.center.x-e.center.x)>0.01)return"horizontal";if(r.has("up")&&r.has("down")&&Math.abs(t.center.x-e.center.x)<0.01&&Math.abs(t.center.y-e.center.y)>0.01)return"vertical"}class Pn extends U{params;index;resistorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);this.resistorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_resistor").map((e)=>e.source_component_id),this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.resistorIds.length,!t||this.unpopulated.has(t))return;let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.twoTerminalNets(t),s=e.portsByComponent.get(t)??[];if(r?.ftype!=="simple_resistor"||!Number.isFinite(r.resistance)||r.resistance<=0||!n||!i||s.some((B)=>B.do_not_connect))return;let o=i.filter((B)=>e.groundNets.has(B)&&!e.powerNets.has(B));if(o.length!==1)return;let c=i.find((B)=>B!==o[0]);if(e.isRail(c))return;let l=e.portsByNet.get(c)??[];if(l.length!==2)return;let a=l.find((B)=>B.source_component_id!==t),p=l.find((B)=>B.source_component_id===t);if(!a||!p||a.do_not_connect||r5(a))return;let d=a.source_component_id,m=e.placement(d);if(e.components.get(d)?.ftype!=="simple_chip"||(e.portsByComponent.get(d)?.length??0)<3||this.unpopulated.has(d)||!m||!e.sameLocalScope(m,n))return;let f=e.port(a),_=e.port(p);if(!f||!_||[f,_].some((B)=>B.schematic_sheet_id!==m.schematicSheetId||!Number.isFinite(B.center.x)||!Number.isFinite(B.center.y))||[m,n].some((B)=>![B.schX,B.schY,B.width,B.height].every(Number.isFinite)||B.width<=0||B.height<=0))return;let g=f.facing_direction;if(!g)return;let y=g==="left"||g==="right",P=-(g==="left"||g==="down"?-1:1)*(y?n.schX-m.schX:n.schY-m.schY),b=y?(m.width+n.width)/2:(m.height+n.height)/2;if(P<=b+0.2)return;let C=Math.hypot(f.center.x-_.center.x,f.center.y-_.center.y),L=Math.max(4,3*Math.max(n.width,n.height));if(C<=L)return;this.params.issues.push({lineItemType:"ResistorSeparatedFromChipPin",hostSchematicBox:m,resistorSchematicBox:n,chipSourcePortId:a.source_port_id,resistorSourcePortId:p.source_port_id,pinDistance:C,maxRecommendedPinDistance:L,message:`Place ${n.sourceComponentName||"resistor"} beside its connected pin on the ${g} side of ${m.sourceComponentName||"chip"} so the resistor-to-ground branch can be read together. Preserve pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}static issueToString(t){let e=[];return v(e,"hostComponentName",t.hostSchematicBox.sourceComponentName),v(e,"resistorName",t.resistorSchematicBox.sourceComponentName),v(e,"pinDistance",t.pinDistance),v(e,"maxRecommendedPinDistance",t.maxRecommendedPinDistance),v(e,"message",t.message),`<ResistorSeparatedFromChipPin ${e.join(" ")} />`}}function r5(t){return Boolean(t.requires_power||t.provides_power||t.requires_ground||t.provides_ground||t.requires_voltage!==void 0||t.provides_voltage!==void 0)}class Bn extends U{params;banks=[];bankIndex=0;constructor(t){super();this.params=t;let e=new tt(t.ctx),r=new Map;for(let n of e.components.values()){let i=n.ftype==="simple_diode"||n.ftype==="simple_led";if(!i&&n.ftype!=="simple_resistor")continue;let s=n.source_component_id,o=e.placement(s),c=e.twoTerminalNets(s)?.sort(),l=e.portsByComponent.get(s);if(!o||!c||!l)continue;let a=c.map((y)=>{let S=l.find((P)=>e.connected(P.source_port_id)===y);return S&&e.port(S)}),[p,d]=a,m={diode:i,box:o};if(p&&d&&!l.some((y)=>y.do_not_connect)&&a.every((y)=>y?.schematic_sheet_id===o.schematicSheetId))m.pins=[p,d],m.axis=n5(p,d);let f=JSON.stringify(c),_=r.get(f)??[],g=_.find((y)=>e.sameLocalScope(y[0].box,o));if(g)g.push(m);else{let y=[m];_.push(y),this.banks.push(y)}r.set(f,_)}this.solved=this.banks.length===0}_step(){let t=this.banks[this.bankIndex++];if(this.solved=this.bankIndex>=this.banks.length,t.length!==2)return;let e=t.find((o)=>o.diode),r=t.find((o)=>!o.diode);if(!e?.pins||!e.axis||!r?.pins||!r.axis)return;let n=e.box,i=r.box;if(Math.abs(n.schX-i.schX)<(n.width+i.width)/2&&Math.abs(n.schY-i.schY)<(n.height+i.height)/2)return;let s;if(e.axis!==r.axis)s="different_axes";else{let o=e.axis==="horizontal"?"x":"y",c=e.pins.map((a)=>a.center[o]),l=r.pins.map((a)=>a.center[o]);if((c[1]-c[0])*(l[1]-l[0])<0)s="crossed_connections";else{if(Math.min(Math.max(...c),Math.max(...l))-Math.max(Math.min(...c),Math.min(...l))>0.01)return;s="staggered"}}this.params.issues.push({lineItemType:"ParallelDiodeResistorNotAligned",diodeSchematicBox:n,resistorSchematicBox:i,reason:s,message:`Draw ${n.sourceComponentName||"the diode"} and ${i.sourceComponentName||"the resistor"} as adjacent parallel rows or columns with their shared nets at matching ends. Preserve every pin connection and diode polarity, leave room for labels, and reroute the affected wires.`})}static issueToString(t){let e=[];return v(e,"diodeComponentName",t.diodeSchematicBox.sourceComponentName),v(e,"resistorComponentName",t.resistorSchematicBox.sourceComponentName),v(e,"reason",t.reason),v(e,"message",t.message),`<ParallelDiodeResistorNotAligned ${e.join(" ")} />`}}function n5(t,e){let r=new Set([t.facing_direction,e.facing_direction]);if(r.has("left")&&r.has("right")&&Math.abs(t.center.y-e.center.y)<0.01&&Math.abs(t.center.x-e.center.x)>0.01)return"horizontal";if(r.has("up")&&r.has("down")&&Math.abs(t.center.x-e.center.x)<0.01&&Math.abs(t.center.y-e.center.y)>0.01)return"vertical"}var In=(t,e)=>Math.hypot(t.x-e.x,t.y-e.y),rr=0.001;class Fn extends U{index;nodes=new Map;starts=[];currentIndex=0;issues;maxSpan;maxLength;constructor({ctx:t,issues:e,maxSpan:r=8,maxLength:n=16}){super();if(this.index=new tt(t),this.issues=e,!Number.isFinite(r)||r<0||!Number.isFinite(n)||n<0)throw Error("Rail visibility thresholds must be finite and nonnegative");this.maxSpan=r,this.maxLength=n;let i=this.index,s=(a,p,d)=>{let m=JSON.stringify([d,p,Math.round(a.x/rr),Math.round(a.y/rr)]);if(!this.nodes.has(m))this.nodes.set(m,{point:a,net:p,sheet:d,links:[]});return m},o=(a,p,d)=>{let m=this.nodes.get(a),f=this.nodes.get(p),_=In(m.point,f.point);m.links.push({to:p,length:_,...d}),f.links.push({to:a,length:_,...d})},c=new Map;for(let[a,p]of i.portsByComponent)for(let d of p){let m=i.port(d);if(!m)continue;let f=s(m.center,i.connected(d.source_port_id),m.schematic_sheet_id);if(c.set(d.source_port_id,f),p.length>2)this.starts.push({portId:d.source_port_id,componentId:a,nodeId:f})}for(let a of t.circuitJson){if(a.type!=="schematic_net_label"||!a.source_net_id||!a.anchor_position)continue;let p=i.connected(a.source_net_id);if(!i.isRail(p)||i.powerNets.has(p)&&i.groundNets.has(p))continue;let d=s(a.anchor_position,p,a.schematic_sheet_id);this.nodes.get(d).terminal=i.groundNets.has(p)?"ground":"power"}let l=[];for(let a of t.circuitJson){if(a.type!=="schematic_trace")continue;let p=i5(a,t.circuitJson,i);if(!p)continue;for(let d of a.edges)l.push({from:s(d.from,p,a.schematic_sheet_id),to:s(d.to,p,a.schematic_sheet_id),traceId:a.schematic_trace_id})}for(let a of l){let p=this.nodes.get(a.from),d=this.nodes.get(a.to);if(In(p.point,d.point)<rr)continue;let f=[...this.nodes].filter(([,_])=>_.net===p.net&&_.sheet===p.sheet&&o5(_.point,p.point,d.point)).sort(([,_],[,g])=>In(p.point,_.point)-In(p.point,g.point));for(let _=1;_<f.length;_++)o(f[_-1][0],f[_][0],{traceId:a.traceId})}for(let[a,p]of i.components){if(!["simple_resistor","simple_capacitor","simple_inductor"].includes(p.ftype))continue;let d=i.portsByComponent.get(a);if(d?.length!==2||!i.twoTerminalNets(a))continue;let m=c.get(d[0].source_port_id),f=c.get(d[1].source_port_id);if(m&&f)o(m,f,{componentId:a})}this.solved=this.starts.length===0}_step(){let t=this.starts[this.currentIndex++];if(this.solved=this.currentIndex>=this.starts.length,!t)return;let e=this.index.portsByComponent.get(t.componentId)?.find((c)=>c.source_port_id===t.portId),r=e?this.index.port(e):void 0,n=r?.display_pin_label||e?.name||(r?.pin_number!==void 0?`pin${r.pin_number}`:"connected pin"),i=this.index.placement(t.componentId);if(!i)return;let s=[{id:t.nodeId,length:0,hops:0,path:[t.nodeId],links:[]}],o=new Map([[`${t.nodeId}:0`,0]]);while(s.length){s.sort((p,d)=>p.length-d.length);let c=s.shift(),l=`${c.id}:${c.hops}`;if(c.length!==o.get(l))continue;let a=this.nodes.get(c.id);if(a.terminal){let p=c.path.map((y)=>this.nodes.get(y).point),d=p.map((y)=>y.x),m=p.map((y)=>y.y),f={left:Math.min(...d),right:Math.max(...d),bottom:Math.min(...m),top:Math.max(...m)},_=Math.max(f.right-f.left,f.top-f.bottom);if(_<=this.maxSpan&&c.length<=this.maxLength)return;let g=[...new Set(c.links.flatMap((y)=>y.componentId?[y.componentId]:[]))];this.issues.push({lineItemType:"RailPathTooSpreadOut",hostSchematicBox:i,sourcePortId:t.portId,sourcePortName:n,railType:a.terminal,supportSchematicBoxes:g.flatMap((y)=>{let S=this.index.placement(y);return S?[S]:[]}),schematicTraceIds:[...new Set(c.links.flatMap((y)=>y.traceId?[y.traceId]:[]))],pathPoints:p,pathBounds:f,pathLength:c.length,pathSpan:_,maxRecommendedSpan:this.maxSpan,maxRecommendedPathLength:this.maxLength,message:`Visible path from ${i.sourceComponentName||"component"}.${n} to ${a.terminal} spans ${_.toFixed(2)} schematic units; move the connected support elements closer together near the pin and recompute their schematic traces.`});return}for(let p of a.links){if(c.path.includes(p.to))continue;if(p.componentId){let _=this.index.placement(p.componentId);if(c.hops>=3||!_||!this.index.sameLocalScope(i,_))continue}let d=c.length+p.length,m=c.hops+(p.componentId?1:0),f=`${p.to}:${m}`;if(d>=(o.get(f)??1/0))continue;o.set(f,d),s.push({id:p.to,length:d,hops:m,path:[...c.path,p.to],links:[...c.links,p]})}}}static issueToString(t){let e=[];return v(e,"hostName",t.hostSchematicBox.sourceComponentName),v(e,"pinName",t.sourcePortName),v(e,"railType",t.railType),v(e,"pathSpan",t.pathSpan),v(e,"pathLength",t.pathLength),v(e,"message",t.message),`<RailPathTooSpreadOut ${e.join(" ")} />`}}function i5(t,e,r){if(t.subcircuit_connectivity_map_key)return r.connected(`connectivity:${t.subcircuit_connectivity_map_key}`);let n=e.find((s)=>s.type==="source_trace"&&s.source_trace_id===t.source_trace_id);if(n?.type!=="source_trace")return;let i=[...n.connected_source_port_ids,...n.connected_source_net_ids];return i[0]?r.connected(i[0]):void 0}function o5(t,e,r){let n=r.x-e.x,i=r.y-e.y,s=In(e,r);if(s<rr)return In(e,t)<rr;let o=((t.x-e.x)*n+(t.y-e.y)*i)/s;return Math.abs((t.x-e.x)*i-(t.y-e.y)*n)/s<rr&&o>=-rr&&o<=s+rr}class Mn extends U{params;index;capacitorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);this.capacitorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_capacitor").map((e)=>e.source_component_id),this.solved=this.capacitorIds.length===0}_step(){let t=this.capacitorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.capacitorIds.length,!t||this.unpopulated.has(t))return;let e=this.index,r=e.components.get(t),n=e.placement(t),i=e.portsByComponent.get(t)??[],s=e.twoTerminalNets(t);if(r?.ftype!=="simple_capacitor"||!Number.isFinite(r.capacitance)||r.capacitance<=0||!n||!s||s.some((I)=>e.isRail(I))||i.some((I)=>I.do_not_connect||Zl(I)))return;let o=s.map((I)=>{let j=e.portsByNet.get(I)??[];if(j.length!==2)return;return j.find((Q)=>Q.source_component_id!==t)}),[c,l]=o;if(!c||!l||c.source_component_id!==l.source_component_id||c.do_not_connect||l.do_not_connect||Zl(c)||Zl(l))return;let a=c.source_component_id,p=e.placement(a);if(e.components.get(a)?.ftype!=="simple_chip"||this.unpopulated.has(a)||!p||!e.sameLocalScope(p,n))return;let d=[c,l],m=d.map((I)=>e.port(I)),f=i.map((I)=>e.port(I));if([...m,...f].some((I)=>!I||I.schematic_sheet_id!==p.schematicSheetId||!Number.isFinite(I.center.x)||!Number.isFinite(I.center.y))||[p,n].some((I)=>![I.schX,I.schY,I.width,I.height].every(Number.isFinite)||I.width<=0||I.height<=0))return;let _=m[0],g=m[1],y=_.facing_direction;if(!y||y!==g.facing_direction)return;let S=y==="left"||y==="right",P=y==="left"||y==="down"?-1:1,b=Math.hypot(_.center.x-g.center.x,_.center.y-g.center.y);if(b<0.01)return;let C=-P*(S?n.schX-p.schX:n.schY-p.schY),L=S?(p.width+n.width)/2:(p.height+n.height)/2;if(C<=L+0.2)return;let B=Math.max(...m.map((I,j)=>Math.hypot(I.center.x-f[j].center.x,I.center.y-f[j].center.y))),k=Math.max(4,3*Math.max(n.width,n.height),2*b);if(B<=k)return;this.params.issues.push({lineItemType:"CapacitorSeparatedFromChipPins",hostSchematicBox:p,capacitorSchematicBox:n,chipSourcePortIds:[d[0].source_port_id,d[1].source_port_id],maxPinDistance:B,maxRecommendedPinDistance:k,message:`Place ${n.sourceComponentName||"component"} beside its two connected pins on the ${y} side of ${p.sourceComponentName||"component"} so their connections can be read together. Preserve pin connections, leave room for labels, and reroute affected traces; exact alignment is not required.`})}static issueToString(t){let e=[];return v(e,"hostComponentName",t.hostSchematicBox.sourceComponentName),v(e,"capacitorName",t.capacitorSchematicBox.sourceComponentName),v(e,"maxPinDistance",t.maxPinDistance),v(e,"maxRecommendedPinDistance",t.maxRecommendedPinDistance),v(e,"message",t.message),`<CapacitorSeparatedFromChipPins ${e.join(" ")} />`}}function Zl(t){return Boolean(t.requires_power||t.provides_power||t.requires_ground||t.provides_ground||t.requires_voltage!==void 0||t.provides_voltage!==void 0)}class Cn extends U{params;index;inductorIds;unpopulated=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx);for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&e.do_not_place)this.unpopulated.add(e.source_component_id);for(let e of t.ctx.circuitJson)if(e.type==="pcb_component"&&!e.do_not_place)this.unpopulated.delete(e.source_component_id);this.inductorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_inductor"&&!this.unpopulated.has(e.source_component_id)).map((e)=>e.source_component_id),this.solved=this.inductorIds.length===0}_step(){let t=this.inductorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.inductorIds.length,!t)return;let e=this.index,r=this.localPart(t),n=e.twoTerminalNets(t);if(!r||!n||n.some((d)=>e.isRail(d)))return;let i=n.map((d)=>{let m=e.portsByNet.get(d)??[];if(m.some((b)=>b.source_component_id!==t&&!this.unpopulated.has(b.source_component_id)&&e.components.get(b.source_component_id)?.ftype==="simple_inductor"))return;let f=m.filter((b)=>{let C=e.components.get(b.source_component_id),L=e.twoTerminalNets(b.source_component_id);return C?.ftype==="simple_capacitor"&&!this.unpopulated.has(b.source_component_id)&&L?.some((B)=>B!==d&&e.groundNets.has(B))});if(f.length!==1)return;let _=f[0],g=e.components.get(_.source_component_id);if(g.ftype!=="simple_capacitor"||!Number.isFinite(g.capacitance)||g.capacitance<=0)return;let y=this.localPart(_.source_component_id);if(!y||!e.sameLocalScope(r.placement,y.placement))return;let S=e.port(_),P=e.port(r.ports.find((b)=>e.connected(b.source_port_id)===d));return{placement:y.placement,ground:e.twoTerminalNets(_.source_component_id).find((b)=>b!==d),distance:Math.hypot(S.center.x-P.center.x,S.center.y-P.center.y)}}),[s,o]=i;if(!s||!o||s.ground!==o.ground)return;let c=[r.placement,s.placement,o.placement],l=Math.max(4,...c.map((d)=>3*Math.max(d.width,d.height))),a=Math.max(s.distance,o.distance);if(a<=l)return;let p=(d)=>d.sourceComponentName||"component";this.params.issues.push({lineItemType:"PiFilterComponentsNotGrouped",inductorSchematicBox:r.placement,firstCapacitorSchematicBox:s.placement,secondCapacitorSchematicBox:o.placement,maxSignalPinDistance:a,maxRecommendedSignalPinDistance:l,message:`Group ${p(s.placement)} and ${p(o.placement)} beside the connected ends of ${p(r.placement)} so the series path and both grounded branches of the pi filter can be read together. Preserve pin connections, allow room for labels, and reroute affected traces.`})}localPart(t){let e=this.index.placement(t),r=this.index.portsByComponent.get(t);if(!e||r?.length!==2||r.some((n)=>{let i=this.index.port(n);return n.do_not_connect||!i||i.schematic_sheet_id!==e.schematicSheetId||!Number.isFinite(i.center.x)||!Number.isFinite(i.center.y)}))return;return{placement:e,ports:r}}static issueToString(t){let e=[];return v(e,"inductorName",t.inductorSchematicBox.sourceComponentName),v(e,"firstCapacitorName",t.firstCapacitorSchematicBox.sourceComponentName),v(e,"secondCapacitorName",t.secondCapacitorSchematicBox.sourceComponentName),v(e,"maxSignalPinDistance",t.maxSignalPinDistance),v(e,"maxRecommendedSignalPinDistance",t.maxRecommendedSignalPinDistance),v(e,"message",t.message),`<PiFilterComponentsNotGrouped ${e.join(" ")} />`}}class kn extends U{params;index;mosfetIds;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.mosfetIds=[...this.index.components.keys()].filter((e)=>this.mosfetPorts(e)),this.solved=this.mosfetIds.length===0}_step(){let t=this.mosfetIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.mosfetIds.length,!t)return;let e=this.index,r=e.placement(t),n=this.mosfetPorts(t);if(!r)return;let i=e.connected(n.gate.source_port_id),s=e.connected(n.sources[0].source_port_id),o=e.connected(n.drains[0].source_port_id);if(new Set([i,s,o]).size!==3||e.isRail(i))return;if([n.gate,...n.sources,...n.drains].some((g)=>{let y=e.port(g);return!y||y.schematic_sheet_id!==r.schematicSheetId}))return;let c=(e.portsByNet.get(i)??[]).filter((g)=>g.source_component_id!==t);if(c.length!==2)return;let l=c.map((g)=>{let y=g.source_component_id,S=e.components.get(y),P=e.placement(y),b=e.twoTerminalNets(y);if(S?.ftype!=="simple_resistor"||!Number.isFinite(S.resistance)||S.resistance<=0||!P||!b||!e.sameLocalScope(r,P)||e.portsByComponent.get(y).some((C)=>{let L=e.port(C);return C.do_not_connect||!L||L.schematic_sheet_id!==r.schematicSheetId}))return;return{placement:P,otherNet:b.find((C)=>C!==i)}});if(l.some((g)=>!g))return;let a=l.filter((g)=>g.otherNet===s),p=l.filter((g)=>g.otherNet!==s);if(a.length!==1||p.length!==1)return;let d=a[0].placement,m=p[0].placement;if(p[0].otherNet===o||e.isRail(p[0].otherNet))return;let f=Math.max(6,3*Math.max(r.width,r.height)),_=Math.max(Iy(r,m),Iy(r,d));if(_<=f)return;this.params.issues.push({lineItemType:"MosfetGateNetworkNotGrouped",mosfetSchematicBox:r,seriesGateResistorSchematicBox:m,gateSourceResistorSchematicBox:d,maxBodyGap:_,maxRecommendedBodyGap:f,message:`Group ${m.sourceComponentName||"component"} and ${d.sourceComponentName||"component"} beside ${r.sourceComponentName||"component"}'s gate/source pins so the gate-drive branch can be read together. Preserve all pin connections, leave room for labels, and reroute affected traces.`})}mosfetPorts(t){let e=this.index.components.get(t)?.ftype;if(e!=="simple_mosfet"&&e!=="simple_chip")return;let r=this.index.portsByComponent.get(t)??[],n=r.filter((o)=>ql(o,/^(G|GATE)$/)),i=r.filter((o)=>ql(o,/^(S|SOURCE)[0-9]*$/)),s=r.filter((o)=>ql(o,/^(D|DRAIN)[0-9]*$/));if(n.length!==1||!i.length||!s.length||n.length+i.length+s.length!==r.length||new Set([...n,...i,...s]).size!==r.length||r.some((o)=>o.do_not_connect))return;for(let o of[i,s])if(new Set(o.map((c)=>this.index.connected(c.source_port_id))).size!==1)return;return{gate:n[0],sources:i,drains:s}}static issueToString(t){let e=[];return v(e,"mosfetName",t.mosfetSchematicBox.sourceComponentName),v(e,"seriesGateResistorName",t.seriesGateResistorSchematicBox.sourceComponentName),v(e,"gateSourceResistorName",t.gateSourceResistorSchematicBox.sourceComponentName),v(e,"maxBodyGap",t.maxBodyGap),v(e,"maxRecommendedBodyGap",t.maxRecommendedBodyGap),v(e,"message",t.message),`<MosfetGateNetworkNotGrouped ${e.join(" ")} />`}}function ql(t,e){return[t.name,...t.port_hints??[]].some((r)=>e.test(r.toUpperCase().replace(/[\s_]/g,"")))}function Iy(t,e){return Math.hypot(Math.max(0,Math.abs(t.schX-e.schX)-(t.width+e.width)/2),Math.max(0,Math.abs(t.schY-e.schY)-(t.height+e.height)/2))}class Nn extends U{params;index;relayIds;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.relayIds=[...this.index.components.keys()].filter((e)=>this.coilPorts(e)),this.solved=this.relayIds.length===0}_step(){let t=this.relayIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.relayIds.length,!t)return;let e=this.index,r=e.placement(t),n=this.coilPorts(t);if(!r||n.some((I)=>I.do_not_connect))return;let i=n.map((I)=>e.connected(I.source_port_id));if(i[0]===i[1])return;if(this.relayIds.some((I)=>I!==t&&this.coilPorts(I).every((j)=>i.includes(e.connected(j.source_port_id)))))return;let s=new Set((e.portsByNet.get(i[0])??[]).filter((I)=>e.components.get(I.source_component_id)?.ftype==="simple_diode").map((I)=>I.source_component_id).filter((I)=>e.twoTerminalNets(I)?.includes(i[1])));if(s.size!==1)return;let o=[...s][0],c=e.placement(o),l=this.uniquePort(o,/^(?:ANODE|A)$/),a=this.uniquePort(o,/^(?:CATHODE|K)$/);if(!c||!e.sameLocalScope(r,c)||!l||!a||l===a||l.do_not_connect||a.do_not_connect)return;let p=e.connected(l.source_port_id),d=e.connected(a.source_port_id);if(e.isRail(p)||e.groundNets.has(d)||!this.hasGroundedDriver(p,d))return;let m=n.map((I)=>e.port(I)),f=[l,a].map((I)=>e.port(I));if([...m,...f].some((I)=>!I||I.schematic_sheet_id!==r.schematicSheetId))return;let[_,g]=m,y=Math.min(_.center.x,g.center.x),S=Math.max(_.center.x,g.center.x),P=Math.min(_.center.y,g.center.y),b=Math.max(_.center.y,g.center.y),C=Math.max(y-(c.schX+c.width/2),c.schX-c.width/2-S,0),L=Math.max(P-(c.schY+c.height/2),c.schY-c.height/2-b,0),B=Math.hypot(C,L),k=Math.hypot(S-y,b-P);if(B<=Math.max(1.5,2*k)||B>Math.max(8,4*Math.max(r.width,r.height)))return;if(!this.params.ctx.circuitJson.some((I)=>I.type==="schematic_net_label"&&I.schematic_sheet_id===r.schematicSheetId&&I.anchor_position&&f.some((j)=>Math.hypot(j.center.x-I.anchor_position.x,j.center.y-I.anchor_position.y)<0.01&&!this.hasWireAtPin(j))))return;this.params.issues.push({lineItemType:"FlybackDiodeSeparatedFromRelayCoil",relaySchematicBox:r,diodeSchematicBox:c,coilSourcePortIds:[n[0].source_port_id,n[1].source_port_id],distanceFromCoilPins:B,message:`Place ${c.sourceComponentName||"component"} beside ${r.sourceComponentName||"component"}'s coil pins so the flyback protection loop can be read together. Preserve diode polarity and all pin connections; leave room for labels and reroute affected traces.`})}hasWireAtPin(t){return this.params.ctx.circuitJson.some((e)=>e.type==="schematic_trace"&&e.schematic_sheet_id===t.schematic_sheet_id&&e.edges.some(({from:r,to:n})=>{let i=n.x-r.x,s=n.y-r.y,o=i*i+s*s,c=o?Math.max(0,Math.min(1,((t.center.x-r.x)*i+(t.center.y-r.y)*s)/o)):0;return Math.hypot(t.center.x-r.x-c*i,t.center.y-r.y-c*s)<0.01}))}uniquePort(t,e){let r=this.index.portsByComponent.get(t)?.filter((n)=>Ui(n,e));return r?.length===1?r[0]:void 0}coilPorts(t){if(this.index.components.get(t)?.ftype!=="simple_chip")return;let e=this.index.portsByComponent.get(t)??[];if(!this.uniquePort(t,/^(?:COM|COMMON)$/)||!e.some((n)=>Ui(n,/^(?:NO|NC|NORMALLYOPEN|NORMALLYCLOSED)$/)))return;if(e.filter((n)=>Ui(n,/^(?:COIL[A-B12]|A[12])$/)).length!==2)return;for(let[n,i]of[["COILA","COILB"],["COIL1","COIL2"],["A1","A2"]]){let s=this.uniquePort(t,new RegExp(`^${n}$`)),o=this.uniquePort(t,new RegExp(`^${i}$`));if(s&&o&&s!==o&&!Ui(s,new RegExp(`^${i}$`))&&!Ui(o,new RegExp(`^${n}$`)))return[s,o]}}hasGroundedDriver(t,e){return(this.index.portsByNet.get(t)??[]).some((r)=>{let n=r.source_component_id,i=this.index.components.get(n);if(i?.ftype!=="simple_chip"&&!(i?.ftype==="simple_transistor"&&i.transistor_type==="npn"))return!1;if(this.index.portsByComponent.get(n)?.length!==3)return!1;let s=this.uniquePort(n,/^(?:C|COLLECTOR)$/),o=this.uniquePort(n,/^(?:E|EMITTER)$/),c=this.uniquePort(n,/^(?:B|BASE)$/);if(!s||!o||!c||new Set([s,o,c]).size!==3||[s,o,c].some((p)=>p.do_not_connect)||s.source_port_id!==r.source_port_id)return!1;let l=this.index.connected(o.source_port_id),a=this.index.connected(c.source_port_id);return this.index.groundNets.has(l)&&!this.index.powerNets.has(l)&&new Set([t,e,l,a]).size===4})}static issueToString(t){let e=[];return v(e,"relayName",t.relaySchematicBox.sourceComponentName),v(e,"diodeName",t.diodeSchematicBox.sourceComponentName),v(e,"distanceFromCoilPins",t.distanceFromCoilPins),v(e,"message",t.message),`<FlybackDiodeSeparatedFromRelayCoil ${e.join(" ")} />`}}function Ui(t,e){return[t.name,...t.port_hints??[]].some((r)=>e.test(r.toUpperCase().replace(/[\s_]/g,"")))}var nr=0.01;class Yn extends U{params;index;hostIds;traces;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.hostIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_chip").map((e)=>e.source_component_id),this.traces=t.ctx.circuitJson.filter((e)=>e.type==="schematic_trace"),this.solved=this.hostIds.length===0}_step(){let t=this.hostIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.hostIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.portsByComponent.get(t)??[],i=n.filter((N)=>Jl(N)==="positive"),s=n.filter((N)=>Jl(N)==="negative"),o=n.filter((N)=>Gi(N,/^(?:OUT|VOUT|OUTPUT)$/));if(!r||i.length!==1||s.length!==1||o.length!==1||!n.some((N)=>Gi(N,/^(?:VS|VCC|VDD)$/))||!n.some((N)=>Gi(N,/^(?:GND|GROUND|VSS)$/)))return;let c=[i[0],s[0]],l=c.map((N)=>e.connected(N.source_port_id));if(c.some((N)=>N.do_not_connect)||l[0]===l[1]||l.includes(e.connected(o[0].source_port_id)))return;let a=c.map((N)=>e.port(N)),[p,d]=a;if(!p||!d||!p.facing_direction||p.facing_direction!==d.facing_direction||a.some((N)=>N.schematic_sheet_id!==r.schematicSheetId))return;let m=new Set((e.portsByNet.get(l[0])??[]).filter((N)=>e.components.get(N.source_component_id)?.ftype==="simple_resistor").map((N)=>N.source_component_id).filter((N)=>e.twoTerminalNets(N)?.includes(l[1])));if(m.size!==1)return;let f=[...m][0],_=e.components.get(f);if(_?.ftype!=="simple_resistor"||!Number.isFinite(_.resistance)||_.resistance<=0||_.resistance>1)return;if(l.some((N)=>(e.portsByNet.get(N)??[]).some((at)=>at.source_component_id!==t&&Jl(at)!==void 0&&e.components.get(at.source_component_id)?.ftype==="simple_chip")))return;let g=e.placement(f);if(!g||!e.sameLocalScope(r,g))return;let y=e.portsByComponent.get(f);if(y.some((N)=>N.do_not_connect))return;let S=l.map((N)=>e.port(y.find((at)=>e.connected(at.source_port_id)===N)));if(S.some((N)=>!N||N.schematic_sheet_id!==r.schematicSheetId))return;let P=p.facing_direction==="left"||p.facing_direction==="right",b=(N)=>P?N.y:N.x,C=b(p.center),L=b(d.center),B=Math.abs(C-L);if(B<nr)return;let k=P?g.schY:g.schX,I=(P?g.height:g.width)/2,j=Math.max(Math.min(C,L)-(k+I),k-I-Math.max(C,L));if(j<=Math.max(1.5,2*B)||Math.hypot(g.schX-r.schX,g.schY-r.schY)>Math.max(8,4*Math.max(r.width,r.height)))return;let Q=a.map((N,at)=>this.hasVisibleConnection(S[at],N,l[at]));if(Q[0]===Q[1])return;let lt=Q[0]?1:0,z=l[lt];if(!this.params.ctx.circuitJson.some((N)=>{if(N.type!=="schematic_net_label"||N.schematic_sheet_id!==r.schematicSheetId)return!1;if(N.source_net_id&&(e.connected(N.source_net_id)===z||e.connected(`connectivity:${N.source_net_id}`)===z))return!0;let at=S[lt].center;if(N.anchor_position&&Math.hypot(N.anchor_position.x-at.x,N.anchor_position.y-at.y)<nr)return!0;return N.source_trace_id!==void 0&&this.sourceTraceTouchesNet(N.source_trace_id,z)}))return;this.params.issues.push({lineItemType:"CurrentSenseShuntSeparatedFromInputs",amplifierSchematicBox:r,shuntSchematicBox:g,positiveInputSourcePortId:c[0].source_port_id,negativeInputSourcePortId:c[1].source_port_id,inputBandGap:j,message:`Place ${g.sourceComponentName||"component"} near ${r.sourceComponentName||"component"}.${c[0].name}/${c[1].name}, so both sense connections can be read together. Move or rotate the shunt as needed; preserve all pin connections and leave room for labels.`})}hasVisibleConnection(t,e,r){let n=this.traces.filter((o)=>{if(o.schematic_sheet_id!==t.schematic_sheet_id)return!1;if(o.subcircuit_connectivity_map_key)return this.index.connected(`connectivity:${o.subcircuit_connectivity_map_key}`)===r;if(this.sourceTraceTouchesNet(o.source_trace_id,r))return!0;let c=[o.edges[0]?.from,o.edges.at(-1)?.to],l=new Set(this.params.ctx.circuitJson.flatMap((a)=>a.type==="schematic_port"&&a.source_port_id&&a.schematic_sheet_id===o.schematic_sheet_id&&c.some((p)=>p&&Math.hypot(p.x-a.center.x,p.y-a.center.y)<nr)?[this.index.connected(a.source_port_id)]:[]));return l.size===1&&l.has(r)}).flatMap((o)=>o.edges),i=n.filter((o)=>os(t.center,o.from,o.to)),s=new Set;for(let o=0;o<i.length;o++){let c=i[o];if(os(e.center,c.from,c.to))return!0;for(let[l,a]of n.entries()){if(s.has(l)||![c.from,c.to].some((p)=>os(p,a.from,a.to))&&![a.from,a.to].some((p)=>os(p,c.from,c.to)))continue;s.add(l),i.push(a)}}return!1}sourceTraceTouchesNet(t,e){if(!t)return!1;let r=this.params.ctx.circuitJson.find((n)=>n.type==="source_trace"&&n.source_trace_id===t);return r?.type==="source_trace"&&r.connected_source_port_ids.some((n)=>this.index.connected(n)===e)}static issueToString(t){let e=[];return v(e,"amplifierName",t.amplifierSchematicBox.sourceComponentName),v(e,"shuntName",t.shuntSchematicBox.sourceComponentName),v(e,"inputBandGap",t.inputBandGap),v(e,"message",t.message),`<CurrentSenseShuntSeparatedFromInputs ${e.join(" ")} />`}}function Gi(t,e){return[t.name,...t.port_hints??[]].some((r)=>e.test(r.toUpperCase().replace(/[\s_]/g,"")))}function Jl(t){let e=Gi(t,/^(?:IN\+|VIN\+|INPOS|VINPOS)$/),r=Gi(t,/^(?:IN-|VIN-|INNEG|VINNEG)$/);return e===r?void 0:e?"positive":"negative"}function os(t,e,r){let n=r.x-e.x,i=r.y-e.y,s=Math.hypot(n,i);if(s<nr)return Math.hypot(t.x-e.x,t.y-e.y)<nr;let o=((t.x-e.x)*n+(t.y-e.y)*i)/s;return o>=-nr&&o<=s+nr&&Math.abs((t.x-e.x)*i-(t.y-e.y)*n)/s<nr}class Ln extends U{params;index;positiveNets=new Set;resistorIds;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.resistorIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_resistor").map((e)=>e.source_component_id);for(let e of t.ctx.circuitJson)if(e.type==="source_net"&&e.is_positive_voltage_source)this.positiveNets.add(this.index.connected(e.source_net_id));this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.resistorIds.length,!t||!this.isResistor(t))return;let e=this.index,r=e.twoTerminalNets(t);if(!r)return;let n=r.filter((y)=>e.isRail(y));if(n.length!==1)return;let i=n[0];if(!this.positiveNets.has(i)||e.groundNets.has(i))return;let s=r.find((y)=>y!==i),o=e.portsByNet.get(s)??[],c=new Set(o.filter((y)=>e.components.get(y.source_component_id)?.ftype==="simple_resistor").map((y)=>y.source_component_id));if(c.size!==2)return;let l=[...c].find((y)=>y!==t);if(!this.isResistor(l))return;let a=e.twoTerminalNets(l),p=a?.find((y)=>y!==s);if(!a?.includes(s)||!p||!e.groundNets.has(p)||e.powerNets.has(p)||!o.some((y)=>!c.has(y.source_component_id)))return;let d=e.placement(t),m=e.placement(l);if(!d||!m||!e.sameLocalScope(d,m))return;let f=this.getDownwardResistorPorts(t,i,s),_=this.getDownwardResistorPorts(l,s,p);if(!f||!_)return;let g=m.schY-m.height/2-(d.schY+d.height/2);if(g<=1.5)return;this.params.issues.push({lineItemType:"VoltageDividerSupplyResistorBelowGroundResistor",supplyResistorSchematicBox:d,groundResistorSchematicBox:m,supplyTapSourcePortId:f.bottom.source_port_id,groundTapSourcePortId:_.top.source_port_id,reversedBodyGap:g,message:`Place ${d.sourceComponentName||"component"} above ${m.sourceComponentName||"component"}, close enough to read their shared divider tap. Preserve all connections and leave room for labels; exact alignment is not required.`})}isResistor(t){let e=this.index.components.get(t);return e?.ftype==="simple_resistor"&&Number.isFinite(e.resistance)&&e.resistance>0}getDownwardResistorPorts(t,e,r){let n=this.index,i=n.placement(t),s=n.portsByComponent.get(t);if(s.some((p)=>p.do_not_connect))return;let o=s.find((p)=>n.connected(p.source_port_id)===e),c=s.find((p)=>n.connected(p.source_port_id)===r);if(!o||!c)return;let l=n.port(o),a=n.port(c);if(!l||!a||l.schematic_sheet_id!==i.schematicSheetId||a.schematic_sheet_id!==i.schematicSheetId||l.facing_direction!=="up"||a.facing_direction!=="down"||l.center.y<=a.center.y)return;return{top:o,bottom:c}}static issueToString(t){let e=[];return v(e,"supplyResistorName",t.supplyResistorSchematicBox.sourceComponentName),v(e,"groundResistorName",t.groundResistorSchematicBox.sourceComponentName),v(e,"reversedBodyGap",t.reversedBodyGap),v(e,"message",t.message),`<VoltageDividerSupplyResistorBelowGroundResistor ${e.join(" ")} />`}}class Tn extends U{params;index;hostIds;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.hostIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_chip").map((e)=>e.source_component_id),this.solved=this.hostIds.length===0}_step(){let t=this.hostIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.hostIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.portsByComponent.get(t)??[];if(!r||n.some((k)=>!ss(k)))return;let i=n.filter((k)=>ss(k)==="input"),s=n.filter((k)=>ss(k)==="output"),o=n.filter((k)=>ss(k)==="ground");if(i.length!==1||s.length!==1||!o.length)return;let c=i[0],l=s[0];if([c,l,...o].some((k)=>k.do_not_connect))return;let a=e.connected(c.source_port_id),p=e.connected(l.source_port_id),d=new Set(o.map((k)=>e.connected(k.source_port_id)));if(d.size!==1)return;let m=[...d][0];if(new Set([a,p,m]).size!==3||!(e.groundNets.has(m)||o.some((k)=>k.requires_ground||k.provides_ground))||!(e.powerNets.has(a)||c.requires_power)||!(e.powerNets.has(p)||l.provides_power))return;let f=e.port(c),_=e.port(l);if(!f||!_||f.schematic_sheet_id!==r.schematicSheetId||_.schematic_sheet_id!==r.schematicSheetId)return;let g=f.facing_direction==="left"&&_.facing_direction==="right"||f.facing_direction==="right"&&_.facing_direction==="left",y=f.facing_direction==="up"&&_.facing_direction==="down"||f.facing_direction==="down"&&_.facing_direction==="up";if(!g&&!y)return;let S=_.facing_direction==="right"||_.facing_direction==="up"?1:-1;if(S*(g?_.center.x-f.center.x:_.center.y-f.center.y)<=0.01)return;let b=this.localCapacitor(r,a,m),C=this.localCapacitor(r,p,m);if(!b||!C)return;let L=(k,I)=>{let j=I*S*(g?k.schX-r.schX:k.schY-r.schY),Q=g?(r.width+k.width)/2:(r.height+k.height)/2;return j>Q+0.2};if(!L(b,1)||!L(C,-1))return;let B=r.sourceComponentName||"component";this.params.issues.push({lineItemType:"RegulatorCapacitorsOnWrongSides",regulatorSchematicBox:r,inputCapacitorSchematicBox:b,outputCapacitorSchematicBox:C,inputSourcePortId:c.source_port_id,outputSourcePortId:l.source_port_id,message:`Place ${b.sourceComponentName} near ${B}.${c.name} on the ${f.facing_direction} side and ${C.sourceComponentName} near ${B}.${l.name} on the ${_.facing_direction} side. Preserve all connections and leave room for labels; exact alignment is not required.`})}localCapacitor(t,e,r){let n=this.index,i=[],s=Math.max(6,4*Math.max(t.width,t.height)),o=new Set((n.portsByNet.get(e)??[]).map((c)=>c.source_component_id));for(let c of o){if(n.components.get(c)?.ftype!=="simple_capacitor")continue;let l=n.twoTerminalNets(c),a=n.placement(c);if(!l?.includes(r)||!a||!n.sameLocalScope(t,a))continue;if(Math.hypot(a.schX-t.schX,a.schY-t.schY)>s)continue;if(n.portsByComponent.get(c).some((d)=>d.do_not_connect||!n.port(d)||n.port(d).schematic_sheet_id!==t.schematicSheetId))continue;i.push(a)}return i.length===1?i[0]:void 0}static issueToString(t){let e=[];return v(e,"regulatorName",t.regulatorSchematicBox.sourceComponentName),v(e,"inputCapacitorName",t.inputCapacitorSchematicBox.sourceComponentName),v(e,"outputCapacitorName",t.outputCapacitorSchematicBox.sourceComponentName),v(e,"message",t.message),`<RegulatorCapacitorsOnWrongSides ${e.join(" ")} />`}}function ss(t){let e=new Set;for(let r of[t.name,...t.port_hints??[]]){let n=r.toUpperCase().replace(/[ _-]/g,"");if(/^(?:VIN|IN|INPUT)$/.test(n))e.add("input");else if(/^(?:VOUT|OUT|OUTPUT)$/.test(n))e.add("output");else if(/^(?:GND\d*|VSS)$/.test(n))e.add("ground");else if(/^(?:EN|ENABLE|CE|SHDN|NC\d*|EP|PAD|ADJ|FB|BYP|BYPASS|NR|PG|PGOOD)$/.test(n))e.add("control")}return e.size===1?[...e][0]:void 0}var Qi=0.01,Fy={right:{x:1,y:0},left:{x:-1,y:0},up:{x:0,y:1},down:{x:0,y:-1}},Ht=(t,e)=>t.x*e.x+t.y*e.y,Hi=(t,e)=>Math.abs(t.x-e.x)+Math.abs(t.y-e.y),ir=(t,e)=>Hi(t,e)<=Qi,En=(t)=>Math.round(t*100)/100;class Rn extends U{params;constructor(t){super();this.params=t}_step(){let{ctx:t,issues:e}=this.params,r=new tt(t);for(let i of r.portsByComponent.values())for(let s of i){let o=r.connected(s.source_port_id);if(s.requires_ground||s.provides_ground)r.groundNets.add(o);if(s.requires_power||s.provides_power)r.powerNets.add(o)}let n=t.circuitJson.filter((i)=>i.type==="schematic_trace");for(let[i,s]of r.components){if(s.ftype!=="simple_pin_header"&&s.ftype!=="simple_connector")continue;let o=r.placement(i),c=r.portsByComponent.get(i)??[];if(!o||c.length<2)continue;let l=c.map((D)=>r.port(D)),a=l[0]?.facing_direction;if(!a||l.some((D)=>!D||D.facing_direction!==a))continue;let p=Fy[a],d={x:-p.y,y:p.x},m=n.filter((D)=>D.schematic_sheet_id===o.schematicSheetId),f=t.circuitJson.filter((D)=>D.type==="schematic_net_label"&&D.schematic_sheet_id===o.schematicSheetId),_=[],g=!1;for(let D of c){let it=r.port(D),rt=r.connected(D.source_port_id),G=(r.portsByNet.get(rt)??[]).filter((st)=>st.source_port_id!==D.source_port_id),H=m.filter((st)=>st.edges.some((bt)=>ir(bt.from,it.center)||ir(bt.to,it.center)));if(r.isRail(rt)){if(H.some((st)=>!f.some((bt)=>bt.anchor_position&&My(st,it.center,bt.anchor_position))))g=!0;continue}if(G.length===0){if(H.length>0)g=!0;continue}let J=G.length===1?r.port(G[0]):void 0,q=G.length===1?r.placement(G[0].source_component_id):void 0;if(!J?.facing_direction||!q||!r.sameLocalScope(o,q)||Ht(Fy[J.facing_direction],p)!==-1){g=!0;break}_.push({pin:it,peer:J,component:q})}if(g||_.length<2)continue;if(_.some((D)=>Ht(D.peer.center,p)>=Ht(D.pin.center,p)-2))continue;let y=_.map((D)=>m.filter((it)=>My(it,D.pin.center,D.peer.center)&&s5(it)>=3)).filter((D)=>D.length>0);if(y.length<2)continue;let S=y.flat(),P=[..._].sort((D,it)=>Ht(D.pin.center,d)-Ht(it.pin.center,d));if(P.some((D,it)=>it>0&&Ht(D.peer.center,d)<=Ht(P[it-1].peer.center,d)+Qi))continue;let b={x:o.schX,y:o.schY},C=Math.max(..._.map((D)=>Ht(D.pin.center,p)-Ht(b,p))),L=Math.min(..._.map((D)=>Ht(D.peer.center,p)))-2-C,B=_.map((D)=>Ht(D.peer.center,d)-Ht(D.pin.center,d)+Ht(b,d)).sort((D,it)=>D-it),k=B[Math.floor(B.length/2)],I={x:En(p.x*L+d.x*k),y:En(p.y*L+d.y*k)},j={x:I.x-b.x,y:I.y-b.y},Q=(D)=>({x:D.center.x+j.x,y:D.center.y+j.y});if(_.some((D)=>Hi(Q(D.pin),D.peer.center)>Hi(D.pin.center,D.peer.center)+Qi))continue;let lt=_.reduce((D,it)=>D+Hi(it.pin.center,it.peer.center),0),z=_.reduce((D,it)=>D+Hi(Q(it.pin),it.peer.center),0);if(lt-z<4||z>lt*0.75)continue;let N=t.componentPlacements.filter((D)=>D.schematicSheetId===o.schematicSheetId&&D.schematicComponentId!==o.schematicComponentId),at=zt(I.x,I.y,o.width+0.4,o.height+0.4);if(N.some((D)=>xr(at,zt(D.schX,D.schY,D.width,D.height))))continue;if(_.some((D)=>{let it=Q(D.pin),rt=D.peer.center,G=(Ht(it,p)+Ht(rt,p))/2,H=[it,{x:p.x*G+d.x*Ht(it,d),y:p.y*G+d.y*Ht(it,d)},{x:p.x*G+d.x*Ht(rt,d),y:p.y*G+d.y*Ht(rt,d)},rt];return N.some((J)=>J.schematicComponentId!==D.component.schematicComponentId&&H.slice(1).some((q,st)=>a5(H[st],q,J)))}))continue;let ot=[...new Map(_.map((D)=>[D.component.schematicComponentId,D.component])).values()],et=o.sourceComponentName||"component";e.push({lineItemType:"ConnectorPositionCausesTraceDetours",connectorSchematicBox:o,connectedComponents:ot,schematicTraceIds:[...new Set(S.map((D)=>D.schematic_trace_id))],evaluatedSignalCount:_.length,newSchX:I.x,newSchY:I.y,deltaSchX:En(j.x),deltaSchY:En(j.y),currentTotalSignalDistance:En(lt),suggestedTotalSignalDistance:En(z),message:`Move ${et} to schX=${I.x}, schY=${I.y} so its signal pins face ${ot.map((D)=>D.sourceComponentName||"component").join(", ")}. Preserve rotation and pin assignments; reroute the connections and attached rail labels.`})}this.solved=!0}static issueToString(t){let e=[];v(e,"connectorComponentName",t.connectorSchematicBox.sourceComponentName),v(e,"connectedComponents",t.connectedComponents.map((r)=>r.sourceComponentName||"component").join(","));for(let r of["evaluatedSignalCount","newSchX","newSchY","deltaSchX","deltaSchY","currentTotalSignalDistance","suggestedTotalSignalDistance"])v(e,r,t[r]);return v(e,"message",t.message),`<ConnectorPositionCausesTraceDetours ${e.join(" ")} />`}}function My(t,e,r){let n=t.edges[0]?.from,i=t.edges.at(-1)?.to;return!!n&&!!i&&(ir(n,e)&&ir(i,r)||ir(n,r)&&ir(i,e))}function s5(t){let e,r=0;for(let n=0;n<t.edges.length;n++){let i=t.edges[n];if(n>0&&!ir(t.edges[n-1].to,i.from))return 0;if(ir(i.from,i.to))continue;let s=Math.abs(i.from.y-i.to.y)<Qi?"x":Math.abs(i.from.x-i.to.x)<Qi?"y":void 0;if(!s)return 0;if(e&&e!==s)r++;e=s}return r}function a5(t,e,r){let n=zt(r.schX,r.schY,r.width+0.2,r.height+0.2);return Math.max(t.x,e.x)>n.left&&Math.min(t.x,e.x)<n.right&&Math.max(t.y,e.y)>n.bottom&&Math.min(t.y,e.y)<n.top}class On extends U{index;positiveNets=new Set;transistorIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t);for(let r of t.circuitJson)if(r.type==="source_net"&&r.is_positive_voltage_source)this.positiveNets.add(this.index.connected(r.source_net_id));this.transistorIds=[...this.index.components.values()].filter((r)=>r.ftype==="simple_transistor"&&r.transistor_type==="npn").map((r)=>r.source_component_id),this.solved=this.transistorIds.length===0}_step(){let t=this.transistorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.transistorIds.length,!t)return;let e=this.index,r=e.placement(t);if(!r||e.portsByComponent.get(t)?.length!==3)return;let n=e.namedPort(t,"base"),i=e.namedPort(t,"collector"),s=e.namedPort(t,"emitter");if(!n||!i||!s)return;let o=e.connected(n.source_port_id),c=e.connected(i.source_port_id),l=e.connected(s.source_port_id);if(new Set([o,c,l]).size!==3||!e.groundNets.has(l)||e.powerNets.has(l)||e.isRail(o)||e.isRail(c))return;let a=(e.portsByNet.get(o)??[]).filter((it)=>it.source_component_id!==t);if(a.length!==1)return;let p=a[0].source_component_id,d=e.components.get(p),m=e.placement(p),_=e.twoTerminalNets(p)?.find((it)=>it!==o);if(d?.ftype!=="simple_resistor"||d.resistance<=0||!m||!e.sameLocalScope(r,m)||!_||e.isRail(_)||_===c)return;let g=(e.portsByNet.get(c)??[]).filter((it)=>it.source_component_id!==t),y=g.filter((it)=>e.components.get(it.source_component_id)?.ftype==="simple_chip");if(y.length!==1)return;let S=y[0].source_component_id,P=e.placement(S),C=e.twoTerminalNets(S)?.find((it)=>it!==c);if(!P||!e.sameLocalScope(r,P)||!C||!this.positiveNets.has(C)||e.groundNets.has(C))return;let L=g.filter((it)=>it.source_component_id!==S);if(L.length!==1)return;let B=L[0].source_component_id,k=e.placement(B),I=e.namedPort(B,"anode"),j=e.namedPort(B,"cathode");if(e.components.get(B)?.ftype!=="simple_diode"||!e.twoTerminalNets(B)||!I||!j||e.connected(I.source_port_id)!==c||e.connected(j.source_port_id)!==C||!k||!e.sameLocalScope(r,k))return;let Q=e.port(i),lt=e.port(s),z=e.port(n);if(!Q||!lt||!z)return;let N=Q.facing_direction,at=lt.facing_direction;if(!N||!at)return;let ot=[];if(r.schY>=P.schY)ot.push("transistor_not_below_load");if(N!=="up")ot.push("collector_not_up");if(at!=="down")ot.push("emitter_not_down");if(ot.length===0)return;let et=r.sourceComponentName||"component",D=P.sourceComponentName||"component";this.issues.push({lineItemType:"LowSideTransistorNotAlignedWithLoad",transistorSchematicBox:r,loadSchematicBox:P,baseResistorSchematicBox:m,clampDiodeSchematicBox:k,collectorSourcePortId:i.source_port_id,emitterSourcePortId:s.source_port_id,collectorFacingDirection:N,emitterFacingDirection:at,placementProblems:ot,message:`Arrange ${et} below ${D}, with its collector facing up toward the load and emitter facing down toward ground; place ${m.sourceComponentName||"component"} beside the base. Preserve all pin connections and reroute affected traces.`})}static issueToString(t){let e=[];return v(e,"transistorName",t.transistorSchematicBox.sourceComponentName),v(e,"loadName",t.loadSchematicBox.sourceComponentName),v(e,"baseResistorName",t.baseResistorSchematicBox.sourceComponentName),v(e,"clampDiodeName",t.clampDiodeSchematicBox.sourceComponentName),v(e,"placementProblems",t.placementProblems.join(",")),v(e,"collectorFacingDirection",t.collectorFacingDirection),v(e,"emitterFacingDirection",t.emitterFacingDirection),v(e,"message",t.message),`<LowSideTransistorNotAlignedWithLoad ${e.join(" ")} />`}}class Wn extends U{params;index;hostIds;reportedPairs=new Set;currentIndex=0;constructor(t){super();this.params=t;this.index=new tt(t.ctx),this.hostIds=[...this.index.components.values()].filter((e)=>e.ftype==="simple_chip").map((e)=>e.source_component_id),this.solved=this.hostIds.length===0}_step(){let t=this.hostIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.hostIds.length,!t)return;let e=this.index.portsByComponent.get(t)??[],r=e.filter((L)=>Cy(L)==="positive"),n=e.filter((L)=>Cy(L)==="negative");if(r.length!==1||n.length!==1)return;let i=r[0],s=n[0],o=this.seriesResistor(i),c=this.seriesResistor(s);if(!o||!c||o.axis!==c.axis||!this.index.sameLocalScope(o.placement,c.placement)||new Set([o.hostNet,c.hostNet,o.interfaceNet,c.interfaceNet]).size!==4||!this.shareInterface(o,c,t))return;let l=[o.id,c.id].sort().join("\x00");if(this.reportedPairs.has(l))return;let a=o.placement,p=c.placement,d=o.axis==="horizontal",m=Math.abs(d?a.schX-p.schX:a.schY-p.schY),f=Math.abs(d?a.schY-p.schY:a.schX-p.schX),_=d?a.width:a.height,g=d?p.width:p.height,y=d?a.height:a.width,S=d?p.height:p.width;if(m-(_+g)/2<Math.max(_,g)||f>=(y+S)/2-0.01)return;this.reportedPairs.add(l);let b=a.sourceComponentName||"component",C=p.sourceComponentName||"component";this.params.issues.push({lineItemType:"UsbSeriesResistorsNotAligned",positiveResistorSchematicBox:a,negativeResistorSchematicBox:p,hostSourceComponentId:t,positiveSourcePortId:i.source_port_id,negativeSourcePortId:s.source_port_id,signalAxis:o.axis,message:`Place ${b} (D+) and ${C} (D−) near each other and draw clear traces to their corresponding USB ports. Exact alignment is not required; preserve pin assignments and leave space for labels.`})}seriesResistor(t){let e=this.index,r=e.connected(t.source_port_id);if(e.isRail(r))return;let n=new Set((e.portsByNet.get(r)??[]).filter((f)=>e.components.get(f.source_component_id)?.ftype==="simple_resistor").map((f)=>f.source_component_id));if(n.size!==1)return;let i=[...n][0],o=e.twoTerminalNets(i)?.find((f)=>f!==r),c=e.placement(i);if(!o||e.isRail(o)||!c)return;if((e.portsByNet.get(o)??[]).some((f)=>f.source_component_id!==i&&e.components.get(f.source_component_id)?.ftype==="simple_resistor"))return;let l=e.portsByComponent.get(i).map((f)=>e.port(f)),[a,p]=l;if(!a||!p)return;let d=new Set([a.facing_direction,p.facing_direction]),m;if(d.has("left")&&d.has("right")&&Math.abs(a.center.y-p.center.y)<0.01)m="horizontal";else if(d.has("up")&&d.has("down")&&Math.abs(a.center.x-p.center.x)<0.01)m="vertical";else return;return{id:i,placement:c,hostNet:r,interfaceNet:o,axis:m}}shareInterface(t,e,r){let n=(s)=>new Set((this.index.portsByNet.get(s)??[]).map((o)=>o.source_component_id).filter((o)=>o!==r&&o!==t.id&&o!==e.id&&(this.index.portsByComponent.get(o)?.length??0)>2)),i=n(t.interfaceNet);return[...n(e.interfaceNet)].some((s)=>i.has(s))}static issueToString(t){let e=[];return v(e,"positiveResistorName",t.positiveResistorSchematicBox.sourceComponentName),v(e,"negativeResistorName",t.negativeResistorSchematicBox.sourceComponentName),v(e,"signalAxis",t.signalAxis),v(e,"message",t.message),`<UsbSeriesResistorsNotAligned ${e.join(" ")} />`}}function Cy(t){let e=new Set;for(let r of[t.name,...t.port_hints??[]]){let n=r.toUpperCase();if(/^(?:USB_?)?D(?:P|\+|_POS)$/.test(n))e.add("positive");if(/^(?:USB_?)?D(?:M|N|-|_NEG)$/.test(n))e.add("negative")}return e.size===1?[...e][0]:void 0}function ky(t){return t.filter((e)=>e!==void 0).reduce((e,r)=>Qo(e,r),{})}function Ny(t,e,r){return{rects:[{center:{x:t.schX,y:t.schY},width:t.width,height:t.height,stroke:e,fill:e.replace("0.95","0.15"),label:r}]}}function Yy(t){return{rects:t.filter((r)=>r.type==="schematic_box").map((r)=>{let n=r;return{center:{x:n.x,y:n.y},width:n.width,height:n.height,stroke:"hsl(0,0%,60%)"}})}}class le extends U{static EPSILON=0.01;static ORIENTATION_MESSAGE='Use schOrientation="vertical" on this capacitor to fix the symbol orientation';ctx;out;schematicComponentById;sourceComponentById;capacitorPlacements;feedbackCapacitorIds;currentPlacementIndex=0;horizontalSymbolNames=new Set(["capacitor_left","capacitor_right"]);constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e,this.schematicComponentById=this.buildSchematicComponentById(t.circuitJson),this.sourceComponentById=this.buildSourceComponentById(t.circuitJson),this.capacitorPlacements=this.getCapacitorPlacements();let r=new tt(t);this.feedbackCapacitorIds=new Set(this.capacitorPlacements.flatMap((n)=>n.sourceComponentId&&r.isDirectOpAmpFeedback(n.sourceComponentId)?[n.sourceComponentId]:[])),this.solved=this.capacitorPlacements.length===0}getCapacitorPlacements(){return this.ctx.componentPlacements.filter((t)=>t.sourceComponentId!==void 0&&this.sourceComponentById.get(t.sourceComponentId)?.ftype==="simple_capacitor").map((t)=>({schX:t.schX,schY:t.schY,width:t.width,height:t.height,sourceComponentId:t.sourceComponentId,sourceComponentName:t.sourceComponentName,schematicComponentId:t.schematicComponentId,schematicSheetId:t.schematicSheetId,schematicSheetName:t.schematicSheetName}))}_step(){let t=this.capacitorPlacements[this.currentPlacementIndex];if(!t){this.solved=!0;return}this.currentPlacementIndex+=1,this.solved=this.currentPlacementIndex>=this.capacitorPlacements.length;let e=this.getIssueForPlacement(t);if(e)this.out.push(e)}visualize(){let t=this.getFocusedPlacement();return ky([Yy(this.ctx.circuitJson),t?Ny(t,"hsl(210, 100%, 50%, 0.95)","capacitorOrientation"):void 0])}getFocusedPlacement(){if(this.capacitorPlacements.length===0)return;let t=this.iterations===0?this.currentPlacementIndex:Math.max(0,this.currentPlacementIndex-1);return this.capacitorPlacements[t]}buildSchematicComponentById(t){return new Map(t.filter((e)=>e.type==="schematic_component").map((e)=>[e.schematic_component_id,e]))}buildSourceComponentById(t){return new Map(t.flatMap((e)=>{if(e.type!=="source_component"||!("source_component_id"in e)||typeof e.source_component_id!=="string")return[];return[{type:"source_component",source_component_id:e.source_component_id,ftype:"ftype"in e&&typeof e.ftype==="string"?e.ftype:void 0}]}).map((e)=>[e.source_component_id,e]))}createIssuePlacement(t){return{positionAnchor:"center",schX:t.schX,schY:t.schY,width:t.width,height:t.height,sourceComponentId:t.sourceComponentId,sourceComponentName:t.sourceComponentName,schematicComponentId:t.schematicComponentId,schematicSheetId:t.schematicSheetId,schematicSheetName:t.schematicSheetName}}getIssueForPlacement(t){if(!t.schematicComponentId||!t.sourceComponentId)return;let e=this.schematicComponentById.get(t.schematicComponentId);if(!e)return;if(!this.horizontalSymbolNames.has(e.symbol_name??""))return;if(this.feedbackCapacitorIds.has(t.sourceComponentId))return;if(this.isInlineWithHorizontalTraces(t.schematicComponentId))return;return{lineItemType:"CapacitorSymbolHorizontal",schematicBox:this.createIssuePlacement(t),message:le.ORIENTATION_MESSAGE}}isInlineWithHorizontalTraces(t){let e=this.ctx.circuitJson.filter((n)=>n.type==="schematic_port"&&n.schematic_component_id===t);if(e.length!==2)return!1;let r=e.map((n)=>this.getOutwardHorizontalTrace(n));return r.every((n)=>n!==void 0)&&r.some((n)=>n!==void 0&&n.edges.every((i)=>Math.abs(i.from.y-i.to.y)<=le.EPSILON))}getOutwardHorizontalTrace(t){if(t.facing_direction!=="left"&&t.facing_direction!=="right")return;return this.ctx.circuitJson.find((e)=>e.type==="schematic_trace"&&e.schematic_sheet_id===t.schematic_sheet_id&&e.edges.some((r)=>{let n=this.pointsEqual(r.from,t.center)?r.to:this.pointsEqual(r.to,t.center)?r.from:void 0;return n!==void 0&&Math.abs(n.y-t.center.y)<=le.EPSILON&&(t.facing_direction==="left"?n.x<t.center.x-le.EPSILON:n.x>t.center.x+le.EPSILON)}))}pointsEqual(t,e){return Math.abs(t.x-e.x)<=le.EPSILON&&Math.abs(t.y-e.y)<=le.EPSILON}static issueToString(t){let e=[];return v(e,"componentName",t.schematicBox.sourceComponentName),v(e,"schX",t.schematicBox.schX),v(e,"schY",t.schematicBox.schY),v(e,"width",t.schematicBox.width),v(e,"height",t.schematicBox.height),v(e,"message",t.message),`<CapacitorSymbolHorizontal ${e.join(" ")} />`}}class Re extends U{params;static MIN_BODY_GAP=1;banks=[];netNames=new Map;bankIndex=0;constructor(t){super();this.params=t;let e=new tt(t.ctx),r=new Set(e.powerNets),n=new Set(e.groundNets);for(let i of t.ctx.circuitJson)if(i.type==="source_net"){let s=e.connected(i.source_net_id);if(!this.netNames.has(s))this.netNames.set(s,i.name)}for(let i of e.portsByComponent.values())for(let s of i){if(s.do_not_connect)continue;let o=e.connected(s.source_port_id);if(s.provides_power||s.requires_power)r.add(o);if(s.provides_ground||s.requires_ground)n.add(o);if((r.has(o)||n.has(o))&&!this.netNames.has(o))this.netNames.set(o,s.name)}for(let i of e.components.values()){if(i.ftype!=="simple_capacitor")continue;let s=i.source_component_id,o=e.placement(s),c=e.twoTerminalNets(s),l=e.portsByComponent.get(s);if(!o||!c||!l||l.some((m)=>{let f=e.port(m);return m.do_not_connect||!f||f.schematic_sheet_id!==o.schematicSheetId}))continue;let a=c.find((m)=>r.has(m)&&!n.has(m)),p=c.find((m)=>n.has(m)&&!r.has(m));if(!a||!p)continue;let d=this.banks.find((m)=>m.power===a&&m.ground===p&&e.sameLocalScope(m.capacitors[0],o));if(d)d.capacitors.push(o);else this.banks.push({power:a,ground:p,capacitors:[o]})}this.solved=this.banks.length===0}_step(){let t=this.banks[this.bankIndex++];if(this.solved=this.bankIndex>=this.banks.length,t.capacitors.length<2)return;let e=Math.max(Re.MIN_BODY_GAP,...t.capacitors.map((o)=>Math.max(o.width,o.height))),r=0,n=t.capacitors.slice(1).map((o)=>({box:o,gap:Re.bodyGap(t.capacitors[0],o)}));while(n.length>0){let o=0;for(let l=1;l<n.length;l++)if(n[l].gap<n[o].gap)o=l;let c=n.splice(o,1)[0];r=Math.max(r,c.gap);for(let l of n)l.gap=Math.min(l.gap,Re.bodyGap(c.box,l.box))}if(r<=e+0.000001)return;let i=this.netNames.get(t.power)??"power",s=this.netNames.get(t.ground)??"ground";this.params.issues.push({lineItemType:"DecouplingCapacitorsNotCloseTogether",railName:i,groundName:s,capacitorSchematicBoxes:t.capacitors,maxBodyGap:r,maxRecommendedBodyGap:e,message:`Group the decoupling capacitors between ${i} and ${s} closer together in this schematic block. Preserve their net connections.`})}static bodyGap(t,e){return Math.hypot(Math.max(0,Math.abs(t.schX-e.schX)-(t.width+e.width)/2),Math.max(0,Math.abs(t.schY-e.schY)-(t.height+e.height)/2))}static issueToString(t){let e=[];return v(e,"rail",t.railName),v(e,"ground",t.groundName),v(e,"capacitorNames",t.capacitorSchematicBoxes.map((r)=>r.sourceComponentName||"component").join(", ")),v(e,"maxBodyGap",t.maxBodyGap),v(e,"maxRecommendedBodyGap",t.maxRecommendedBodyGap),v(e,"message",t.message),`<DecouplingCapacitorsNotCloseTogether ${e.join(" ")} />`}}class or extends U{params;placements;netLabelsByComponentId;rawCollisions=[];firstIndex=0;secondIndex=1;constructor(t){super();this.params=t;this.placements=t.ctx.componentPlacements,this.netLabelsByComponentId=this.buildNetLabelsByComponentId(t.ctx.circuitJson),this.solved=this.placements.length<2}_step(){if(this.firstIndex>=this.placements.length-1){this.buildAndPushIssues(),this.solved=!0;return}let t=this.placements[this.firstIndex],e=this.placements[this.secondIndex];if(this.detectPair(t,e),this.secondIndex++,this.secondIndex>=this.placements.length)this.firstIndex++,this.secondIndex=this.firstIndex+1}detectPair(t,e){if(t.schematicSheetId!==e.schematicSheetId)return;this.rawCollisions.push(...this.detectLabelLabel(t,e)),this.rawCollisions.push(...this.detectBoxLabel(t,e)),this.rawCollisions.push(...this.detectBoxLabel(e,t))}detectLabelLabel(t,e){let r=t,n=e;if(t.schX>e.schX)r=e,n=t;let i=r.schematicComponentId,s=n.schematicComponentId;if(!i||!s)return[];let o=this.netLabelsByComponentId.get(i)??[],c=this.netLabelsByComponentId.get(s)??[];if(o.length===0||c.length===0)return[];let l=[];for(let a of o)for(let p of c){let d=Ke(a),m=Ke(p);if(xr(d,m))l.push({type:"label-label",bounds:{left:Math.max(d.left,m.left),right:Math.min(d.right,m.right),top:Math.min(d.top,m.top),bottom:Math.max(d.bottom,m.bottom)},leftComp:r,rightComp:n,leftId:i,rightId:s,xSeparation:d.right-m.left+0.1})}return l}detectBoxLabel(t,e){let r=t.schematicComponentId,n=e.schematicComponentId;if(!r||!n)return[];let i=this.netLabelsByComponentId.get(n)??[];if(i.length===0)return[];let s=zt(t.schX,t.schY,t.width,t.height),o=t.schX<=e.schX,c=[];for(let l of i){let a=Ke(l);if(!xr(s,a))continue;let p;if(o)p=s.right-a.left+0.1;else p=a.right-s.left+0.1;c.push({type:"box-label",bounds:{left:Math.max(s.left,a.left),right:Math.min(s.right,a.right),top:Math.min(s.top,a.top),bottom:Math.max(s.bottom,a.bottom)},boxComp:t,labelComp:e,boxId:r,labelId:n,xSeparation:p})}return c}buildAndPushIssues(){if(this.rawCollisions.length===0)return;let t=new Map;for(let e of this.rawCollisions){let n=(e.type==="label-label"?e.leftComp:e.boxComp).schematicSheetId??"",i=t.get(n);if(i)i.push(e);else t.set(n,[e])}for(let e of t.values())this.buildAndPushIssueForSheet(e)}buildAndPushIssueForSheet(t){let e=this.computeGlobalFixes(t);if(e.size===0)return;let r=new Set,n=[];for(let o of t){let c,l;if(o.type==="label-label")c=o.leftComp.sourceComponentName??"",l=o.rightComp.sourceComponentName??"";else c=o.boxComp.sourceComponentName??"",l=o.labelComp.sourceComponentName??"";let a=`${c}/${l}`;if(!r.has(a))r.add(a),n.push({comp1Name:c,comp2Name:l})}let i=t[0],s=i.type==="label-label"?i.leftComp:i.boxComp;this.params.issues.push({lineItemType:"NetLabelCollision",schematicSheetId:s.schematicSheetId,schematicSheetName:s.schematicSheetName,pairs:n,collisionBounds:t.map((o)=>o.bounds),moves:Array.from(e.values())})}computeGlobalFixes(t){let e=new Map;for(let a of this.placements)if(a.schematicComponentId)e.set(a.schematicComponentId,a);let r=new Map,n=(a,p,d)=>{let m=e.get(a),f=e.get(p);if(!m||!f)return;let _=f.schX-m.schX+d,g=`${a}|${p}`;r.set(g,Math.max(r.get(g)??0,_))};for(let a of t)if(a.type==="label-label")n(a.leftId,a.rightId,a.xSeparation);else if(a.boxComp.schX<=a.labelComp.schX)n(a.boxId,a.labelId,a.xSeparation);else n(a.labelId,a.boxId,a.xSeparation);let i=[...r.entries()].map(([a,p])=>{let d=a.indexOf("|");return{leftId:a.slice(0,d),rightId:a.slice(d+1),minSep:p}}),s=new Set,o=new Map;for(let{leftId:a,rightId:p}of i){if(s.add(a),s.add(p),!o.has(a))o.set(a,new Set);if(!o.has(p))o.set(p,new Set);o.get(a).add(p),o.get(p).add(a)}let c=new Set,l=new Map;for(let a of s){if(c.has(a))continue;let p=[],d=[a];c.add(a);while(d.length){let y=d.shift();p.push(y);for(let S of o.get(y)??[])if(!c.has(S))c.add(S),d.push(S)}p.sort((y,S)=>(e.get(y)?.schX??0)-(e.get(S)?.schX??0));let m=new Set(p),f=i.filter((y)=>m.has(y.leftId)&&m.has(y.rightId)),_=new Map;for(let y of p){let S=e.get(y)?.schX??0;for(let{leftId:P,rightId:b,minSep:C}of f)if(b===y&&_.has(P))S=Math.max(S,_.get(P)+C);_.set(y,S)}let g=[..._.entries()].reduce((y,[S,P])=>y+(P-(e.get(S)?.schX??0)),0);if(g>0.000000001){let y=g/p.length,S=new Map;for(let b of p){let C=(e.get(b)?.schX??0)-y;for(let{leftId:L,rightId:B,minSep:k}of f)if(B===b&&S.has(L))C=Math.max(C,S.get(L)+k);S.set(b,C)}let P=(b)=>[...b.entries()].reduce((C,[L,B])=>Math.max(C,Math.abs(B-(e.get(L)?.schX??0))),0);if(P(S)<P(_))for(let[b,C]of S)_.set(b,C)}for(let[y,S]of _){let P=e.get(y);if(!P||Math.abs(S-P.schX)<0.000000001)continue;l.set(y,{componentName:P.sourceComponentName||"component",newSchX:Math.round(S*100)/100,newSchY:Math.round(P.schY*100)/100})}}return l}buildNetLabelsByComponentId(t){let r=[];for(let i of t){if(i.type!=="schematic_port")continue;let s=i;if(!s.schematic_component_id)continue;r.push({componentId:s.schematic_component_id,cx:s.center.x,cy:s.center.y,schematicSheetId:s.schematic_sheet_id})}let n=new Map;for(let i of t){if(i.type!=="schematic_net_label")continue;let s=i;if(!s.anchor_position)continue;let{x:o,y:c}=s.anchor_position,l=r.filter((m)=>m.schematicSheetId===s.schematic_sheet_id&&Math.hypot(m.cx-o,m.cy-c)<0.0001);if(l.length===0)continue;if(new Set(l.map((m)=>m.componentId)).size!==1)continue;let p=l[0].componentId,d=n.get(p)??[];d.push(s),n.set(p,d)}return n}static netLabelCollisionToString(t){let e=t.pairs.map((n,i)=>`pair${i+1}="${n.comp1Name}/${n.comp2Name}"`).join(" "),r=t.moves.map((n)=>`    <Move componentName="${n.componentName}" newSchX="${n.newSchX}" newSchY="${n.newSchY}" />`);return[`<ComponentNetLabelCollision ${e}>`,'  <SuggestedFix note="Apply all moves simultaneously. Set schAutoLayoutEnabled on your circuit.">',...r,"  </SuggestedFix>","</ComponentNetLabelCollision>"].join(`
`)}}class sr extends U{static ALIGNMENT_EPSILON=0.01;ctx;out;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e}_step(){let t=new Map(this.ctx.circuitJson.filter((n)=>n.type==="schematic_port").map((n)=>[n.schematic_port_id,n])),e=new Map(this.ctx.componentPlacements.flatMap((n)=>n.schematicComponentId?[[n.schematicComponentId,n]]:[])),r=new Map;for(let n of this.ctx.circuitJson.filter((i)=>i.type==="schematic_trace")){let i=this.getTracePinPair(n,t);if(!i)continue;let s=i.firstPort.schematic_component_id,o=i.secondPort.schematic_component_id;if(!s||!o||s===o)continue;let c=s<o?i:{firstPort:i.secondPort,secondPort:i.firstPort},l=[s,o].sort().join("\x00"),a=r.get(l)??[];if(!a.some((d)=>d.firstPort.schematic_port_id===c.firstPort.schematic_port_id&&d.secondPort.schematic_port_id===c.secondPort.schematic_port_id))a.push(c);r.set(l,a)}for(let n of r.values()){let i=this.findVerticalShiftIssue(n,e);if(i)this.out.push(i)}this.solved=!0}getTracePinPair(t,e){let r=t.edges?.[0],n=t.edges?.at(-1);if(!r||!n)return;let i=r.from_schematic_port_id??r.to_schematic_port_id,s=n.to_schematic_port_id??n.from_schematic_port_id,o=[...e.values()],c=i?e.get(i):this.findPortAtPoint(o,r.from,t.schematic_sheet_id),l=s?e.get(s):this.findPortAtPoint(o,n.to,t.schematic_sheet_id);if(!c||!l)return;if(c.schematic_port_id===l.schematic_port_id)return;if(c.schematic_sheet_id!==l.schematic_sheet_id)return;return{firstPort:c,secondPort:l}}findPortAtPoint(t,e,r){let{ALIGNMENT_EPSILON:n}=sr;return t.find((i)=>i.schematic_sheet_id===r&&Math.abs(i.center.x-e.x)<=n&&Math.abs(i.center.y-e.y)<=n)}findVerticalShiftIssue(t,e){let r=t[0];if(!r)return;let n=e.get(r.firstPort.schematic_component_id),i=e.get(r.secondPort.schematic_component_id);if(!n||!i)return;let[s,o]=n.schX<=i.schX?[n,i]:[i,n],c=t.flatMap((g)=>{let[y,S]=g.firstPort.center.x<=g.secondPort.center.x?[g.firstPort,g.secondPort]:[g.secondPort,g.firstPort];return y.facing_direction==="right"&&S.facing_direction==="left"?[{leftPort:y,rightPort:S}]:[]});if(c.length<2)return;let{ALIGNMENT_EPSILON:l}=sr,a=c.filter(({leftPort:g,rightPort:y})=>Math.abs(g.center.y-y.center.y)<=l).length,p=[];for(let g of c){let y=g.leftPort.center.y-g.rightPort.center.y;if(Math.abs(y)<=l)continue;let S=p.find((P)=>Math.abs(P.deltaSchY-y)<=l);if(S)S.pairs.push(g);else p.push({deltaSchY:y,pairs:[g]})}let d=p.sort((g,y)=>y.pairs.length-g.pairs.length||Math.abs(g.deltaSchY)-Math.abs(y.deltaSchY))[0];if(!d||d.pairs.length<2||d.pairs.length<=a)return;let m=o.sourceComponentName||"component",f=d.deltaSchY,_=o.schY+f;return{lineItemType:"ComponentPinsWouldAlignWithVerticalShift",firstComponent:s,secondComponent:o,targetComponent:o,deltaSchY:f,newSchY:_,currentlyAlignedPinCount:a,alignedPinCount:d.pairs.length,alignedPinPairs:d.pairs.map(({leftPort:g,rightPort:y})=>({firstPin:this.getPinLabel(g),secondPin:this.getPinLabel(y)})),message:`shift ${m} vertically by ${jl(f)} to align ${d.pairs.length} connected pin pairs`}}getPinLabel(t){return t.display_pin_label??t.pin_number?.toString()}static issueToString(t){let e=[];return v(e,"firstComponentName",t.firstComponent.sourceComponentName),v(e,"secondComponentName",t.secondComponent.sourceComponentName),v(e,"targetComponentName",t.targetComponent.sourceComponentName),v(e,"deltaSchY",t.deltaSchY),v(e,"newSchY",t.newSchY),v(e,"currentlyAlignedPinCount",t.currentlyAlignedPinCount),v(e,"alignedPinCount",t.alignedPinCount),v(e,"message",t.message),`<ComponentPinsWouldAlignWithVerticalShift ${e.join(" ")} />`}}class Oe extends U{static ALIGNMENT_TOLERANCE=0.1;issues;networks;currentNetworkIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.networks=this.findCrystalLoadNetworks(t),this.solved=this.networks.length===0}_step(){let t=this.networks[this.currentNetworkIndex];if(!t){this.solved=!0;return}this.currentNetworkIndex+=1,this.solved=this.currentNetworkIndex>=this.networks.length;let e=as(t.newSchX-t.crystal.schX),r=as(t.newSchY-t.crystal.schY);if(Math.abs(e)<=Oe.ALIGNMENT_TOLERANCE&&Math.abs(r)<=Oe.ALIGNMENT_TOLERANCE)return;let n=t.crystal.sourceComponentName??"the crystal",i=t.firstLoadCapacitor.sourceComponentName??"the first load capacitor",s=t.secondLoadCapacitor.sourceComponentName??"the second load capacitor",o=Math.abs(r)<=Oe.ALIGNMENT_TOLERANCE?`horizontally centered between ${i} and ${s} while preserving its vertical placement`:`centered between ${i} and ${s} and aligned with their load-side pins`;this.issues.push({lineItemType:"CrystalNotCenteredOverLoadCapacitors",crystalSchematicBox:t.crystal,firstLoadCapacitorSchematicBox:t.firstLoadCapacitor,secondLoadCapacitorSchematicBox:t.secondLoadCapacitor,deltaSchX:e,deltaSchY:r,newSchX:t.newSchX,newSchY:t.newSchY,message:`move ${n} to schX=${t.newSchX}, schY=${t.newSchY} so it is ${o}`})}findCrystalLoadNetworks(t){let e=new Map,r=new Map,n=new Map,i=new Map(t.componentPlacements.flatMap((c)=>c.sourceComponentId?[[c.sourceComponentId,c]]:[]));for(let c of t.circuitJson){if(c.type==="source_component")e.set(c.source_component_id,{sourceComponentId:c.source_component_id,ftype:"ftype"in c&&typeof c.ftype==="string"?c.ftype:void 0,pinVariant:"pin_variant"in c&&(c.pin_variant==="two_pin"||c.pin_variant==="four_pin")?c.pin_variant:void 0});if(c.type==="source_port"&&typeof c.source_component_id==="string"&&typeof c.subcircuit_connectivity_map_key==="string"){let l={sourcePortId:c.source_port_id,sourceComponentId:c.source_component_id,connectivityKey:c.subcircuit_connectivity_map_key},a=r.get(c.source_component_id)??[];a.push(l),r.set(c.source_component_id,a)}if(c.type==="schematic_port"&&c.source_port_id)n.set(c.source_port_id,c)}let s=new Map;for(let c of e.values()){if(c.ftype!=="simple_capacitor")continue;let l=r.get(c.sourceComponentId)??[];if(l.length!==2)continue;let a=l[0],p=l[1],d=i.get(c.sourceComponentId);if(!d)continue;for(let[m,f]of[[a,p],[p,a]]){let _=n.get(m.sourcePortId);if(!_)continue;let g=s.get(m.connectivityKey)??[];g.push({capacitor:d,loadPort:_,returnConnectivityKey:f.connectivityKey}),s.set(m.connectivityKey,g)}}let o=[];for(let c of e.values()){if(c.ftype!=="simple_crystal"&&c.ftype!=="simple_chip")continue;let l=r.get(c.sourceComponentId)??[],a=c.ftype==="simple_chip"?l.length===2&&l[0].connectivityKey!==l[1].connectivityKey?[[l[0].connectivityKey,l[1].connectivityKey]]:[]:c5(l);if(a.length===0)continue;let p=i.get(c.sourceComponentId);if(!p)continue;let d=a.flatMap(([y,S])=>{if(![...r.entries()].some(([L,B])=>L!==c.sourceComponentId&&B.length>2&&B.some((k)=>k.connectivityKey===y)&&B.some((k)=>k.connectivityKey===S)))return[];let b=s.get(y)??[],C=s.get(S)??[];return b.flatMap((L)=>C.flatMap((B)=>{if(L.capacitor.sourceComponentId===B.capacitor.sourceComponentId||L.returnConnectivityKey!==B.returnConnectivityKey||L.returnConnectivityKey===y||L.returnConnectivityKey===S||L.capacitor.schematicSheetId!==p.schematicSheetId||B.capacitor.schematicSheetId!==p.schematicSheetId)return[];return[{firstConnection:L,secondConnection:B}]}))});if(d.length===0)continue;let m=d.toSorted((y,S)=>Ly(y,p)-Ly(S,p))[0],f=[m.firstConnection.loadPort,m.secondConnection.loadPort],_=[m.firstConnection.capacitor,m.secondConnection.capacitor].toSorted((y,S)=>y.schX-S.schX),g=c.ftype==="simple_crystal"&&(c.pinVariant==="four_pin"||l.length>2);o.push({crystal:p,firstLoadCapacitor:_[0],secondLoadCapacitor:_[1],newSchX:as((f[0].center.x+f[1].center.x)/2),newSchY:g?p.schY:as((f[0].center.y+f[1].center.y)/2)})}return o}static issueToString(t){let e=[];return v(e,"crystalName",t.crystalSchematicBox.sourceComponentName),v(e,"firstLoadCapacitorName",t.firstLoadCapacitorSchematicBox.sourceComponentName),v(e,"secondLoadCapacitorName",t.secondLoadCapacitorSchematicBox.sourceComponentName),v(e,"newSchX",t.newSchX),v(e,"newSchY",t.newSchY),v(e,"deltaSchX",t.deltaSchX,{formatDelta:!0}),v(e,"deltaSchY",t.deltaSchY,{formatDelta:!0}),v(e,"message",t.message),`<CrystalNotCenteredOverLoadCapacitors ${e.join(" ")} />`}}var c5=(t)=>{let e=[...new Set(t.map((r)=>r.connectivityKey))];return e.flatMap((r,n)=>e.slice(n+1).map((i)=>[r,i]))},Ly=(t,e)=>Ty(t.firstConnection.capacitor,e)+Ty(t.secondConnection.capacitor,e),Ty=(t,e)=>Math.hypot(t.schX-e.schX,t.schY-e.schY),as=(t)=>Math.round(t*100)/100;function Kl(t){let e=new Map,r=0;function n(i){for(let[,o]of e)if(o.has(i))return o;let s=new Set;return e.set(`connectivity_net${r++}`,s),s}for(let i of t){let s=null;for(let o of i){if(!s)s=n(o);else if(!s.has(o)){let c=n(o);if(c!==s){for(let l of c)s.add(l);e.delete(Array.from(e.entries()).find(([,l])=>l===c)[0])}}s.add(o)}}return Object.fromEntries(Array.from(e.entries()).map(([i,s])=>[i,Array.from(s)]))}var p5=class{netMap;idToNetMap;constructor(t){this.netMap=t,this.idToNetMap={};for(let[e,r]of Object.entries(t))for(let n of r)this.idToNetMap[n]=e}addConnections(t){for(let e of t){let r=new Set;for(let i of e){let s=this.idToNetMap[i];if(s)r.add(s)}let n;if(r.size===0)n=`connectivity_net${Object.keys(this.netMap).length}`,this.netMap[n]=[];else if(r.size===1)n=r.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;else{n=r.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;for(let i of r)if(i!==n){this.netMap[n].push(...this.netMap[i]),this.netMap[i]=this.netMap[n];for(let s of this.netMap[n])this.idToNetMap[s]=n}}for(let i of e){if(!this.netMap[n].includes(i))this.netMap[n].push(i);this.idToNetMap[i]=n}}}getIdsConnectedToNet(t){return this.netMap[t]||[]}getNetConnectedToId(t){return this.idToNetMap[t]}areIdsConnected(t,e){if(t===e)return!0;let r=this.getNetConnectedToId(t);if(!r)return!1;let n=this.getNetConnectedToId(e);if(!n)return!1;return r===n||n===t||n===t}areAllIdsConnected(t){let e=this.getNetConnectedToId(t[0]);for(let r of t){let n=this.getNetConnectedToId(r);if(n===void 0)return!1;if(n!==e)return!1}return!0}},cs=(t)=>{let e=[];for(let n of t)if(n.type==="source_trace")e.push([...n.connected_source_port_ids??[],...n.connected_source_net_ids??[]]);else if(n.type==="source_component"){if(n.internally_connected_source_port_ids)for(let i of n.internally_connected_source_port_ids)e.push(i)}else if(n.type==="source_component_internal_connection")e.push(n.source_port_ids);let r=Kl(e);return new p5(r)};class Ae extends U{static DIODE_FTYPES=new Set(["simple_led","simple_diode"]);ctx;out;schematicTraces;currentIndex=0;sourceConnectivity;sourceComponentFtypeById;sourceComponentIdBySourcePortId;schematicPorts;schematicBoxBySourceComponentId;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e;let{circuitJson:r}=t;this.sourceConnectivity=cs(r),this.sourceComponentFtypeById=this.buildSourceComponentFtypeById(r),this.sourceComponentIdBySourcePortId=this.buildSourceComponentIdBySourcePortId(r),this.schematicPorts=r.filter((n)=>n.type==="schematic_port"),this.schematicBoxBySourceComponentId=this.buildSchematicBoxBySourceComponentId(),this.schematicTraces=r.filter((n)=>n.type==="schematic_trace"),this.solved=this.schematicTraces.length===0}_step(){let t=this.schematicTraces[this.currentIndex];if(!t){this.solved=!0;return}if(this.currentIndex++,this.solved=this.currentIndex>=this.schematicTraces.length,!t.edges||t.edges.length===0)return;let e=t.edges[0],r=t.edges[t.edges.length-1];if(!e||!r)return;let n=e.from,i=r.to,s=t.schematic_sheet_id,o=this.findSourceComponentIdNearPoint(n,s),c=this.findSourceComponentIdNearPoint(i,s);if(!o||!c)return;let l=this.sourceComponentFtypeById.get(o),a=this.sourceComponentFtypeById.get(c),{DIODE_FTYPES:p}=Ae;if(!(p.has(l)&&a==="simple_resistor"||l==="simple_resistor"&&p.has(a)))return;let m=p.has(l)?o:c,f=l==="simple_resistor"?o:c,_=this.schematicBoxBySourceComponentId.get(m),g=this.schematicBoxBySourceComponentId.get(f);if(!_||!g)return;let y=this.findNearestPort(p.has(l)?n:i,s),S=this.findNearestPort(l==="simple_resistor"?n:i,s);if(!y?.center||!S?.center)return;if(!this.sourceConnectivity.areIdsConnected(y.source_port_id,S.source_port_id))return;let P=_.sourceComponentName||"component",b=g.sourceComponentName||"component",C=y?.display_pin_label??y?.pin_number?.toString(),L=S?.display_pin_label??S?.pin_number?.toString(),B=y?.facing_direction,k=S?.facing_direction,I=C?`${P}.${C}`:P,j=L?`${b}.${L}`:b,Q=(lt)=>({lineItemType:"DiodeResistorNotAligned",diodeSchematicBox:_,resistorSchematicBox:g,diodePin:C,resistorPin:L,diodePinFacingDirection:B,resistorPinFacingDirection:k,message:lt});if(!Ae.isCoLinear(y.center,S.center)){this.out.push(Q(`trace has corners — align ${P} and ${b} on same axis and rotate so ${I} faces ${j}`));return}if(B&&k&&!Ae.pinsFacingEachOther(y.center,B,S.center,k))this.out.push(Q(`${I} and ${j} face away from each other — rotate ${P} so ${I} faces ${j}`))}static isCoLinear(t,e,r=0.01){return Math.abs(t.x-e.x)<r||Math.abs(t.y-e.y)<r}static pinsFacingEachOther(t,e,r,n){let i=r.x-t.x,s=r.y-t.y,o=e==="right"&&i>0||e==="left"&&i<0||e==="up"&&s>0||e==="down"&&s<0,c=n==="right"&&i<0||n==="left"&&i>0||n==="up"&&s<0||n==="down"&&s>0;return o&&c}static dist(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}findNearestPort(t,e){let r,n=1/0;for(let i of this.schematicPorts){if(i.schematic_sheet_id!==e)continue;if(!i.center)continue;let s=Ae.dist(t,i.center);if(s<n)n=s,r=i}return r}findSourceComponentIdNearPoint(t,e){let r=this.findNearestPort(t,e);if(!r||!r.source_port_id)return;return this.sourceComponentIdBySourcePortId.get(r.source_port_id)}buildSourceComponentFtypeById(t){let e=new Map;for(let r of t)if(r.type==="source_component"&&"source_component_id"in r&&"ftype"in r&&typeof r.ftype==="string")e.set(r.source_component_id,r.ftype);return e}buildSourceComponentIdBySourcePortId(t){let e=new Map;for(let r of t)if(r.type==="source_port"&&"source_port_id"in r&&"source_component_id"in r&&typeof r.source_port_id==="string"&&typeof r.source_component_id==="string")e.set(r.source_port_id,r.source_component_id);return e}buildSchematicBoxBySourceComponentId(){let t=new Map;for(let e of this.ctx.componentPlacements)if(e.sourceComponentId)t.set(e.sourceComponentId,e);return t}static issueToString(t){let e=[];return v(e,"diodeComponentName",t.diodeSchematicBox.sourceComponentName),v(e,"diodePin",t.diodePin),v(e,"resistorComponentName",t.resistorSchematicBox.sourceComponentName),v(e,"resistorPin",t.resistorPin),v(e,"message",t.message),`<DiodeResistorNotAligned ${e.join(" ")} />`}}class Ar extends U{static MIN_BODY_GAP=4;index;amplifierIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t),this.amplifierIds=[...this.index.components.values()].filter((r)=>r.ftype==="simple_op_amp").map((r)=>r.source_component_id),this.solved=this.amplifierIds.length===0}_step(){let t=this.amplifierIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.amplifierIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.namedPort(t,"output"),i=e.namedPort(t,"inverting_input");if(!r||!n||!i||!e.port(n)||!e.port(i))return;let s=e.connected(n.source_port_id),o=e.connected(i.source_port_id);if(s===o||e.isRail(s)||e.isRail(o))return;if((e.portsByNet.get(o)??[]).some((d)=>d.source_component_id!==t&&e.components.get(d.source_component_id)?.ftype==="simple_op_amp"))return;let c=[],l=new Set;for(let d of e.portsByNet.get(s)??[]){let m=d.source_component_id;if(l.has(m))continue;l.add(m);let f=e.components.get(m);if(f?.ftype!=="simple_resistor"&&f?.ftype!=="simple_capacitor")continue;if(f.ftype==="simple_resistor"&&!(f.resistance>0))continue;let _=e.twoTerminalNets(m);if(!_?.includes(o)||!_.includes(s))continue;let g=e.placement(m);if(!g||!e.sameLocalScope(r,g))return;c.push(g)}let a=c.flatMap((d)=>{let m=h5(r,d),f=Math.max(Ar.MIN_BODY_GAP,3*Math.max(d.width,d.height));return m>f?[{schematicBox:d,bodyGap:m,maxRecommendedBodyGap:f}]:[]});if(a.length===0)return;let p=a.map(({schematicBox:d})=>d.sourceComponentName||"component").join(", ");this.issues.push({lineItemType:"FeedbackNetworkNotCompact",amplifierSchematicBox:r,feedbackComponents:c,distantComponents:a,outputSourcePortId:n.source_port_id,invertingInputSourcePortId:i.source_port_id,message:`consider grouping ${p} closer to ${r.sourceComponentName||"component"}, with a compact feedback return path above or below the amplifier`})}static issueToString(t){let e=[];return v(e,"amplifierName",t.amplifierSchematicBox.sourceComponentName),v(e,"feedbackComponentNames",t.feedbackComponents.map((r)=>r.sourceComponentName||"component").join(", ")),v(e,"distantComponentNames",t.distantComponents.map(({schematicBox:r})=>r.sourceComponentName||"component").join(", ")),v(e,"message",t.message),`<FeedbackNetworkNotCompact ${e.join(" ")} />`}}function h5(t,e){return Math.hypot(Math.max(0,Math.abs(t.schX-e.schX)-(t.width+e.width)/2),Math.max(0,Math.abs(t.schY-e.schY)-(t.height+e.height)/2))}function tp(t){let e=[],r=(n)=>{let i=t.portsByComponent.get(n);if(i?.length!==2)return!1;let s=t.port(i[0]),o=t.port(i[1]);return!!s&&!!o&&Math.abs(s.center.y-o.center.y)<0.01&&Math.abs(s.center.x-o.center.x)>0.01};for(let n of t.components.values()){if(n.ftype!=="simple_resistor"||n.resistance<=0)continue;let i=n.source_component_id,s=t.twoTerminalNets(i);if(!s||s.filter((b)=>t.isRail(b)).length!==1)continue;let o=s.find((b)=>t.isRail(b));if(t.powerNets.has(o)&&t.groundNets.has(o))continue;let c=s.find((b)=>b!==o),l=t.portsByNet.get(c)??[],a=l.filter((b)=>{let C=t.components.get(b.source_component_id)?.ftype;return C==="simple_switch"||C==="simple_push_button"});if(a.length!==1||l.filter((b)=>t.components.get(b.source_component_id)?.ftype==="simple_resistor").length!==1)continue;let p=a[0],d=p.source_component_id,m=t.components.get(d)?.ftype,_=t.twoTerminalNets(d)?.find((b)=>b!==c);if(!_)continue;let g=t.powerNets.has(o)?"up":"down";if(g==="up"?!t.groundNets.has(_)||t.powerNets.has(_):!t.powerNets.has(_)||t.groundNets.has(_))continue;if([i,d].some((b)=>t.portsByComponent.get(b)?.some((C)=>C.do_not_connect)))continue;let y=t.placement(i),S=t.placement(d),P=t.port(p);if(!y||!S||!P||!t.sameLocalScope(y,S))continue;e.push({resistor:y,switchBox:S,signalPort:p,signalSchY:P.center.y,pullDirection:g,horizontalPushbutton:m==="simple_push_button"&&r(i)&&r(d)})}return e}function ls(t){return new Set(tp(t).flatMap((e)=>e.horizontalPushbutton?[e.resistor.sourceComponentId,e.switchBox.sourceComponentId]:[]))}class ar extends U{static MIN_WRONG_SIDE_GAP=1.5;index;resistorIds;horizontalPushbuttonComponentIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t),this.horizontalPushbuttonComponentIds=ls(this.index),this.resistorIds=[...this.index.components.values()].filter((r)=>r.ftype==="simple_resistor"&&r.resistance>0).map((r)=>r.source_component_id),this.solved=this.resistorIds.length===0}_step(){let t=this.resistorIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.resistorIds.length,!t)return;if(this.horizontalPushbuttonComponentIds.has(t))return;let e=this.index,r=e.placement(t),n=e.twoTerminalNets(t);if(!r||!n)return;let i=n.filter((y)=>e.isRail(y));if(i.length!==1)return;let s=i[0];if(e.powerNets.has(s)&&e.groundNets.has(s))return;let o=e.groundNets.has(s)?"down":"up",c=n.find((y)=>y!==s),l=e.portsByNet.get(c)??[],a=l.filter((y)=>y.needs_external_pullup||y.needs_external_pulldown);if(a.length!==1)return;let p=a[0];if(p.needs_external_pullup&&p.needs_external_pulldown)return;if(o==="up"?!p.needs_external_pullup:!p.needs_external_pulldown)return;let d=e.placement(p.source_component_id),m=e.port(p);if(!d||!m||!e.sameLocalScope(d,r))return;if(l.some((y)=>{let S=y.source_component_id;if(S===t||S===p.source_component_id)return!1;if(e.components.get(S)?.ftype!=="simple_capacitor")return!0;let C=e.twoTerminalNets(S)?.find((B)=>B!==c);if(!C||!e.groundNets.has(C)||e.powerNets.has(C))return!0;let L=e.placement(S);return!L||!e.sameLocalScope(d,L)}))return;let f=m.center.y,_=o==="up"?f-(r.schY+r.height/2):r.schY-r.height/2-f;if(_<=ar.MIN_WRONG_SIDE_GAP)return;let g=o==="up"?"above":"below";this.issues.push({lineItemType:"PullResistorOnWrongSide",resistorSchematicBox:r,hostSchematicBox:d,signalSourcePortId:p.source_port_id,signalPinName:p.name,signalSchY:f,pullDirection:o,preferredSide:g,wrongSideGap:_,maxRecommendedWrongSideGap:ar.MIN_WRONG_SIDE_GAP,message:`consider placing ${r.sourceComponentName||"component"} ${g} ${d.sourceComponentName||"component"}.${p.name} so the pull-${o} branch reads toward ${o==="up"?"power":"ground"}`})}static issueToString(t){let e=[];return v(e,"resistorName",t.resistorSchematicBox.sourceComponentName),v(e,"hostName",t.hostSchematicBox.sourceComponentName),v(e,"signalPin",t.signalPinName),v(e,"pullDirection",t.pullDirection),v(e,"preferredSide",t.preferredSide),v(e,"signalSchY",t.signalSchY),v(e,"wrongSideGap",t.wrongSideGap),v(e,"message",t.message),`<PullResistorOnWrongSide ${e.join(" ")} />`}}class _e extends U{static EPSILON=0.01;index;powerNets;groundNets;positiveVoltageNets=new Set;componentIds;horizontalPushbuttonComponentIds;issues;currentIndex=0;constructor({ctx:t,issues:e}){super();this.issues=e,this.index=new tt(t),this.horizontalPushbuttonComponentIds=ls(this.index),this.powerNets=new Set(this.index.powerNets),this.groundNets=new Set(this.index.groundNets);for(let r of t.circuitJson){if(r.type==="source_net"&&r.is_positive_voltage_source)this.positiveVoltageNets.add(this.index.connected(r.source_net_id));if(r.type!=="source_port")continue;let n=this.index.connected(r.source_port_id);if(r.provides_power||r.requires_power)this.powerNets.add(n);if(r.provides_ground||r.requires_ground)this.groundNets.add(n)}this.componentIds=[...this.index.components.keys()].filter((r)=>this.index.portsByComponent.get(r)?.length===2),this.solved=this.componentIds.length===0}_step(){let t=this.componentIds[this.currentIndex++];if(this.solved=this.currentIndex>=this.componentIds.length,!t)return;let e=this.index,r=e.placement(t),n=e.components.get(t),i=e.twoTerminalNets(t);if(!r||!i)return;if(n?.ftype==="simple_inductor"&&!i.some((B)=>this.groundNets.has(B)))return;if((n?.ftype==="simple_diode"||n?.ftype==="simple_fuse")&&i.every((B)=>this.powerNets.has(B)))return;if(i.some((B)=>this.powerNets.has(B)&&this.groundNets.has(B)))return;let s=i.map((B)=>this.powerNets.has(B)?"power":this.groundNets.has(B)?"ground":void 0);if(s.every((B)=>B===void 0))return;let o=s.includes("power")?"power":"ground",c=i.flatMap((B,k)=>s[k]===o?[{net:B,index:k}]:[]),l=(c.find(({net:B})=>e.portsByNet.get(B)?.some((k)=>o==="power"?k.provides_power:k.provides_ground))??c.find(({net:B})=>(o==="power"?e.powerNets:e.groundNets).has(B))??c[0]).index,a=i[l],p=e.portsByComponent.get(t),d=p.find((B)=>e.connected(B.source_port_id)===a),m=p.find((B)=>B!==d),f=e.port(d),_=e.port(m);if(!f||!_)return;let g=e.connected(m.source_port_id),y=this.groundNets.has(g),S=n?.ftype==="simple_resistor"&&!this.powerNets.has(g)&&!y;if(this.positiveVoltageNets.has(a)&&(y||S)&&Math.abs(f.center.x-_.center.x)<=_e.EPSILON&&f.center.y<_.center.y-_e.EPSILON&&f.facing_direction==="down"&&_.facing_direction==="up"){this.issues.push({lineItemType:"TwoPinComponentHasInvertedRails",schematicBox:r,railSourcePortId:d.source_port_id,railPinName:d.name,railType:"power",deltaSchRotation:180,suggestedRailFacingDirection:"up",message:`rotate ${r.sourceComponentName||"component"} by 180° so its positive-supply pin faces up and its ${y?"ground":"signal"} pin faces down; preserve pin connections and reroute attached traces`});return}if(!(Math.abs(f.center.y-_.center.y)<=_e.EPSILON&&Math.abs(f.center.x-_.center.x)>_e.EPSILON&&(f.facing_direction==="left"&&_.facing_direction==="right"||f.facing_direction==="right"&&_.facing_direction==="left")))return;if(this.horizontalPushbuttonComponentIds.has(t))return;let C=o==="power"?"up":"down",L=f.facing_direction==="left"===(o==="power")?-90:90;this.issues.push({lineItemType:"TwoPinComponentShouldBeVertical",schematicBox:r,railSourcePortId:d.source_port_id,railPinName:d.name,railType:o,deltaSchRotation:L,suggestedRailFacingDirection:C,message:`rotate ${r.sourceComponentName||"component"} by ${L}° so its ${o}-connected pin faces ${C} and the component is vertical`})}static issueToString(t){let e=[];return v(e,"componentName",t.schematicBox.sourceComponentName),v(e,"railPin",t.railPinName),v(e,"railType",t.railType),v(e,"deltaSchRotation",t.deltaSchRotation),v(e,"suggestedRailFacingDirection",t.suggestedRailFacingDirection),v(e,"message",t.message),`<${t.lineItemType} ${e.join(" ")} />`}}function Ey(t,e,r){let n=we(e.side,r)-we(t.side,r);if(n===0)return 1/0;let[i,s]=n>0?[t,e]:[e,t],o=r==="width"?s.xMin-i.xMax:s.yMin-i.yMax;return(be-o)/Math.abs(n)}function Ry(t,e){let r=(s)=>{let{width:o,height:c}=t,l=e.map((p)=>({...p})),a=l.length*(l.length-1)/2;for(let p=0;p<=a;p++){let d;for(let k=0;k<l.length&&!d;k++)for(let I=k+1;I<l.length;I++){let j=l[k],Q=l[I];if(j.side!==Q.side&&wr(j,Q,be)){d=[j,Q];break}}if(!d)return{width:o>t.width?o:void 0,height:c>t.height?c:void 0};let[m,f]=d,_=s==="height"?1/0:Ey(m,f,"width"),g=s==="width"?1/0:Ey(m,f,"height"),y=_*c<=g*o?"width":"height",S=y==="width"?_:g;if(!Number.isFinite(S)||S<=0)return;let P=y==="width"?o:c,b=Math.ceil((P+S)*1000-0.000000001)/1000,C=b-P;if(y==="width")o=b;else c=b;let L=y==="width"?"xMin":"yMin",B=y==="width"?"xMax":"yMax";for(let k of l){let I=we(k.side,y)*C;k[L]+=I,k[B]+=I}}},n=[r("width"),r("height"),r()].filter((s)=>s!==void 0),i=(s)=>(s.width??t.width)*(s.height??t.height);return n.sort((s,o)=>i(s)-i(o))[0]}class $n extends U{params;entries;placementById;currentIndex=0;constructor(t){super();this.params=t;let{circuitJson:e,componentPlacements:r}=t.ctx;this.placementById=this.getPlacementBySchematicComponentId(r);let n=er(e);this.entries=Array.from(this.getPortsBySchematicComponentId(e)).filter(([i])=>n.has(i)),this.solved=this.entries.length===0}_step(){let t=this.entries[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex>=this.entries.length;let[e,r]=t,n=this.placementById.get(e);if(!n)return;let i=Sr(n,r,_n);if(i.length===0)return;let s=this.getCollisionSummary(i);if(s.overlappingSides.length===0)return;let o=Ry(n,i);this.params.issues.push({lineItemType:"SchematicBoxInnerLabelCollision",schematicBox:n,overlappingSides:s.overlappingSides,minimumLabelGap:be,labelPairs:s.labelPairs,suggestedSchWidth:o?.width,suggestedSchHeight:o?.height,message:this.getMessage(s,o)})}static issueToString(t){let e=[];v(e,"message",t.message),v(e,"componentName",t.schematicBox.sourceComponentName),v(e,"currentSchWidth",t.schematicBox.width),v(e,"currentSchHeight",t.schematicBox.height),v(e,"overlappingSides",t.overlappingSides.join(",")),v(e,"minimumLabelGap",t.minimumLabelGap),v(e,"suggestedSchWidth",t.suggestedSchWidth),v(e,"suggestedSchHeight",t.suggestedSchHeight);let r=`<SchematicBoxInnerLabelCollision ${e.join(" ")}`;if(!t.labelPairs?.length)return`${r} />`;let n=t.labelPairs.map((i)=>{let s=[];return v(s,"label1",i.firstLabel.text),v(s,"label2",i.secondLabel.text),v(s,"port1",i.firstLabel.schematicPortId),v(s,"port2",i.secondLabel.schematicPortId),v(s,"side1",i.firstLabel.side),v(s,"side2",i.secondLabel.side),v(s,"kind",i.kind),v(s,"measuredGap",i.measuredGap),`  <PinLabelPair ${s.join(" ")} />`});return`${r}>
${n.join(`
`)}
</SchematicBoxInnerLabelCollision>`}getMessage({overlappingSides:t,labelPairs:e},r){let n=r?.width&&r.height?"schWidth and schHeight":r?.width?"schWidth":r?.height?"schHeight":t.every((s)=>s==="left"||s==="right")?"schWidth":t.every((s)=>s==="top"||s==="bottom")?"schHeight":"schWidth or schHeight";return`${e.map(({firstLabel:s,secondLabel:o,kind:c})=>`Labels ${s.text} (${s.side}) and ${o.text} (${o.side}) ${c==="overlap"?"overlap":"are too close"}.`).join(" ")} Increase the ${n} to leave at least ${be} schematic units between these labels.`}isSchematicPort(t){return t.type==="schematic_port"}isSchematicSide(t){return t==="left"||t==="right"||t==="top"||t==="bottom"}getPlacementBySchematicComponentId(t){return new Map(t.filter((e)=>e.schematicComponentId).map((e)=>[e.schematicComponentId,e]))}getPortsBySchematicComponentId(t){let e=new Map;for(let r of t.filter((n)=>this.isSchematicPort(n))){if(!r.schematic_component_id)continue;if(!this.isSchematicSide(r.side_of_component))continue;let n=e.get(r.schematic_component_id);if(n)n.push(r);else e.set(r.schematic_component_id,[r])}return e}getCollisionSummary(t){let e=new Set,r=[],n=(i)=>({schematicPortId:i.schematicPortId,text:i.text,side:i.side,bounds:{left:i.xMin,right:i.xMax,bottom:i.yMin,top:i.yMax}});for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++){let o=t[i],c=t[s];if(o.side===c.side)continue;if(!wr(o,c,be))continue;e.add(o.side),e.add(c.side),r.push({firstLabel:n(o),secondLabel:n(c),measuredGap:Math.max(0,o.xMin-c.xMax,c.xMin-o.xMax,o.yMin-c.yMax,c.yMin-o.yMax),kind:wr(o,c,0)?"overlap":"clearance"})}return{overlappingSides:this.sortSides(Array.from(e)),labelPairs:r}}sortSides(t){let e={left:0,right:1,top:2,bottom:3};return t.sort((r,n)=>e[r]-e[n])}}class Pr extends U{params;placements;firstIndex=0;secondIndex=1;constructor(t){super();this.params=t;this.placements=t.ctx.componentPlacements,this.solved=this.placements.length<2}_step(){if(this.firstIndex>=this.placements.length-1){this.solved=!0;return}let t=this.getComponentOverlap(this.placements[this.firstIndex],this.placements[this.secondIndex]);if(t)this.params.issues.push(t);if(this.secondIndex++,this.secondIndex>=this.placements.length)this.firstIndex++,this.secondIndex=this.firstIndex+1;this.solved=this.firstIndex>=this.placements.length-1}getCenteredRectBounds(t){return{left:t.schX-t.width/2,right:t.schX+t.width/2,top:t.schY-t.height/2,bottom:t.schY+t.height/2}}getOverlapCorrectionSuggestions({firstComponent:t,secondComponent:e,overlapWidth:r,overlapHeight:n}){let i=t.width*t.height,s=e.width*e.height,o=i<=s?t:e,c=o===t?e:t,l=o.schX<=c.schX?-r:r,a=o.schY<=c.schY?-n:n;return[{targetComponentName:o.sourceComponentName,deltaSchX:l,deltaSchY:0,newSchX:o.schX+l,newSchY:o.schY},{targetComponentName:o.sourceComponentName,deltaSchX:0,deltaSchY:a,newSchX:o.schX,newSchY:o.schY+a}]}static issueToString(t){let e=[];return v(e,"component1Name",t.firstComponent.sourceComponentName),v(e,"component2Name",t.secondComponent.sourceComponentName),v(e,"component1SchX",t.firstComponent.schX),v(e,"component1SchY",t.firstComponent.schY),v(e,"component2SchX",t.secondComponent.schX),v(e,"component2SchY",t.secondComponent.schY),v(e,"overlapWidth",t.overlapWidth),v(e,"overlapHeight",t.overlapHeight),[`<ComponentOverlap ${e.join(" ")}>`,...t.correctionSuggestions.map(Pr.correctionSuggestionToString),"</ComponentOverlap>"].join(`
`)}static correctionSuggestionToString(t){let e=[];if(v(e,"target",t.targetComponentName),t.deltaSchX!==0)v(e,"newSchX",t.newSchX),v(e,"deltaSchX",t.deltaSchX,{formatDelta:!0});if(t.deltaSchY!==0)v(e,"newSchY",t.newSchY),v(e,"deltaSchY",t.deltaSchY,{formatDelta:!0});return`<OverlapCorrectionSuggestion ${e.join(" ")} />`}getComponentOverlap(t,e){if(t.schematicSheetId!==e.schematicSheetId)return null;let r=this.getCenteredRectBounds(t),n=this.getCenteredRectBounds(e),i=Math.min(r.right,n.right)-Math.max(r.left,n.left),s=Math.min(r.bottom,n.bottom)-Math.max(r.top,n.top);if(i<=0||s<=0)return null;return{lineItemType:"ComponentOverlap",firstComponent:t,secondComponent:e,overlapWidth:i,overlapHeight:s,correctionSuggestions:this.getOverlapCorrectionSuggestions({firstComponent:t,secondComponent:e,overlapWidth:i,overlapHeight:s})}}}function ps(t,e){let r;for(let n of t){if(n.type!=="schematic_path"&&n.type!=="schematic_circle"&&n.type!=="schematic_rect"||n.schematic_component_id!==e)continue;let i=(n.stroke_width??0.02)/2,s;if(n.type==="schematic_path"){if(!n.points.length)continue;s={xMin:Math.min(...n.points.map((o)=>o.x)),xMax:Math.max(...n.points.map((o)=>o.x)),yMin:Math.min(...n.points.map((o)=>o.y)),yMax:Math.max(...n.points.map((o)=>o.y))}}else{let o=n.type==="schematic_rect"?(n.rotation??0)*Math.PI/180:0,c=n.type==="schematic_circle"?2*n.radius:n.width,l=n.type==="schematic_circle"?2*n.radius:n.height,a=(Math.abs(c*Math.cos(o))+Math.abs(l*Math.sin(o)))/2,p=(Math.abs(c*Math.sin(o))+Math.abs(l*Math.cos(o)))/2;s={xMin:n.center.x-a,xMax:n.center.x+a,yMin:n.center.y-p,yMax:n.center.y+p}}s.xMin-=i,s.xMax+=i,s.yMin-=i,s.yMax+=i,r=r?{xMin:Math.min(r.xMin,s.xMin),xMax:Math.max(r.xMax,s.xMax),yMin:Math.min(r.yMin,s.yMin),yMax:Math.max(r.yMax,s.yMax)}:s}return r}var Zi=(t)=>Array.from(ns(t)).length*0.095*(is(t)/0.15),$y=(t)=>Math.max(Zi(t),_n(t));function hs(t,e,r,n,i=0,s){if(!Number.isFinite(r)||r<=0)return;if(e.some((g)=>!g.side_of_component))return;if(!Wy(t,e,be,s))return;let o=0,c=0;for(let g of e)if(g.side_of_component==="left"||g.side_of_component==="right")c=Math.max(c,2*(Math.abs(g.center.y-t.schY)+r));else o=Math.max(o,2*(Math.abs(g.center.x-t.schX)+r));let l=n.width===void 0?t.width:Math.max(n.width,o,Oy(t,e,"width",s)),a=n.height===void 0?t.height:Math.max(n.height,c,Oy(t,e,"height",s)),p=(g)=>g>0.000000001&&g>=i-0.000000001,d=p(t.width-l)?l:void 0,m=p(t.height-a)?a:void 0;if(d===void 0&&m===void 0)return;let f=[{width:d,height:m}];if(d!==void 0&&m!==void 0)f.push({width:d},{height:m});let _=(g)=>(g.width??t.width)*(g.height??t.height);return f.sort((g,y)=>_(g)-_(y)),f.find((g)=>Wy({...t,width:g.width??t.width,height:g.height??t.height},e,be,s))}function Oy(t,e,r,n){let i=t[r],s=r==="width"?t.schX:t.schY,o=r==="width"?"xMin":"yMin",c=r==="width"?"xMax":"yMax",l=r==="width"?"yMin":"xMin",a=r==="width"?"yMax":"xMax",p=0,d=(f,_,g=0)=>{if(_>0)p=Math.max(p,i+(g-f)/_)},m=Sr(t,e,$y);if(n)m.push(n);for(let f=0;f<m.length;f++){let _=m[f],g=we(_.side,r);d(_[o]-(s-i/2),g+0.5),d(s+i/2-_[c],0.5-g);for(let y=f+1;y<m.length;y++){let S=m[y],P=_.side&&S.side&&_.side!==S.side?be:yn;if(!rs(_[l],_[a],S[l],S[a],P))continue;let[b,C]=_[c]<=S[o]?[_,S]:[S,_];d(C[o]-b[c],we(C.side,r)-we(b.side,r),P)}}return p}function Wy(t,e,r=yn,n){if(!Number.isFinite(t.width)||!Number.isFinite(t.height))return!1;let i=Sr(t,e,$y);if(n)i.push(n);for(let s=0;s<i.length;s++){let o=i[s];if(o.xMin<t.schX-t.width/2-0.000000001||o.xMax>t.schX+t.width/2+0.000000001||o.yMin<t.schY-t.height/2-0.000000001||o.yMax>t.schY+t.height/2+0.000000001)return!1;for(let c=s+1;c<i.length;c++){let l=i[c],a=o.side&&l.side&&o.side!==l.side?r:yn;if(wr(o,l,a))return!1}}return!0}class Br extends U{params;SCHEMATIC_BOX_TOO_WIDE_MESSAGE="Shrink schematic box width";PIN_HEADER_MAX_ALLOWED_GAP=0.1;GENERIC_MAX_ALLOWED_GAP=1;PIN_LABEL_EDGE_PADDING=0.1;GAP_COMPARISON_EPSILON=0.000000001;entries;placementById;schematicComponentById;sourceComponentById;currentIndex=0;constructor(t){super();this.params=t;let{circuitJson:e,componentPlacements:r}=t.ctx;this.placementById=this.getPlacementBySchematicComponentId(r),this.schematicComponentById=new Map(e.filter((i)=>i.type==="schematic_component").map((i)=>[i.schematic_component_id,i])),this.sourceComponentById=this.getSourceComponentById(e);let n=er(e);this.entries=Array.from(this.getPortsBySchematicComponentId(e)).filter(([i])=>n.has(i)),this.solved=this.entries.length===0}_step(){let t=this.entries[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex>=this.entries.length;let[e,r]=t,n=this.placementById.get(e);if(!n)return;let i=this.getCenteredRectBounds(n),s=this.getLabelColumn("left",r),o=this.getLabelColumn("right",r),c=this.getSourceComponentFtype(n,this.sourceComponentById),l;if(s&&o)l=this.getInnerLabelEdge(i,o)-this.getInnerLabelEdge(i,s);else if(s&&s.labelCount>=4)l=i.right-this.getInnerLabelEdge(i,s);else if(o&&o.labelCount>=4)l=this.getInnerLabelEdge(i,o)-i.left;if(l===void 0)return;let a=c==="simple_pin_header"?this.PIN_HEADER_MAX_ALLOWED_GAP:this.GENERIC_MAX_ALLOWED_GAP;if(!this.exceedsMaxAllowedGap(l,a))return;let p=this.getSuggestedWidth({measuredInnerLabelHorizontalEmptySpace:l,maxAllowedInnerLabelHorizontalEmptySpace:a,currentWidth:n.width}),d=this.schematicComponentById.get(e)?.pin_spacing;if(d===void 0)return;let m=hs(n,r,d,{width:p},0,ps(this.params.ctx.circuitJson,e));if(m?.width===void 0)return;let f=m.width;if(c==="simple_pin_header")this.params.issues.push({lineItemType:"PinHeaderSchematicBoxTooWide",schematicBox:n,measuredInnerLabelHorizontalEmptySpace:l,maxAllowedInnerLabelHorizontalEmptySpace:a,suggestedSchWidth:f,message:this.SCHEMATIC_BOX_TOO_WIDE_MESSAGE});else this.params.issues.push({lineItemType:"GenericSchematicBoxTooWide",schematicBox:n,measuredInnerLabelHorizontalEmptySpace:l,maxAllowedInnerLabelHorizontalEmptySpace:a,suggestedSchWidth:f,message:this.SCHEMATIC_BOX_TOO_WIDE_MESSAGE})}static issueToString(t){let e=[];return v(e,"message",t.message),v(e,"componentName",t.schematicBox.sourceComponentName),v(e,"currentSchWidth",t.schematicBox.width),v(e,"measuredInnerLabelHorizontalEmptySpace",t.measuredInnerLabelHorizontalEmptySpace),v(e,"maxAllowedInnerLabelHorizontalEmptySpace",t.maxAllowedInnerLabelHorizontalEmptySpace),v(e,"suggestedSchWidth",t.suggestedSchWidth),`<${t.lineItemType} ${e.join(" ")} />`}isSchematicPort(t){return t.type==="schematic_port"}getSourceComponentWithFtype(t){if(t.type!=="source_component"||!("source_component_id"in t)||typeof t.source_component_id!=="string")return null;return{type:"source_component",source_component_id:t.source_component_id,ftype:"ftype"in t&&typeof t.ftype==="string"?t.ftype:void 0}}exceedsMaxAllowedGap(t,e){return t-e>this.GAP_COMPARISON_EPSILON}getCenteredRectBounds(t){return{left:t.schX-t.width/2,right:t.schX+t.width/2,top:t.schY+t.height/2,bottom:t.schY-t.height/2}}getSourceComponentById(t){return new Map(t.flatMap((e)=>{let r=this.getSourceComponentWithFtype(e);return r?[r]:[]}).map((e)=>[e.source_component_id,e]))}getPlacementBySchematicComponentId(t){return new Map(t.filter((e)=>e.schematicComponentId).map((e)=>[e.schematicComponentId,e]))}getPortsBySchematicComponentId(t){let e=new Map;for(let r of t.filter((n)=>this.isSchematicPort(n))){if(!r.schematic_component_id)continue;let n=e.get(r.schematic_component_id);if(n)n.push(r);else e.set(r.schematic_component_id,[r])}return e}getSourceComponentFtype(t,e){return t.sourceComponentId?e.get(t.sourceComponentId)?.ftype:void 0}getLabelColumn(t,e){let r=e.filter((n)=>n.side_of_component===t).flatMap((n)=>n.display_pin_label?[Zi(n)]:[]);if(r.length===0)return null;return{side:t,labelCount:r.length,maxLabelWidth:Math.max(...r)}}getInnerLabelEdge(t,e){return e.side==="left"?t.left+this.PIN_LABEL_EDGE_PADDING+e.maxLabelWidth:t.right-this.PIN_LABEL_EDGE_PADDING-e.maxLabelWidth}getSuggestedWidth(t){return t.currentWidth-t.measuredInnerLabelHorizontalEmptySpace+t.maxAllowedInnerLabelHorizontalEmptySpace}}class jn extends U{params;MESSAGE="Move schematic pins closer to the box edge or change the schematic box";GAP_COMPARISON_EPSILON=0.000000001;entries;placementById;schematicComponentById;sourcePortById;currentIndex=0;constructor(t){super();this.params=t;let{circuitJson:e,componentPlacements:r}=t.ctx;this.placementById=this.getPlacementBySchematicComponentId(r),this.schematicComponentById=this.getSchematicComponentById(e),this.sourcePortById=this.getSourcePortById(e);let n=er(e);this.entries=Array.from(this.getPortsBySchematicComponentId(e)).filter(([i])=>n.has(i)),this.solved=this.entries.length===0}_step(){let t=this.entries[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex>=this.entries.length;let[e,r]=t,n=this.placementById.get(e);if(!n)return;let i=this.getPinSpacing(n,this.schematicComponentById);if(i===null)return;let s=this.getMaxLabelLengthBySide(r),o=new Map;for(let g of r){if(!this.isSchematicSide(g.side_of_component))continue;let y=o.get(g.side_of_component)??[];y.push(g),o.set(g.side_of_component,y)}let c=[];for(let[g,y]of o){if(y.length===1)continue;for(let S of this.getBoxEdgeSidesForPinSide(g)){let P=this.getOuterPinBySide(S,y);if(!P)continue;let b=this.getPinPaddingToEdge(n,P,S),C=Math.max(i,this.getMaxAllowedPinPadding(i,S,s));if(!this.exceedsMaxAllowedGap(b,C+i))continue;c.push({schematicBox:n,pinSide:g,edgeSide:S,pinName:this.getPinName(P,this.sourcePortById),measuredPadding:b,maxAllowedPadding:C})}}if(!c.length)return;let l=c.map((g)=>this.createIssue(g)),a=l.flatMap((g)=>g.suggestedSchWidth===void 0?[]:[g.suggestedSchWidth]),p=l.flatMap((g)=>g.suggestedSchHeight===void 0?[]:[g.suggestedSchHeight]),d=hs(n,r,i,{width:a.length?Math.max(...a):void 0,height:p.length?Math.max(...p):void 0},2*i,ps(this.params.ctx.circuitJson,e));if(!d)return;let m=l.filter((g)=>d.width!==void 0&&g.suggestedSchWidth!==void 0||d.height!==void 0&&g.suggestedSchHeight!==void 0),f=m.reduce((g,y)=>y.excessPadding>g.excessPadding?y:g),_=[d.width===void 0?"":"width",d.height===void 0?"":"height"].filter(Boolean).join(" and ");this.params.issues.push({...f,paddingDetails:m.map(({pinSide:g,edgeSide:y,pinName:S,measuredPadding:P,maxAllowedPadding:b,excessPadding:C})=>({pinSide:g,edgeSide:y,pinName:S,measuredPadding:P,maxAllowedPadding:b,excessPadding:C})),suggestedSchWidth:d.width,suggestedSchHeight:d.height,message:`${this.MESSAGE} ${_}`})}static issueToString(t){let e=[];if(v(e,"message",t.message),v(e,"componentName",t.schematicBox.sourceComponentName),t.paddingDetails)v(e,"pinSides",[...new Set(t.paddingDetails.map((r)=>r.pinSide))].join(",")),v(e,"edgeSides",[...new Set(t.paddingDetails.map((r)=>r.edgeSide))].join(","));else v(e,"pinSide",t.pinSide),v(e,"edgeSide",t.edgeSide),v(e,"pinName",t.pinName),v(e,"measuredPadding",t.measuredPadding),v(e,"maxAllowedPadding",t.maxAllowedPadding),v(e,"excessPadding",t.excessPadding);return v(e,"suggestedSchWidth",t.suggestedSchWidth),v(e,"suggestedSchHeight",t.suggestedSchHeight),`<SchematicPinPaddingToEdgeTooLarge ${e.join(" ")} />`}isSchematicPort(t){return t.type==="schematic_port"}isSourcePort(t){return t.type==="source_port"}isSchematicComponent(t){return t.type==="schematic_component"}isHorizontalSide(t){return t==="left"||t==="right"}isVerticalSide(t){return t==="top"||t==="bottom"}isSchematicSide(t){return this.isHorizontalSide(t)||this.isVerticalSide(t)}exceedsMaxAllowedGap(t,e){return t-e>this.GAP_COMPARISON_EPSILON}getCenteredRectBounds(t){return{left:t.schX-t.width/2,right:t.schX+t.width/2,top:t.schY+t.height/2,bottom:t.schY-t.height/2}}getSourcePortById(t){return new Map(t.filter((e)=>this.isSourcePort(e)).map((e)=>[e.source_port_id,e]))}getSchematicComponentById(t){return new Map(t.filter((e)=>this.isSchematicComponent(e)).map((e)=>[e.schematic_component_id,e]))}getPlacementBySchematicComponentId(t){return new Map(t.filter((e)=>e.schematicComponentId).map((e)=>[e.schematicComponentId,e]))}getPortsBySchematicComponentId(t){let e=new Map;for(let r of t.filter((n)=>this.isSchematicPort(n))){if(!r.schematic_component_id)continue;let n=e.get(r.schematic_component_id);if(n)n.push(r);else e.set(r.schematic_component_id,[r])}return e}getPinSpacing(t,e){if(!t.schematicComponentId)return null;let r=e.get(t.schematicComponentId);return typeof r?.pin_spacing==="number"?r.pin_spacing:null}getPinName(t,e){let r=e.get(t.source_port_id);if(r?.name)return r.name;if(t.display_pin_label)return t.display_pin_label;if(r?.pin_number!==void 0)return String(r.pin_number);return}getMaxLabelLengthBySide(t){let e={left:0,right:0,top:0,bottom:0};for(let r of t){if(!this.isSchematicSide(r.side_of_component))continue;if(!r.display_pin_label)continue;e[r.side_of_component]=Math.max(e[r.side_of_component],Zi(r))}return e}getOuterPinBySide(t,e){if(e.length===0)return null;switch(t){case"top":return e.reduce((r,n)=>n.center.y>r.center.y?n:r);case"bottom":return e.reduce((r,n)=>n.center.y<r.center.y?n:r);case"left":return e.reduce((r,n)=>n.center.x<r.center.x?n:r);case"right":return e.reduce((r,n)=>n.center.x>r.center.x?n:r)}}getPinPaddingToEdge(t,e,r){let n=this.getCenteredRectBounds(t);switch(r){case"top":return Math.max(0,n.top-e.center.y);case"bottom":return Math.max(0,e.center.y-n.bottom);case"left":return Math.max(0,e.center.x-n.left);case"right":return Math.max(0,n.right-e.center.x)}}getBoxEdgeSidesForPinSide(t){return this.isHorizontalSide(t)?["top","bottom"]:["left","right"]}getMaxAllowedPinPadding(t,e,r){let n=this.isHorizontalSide(e)?["left","right"]:["top","bottom"];return(r[n[0]]+r[n[1]]+t)/2}createIssue(t){let e=Math.max(0,t.measuredPadding-t.maxAllowedPadding),r=e*2;return{lineItemType:"SchematicPinPaddingToEdgeTooLarge",pinSide:t.pinSide,edgeSide:t.edgeSide,pinName:t.pinName,schematicBox:t.schematicBox,measuredPadding:t.measuredPadding,maxAllowedPadding:t.maxAllowedPadding,excessPadding:e,suggestedSchWidth:this.isHorizontalSide(t.pinSide)?void 0:Math.max(0,t.schematicBox.width-r),suggestedSchHeight:this.isHorizontalSide(t.pinSide)?Math.max(0,t.schematicBox.height-r):void 0,message:this.isHorizontalSide(t.pinSide)?`${this.MESSAGE} height`:`${this.MESSAGE} width`}}}var Xy=new Map([["T",1000000000000],["G",1e9],["M",1e6],["K",1000],["k",1000],["",1],["m",0.001],["µ",0.000001],["μ",0.000001],["u",0.000001],["n",0.000000001],["p",0.000000000001],["f",0.000000000000001]]),d5=[...Xy.keys()];function Dy(t){return Xy.get(t)}var Vy={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1000,Hz:1}},g:{baseUnit:"g",variants:{kg:1000,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:0.001,mohm:0.001,mOhm:0.001,milliohm:0.001,Ω:1,ohm:1,Ohm:1,kΩ:1000,KΩ:1000,kohm:1000,kOhm:1000,KOhm:1000,Kohm:1000,MΩ:1e6,Mohm:1e6,MOhm:1e6,megohm:1e6,Megohm:1e6,GΩ:1e9,Gohm:1e9,GOhm:1e9,TΩ:1000000000000,Tohm:1000000000000,TOhm:1000000000000}},V:{baseUnit:"V",variants:{mV:0.001,V:1,kV:1000,KV:1000,MV:1e6,GV:1e9,TV:1000000000000}},A:{baseUnit:"A",variants:{µA:0.000001,μA:0.000001,mA:0.001,ma:0.001,A:1,kA:1000,MA:1e6}},F:{baseUnit:"F",variants:{pF:0.000000000001,nF:0.000000001,µF:0.000001,μF:0.000001,uF:0.000001,mF:0.001,F:1,kF:1000,KF:1000,MF:1e6}},H:{baseUnit:"H",variants:{pH:0.000000000001,nH:0.000000001,µH:0.000001,μH:0.000001,uH:0.000001,mH:0.001,H:1,kH:1000,KH:1000,MH:1e6}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1000,L:1000}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{fs:0.000000000001,ps:0.000000001,ns:0.000001,us:0.001,µs:0.001,μs:0.001,ms:1,s:1000}},mm:{baseUnit:"mm",variants:{nm:0.000001,µm:0.001,μm:0.001,um:0.001,mm:1,cm:10,dm:100,m:1000,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:0.0254}}},ep=new Set;for(let[t,e]of Object.entries(Vy)){ep.add(t);for(let r of Object.keys(e.variants))ep.add(r)}function m5(t){for(let e of Object.values(Vy)){if(t in e.variants)return{baseUnit:e.baseUnit,conversionFactor:e.variants[t]};for(let[r,n]of Object.entries(e.variants)){if(!t.endsWith(r))continue;let i=t.slice(0,-r.length),s=Dy(i);if(s==null)continue;return{baseUnit:e.baseUnit,conversionFactor:s*n}}}return{baseUnit:t,conversionFactor:1}}function se(t,e){if(t===void 0||t===null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof t==="string"&&t.match(/^-?[\d.]+$/))return{value:Number.parseFloat(t),parsedUnit:null,unitOfValue:null};if(typeof t==="number")return{value:t,parsedUnit:null,unitOfValue:null};if(typeof t==="object"&&"x"in t&&"y"in t){let a=se(t.x,e),p=se(t.x,e),d=se(t.y,e);if(p.value===null||d.value===null)return{parsedUnit:null,unitOfValue:null,value:null};return{parsedUnit:a.parsedUnit,unitOfValue:a.unitOfValue,value:{x:p.value,y:d.value}}}let n=t.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!n)throw Error(`Could not determine unit: "${t}"`);let i=n.split("").reverse().join(""),s=t.slice(0,-i.length),o=Dy(i);if(e&&o!=null)return{parsedUnit:null,unitOfValue:e,value:Number.parseFloat(s)*o};if(o!=null&&!ep.has(i))return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(s)*o};let{baseUnit:c,conversionFactor:l}=m5(i);return{parsedUnit:i,unitOfValue:c,value:l*Number.parseFloat(s)}}var u5=d5.filter((t)=>t!=="").sort((t,e)=>e.length-t.length).map((t)=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),YU=new RegExp(`^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)(?:(${u5}))?$`);var jy=[{value:1000000000000,symbol:"T"},{value:1e9,symbol:"G"},{value:1e6,symbol:"M"},{value:1000,symbol:"k"},{value:1,symbol:""},{value:0.001,symbol:"m"},{value:0.000001,symbol:"µ"},{value:0.000000001,symbol:"n"},{value:0.000000000001,symbol:"p"}],LU=jy[jy.length-1];var kt;(function(t){t.assertEqual=(i)=>{};function e(i){}t.assertIs=e;function r(i){throw Error()}t.assertNever=r,t.arrayToEnum=(i)=>{let s={};for(let o of i)s[o]=o;return s},t.getValidEnumValues=(i)=>{let s=t.objectKeys(i).filter((c)=>typeof i[i[c]]!=="number"),o={};for(let c of s)o[c]=i[c];return t.objectValues(o)},t.objectValues=(i)=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys==="function"?(i)=>Object.keys(i):(i)=>{let s=[];for(let o in i)if(Object.prototype.hasOwnProperty.call(i,o))s.push(o);return s},t.find=(i,s)=>{for(let o of i)if(s(o))return o;return},t.isInteger=typeof Number.isInteger==="function"?(i)=>Number.isInteger(i):(i)=>typeof i==="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map((o)=>typeof o==="string"?`'${o}'`:o).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>{if(typeof s==="bigint")return s.toString();return s}})(kt||(kt={}));var zy;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(zy||(zy={}));var pt=kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),We=(t)=>{switch(typeof t){case"undefined":return pt.undefined;case"string":return pt.string;case"number":return Number.isNaN(t)?pt.nan:pt.number;case"boolean":return pt.boolean;case"function":return pt.function;case"bigint":return pt.bigint;case"symbol":return pt.symbol;case"object":if(Array.isArray(t))return pt.array;if(t===null)return pt.null;if(t.then&&typeof t.then==="function"&&t.catch&&typeof t.catch==="function")return pt.promise;if(typeof Map<"u"&&t instanceof Map)return pt.map;if(typeof Set<"u"&&t instanceof Set)return pt.set;if(typeof Date<"u"&&t instanceof Date)return pt.date;return pt.object;default:return pt.unknown}};var X=kt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class pe extends Error{get errors(){return this.issues}constructor(t){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let e=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,e);else this.__proto__=e;this.name="ZodError",this.issues=t}format(t){let e=t||function(i){return i.message},r={_errors:[]},n=(i)=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(e(s));else{let o=r,c=0;while(c<s.path.length){let l=s.path[c];if(c!==s.path.length-1)o[l]=o[l]||{_errors:[]};else o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(s));o=o[l],c++}}};return n(this),r}static assert(t){if(!(t instanceof pe))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,kt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=(e)=>e.message){let e={},r=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];e[i]=e[i]||[],e[i].push(t(n))}else r.push(t(n));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}}pe.create=(t)=>new pe(t);var f5=(t,e)=>{let r;switch(t.code){case X.invalid_type:if(t.received===pt.undefined)r="Required";else r=`Expected ${t.expected}, received ${t.received}`;break;case X.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,kt.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:r=`Unrecognized key(s) in object: ${kt.joinValues(t.keys,", ")}`;break;case X.invalid_union:r="Invalid input";break;case X.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${kt.joinValues(t.options)}`;break;case X.invalid_enum_value:r=`Invalid enum value. Expected ${kt.joinValues(t.options)}, received '${t.received}'`;break;case X.invalid_arguments:r="Invalid function arguments";break;case X.invalid_return_type:r="Invalid function return type";break;case X.invalid_date:r="Invalid date";break;case X.invalid_string:if(typeof t.validation==="object")if("includes"in t.validation){if(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${t.validation.position}`}else if("startsWith"in t.validation)r=`Invalid input: must start with "${t.validation.startsWith}"`;else if("endsWith"in t.validation)r=`Invalid input: must end with "${t.validation.endsWith}"`;else kt.assertNever(t.validation);else if(t.validation!=="regex")r=`Invalid ${t.validation}`;else r="Invalid";break;case X.too_small:if(t.type==="array")r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`;else if(t.type==="string")r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`;else if(t.type==="number")r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`;else if(t.type==="bigint")r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`;else if(t.type==="date")r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`;else r="Invalid input";break;case X.too_big:if(t.type==="array")r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`;else if(t.type==="string")r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`;else if(t.type==="number")r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`;else if(t.type==="bigint")r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`;else if(t.type==="date")r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`;else r="Invalid input";break;case X.custom:r="Invalid input";break;case X.invalid_intersection_types:r="Intersection results could not be merged";break;case X.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case X.not_finite:r="Number must be finite";break;default:r=e.defaultError,kt.assertNever(t)}return{message:r}},cr=f5;var y5=cr;function qi(){return y5}var ds=(t)=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="",l=n.filter((a)=>!!a).slice().reverse();for(let a of l)c=a(o,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function ct(t,e){let r=qi(),n=ds({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===cr?void 0:cr].filter((i)=>!!i)});t.common.issues.push(n)}class ee{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(t,e){let r=[];for(let n of e){if(n.status==="aborted")return vt;if(n.status==="dirty")t.dirty();r.push(n.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,e){let r=[];for(let n of e){let i=await n.key,s=await n.value;r.push({key:i,value:s})}return ee.mergeObjectSync(t,r)}static mergeObjectSync(t,e){let r={};for(let n of e){let{key:i,value:s}=n;if(i.status==="aborted")return vt;if(s.status==="aborted")return vt;if(i.status==="dirty")t.dirty();if(s.status==="dirty")t.dirty();if(i.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet))r[i.value]=s.value}return{status:t.value,value:r}}}var vt=Object.freeze({status:"aborted"}),Xn=(t)=>({status:"dirty",value:t}),ne=(t)=>({status:"valid",value:t}),rp=(t)=>t.status==="aborted",np=(t)=>t.status==="dirty",Ir=(t)=>t.status==="valid",Ji=(t)=>typeof Promise<"u"&&t instanceof Promise;var dt;(function(t){t.errToObj=(e)=>typeof e==="string"?{message:e}:e||{},t.toString=(e)=>typeof e==="string"?e:e?.message})(dt||(dt={}));class ve{constructor(t,e,r,n){this._cachedPath=[],this.parent=t,this.data=e,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Uy=(t,e)=>{if(Ir(e))return{success:!0,data:e.value};else{if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new pe(t.common.issues);return this._error=r,this._error}}}};function It(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(e)return{errorMap:e,description:i};return{errorMap:(o,c)=>{let{message:l}=t;if(o.code==="invalid_enum_value")return{message:l??c.defaultError};if(typeof c.data>"u")return{message:l??n??c.defaultError};if(o.code!=="invalid_type")return{message:c.defaultError};return{message:l??r??c.defaultError}},description:i}}class Ft{get description(){return this._def.description}_getType(t){return We(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:We(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ee,ctx:{common:t.parent.common,data:t.data,parsedType:We(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(Ji(e))throw Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){let r={common:{issues:[],async:e?.async??!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:We(t)},n=this._parseSync({data:t,path:r.path,parent:r});return Uy(r,n)}"~validate"(t){let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:We(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:e});return Ir(r)?{value:r.value}:{issues:e.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;e.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:e}).then((r)=>Ir(r)?{value:r.value}:{issues:e.common.issues})}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:We(t)},n=this._parse({data:t,path:r.path,parent:r}),i=await(Ji(n)?n:Promise.resolve(n));return Uy(r,i)}refine(t,e){let r=(n)=>{if(typeof e==="string"||typeof e>"u")return{message:e};else if(typeof e==="function")return e(n);else return e};return this._refinement((n,i)=>{let s=t(n),o=()=>i.addIssue({code:X.custom,...r(n)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((c)=>{if(!c)return o(),!1;else return!0});if(!s)return o(),!1;else return!0})}refinement(t,e){return this._refinement((r,n)=>{if(!t(r))return n.addIssue(typeof e==="function"?e(r,n):e),!1;else return!0})}_refinement(t){return new Ie({schema:this,typeName:wt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(e)=>this["~validate"](e)}}optional(){return Be.create(this,this._def)}nullable(){return lr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pe.create(this)}promise(){return Hn.create(this,this._def)}or(t){return no.create([this,t],this._def)}and(t){return io.create(this,t,this._def)}transform(t){return new Ie({...It(this._def),schema:this,typeName:wt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t==="function"?t:()=>t;return new co({...It(this._def),innerType:this,defaultValue:e,typeName:wt.ZodDefault})}brand(){return new ap({typeName:wt.ZodBranded,type:this,...It(this._def)})}catch(t){let e=typeof t==="function"?t:()=>t;return new lo({...It(this._def),innerType:this,catchValue:e,typeName:wt.ZodCatch})}describe(t){return new this.constructor({...this._def,description:t})}pipe(t){return xs.create(this,t)}readonly(){return po.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var _5=/^c[^\s-]{8,}$/i,g5=/^[0-9a-z]+$/,x5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,b5=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,v5=/^[a-z0-9_-]{21}$/i,S5=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,w5=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,A5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,P5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ip,B5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,I5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,F5=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,M5=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,C5=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,k5=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Hy="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",N5=new RegExp(`^${Hy}$`);function Qy(t){let e="[0-5]\\d";if(t.precision)e=`${e}\\.\\d{${t.precision}}`;else if(t.precision==null)e=`${e}(\\.\\d+)?`;let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Y5(t){return new RegExp(`^${Qy(t)}$`)}function L5(t){let e=`${Hy}T${Qy(t)}`,r=[];if(r.push(t.local?"Z?":"Z"),t.offset)r.push("([+-]\\d{2}:?\\d{2})");return e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function T5(t,e){if((e==="v4"||!e)&&B5.test(t))return!0;if((e==="v6"||!e)&&F5.test(t))return!0;return!1}function E5(t,e){if(!S5.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));if(typeof i!=="object"||i===null)return!1;if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(e&&i.alg!==e)return!1;return!0}catch{return!1}}function R5(t,e){if((e==="v4"||!e)&&I5.test(t))return!0;if((e==="v6"||!e)&&M5.test(t))return!0;return!1}class je extends Ft{_parse(t){if(this._def.coerce)t.data=String(t.data);if(this._getType(t)!==pt.string){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_type,expected:pt.string,received:i.parsedType}),vt}let r=new ee,n=void 0;for(let i of this._def.checks)if(i.kind==="min"){if(t.data.length<i.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind==="max"){if(t.data.length>i.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty()}else if(i.kind==="length"){let s=t.data.length>i.value,o=t.data.length<i.value;if(s||o){if(n=this._getOrReturnCtx(t,n),s)ct(n,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message});else if(o)ct(n,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message});r.dirty()}}else if(i.kind==="email"){if(!A5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"email",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="emoji"){if(!ip)ip=new RegExp(P5,"u");if(!ip.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"emoji",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="uuid"){if(!b5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"uuid",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="nanoid"){if(!v5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"nanoid",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cuid"){if(!_5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"cuid",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cuid2"){if(!g5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"cuid2",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="ulid"){if(!x5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"ulid",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),ct(n,{validation:"url",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="regex"){if(i.regex.lastIndex=0,!i.regex.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"regex",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="trim")t.data=t.data.trim();else if(i.kind==="includes"){if(!t.data.includes(i.value,i.position))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()}else if(i.kind==="toLowerCase")t.data=t.data.toLowerCase();else if(i.kind==="toUpperCase")t.data=t.data.toUpperCase();else if(i.kind==="startsWith"){if(!t.data.startsWith(i.value))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()}else if(i.kind==="endsWith"){if(!t.data.endsWith(i.value))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()}else if(i.kind==="datetime"){if(!L5(i).test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:"datetime",message:i.message}),r.dirty()}else if(i.kind==="date"){if(!N5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:"date",message:i.message}),r.dirty()}else if(i.kind==="time"){if(!Y5(i).test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{code:X.invalid_string,validation:"time",message:i.message}),r.dirty()}else if(i.kind==="duration"){if(!w5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"duration",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="ip"){if(!T5(t.data,i.version))n=this._getOrReturnCtx(t,n),ct(n,{validation:"ip",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="jwt"){if(!E5(t.data,i.alg))n=this._getOrReturnCtx(t,n),ct(n,{validation:"jwt",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="cidr"){if(!R5(t.data,i.version))n=this._getOrReturnCtx(t,n),ct(n,{validation:"cidr",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="base64"){if(!C5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"base64",code:X.invalid_string,message:i.message}),r.dirty()}else if(i.kind==="base64url"){if(!k5.test(t.data))n=this._getOrReturnCtx(t,n),ct(n,{validation:"base64url",code:X.invalid_string,message:i.message}),r.dirty()}else kt.assertNever(i);return{status:r.value,value:t.data}}_regex(t,e,r){return this.refinement((n)=>t.test(n),{validation:e,code:X.invalid_string,...dt.errToObj(r)})}_addCheck(t){return new je({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...dt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...dt.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...dt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...dt.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...dt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...dt.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...dt.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...dt.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...dt.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...dt.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...dt.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...dt.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...dt.errToObj(t)})}datetime(t){if(typeof t==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t});return this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...dt.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){if(typeof t==="string")return this._addCheck({kind:"time",precision:null,message:t});return this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...dt.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...dt.errToObj(t)})}regex(t,e){return this._addCheck({kind:"regex",regex:t,...dt.errToObj(e)})}includes(t,e){return this._addCheck({kind:"includes",value:t,position:e?.position,...dt.errToObj(e?.message)})}startsWith(t,e){return this._addCheck({kind:"startsWith",value:t,...dt.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:"endsWith",value:t,...dt.errToObj(e)})}min(t,e){return this._addCheck({kind:"min",value:t,...dt.errToObj(e)})}max(t,e){return this._addCheck({kind:"max",value:t,...dt.errToObj(e)})}length(t,e){return this._addCheck({kind:"length",value:t,...dt.errToObj(e)})}nonempty(t){return this.min(1,dt.errToObj(t))}trim(){return new je({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new je({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new je({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((t)=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find((t)=>t.kind==="date")}get isTime(){return!!this._def.checks.find((t)=>t.kind==="time")}get isDuration(){return!!this._def.checks.find((t)=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find((t)=>t.kind==="email")}get isURL(){return!!this._def.checks.find((t)=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find((t)=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find((t)=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((t)=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((t)=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((t)=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find((t)=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find((t)=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find((t)=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find((t)=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find((t)=>t.kind==="base64url")}get minLength(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t}get maxLength(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t}}je.create=(t)=>new je({checks:[],typeName:wt.ZodString,coerce:t?.coerce??!1,...It(t)});function O5(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}class Vn extends Ft{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce)t.data=Number(t.data);if(this._getType(t)!==pt.number){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_type,expected:pt.number,received:i.parsedType}),vt}let r=void 0,n=new ee;for(let i of this._def.checks)if(i.kind==="int"){if(!kt.isInteger(t.data))r=this._getOrReturnCtx(t,r),ct(r,{code:X.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()}else if(i.kind==="min"){if(i.inclusive?t.data<i.value:t.data<=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind==="max"){if(i.inclusive?t.data>i.value:t.data>=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()}else if(i.kind==="multipleOf"){if(O5(t.data,i.value)!==0)r=this._getOrReturnCtx(t,r),ct(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else if(i.kind==="finite"){if(!Number.isFinite(t.data))r=this._getOrReturnCtx(t,r),ct(r,{code:X.not_finite,message:i.message}),n.dirty()}else kt.assertNever(i);return{status:n.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,dt.toString(e))}gt(t,e){return this.setLimit("min",t,!1,dt.toString(e))}lte(t,e){return this.setLimit("max",t,!0,dt.toString(e))}lt(t,e){return this.setLimit("max",t,!1,dt.toString(e))}setLimit(t,e,r,n){return new Vn({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:dt.toString(n)}]})}_addCheck(t){return new Vn({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:dt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:dt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:dt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:dt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:dt.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:dt.toString(e)})}finite(t){return this._addCheck({kind:"finite",message:dt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:dt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:dt.toString(t)})}get minValue(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t}get maxValue(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t}get isInt(){return!!this._def.checks.find((t)=>t.kind==="int"||t.kind==="multipleOf"&&kt.isInteger(t.value))}get isFinite(){let t=null,e=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(e===null||r.value>e)e=r.value}else if(r.kind==="max"){if(t===null||r.value<t)t=r.value}return Number.isFinite(e)&&Number.isFinite(t)}}Vn.create=(t)=>new Vn({checks:[],typeName:wt.ZodNumber,coerce:t?.coerce||!1,...It(t)});class zn extends Ft{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==pt.bigint)return this._getInvalidInput(t);let r=void 0,n=new ee;for(let i of this._def.checks)if(i.kind==="min"){if(i.inclusive?t.data<i.value:t.data<=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind==="max"){if(i.inclusive?t.data>i.value:t.data>=i.value)r=this._getOrReturnCtx(t,r),ct(r,{code:X.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()}else if(i.kind==="multipleOf"){if(t.data%i.value!==BigInt(0))r=this._getOrReturnCtx(t,r),ct(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()}else kt.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let e=this._getOrReturnCtx(t);return ct(e,{code:X.invalid_type,expected:pt.bigint,received:e.parsedType}),vt}gte(t,e){return this.setLimit("min",t,!0,dt.toString(e))}gt(t,e){return this.setLimit("min",t,!1,dt.toString(e))}lte(t,e){return this.setLimit("max",t,!0,dt.toString(e))}lt(t,e){return this.setLimit("max",t,!1,dt.toString(e))}setLimit(t,e,r,n){return new zn({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:dt.toString(n)}]})}_addCheck(t){return new zn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:dt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:dt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:dt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:dt.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:dt.toString(e)})}get minValue(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t}get maxValue(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t}}zn.create=(t)=>new zn({checks:[],typeName:wt.ZodBigInt,coerce:t?.coerce??!1,...It(t)});class ms extends Ft{_parse(t){if(this._def.coerce)t.data=Boolean(t.data);if(this._getType(t)!==pt.boolean){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.boolean,received:r.parsedType}),vt}return ne(t.data)}}ms.create=(t)=>new ms({typeName:wt.ZodBoolean,coerce:t?.coerce||!1,...It(t)});class to extends Ft{_parse(t){if(this._def.coerce)t.data=new Date(t.data);if(this._getType(t)!==pt.date){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_type,expected:pt.date,received:i.parsedType}),vt}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return ct(i,{code:X.invalid_date}),vt}let r=new ee,n=void 0;for(let i of this._def.checks)if(i.kind==="min"){if(t.data.getTime()<i.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()}else if(i.kind==="max"){if(t.data.getTime()>i.value)n=this._getOrReturnCtx(t,n),ct(n,{code:X.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()}else kt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new to({...this._def,checks:[...this._def.checks,t]})}min(t,e){return this._addCheck({kind:"min",value:t.getTime(),message:dt.toString(e)})}max(t,e){return this._addCheck({kind:"max",value:t.getTime(),message:dt.toString(e)})}get minDate(){let t=null;for(let e of this._def.checks)if(e.kind==="min"){if(t===null||e.value>t)t=e.value}return t!=null?new Date(t):null}get maxDate(){let t=null;for(let e of this._def.checks)if(e.kind==="max"){if(t===null||e.value<t)t=e.value}return t!=null?new Date(t):null}}to.create=(t)=>new to({checks:[],coerce:t?.coerce||!1,typeName:wt.ZodDate,...It(t)});class us extends Ft{_parse(t){if(this._getType(t)!==pt.symbol){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.symbol,received:r.parsedType}),vt}return ne(t.data)}}us.create=(t)=>new us({typeName:wt.ZodSymbol,...It(t)});class eo extends Ft{_parse(t){if(this._getType(t)!==pt.undefined){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.undefined,received:r.parsedType}),vt}return ne(t.data)}}eo.create=(t)=>new eo({typeName:wt.ZodUndefined,...It(t)});class ro extends Ft{_parse(t){if(this._getType(t)!==pt.null){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.null,received:r.parsedType}),vt}return ne(t.data)}}ro.create=(t)=>new ro({typeName:wt.ZodNull,...It(t)});class Un extends Ft{constructor(){super(...arguments);this._any=!0}_parse(t){return ne(t.data)}}Un.create=(t)=>new Un({typeName:wt.ZodAny,...It(t)});class Fr extends Ft{constructor(){super(...arguments);this._unknown=!0}_parse(t){return ne(t.data)}}Fr.create=(t)=>new Fr({typeName:wt.ZodUnknown,...It(t)});class Xe extends Ft{_parse(t){let e=this._getOrReturnCtx(t);return ct(e,{code:X.invalid_type,expected:pt.never,received:e.parsedType}),vt}}Xe.create=(t)=>new Xe({typeName:wt.ZodNever,...It(t)});class fs extends Ft{_parse(t){if(this._getType(t)!==pt.undefined){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.void,received:r.parsedType}),vt}return ne(t.data)}}fs.create=(t)=>new fs({typeName:wt.ZodVoid,...It(t)});class Pe extends Ft{_parse(t){let{ctx:e,status:r}=this._processInputParams(t),n=this._def;if(e.parsedType!==pt.array)return ct(e,{code:X.invalid_type,expected:pt.array,received:e.parsedType}),vt;if(n.exactLength!==null){let s=e.data.length>n.exactLength.value,o=e.data.length<n.exactLength.value;if(s||o)ct(e,{code:s?X.too_big:X.too_small,minimum:o?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(e.data.length<n.minLength.value)ct(e,{code:X.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(e.data.length>n.maxLength.value)ct(e,{code:X.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(e.common.async)return Promise.all([...e.data].map((s,o)=>n.type._parseAsync(new ve(e,s,e.path,o)))).then((s)=>ee.mergeArray(r,s));let i=[...e.data].map((s,o)=>n.type._parseSync(new ve(e,s,e.path,o)));return ee.mergeArray(r,i)}get element(){return this._def.type}min(t,e){return new Pe({...this._def,minLength:{value:t,message:dt.toString(e)}})}max(t,e){return new Pe({...this._def,maxLength:{value:t,message:dt.toString(e)}})}length(t,e){return new Pe({...this._def,exactLength:{value:t,message:dt.toString(e)}})}nonempty(t){return this.min(1,t)}}Pe.create=(t,e)=>new Pe({type:t,minLength:null,maxLength:null,exactLength:null,typeName:wt.ZodArray,...It(e)});function Dn(t){if(t instanceof Vt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Be.create(Dn(n))}return new Vt({...t._def,shape:()=>e})}else if(t instanceof Pe)return new Pe({...t._def,type:Dn(t.element)});else if(t instanceof Be)return Be.create(Dn(t.unwrap()));else if(t instanceof lr)return lr.create(Dn(t.unwrap()));else if(t instanceof De)return De.create(t.items.map((e)=>Dn(e)));else return t}class Vt extends Ft{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),e=kt.objectKeys(t);return this._cached={shape:t,keys:e},this._cached}_parse(t){if(this._getType(t)!==pt.object){let l=this._getOrReturnCtx(t);return ct(l,{code:X.invalid_type,expected:pt.object,received:l.parsedType}),vt}let{status:r,ctx:n}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Xe&&this._def.unknownKeys==="strip")){for(let l in n.data)if(!s.includes(l))o.push(l)}let c=[];for(let l of s){let a=i[l],p=n.data[l];c.push({key:{status:"valid",value:l},value:a._parse(new ve(n,p,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Xe){let l=this._def.unknownKeys;if(l==="passthrough")for(let a of o)c.push({key:{status:"valid",value:a},value:{status:"valid",value:n.data[a]}});else if(l==="strict"){if(o.length>0)ct(n,{code:X.unrecognized_keys,keys:o}),r.dirty()}else if(l==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let a of o){let p=n.data[a];c.push({key:{status:"valid",value:a},value:l._parse(new ve(n,p,n.path,a)),alwaysSet:a in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let l=[];for(let a of c){let p=await a.key,d=await a.value;l.push({key:p,value:d,alwaysSet:a.alwaysSet})}return l}).then((l)=>ee.mergeObjectSync(r,l));else return ee.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return dt.errToObj,new Vt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(e,r)=>{let n=this._def.errorMap?.(e,r).message??r.defaultError;if(e.code==="unrecognized_keys")return{message:dt.errToObj(t).message??n};return{message:n}}}:{}})}strip(){return new Vt({...this._def,unknownKeys:"strip"})}passthrough(){return new Vt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Vt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Vt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:wt.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new Vt({...this._def,catchall:t})}pick(t){let e={};for(let r of kt.objectKeys(t))if(t[r]&&this.shape[r])e[r]=this.shape[r];return new Vt({...this._def,shape:()=>e})}omit(t){let e={};for(let r of kt.objectKeys(this.shape))if(!t[r])e[r]=this.shape[r];return new Vt({...this._def,shape:()=>e})}deepPartial(){return Dn(this)}partial(t){let e={};for(let r of kt.objectKeys(this.shape)){let n=this.shape[r];if(t&&!t[r])e[r]=n;else e[r]=n.optional()}return new Vt({...this._def,shape:()=>e})}required(t){let e={};for(let r of kt.objectKeys(this.shape))if(t&&!t[r])e[r]=this.shape[r];else{let i=this.shape[r];while(i instanceof Be)i=i._def.innerType;e[r]=i}return new Vt({...this._def,shape:()=>e})}keyof(){return Zy(kt.objectKeys(this.shape))}}Vt.create=(t,e)=>new Vt({shape:()=>t,unknownKeys:"strip",catchall:Xe.create(),typeName:wt.ZodObject,...It(e)});Vt.strictCreate=(t,e)=>new Vt({shape:()=>t,unknownKeys:"strict",catchall:Xe.create(),typeName:wt.ZodObject,...It(e)});Vt.lazycreate=(t,e)=>new Vt({shape:t,unknownKeys:"strip",catchall:Xe.create(),typeName:wt.ZodObject,...It(e)});class no extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return e.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map((o)=>new pe(o.ctx.common.issues));return ct(e,{code:X.invalid_union,unionErrors:s}),vt}if(e.common.async)return Promise.all(r.map(async(i)=>{let s={...e,common:{...e.common,issues:[]},parent:null};return{result:await i._parseAsync({data:e.data,path:e.path,parent:s}),ctx:s}})).then(n);else{let i=void 0,s=[];for(let c of r){let l={...e,common:{...e.common,issues:[]},parent:null},a=c._parseSync({data:e.data,path:e.path,parent:l});if(a.status==="valid")return a;else if(a.status==="dirty"&&!i)i={result:a,ctx:l};if(l.common.issues.length)s.push(l.common.issues)}if(i)return e.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map((c)=>new pe(c));return ct(e,{code:X.invalid_union,unionErrors:o}),vt}}get options(){return this._def.options}}no.create=(t,e)=>new no({options:t,typeName:wt.ZodUnion,...It(e)});var $e=(t)=>{if(t instanceof oo)return $e(t.schema);else if(t instanceof Ie)return $e(t.innerType());else if(t instanceof so)return[t.value];else if(t instanceof Mr)return t.options;else if(t instanceof ao)return kt.objectValues(t.enum);else if(t instanceof co)return $e(t._def.innerType);else if(t instanceof eo)return[void 0];else if(t instanceof ro)return[null];else if(t instanceof Be)return[void 0,...$e(t.unwrap())];else if(t instanceof lr)return[null,...$e(t.unwrap())];else if(t instanceof ap)return $e(t.unwrap());else if(t instanceof po)return $e(t.unwrap());else if(t instanceof lo)return $e(t._def.innerType);else return[]};class sp extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==pt.object)return ct(e,{code:X.invalid_type,expected:pt.object,received:e.parsedType}),vt;let r=this.discriminator,n=e.data[r],i=this.optionsMap.get(n);if(!i)return ct(e,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),vt;if(e.common.async)return i._parseAsync({data:e.data,path:e.path,parent:e});else return i._parseSync({data:e.data,path:e.path,parent:e})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,e,r){let n=new Map;for(let i of e){let s=$e(i.shape[t]);if(!s.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let o of s){if(n.has(o))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);n.set(o,i)}}return new sp({typeName:wt.ZodDiscriminatedUnion,discriminator:t,options:e,optionsMap:n,...It(r)})}}function op(t,e){let r=We(t),n=We(e);if(t===e)return{valid:!0,data:t};else if(r===pt.object&&n===pt.object){let i=kt.objectKeys(e),s=kt.objectKeys(t).filter((c)=>i.indexOf(c)!==-1),o={...t,...e};for(let c of s){let l=op(t[c],e[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(r===pt.array&&n===pt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<t.length;s++){let o=t[s],c=e[s],l=op(o,c);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else if(r===pt.date&&n===pt.date&&+t===+e)return{valid:!0,data:t};else return{valid:!1}}class io extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=(i,s)=>{if(rp(i)||rp(s))return vt;let o=op(i.value,s.value);if(!o.valid)return ct(r,{code:X.invalid_intersection_types}),vt;if(np(i)||np(s))e.dirty();return{status:e.value,value:o.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>n(i,s));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}io.create=(t,e,r)=>new io({left:t,right:e,typeName:wt.ZodIntersection,...It(r)});class De extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.array)return ct(r,{code:X.invalid_type,expected:pt.array,received:r.parsedType}),vt;if(r.data.length<this._def.items.length)return ct(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),vt;if(!this._def.rest&&r.data.length>this._def.items.length)ct(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty();let i=[...r.data].map((s,o)=>{let c=this._def.items[o]||this._def.rest;if(!c)return null;return c._parse(new ve(r,s,r.path,o))}).filter((s)=>!!s);if(r.common.async)return Promise.all(i).then((s)=>ee.mergeArray(e,s));else return ee.mergeArray(e,i)}get items(){return this._def.items}rest(t){return new De({...this._def,rest:t})}}De.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new De({items:t,typeName:wt.ZodTuple,rest:null,...It(e)})};class ys extends Ft{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.object)return ct(r,{code:X.invalid_type,expected:pt.object,received:r.parsedType}),vt;let n=[],i=this._def.keyType,s=this._def.valueType;for(let o in r.data)n.push({key:i._parse(new ve(r,o,r.path,o)),value:s._parse(new ve(r,r.data[o],r.path,o)),alwaysSet:o in r.data});if(r.common.async)return ee.mergeObjectAsync(e,n);else return ee.mergeObjectSync(e,n)}get element(){return this._def.valueType}static create(t,e,r){if(e instanceof Ft)return new ys({keyType:t,valueType:e,typeName:wt.ZodRecord,...It(r)});return new ys({keyType:je.create(),valueType:t,typeName:wt.ZodRecord,...It(e)})}}class _s extends Ft{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.map)return ct(r,{code:X.invalid_type,expected:pt.map,received:r.parsedType}),vt;let n=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,c],l)=>({key:n._parse(new ve(r,o,r.path,[l,"key"])),value:i._parse(new ve(r,c,r.path,[l,"value"]))}));if(r.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,a=await c.value;if(l.status==="aborted"||a.status==="aborted")return vt;if(l.status==="dirty"||a.status==="dirty")e.dirty();o.set(l.value,a.value)}return{status:e.value,value:o}})}else{let o=new Map;for(let c of s){let{key:l,value:a}=c;if(l.status==="aborted"||a.status==="aborted")return vt;if(l.status==="dirty"||a.status==="dirty")e.dirty();o.set(l.value,a.value)}return{status:e.value,value:o}}}}_s.create=(t,e,r)=>new _s({valueType:e,keyType:t,typeName:wt.ZodMap,...It(r)});class Gn extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==pt.set)return ct(r,{code:X.invalid_type,expected:pt.set,received:r.parsedType}),vt;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)ct(r,{code:X.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),e.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)ct(r,{code:X.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),e.dirty()}let i=this._def.valueType;function s(c){let l=new Set;for(let a of c){if(a.status==="aborted")return vt;if(a.status==="dirty")e.dirty();l.add(a.value)}return{status:e.value,value:l}}let o=[...r.data.values()].map((c,l)=>i._parse(new ve(r,c,r.path,l)));if(r.common.async)return Promise.all(o).then((c)=>s(c));else return s(o)}min(t,e){return new Gn({...this._def,minSize:{value:t,message:dt.toString(e)}})}max(t,e){return new Gn({...this._def,maxSize:{value:t,message:dt.toString(e)}})}size(t,e){return this.min(t,e).max(t,e)}nonempty(t){return this.min(1,t)}}Gn.create=(t,e)=>new Gn({valueType:t,minSize:null,maxSize:null,typeName:wt.ZodSet,...It(e)});class Ki extends Ft{constructor(){super(...arguments);this.validate=this.implement}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==pt.function)return ct(e,{code:X.invalid_type,expected:pt.function,received:e.parsedType}),vt;function r(o,c){return ds({data:o,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,qi(),cr].filter((l)=>!!l),issueData:{code:X.invalid_arguments,argumentsError:c}})}function n(o,c){return ds({data:o,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,qi(),cr].filter((l)=>!!l),issueData:{code:X.invalid_return_type,returnTypeError:c}})}let i={errorMap:e.common.contextualErrorMap},s=e.data;if(this._def.returns instanceof Hn){let o=this;return ne(async function(...c){let l=new pe([]),a=await o._def.args.parseAsync(c,i).catch((m)=>{throw l.addIssue(r(c,m)),l}),p=await Reflect.apply(s,this,a);return await o._def.returns._def.type.parseAsync(p,i).catch((m)=>{throw l.addIssue(n(p,m)),l})})}else{let o=this;return ne(function(...c){let l=o._def.args.safeParse(c,i);if(!l.success)throw new pe([r(c,l.error)]);let a=Reflect.apply(s,this,l.data),p=o._def.returns.safeParse(a,i);if(!p.success)throw new pe([n(a,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ki({...this._def,args:De.create(t).rest(Fr.create())})}returns(t){return new Ki({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,e,r){return new Ki({args:t?t:De.create([]).rest(Fr.create()),returns:e||Fr.create(),typeName:wt.ZodFunction,...It(r)})}}class oo extends Ft{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}}oo.create=(t,e)=>new oo({getter:t,typeName:wt.ZodLazy,...It(e)});class so extends Ft{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return ct(e,{received:e.data,code:X.invalid_literal,expected:this._def.value}),vt}return{status:"valid",value:t.data}}get value(){return this._def.value}}so.create=(t,e)=>new so({value:t,typeName:wt.ZodLiteral,...It(e)});function Zy(t,e){return new Mr({values:t,typeName:wt.ZodEnum,...It(e)})}class Mr extends Ft{_parse(t){if(typeof t.data!=="string"){let e=this._getOrReturnCtx(t),r=this._def.values;return ct(e,{expected:kt.joinValues(r),received:e.parsedType,code:X.invalid_type}),vt}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(t.data)){let e=this._getOrReturnCtx(t),r=this._def.values;return ct(e,{received:e.data,code:X.invalid_enum_value,options:r}),vt}return ne(t.data)}get options(){return this._def.values}get enum(){let t={};for(let e of this._def.values)t[e]=e;return t}get Values(){let t={};for(let e of this._def.values)t[e]=e;return t}get Enum(){let t={};for(let e of this._def.values)t[e]=e;return t}extract(t,e=this._def){return Mr.create(t,{...this._def,...e})}exclude(t,e=this._def){return Mr.create(this.options.filter((r)=>!t.includes(r)),{...this._def,...e})}}Mr.create=Zy;class ao extends Ft{_parse(t){let e=kt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==pt.string&&r.parsedType!==pt.number){let n=kt.objectValues(e);return ct(r,{expected:kt.joinValues(n),received:r.parsedType,code:X.invalid_type}),vt}if(!this._cache)this._cache=new Set(kt.getValidEnumValues(this._def.values));if(!this._cache.has(t.data)){let n=kt.objectValues(e);return ct(r,{received:r.data,code:X.invalid_enum_value,options:n}),vt}return ne(t.data)}get enum(){return this._def.values}}ao.create=(t,e)=>new ao({values:t,typeName:wt.ZodNativeEnum,...It(e)});class Hn extends Ft{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==pt.promise&&e.common.async===!1)return ct(e,{code:X.invalid_type,expected:pt.promise,received:e.parsedType}),vt;let r=e.parsedType===pt.promise?e.data:Promise.resolve(e.data);return ne(r.then((n)=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}}Hn.create=(t,e)=>new Hn({type:t,typeName:wt.ZodPromise,...It(e)});class Ie extends Ft{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:(s)=>{if(ct(r,s),s.fatal)e.abort();else e.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let s=n.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async(o)=>{if(e.value==="aborted")return vt;let c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});if(c.status==="aborted")return vt;if(c.status==="dirty")return Xn(c.value);if(e.value==="dirty")return Xn(c.value);return c});else{if(e.value==="aborted")return vt;let o=this._def.schema._parseSync({data:s,path:r.path,parent:r});if(o.status==="aborted")return vt;if(o.status==="dirty")return Xn(o.value);if(e.value==="dirty")return Xn(o.value);return o}}if(n.type==="refinement"){let s=(o)=>{let c=n.refinement(o,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return vt;if(o.status==="dirty")e.dirty();return s(o.value),{status:e.value,value:o.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(o.status==="aborted")return vt;if(o.status==="dirty")e.dirty();return s(o.value).then(()=>({status:e.value,value:o.value}))})}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ir(s))return vt;let o=n.transform(s.value,i);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(!Ir(s))return vt;return Promise.resolve(n.transform(s.value,i)).then((o)=>({status:e.value,value:o}))});kt.assertNever(n)}}Ie.create=(t,e,r)=>new Ie({schema:t,typeName:wt.ZodEffects,effect:e,...It(r)});Ie.createWithPreprocess=(t,e,r)=>new Ie({schema:e,effect:{type:"preprocess",transform:t},typeName:wt.ZodEffects,...It(r)});class Be extends Ft{_parse(t){if(this._getType(t)===pt.undefined)return ne(void 0);return this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Be.create=(t,e)=>new Be({innerType:t,typeName:wt.ZodOptional,...It(e)});class lr extends Ft{_parse(t){if(this._getType(t)===pt.null)return ne(null);return this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}lr.create=(t,e)=>new lr({innerType:t,typeName:wt.ZodNullable,...It(e)});class co extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;if(e.parsedType===pt.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}}co.create=(t,e)=>new co({innerType:t,typeName:wt.ZodDefault,defaultValue:typeof e.default==="function"?e.default:()=>e.default,...It(e)});class lo extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Ji(n))return n.then((i)=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new pe(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new pe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}lo.create=(t,e)=>new lo({innerType:t,typeName:wt.ZodCatch,catchValue:typeof e.catch==="function"?e.catch:()=>e.catch,...It(e)});class gs extends Ft{_parse(t){if(this._getType(t)!==pt.nan){let r=this._getOrReturnCtx(t);return ct(r,{code:X.invalid_type,expected:pt.nan,received:r.parsedType}),vt}return{status:"valid",value:t.data}}}gs.create=(t)=>new gs({typeName:wt.ZodNaN,...It(t)});var KU=Symbol("zod_brand");class ap extends Ft{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}}class xs extends Ft{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return vt;if(i.status==="dirty")return e.dirty(),Xn(i.value);else return this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return vt;if(n.status==="dirty")return e.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(t,e){return new xs({in:t,out:e,typeName:wt.ZodPipeline})}}class po extends Ft{_parse(t){let e=this._def.innerType._parse(t),r=(n)=>{if(Ir(n))n.value=Object.freeze(n.value);return n};return Ji(e)?e.then((n)=>r(n)):r(e)}unwrap(){return this._def.innerType}}po.create=(t,e)=>new po({innerType:t,typeName:wt.ZodReadonly,...It(e)});function Gy(t,e){let r=typeof t==="function"?t(e):typeof t==="string"?{message:t}:t;return typeof r==="string"?{message:r}:r}function qy(t,e={},r){if(t)return Un.create().superRefine((n,i)=>{let s=t(n);if(s instanceof Promise)return s.then((o)=>{if(!o){let c=Gy(e,n),l=c.fatal??r??!0;i.addIssue({code:"custom",...c,fatal:l})}});if(!s){let o=Gy(e,n),c=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:c})}return});return Un.create()}var tG={object:Vt.lazycreate},wt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(wt||(wt={}));var h=je.create,w=Vn.create,eG=gs.create,rG=zn.create,E=ms.create,nG=to.create,iG=us.create,oG=eo.create,sG=ro.create,Jy=Un.create,Ky=Fr.create,ho=Xe.create,aG=fs.create,W=Pe.create,{create:M,strictCreate:cG}=Vt,Wt=no.create,ie=sp.create,lG=io.create,t_=De.create,Qn=ys.create,pG=_s.create,hG=Gn.create,dG=Ki.create,mG=oo.create,x=so.create,ut=Mr.create,uG=ao.create,fG=Hn.create,yG=Ie.create,_G=Be.create,gG=lr.create,xG=Ie.createWithPreprocess,bG=xs.create;var vs=h().or(w()).transform((t)=>se(t,"Ω").value),_p=h().or(w()).transform((t)=>se(t,"F").value).transform((t)=>Number.parseFloat(t.toPrecision(12))),d_=h().or(w()).transform((t)=>se(t,"H").value),xe=h().or(w()).transform((t)=>se(t,"V").value),K=h().or(w()).transform((t)=>se(t).value),kr=h().or(w()).transform((t)=>se(t,"Hz").value),R=K,hr=h().or(w()).transform((t)=>se(t,"A").value),Jn=h().or(w()).transform((t)=>se(t).value),W5=Jn,Qt=Jn,m_=h().datetime(),Et=h().or(w()).transform((t)=>{if(typeof t==="number")return t;if(t.endsWith("deg"))return Number.parseFloat(t.split("deg")[0]);if(t.endsWith("rad"))return Number.parseFloat(t.split("rad")[0])*180/Math.PI;return Number.parseFloat(t)}),u_=w().or(h().endsWith("mAh")).transform((t)=>{if(typeof t==="string"){let e=t.replace("mAh",""),r=Number.parseFloat(e);if(Number.isNaN(r))throw Error("Invalid capacity");return r}return t}).describe("Battery capacity in mAh"),A=(t)=>{};A("extra props b");A("missing props b");A(!0);A("mismatched prop types: a");var Nr=(t)=>{};Nr(!0);Nr('T1 has extra: "c", T2 has extra: "d"');Nr('T1 has extra: "c"');Nr('T2 has extra: "c"');Nr('T1 has extra: "d", T2 has extra: "c"');Nr(!0);var nt=M({x:R,y:R}),$5=nt;A(!0);A(!0);var ge=M({x:R,y:R,z:R}),j5=ge;A(!0);var Ss=M({width:w(),height:w()});A(!0);var qn=R.pipe(w().finite()),pp=R.pipe(w().finite().positive()),gp=M({shape:x("circle"),x:qn,y:qn,radius:pp}).strict(),ws=M({shape:x("rect"),x:qn,y:qn,width:pp,height:pp}).strict(),xp=ws.extend({shape:x("rotated_rect"),ccw_rotation:Et.pipe(w().finite())}),yo=M({shape:x("polygon"),points:W(nt.extend({x:qn,y:qn})).min(3).refine((t)=>{let e=t.reduce((r,n,i)=>{let s=t[(i+1)%t.length];return r+n.x*s.y-s.x*n.y},0);return Number.isFinite(e)&&e!==0},"Polygon boundary must enclose a nonzero area")}).strict();A(!0);A(!0);A(!0);A(!0);var X5=ie("shape",[gp,ws,xp,yo]);A(!0);var D5=(t)=>Array.from({length:t},()=>"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[Math.floor(Math.random()*62)]).join(""),T=(t)=>h().optional().default(()=>`${t}_${D5(10)}`),Ve=ut(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]);A(!0);var V5=ut(["top_silkscreen","bottom_silkscreen","top_copper","bottom_copper","top_soldermask","bottom_soldermask","top_fabrication_note","bottom_fabrication_note","top_user_note","bottom_user_note","top_courtyard","bottom_courtyard","inner1_copper","inner2_copper","inner3_copper","inner4_copper","inner5_copper","inner6_copper","inner7_copper","inner8_copper","edge_cuts","drill"]);A(!0);var _o=M({project_relative_path:h(),url:h(),mimetype:h()});A(!0);var As=nt.extend({rotation:Et.optional()});A(!0);var bp=M({size:nt.optional(),thickness:R.optional()});A(!0);var f_=M({font:bp.optional()});A(!0);var fo=M({value:h(),at:As.optional(),layer:h().optional(),uuid:h().optional(),hide:E().optional(),effects:f_.optional()});A(!0);var y_=M({Reference:fo.optional(),Value:fo.optional(),Datasheet:fo.optional(),Description:fo.optional()});A(!0);var __=M({through_hole:E().optional(),smd:E().optional(),exclude_from_pos_files:E().optional(),exclude_from_bom:E().optional()});A(!0);var g_=M({name:h(),type:h(),shape:h().optional(),at:As.optional(),size:nt.optional(),drill:R.optional(),layers:W(h()).optional(),removeUnusedLayers:E().optional(),uuid:h().optional()});A(!0);var x_=M({path:h(),offset:ge.optional(),scale:ge.optional(),rotate:ge.optional()});A(!0);var b_=M({footprintName:h().optional(),version:Wt([w(),h()]).optional(),generator:h().optional(),generatorVersion:Wt([w(),h()]).optional(),layer:h().optional(),properties:y_.optional(),attributes:__.optional(),pads:W(g_).optional(),embeddedFonts:E().optional(),model:x_.optional()});A(!0);var v_=M({hide:E().optional()});A(!0);var S_=M({offset:R.optional(),hide:E().optional()});A(!0);var w_=M({font:bp.optional(),justify:Wt([h(),W(h())]).optional(),hide:E().optional()});A(!0);var pr=M({value:h(),id:Wt([w(),h()]).optional(),at:As.optional(),effects:w_.optional()});A(!0);var A_=M({Reference:pr.optional(),Value:pr.optional(),Footprint:pr.optional(),Datasheet:pr.optional(),Description:pr.optional(),ki_keywords:pr.optional(),ki_fp_filters:pr.optional()});A(!0);var P_=M({symbolName:h().optional(),extends:h().optional(),pinNumbers:v_.optional(),pinNames:S_.optional(),excludeFromSim:E().optional(),inBom:E().optional(),onBoard:E().optional(),properties:A_.optional(),embeddedFonts:E().optional()});A(!0);var Mt=M({error_type:h(),message:h(),is_fatal:E().optional()});A(!0);var Kn=ut(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]);A(!0);var Tt=M({type:x("source_component"),ftype:h().optional(),source_component_id:h(),name:h(),manufacturer_part_number:h().optional(),supplier_part_numbers:Qn(Kn,W(h())).optional(),display_value:h().optional(),display_name:h().optional(),are_pins_interchangeable:E().optional(),internally_connected_source_port_ids:W(W(h())).optional(),source_group_id:h().optional(),subcircuit_id:h().optional()});A(!0);var vp=Tt.extend({ftype:x("simple_capacitor"),capacitance:_p,max_voltage_rating:xe.optional(),display_capacitance:h().optional(),max_decoupling_trace_length:R.optional()});A(!0);var Sp=Tt.extend({ftype:x("simple_resistor"),resistance:vs,display_resistance:h().optional()});A(!0);var Ps=Tt.extend({ftype:x("simple_diode")});A(!0);var B_=Tt.extend({ftype:x("simple_fiducial")});A(!0);var wp=Ps.extend({ftype:x("simple_led"),color:h().optional(),wavelength:h().optional()});A(!0);var I_=Tt.extend({ftype:x("simple_ground")});A(!0);var Ap=Tt.extend({ftype:x("simple_chip")});A(!0);var F_=Tt.extend({ftype:x("printedpart"),material:ut(["pla","petg","nylon"]).optional(),color:h().trim().min(1).optional()});A(!0);var M_=Tt.extend({ftype:x("subassembly")});A(!0);var C_=Tt.extend({ftype:x("motor")});A(!0);var Pp=Tt.extend({ftype:x("simple_power_source"),voltage:xe});A(!0);var k_=Tt.extend({ftype:x("simple_current_source"),current:hr,frequency:kr.optional(),peak_to_peak_current:hr.optional(),wave_shape:ut(["sine","square","triangle","sawtooth","dc"]).optional().default("dc"),phase:w().optional(),duty_cycle:w().min(0).max(1).optional()});A(!0);var N_=Tt.extend({ftype:x("simple_fuse"),current_rating_amps:w().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:w().describe("Voltage rating in volts, e.g. ±5V would be 5")});A(!0);var Y_=Tt.extend({ftype:x("simple_ammeter")});A(!0);var e_=Wt([w(),h().trim().regex(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?\s*(?:[fpnumkKMGTµμ]?V?|V)?$/,"Expected a scalar voltage, optionally with SI units")]).pipe(xe).pipe(w().finite()),L_=M({is_input:E().optional(),is_output:E().optional(),is_bidirectional:E().optional(),is_passive:E().optional(),can_use_tri_state:E().optional(),is_using_tri_state:E().optional(),can_use_open_collector:E().optional(),is_using_open_collector:E().optional(),can_use_open_emitter:E().optional(),is_using_open_emitter:E().optional(),is_gpio:E().optional(),highlight_color:h().optional(),must_be_connected:E().optional(),provides_power:E().optional(),requires_power:E().optional(),provides_ground:E().optional(),requires_ground:E().optional(),provides_voltage:e_.optional(),requires_voltage:e_.optional(),required_voltage_tolerance:w().finite().min(0).max(1).optional(),do_not_connect:E().optional(),include_in_board_pinout:E().optional(),can_use_internal_pullup:E().optional(),is_using_internal_pullup:E().optional(),needs_external_pullup:E().optional(),can_use_internal_pulldown:E().optional(),is_using_internal_pulldown:E().optional(),needs_external_pulldown:E().optional(),can_use_open_drain:E().optional(),is_using_open_drain:E().optional(),can_use_push_pull:E().optional(),is_using_push_pull:E().optional(),should_have_decoupling_capacitor:E().optional(),recommended_decoupling_capacitor_capacitance:Wt([h(),w()]).optional(),is_configured_for_i2c_sda:E().optional(),is_configured_for_i2c_scl:E().optional(),is_configured_for_spi_mosi:E().optional(),is_configured_for_spi_miso:E().optional(),is_configured_for_spi_sck:E().optional(),is_configured_for_spi_cs:E().optional(),is_configured_for_uart_tx:E().optional(),is_configured_for_uart_rx:E().optional(),supports_i2c_sda:E().optional(),supports_i2c_scl:E().optional(),supports_spi_mosi:E().optional(),supports_spi_miso:E().optional(),supports_spi_sck:E().optional(),supports_spi_cs:E().optional(),supports_uart_tx:E().optional(),supports_uart_rx:E().optional()});A(!0);var Bp=Tt.extend({ftype:x("simple_battery"),capacity:u_});A(!0);var Ip=Tt.extend({ftype:x("simple_inductor"),inductance:d_,display_inductance:h().optional(),max_current_rating:w().optional()});A(!0);var Fp=Tt.extend({ftype:x("simple_push_button")});A(!0);var Mp=Tt.extend({ftype:x("simple_potentiometer"),max_resistance:vs,display_max_resistance:h().optional()});A(!0);var T_=Tt.extend({ftype:x("simple_crystal"),frequency:w().describe("Frequency in Hz"),load_capacitance:w().optional().describe("Load capacitance in pF"),pin_variant:ut(["two_pin","four_pin"]).optional()});A(!0);var Cp=Tt.extend({ftype:x("simple_pin_header"),pin_count:w(),gender:ut(["male","female"]).optional().default("male")});A(!0);var E_=["usb_c","m2","jst_sh","jst_gh","jst_zh","jst_ph","jst_xh","jst_vh"],R_=Tt.extend({ftype:x("simple_connector"),standard:ut(E_).optional(),pin_count:w().int().positive().optional()});A(!0);var kp=Tt.extend({ftype:x("simple_pinout")});A(!0);var Np=Tt.extend({ftype:x("simple_resonator"),load_capacitance:_p,equivalent_series_resistance:vs.optional(),frequency:kr});A(!0);var Yp=Tt.extend({ftype:x("simple_transistor"),transistor_type:ut(["npn","pnp"])});A(!0);var Lp=Tt.extend({ftype:x("simple_test_point"),footprint_variant:ut(["pad","through_hole"]).optional(),pad_shape:ut(["rect","circle"]).optional(),pad_diameter:Wt([w(),h()]).optional(),hole_diameter:Wt([w(),h()]).optional(),width:Wt([w(),h()]).optional(),height:Wt([w(),h()]).optional()});A(!0);var Tp=Tt.extend({ftype:x("simple_mosfet"),channel_type:ut(["n","p"]),mosfet_mode:ut(["enhancement","depletion"])});A(!0);var Ep=Tt.extend({ftype:x("simple_op_amp")});A(!0);var Rp=Tt.extend({ftype:x("simple_switch")});A(!0);var Op=M({type:x("source_project_metadata"),name:h().optional(),software_used_string:h().optional(),project_url:h().optional(),source_filesystem_md5_hash:h().optional(),created_at:m_.optional()});A(!0);var O_=Mt.extend({type:x("source_missing_property_error"),source_missing_property_error_id:T("source_missing_property_error"),source_component_id:h(),property_name:h(),subcircuit_id:h().optional(),error_type:x("source_missing_property_error").default("source_missing_property_error")}).describe("The source code is missing a property");A(!0);var W_=Mt.extend({type:x("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:T("source_failed_to_create_component_error"),error_type:x("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:h().optional(),subcircuit_id:h().optional(),parent_source_component_id:h().optional(),pcb_center:M({x:w().optional(),y:w().optional()}).optional(),schematic_center:M({x:w().optional(),y:w().optional()}).optional()}).describe("Error emitted when a component fails to be constructed");A(!0);var Wp=Mt.extend({type:x("source_invalid_component_property_error"),source_invalid_component_property_error_id:T("source_invalid_component_property_error"),source_component_id:h(),property_name:h(),property_value:Ky().optional(),expected_format:h().optional(),subcircuit_id:h().optional(),error_type:x("source_invalid_component_property_error").default("source_invalid_component_property_error")}).describe("The source component property is invalid");A(!0);var $p=Mt.extend({type:x("source_trace_not_connected_error"),source_trace_not_connected_error_id:T("source_trace_not_connected_error"),error_type:x("source_trace_not_connected_error").default("source_trace_not_connected_error"),subcircuit_id:h().optional(),source_group_id:h().optional(),source_trace_id:h().optional(),connected_source_port_ids:W(h()).optional(),selectors_not_found:W(h()).optional()}).describe("Occurs when a source trace selector does not match any ports");A(!0);var $_=M({type:x("source_property_ignored_warning"),source_property_ignored_warning_id:T("source_property_ignored_warning"),source_component_id:h(),property_name:h(),subcircuit_id:h().optional(),error_type:x("source_property_ignored_warning").default("source_property_ignored_warning"),message:h()}).describe("The source property was ignored");A(!0);var jp=M({type:x("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:T("source_pin_missing_trace_warning"),warning_type:x("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:h(),source_component_id:h(),source_port_id:h(),subcircuit_id:h().optional()}).describe("Warning emitted when a source component pin is missing a trace connection");A(!0);var Xp=M({type:x("source_missing_manufacturer_part_number_warning"),source_missing_manufacturer_part_number_warning_id:T("source_missing_manufacturer_part_number_warning"),warning_type:x("source_missing_manufacturer_part_number_warning").default("source_missing_manufacturer_part_number_warning"),message:h(),source_component_id:h(),standard:h().optional(),subcircuit_id:h().optional()}).describe("Warning emitted when a source component is missing its manufacturer part number");A(!0);var Dp=M({type:x("source_refdes_convention_warning"),source_refdes_convention_warning_id:T("source_refdes_convention_warning"),warning_type:x("source_refdes_convention_warning").default("source_refdes_convention_warning"),message:h(),source_component_id:h(),refdes:h(),source_component_ftype:h(),expected_prefixes:W(h()),actual_prefix:h().optional(),subcircuit_id:h().optional()}).describe("Warning emitted when a source component reference designator does not match the component type convention");A(!0);var Vp=M({type:x("source_component_availability_warning"),source_component_availability_warning_id:T("source_component_availability_warning"),warning_type:x("source_component_availability_warning").default("source_component_availability_warning"),message:h(),source_component_id:h(),subcircuit_id:h().optional(),supplier_name:Kn,supplier_part_numbers:W(h()).nonempty()}).describe("Warning emitted when no supplier alternative can be confirmed in stock. Availability may be unknown or change over time.");A(!0);var j_=Tt.extend({ftype:x("simple_voltage_probe")});A(!0);var X_=Tt.extend({ftype:x("interconnect")});A(!0);var zp=Mt.extend({type:x("source_i2c_misconfigured_error"),source_i2c_misconfigured_error_id:T("source_i2c_misconfigured_error"),error_type:x("source_i2c_misconfigured_error").default("source_i2c_misconfigured_error"),source_port_ids:W(h())}).describe("Error emitted when incompatible I2C pins (e.g. SDA and SCL) are connected to the same net");A(!0);var Up=Mt.extend({type:x("source_component_misconfigured_error"),source_component_misconfigured_error_id:T("source_component_misconfigured_error"),error_type:x("source_component_misconfigured_error").default("source_component_misconfigured_error"),source_component_ids:W(h()),source_port_ids:W(h()).optional()}).describe("Error emitted when one or more source components have an invalid or conflicting configuration");A(!0);var D_=Tt.extend({ftype:x("simple_voltage_source"),voltage:xe,frequency:kr.optional(),peak_to_peak_voltage:xe.optional(),wave_shape:ut(["sinewave","square","triangle","sawtooth"]).optional(),phase:Et.optional(),duty_cycle:w().optional().describe("Duty cycle as a fraction (0 to 1)"),pulse_delay:Qt.optional(),rise_time:Qt.optional(),fall_time:Qt.optional(),pulse_width:Qt.optional(),period:Qt.optional()});A(!0);var V_=Wt([Sp,vp,Ps,B_,wp,I_,Ap,F_,M_,C_,Pp,k_,Y_,Bp,Ip,Fp,Mp,T_,Cp,R_,kp,Np,Rp,Yp,Lp,Tp,Ep,N_,j_,X_,D_,Op,O_,Wp,W_,$p,$_,jp,Xp,Dp,Vp,zp,Up]);A(!0);var z_=M({type:x("source_port"),pin_number:w().optional(),port_hints:W(h()).optional(),name:h(),source_port_id:h(),source_component_id:h().optional(),source_group_id:h().optional(),most_frequently_referenced_by_name:h().optional(),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional()}).merge(L_);A(!0);var U_=M({type:x("source_component_internal_connection"),source_component_internal_connection_id:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()});A(!0);var G_=M({type:x("source_trace"),source_trace_id:h(),connected_source_port_ids:W(h()),connected_source_net_ids:W(h()),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),max_length:w().optional(),max_via_count:w().int().nonnegative().optional(),name:h().optional(),min_trace_thickness:w().optional(),display_name:h().optional()});A(!0);var H_=M({type:x("source_group"),source_group_id:h(),subcircuit_id:h().optional(),parent_subcircuit_id:h().optional(),parent_source_group_id:h().optional(),is_subcircuit:E().optional(),show_as_schematic_box:E().optional(),name:h().optional(),was_automatically_named:E().optional()});A(!0);var Q_=M({type:x("source_net"),source_net_id:h(),name:h(),member_source_group_ids:W(h()),is_power:E().optional(),is_ground:E().optional(),is_digital_signal:E().optional(),is_analog_signal:E().optional(),is_positive_voltage_source:E().optional(),trace_width:w().optional(),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional()});A(!0);var Z_=M({type:x("source_board"),source_board_id:h(),source_group_id:h(),title:h().optional()}).describe("Defines a board in the source domain");A(!0);var q_=Mt.extend({type:x("source_ambiguous_port_reference"),source_ambiguous_port_reference_id:T("source_ambiguous_port_reference"),error_type:x("source_ambiguous_port_reference").default("source_ambiguous_port_reference"),source_port_id:h().optional(),source_component_id:h().optional()}).describe("Error emitted when a port hint matches multiple non-overlapping pads, making the port reference ambiguous");A(!0);var J_=M({type:x("source_pcb_ground_plane"),source_pcb_ground_plane_id:h(),source_group_id:h(),source_net_id:h(),subcircuit_id:h().optional()}).describe("Defines a ground plane in the source domain");A(!0);var K_=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6","inner7","inner8"],hp=ut(K_),gt=hp.or(M({name:hp})).transform((t)=>{if(typeof t==="string")return t;return t.name});A(!0);var Ut=ut(["top","bottom"]),t0=M({type:x("source_manually_placed_via"),source_manually_placed_via_id:h(),source_group_id:h(),source_net_id:h().min(1).optional(),subcircuit_id:h().optional(),source_trace_id:h().optional()}).describe("Defines a via that is manually placed in the source domain");A(!0);var e0=M({type:x("source_unnamed_trace_warning"),source_unnamed_trace_warning_id:T("source_unnamed_trace_warning"),warning_type:x("source_unnamed_trace_warning").default("source_unnamed_trace_warning"),message:h(),source_trace_id:h(),subcircuit_id:h().optional()}).describe("Warning emitted when a source trace is missing a name");A(!0);var r0=M({type:x("source_no_power_pin_defined_warning"),source_no_power_pin_defined_warning_id:T("source_no_power_pin_defined_warning"),warning_type:x("source_no_power_pin_defined_warning").default("source_no_power_pin_defined_warning"),message:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()}).describe("Warning emitted when a chip has no source ports with requires_power=true");A(!0);var n0=M({type:x("source_no_ground_pin_defined_warning"),source_no_ground_pin_defined_warning_id:T("source_no_ground_pin_defined_warning"),warning_type:x("source_no_ground_pin_defined_warning").default("source_no_ground_pin_defined_warning"),message:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()}).describe("Warning emitted when a chip has no source ports marked as ground pins");A(!0);var i0=M({type:x("source_component_pins_underspecified_warning"),source_component_pins_underspecified_warning_id:T("source_component_pins_underspecified_warning"),warning_type:x("source_component_pins_underspecified_warning").default("source_component_pins_underspecified_warning"),message:h(),source_component_id:h(),source_port_ids:W(h()),subcircuit_id:h().optional()}).describe("Warning emitted when all ports on a source component are underspecified");A(!0);var o0=Mt.extend({type:x("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:T("source_pin_must_be_connected_error"),error_type:x("source_pin_must_be_connected_error").default("source_pin_must_be_connected_error"),source_component_id:h(),source_port_id:h(),subcircuit_id:h().optional()}).describe("Error emitted when a pin with mustBeConnected attribute is not connected to any trace");A(!0);var s0=Mt.extend({type:x("unknown_error_finding_part"),unknown_error_finding_part_id:T("unknown_error_finding_part"),error_type:x("unknown_error_finding_part").default("unknown_error_finding_part"),source_component_id:h().optional(),subcircuit_id:h().optional()}).describe("Error emitted when an unexpected error occurs while finding a part");A(!0);var a0=M({type:x("source_part_not_found_warning"),source_part_not_found_warning_id:T("source_part_not_found_warning"),warning_type:x("source_part_not_found_warning").default("source_part_not_found_warning"),message:h(),source_component_id:h().optional(),subcircuit_id:h().optional(),supplier_name:Kn.optional(),manufacturer_part_number:h().optional(),supplier_part_number:h().optional(),part_name:h().optional()}).describe("Warning emitted when a requested part can not be found");A(!0);var c0=M({type:x("source_confusing_net_name_warning"),source_confusing_net_name_warning_id:T("source_confusing_net_name_warning"),warning_type:x("source_confusing_net_name_warning").default("source_confusing_net_name_warning"),message:h(),source_net_ids:W(h()).min(2),net_name:h(),subcircuit_id:h().optional()}).describe("Warning emitted when electrically disconnected source nets share a name");A(!0);var cp=Wt([w().nonnegative().finite(),M({reference:x("longest_manhattan"),source_trace_ids:W(h()).min(1).optional(),offset:w().finite().optional()})]),r_=Wt([w().positive().finite(),M({width_multiplier:w().positive().finite()})]),l0=M({type:x("source_bus"),source_bus_id:h(),name:h().optional(),source_trace_ids:W(h()).min(1),max_length_skew:w().nonnegative().finite().optional(),target_impedance:w().positive().finite().optional(),target_differential_impedance:w().positive().finite().optional(),differential_pair:M({positive_source_trace_id:h(),negative_source_trace_id:h(),trace_gap:w().positive().finite().optional(),max_uncoupled_length:w().nonnegative().finite().optional()}).optional(),length_match_source_trace_ids:W(h()).min(1).optional(),min_length:cp.optional(),max_length:cp.optional(),target_length:cp.optional(),length_tolerance:w().nonnegative().finite().optional(),pcb_trace_spacing:r_.optional(),pcb_spacing_to_other_signals:r_.optional(),target_impedance_min:w().positive().finite().optional(),target_impedance_max:w().positive().finite().optional(),target_differential_impedance_min:w().positive().finite().optional(),target_differential_impedance_max:w().positive().finite().optional(),subcircuit_id:h().optional()});A(!0);var p0=Mt.pick({message:!0,error_type:!0}).extend({type:x("source_runtime_error"),source_runtime_error_id:T("source_runtime_error"),error_type:x("source_runtime_error").default("source_runtime_error"),phase_name:h().optional()}).describe("An unexpected runtime failure while generating or validating a circuit");A(!0);var h0=M({type:x("schematic_box"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),width:R,height:R,is_dashed:E().default(!1),x:R,y:R,subcircuit_id:h().optional()}).describe("Draws a box on the schematic");A(!0);var d0=M({type:x("schematic_path"),schematic_path_id:T("schematic_path"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),fill_color:h().optional(),is_filled:E().optional(),is_dashed:E().default(!1),stroke_width:R.nullable().optional(),stroke_color:h().optional(),dash_length:R.optional(),dash_gap:R.optional(),points:W(nt),subcircuit_id:h().optional()});A(!0);var m0=Qn(M({left_margin:K.optional(),right_margin:K.optional(),top_margin:K.optional(),bottom_margin:K.optional()})),u0=M({left_size:w(),right_size:w(),top_size:w().optional(),bottom_size:w().optional()});A(!0);var f0=M({left_side:M({pins:W(w()),direction:ut(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:M({pins:W(w()),direction:ut(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:M({pins:W(w()),direction:ut(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:M({pins:W(w()),direction:ut(["left-to-right","right-to-left"]).optional()}).optional()});A(!0);var y0=Wt([u0,f0]),_0=M({type:x("schematic_component"),size:Ss,center:nt,source_component_id:h().optional(),schematic_component_id:h(),schematic_sheet_id:h().optional(),schematic_symbol_id:h().optional(),pin_spacing:K.optional(),pin_styles:m0.optional(),box_width:K.optional(),symbol_name:h().optional(),port_arrangement:y0.optional(),port_labels:Qn(h()).optional(),symbol_display_value:h().optional(),subcircuit_id:h().optional(),schematic_group_id:h().optional(),is_schematic_group:E().optional(),source_group_id:h().optional(),is_box_with_pins:E().optional().default(!0)});A(!0);var z5=M({kicad_symbol:P_.optional()}).catchall(Ky()),g0=M({type:x("schematic_symbol"),schematic_symbol_id:h(),name:h().optional(),metadata:z5.optional()}).describe("Defines a named schematic symbol that can be referenced by components.");A(!0);var x0=M({type:x("schematic_line"),schematic_line_id:T("schematic_line"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),x1:R,y1:R,x2:R,y2:R,stroke_width:R.nullable().optional(),color:h().default("#000000"),is_dashed:E().default(!1),dash_length:R.optional(),dash_gap:R.optional(),subcircuit_id:h().optional()}).describe("Draws a styled line on the schematic");A(!0);var b0=M({type:x("schematic_rect"),schematic_rect_id:T("schematic_rect"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),center:nt,width:R,height:R,rotation:Et.default(0),stroke_width:R.nullable().optional(),color:h().default("#000000"),is_filled:E().default(!1),fill_color:h().optional(),is_dashed:E().default(!1),subcircuit_id:h().optional()}).describe("Draws a styled rectangle on the schematic");A(!0);var v0=M({type:x("schematic_circle"),schematic_circle_id:T("schematic_circle"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),center:nt,radius:R,stroke_width:R.nullable().optional(),color:h().default("#000000"),is_filled:E().default(!1),fill_color:h().optional(),is_dashed:E().default(!1),subcircuit_id:h().optional()}).describe("Draws a styled circle on the schematic");A(!0);var S0=M({type:x("schematic_arc"),schematic_arc_id:T("schematic_arc"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),center:nt,radius:R,start_angle_degrees:Et,end_angle_degrees:Et,direction:ut(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:R.nullable().optional(),color:h().default("#000000"),is_dashed:E().default(!1),subcircuit_id:h().optional()}).describe("Draws a styled arc on the schematic");A(!0);var w0=M({type:x("schematic_trace"),schematic_trace_id:h(),schematic_sheet_id:h().optional(),source_trace_id:h().optional(),junctions:W(M({x:w(),y:w()})),edges:W(M({from:M({x:w(),y:w()}),to:M({x:w(),y:w()}),is_crossing:E().optional(),from_schematic_port_id:h().optional(),to_schematic_port_id:h().optional()})),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional()});A(!0);var U5=ut(["center","left","right","top","bottom"]);A(!0);var Gp=M({text:h(),is_overlined:E().optional()}),A0=M({type:x("schematic_text"),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),schematic_symbol_id:h().optional(),schematic_text_id:h(),source_trace_id:h().optional(),text:h(),text_parts:W(Gp).min(1).optional(),display_superscript:h().optional(),font_size:w().default(0.18),position:M({x:R,y:R}),rotation:w().default(0),anchor:Wt([U5.describe("legacy"),Ve]).default("center"),color:h().default("#000000"),subcircuit_id:h().optional()});A(!0);var P0=M({type:x("schematic_port"),schematic_port_id:h(),source_port_id:h(),schematic_sheet_id:h().optional(),schematic_component_id:h().optional(),center:nt,facing_direction:ut(["up","down","left","right"]).optional(),distance_from_component_edge:w().optional(),side_of_component:ut(["top","bottom","left","right"]).optional(),true_ccw_index:w().optional(),pin_number:w().optional(),display_pin_label:h().optional(),display_pin_label_text_parts:W(Gp).min(1).optional(),display_pin_label_font_size:w().positive().finite().optional(),subcircuit_id:h().optional(),is_connected:E().optional(),is_internal_circuit_port:E().optional(),is_overlapping_internal_circuit_port:E().optional(),has_input_arrow:E().optional(),has_output_arrow:E().optional(),is_drawn_with_inversion_circle:E().optional()}).describe("Defines a port on a schematic component");A(!0);var B0=M({type:x("schematic_net_label"),schematic_net_label_id:T("schematic_net_label"),schematic_sheet_id:h().optional(),schematic_trace_id:h().optional(),source_trace_id:h().optional(),source_net_id:h(),center:nt,anchor_position:nt.optional(),anchor_side:ut(["top","bottom","left","right"]),text:h(),display_superscript:h().optional(),symbol_name:h().optional(),is_movable:E().optional(),subcircuit_id:h().optional()});A(!0);var I0=Mt.extend({type:x("schematic_error"),schematic_error_id:h(),error_type:x("schematic_port_not_found").default("schematic_port_not_found"),subcircuit_id:h().optional()}).describe("Defines a schematic error on the schematic");A(!0);var F0=Mt.extend({type:x("schematic_layout_error"),schematic_layout_error_id:T("schematic_layout_error"),error_type:x("schematic_layout_error").default("schematic_layout_error"),source_group_id:h(),schematic_group_id:h(),subcircuit_id:h().optional()}).describe("Error emitted when schematic layout fails for a group");A(!0);var Bs=M({type:x("schematic_debug_object"),label:h().optional(),subcircuit_id:h().optional()}),M0=Bs.extend({shape:x("rect"),center:nt,size:Ss}),C0=Bs.extend({shape:x("line"),start:nt,end:nt}),k0=Bs.extend({shape:x("point"),center:nt}),N0=ie("shape",[M0,C0,k0]);A(!0);var Y0=M({type:x("schematic_voltage_probe"),schematic_voltage_probe_id:h(),schematic_sheet_id:h().optional(),source_component_id:h().optional(),name:h().optional(),position:nt,schematic_trace_id:h(),voltage:xe.optional(),subcircuit_id:h().optional(),color:h().optional(),label_alignment:Ve.optional()}).describe("Defines a voltage probe measurement point on a schematic trace");A(!0);var L0=M({type:x("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:T("schematic_manual_edit_conflict_warning"),warning_type:x("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:h(),schematic_component_id:h(),schematic_group_id:h().optional(),subcircuit_id:h().optional(),source_component_id:h()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates");A(!0);var T0=M({type:x("schematic_component_overlap_warning"),schematic_component_overlap_warning_id:T("schematic_component_overlap_warning"),warning_type:x("schematic_component_overlap_warning").default("schematic_component_overlap_warning"),message:h(),schematic_component_ids:t_([h(),h()]),schematic_sheet_id:h().optional()}).describe("Warning emitted when the rendered bounds of two schematic components overlap");A(!0);var E0=M({type:x("schematic_component_styling_warning"),schematic_component_styling_warning_id:T("schematic_component_styling_warning"),warning_type:x("schematic_component_styling_warning").default("schematic_component_styling_warning"),message:h(),schematic_component_id:h(),styling_issue_type:h(),schematic_port_ids:W(h()).optional(),source_component_id:h().optional(),schematic_sheet_id:h().optional(),subcircuit_id:h().optional()}).describe("Warning emitted when a schematic component has a visual styling issue");A(!0);var R0=M({type:x("schematic_sheet_styling_warning"),schematic_sheet_styling_warning_id:T("schematic_sheet_styling_warning"),warning_type:x("schematic_sheet_styling_warning").default("schematic_sheet_styling_warning"),message:h(),schematic_sheet_id:h(),styling_issue_type:x("non_default_sheet_size"),subcircuit_id:h().optional()}).describe("Style warning emitted when a schematic sheet uses a non-default size");A(!0);var O0=M({type:x("schematic_element_outside_sheet_warning"),schematic_element_outside_sheet_warning_id:T("schematic_element_outside_sheet_warning"),warning_type:x("schematic_element_outside_sheet_warning").default("schematic_element_outside_sheet_warning"),message:h(),schematic_sheet_id:h(),schematic_element_type:ut(["schematic_component","schematic_net_label","schematic_trace"]),schematic_element_id:h()}).describe("Warning emitted when a schematic component, net label, or trace extends outside its schematic sheet");A(!0);var n_=R.pipe(w().positive().finite()),W0=M({type:x("schematic_graphic"),schematic_graphic_id:T("schematic_graphic"),schematic_sheet_id:h().optional(),asset:_o.optional(),svg_content:h().optional(),width:n_.optional(),height:n_.optional()}).describe("References a graphic asset or inline SVG content with optional centered layout bounds on a schematic sheet").superRefine(({asset:t,svg_content:e},r)=>{if(t===void 0&&e===void 0)r.addIssue({code:X.custom,message:"At least one of asset or svg_content is required"})});A(!0);var $0=M({type:x("schematic_group"),schematic_group_id:T("schematic_group"),schematic_sheet_id:h().optional(),source_group_id:h(),is_subcircuit:E().optional(),subcircuit_id:h().optional(),width:K,height:K,center:nt,schematic_component_ids:W(h()),show_as_schematic_box:E().optional(),name:h().optional(),description:h().optional()}).describe("Defines a group of components on the schematic");A(!0);var j0=M({type:x("schematic_table"),schematic_table_id:T("schematic_table"),schematic_sheet_id:h().optional(),anchor_position:nt,column_widths:W(R),row_heights:W(R),cell_padding:R.optional(),border_width:R.optional(),subcircuit_id:h().optional(),schematic_component_id:h().optional(),anchor:Ve.optional()}).describe("Defines a table on the schematic");A(!0);var X0=M({type:x("schematic_table_cell"),schematic_table_cell_id:T("schematic_table_cell"),schematic_sheet_id:h().optional(),schematic_table_id:h(),start_row_index:w(),end_row_index:w(),start_column_index:w(),end_column_index:w(),text:h().optional(),center:nt,width:R,height:R,horizontal_align:ut(["left","center","right"]).optional(),vertical_align:ut(["top","middle","bottom"]).optional(),font_size:R.optional(),subcircuit_id:h().optional()}).describe("Defines a cell within a schematic_table");A(!0);var D0=ut(["a4","ansi_b"]),V0=M({type:x("schematic_sheet"),schematic_sheet_id:T("schematic_sheet"),name:h().optional(),sheet_index:w().optional(),sheet_size:D0.optional(),sheet_width:w().positive().optional(),sheet_height:w().positive().optional(),subcircuit_id:h().optional(),outline_color:h().optional()}).describe("Defines a schematic sheet or page that components can be placed on");A(!0);var z0=M({type:x("schematic_missing_sheet_warning"),schematic_missing_sheet_warning_id:T("schematic_missing_sheet_warning"),warning_type:x("schematic_missing_sheet_warning").default("schematic_missing_sheet_warning"),message:h()}).describe("Circuit-wide warning emitted when a schematic has no schematic sheet. Display as a banner without attaching it to a component or drawing a target outline or leader line.");A(!0);var U0=M({x:R,y:R,bulge:w().optional()});A(!0);var dp=M({vertices:W(U0)});A(!0);var Hp=M({outer_ring:dp,inner_rings:W(dp).default([])});A(!0);var G0={from_left:"from_left",from_right:"from_right",from_top:"from_top",from_bottom:"from_bottom",from_above:"from_above",from_below:"from_below",from_x_neg:"from_left",from_x_pos:"from_right",from_y_pos:"from_top",from_y_neg:"from_bottom",from_z_pos:"from_above",from_z_neg:"from_below",from_front:"from_top",from_back:"from_bottom"},G5={from_left:{x:-1,y:0,z:0},from_right:{x:1,y:0,z:0},from_top:{x:0,y:1,z:0},from_bottom:{x:0,y:-1,z:0},from_above:{x:0,y:0,z:1},from_below:{x:0,y:0,z:-1}},H0=ut(["from_left","from_right","from_top","from_bottom","from_above","from_below","from_x_neg","from_x_pos","from_y_pos","from_y_neg","from_z_pos","from_z_neg","from_front","from_back"]).transform((t)=>G0[t]).describe('The side exposing the receptacle where the cable or mating part is attached, following the 2D PCB diagram convention, not a 3D viewport frame. In project coordinate space, "from_top" is +Y, "from_bottom" -Y, "from_left" -X, "from_right" +X, "from_above" +Z and "from_below" -Z. A receptacle on the +Y edge is "from_top" even though the plug moves in -Y as it seats. Cartesian spellings such as "from_y_pos" are accepted and normalized to the named values, as are the deprecated "from_front" (now "from_top") and "from_back" (now "from_bottom").');A(!0);A(!0);var mp=ut(["leftside_top","leftside_bottom","rightside_top","rightside_bottom","topside_left","topside_right","bottomside_left","bottomside_right"]);A(!0);var H5=[["leftside_top","bottomside_left","rightside_bottom","topside_right"],["leftside_bottom","bottomside_right","rightside_top","topside_left"]],Q5=(t,e)=>{for(let r of H5){let n=r.indexOf(t),i=r.indexOf(e);if(n!==-1&&i!==-1)return(i-n+r.length)%r.length*90}return null},Q0=M({x:R,y:R,via:E().optional(),via_to_layer:gt.optional()}),Z5=W(Q0);A(!0);A(!0);var Z0=M({x:R,y:R,via:E().optional(),to_layer:gt.optional(),trace_width:R.optional()});A(!0);var q0=M({min_trace_width:K.optional(),min_board_edge_clearance:K.optional(),min_via_hole_edge_to_via_hole_edge_clearance:K.optional(),min_plated_hole_drill_edge_to_drill_edge_clearance:K.optional(),min_trace_to_pad_edge_clearance:K.optional(),min_trace_to_hole_edge_clearance:K.optional().describe("Minimum distance from a trace copper edge to a non-plated hole edge, in mm. No default is applied when omitted."),min_pad_edge_to_pad_edge_clearance:K.optional(),min_same_net_trace_edge_to_trace_edge_clearance:K.optional(),min_different_net_trace_edge_to_trace_edge_clearance:K.optional(),min_via_edge_to_pad_edge_clearance:K.optional(),min_via_hole_diameter:K.optional(),min_via_pad_diameter:K.optional()}),J0=M({type:x("pcb_component"),pcb_component_id:T("pcb_component"),source_component_id:h(),center:nt,layer:gt,rotation:Et,display_offset_x:h().optional().describe("How to display the x offset for this part, usually corresponding with how the user specified it"),display_offset_y:h().optional().describe("How to display the y offset for this part, usually corresponding with how the user specified it"),width:K,height:K,do_not_place:E().optional(),is_allowed_to_be_off_board:E().optional(),subcircuit_id:h().optional(),pcb_group_id:h().optional(),position_mode:ut(["packed","relative_to_group_anchor","relative_to_another_component","none"]).optional(),anchor_position:nt.optional(),anchor_alignment:Ve.optional(),positioned_relative_to_pcb_group_id:h().optional(),positioned_relative_to_pcb_board_id:h().optional(),cable_insertion_center:nt.optional(),insertion_direction:H0.optional(),pin1_location:mp.optional().describe("Location of pin 1 on the unrotated, top-view component footprint"),supplier_pin1_location_map:Qn(Kn,mp).optional().describe("Pin 1 location for each supplier's unrotated, top-view footprint"),metadata:M({kicad_footprint:b_.optional()}).optional(),obstructs_within_bounds:E().default(!0).describe("Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath")}).describe("Defines a component on the PCB");A(!0);var Is=M({type:x("pcb_debug_object"),pcb_debug_object_id:T("pcb_debug_object"),label:h().optional(),subcircuit_id:h().optional()}),K0=Is.extend({shape:x("rect"),center:nt,size:Ss}),tg=Is.extend({shape:x("line"),start:nt,end:nt}),eg=Is.extend({shape:x("point"),center:nt}),rg=ie("shape",[K0,tg,eg]);A(!0);var ng=M({type:x("pcb_hole"),pcb_hole_id:T("pcb_hole"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x("circle"),hole_diameter:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),q5=ng.describe("Defines a circular hole on the PCB");A(!0);var ig=M({type:x("pcb_hole"),pcb_hole_id:T("pcb_hole"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x("rect"),hole_width:w(),hole_height:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),J5=ig.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square.");A(!0);var og=M({type:x("pcb_hole"),pcb_hole_id:T("pcb_hole"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:ut(["circle","square"]),hole_diameter:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),K5=og.describe("Defines a circular or square hole on the PCB");A(!0);var sg=M({type:x("pcb_hole"),pcb_hole_id:T("pcb_hole"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x("oval"),hole_width:w(),hole_height:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),t3=sg.describe("Defines an oval hole on the PCB");A(!0);var ag=M({type:x("pcb_hole"),pcb_hole_id:T("pcb_hole"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x("pill"),hole_width:w(),hole_height:w(),x:R,y:R,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),e3=ag.describe("Defines a pill-shaped hole on the PCB");A(!0);var cg=M({type:x("pcb_hole"),pcb_hole_id:T("pcb_hole"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_component_id:h().optional(),hole_shape:x("rotated_pill"),hole_width:w(),hole_height:w(),x:R,y:R,ccw_rotation:Et,is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional()}),r3=cg.describe("Defines a rotated pill-shaped hole on the PCB");A(!0);var lg=og.or(sg).or(ag).or(cg).or(ng).or(ig),n3=M({type:x("pcb_plated_hole"),shape:x("circle"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),outer_diameter:w(),hole_diameter:w(),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T("pcb_plated_hole"),soldermask_margin:w().optional()}),i3=M({type:x("pcb_plated_hole"),shape:ut(["oval","pill"]),pcb_group_id:h().optional(),subcircuit_id:h().optional(),outer_width:w(),outer_height:w(),hole_width:w(),hole_height:w(),is_covered_with_solder_mask:E().optional(),x:R,y:R,ccw_rotation:Et,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T("pcb_plated_hole"),soldermask_margin:w().optional()}),o3=M({type:x("pcb_plated_hole"),shape:x("circular_hole_with_rect_pad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:x("circle"),pad_shape:x("rect"),hole_diameter:w(),rect_pad_width:w(),rect_pad_height:w(),rect_border_radius:w().optional(),hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T("pcb_plated_hole"),soldermask_margin:w().optional(),rect_ccw_rotation:Et.optional()}),s3=M({type:x("pcb_plated_hole"),shape:x("pill_hole_with_rect_pad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:x("pill"),pad_shape:x("rect"),hole_width:w(),hole_height:w(),rect_pad_width:w(),rect_pad_height:w(),rect_border_radius:w().optional(),hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T("pcb_plated_hole"),soldermask_margin:w().optional()}),a3=M({type:x("pcb_plated_hole"),shape:x("rotated_pill_hole_with_rect_pad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:x("rotated_pill"),pad_shape:x("rect"),hole_width:w(),hole_height:w(),hole_ccw_rotation:Et,rect_pad_width:w(),rect_pad_height:w(),rect_border_radius:w().optional(),rect_ccw_rotation:Et,hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T("pcb_plated_hole"),soldermask_margin:w().optional()}),c3=M({type:x("pcb_plated_hole"),shape:x("hole_with_polygon_pad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),hole_shape:ut(["circle","oval","pill","rotated_pill"]),hole_diameter:w().optional(),hole_width:w().optional(),hole_height:w().optional(),pad_outline:W(M({x:R,y:R})).min(3),hole_offset_x:R.default(0),hole_offset_y:R.default(0),is_covered_with_solder_mask:E().optional(),x:R,y:R,layers:W(gt),port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),pcb_plated_hole_id:T("pcb_plated_hole"),soldermask_margin:w().optional(),ccw_rotation:Et.optional()}),pg=Wt([n3,i3,o3,s3,a3,c3]);A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);var hg=M({type:x("pcb_port"),pcb_port_id:T("pcb_port"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),source_port_id:h(),pcb_component_id:h().optional(),x:R,y:R,layers:W(gt),is_board_pinout:E().optional()}).describe("Defines a port on the PCB");A(!0);var l3=M({type:x("pcb_smtpad"),shape:x("circle"),pcb_smtpad_id:T("pcb_smtpad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,radius:w(),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),p3=M({type:x("pcb_smtpad"),shape:x("rect"),pcb_smtpad_id:T("pcb_smtpad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),rect_border_radius:w().optional(),corner_radius:w().optional(),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),soldermask_margin_left:w().optional(),soldermask_margin_top:w().optional(),soldermask_margin_right:w().optional(),soldermask_margin_bottom:w().optional(),solderpaste_margin:w().optional()}),h3=M({type:x("pcb_smtpad"),shape:x("rotated_rect"),pcb_smtpad_id:T("pcb_smtpad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),rect_border_radius:w().optional(),corner_radius:w().optional(),ccw_rotation:Et,layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),soldermask_margin_left:w().optional(),soldermask_margin_top:w().optional(),soldermask_margin_right:w().optional(),soldermask_margin_bottom:w().optional(),solderpaste_margin:w().optional()}),dg=M({type:x("pcb_smtpad"),shape:x("pill"),pcb_smtpad_id:T("pcb_smtpad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),d3=M({type:x("pcb_smtpad"),shape:x("rotated_pill"),pcb_smtpad_id:T("pcb_smtpad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),ccw_rotation:Et,layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),m3=M({type:x("pcb_smtpad"),shape:x("polygon"),pcb_smtpad_id:T("pcb_smtpad"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),points:W(nt),layer:gt,port_hints:W(h()).optional(),pcb_component_id:h().optional(),pcb_port_id:h().optional(),is_covered_with_solder_mask:E().optional(),soldermask_margin:w().optional(),solderpaste_margin:w().optional()}),mg=ie("shape",[l3,p3,h3,d3,dg,m3]).describe("Defines an SMT pad on the PCB");A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);var u3=M({type:x("pcb_solder_paste"),shape:x("circle"),pcb_solder_paste_id:T("pcb_solder_paste"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,radius:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),f3=M({type:x("pcb_solder_paste"),shape:x("rect"),pcb_solder_paste_id:T("pcb_solder_paste"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),y3=M({type:x("pcb_solder_paste"),shape:x("pill"),pcb_solder_paste_id:T("pcb_solder_paste"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),_3=M({type:x("pcb_solder_paste"),shape:x("rotated_rect"),pcb_solder_paste_id:T("pcb_solder_paste"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),ccw_rotation:R,layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),g3=M({type:x("pcb_solder_paste"),shape:x("rotated_pill"),pcb_solder_paste_id:T("pcb_solder_paste"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),radius:w(),ccw_rotation:Et,layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),x3=M({type:x("pcb_solder_paste"),shape:x("oval"),pcb_solder_paste_id:T("pcb_solder_paste"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),x:R,y:R,width:w(),height:w(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),b3=yo.extend({type:x("pcb_solder_paste"),pcb_solder_paste_id:T("pcb_solder_paste"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),holes:W(yo.shape.points).optional(),layer:gt,pcb_component_id:h().optional(),pcb_smtpad_id:h().optional()}),ug=Wt([u3,f3,y3,_3,g3,x3,b3]).describe("Defines solderpaste on the PCB");A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);A(!0);var bs=M({type:x("pcb_soldermask_opening"),pcb_soldermask_opening_id:T("pcb_soldermask_opening"),layer:gt.pipe(Ut),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional()}),fg=ie("shape",[gp.extend(bs.shape),ws.extend(bs.shape),xp.extend(bs.shape),yo.extend(bs.shape)]).describe("An explicit opening in top or bottom solder mask or flex coverlay, independent of pads. Removes mask without adding copper or solder paste.");A(!0);var yg=M({type:x("pcb_text"),pcb_text_id:T("pcb_text"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),text:h(),center:nt,layer:gt,width:K,height:K,lines:w(),align:ut(["bottom-left"])}).describe("Defines text on the PCB");A(!0);var i_=R.pipe(w().finite().positive()),_g=M({route_type:x("wire"),x:R,y:R,width:R,start_width:i_.optional(),end_width:i_.optional(),width_interpolation_mode:ut(["linear","quadratic"]).optional(),copper_pour_id:h().optional(),is_inside_copper_pour:E().optional(),start_pcb_port_id:h().optional(),end_pcb_port_id:h().optional(),layer:gt}).superRefine((t,e)=>{let r=[t.start_width,t.end_width,t.width_interpolation_mode].filter((n)=>n!==void 0).length;if(r===0)return;if(r!==3)e.addIssue({code:X.custom,message:"Wire taper requires start_width, end_width and width_interpolation_mode together"});if(t.width!==t.start_width)e.addIssue({code:X.custom,path:["start_width"],message:"start_width must equal width"});if(!Number.isFinite(t.x)||!Number.isFinite(t.y))e.addIssue({code:X.custom,message:"Tapered wire coordinates must be finite"})}),gg=M({route_type:x("via"),x:R,y:R,copper_pour_id:h().optional(),is_inside_copper_pour:E().optional(),hole_diameter:R.optional(),outer_diameter:R.optional(),tented_on_top:E().optional(),tented_on_bottom:E().optional(),from_layer:gt,to_layer:gt}),xg=M({route_type:x("through_pad"),start:nt,end:nt,width:R,start_layer:gt,end_layer:gt,pcb_smtpad_id:h().optional(),pcb_plated_hole_id:h().optional()}),bg=Wt([_g,gg,xg]),vg=M({type:x("pcb_trace"),source_trace_id:h().optional(),pcb_component_id:h().optional(),pcb_trace_id:T("pcb_trace"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),route_thickness_mode:ut(["constant","interpolated"]).default("constant").optional(),route_order_index:w().optional(),should_round_corners:E().optional(),trace_length:w().optional(),is_antenna_trace:E().optional(),highlight_color:h().optional(),route:W(bg).superRefine((t,e)=>{for(let[r,n]of t.entries()){if(n.route_type!=="wire"||n.width_interpolation_mode===void 0)continue;let i=t[r+1],s=i?.route_type==="through_pad"?i.start:i,o=i?.route_type==="wire"?i.layer:i?.route_type==="via"?i.from_layer:i?.start_layer,c=s?Math.hypot(s.x-n.x,s.y-n.y):NaN;if(!Number.isFinite(c)||c<=0||o!==n.layer)e.addIssue({code:X.custom,path:[r],message:"Tapered wire must lead to a distinct finite next point on the same layer"})}})}).describe("Defines a trace on the PCB");A(!0);A(!0);var Sg=M({type:x("pcb_trace_warning"),pcb_trace_warning_id:T("pcb_trace_warning"),warning_type:x("pcb_trace_warning").default("pcb_trace_warning"),message:h(),center:nt.optional(),pcb_trace_id:h(),source_trace_id:h(),pcb_component_ids:W(h()),pcb_port_ids:W(h()),subcircuit_id:h().optional()}).describe("Defines a trace warning on the PCB");A(!0);var wg=M({type:x("pcb_trace_style_warning"),pcb_trace_style_warning_id:T("pcb_trace_style_warning"),warning_type:x("pcb_trace_style_warning").default("pcb_trace_style_warning"),message:h(),styling_issue_type:x("long_segment_at_odd_angle"),pcb_trace_id:h(),source_trace_id:h().optional(),subcircuit_id:h().optional(),layer:gt,start_route_index:w().int().nonnegative(),end_route_index:w().int().nonnegative(),segment_start:nt,segment_end:nt,center:nt,segment_length:R,minimum_segment_length:R,angle_degrees:w().min(0).lt(360),nearest_allowed_angle_degrees:w().min(0).lt(360).multipleOf(45),angle_deviation_degrees:w().min(0).max(22.5),angle_tolerance_degrees:w().min(0).lt(22.5)}).describe("Warning for a long PCB trace segment whose direction deviates from a multiple of 45 degrees");A(!0);var Ag=M({type:x("pcb_trace_too_long_error"),pcb_trace_too_long_error_id:T("pcb_trace_too_long_error"),error_type:x("pcb_trace_too_long_error").default("pcb_trace_too_long_error"),message:h(),pcb_trace_id:h(),source_net_id:h().optional(),source_trace_id:h().optional(),actual_trace_length:R,maximum_trace_length:R,subcircuit_id:h().optional()}).describe("Error emitted when a PCB trace is longer than its maximum allowed length");A(!0);var Pg=Mt.extend({type:x("pcb_bus_length_skew_error"),pcb_bus_length_skew_error_id:T("pcb_bus_length_skew_error"),error_type:x("pcb_bus_length_skew_error").default("pcb_bus_length_skew_error"),source_bus_id:h(),source_trace_ids:W(h()),pcb_trace_ids:W(h()),actual_length_skew:w().nonnegative().finite(),maximum_length_skew:w().nonnegative().finite(),subcircuit_id:h().optional()});A(!0);var Bg=M({type:x("pcb_trace_too_long_warning"),pcb_trace_too_long_warning_id:T("pcb_trace_too_long_warning"),warning_type:x("pcb_trace_too_long_warning").default("pcb_trace_too_long_warning"),message:h(),pcb_trace_id:h(),source_net_id:h().optional(),source_trace_id:h().optional(),actual_trace_length:R,maximum_trace_length:R,subcircuit_id:h().optional()}).describe("Warning emitted when a PCB trace is longer than its maximum allowed length");A(!0);var Ig=M({type:x("pcb_trace_too_many_vias_warning"),pcb_trace_too_many_vias_warning_id:T("pcb_trace_too_many_vias_warning"),warning_type:x("pcb_trace_too_many_vias_warning").default("pcb_trace_too_many_vias_warning"),message:h(),pcb_trace_id:h(),source_net_id:h().optional(),source_trace_id:h().optional(),actual_via_count:w().int().nonnegative(),maximum_via_count:w().int().nonnegative(),subcircuit_id:h().optional()}).describe("Warning emitted when a PCB trace has more vias than its maximum allowed count");A(!0);var Cr=Mt.extend({type:x("pcb_bus_routing_constraint_error"),pcb_bus_routing_constraint_error_id:T("pcb_bus_routing_constraint_error"),error_type:x("pcb_bus_routing_constraint_error").default("pcb_bus_routing_constraint_error"),source_bus_id:h(),source_trace_ids:W(h()).min(1),pcb_trace_ids:W(h()),subcircuit_id:h().optional()}),Fg=ie("routing_rule",[Cr.extend({routing_rule:x("length_skew"),actual_length_skew:w().nonnegative().finite(),maximum_length_skew:w().nonnegative().finite()}),Cr.extend({routing_rule:x("min_length"),actual_trace_length:w().nonnegative().finite(),minimum_trace_length:w().finite()}),Cr.extend({routing_rule:x("max_length"),actual_trace_length:w().nonnegative().finite(),maximum_trace_length:w().finite()}),Cr.extend({routing_rule:x("target_length"),actual_trace_length:w().nonnegative().finite(),target_trace_length:w().finite(),length_tolerance:w().nonnegative().finite()}),Cr.extend({routing_rule:x("pcb_trace_spacing"),other_pcb_trace_id:h(),other_source_trace_id:h().optional(),actual_centerline_spacing:w().nonnegative().finite(),minimum_centerline_spacing:w().positive().finite()}),Cr.extend({routing_rule:x("pcb_spacing_to_other_signals"),other_pcb_trace_id:h(),other_source_trace_id:h().optional(),actual_centerline_spacing:w().nonnegative().finite(),minimum_centerline_spacing:w().positive().finite()}),Cr.extend({routing_rule:x("impedance_target"),target_impedance:w().positive().finite(),minimum_impedance:w().positive().finite().optional(),maximum_impedance:w().positive().finite().optional()})]).superRefine((t,e)=>{if(t.routing_rule!=="impedance_target")return;if(t.minimum_impedance===void 0&&t.maximum_impedance===void 0)e.addIssue({code:X.custom,path:["minimum_impedance"],message:"Provide an impedance bound"});if(t.minimum_impedance!==void 0&&t.maximum_impedance!==void 0&&t.minimum_impedance>t.maximum_impedance)e.addIssue({code:X.custom,path:["maximum_impedance"],message:"Impedance bounds must be ordered"})}).describe("A declared bus or differential-pair routing constraint is violated.");A(!0);var mo=M({type:x("pcb_bus_routing_constraint_warning"),pcb_bus_routing_constraint_warning_id:T("pcb_bus_routing_constraint_warning"),warning_type:x("pcb_bus_routing_constraint_warning").default("pcb_bus_routing_constraint_warning"),source_bus_id:h(),source_trace_ids:W(h()).min(1),pcb_trace_ids:W(h()),message:h(),subcircuit_id:h().optional()}).describe("A declared bus or pair constraint could not be verified; this is not a pass."),Mg=ie("routing_rule",[mo.extend({routing_rule:x("route_geometry")}),mo.extend({routing_rule:x("reference_geometry")}),mo.extend({routing_rule:x("spacing_geometry")}),mo.extend({routing_rule:x("target_length")}),mo.extend({routing_rule:x("physical_impedance")})]);A(!0);var Cg=Mt.extend({type:x("pcb_trace_error"),pcb_trace_error_id:T("pcb_trace_error"),error_type:x("pcb_trace_error").default("pcb_trace_error"),center:nt.optional(),pcb_trace_id:h(),source_trace_id:h(),pcb_component_ids:W(h()),pcb_port_ids:W(h()),subcircuit_id:h().optional()}).describe("Defines a trace error on the PCB");A(!0);var kg=Mt.extend({type:x("pcb_trace_missing_error"),pcb_trace_missing_error_id:T("pcb_trace_missing_error"),error_type:x("pcb_trace_missing_error").default("pcb_trace_missing_error"),center:nt.optional(),source_trace_id:h(),pcb_component_ids:W(h()),pcb_port_ids:W(h()),subcircuit_id:h().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace");A(!0);var Ng=Mt.extend({type:x("pcb_port_not_matched_error"),pcb_error_id:T("pcb_error"),error_type:x("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),pcb_component_ids:W(h()),subcircuit_id:h().optional()}).describe("Defines a trace error on the PCB where a port is not matched");A(!0);var Yg=Mt.extend({type:x("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:T("pcb_port_not_connected_error"),error_type:x("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),pcb_port_ids:W(h()),pcb_component_ids:W(h()),subcircuit_id:h().optional()}).describe("Defines an error when a pcb port is not connected to any trace");A(!0);var Lg=M({type:x("pcb_net"),pcb_net_id:T("pcb_net"),source_net_id:h().optional(),highlight_color:h().optional()}).describe("Defines a net on the PCB");A(!0);var Tg=M({type:x("pcb_via"),pcb_via_id:T("pcb_via"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),x:R,y:R,outer_diameter:R.default("0.6mm"),hole_diameter:R.default("0.25mm"),topmost_drill_layer:gt.optional(),bottommost_drill_layer:gt.optional(),through_hole:E().optional(),from_layer:gt.optional(),to_layer:gt.optional(),layers:W(gt),pcb_port_ids:W(h()).optional(),pcb_trace_id:h().optional(),source_trace_id:h().optional(),source_net_id:h().min(1).optional(),net_is_assignable:E().optional(),net_assigned:E().optional(),is_tented:E().optional(),tented_on_top:E().optional(),tented_on_bottom:E().optional()}).transform(({is_tented:t,...e})=>{if(t!==void 0)e.tented_on_top??=t,e.tented_on_bottom??=t;return e}).describe("Defines a via on the PCB");A(!0);var Eg=M({type:x("pcb_board"),pcb_board_id:T("pcb_board"),pcb_panel_id:h().optional(),carrier_pcb_board_id:h().optional(),is_subcircuit:E().optional(),subcircuit_id:h().optional(),is_mounted_to_carrier_board:E().optional(),is_via_in_pad_allowed:E().optional(),default_via_tented_on_top:E().optional(),default_via_tented_on_bottom:E().optional(),default_via_plugged:E().optional(),width:K.optional(),height:K.optional(),center:nt,display_offset_x:h().optional().describe("How to display the x offset for this board, usually corresponding with how the user specified it"),display_offset_y:h().optional().describe("How to display the y offset for this board, usually corresponding with how the user specified it"),thickness:K.optional().default(1.4),num_layers:w().optional().default(4),allow_blind_and_buried_vias:E().optional().describe("Whether autorouters may generate blind and buried vias. False restricts newly generated vias to the full board stack."),outline:W(nt).optional(),shape:ut(["rect","polygon"]).optional(),material:ut(["fr4","fr1","flex"]).default("fr4"),solder_mask_color:h().optional(),silkscreen_color:h().optional(),anchor_position:nt.optional(),anchor_alignment:Ve.optional(),position_mode:ut(["relative_to_panel_anchor","none"]).optional()}).merge(q0).describe("Defines the board outline of the PCB");A(!0);var o_=nt.extend({x:K.pipe(w().finite()),y:K.pipe(w().finite())}),Rg=M({type:x("pcb_bend"),pcb_bend_id:T("pcb_bend"),pcb_board_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),start:o_,end:o_,bend_angle:Et.pipe(w().finite()),bend_radius:K.pipe(w().finite().positive()),bend_side:ut(["left","right"])}).refine(({start:t,end:e})=>t.x!==e.x||t.y!==e.y,{message:"Bend centerline endpoints must be distinct",path:["end"]}).describe("Defines a finite-radius bend on a flat PCB for runtime CAD folding");A(!0);var up=K.pipe(w().finite().positive()),Og=nt.extend({x:K.pipe(w().finite()),y:K.pipe(w().finite())}),Wg=M({type:x("pcb_stiffener"),pcb_stiffener_id:T("pcb_stiffener"),pcb_board_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),layer:ut(["top","bottom"]),material:ut(["fr4","polyimide","stainless_steel","aluminum"]),thickness:up,adhesive_thickness:K.pipe(w().finite().nonnegative()).optional()}),$g=Wg.extend({shape:x("rect"),center:Og,rotation:Et.pipe(w().finite()).optional(),width:up,height:up,outline:ho().optional()});A(!0);var jg=Wg.extend({shape:x("polygon"),outline:W(Og).min(3).refine((t)=>{let e=t.reduce((r,n,i)=>{let s=t[(i+1)%t.length];return r+n.x*s.y-s.x*n.y},0);return Number.isFinite(e)&&e!==0},"Stiffener outline must enclose a nonzero area"),center:ho().optional(),rotation:ho().optional(),width:ho().optional(),height:ho().optional()});A(!0);var Xg=ie("shape",[$g,jg]).describe("Defines bonded mechanical PCB reinforcement without adding copper layers");A(!0);var Dg=M({type:x("pcb_panel"),pcb_panel_id:T("pcb_panel"),width:K,height:K,center:nt,thickness:K.optional().default(1.4),covered_with_solder_mask:E().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards");A(!0);var Vg=Mt.extend({type:x("pcb_placement_error"),pcb_placement_error_id:T("pcb_placement_error"),error_type:x("pcb_placement_error").default("pcb_placement_error"),subcircuit_id:h().optional()}).describe("Defines a placement error on the PCB");A(!0);var zg=Mt.extend({type:x("pcb_packing_error"),pcb_packing_error_id:T("pcb_packing_error"),error_type:x("pcb_packing_error").default("pcb_packing_error"),pcb_group_id:h().optional(),subcircuit_id:h().optional()}).describe("Defines a failure to pack PCB components within layout bounds");A(!0);var Ug=Mt.extend({type:x("pcb_panelization_placement_error"),pcb_panelization_placement_error_id:T("pcb_panelization_placement_error"),error_type:x("pcb_panelization_placement_error").default("pcb_panelization_placement_error"),pcb_panel_id:h().optional(),pcb_board_id:h().optional(),subcircuit_id:h().optional()}).describe("Defines a panelization placement error on the PCB");A(!0);var Gg=M({type:x("pcb_trace_hint"),pcb_trace_hint_id:T("pcb_trace_hint"),pcb_port_id:h(),pcb_component_id:h(),route:W(Z0),subcircuit_id:h().optional()}).describe("A hint that can be used during generation of a PCB trace");A(!0);var Hg=M({type:x("pcb_silkscreen_line"),pcb_silkscreen_line_id:T("pcb_silkscreen_line"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),stroke_width:R.default("0.1mm"),x1:R,y1:R,x2:R,y2:R,layer:Ut}).describe("Defines a silkscreen line on the PCB");A(!0);var Qg=M({type:x("pcb_silkscreen_path"),pcb_silkscreen_path_id:T("pcb_silkscreen_path"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,route:W(nt),stroke_width:K}).describe("Defines a silkscreen path on the PCB");A(!0);var Zg=M({type:x("pcb_silkscreen_text"),pcb_silkscreen_text_id:T("pcb_silkscreen_text"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),font:x("tscircuit2024").default("tscircuit2024"),font_size:R.default("0.2mm"),pcb_component_id:h(),text:h(),is_knockout:E().default(!1).optional(),knockout_padding:M({left:K,top:K,bottom:K,right:K}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:w().optional(),layer:gt,is_mirrored:E().default(!1).optional(),anchor_position:nt.default({x:0,y:0}),anchor_alignment:Ve.default("center")}).describe("Defines silkscreen text on the PCB");A(!0);var qg=M({type:x("pcb_copper_text"),pcb_copper_text_id:T("pcb_copper_text"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),font:x("tscircuit2024").default("tscircuit2024"),font_size:R.default("0.2mm"),pcb_component_id:h(),text:h(),is_knockout:E().default(!1).optional(),knockout_padding:M({left:K,top:K,bottom:K,right:K}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:w().optional(),layer:gt,is_mirrored:E().default(!1).optional(),anchor_position:nt.default({x:0,y:0}),anchor_alignment:Ve.default("center")}).describe("Defines copper text on the PCB");A(!0);var Jg=M({type:x("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:T("pcb_silkscreen_rect"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:gt,stroke_width:K.default("1mm"),corner_radius:K.optional(),is_filled:E().default(!0).optional(),has_stroke:E().optional(),is_stroke_dashed:E().optional(),ccw_rotation:w().optional()}).describe("Defines a silkscreen rect on the PCB");A(!0);var Kg=M({type:x("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:T("pcb_silkscreen_circle"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius:K,layer:Ut,stroke_width:K.default("1mm"),is_filled:E().optional()}).describe("Defines a silkscreen circle on the PCB");A(!0);var tx=M({type:x("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:T("pcb_silkscreen_oval"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius_x:R,radius_y:R,layer:Ut,ccw_rotation:Et.optional()}).describe("Defines a silkscreen oval on the PCB");A(!0);var v3=M({type:x("pcb_silkscreen_graphic"),pcb_silkscreen_graphic_id:T("pcb_silkscreen_graphic"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,image_asset:_o.optional()}),ex=v3.extend({shape:x("brep"),brep_shape:Hp}).describe("Defines a BRep silkscreen graphic on the PCB");A(!0);var rx=ie("shape",[ex]).describe("Defines a silkscreen graphic on the PCB");A(!0);var nx=M({type:x("pcb_silkscreen_pill"),pcb_silkscreen_pill_id:T("pcb_silkscreen_pill"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:gt,ccw_rotation:w().optional()}).describe("Defines a silkscreen pill on the PCB");A(!0);var ix=M({type:x("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:T("pcb_fabrication_note_text"),subcircuit_id:h().optional(),pcb_group_id:h().optional(),font:x("tscircuit2024").default("tscircuit2024"),font_size:R.default("1mm"),pcb_component_id:h(),text:h(),ccw_rotation:w().optional(),layer:Ut,anchor_position:nt.default({x:0,y:0}),anchor_alignment:ut(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:h().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators");A(!0);var ox=M({type:x("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:T("pcb_fabrication_note_path"),pcb_component_id:h(),subcircuit_id:h().optional(),layer:gt,route:W(nt),stroke_width:K,color:h().optional(),is_filled:E().optional(),has_stroke:E().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers");A(!0);var sx=M({type:x("pcb_fabrication_note_rect"),pcb_fabrication_note_rect_id:T("pcb_fabrication_note_rect"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:Ut,stroke_width:K.default("0.1mm"),corner_radius:K.optional(),is_filled:E().optional(),has_stroke:E().optional(),is_stroke_dashed:E().optional(),color:h().optional()}).describe("Defines a fabrication note rectangle on the PCB");A(!0);var ax=M({type:x("pcb_fabrication_note_dimension"),pcb_fabrication_note_dimension_id:T("pcb_fabrication_note_dimension"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,from:nt,to:nt,text:h().optional(),text_ccw_rotation:w().optional(),offset:K.optional(),offset_distance:K.optional(),offset_direction:M({x:w(),y:w()}).optional(),font:x("tscircuit2024").default("tscircuit2024"),font_size:K.default("1mm"),color:h().optional(),arrow_size:K.default("1mm")}).describe("Defines a measurement annotation within PCB fabrication notes");A(!0);var cx=M({type:x("pcb_note_text"),pcb_note_text_id:T("pcb_note_text"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),font:x("tscircuit2024").default("tscircuit2024"),font_size:R.default("1mm"),text:h().optional(),anchor_position:nt.default({x:0,y:0}),anchor_alignment:ut(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),layer:Ut.default("top"),is_mirrored_from_top_view:E().optional(),color:h().optional()}).describe("Defines a documentation note in text on the PCB");A(!0);var lx=M({type:x("pcb_note_rect"),pcb_note_rect_id:T("pcb_note_rect"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),text:h().optional(),center:nt,width:K,height:K,layer:Ut.default("top"),stroke_width:K.default("0.1mm"),corner_radius:K.optional(),is_filled:E().optional(),has_stroke:E().optional(),is_stroke_dashed:E().optional(),color:h().optional()}).describe("Defines a rectangular documentation note on the PCB");A(!0);var px=M({type:x("pcb_note_path"),pcb_note_path_id:T("pcb_note_path"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),text:h().optional(),route:W(nt),layer:Ut.default("top"),stroke_width:K.default("0.1mm"),color:h().optional()}).describe("Defines a polyline documentation note on the PCB");A(!0);var hx=M({type:x("pcb_note_line"),pcb_note_line_id:T("pcb_note_line"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),text:h().optional(),x1:R,y1:R,x2:R,y2:R,layer:Ut.default("top"),stroke_width:R.default("0.1mm"),color:h().optional(),is_dashed:E().optional()}).describe("Defines a straight documentation note line on the PCB");A(!0);var dx=M({type:x("pcb_note_dimension"),pcb_note_dimension_id:T("pcb_note_dimension"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),name:h().optional(),from:nt,to:nt,text:h().optional(),text_ccw_rotation:w().optional(),offset_distance:K.optional(),offset_direction:M({x:w(),y:w()}).optional(),font:x("tscircuit2024").default("tscircuit2024"),font_size:K.default("1mm"),layer:Ut.default("top"),color:h().optional(),arrow_size:K.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes");A(!0);var mx=Mt.extend({type:x("pcb_footprint_overlap_error"),pcb_error_id:T("pcb_error"),error_type:x("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),pcb_smtpad_ids:W(h()).optional(),pcb_plated_hole_ids:W(h()).optional(),pcb_hole_ids:W(h()).optional(),pcb_keepout_ids:W(h()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element");A(!0);var ux=Mt.extend({type:x("pcb_courtyard_overlap_error"),pcb_error_id:T("pcb_error"),error_type:x("pcb_courtyard_overlap_error").default("pcb_courtyard_overlap_error"),pcb_component_ids:t_([h(),h()])}).describe("Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another");A(!0);var fx=M({type:x("pcb_keepout"),shape:x("outline"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),outline:W(nt).min(2),stroke_width:K,pcb_keepout_id:h(),layers:W(h()),description:h().optional(),excluded_pcb_component_ids:W(h()).optional(),warning_only:E().optional(),allow_traces:E().optional(),allow_placements:E().optional()}),yx=M({type:x("pcb_keepout"),shape:x("rect"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:R,height:R,pcb_keepout_id:h(),layers:W(h()),description:h().optional(),excluded_pcb_component_ids:W(h()).optional(),warning_only:E().optional(),allow_traces:E().optional(),allow_placements:E().optional()}).or(M({type:x("pcb_keepout"),shape:x("circle"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius:R,pcb_keepout_id:h(),layers:W(h()),description:h().optional(),excluded_pcb_component_ids:W(h()).optional(),warning_only:E().optional(),allow_traces:E().optional(),allow_placements:E().optional()})).or(fx);A(!0);A(!0);var _x=M({type:x("pcb_keepout_overlap_warning"),pcb_keepout_overlap_warning_id:T("pcb_keepout_overlap_warning"),warning_type:x("pcb_keepout_overlap_warning").default("pcb_keepout_overlap_warning"),message:h(),pcb_keepout_id:h(),pcb_component_ids:W(h()).optional(),pcb_trace_ids:W(h()).optional(),pcb_smtpad_ids:W(h()).optional(),pcb_plated_hole_ids:W(h()).optional(),pcb_via_ids:W(h()).optional(),center:nt.optional(),subcircuit_id:h().optional()}).describe("Warning emitted when copper overlaps a PCB keepout with warning_only enabled");A(!0);var Fs=M({type:x("pcb_cutout"),pcb_cutout_id:T("pcb_cutout"),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),pcb_board_id:h().optional(),pcb_panel_id:h().optional()}),gx=Fs.extend({shape:x("rect"),center:nt,width:K,height:K,rotation:Et.optional(),corner_radius:K.optional()});A(!0);var xx=Fs.extend({shape:x("circle"),center:nt,radius:K});A(!0);var bx=Fs.extend({shape:x("polygon"),points:W(nt)});A(!0);var vx=Fs.extend({shape:x("path"),route:W(nt),slot_width:K,slot_length:K.optional(),space_between_slots:K.optional(),slot_corner_radius:K.optional()});A(!0);var Sx=ie("shape",[gx,xx,bx,vx]).describe("Defines a cutout on the PCB, removing board material.");A(!0);var wx=Mt.extend({type:x("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:T("pcb_missing_footprint_error"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),error_type:x("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:h()}).describe("Defines a missing footprint error on the PCB");A(!0);var Ax=Mt.extend({type:x("external_footprint_load_error"),external_footprint_load_error_id:T("external_footprint_load_error"),pcb_component_id:h(),source_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),footprinter_string:h().optional(),error_type:x("external_footprint_load_error").default("external_footprint_load_error")}).describe("Defines an error when an external footprint fails to load");A(!0);var Px=Mt.extend({type:x("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:T("circuit_json_footprint_load_error"),pcb_component_id:h(),source_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),error_type:x("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),circuit_json:W(Jy()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load");A(!0);var Bx=M({type:x("pcb_group"),pcb_group_id:T("pcb_group"),source_group_id:h(),is_subcircuit:E().optional(),subcircuit_id:h().optional(),width:K.optional(),height:K.optional(),center:nt,display_offset_x:h().optional().describe("How to display the x offset for this group, usually corresponding with how the user specified it"),display_offset_y:h().optional().describe("How to display the y offset for this group, usually corresponding with how the user specified it"),outline:W(nt).optional(),anchor_position:nt.optional(),anchor_alignment:Ve.default("center"),position_mode:ut(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:h().optional(),positioned_relative_to_pcb_board_id:h().optional(),pcb_component_ids:W(h()),child_layout_mode:ut(["packed","none"]).optional(),name:h().optional(),description:h().optional(),layout_mode:h().optional(),autorouter_configuration:M({trace_clearance:K}).optional(),autorouter_used_string:h().optional()}).describe("Defines a group of components on the PCB");A(!0);var Ix=Mt.extend({type:x("pcb_autorouting_error"),pcb_error_id:T("pcb_autorouting_error"),error_type:x("pcb_autorouting_error").default("pcb_autorouting_error"),subcircuit_id:h().optional()}).describe("The autorouting has failed to route a portion of the board");A(!0);var Fx=Mt.extend({type:x("pcb_preflight_routing_error"),pcb_preflight_routing_error_id:T("pcb_preflight_routing_error"),error_type:x("pcb_preflight_routing_error").default("pcb_preflight_routing_error"),error_code:h(),subcircuit_id:h().optional(),pcb_group_id:h().optional(),routing_phase_index:w().int().optional(),phase_name:h().optional(),source_trace_ids:W(h()).optional(),pcb_component_ids:W(h()).optional(),pcb_port_ids:W(h()).optional(),related_error_ids:W(h()).optional(),measurements:Qn(w().finite()).optional()});A(!0);var Mx=M({type:x("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:T("pcb_manual_edit_conflict_warning"),warning_type:x("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:h(),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),source_component_id:h()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates");A(!0);var s_=ut(["x-","x+","y+","y-"]),Cx=M({type:x("pcb_connector_not_in_accessible_orientation_warning"),pcb_connector_not_in_accessible_orientation_warning_id:T("pcb_connector_not_in_accessible_orientation_warning"),warning_type:x("pcb_connector_not_in_accessible_orientation_warning").default("pcb_connector_not_in_accessible_orientation_warning"),message:h(),pcb_component_id:h(),source_component_id:h().optional(),pcb_board_id:h().optional(),facing_direction:s_,recommended_facing_direction:s_,subcircuit_id:h().optional()}).describe("Warning emitted when a connector PCB component is facing inward toward the board and should be reoriented to an outward-facing direction");A(!0);var kx=M({type:x("pcb_component_missing_courtyard_warning"),pcb_component_missing_courtyard_warning_id:T("pcb_component_missing_courtyard_warning"),warning_type:x("pcb_component_missing_courtyard_warning").default("pcb_component_missing_courtyard_warning"),message:h(),pcb_component_id:h(),source_component_id:h().optional(),subcircuit_id:h().optional()}).describe("Warning emitted when a PCB component has no courtyard geometry");A(!0);var Nx=M({type:x("supplier_footprint_mismatch_warning"),supplier_footprint_mismatch_warning_id:T("supplier_footprint_mismatch_warning"),warning_type:x("supplier_footprint_mismatch_warning").default("supplier_footprint_mismatch_warning"),message:h(),source_component_id:h(),pcb_component_id:h().optional(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),supplier_name:Kn.optional(),supplier_part_number:h().optional(),supplier_footprint_url:h().optional(),footprint_copper_intersection_over_union:w()}).describe("Warning emitted when a supplier part footprint does not match the expected footprint");A(!0);var Yx=M({type:x("pcb_fabricator_extra_charge_warning"),pcb_fabricator_extra_charge_warning_id:T("pcb_fabricator_extra_charge_warning"),warning_type:x("pcb_fabricator_extra_charge_warning").default("pcb_fabricator_extra_charge_warning"),message:h(),fabricator_preset:h(),pcb_board_id:h().optional(),pcb_via_ids:W(h()).optional(),subcircuit_id:h().optional()}).describe("Warning that a design feature incurs an extra charge for the selected fabricator preset, such as via hole diameters below 0.3 mm with JLCPCB economy or standard presets.");A(!0);var Lx=M({type:x("pcb_breakout_point"),pcb_breakout_point_id:T("pcb_breakout_point"),pcb_group_id:h(),subcircuit_id:h().optional(),source_trace_id:h().optional(),source_port_id:h().optional(),source_net_id:h().optional(),layer:gt.optional(),x:R,y:R}).describe("Defines a routing target within a pcb_group for a source_trace or source_net");A(!0);var Tx=M({type:x("pcb_ground_plane"),pcb_ground_plane_id:T("pcb_ground_plane"),source_pcb_ground_plane_id:h(),source_net_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional()}).describe("Defines a ground plane on the PCB");A(!0);var Ex=M({type:x("pcb_ground_plane_region"),pcb_ground_plane_region_id:T("pcb_ground_plane_region"),pcb_ground_plane_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:gt,points:W(nt)}).describe("Defines a polygon region of a ground plane");A(!0);var Rx=M({type:x("pcb_thermal_spoke"),pcb_thermal_spoke_id:T("pcb_thermal_spoke"),pcb_ground_plane_id:h(),shape:h(),spoke_count:w(),spoke_thickness:R,spoke_inner_diameter:R,spoke_outer_diameter:R,pcb_plated_hole_id:h().optional(),subcircuit_id:h().optional()}).describe("Pattern for connecting a ground plane to a plated hole");A(!0);var Qp=M({type:x("pcb_copper_pour"),pcb_copper_pour_id:T("pcb_copper_pour"),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:gt,source_net_id:h().optional(),covered_with_solder_mask:E().optional().default(!0)}),Ox=Qp.extend({shape:x("rect"),center:nt,width:K,height:K,rotation:Et.optional()});A(!0);var Wx=Qp.extend({shape:x("brep"),brep_shape:Hp});A(!0);var $x=Qp.extend({shape:x("polygon"),points:W(nt)});A(!0);var jx=ie("shape",[Ox,Wx,$x]).describe("Defines a copper pour on the PCB.");A(!0);var Xx=Mt.extend({type:x("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:T("pcb_component_outside_board_error"),error_type:x("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),pcb_component_id:h(),pcb_board_id:h(),component_center:nt,component_bounds:M({min_x:w(),max_x:w(),min_y:w(),max_y:w()}),subcircuit_id:h().optional(),source_component_id:h().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries");A(!0);var Dx=Mt.extend({type:x("pcb_component_not_on_board_edge_error"),pcb_component_not_on_board_edge_error_id:T("pcb_component_not_on_board_edge_error"),error_type:x("pcb_component_not_on_board_edge_error").default("pcb_component_not_on_board_edge_error"),pcb_component_id:h(),pcb_board_id:h(),component_center:nt,pad_to_nearest_board_edge_distance:w(),source_component_id:h().optional(),subcircuit_id:h().optional()}).describe("Error emitted when a component that must be placed on the board edge is centered away from the edge");A(!0);var Vx=Mt.extend({type:x("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:T("pcb_component_invalid_layer_error"),error_type:x("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),pcb_component_id:h().optional(),source_component_id:h(),layer:gt,subcircuit_id:h().optional()}).describe("Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)");A(!0);var zx=Mt.extend({type:x("pcb_via_clearance_error"),pcb_error_id:T("pcb_error"),error_type:x("pcb_via_clearance_error").default("pcb_via_clearance_error"),pcb_via_ids:W(h()).min(2),minimum_clearance:R.optional(),actual_clearance:R.optional(),pcb_center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe("Error emitted when vias are closer than the allowed clearance");A(!0);var Ux=Mt.extend({type:x("pcb_via_trace_clearance_error"),pcb_via_trace_clearance_error_id:T("pcb_via_trace_clearance_error"),error_type:x("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),pcb_via_id:h(),pcb_trace_id:h(),minimum_clearance:R.optional(),actual_clearance:R.optional(),center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe("Error emitted when a via and trace are closer than the allowed clearance");A(!0);var Gx=Mt.extend({type:x("pcb_pad_pad_clearance_error"),pcb_pad_pad_clearance_error_id:T("pcb_pad_pad_clearance_error"),error_type:x("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),pcb_pad_ids:W(h()).min(2),minimum_clearance:R.optional(),actual_clearance:R.optional(),center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe("Error emitted when pads are closer than the allowed clearance");A(!0);var Hx=Mt.extend({type:x("pcb_pad_trace_clearance_error"),pcb_pad_trace_clearance_error_id:T("pcb_pad_trace_clearance_error"),error_type:x("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),pcb_pad_id:h(),pcb_trace_id:h(),minimum_clearance:R.optional(),actual_clearance:R.optional(),center:M({x:w().optional(),y:w().optional()}).optional(),subcircuit_id:h().optional()}).describe("Error emitted when a pad and trace are closer than allowed clearance");A(!0);var Qx=M({type:x("pcb_courtyard_rect"),pcb_courtyard_rect_id:T("pcb_courtyard_rect"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,layer:Ut,ccw_rotation:Et.optional(),color:h().optional()}).describe("Defines a courtyard rectangle on the PCB");A(!0);var Zx=M({type:x("pcb_courtyard_outline"),pcb_courtyard_outline_id:T("pcb_courtyard_outline"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,outline:W(nt).min(2)}).describe("Defines a courtyard outline on the PCB");A(!0);var qx=M({type:x("pcb_courtyard_polygon"),pcb_courtyard_polygon_id:T("pcb_courtyard_polygon"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),layer:Ut,points:W(nt).min(3),color:h().optional()}).describe("Defines a courtyard polygon on the PCB");A(!0);var Jx=M({type:x("pcb_courtyard_circle"),pcb_courtyard_circle_id:T("pcb_courtyard_circle"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,radius:K,layer:Ut,color:h().optional()}).describe("Defines a courtyard circle on the PCB");A(!0);var Kx=M({type:x("pcb_courtyard_pill"),pcb_courtyard_pill_id:T("pcb_courtyard_pill"),pcb_component_id:h(),pcb_group_id:h().optional(),subcircuit_id:h().optional(),center:nt,width:K,height:K,radius:K,layer:Ut,color:h().optional()}).describe("Defines a courtyard pill on the PCB");A(!0);var S3=["obj","stl","3mf","gltf","glb","step","wrl"],tb=["x+","x-","y+","y-","z+","z-"],w3={obj:"z+",stl:"z+","3mf":"z+",gltf:"y+",glb:"y+",step:"z+",wrl:"y+"},eb=M({type:x("cad_component"),cad_component_id:h(),pcb_component_id:h().optional().describe("Optional PCB component reference; omit for CAD geometry without a PCB component"),source_component_id:h(),position:ge,rotation:ge.optional(),is_on_folded_board:E().optional().describe("True when position and rotation describe the assembled folded board pose. False or omitted means the flat board pose. PCB records remain flat; pcb_component_id identifies the flat mount and owning board for reversible transforms."),size:ge.optional(),layer:gt.optional(),subcircuit_id:h().optional(),footprinter_string:h().optional(),model_obj_url:h().optional(),model_stl_url:h().optional(),model_3mf_url:h().optional(),model_gltf_url:h().optional(),model_glb_url:h().optional(),model_step_url:h().optional(),model_wrl_url:h().optional(),model_asset:_o.optional(),model_unit_to_mm_scale_factor:w().optional(),model_board_normal_direction:ut(tb).optional().describe(`The direction in the model's coordinate space that is considered "up" or "coming out of the board surface"`),model_origin_position:ge.optional(),model_origin_alignment:ut(["unknown","center","center_of_component_on_board_surface","bottom_center_of_component"]).optional(),model_object_fit:ut(["contain_within_bounds","fill_bounds"]).optional().default("contain_within_bounds"),model_jscad:Jy().optional(),color:h().trim().min(1).optional().describe("Explicit color override for CAD geometry, including authored JSCAD material colors. Omit to preserve model materials."),show_as_translucent_model:E().optional(),show_as_bounding_box:E().optional(),show_hidden_edges:E().optional(),anchor_alignment:ut(["center","center_of_component_on_board_surface"]).optional().default("center")}).describe("Defines CAD geometry, optionally associated with a PCB component");A(!0);var rb=Mt.extend({type:x("cad_collision_error"),cad_collision_error_id:T("cad_collision_error"),error_type:x("cad_collision_error").default("cad_collision_error"),cad_component_ids:W(h()).min(1),pcb_component_ids:W(h()).optional(),source_component_ids:W(h()).min(1),intersection_area_mm2:w().finite().nonnegative(),threshold_area_mm2:w().finite().nonnegative()}).describe("An aperture-bearing part intersects the finished enclosure. The intersection_area_mm2 is the union silhouette area of the solid intersection projected along the aperture face normal, in the right-handed Circuit JSON world frame (+X right, +Y top, +Z above). It is an area in square millimetres, not intersection volume or surface area. This indicates possible aperture misplacement, insufficient size/depth, or body clearance problems; it does not prove which cause applies.");A(!0);var a_=ge.refine((t)=>[t.x,t.y,t.z].every(Number.isFinite),"Connector pin 1 positions must be finite").describe("Resolved pin 1 position at the connector mating face, in right-handed circuit world, millimeters: +X right, +Y top, +Z above. An absolute point, not a direction. Computed by the circuit producer from endpoint geometry. Together with the endpoint path tangent, fixes connector roll and identifies its pin 1 side; renderers must not infer it from footprints."),nb=M({type:x("cad_cable"),cad_cable_id:h(),name:h().min(1),from_source_component_id:h(),to_source_component_id:h(),from_connector_pin1_position:a_.optional(),to_connector_pin1_position:a_.optional(),cableprinter_string:h().min(1).describe('Physical cable definition, e.g. "usb_c" or "jst_ph_pins6". Independent of the route.'),path:W(ge).min(2).refine((t)=>t.every((e,r)=>[e.x,e.y,e.z].every(Number.isFinite)&&(r===0||Math.hypot(e.x-t[r-1].x,e.y-t[r-1].y,e.z-t[r-1].z)>0.00000001)),"Cable paths require finite, distinct consecutive points").describe("Resolved cable centerline points in right-handed circuit world, millimeters: +X right, +Y top, +Z above. First/last samples are connector wire exits; their tangents point into/out of the cable. Includes routing/slack; renderers must not recompute the path.")}).describe("A physical assembly cable with a resolved 3D route. Several cables are independent cad_cable records, each with its own endpoints, definition and path. Does not imply electrical pin mapping.");A(!0);var ib=0.000001,c_=M({x:w().finite(),y:w().finite(),z:w().finite()}).refine((t)=>Math.abs(Math.hypot(t.x,t.y,t.z)-1)<=ib,"Reference surface directions must be unit vectors"),l_=R.pipe(w().finite().positive()),ob=M({type:x("cad_reference_surface"),cad_reference_surface_id:h().min(1),source_component_id:h().min(1).describe("Owning assembly part's source component ID. The part may have no CAD geometry."),name:h().trim().min(1).describe("Reference name, unique within the owning part, e.g. shade in STEM.shade."),shape:x("rect"),center:ge.refine((t)=>[t.x,t.y,t.z].every(Number.isFinite),"Reference surface centers must be finite").describe("Resolved surface center in right-handed circuit-world XYZ, millimeters: +X right, +Y top, +Z above. An absolute point after assembly placement."),normal:c_.describe("Outward unit normal in circuit-world XYZ. Dimensionless direction; transform with the part's rotation, without translation."),x_axis:c_.describe("In-plane unit X direction in circuit-world XYZ, perpendicular to normal. The second tangent is normal cross x_axis, giving a right-handed frame."),width:l_.optional().describe("Rectangular extent along x_axis in millimeters. Supply together with height. Omission leaves the surface's display size unspecified."),height:l_.optional().describe("Rectangular extent along normal cross x_axis in millimeters. Supply together with width."),subcircuit_id:h().optional()}).superRefine((t,e)=>{if(t.width===void 0!==(t.height===void 0))e.addIssue({code:X.custom,path:["width"],message:"Provide width and height together"});let{normal:r,x_axis:n}=t;if(Math.abs(r.x*n.x+r.y*n.y+r.z*n.z)>ib)e.addIssue({code:X.custom,path:["x_axis"],message:"x_axis must be perpendicular to normal"})}).describe("A named assembly mounting surface with a resolved world-space frame. Reference geometry for optional visualization; does not add solid material or electrical connectivity. The producer resolves part placement independently of CAD-model offsets; renderers consume the world frame without reapplying the owning model's transform.");A(!0);var Zp=ut(["sinewave","square","triangle","sawtooth"]),A3=Wt([h(),w()]).transform((t)=>{if(typeof t==="string"){if(t.endsWith("%"))return parseFloat(t.slice(0,-1))/100;return parseFloat(t)}return t}).pipe(w().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),sb=M({type:x("simulation_voltage_source"),simulation_voltage_source_id:T("simulation_voltage_source"),is_dc_source:x(!0).optional().default(!0),positive_source_port_id:h().optional(),negative_source_port_id:h().optional(),positive_source_net_id:h().optional(),negative_source_net_id:h().optional(),voltage:xe,ac_magnitude:xe.optional(),ac_phase:Et.optional()}).describe("Defines a DC voltage source for simulation"),ab=M({type:x("simulation_voltage_source"),simulation_voltage_source_id:T("simulation_voltage_source"),is_dc_source:x(!1),terminal1_source_port_id:h().optional(),terminal2_source_port_id:h().optional(),terminal1_source_net_id:h().optional(),terminal2_source_net_id:h().optional(),voltage:xe.optional(),frequency:kr.optional(),peak_to_peak_voltage:xe.optional(),wave_shape:Zp.optional(),phase:Et.optional(),duty_cycle:A3.optional(),pulse_delay:Qt.optional(),rise_time:Qt.optional(),fall_time:Qt.optional(),pulse_width:Qt.optional(),period:Qt.optional(),ac_magnitude:xe.optional(),ac_phase:Et.optional()}).describe("Defines an AC voltage source for simulation"),cb=Wt([sb,ab]).describe("Defines a voltage source for simulation");A(!0);A(!0);A(!0);var P3=Wt([h(),w()]).transform((t)=>{if(typeof t==="string"){if(t.endsWith("%"))return parseFloat(t.slice(0,-1))/100;return parseFloat(t)}return t}).pipe(w().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),lb=M({type:x("simulation_current_source"),simulation_current_source_id:T("simulation_current_source"),is_dc_source:x(!0).optional().default(!0),positive_source_port_id:h().optional(),negative_source_port_id:h().optional(),positive_source_net_id:h().optional(),negative_source_net_id:h().optional(),current:hr,ac_magnitude:hr.optional(),ac_phase:Et.optional()}).describe("Defines a DC current source for simulation"),pb=M({type:x("simulation_current_source"),simulation_current_source_id:T("simulation_current_source"),is_dc_source:x(!1),terminal1_source_port_id:h().optional(),terminal2_source_port_id:h().optional(),terminal1_source_net_id:h().optional(),terminal2_source_net_id:h().optional(),current:hr.optional(),frequency:kr.optional(),peak_to_peak_current:hr.optional(),wave_shape:Zp.optional(),phase:Et.optional(),duty_cycle:P3.optional(),ac_magnitude:hr.optional(),ac_phase:Et.optional()}).describe("Defines an AC current source for simulation"),hb=Wt([lb,pb]).describe("Defines a current source for simulation");A(!0);A(!0);A(!0);var Ms=qy((t)=>t==="V"||t==="A"),qp=qy((t)=>t==="Ω"||t==="F"||t==="H"||t==="V"||t==="A"),db=Wt([x("spice_dc_sweep"),x("spice_dc_operating_point"),x("spice_transient_analysis"),x("spice_ac_analysis"),x("pcb_return_current")]),mb=M({method:ut(["trap","gear"]).optional(),reltol:Wt([w(),h()]).optional(),abstol:Wt([w(),h()]).optional(),vntol:Wt([w(),h()]).optional()}).describe("SPICE solver options for a simulation experiment"),ub=M({type:x("simulation_experiment"),simulation_experiment_id:T("simulation_experiment"),name:h(),experiment_type:db,time_per_step:Jn.optional(),start_time_ms:Qt.optional(),end_time_ms:Qt.optional(),spice_options:mb.optional(),dc_sweep_voltage_source_id:h().optional(),dc_sweep_current_source_id:h().optional(),dc_sweep_start:w().optional(),dc_sweep_stop:w().optional(),dc_sweep_step:w().refine((t)=>t!==0).optional(),dc_sweep_unit:Ms.optional(),ac_sweep_type:ut(["linear","decade","octave"]).optional(),ac_samples_per_interval:w().int().positive().optional(),ac_sample_count:w().int().positive().optional(),ac_start_frequency_hz:w().positive().optional(),ac_stop_frequency_hz:w().positive().optional()}).superRefine((t,e)=>{if(t.experiment_type==="spice_dc_sweep"){let r=["dc_sweep_start","dc_sweep_stop","dc_sweep_step","dc_sweep_unit"];for(let s of r)if(t[s]===void 0)e.addIssue({code:X.custom,path:[s],message:`${s} is required for a DC sweep`});let n=t.dc_sweep_voltage_source_id!==void 0,i=t.dc_sweep_current_source_id!==void 0;if(n===i)e.addIssue({code:X.custom,path:["dc_sweep_voltage_source_id"],message:"Exactly one DC sweep voltage or current source ID is required"})}if(t.experiment_type==="spice_ac_analysis"){if(t.ac_sweep_type===void 0)e.addIssue({code:X.custom,path:["ac_sweep_type"],message:"ac_sweep_type is required for an AC analysis"});if(t.ac_start_frequency_hz===void 0)e.addIssue({code:X.custom,path:["ac_start_frequency_hz"],message:"ac_start_frequency_hz is required for an AC analysis"});if(t.ac_stop_frequency_hz===void 0)e.addIssue({code:X.custom,path:["ac_stop_frequency_hz"],message:"ac_stop_frequency_hz is required for an AC analysis"});if(t.ac_sweep_type==="linear"&&t.ac_sample_count===void 0)e.addIssue({code:X.custom,path:["ac_sample_count"],message:"ac_sample_count is required for a linear AC analysis"});if((t.ac_sweep_type==="decade"||t.ac_sweep_type==="octave")&&t.ac_samples_per_interval===void 0)e.addIssue({code:X.custom,path:["ac_samples_per_interval"],message:"ac_samples_per_interval is required for decade and octave AC analyses"})}}).describe("Defines a simulation experiment configuration");A(!0);var ze=M({simulation_parameter_sweep_id:h(),sweep_index:w().int().nonnegative(),parameter_value:w(),parameter_unit:qp});A(!0);var fb=M({type:x("simulation_transient_voltage_graph"),simulation_transient_voltage_graph_id:T("simulation_transient_voltage_graph"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),timestamps_ms:W(w()).optional(),voltage_levels:W(w()),source_component_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),time_per_step:Jn,start_time_ms:Qt,end_time_ms:Qt,name:h().optional(),color:h().optional()}).describe("Stores voltage measurements over time for a simulation");A(!0);var yb=M({type:x("simulation_transient_current_graph"),simulation_transient_current_graph_id:T("simulation_transient_current_graph"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),timestamps_ms:W(w()).optional(),current_levels:W(w()),source_component_id:h().optional(),subcircuit_connectivity_map_key:h().optional(),time_per_step:Jn,start_time_ms:Qt,end_time_ms:Qt,name:h().optional(),color:h().optional()}).describe("Stores current measurements over time for a simulation");A(!0);var _b=M({type:x("simulation_switch"),simulation_switch_id:T("simulation_switch"),source_component_id:h().optional(),closes_at:Qt.optional(),opens_at:Qt.optional(),starts_closed:E().optional(),switching_frequency:kr.optional()}).describe("Defines a switch for simulation timing control");A(!0);var gb=M({type:x("simulation_voltage_probe"),simulation_voltage_probe_id:T("simulation_voltage_probe"),source_component_id:h().optional(),name:h().optional(),signal_input_source_port_id:h().optional(),signal_input_source_net_id:h().optional(),reference_input_source_port_id:h().optional(),reference_input_source_net_id:h().optional(),subcircuit_id:h().optional(),color:h().optional()}).describe("Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.").superRefine((t,e)=>{if(t.reference_input_source_port_id||t.reference_input_source_net_id){let n=!!t.signal_input_source_port_id||!!t.reference_input_source_port_id,i=!!t.signal_input_source_net_id||!!t.reference_input_source_net_id;if(n&&i)e.addIssue({code:X.custom,message:"Cannot mix port and net connections in a differential probe."});else if(n){if(!t.signal_input_source_port_id||!t.reference_input_source_port_id)e.addIssue({code:X.custom,message:"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."})}else if(i){if(!t.signal_input_source_net_id||!t.reference_input_source_net_id)e.addIssue({code:X.custom,message:"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."})}}else if(!!t.signal_input_source_port_id===!!t.signal_input_source_net_id)e.addIssue({code:X.custom,message:"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."})});A(!0);var xb=M({type:x("simulation_current_probe"),simulation_current_probe_id:T("simulation_current_probe"),source_component_id:h().optional(),name:h().optional(),positive_source_port_id:h().optional(),negative_source_port_id:h().optional(),positive_source_net_id:h().optional(),negative_source_net_id:h().optional(),subcircuit_id:h().optional(),color:h().optional()}).describe("Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint.").superRefine((t,e)=>{let r=!!t.positive_source_port_id,n=!!t.negative_source_port_id,i=!!t.positive_source_net_id,s=!!t.negative_source_net_id,o=r||n,c=i||s;if(o&&c){e.addIssue({code:X.custom,message:"Cannot mix port and net connections in a current probe."});return}if(o){if(!r||!n)e.addIssue({code:X.custom,message:"Current probe using source ports requires both positive_source_port_id and negative_source_port_id."});return}if(c){if(!i||!s)e.addIssue({code:X.custom,message:"Current probe using source nets requires both positive_source_net_id and negative_source_net_id."});return}e.addIssue({code:X.custom,message:"A current probe must have either positive/negative source port ids or positive/negative source net ids."})});A(!0);var bb=Mt.extend({type:x("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:T("simulation_unknown_experiment_error"),error_type:x("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),simulation_experiment_id:h().optional(),subcircuit_id:h().optional()}).describe("An unknown error occurred during the simulation experiment.");A(!0);var B3=ut(["resistance","capacitance","inductance","voltage","current"]),uo=M({type:x("simulation_parameter_sweep"),simulation_parameter_sweep_id:T("simulation_parameter_sweep"),simulation_experiment_id:h(),name:h().optional(),parameter_values:W(w()).min(1),parameter_unit:qp}),vb=ie("parameter_type",[uo.extend({parameter_type:x("resistance"),resistor_source_component_id:h()}),uo.extend({parameter_type:x("capacitance"),capacitor_source_component_id:h()}),uo.extend({parameter_type:x("inductance"),inductor_source_component_id:h()}),uo.extend({parameter_type:x("voltage"),source_net_id:h()}),uo.extend({parameter_type:x("current"),current_source_component_id:h()})]).describe("Repeats a simulation experiment over component parameter values");A(!0);var Sb=M({type:x("simulation_dc_operating_point_voltage"),simulation_dc_operating_point_voltage_id:T("simulation_dc_operating_point_voltage"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_voltage_probe_id:h(),voltage:w(),name:h().optional(),color:h().optional()});A(!0);var wb=M({type:x("simulation_dc_operating_point_current"),simulation_dc_operating_point_current_id:T("simulation_dc_operating_point_current"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_current_probe_id:h(),current:w(),name:h().optional(),color:h().optional()});A(!0);var Ab=M({type:x("simulation_dc_sweep_voltage_graph"),simulation_dc_sweep_voltage_graph_id:T("simulation_dc_sweep_voltage_graph"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_voltage_probe_id:h(),sweep_values:W(w()),sweep_unit:Ms,voltage_levels:W(w()),name:h().optional(),color:h().optional()}).refine((t)=>t.sweep_values.length===t.voltage_levels.length,{message:"sweep_values and voltage_levels must have the same length"});A(!0);var Pb=M({type:x("simulation_dc_sweep_current_graph"),simulation_dc_sweep_current_graph_id:T("simulation_dc_sweep_current_graph"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_current_probe_id:h(),sweep_values:W(w()),sweep_unit:Ms,current_levels:W(w()),name:h().optional(),color:h().optional()}).refine((t)=>t.sweep_values.length===t.current_levels.length,{message:"sweep_values and current_levels must have the same length"});A(!0);var Jp=M({re:w(),im:w()});A(!0);var Bb=M({type:x("simulation_ac_sweep_voltage_graph"),simulation_ac_sweep_voltage_graph_id:T("simulation_ac_sweep_voltage_graph"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_voltage_probe_id:h(),frequencies_hz:W(w()),complex_voltages:W(Jp),name:h().optional(),color:h().optional()}).refine((t)=>t.frequencies_hz.length===t.complex_voltages.length,{message:"frequencies_hz and complex_voltages must have the same length"});A(!0);var Ib=M({type:x("simulation_ac_sweep_current_graph"),simulation_ac_sweep_current_graph_id:T("simulation_ac_sweep_current_graph"),simulation_experiment_id:h(),simulation_parameter_sweep_coordinate:ze.optional(),simulation_current_probe_id:h(),frequencies_hz:W(w()),complex_currents:W(Jp),name:h().optional(),color:h().optional()}).refine((t)=>t.frequencies_hz.length===t.complex_currents.length,{message:"frequencies_hz and complex_currents must have the same length"});A(!0);var Fb=M({type:x("simulation_op_amp"),simulation_op_amp_id:T("simulation_op_amp"),source_component_id:h().optional(),inverting_input_source_port_id:h(),non_inverting_input_source_port_id:h(),output_source_port_id:h(),positive_supply_source_port_id:h(),negative_supply_source_port_id:h()}).describe("Defines a simple ideal operational amplifier for simulation");A(!0);var Mb=M({type:x("simulation_spice_subcircuit"),simulation_spice_subcircuit_id:T("simulation_spice_subcircuit"),source_component_id:h(),spice_pin_to_source_port_map:Qn(h(),h()),subcircuit_source:h()}).describe("Defines a custom SPICE subcircuit model for simulation");A(!0);var p_=(t)=>t!==void 0,Cb=M({type:x("simulation_oscilloscope_trace"),simulation_oscilloscope_trace_id:T("simulation_oscilloscope_trace"),simulation_transient_voltage_graph_id:h().optional(),simulation_transient_current_graph_id:h().optional(),simulation_voltage_probe_id:h().optional(),simulation_current_probe_id:h().optional(),display_name:h().optional(),color:h().optional(),display_center_value:w().optional(),display_center_offset_divs:w().optional(),volts_per_div:w().positive().optional(),amps_per_div:w().positive().optional()}).describe("Defines how a simulation measurement is rendered as an oscilloscope-style trace.").superRefine((t,e)=>{let r=[t.simulation_transient_voltage_graph_id,t.simulation_voltage_probe_id].filter(p_).length,n=[t.simulation_transient_current_graph_id,t.simulation_current_probe_id].filter(p_).length;if(r+n!==1)e.addIssue({code:X.custom,message:"An oscilloscope trace must reference exactly one voltage graph, current graph, voltage probe, or current probe."});if(r>0&&t.amps_per_div!==void 0)e.addIssue({code:X.custom,message:"Voltage oscilloscope traces must use volts_per_div, not amps_per_div."});if(n>0&&t.volts_per_div!==void 0)e.addIssue({code:X.custom,message:"Current oscilloscope traces must use amps_per_div, not volts_per_div."})});A(!0);var lp=M({x:w().finite(),y:w().finite(),layer:gt}),fp=ie("contact_type",[lp.extend({contact_type:x("pcb_port"),pcb_port_id:h().min(1)}),lp.extend({contact_type:x("pcb_via"),pcb_via_id:h().min(1)}),lp.extend({contact_type:x("pcb_copper_pour"),pcb_copper_pour_id:h().min(1)})]).describe("Identifies the reference conductor at a return-current contact");A(!0);var yp=M({signal_pcb_port_id:h().min(1),reference_pcb_port_id:h().min(1).optional(),reference_layer:gt,resistance:w().finite().positive()}).describe("A two-terminal return-current excitation port with resistance in ohms");A(!0);var kb=M({type:x("simulation_return_current_excitation"),simulation_return_current_excitation_id:T("simulation_return_current_excitation"),simulation_experiment_id:h().min(1),pcb_trace_id:h().min(1),ground_source_net_id:h().min(1),current:w().finite(),return_source:fp,return_sink:fp,source_port:yp.optional(),load_port:yp.optional()}).describe("Excites a signal trace with signed current in amperes, peak for AC; return_source is near the load and return_sink near the driver for positive current");A(!0);var Nb=M({type:x("simulation_pcb_return_current_result"),simulation_pcb_return_current_result_id:T("simulation_pcb_return_current_result"),simulation_experiment_id:h().min(1),pcb_board_id:h().min(1),simulation_return_current_excitation_ids:W(h().min(1)).min(1).refine((t)=>new Set(t).size===t.length,"Excitation IDs must be unique"),frequency_hz:w().finite().positive().optional()}).describe("A PCB return-current result at one frequency, or a frequency-independent result when frequency_hz is absent");A(!0);function Yb(t){return _o.extend({project_relative_path:h().min(1),url:h().url()}).superRefine((e,r)=>{if(!t.includes(e.mimetype))r.addIssue({code:X.custom,path:["mimetype"],message:`Expected one of: ${t.join(", ")}`});if(e.url.startsWith("data:")){if(/^data:([^;,]*)(?:;[^,]*)?,/i.exec(e.url)?.[1]?.toLowerCase()!==e.mimetype)r.addIssue({code:X.custom,path:["url"],message:"Data URL media type must match asset.mimetype"})}})}var Lb=Yb(["application/json","application/gzip"]),Tb=Yb(["image/png","image/webp"]),Eb=M({type:x("simulation_pcb_return_current_field"),simulation_pcb_return_current_field_id:T("simulation_pcb_return_current_field"),simulation_pcb_return_current_result_id:h().min(1),layer:gt,source_net_id:h().min(1),field_type:ut(["real","complex_phasor"]),min_x:w().finite(),min_y:w().finite(),columns:w().int().positive().safe(),rows:w().int().positive().safe(),cell_width:w().finite().positive(),cell_height:w().finite().positive(),copper_thickness:w().finite().positive(),data_format:x("simulation_return_current_grid_json_v1"),field_asset:Lb}).superRefine((t,e)=>{if(!Number.isSafeInteger(t.columns*t.rows))e.addIssue({code:X.custom,path:["columns"],message:"The grid cell count must be a safe integer"})}).describe("A sampled sheet-current field in A/mm, using plain or gzipped JSON Asset URLs; dimensions are PCB millimeters");A(!0);var Zn=W(w().finite().nullable()).min(1),Rb=ie("field_type",[M({field_type:x("real"),sheet_current_x:Zn,sheet_current_y:Zn}),M({field_type:x("complex_phasor"),sheet_current_x_real:Zn,sheet_current_x_imag:Zn,sheet_current_y_real:Zn,sheet_current_y_imag:Zn})]).superRefine((t,e)=>{let r=t.field_type==="real"?[t.sheet_current_x,t.sheet_current_y]:[t.sheet_current_x_real,t.sheet_current_x_imag,t.sheet_current_y_real,t.sheet_current_y_imag],n=r[0];if(r.some((i)=>i.length!==n.length)){e.addIssue({code:X.custom,message:"Current channels must have equal lengths"});return}for(let i=0;i<n.length;i++){let s=n[i]===null;if(r.some((o)=>o[i]===null!==s)){e.addIssue({code:X.custom,message:`Cell ${i} must be null in every channel or finite in every channel`});return}}}).describe("Decoded real or complex sheet-current arrays with a shared conductor mask");A(!0);function I3(t){let e=t.columns*t.rows;if(!Number.isSafeInteger(t.columns)||t.columns<=0||!Number.isSafeInteger(t.rows)||t.rows<=0||!Number.isSafeInteger(e))throw Error("Grid dimensions must be positive safe integers");return Rb.superRefine((r,n)=>{if(r.field_type!==t.field_type)n.addIssue({code:X.custom,path:["field_type"],message:"Decoded field_type must match the parent field"});if((r.field_type==="real"?r.sheet_current_x:r.sheet_current_x_real).length!==e)n.addIssue({code:X.custom,message:`Each current channel must have ${e} entries (columns * rows)`})})}var Ob=M({type:x("simulation_pcb_return_current_heatmap"),simulation_pcb_return_current_heatmap_id:T("simulation_pcb_return_current_heatmap"),simulation_pcb_return_current_result_id:h().min(1),layer:gt,source_net_id:h().min(1),min_x:w().finite(),min_y:w().finite(),max_x:w().finite(),max_y:w().finite(),image_asset:Tb}).superRefine((t,e)=>{for(let r of["x","y"])if(t[`max_${r}`]<=t[`min_${r}`])e.addIssue({code:X.custom,path:[`max_${r}`],message:"Heatmap bounds must have positive width and height"})}).describe("A transparent PNG/WebP current-density overlay in A/mm²; the top-left pixel maps to (min_x, max_y)");A(!0);var h_=M({type:x("simulation_pcb_return_current_marker"),simulation_pcb_return_current_marker_id:T("simulation_pcb_return_current_marker"),simulation_pcb_return_current_result_id:h().min(1),role:ut(["signal_source","signal_load","return_source","return_sink","signal_transition","return_transition"]),label:h().optional(),label_x:w().finite().optional(),label_y:w().finite().optional()}),Wb=ie("target_type",[h_.extend({target_type:x("pcb_port"),pcb_port_id:h().min(1),layer:gt}),h_.extend({target_type:x("pcb_via"),pcb_via_id:h().min(1),from_layer:gt,to_layer:gt})]).superRefine((t,e)=>{if(t.label_x===void 0!==(t.label_y===void 0))e.addIssue({code:X.custom,path:["label_x"],message:"label_x and label_y must be provided together"});if(t.target_type==="pcb_via"&&t.from_layer===t.to_layer)e.addIssue({code:X.custom,path:["to_layer"],message:"A via transition must connect distinct layers"})}).describe("A signal/return port or via highlight; markers do not assert measured via-transfer currents");A(!0);var $b=Wt([p0,G_,l0,z_,U_,V_,Q_,H_,Ap,vp,Ps,wp,Sp,Pp,Bp,Ip,Cp,kp,Np,Rp,Yp,Lp,Tp,Ep,Mp,Fp,J_,t0,Z_,Op,Wp,$p,jp,e0,c0,Xp,Vp,Dp,r0,n0,i0,o0,s0,a0,zp,Up,q_,J0,rg,lg,wx,Ax,Px,Mx,Cx,kx,Nx,Yx,pg,yx,_x,hg,Lg,yg,vg,Sg,wg,Bg,Ag,Pg,Ig,Tg,mg,ug,fg,Eg,Rg,Xg,Dg,Bx,Gg,Hg,Qg,Zg,nx,qg,Jg,Kg,tx,rx,Fg,Mg,Cg,kg,Vg,zg,Ug,Ng,Yg,zx,Ux,Gx,Hx,ox,ix,sx,ax,cx,lx,px,hx,dx,Ix,Fx,mx,ux,Lx,Sx,Tx,Ex,Rx,jx,Xx,Dx,Vx,Qx,Zx,qx,Jx,Kx,h0,A0,x0,b0,v0,S0,_0,g0,P0,w0,d0,I0,F0,B0,N0,Y0,L0,T0,E0,R0,z0,O0,W0,$0,V0,j0,X0,eb,nb,ob,rb,cb,hb,ub,kb,Nb,Eb,Ob,Wb,fb,yb,Sb,wb,Ab,Pb,Bb,Ib,vb,_b,gb,xb,Cb,bb,Fb,Mb]),ti=$b;A(!0);Nr(!0);function O(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function jb(t){let{a:e,b:r,c:n,d:i,e:s,f:o}=t,c=e*i-r*n;return{a:i/c,b:r/-c,c:n/-c,d:e/c,e:(i*s-n*o)/-c,f:(r*s-e*o)/c}}function Yr(t){return typeof t>"u"}function Rt(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function dr(...t){t=Array.isArray(t[0])?t[0]:t;let e=(r,n)=>({a:r.a*n.a+r.c*n.b,c:r.a*n.c+r.c*n.d,e:r.a*n.e+r.c*n.f+r.e,b:r.b*n.a+r.d*n.b,d:r.b*n.c+r.d*n.d,f:r.b*n.e+r.d*n.f+r.f});switch(t.length){case 0:throw Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{let[r,n,...i]=t,s=e(r,n);return dr(s,...i)}}}function Ct(...t){return dr(...t)}var{cos:F3,sin:M3,PI:iJ}=Math;function Se(t,e,r){let n=F3(t),i=M3(t),s={a:n,c:-i,e:0,b:i,d:n,f:0};if(Yr(e)||Yr(r))return s;return dr([Rt(e,r),s,Rt(-e,-r)])}function oe(t,e=void 0,r=void 0,n=void 0){if(Yr(e))e=t;let i={a:t,c:0,e:0,b:0,d:e,f:0};if(Yr(r)||Yr(n))return i;return dr([Rt(r,n),i,Rt(-r,-n)])}var{tan:hJ}=Math;function Xb(t){return Lr(t)}function Lr(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function Db(t,e=10000000000){return{a:Math.round(t.a*e)/e,b:Math.round(t.b*e)/e,c:Math.round(t.c*e)/e,d:Math.round(t.d*e)/e,e:Math.round(t.e*e)/e,f:Math.round(t.f*e)/e}}function Vb(t,e){let r=t[0].x!=null?t[0].x:t[0][0],n=t[0].y!=null?t[0].y:t[0][1],i=e[0].x!=null?e[0].x:e[0][0],s=e[0].y!=null?e[0].y:e[0][1],o=t[1].x!=null?t[1].x:t[1][0],c=t[1].y!=null?t[1].y:t[1][1],l=e[1].x!=null?e[1].x:e[1][0],a=e[1].y!=null?e[1].y:e[1][1],p=t[2].x!=null?t[2].x:t[2][0],d=t[2].y!=null?t[2].y:t[2][1],m=e[2].x!=null?e[2].x:e[2][0],f=e[2].y!=null?e[2].y:e[2][1],_={a:r-p,b:n-d,c:o-p,d:c-d,e:p,f:d},g={a:i-m,b:s-f,c:l-m,d:a-f,e:m,f},y=jb(_),S=dr([g,y]);return Db(S)}function k3(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Cs(t,e,r,n){var i=Error.call(this,t);if(Object.setPrototypeOf)Object.setPrototypeOf(i,Cs.prototype);return i.expected=e,i.found=r,i.location=n,i.name="SyntaxError",i}k3(Cs,Error);function Kp(t,e,r){if(r=r||" ",t.length>e)return t;return e-=t.length,r+=r.repeat(e),t+r.slice(0,e)}Cs.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n<t.length;n++)if(t[n].source===this.location.source){r=t[n].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,s=this.location.source&&typeof this.location.source.offset==="function"?this.location.source.offset(i):i,o=this.location.source+":"+s.line+":"+s.column;if(r){var c=this.location.end,l=Kp("",s.line.toString().length," "),a=r[i.line-1],p=i.line===c.line?c.column:a.length+1,d=p-i.column||1;e+=`
 --> `+o+`
`+l+` |
`+s.line+" | "+a+`
`+l+" | "+Kp("",i.column-1," ")+Kp("",d,"^")}else e+=`
 at `+o}return e};Cs.buildMessage=function(t,e){var r={literal:function(a){return'"'+i(a.text)+'"'},class:function(a){var p=a.parts.map(function(d){return Array.isArray(d)?s(d[0])+"-"+s(d[1]):s(d)});return"["+(a.inverted?"^":"")+p.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(a){return a.description}};function n(a){return a.charCodeAt(0).toString(16).toUpperCase()}function i(a){return a.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(p){return"\\x0"+n(p)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(p){return"\\x"+n(p)})}function s(a){return a.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(p){return"\\x0"+n(p)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(p){return"\\x"+n(p)})}function o(a){return r[a.type](a)}function c(a){var p=a.map(o),d,m;if(p.sort(),p.length>0){for(d=1,m=1;d<p.length;d++)if(p[d-1]!==p[d])p[m]=p[d],m++;p.length=m}switch(p.length){case 1:return p[0];case 2:return p[0]+" or "+p[1];default:return p.slice(0,-1).join(", ")+", or "+p[p.length-1]}}function l(a){return a?'"'+i(a)+'"':"end of input"}return"Expected "+c(t)+" but "+l(e)+" found."};var ni={CCW:-1,CW:1,NOT_ORIENTABLE:0},Y3=2*Math.PI;var Ys=Object.freeze({__proto__:null,BOUNDARY:2,CCW:!0,CONTAINS:3,CW:!1,END_VERTEX:2,INSIDE:1,INTERLACE:4,NOT_VERTEX:0,ORIENTATION:ni,OUTSIDE:0,OVERLAP_OPPOSITE:2,OVERLAP_SAME:1,PIx2:Y3,START_VERTEX:1}),Ce=0.000001;function i1(t){Ce=t}function o1(){return Ce}var L3=3;function rh(t){return t<Ce&&t>-Ce}function Er(t,e){return t-e<Ce&&t-e>-Ce}function s1(t,e){return t-e>Ce}function T3(t,e){return t-e>-Ce}function a1(t,e){return t-e<-Ce}function E3(t,e){return t-e<Ce}var c1=Object.freeze({__proto__:null,DECIMALS:L3,EQ:Er,EQ_0:rh,GE:T3,GT:s1,LE:E3,LT:a1,getTolerance:o1,setTolerance:i1}),u={Utils:c1,Errors:void 0,Matrix:void 0,Planar_set:void 0,Point:void 0,Vector:void 0,Line:void 0,Circle:void 0,Segment:void 0,Arc:void 0,Box:void 0,Edge:void 0,Face:void 0,Ray:void 0,Ray_shooting:void 0,Multiline:void 0,Polygon:void 0,Distance:void 0,Inversion:void 0};for(let t in Ys)u[t]=Ys[t];Object.defineProperty(u,"DP_TOL",{get:function(){return o1()},set:function(t){i1(t)}});class $t{static get ILLEGAL_PARAMETERS(){return ReferenceError("Illegal Parameters")}static get ZERO_DIVISION(){return Error("Zero division")}static get UNRESOLVED_BOUNDARY_CONFLICT(){return Error("Unresolved boundary conflict in boolean operation")}static get INFINITE_LOOP(){return Error("Infinite loop")}static get CANNOT_COMPLETE_BOOLEAN_OPERATION(){return Error("Cannot complete boolean operation")}static get CANNOT_INVOKE_ABSTRACT_METHOD(){return Error("Abstract method cannot be invoked")}static get OPERATION_IS_NOT_SUPPORTED(){return Error("Operation is not supported")}static get UNSUPPORTED_SHAPE_TYPE(){return Error("Unsupported shape type")}}u.Errors=$t;class Ls{constructor(t,e){this.first=t,this.last=e||this.first}[Symbol.iterator](){let t=void 0;return{next:()=>(t=t?t.next:this.first,{value:t,done:t===void 0})}}get size(){let t=0;for(let e of this)t++;return t}toArray(t=void 0,e=void 0){let r=[],n=t||this.first,i=e||this.last,s=n;if(s===void 0)return r;do r.push(s),s=s.next;while(s!==i.next);return r}append(t){if(this.isEmpty())this.first=t;else t.prev=this.last,this.last.next=t;return this.last=t,this.last.next=void 0,this.first.prev=void 0,this}insert(t,e){if(this.isEmpty())this.first=t,this.last=t;else if(e===null||e===void 0)t.next=this.first,this.first.prev=t,this.first=t;else{let r=e.next;if(e.next=t,r)r.prev=t;if(t.prev=e,t.next=r,this.last===e)this.last=t}return this.last.next=void 0,this.first.prev=void 0,this}remove(t){if(t===this.first&&t===this.last)this.first=void 0,this.last=void 0;else{if(t.prev)t.prev.next=t.next;if(t.next)t.next.prev=t.prev;if(t===this.first)this.first=t.next;if(t===this.last)this.last=t.prev}return this}isEmpty(){return this.first===void 0}static testInfiniteLoop(t){let e=t,r=t;do{if(e!=t&&e===r)throw $t.INFINITE_LOOP;e=e.next,r=r.next.next}while(e!=t)}}var zb={stroke:"black"};class l1{constructor(t=zb){for(let e in t)this[e]=t[e];this.stroke=t.stroke??zb.stroke}toAttributesString(){return Object.keys(this).reduce((t,e)=>t+(this[e]!==void 0?this.toAttrString(e,this[e]):""),"")}toAttrString(t,e){let r=t==="className"?"class":this.convertCamelToKebabCase(t);return e===null?`${r} `:`${r}="${e.toString()}" `}convertCamelToKebabCase(t){return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).join("-").toLowerCase()}}function Or(t){return new l1(t).toAttributesString()}function ci(t,e){let r=[],[n,i,s]=t.standard,[o,c,l]=e.standard,a=n*c-i*o,p=s*c-i*l,d=n*l-s*o;if(!u.Utils.EQ_0(a)){let m,f;if(i===0)m=s/n,f=d/a;else if(c===0)m=l/o,f=d/a;else if(n===0)m=p/a,f=s/i;else if(o===0)m=p/a,f=l/c;else m=p/a,f=d/a;r.push(new u.Point(m,f))}return r}function Wr(t,e){let r=[],n=e.pc.projectionOn(t),i=e.pc.distanceTo(n)[0];if(u.Utils.EQ(i,e.r))r.push(n);else if(u.Utils.LT(i,e.r)){let s=Math.sqrt(e.r*e.r-i*i),o,c;o=t.norm.rotate90CCW().multiply(s),c=n.translate(o),r.push(c),o=t.norm.rotate90CW().multiply(s),c=n.translate(o),r.push(c)}return r}function ii(t,e){let r=[];for(let n of e.toSegments()){let i=wo(n,t);for(let s of i)if(!g1(s,r))r.push(s)}return r}function Ts(t,e){let r=[];if(ii(t,e.box).length===0)return r;let n=new u.Circle(e.pc,e.r),i=Wr(t,n);for(let s of i)if(s.on(e))r.push(s);return r}function wo(t,e){let r=[];if(t.ps.on(e))r.push(t.ps);if(t.pe.on(e)&&!t.isZeroLength())r.push(t.pe);if(r.length>0)return r;if(t.isZeroLength())return r;if(t.ps.leftTo(e)&&t.pe.leftTo(e)||!t.ps.leftTo(e)&&!t.pe.leftTo(e))return r;let n=new u.Line(t.ps,t.pe);return ci(n,e)}function Es(t,e){let r=[];if(t.isZeroLength()){if(t.ps.on(e))r.push(t.ps);return r}if(e.isZeroLength()){if(e.ps.on(t))r.push(e.ps);return r}let n=new u.Line(t.ps,t.pe),i=new u.Line(e.ps,e.pe);if(n.incidentTo(i)){if(t.ps.on(e))r.push(t.ps);if(t.pe.on(e))r.push(t.pe);if(e.ps.on(t)&&!e.ps.equalTo(t.ps)&&!e.ps.equalTo(t.pe))r.push(e.ps);if(e.pe.on(t)&&!e.pe.equalTo(t.ps)&&!e.pe.equalTo(t.pe))r.push(e.pe)}else if(n.parallelTo(i)){let s=new u.Vector(t.ps,t.pe),o=new u.Vector(e.ps,e.pe),c=new u.Vector(t.ps,e.ps),l=s.cross(o);if(!u.Utils.EQ_0(l)){let a=c.cross(o)/l,p=c.cross(s)/l;if(u.Utils.GE(a,0)&&u.Utils.LE(a,1)&&u.Utils.GE(p,0)&&u.Utils.LE(p,1))r.push(Ub(t.ps.translate(s.multiply(a)),t,e))}}else{let s=ci(n,i);if(s.length>0){if(Gb(s[0],t)&&Gb(s[0],e))r.push(Ub(s[0],t,e))}}return r}function Ub(t,e,r){for(let n of[e.ps,e.pe,r.ps,r.pe])if(t.equalTo(n))return n;return t}function Gb(t,e){let r=e.box;return u.Utils.LE(t.x,r.xmax)&&u.Utils.GE(t.x,r.xmin)&&u.Utils.LE(t.y,r.ymax)&&u.Utils.GE(t.y,r.ymin)}function Rs(t,e){let r=[];if(t.isZeroLength()){let[s,o]=t.ps.distanceTo(e.pc);if(u.Utils.EQ(s,e.r))r.push(t.ps);return r}let n=new u.Line(t.ps,t.pe),i=Wr(n,e);for(let s of i)if(s.on(t))r.push(s);return r}function li(t,e){let r=[];if(t.isZeroLength()){if(t.ps.on(e))r.push(t.ps);return r}let n=new u.Line(t.ps,t.pe),i=new u.Circle(e.pc,e.r),s=Wr(n,i);for(let o of s)if(o.on(t)&&o.on(e))r.push(o);return r}function R3(t,e){let r=[];for(let n of e.toSegments()){let i=Es(n,t);for(let s of i)r.push(s)}return r}function p1(t,e){let r=[],n=new u.Vector(t.pc,e.pc),i=t.r,s=e.r;if(u.Utils.EQ_0(i)||u.Utils.EQ_0(s))return r;if(u.Utils.EQ_0(n.x)&&u.Utils.EQ_0(n.y)&&u.Utils.EQ(i,s))return r.push(t.pc.translate(-i,0)),r;let o=t.pc.distanceTo(e.pc)[0];if(u.Utils.GT(o,i+s))return r;if(u.Utils.LT(o,Math.abs(i-s)))return r;n.x/=o,n.y/=o;let c;if(u.Utils.EQ(o,i+s)||u.Utils.EQ(o,Math.abs(i-s)))return c=t.pc.translate(i*n.x,i*n.y),r.push(c),r;let l=i*i/(2*o)-s*s/(2*o)+o/2,a=t.pc.translate(l*n.x,l*n.y),p=Math.sqrt(i*i-l*l);return c=a.translate(n.rotate90CCW().multiply(p)),r.push(c),c=a.translate(n.rotate90CW().multiply(p)),r.push(c),r}function O3(t,e){let r=[];for(let n of e.toSegments()){let i=Rs(n,t);for(let s of i)r.push(s)}return r}function h1(t,e){let r=[];if(t.pc.equalTo(e.pc)&&u.Utils.EQ(t.r,e.r)){let o;if(o=t.start,o.on(e))r.push(o);if(o=t.end,o.on(e))r.push(o);if(o=e.start,o.on(t))r.push(o);if(o=e.end,o.on(t))r.push(o);return r}let n=new u.Circle(t.pc,t.r),i=new u.Circle(e.pc,e.r),s=n.intersect(i);for(let o of s)if(o.on(t)&&o.on(e))r.push(o);return r}function ph(t,e){let r=[];if(e.pc.equalTo(t.pc)&&u.Utils.EQ(e.r,t.r))return r.push(t.start),r.push(t.end),r;let n=e,i=new u.Circle(t.pc,t.r),s=p1(n,i);for(let o of s)if(o.on(t))r.push(o);return r}function W3(t,e){let r=[];for(let n of e.toSegments()){let i=li(n,t);for(let s of i)r.push(s)}return r}function d1(t,e){return t.isSegment?Es(t.shape,e):li(e,t.shape)}function m1(t,e){return t.isSegment?li(t.shape,e):h1(t.shape,e)}function u1(t,e){return t.isSegment?wo(t.shape,e):Ts(e,t.shape)}function $3(t,e){return t.isSegment?mh(e,t.shape):uh(e,t.shape)}function j3(t,e){return t.isSegment?Rs(t.shape,e):ph(t.shape,e)}function hh(t,e){let r=[];for(let n of e.edges)for(let i of d1(n,t))r.push(i);return r}function dh(t,e){let r=[];for(let n of e.edges)for(let i of m1(n,t))r.push(i);return r}function Ao(t,e){let r=[];if(e.isEmpty())return r;for(let n of e.edges)for(let i of u1(n,t))if(!g1(i,r))r.push(i);return t.sortPoints(r)}function f1(t,e){let r=[];if(e.isEmpty())return r;for(let n of e.edges)for(let i of j3(n,t))r.push(i);return r}function y1(t,e){if(t.isSegment)return d1(e,t.shape);else if(t.isArc)return m1(e,t.shape);else if(t.isLine)return u1(e,t.shape);else if(t.isRay)return $3(e,t.shape);return[]}function _1(t,e){let r=[];if(e.isEmpty()||t.shape.box.not_intersect(e.box))return r;let n=e.edges.search(t.shape.box);for(let i of n)r=[...r,...y1(t,i)];return r}function X3(t,e){let r=[];if(e.isEmpty()||t.size===0)return r;for(let n of t)r=[...r,..._1(n,e)];return r}function D3(t,e){let r=[];if(t.isEmpty()||e.isEmpty())return r;if(t.box.not_intersect(e.box))return r;for(let n of t.edges)r=[...r,..._1(n,e)];return r}function V3(t,e){if(t instanceof u.Line)return Ao(t,e);else if(t instanceof u.Segment)return hh(t,e);else if(t instanceof u.Arc)return dh(t,e);else return[]}function g1(t,e){return e.some((r)=>r.equalTo(t))}function ur(t){return new u.Line(t.start,t.norm)}function mh(t,e){return wo(e,ur(t)).filter((r)=>t.contains(r))}function uh(t,e){return Ts(ur(t),e).filter((r)=>t.contains(r))}function x1(t,e){return Wr(ur(t),e).filter((r)=>t.contains(r))}function z3(t,e){return ii(ur(t),e).filter((r)=>t.contains(r))}function b1(t,e){return ci(ur(t),e).filter((r)=>t.contains(r))}function U3(t,e){return ci(ur(t),ur(e)).filter((r)=>t.contains(r)).filter((r)=>e.contains(r))}function v1(t,e){return Ao(ur(t),e).filter((r)=>t.contains(r))}function S1(t,e){if(t.intersect&&t.intersect instanceof Function)return t.intersect(e);throw $t.UNSUPPORTED_SHAPE_TYPE}function pi(t,e){let r=[];for(let n of e)r=[...r,...S1(t,n.shape)];return r}function G3(t,e){let r=[];for(let n of t)for(let i of e)r=[...r,...S1(n.shape,i.shape)];return r}var $r=class t extends Ls{constructor(...e){super();if(this.isInfinite=!1,e.length===1&&e[0]instanceof Array&&e[0].length>0){let r=e[0],n=r.length,i=(l)=>l instanceof u.Segment||l instanceof u.Arc||l instanceof u.Ray||l instanceof u.Line,s=(l)=>l instanceof u.Segment||l instanceof u.Arc||l instanceof u.Ray,o=(l)=>l instanceof u.Segment||l instanceof u.Arc;if(n===1&&i(r[0])||n>1&&s(r[0])&&s(r[n-1])&&r.slice(1,n-1).every(o)){this.isInfinite=r.some((l)=>l instanceof u.Ray||l instanceof u.Line);for(let l of r){let a=new u.Edge(l);this.append(a)}this.setArcLength()}else throw u.Errors.ILLEGAL_PARAMETERS}}get edges(){return[...this]}get box(){return this.edges.reduce((e,r)=>e.merge(r.box),new u.Box)}get vertices(){let e=this.edges.map((r)=>r.start);return e.push(this.last.end),e}get length(){if(this.isEmpty())return 0;if(this.isInfinite)return Number.POSITIVE_INFINITY;let e=0;for(let r of this)e+=r.length;return e}clone(){return new t(this.toShapes())}setArcLength(){for(let e of this)this.setOneEdgeArcLength(e)}setOneEdgeArcLength(e){if(e===this.first)e.arc_length=0;else e.arc_length=e.prev.arc_length+e.prev.length}pointAtLength(e){if(e>this.length||e<0)return null;if(this.isInfinite)return null;let r=null;for(let n of this)if(e>=n.arc_length&&(n===this.last||e<n.next.arc_length)){r=n.pointAtLength(e-n.arc_length);break}return r}addVertex(e,r){let n=r.shape.split(e);if(n[0]===null)return r.prev;if(n[1]===null)return r;let i=new u.Edge(n[0]),s=r.prev;return this.insert(i,s),r.shape=n[1],i}getChain(e,r){let n=[];for(let i=e;i!==r.next;i=i.next)n.push(i);return n}split(e){for(let r of e){let n=this.findEdgeByPoint(r);this.addVertex(r,n)}return this}findEdgeByPoint(e){let r;for(let n of this)if(n.shape.contains(e)){r=n;break}return r}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Line){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Circle){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Segment){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Arc){let[r,n]=u.Distance.shape2multiline(e,this);return[r,n.reverse()]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2multiline(new u.Polygon(e),this);return[r,n.reverse()]}if(e instanceof u.Multiline)return u.Distance.multiline2multiline(this,e);throw u.Errors.UNSUPPORTED_SHAPE_TYPE}intersect(e){if(e instanceof u.Multiline)return G3(this,e);else return pi(e,this)}contains(e){if(e instanceof u.Point)return this.edges.some((r)=>r.shape.contains(e));throw u.Errors.UNSUPPORTED_SHAPE_TYPE}translate(e){return new t(this.edges.map((r)=>r.shape.translate(e)))}rotate(e=0,r=new u.Point){return new t(this.edges.map((n)=>n.shape.rotate(e,r)))}transform(e=new u.Matrix){return new t(this.edges.map((r)=>r.shape.transform(e)))}toShapes(){return this.edges.map((e)=>e.shape.clone())}toJSON(){return this.edges.map((e)=>e.toJSON())}svgPoints(){return this.vertices.map((e)=>`${e.x},${e.y}`).join(" ")}dpath(){let e=`M${this.first.start.x},${this.first.start.y}`;for(let r of this)e+=r.svg();return e}svg(e={}){let r=`
<path ${Or({fill:"none",...e})} d="`;r+=`
M${this.first.start.x},${this.first.start.y}`;for(let n of this)r+=n.svg();return r+=`" >
</path>`,r}};u.Multiline=$r;var H3=(...t)=>new u.Multiline(...t);u.multiline=H3;function oi(t,e,r){let n=r.length,i=t.shape.split(e);if(i.length===0)return;let s=0;if(i[0]===null)s=0;else if(i[1]===null)s=t.shape.length;else s=i[0].length;let o=0;if(Er(s,0))o|=1;if(Er(s,t.shape.length))o|=2;let c;if(s===1/0)c=i[0].coord(e);else c=o&2&&t.next&&t.next.arc_length===0?0:t.arc_length+s;r.push({id:n,pt:e,arc_length:c,edge_before:t,edge_after:void 0,face:t.face,is_vertex:o})}function vo(t){t.int_points1_sorted=mr(t.int_points1),t.int_points2_sorted=mr(t.int_points2)}function mr(t){let e=new Map,r=0;for(let i of t)if(!e.has(i.face))e.set(i.face,r),r++;for(let i of t)i.faceId=e.get(i.face);return t.slice().sort(Q3)}function Q3(t,e){if(t.faceId<e.faceId)return-1;if(t.faceId>e.faceId)return 1;if(t.arc_length<e.arc_length)return-1;if(t.arc_length>e.arc_length)return 1;return 0}function fh(t){if(t.int_points1.length<2)return;let e=!1,r,n,i,s;for(let o=0;o<t.int_points1_sorted.length;o++){if(t.int_points1_sorted[o].id===-1)continue;r=t.int_points1_sorted[o],n=t.int_points2[r.id];for(let c=o+1;c<t.int_points1_sorted.length;c++){if(i=t.int_points1_sorted[c],!Er(i.arc_length,r.arc_length))break;if(i.id===-1)continue;if(s=t.int_points2[i.id],s.id===-1)continue;if(i.edge_before===r.edge_before&&i.edge_after===r.edge_after&&s.edge_before===n.edge_before&&s.edge_after===n.edge_after)i.id=-1,s.id=-1,e=!0}}n=t.int_points2_sorted[0],r=t.int_points1[n.id];for(let o=1;o<t.int_points2_sorted.length;o++){let c=t.int_points2_sorted[o];if(c.id===-1)continue;if(n.id===-1||!Er(c.arc_length,n.arc_length)){n=c,r=t.int_points1[n.id];continue}let l=t.int_points1[c.id];if(l.edge_before===r.edge_before&&l.edge_after===r.edge_after&&c.edge_before===n.edge_before&&c.edge_after===n.edge_after)l.id=-1,c.id=-1,e=!0}if(e)t.int_points1=t.int_points1.filter((o)=>o.id>=0),t.int_points2=t.int_points2.filter((o)=>o.id>=0),t.int_points1.forEach((o,c)=>o.id=c),t.int_points2.forEach((o,c)=>o.id=c)}function nh(t){for(let e of t){if(e.edge_before)e.edge_before.bvStart=void 0,e.edge_before.bvEnd=void 0,e.edge_before.bv=void 0,e.edge_before.overlap=void 0;if(e.edge_after)e.edge_after.bvStart=void 0,e.edge_after.bvEnd=void 0,e.edge_after.bv=void 0,e.edge_after.overlap=void 0}for(let e of t){if(e.edge_before)e.edge_before.bvEnd=2;if(e.edge_after)e.edge_after.bvStart=2}}function ih(t,e){for(let r of t){if(r.edge_before)r.edge_before.setInclusion(e);if(r.edge_after)r.edge_after.setInclusion(e)}}function Z3(t){let e=void 0,r=void 0,n=void 0,i=t.int_points1.length;for(let s=0;s<i;s++){let o=t.int_points1_sorted[s];if(o.face!==e)r=s,e=o.face;let c=s,l=si(t.int_points1_sorted,s,e),a;if(c+l<i&&t.int_points1_sorted[c+l].face===e)a=c+l;else a=r;let p=si(t.int_points1_sorted,a,e);n=null;for(let S=a;S<a+p;S++){let P=t.int_points1_sorted[S];if(P.face===e&&t.int_points2[P.id].face===t.int_points2[o.id].face){n=P;break}}if(n===null)continue;let d=o.edge_after,m=n.edge_before;if(!(d.bv===2&&m.bv===2))continue;if(d!==m)continue;let f=t.int_points2[o.id],_=t.int_points2[n.id],g=f.edge_after,y=_.edge_before;if(!(g.bv===2&&y.bv===2&&g===y))f=t.int_points2[n.id],_=t.int_points2[o.id],g=f.edge_after,y=_.edge_before;if(!(g.bv===2&&y.bv===2&&g===y))continue;d.setOverlap(g)}}function si(t,e,r){let n,i,s=1;if(t.length===1)return 1;n=t[e];for(let o=e+1;o<t.length;o++){if(n.face!==r)break;if(i=t[o],!(i.pt.equalTo(n.pt)&&i.edge_before===n.edge_before&&i.edge_after===n.edge_after))break;s++}return s}function ai(t,e){if(!e)return;for(let r of e){let n=r.edge_before;if(r.is_vertex=0,n.shape.start&&n.shape.start.equalTo(r.pt))r.is_vertex|=1;if(n.shape.end&&n.shape.end.equalTo(r.pt))r.is_vertex|=2;if(r.is_vertex&1){if(r.edge_before=n.prev,n.prev)r.is_vertex=2;continue}if(r.is_vertex&2)continue;let i=t.addVertex(r.pt,n);r.edge_before=i}for(let r of e)if(r.edge_before)r.edge_after=r.edge_before.next;else if(t instanceof $r&&r.is_vertex&1)r.edge_after=t.first}function Hb(t,e,r){let n=t.edge_before,i=e.edge_after,s=r.length;n.next=r[0],r[0].prev=n,r[s-1].next=i,i.prev=r[s-1]}var{INSIDE:Fe,OUTSIDE:Me,BOUNDARY:Zt,OVERLAP_SAME:q3,OVERLAP_OPPOSITE:J3}=Ys,{NOT_VERTEX:pK,START_VERTEX:Qb,END_VERTEX:Zb}=Ys,Os=1,Po=2,Rr=3;function K3(t,e){let[r,n]=Bo(t,e,Os,!0);return r}function oh(t,e){let n=e.clone().reverse(),[i,s]=Bo(t,n,Rr,!0);return i}function w1(t,e){let[r,n]=Bo(t,e,Po,!0);return r}function A1(t,e){let[r,n]=Bo(t,e,Po,!1),i=[];for(let o of r.faces)i=[...i,...[...o.edges].map((c)=>c.shape)];let s=[];for(let o of n.faces)s=[...s,...[...o.edges].map((c)=>c.shape)];return[i,s]}function sh(t,e){let[r,n]=Bo(t,e,Rr,!1),i=[];for(let s of r.faces)i=[...i,...[...s.edges].map((o)=>o.shape)];return i}function P1(t,e){let r=t.clone(),n=e.clone(),i=B1(r,n);vo(i),ai(r,i.int_points1_sorted),ai(n,i.int_points2_sorted),fh(i),vo(i);let s=i.int_points1_sorted.map((c)=>c.pt),o=i.int_points2_sorted.map((c)=>c.pt);return[s,o]}function tA(t,e,r,n){let i=qb(t,r.int_points1),s=qb(e,r.int_points2);Jb(i,e),Jb(s,t),nh(r.int_points1),nh(r.int_points2),ih(r.int_points1,e),ih(r.int_points2,t);while(rA(t,e,r.int_points1,r.int_points1_sorted,r.int_points2,r));Z3(r),ah(t,n,r.int_points1_sorted,!0),ah(e,n,r.int_points2_sorted,!1),Kb(t,i,n,!0),Kb(e,s,n,!1)}function eA(t,e,r,n){nA(t,e,n,r.int_points2),iA(t,e,r),ch(t,r.int_points1),ch(e,r.int_points2),lh(t,r.int_points1,r.int_points2),lh(t,r.int_points2,r.int_points1),t1(t),t1(e)}function Bo(t,e,r,n){let i=t.clone(),s=e.clone(),o=B1(i,s);if(vo(o),ai(i,o.int_points1_sorted),ai(s,o.int_points2_sorted),fh(o),vo(o),tA(i,s,o,r),n)eA(i,s,o,r);return[i,s]}function B1(t,e){let r={int_points1:[],int_points2:[]};for(let n of t.edges){let i=e.edges.search(n.box);for(let s of i){let o=n.shape.intersect(s.shape);for(let c of o)oi(n,c,r.int_points1),oi(s,c,r.int_points2)}}return r}function qb(t,e){let r=[];for(let n of t.faces)if(!e.find((i)=>i.face===n))r.push(n);return r}function Jb(t,e){for(let r of t)r.first.bv=r.first.bvStart=r.first.bvEnd=void 0,r.first.setInclusion(e)}function rA(t,e,r,n,i,s){let o,c,l,a=n.length,p=!1;for(let d=0;d<a;d++){let m=n[d];if(m.face!==o)c=d,o=m.face;let f=d,_=si(n,d,o),g;if(f+_<a&&n[f+_].face===o)g=f+_;else g=c;let y=si(n,g,o);l=null;for(let b=g;b<g+y;b++){let C=n[b];if(C.face===o&&i[C.id].face===i[m.id].face){l=C;break}}if(l===null)continue;let S=m.edge_after,P=l.edge_before;if(S.bv===Zt&&P.bv!=Zt){S.bv=P.bv;continue}if(S.bv!=Zt&&P.bv===Zt){P.bv=S.bv;continue}if(S.bv===Zt&&P.bv===Zt&&S!=P||(S.bv===Fe&&P.bv===Me||S.bv===Me&&P.bv===Fe)){let b=S.next;while(b!=P)b.bvStart=void 0,b.bvEnd=void 0,b.bv=void 0,b.setInclusion(e),b=b.next}if(S.bv===Zt&&P.bv===Zt&&S!=P){let b=S.next,C;while(b!=P){if(b.bv!=Zt){if(C===void 0)C=b.bv;else if(b.bv!=C)throw $t.UNRESOLVED_BOUNDARY_CONFLICT}b=b.next}if(C!=null)S.bv=C,P.bv=C;continue}if(S.bv===Fe&&P.bv===Me||S.bv===Me&&P.bv===Fe){let b=S;while(b!=P){if(b.bvStart===S.bv&&b.bvEnd===P.bv){let[C,L]=b.shape.distanceTo(e);if(C<10*u.DP_TOL){oi(b,L.ps,r);let B=r[r.length-1];if(B.is_vertex&Qb)B.edge_after=b,B.edge_before=b.prev,b.bvStart=Zt,b.bv=void 0,b.setInclusion(e);else if(B.is_vertex&Zb)B.edge_after=b.next,b.bvEnd=Zt,b.bv=void 0,b.setInclusion(e);else{let j=e.addVertex(B.pt,b);B.edge_before=j,B.edge_after=j.next,j.setInclusion(e),j.next.bvStart=Zt,j.next.bvEnd=void 0,j.next.bv=void 0,j.next.setInclusion(e)}let k=e.findEdgeByPoint(L.pe);oi(k,L.pe,i);let I=i[i.length-1];if(I.is_vertex&Qb)I.edge_after=k,I.edge_before=k.prev;else if(I.is_vertex&Zb)I.edge_after=k.next;else{let j=i.find((lt)=>lt.edge_after===k),Q=e.addVertex(I.pt,k);if(I.edge_before=Q,I.edge_after=Q.next,j)j.edge_after=Q;Q.bvStart=void 0,Q.bvEnd=Zt,Q.bv=void 0,Q.setInclusion(t),Q.next.bvStart=Zt,Q.next.bvEnd=void 0,Q.next.bv=void 0,Q.next.setInclusion(t)}vo(s),p=!0;break}}b=b.next}if(p)break;throw $t.UNRESOLVED_BOUNDARY_CONFLICT}}return p}function ah(t,e,r,n){if(!r)return;let i=void 0,s=void 0,o,c;for(let l=0;l<r.length;l++){if(o=r[l],o.face!==i)s=l,i=o.face;if(i.isEmpty())continue;let a=l,p=si(r,l,i),d;if(a+p<r.length&&r[a+p].face===o.face)d=a+p;else d=s;c=r[d];let m=d,f=si(r,m,i),_=o.edge_after,g=c.edge_before;if(_.bv===Fe&&g.bv===Fe&&e===Os||_.bv===Me&&g.bv===Me&&e===Po||(_.bv===Me||g.bv===Me)&&e===Rr&&!n||(_.bv===Fe||g.bv===Fe)&&e===Rr&&n||_.bv===Zt&&g.bv===Zt&&_.overlap&q3&&n||_.bv===Zt&&g.bv===Zt&&_.overlap&J3){t.removeChain(i,_,g);for(let y=a;y<a+p;y++)r[y].edge_after=void 0;for(let y=m;y<m+f;y++)r[y].edge_before=void 0}l+=p-1}}function nA(t,e,r,n){for(let i of e.faces){for(let s of i)t.edges.add(s);if(n.find((s)=>s.face===i)===void 0)t.addFace(i.first,i.last)}}function iA(t,e,r){if(r.int_points1.length===0)return;for(let n=0;n<r.int_points1.length;n++){let i=r.int_points1[n],s=r.int_points2[n];if(i.edge_before!==void 0&&i.edge_after===void 0){if(s.edge_before===void 0&&s.edge_after!==void 0)i.edge_before.next=s.edge_after,s.edge_after.prev=i.edge_before,i.edge_after=s.edge_after,s.edge_before=i.edge_before}if(s.edge_before!==void 0&&s.edge_after===void 0){if(i.edge_before===void 0&&i.edge_after!==void 0)s.edge_before.next=i.edge_after,i.edge_after.prev=s.edge_before,s.edge_after=i.edge_after,i.edge_before=s.edge_before}if(i.edge_before!==void 0&&i.edge_after===void 0)for(let o of r.int_points1_sorted){if(o===i)continue;if(o.edge_before===void 0&&o.edge_after!==void 0){if(o.pt.equalTo(i.pt))i.edge_before.next=o.edge_after,o.edge_after.prev=i.edge_before,i.edge_after=o.edge_after,o.edge_before=i.edge_before}}if(s.edge_before!==void 0&&s.edge_after===void 0)for(let o of r.int_points2_sorted){if(o===s)continue;if(o.edge_before===void 0&&o.edge_after!==void 0){if(o.pt.equalTo(s.pt))s.edge_before.next=o.edge_after,o.edge_after.prev=s.edge_before,s.edge_after=o.edge_after,o.edge_before=s.edge_before}}}}function ch(t,e){for(let r of e){if(t.faces.delete(r.face),r.face=void 0,r.edge_before)r.edge_before.face=void 0;if(r.edge_after)r.edge_after.face=void 0}}function lh(t,e,r){for(let n of e){if(n.edge_before===void 0||n.edge_after===void 0)continue;if(n.face)continue;if(n.edge_after.face||n.edge_before.face)continue;let{edge_after:i,edge_before:s}=n;try{Ls.testInfiniteLoop(i)}catch(c){throw $t.CANNOT_COMPLETE_BOOLEAN_OPERATION}let o=t.addFace(i,s);for(let c of e)if(c.edge_before&&c.edge_after&&c.edge_before.face===o&&c.edge_after.face===o)c.face=o;for(let c of r)if(c.edge_before&&c.edge_after&&c.edge_before.face===o&&c.edge_after.face===o)c.face=o}}function Kb(t,e,r,n){for(let i of e){let s=i.first.bv;if(r===Os&&s===Fe||r===Rr&&s===Fe&&n||r===Rr&&s===Me&&!n||r===Po&&s===Me)t.deleteFace(i)}}function t1(t){let e=[];for(let r of t.edges)if(!r.face||!t.faces.has(r.face))e.push(r);for(let r of e)t.edges.delete(r)}var oA=Object.freeze({__proto__:null,BOOLEAN_INTERSECT:Po,BOOLEAN_SUBTRACT:Rr,BOOLEAN_UNION:Os,calculateIntersections:P1,innerClip:A1,intersect:w1,outerClip:sh,removeNotRelevantChains:ah,removeOldFaces:ch,restoreFaces:lh,subtract:oh,unify:K3}),sA=RegExp("T.F..FFF.|T.F...F.."),aA=RegExp("T........|.T.......|...T.....|....T...."),cA=RegExp("FT.......|F..T.....|F...T...."),lA=RegExp("T.F..F..."),pA=RegExp("T.F..F...|.TF..F...|..FT.F...|..F.TF...");class jr{constructor(){this.m=[,,,,,,,,,].fill(void 0)}get I2I(){return this.m[0]}set I2I(t){this.m[0]=t}get I2B(){return this.m[1]}set I2B(t){this.m[1]=t}get I2E(){return this.m[2]}set I2E(t){this.m[2]=t}get B2I(){return this.m[3]}set B2I(t){this.m[3]=t}get B2B(){return this.m[4]}set B2B(t){this.m[4]=t}get B2E(){return this.m[5]}set B2E(t){this.m[5]=t}get E2I(){return this.m[6]}set E2I(t){this.m[6]=t}get E2B(){return this.m[7]}set E2B(t){this.m[7]=t}get E2E(){return this.m[8]}set E2E(t){this.m[8]=t}toString(){return this.m.map((t)=>{if(t instanceof Array&&t.length>0)return"T";else if(t instanceof Array&&t.length===0)return"F";else return"*"}).join("")}equal(){return sA.test(this.toString())}intersect(){return aA.test(this.toString())}touch(){return cA.test(this.toString())}inside(){return lA.test(this.toString())}covered(){return pA.test(this.toString())}}function xo(t,e){let r=void 0,n=new u.Ray(e),i=new u.Line(n.pt,n.norm),s=new u.Box(n.box.xmin-u.DP_TOL,n.box.ymin-u.DP_TOL,n.box.xmax+u.DP_TOL,n.box.ymax+u.DP_TOL);if(t.box.not_intersect(s))return u.OUTSIDE;let o=t.edges.search(s);if(o.length===0)return u.OUTSIDE;for(let p of o)if(p.shape.contains(e))return u.BOUNDARY;let c=[...t.faces],l=[];for(let p of o)for(let d of n.intersect(p.shape)){if(d.equalTo(e))return u.BOUNDARY;l.push({pt:d,edge:p,face_index:c.indexOf(p.face)})}l.sort((p,d)=>{if(a1(p.pt.x,d.pt.x))return-1;if(s1(p.pt.x,d.pt.x))return 1;if(p.face_index<d.face_index)return-1;if(p.face_index>d.face_index)return 1;if(p.edge.arc_length<d.edge.arc_length)return-1;if(p.edge.arc_length>d.edge.arc_length)return 1;return 0});let a=0;for(let p=0;p<l.length;p++){let d=l[p];if(d.pt.equalTo(d.edge.shape.start)){if(p>0&&d.pt.equalTo(l[p-1].pt)&&d.face_index===l[p-1].face_index&&d.edge.prev===l[p-1].edge)continue;let m=d.edge.prev;while(rh(m.length))m=m.prev;let f=m.shape.tangentInEnd(),_=d.pt.translate(f),g=d.edge.shape.tangentInStart(),y=d.pt.translate(g),S=_.leftTo(i),P=y.leftTo(i);if(S&&!P||!S&&P)a++}else if(d.pt.equalTo(d.edge.shape.end)){if(p>0&&d.pt.equalTo(l[p-1].pt)&&d.face_index===l[p-1].face_index&&d.edge.next===l[p-1].edge)continue;let m=d.edge.next;while(rh(m.length))m=m.next;let f=m.shape.tangentInStart(),_=d.pt.translate(f),g=d.edge.shape.tangentInEnd(),y=d.pt.translate(g),S=_.leftTo(i),P=y.leftTo(i);if(S&&!P||!S&&P)a++}else if(d.edge.shape instanceof u.Segment)a++;else{let m=d.edge.shape.box;if(!(Er(d.pt.y,m.ymin)||Er(d.pt.y,m.ymax)))a++}}return r=a%2===1?1:0,r}function hA(t,e){return hi(t,e).equal()}function I1(t,e){return hi(t,e).intersect()}function dA(t,e){return hi(t,e).touch()}function mA(t,e){return!I1(t,e)}function F1(t,e){return hi(t,e).inside()}function M1(t,e){return hi(t,e).covered()}function uA(t,e){return F1(e,t)}function C1(t,e){return M1(e,t)}function hi(t,e){if(t instanceof u.Line&&e instanceof u.Line)return fA(t,e);else if(t instanceof u.Line&&e instanceof u.Circle)return yA(t,e);else if(t instanceof u.Line&&e instanceof u.Box)return _A(t,e);else if(t instanceof u.Line&&e instanceof u.Polygon)return gA(t,e);else if((t instanceof u.Segment||t instanceof u.Arc)&&e instanceof u.Polygon)return e1(t,e);else if((t instanceof u.Segment||t instanceof u.Arc)&&(e instanceof u.Circle||e instanceof u.Box))return e1(t,new u.Polygon(e));else if(t instanceof u.Polygon&&e instanceof u.Polygon)return ks(t,e);else if((t instanceof u.Circle||t instanceof u.Box)&&(e instanceof u.Circle||e instanceof u.Box))return ks(new u.Polygon(t),new u.Polygon(e));else if((t instanceof u.Circle||t instanceof u.Box)&&e instanceof u.Polygon)return ks(new u.Polygon(t),e);else if(t instanceof u.Polygon&&(e instanceof u.Circle||e instanceof u.Box))return ks(t,new u.Polygon(e))}function fA(t,e){let r=new jr,n=ci(t,e);if(n.length===0)if(t.contains(e.pt)&&e.contains(t.pt))r.I2I=[t],r.I2E=[],r.E2I=[];else r.I2I=[],r.I2E=[t],r.E2I=[e];else r.I2I=n,r.I2E=t.split(n),r.E2I=e.split(n);return r}function yA(t,e){let r=new jr,n=Wr(t,e);if(n.length===0)r.I2I=[],r.I2B=[],r.I2E=[t],r.E2I=[e];else if(n.length===1)r.I2I=[],r.I2B=n,r.I2E=t.split(n),r.E2I=[e];else{let i=new $r([t]),s=t.sortPoints(n);i.split(s);let o=i.toShapes();r.I2I=[o[1]],r.I2B=s,r.I2E=[o[0],o[2]],r.E2I=new u.Polygon([e.toArc()]).cutWithLine(t)}return r}function _A(t,e){let r=new jr,n=ii(t,e);if(n.length===0)r.I2I=[],r.I2B=[],r.I2E=[t],r.E2I=[e];else if(n.length===1)r.I2I=[],r.I2B=n,r.I2E=t.split(n),r.E2I=[e];else{let i=new $r([t]),s=t.sortPoints(n);i.split(s);let o=i.toShapes();if(e.toSegments().some((c)=>c.contains(n[0])&&c.contains(n[1])))r.I2I=[],r.I2B=[o[1]],r.I2E=[o[0],o[2]],r.E2I=[e];else r.I2I=[o[1]],r.I2B=s,r.I2E=[o[0],o[2]],r.E2I=new u.Polygon(e.toSegments()).cutWithLine(t)}return r}function gA(t,e){let r=new jr,n=Ao(t,e),i=new $r([t]),s=n.length>0?n.slice():t.sortPoints(n);return i.split(s),[...i].forEach((o)=>o.setInclusion(e)),r.I2I=[...i].filter((o)=>o.bv===u.INSIDE).map((o)=>o.shape),r.I2B=[...i].slice(1).map((o)=>o.bv===u.BOUNDARY?o.shape:o.shape.start),r.I2E=[...i].filter((o)=>o.bv===u.OUTSIDE).map((o)=>o.shape),r.E2I=e.cutWithLine(t),r}function e1(t,e){let r=new jr,n=V3(t,e),i=n.length>0?n.slice():t.sortPoints(n),s=new $r([t]);s.split(i),[...s].forEach((o)=>o.setInclusion(e)),r.I2I=[...s].filter((o)=>o.bv===u.INSIDE).map((o)=>o.shape),r.I2B=[...s].slice(1).map((o)=>o.bv===u.BOUNDARY?o.shape:o.shape.start),r.I2E=[...s].filter((o)=>o.bv===u.OUTSIDE).map((o)=>o.shape),r.B2I=[],r.B2B=[],r.B2E=[];for(let o of[t.start,t.end])switch(xo(e,o)){case u.INSIDE:r.B2I.push(o);break;case u.BOUNDARY:r.B2B.push(o);break;case u.OUTSIDE:r.B2E.push(o);break}return r}function ks(t,e){let r=new jr,[n,i]=P1(t,e),s=w1(t,e),o=oh(t,e),c=oh(e,t),[l,a]=A1(t,e),p=sh(t,e),d=sh(e,t);return r.I2I=s.isEmpty()?[]:[s],r.I2B=a,r.I2E=o.isEmpty()?[]:[o],r.B2I=l,r.B2B=n,r.B2E=p,r.E2I=c.isEmpty()?[]:[c],r.E2B=d,r}var xA=Object.freeze({__proto__:null,contain:uA,cover:C1,covered:M1,disjoint:mA,equal:hA,inside:F1,intersect:I1,relate:hi,touch:dA});class he{constructor(t=1,e=0,r=0,n=1,i=0,s=0){this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=s}fromMatrix3x3(t){let[e,r,n]=t[0],[i,s,o]=t[1];return new he(e,i,r,s,n,o)}toMatrix3x3(){return[[this.a,this.c,this.tx],[this.b,this.d,this.ty],[0,0,1]]}clone(){return new he(this.a,this.b,this.c,this.d,this.tx,this.ty)}transform(t){return[t[0]*this.a+t[1]*this.c+this.tx,t[0]*this.b+t[1]*this.d+this.ty]}multiply(t){return new he(this.a*t.a+this.c*t.b,this.b*t.a+this.d*t.b,this.a*t.c+this.c*t.d,this.b*t.c+this.d*t.d,this.a*t.tx+this.c*t.ty+this.tx,this.b*t.tx+this.d*t.ty+this.ty)}translate(...t){let e,r;if(t.length==1&&!isNaN(t[0].x)&&!isNaN(t[0].y))e=t[0].x,r=t[0].y;else if(t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number")e=t[0],r=t[1];else throw $t.ILLEGAL_PARAMETERS;return this.multiply(new he(1,0,0,1,e,r))}rotate(t,e=0,r=0){let n=Math.cos(t),i=Math.sin(t);return this.translate(e,r).multiply(new he(n,i,-i,n,0,0)).translate(-e,-r)}scale(t,e){return this.multiply(new he(t,0,0,e,0,0))}equalTo(t){if(!u.Utils.EQ(this.tx,t.tx))return!1;if(!u.Utils.EQ(this.ty,t.ty))return!1;if(!u.Utils.EQ(this.a,t.a))return!1;if(!u.Utils.EQ(this.b,t.b))return!1;if(!u.Utils.EQ(this.c,t.c))return!1;if(!u.Utils.EQ(this.d,t.d))return!1;return!0}}u.Matrix=he;var bA=(...t)=>new u.Matrix(...t);u.matrix=bA;class k1{constructor(t,e){this.low=t,this.high=e}get max(){return this.clone()}less_than(t){return this.low<t.low||this.low===t.low&&this.high<t.high}equal_to(t){return this.low===t.low&&this.high===t.high}intersect(t){return!this.not_intersect(t)}not_intersect(t){return this.high<t.low||t.high<this.low}merge(t){let e=this.low===void 0?t.low:this.low<t.low?this.low:t.low,r=this.high===void 0?t.high:this.high>t.high?this.high:t.high,n=this.clone();return n.low=e,n.high=r,n}output(){return[this.low,this.high]}comparable_less_than(t,e){return t<e}}class yh extends k1{clone(){return new yh(this.low,this.high)}}var Jt=1,Ot=0;class Ue{constructor(t,e,r=null,n=null,i=null,s=Ot){if(this.left=r,this.right=n,this.parent=i,this.color=s,this.item={key:void 0,values:[]},e!==void 0)this.item.values.push(e);if(t!==void 0)if(Array.isArray(t)){let[o,c]=t;if(!Number.isNaN(o)&&!Number.isNaN(c)){let l=o,a=c;if(l>a)[l,a]=[a,l];this.item.key=new yh(l,a)}}else this.item.key=t;this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0&&this.item.values.length===0&&this.left===null&&this.right===null&&this.color===Ot}requireKey(){if(!this.item.key)throw Error("Node key is undefined (nil/sentinel). Operation is not applicable.");return this.item.key}less_than(t){let e=this.requireKey(),r=t.requireKey();return e.less_than(r)}_value_equal(t){let e=this.item.values[0],r=t.item.values[0];return e&&r&&e.equal_to?e.equal_to(r):e===r}equal_to(t){let e=this.requireKey(),r=t.requireKey();return e.equal_to(r)}intersect(t){let e=this.requireKey(),r=t.requireKey();return e.intersect(r)}copy_data(t){this.item.key=t.item.key,this.item.values=t.item.values.slice()}update_max(){if(this.max=this.item.key?this.item.key.max:void 0,this.right&&this.right.max)this.max=this.max?this.max.merge(this.right.max):this.right.max;if(this.left&&this.left.max)this.max=this.max?this.max.merge(this.left.max):this.left.max}not_intersect_left_subtree(t){if(!this.left)return!0;let e=this.left.max?this.left.max.high:this.left.item.key.high,r=this.requireKey(),n=t.requireKey();return r.comparable_less_than(e,n.low)}not_intersect_right_subtree(t){if(!this.right)return!0;let e=this.right.max?this.right.max.low:this.right.item.key.low,r=this.requireKey(),n=t.requireKey();return r.comparable_less_than(n.high,e)}}class So{constructor(){this.root=null,this.nil_node=new Ue}get size(){let t=0;return this.tree_walk(this.root,(e)=>t+=e.item.values.length),t}get keys(){let t=[];return this.tree_walk(this.root,(e)=>t.push(e.item.key.output())),t}get values(){let t=[];return this.tree_walk(this.root,(e)=>{for(let r of e.item.values)t.push(r)}),t}get items(){let t=[];return this.tree_walk(this.root,(e)=>{let r=e.item.key.output();for(let n of e.item.values)t.push({key:r,value:n})}),t}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(t,e=t){if(t===void 0)return;let r=this.tree_search(this.root,new Ue(t));if(r)return r.item.values.push(e),r;let n=new Ue(t,e,this.nil_node,this.nil_node,null,Jt);return this.tree_insert(n),this.recalc_max(n),n}exist(t,e=t){let r=this.tree_search(this.root,new Ue(t));if(!r)return!1;if(arguments.length<2||e===t)return!0;return r.item.values.some((n)=>n&&n.equal_to?n.equal_to(e):n===e)}remove(t,e=t){let r=this.tree_search(this.root,new Ue(t));if(!r)return;if(arguments.length<2)return this.tree_delete(r),r;let n=r.item.values.findIndex((i)=>i&&i.equal_to?i.equal_to(e):i===e);if(n>=0){if(r.item.values.splice(n,1),r.item.values.length===0)this.tree_delete(r);return r}return}search(t,e=(r,n)=>r===n?n.output():r){let r=new Ue(t),n=[];this.tree_search_interval(this.root,r,n);let i=[];for(let s of n)for(let o of s.item.values)i.push(e(o,s.item.key));return i}intersect_any(t){let e=new Ue(t);return this.tree_find_any_interval(this.root,e)}forEach(t){this.tree_walk(this.root,(e)=>{for(let r of e.item.values)t(e.item.key,r)})}map(t){let e=new So;return this.tree_walk(this.root,(r)=>{for(let n of r.item.values)e.insert(r.item.key,t(n,r.item.key))}),e}*iterate(t,e=(r,n)=>r===n?n.output():r){let r=null;if(t)r=this.tree_search_nearest_forward(this.root,new Ue(t));else if(this.root)r=this.local_minimum(this.root);while(r){for(let n of r.item.values)yield e(n,r.item.key);r=this.tree_successor(r)}}recalc_max(t){let e=t;while(e.parent!=null)e.parent.update_max(),e=e.parent}tree_insert(t){let e=this.root,r=null;if(this.root==null||this.root===this.nil_node)this.root=t;else{while(e!==this.nil_node)if(r=e,t.less_than(e))e=e.left;else e=e.right;if(t.parent=r,t.less_than(r))r.left=t;else r.right=t}this.insert_fixup(t)}insert_fixup(t){let e,r;e=t;while(e!==this.root&&e.parent.color===Jt)if(e.parent===e.parent.parent.left)if(r=e.parent.parent.right,r.color===Jt)e.parent.color=Ot,r.color=Ot,e.parent.parent.color=Jt,e=e.parent.parent;else{if(e===e.parent.right)e=e.parent,this.rotate_left(e);e.parent.color=Ot,e.parent.parent.color=Jt,this.rotate_right(e.parent.parent)}else if(r=e.parent.parent.left,r.color===Jt)e.parent.color=Ot,r.color=Ot,e.parent.parent.color=Jt,e=e.parent.parent;else{if(e===e.parent.left)e=e.parent,this.rotate_right(e);e.parent.color=Ot,e.parent.parent.color=Jt,this.rotate_left(e.parent.parent)}this.root.color=Ot}tree_delete(t){let e,r;if(t.left===this.nil_node||t.right===this.nil_node)e=t;else e=this.tree_successor(t);if(e.left!==this.nil_node)r=e.left;else r=e.right;if(r.parent=e.parent,e===this.root)this.root=r;else{if(e===e.parent.left)e.parent.left=r;else e.parent.right=r;e.parent.update_max()}if(this.recalc_max(r),e!==t)t.copy_data(e),t.update_max(),this.recalc_max(t);if(e.color===Ot)this.delete_fixup(r)}delete_fixup(t){let e=t,r;while(e!==this.root&&e.parent!=null&&e.color===Ot)if(e===e.parent.left){if(r=e.parent.right,r.color===Jt)r.color=Ot,e.parent.color=Jt,this.rotate_left(e.parent),r=e.parent.right;if(r.left.color===Ot&&r.right.color===Ot)r.color=Jt,e=e.parent;else{if(r.right.color===Ot)r.color=Jt,r.left.color=Ot,this.rotate_right(r),r=e.parent.right;r.color=e.parent.color,e.parent.color=Ot,r.right.color=Ot,this.rotate_left(e.parent),e=this.root}}else{if(r=e.parent.left,r.color===Jt)r.color=Ot,e.parent.color=Jt,this.rotate_right(e.parent),r=e.parent.left;if(r.left.color===Ot&&r.right.color===Ot)r.color=Jt,e=e.parent;else{if(r.left.color===Ot)r.color=Jt,r.right.color=Ot,this.rotate_left(r),r=e.parent.left;r.color=e.parent.color,e.parent.color=Ot,r.left.color=Ot,this.rotate_right(e.parent),e=this.root}}e.color=Ot}tree_search(t,e){if(t==null||t===this.nil_node)return;if(e.equal_to(t))return t;if(e.less_than(t))return this.tree_search(t.left,e);else return this.tree_search(t.right,e)}tree_search_nearest_forward(t,e){let r=null,n=t;while(n&&n!==this.nil_node)if(n.less_than(e))if(n.intersect(e))r=n,n=n.left;else n=n.right;else{if(!r||n.less_than(r))r=n;n=n.left}return r||null}tree_search_interval(t,e,r){if(t!=null&&t!==this.nil_node){if(t.left!==this.nil_node&&!t.not_intersect_left_subtree(e))this.tree_search_interval(t.left,e,r);if(t.intersect(e))r.push(t);if(t.right!==this.nil_node&&!t.not_intersect_right_subtree(e))this.tree_search_interval(t.right,e,r)}}tree_find_any_interval(t,e){let r=!1;if(t!=null&&t!==this.nil_node){if(t.left!==this.nil_node&&!t.not_intersect_left_subtree(e))r=this.tree_find_any_interval(t.left,e);if(!r)r=t.intersect(e);if(!r&&t.right!==this.nil_node&&!t.not_intersect_right_subtree(e))r=this.tree_find_any_interval(t.right,e)}return r}local_minimum(t){let e=t;while(e.left!=null&&e.left!==this.nil_node)e=e.left;return e}local_maximum(t){let e=t;while(e.right!=null&&e.right!==this.nil_node)e=e.right;return e}tree_successor(t){let e,r,n;if(t.right!==this.nil_node)e=this.local_minimum(t.right);else{r=t,n=t.parent;while(n!=null&&n.right===r)r=n,n=n.parent;e=n}return e}rotate_left(t){let e=t.right;if(t.right=e.left,e.left!==this.nil_node)e.left.parent=t;if(e.parent=t.parent,t===this.root)this.root=e;else if(t===t.parent.left)t.parent.left=e;else t.parent.right=e;if(e.left=t,t.parent=e,t!==null&&t!==this.nil_node)t.update_max();if(e!=null&&e!==this.nil_node)e.update_max()}rotate_right(t){let e=t.left;if(t.left=e.right,e.right!==this.nil_node)e.right.parent=t;if(e.parent=t.parent,t===this.root)this.root=e;else if(t===t.parent.left)t.parent.left=e;else t.parent.right=e;if(e.right=t,t.parent=e,t!==null&&t!==this.nil_node)t.update_max();if(e!=null&&e!==this.nil_node)e.update_max()}tree_walk(t,e){if(t!=null&&t!==this.nil_node)this.tree_walk(t.left,e),e(t),this.tree_walk(t.right,e)}testRedBlackProperty(){let t=!0;return this.tree_walk(this.root,function(e){if(e.color===Jt){if(!(e.left.color===Ot&&e.right.color===Ot))t=!1}}),t}testBlackHeightProperty(t){let e=0,r=0,n=0;if(t.color===Ot)e++;if(t.left!==this.nil_node)r=this.testBlackHeightProperty(t.left);else r=1;if(t.right!==this.nil_node)n=this.testBlackHeightProperty(t.right);else n=1;if(r!==n)throw Error("Red-black height property violated");return e+=r,e}}class N1 extends Set{constructor(t){super(t);this.index=new So,this.forEach((e)=>this.index.insert(e))}add(t){let e=this.size,{key:r,value:n}=t,i=r||t.box,s=n||t;if(super.add(s),this.size>e)this.index.insert(i,s);return this}delete(t){let{key:e,value:r}=t,n=e||t.box,i=r||t,s=super.delete(i);if(s)this.index.remove(n,i);return s}clear(){super.clear(),this.index=new So}search(t){return this.index.search(t)}hit(t){let e=new u.Box(t.x-1,t.y-1,t.x+1,t.y+1);return this.index.search(e).filter((n)=>t.on(n))}svg(){return[...this].reduce((e,r)=>e+r.svg(),"")}}u.PlanarSet=N1;class Ge{get name(){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}get box(){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}clone(){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}translate(...t){return this.transform(new he().translate(...t))}rotate(t,e=new u.Point){return this.transform(new he().rotate(t,e.x,e.y))}scale(t,e){return this.transform(new he().scale(t,e))}transform(...t){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}toJSON(){return Object.assign({},this,{name:this.name})}svg(t={}){throw $t.CANNOT_INVOKE_ABSTRACT_METHOD}}var Y1=class t extends Ge{constructor(...e){super();if(this.x=0,this.y=0,e.length===0)return;if(e.length===1&&e[0]instanceof Array&&e[0].length===2){let r=e[0];if(typeof r[0]=="number"&&typeof r[1]=="number"){this.x=r[0],this.y=r[1];return}}if(e.length===1&&e[0]instanceof Object&&e[0].name==="point"){let{x:r,y:n}=e[0];this.x=r,this.y=n;return}if(e.length===2){if(typeof e[0]=="number"&&typeof e[1]=="number"){this.x=e[0],this.y=e[1];return}}throw $t.ILLEGAL_PARAMETERS}get box(){return new u.Box(this.x,this.y,this.x,this.y)}clone(){return new u.Point(this.x,this.y)}get vertices(){return[this.clone()]}equalTo(e){return u.Utils.EQ(this.x,e.x)&&u.Utils.EQ(this.y,e.y)}lessThan(e){if(u.Utils.LT(this.y,e.y))return!0;if(u.Utils.EQ(this.y,e.y)&&u.Utils.LT(this.x,e.x))return!0;return!1}transform(e){return new u.Point(e.transform([this.x,this.y]))}projectionOn(e){if(this.equalTo(e.pt))return this.clone();let r=new u.Vector(this,e.pt);if(u.Utils.EQ_0(r.cross(e.norm)))return e.pt.clone();let n=r.dot(e.norm),i=e.norm.multiply(n);return this.translate(i)}leftTo(e){let r=new u.Vector(e.pt,this);return u.Utils.GT(r.dot(e.norm),0)}distanceTo(e){if(e instanceof t){let r=e.x-this.x,n=e.y-this.y;return[Math.sqrt(r*r+n*n),new u.Segment(this,e)]}if(e instanceof u.Line)return u.Distance.point2line(this,e);if(e instanceof u.Circle)return u.Distance.point2circle(this,e);if(e instanceof u.Segment)return u.Distance.point2segment(this,e);if(e instanceof u.Arc)return u.Distance.point2arc(this,e);if(e instanceof u.Box)return u.Distance.point2polygon(this,new u.Polygon(e));if(e instanceof u.Polygon)return u.Distance.point2polygon(this,e);if(e instanceof u.PlanarSet)return u.Distance.shape2planarSet(this,e);if(e instanceof u.Multiline)return u.Distance.shape2multiline(this,e)}on(e){if(e instanceof u.Point)return this.equalTo(e);if(e.contains&&e.contains instanceof Function)return e.contains(this);throw u.Errors.UNSUPPORTED_SHAPE_TYPE}get name(){return"point"}svg(e={}){let r=e.r??3;return`
<circle cx="${this.x}" cy="${this.y}" r="${r}"
            ${Or({fill:"red",...e})} />`}};u.Point=Y1;var vA=(...t)=>new u.Point(...t);u.point=vA;var SA=class extends Ge{constructor(...e){super();if(this.x=0,this.y=0,e.length===0)return;if(e.length===1&&e[0]instanceof Array&&e[0].length===2){let r=e[0];if(typeof r[0]=="number"&&typeof r[1]=="number"){this.x=r[0],this.y=r[1];return}}if(e.length===1&&e[0]instanceof Object&&e[0].name==="vector"){let{x:r,y:n}=e[0];this.x=r,this.y=n;return}if(e.length===1&&e[0]instanceof Object&&e[0].name==="segment"){let{start:r,end:n}=e[0];this.x=n.x-r.x,this.y=n.y-r.y;return}if(e.length===2){let r=e[0],n=e[1];if(typeof r=="number"&&typeof n=="number"){this.x=r,this.y=n;return}if(r instanceof u.Point&&n instanceof u.Point){this.x=n.x-r.x,this.y=n.y-r.y;return}}throw $t.ILLEGAL_PARAMETERS}clone(){return new u.Vector(this.x,this.y)}get slope(){let e=Math.atan2(this.y,this.x);if(e<0)e=2*Math.PI+e;return e}get length(){return Math.sqrt(this.dot(this))}isZeroLength(){return u.Utils.EQ_0(this.length)}equalTo(e){return u.Utils.EQ(this.x,e.x)&&u.Utils.EQ(this.y,e.y)}multiply(e){return new u.Vector(e*this.x,e*this.y)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}normalize(){if(this.isZeroLength())throw $t.ZERO_DIVISION;return new u.Vector(this.x/this.length,this.y/this.length)}rotate(e,r=new u.Point){if(r.x===0&&r.y===0)return this.transform(new he().rotate(e));throw $t.OPERATION_IS_NOT_SUPPORTED}transform(e){return new u.Vector(e.transform([this.x,this.y]))}rotate90CCW(){return new u.Vector(-this.y,this.x)}rotate90CW(){return new u.Vector(this.y,-this.x)}invert(){return new u.Vector(-this.x,-this.y)}add(e){return new u.Vector(this.x+e.x,this.y+e.y)}subtract(e){return new u.Vector(this.x-e.x,this.y-e.y)}angleTo(e){let r=this.normalize(),n=e.normalize(),i=Math.atan2(r.cross(n),r.dot(n));if(i<0)i+=2*Math.PI;return i}projectionOn(e){let r=e.normalize(),n=this.dot(r);return r.multiply(n)}get name(){return"vector"}};u.Vector=SA;var L1=(...t)=>new u.Vector(...t);u.vector=L1;var T1=class t extends Ge{constructor(...e){super();if(this.ps=new u.Point,this.pe=new u.Point,e.length===0)return;if(e.length===1&&e[0]instanceof Array&&e[0].length===4){let r=e[0];this.ps=new u.Point(r[0],r[1]),this.pe=new u.Point(r[2],r[3]);return}if(e.length===1&&e[0]instanceof Object&&e[0].name==="segment"){let{ps:r,pe:n}=e[0];this.ps=new u.Point(r.x,r.y),this.pe=new u.Point(n.x,n.y);return}if(e.length===1&&e[0]instanceof u.Point){this.ps=e[0].clone();return}if(e.length===2&&e[0]instanceof u.Point&&e[1]instanceof u.Point){this.ps=e[0].clone(),this.pe=e[1].clone();return}if(e.length===4){this.ps=new u.Point(e[0],e[1]),this.pe=new u.Point(e[2],e[3]);return}throw $t.ILLEGAL_PARAMETERS}clone(){return new u.Segment(this.start,this.end)}get start(){return this.ps}get end(){return this.pe}get vertices(){return[this.ps.clone(),this.pe.clone()]}get length(){return this.start.distanceTo(this.end)[0]}get slope(){return new u.Vector(this.start,this.end).slope}get box(){return new u.Box(Math.min(this.start.x,this.end.x),Math.min(this.start.y,this.end.y),Math.max(this.start.x,this.end.x),Math.max(this.start.y,this.end.y))}equalTo(e){return this.ps.equalTo(e.ps)&&this.pe.equalTo(e.pe)}contains(e){return u.Utils.EQ_0(this.distanceToPoint(e))}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return wo(this,e);if(e instanceof u.Ray)return mh(e,this);if(e instanceof u.Segment)return Es(this,e);if(e instanceof u.Circle)return Rs(this,e);if(e instanceof u.Box)return R3(this,e);if(e instanceof u.Arc)return li(this,e);if(e instanceof u.Polygon)return hh(this,e);if(e instanceof u.Multiline)return pi(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2segment(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle){let[r,n]=u.Distance.segment2circle(this,e);return[r,n]}if(e instanceof u.Line){let[r,n]=u.Distance.segment2line(this,e);return[r,n]}if(e instanceof u.Segment){let[r,n]=u.Distance.segment2segment(this,e);return[r,n]}if(e instanceof u.Arc){let[r,n]=u.Distance.segment2arc(this,e);return[r,n]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2polygon(this,new u.Polygon(e));return[r,n]}if(e instanceof u.Polygon){let[r,n]=u.Distance.shape2polygon(this,e);return[r,n]}if(e instanceof u.PlanarSet){let[r,n]=u.Distance.shape2planarSet(this,e);return[r,n]}if(e instanceof u.Multiline)return u.Distance.shape2multiline(this,e)}tangentInStart(){return new u.Vector(this.start,this.end).normalize()}tangentInEnd(){return new u.Vector(this.end,this.start).normalize()}reverse(){return new t(this.end,this.start)}split(e){if(this.start.equalTo(e))return[null,this.clone()];if(this.end.equalTo(e))return[this.clone(),null];return[new u.Segment(this.start,e),new u.Segment(e,this.end)]}middle(){return new u.Point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}pointAtLength(e){if(e>this.length||e<0)return null;if(e==0)return this.start;if(e==this.length)return this.end;let r=e/this.length;return new u.Point((this.end.x-this.start.x)*r+this.start.x,(this.end.y-this.start.y)*r+this.start.y)}distanceToPoint(e){let[r,...n]=u.Distance.point2segment(e,this);return r}definiteIntegral(e=0){let r=this.end.x-this.start.x,n=this.start.y-e,i=this.end.y-e;return r*(n+i)/2}transform(e=new u.Matrix){return new t(this.ps.transform(e),this.pe.transform(e))}isZeroLength(){return this.ps.equalTo(this.pe)}sortPoints(e){return new u.Line(this.start,this.end).sortPoints(e)}get name(){return"segment"}svg(e={}){return`
<line x1="${this.start.x}" y1="${this.start.y}" x2="${this.end.x}" y2="${this.end.y}" ${Or(e)} />`}};u.Segment=T1;var wA=(...t)=>new u.Segment(...t);u.segment=wA;var{vector:go}=u,AA=class t extends Ge{constructor(...e){super();if(this.pt=new u.Point,this.norm=new u.Vector(0,1),e.length===0)return;if(e.length===1&&e[0]instanceof Object&&e[0].name==="line"){let{pt:r,norm:n}=e[0];this.pt=new u.Point(r),this.norm=new u.Vector(n);return}if(e.length===2){let r=e[0],n=e[1];if(r instanceof u.Point&&n instanceof u.Point){if(this.pt=r,this.norm=t.points2norm(r,n),this.norm.dot(go(this.pt.x,this.pt.y))>=0)this.norm.invert();return}if(r instanceof u.Point&&n instanceof u.Vector){if(u.Utils.EQ_0(n.x)&&u.Utils.EQ_0(n.y))throw $t.ILLEGAL_PARAMETERS;if(this.pt=r.clone(),this.norm=n.clone(),this.norm=this.norm.normalize(),this.norm.dot(go(this.pt.x,this.pt.y))>=0)this.norm.invert();return}if(r instanceof u.Vector&&n instanceof u.Point){if(u.Utils.EQ_0(r.x)&&u.Utils.EQ_0(r.y))throw $t.ILLEGAL_PARAMETERS;if(this.pt=n.clone(),this.norm=r.clone(),this.norm=this.norm.normalize(),this.norm.dot(go(this.pt.x,this.pt.y))>=0)this.norm.invert();return}}throw $t.ILLEGAL_PARAMETERS}clone(){return new u.Line(this.pt,this.norm)}get start(){return}get end(){return}get length(){return Number.POSITIVE_INFINITY}get box(){return new u.Box(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}get middle(){return}get slope(){return new u.Vector(this.norm.y,-this.norm.x).slope}get standard(){let e=this.norm.x,r=this.norm.y,n=this.norm.dot(go(this.pt.x,this.pt.y));return[e,r,n]}parallelTo(e){return u.Utils.EQ_0(this.norm.cross(e.norm))}incidentTo(e){return this.parallelTo(e)&&this.pt.on(e)}contains(e){if(this.pt.equalTo(e))return!0;let r=new u.Vector(this.pt,e);return u.Utils.EQ_0(this.norm.dot(r))}coord(e){return go(e.x,e.y).cross(this.norm)}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return ci(this,e);if(e instanceof u.Ray)return b1(e,this);if(e instanceof u.Circle)return Wr(this,e);if(e instanceof u.Box)return ii(this,e);if(e instanceof u.Segment)return wo(e,this);if(e instanceof u.Arc)return Ts(this,e);if(e instanceof u.Polygon)return Ao(this,e);if(e instanceof u.Multiline)return pi(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2line(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle){let[r,n]=u.Distance.circle2line(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Segment){let[r,n]=u.Distance.segment2line(e,this);return[r,n.reverse()]}if(e instanceof u.Arc){let[r,n]=u.Distance.arc2line(e,this);return[r,n.reverse()]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2polygon(this,new u.Polygon(e));return[r,n]}if(e instanceof u.Polygon){let[r,n]=u.Distance.shape2polygon(this,e);return[r,n]}}split(e){if(e instanceof u.Point)return[new u.Ray(e,this.norm),new u.Ray(e,this.norm)];else{let r=new u.Multiline([this]),n=this.sortPoints(e);return r.split(n),r.toShapes()}}rotate(e,r=new u.Point){return new u.Line(this.pt.rotate(e,r),this.norm.rotate(e))}transform(e){return new u.Line(this.pt.transform(e),this.norm.clone())}sortPoints(e){return e.slice().sort((r,n)=>{if(this.coord(r)<this.coord(n))return-1;if(this.coord(r)>this.coord(n))return 1;return 0})}get name(){return"line"}svg(e,r={}){let n=ii(this,e);if(n.length===0)return"";let i=n[0],s=n.length===2?n[1]:n.find((c)=>!c.equalTo(i));if(s===void 0)s=i;return new u.Segment(i,s).svg(r)}static points2norm(e,r){if(e.equalTo(r))throw $t.ILLEGAL_PARAMETERS;return new u.Vector(e,r).normalize().rotate90CCW()}};u.Line=AA;var PA=(...t)=>new u.Line(...t);u.line=PA;var E1=class extends Ge{constructor(...e){super();if(this.pc=new u.Point,this.r=1,e.length===1&&e[0]instanceof Object&&e[0].name==="circle"){let{pc:r,r:n}=e[0];this.pc=new u.Point(r),this.r=n}else{let[r,n]=[...e];if(r&&r instanceof u.Point)this.pc=r.clone();if(n!==void 0)this.r=n}}clone(){return new u.Circle(this.pc.clone(),this.r)}get center(){return this.pc}get box(){return new u.Box(this.pc.x-this.r,this.pc.y-this.r,this.pc.x+this.r,this.pc.y+this.r)}contains(e){if(e instanceof u.Point)return u.Utils.LE(e.distanceTo(this.center)[0],this.r);if(e instanceof u.Segment)return u.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&u.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof u.Arc)return this.intersect(e).length===0&&u.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&u.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof u.Circle)return this.intersect(e).length===0&&u.Utils.LE(e.r,this.r)&&u.Utils.LE(e.center.distanceTo(this.center)[0],this.r)}toArc(e=!0){return new u.Arc(this.center,this.r,Math.PI,-Math.PI,e)}scale(e,r){if(e!==r)throw $t.OPERATION_IS_NOT_SUPPORTED;if(!(this.pc.x===0&&this.pc.y===0))throw $t.OPERATION_IS_NOT_SUPPORTED;return new u.Circle(this.pc,this.r*e)}transform(e=new u.Matrix){return new u.Circle(this.pc.transform(e),this.r)}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return Wr(e,this);if(e instanceof u.Ray)return x1(e,this);if(e instanceof u.Segment)return Rs(e,this);if(e instanceof u.Circle)return p1(e,this);if(e instanceof u.Box)return O3(this,e);if(e instanceof u.Arc)return ph(e,this);if(e instanceof u.Polygon)return f1(this,e);if(e instanceof u.Multiline)return pi(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2circle(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle){let[r,n]=u.Distance.circle2circle(this,e);return[r,n]}if(e instanceof u.Line){let[r,n]=u.Distance.circle2line(this,e);return[r,n]}if(e instanceof u.Segment){let[r,n]=u.Distance.segment2circle(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Arc){let[r,n]=u.Distance.arc2circle(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Box){let[r,n]=u.Distance.shape2polygon(this,new u.Polygon(e));return[r,n]}if(e instanceof u.Polygon){let[r,n]=u.Distance.shape2polygon(this,e);return[r,n]}if(e instanceof u.PlanarSet){let[r,n]=u.Distance.shape2planarSet(this,e);return[r,n]}if(e instanceof u.Multiline){let[r,n]=u.Distance.shape2multiline(this,e);return[r,n]}}get name(){return"circle"}svg(e={}){return`
<circle cx="${this.pc.x}" cy="${this.pc.y}" r="${this.r}"
                ${Or({fill:"none",...e})} />`}};u.Circle=E1;var BA=(...t)=>new u.Circle(...t);u.circle=BA;class _h extends Ge{constructor(...t){super();if(this.pc=new u.Point,this.r=1,this.startAngle=0,this.endAngle=2*Math.PI,this.counterClockwise=!0,t.length===0)return;if(t.length===1&&t[0]instanceof Object&&t[0].name==="arc"){let{pc:e,r,startAngle:n,endAngle:i,counterClockwise:s}=t[0];this.pc=new u.Point(e.x,e.y),this.r=r,this.startAngle=n,this.endAngle=i,this.counterClockwise=s}else{let[e,r,n,i,s]=[...t];if(e&&e instanceof u.Point)this.pc=e.clone();if(r!==void 0)this.r=r;if(n!==void 0)this.startAngle=n;if(i!==void 0)this.endAngle=i;if(s!==void 0)this.counterClockwise=s}}clone(){return new u.Arc(this.pc.clone(),this.r,this.startAngle,this.endAngle,this.counterClockwise)}get sweep(){let t=this.startAngle,e=this.endAngle;if(u.Utils.EQ(Math.abs(t-e),u.PIx2))return u.PIx2;if(Math.abs(t)>u.PIx2)t-=Math.trunc(t/u.PIx2)*u.PIx2;if(t<0)t+=u.PIx2;if(Math.abs(e)>u.PIx2)e-=Math.trunc(e/u.PIx2)*u.PIx2;if(e<0)e+=u.PIx2;let r=this.counterClockwise?e-t:t-e;if(r<0)r+=u.PIx2;return r}get start(){return new u.Point(this.pc.x+this.r,this.pc.y).rotate(this.startAngle,this.pc)}get end(){return new u.Point(this.pc.x+this.r,this.pc.y).rotate(this.endAngle,this.pc)}get center(){return this.pc.clone()}get vertices(){return[this.start.clone(),this.end.clone()]}get length(){return Math.abs(this.sweep*this.r)}get box(){let e=this.breakToFunctional().reduce((r,n)=>r.merge(n.start.box),new u.Box);return e=e.merge(this.end.box),e}contains(t){if(!u.Utils.EQ(this.pc.distanceTo(t)[0],this.r))return!1;if(t.equalTo(this.start))return!0;let e=new u.Vector(this.pc,t).slope,r=new u.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise);return u.Utils.LE(r.length,this.length)}split(t){if(this.start.equalTo(t))return[null,this.clone()];if(this.end.equalTo(t))return[this.clone(),null];let e=new u.Vector(this.pc,t).slope;return[new u.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise),new u.Arc(this.pc,this.r,e,this.endAngle,this.counterClockwise)]}middle(){let t=this.counterClockwise?this.startAngle+this.sweep/2:this.startAngle-this.sweep/2;return new u.Arc(this.pc,this.r,this.startAngle,t,this.counterClockwise).end}pointAtLength(t){if(t>this.length||t<0)return null;if(t===0)return this.start;if(t===this.length)return this.end;let e=t/this.length,r=this.counterClockwise?this.startAngle+this.sweep*e:this.startAngle-this.sweep*e;return new u.Arc(this.pc,this.r,this.startAngle,r,this.counterClockwise).end}chordHeight(){return(1-Math.cos(Math.abs(this.sweep/2)))*this.r}intersect(t){if(t instanceof u.Point)return this.contains(t)?[t]:[];if(t instanceof u.Line)return Ts(t,this);if(t instanceof u.Ray)return uh(t,this);if(t instanceof u.Circle)return ph(this,t);if(t instanceof u.Segment)return li(t,this);if(t instanceof u.Box)return W3(this,t);if(t instanceof u.Arc)return h1(this,t);if(t instanceof u.Polygon)return dh(this,t);if(t instanceof u.Multiline)return pi(this,t)}distanceTo(t){if(t instanceof u.Point){let[e,r]=u.Distance.point2arc(t,this);return r=r.reverse(),[e,r]}if(t instanceof u.Circle){let[e,r]=u.Distance.arc2circle(this,t);return[e,r]}if(t instanceof u.Line){let[e,r]=u.Distance.arc2line(this,t);return[e,r]}if(t instanceof u.Segment){let[e,r]=u.Distance.segment2arc(t,this);return r=r.reverse(),[e,r]}if(t instanceof u.Arc){let[e,r]=u.Distance.arc2arc(this,t);return[e,r]}if(t instanceof u.Box){let[e,r]=u.Distance.shape2polygon(this,new u.Polygon(t));return[e,r]}if(t instanceof u.Polygon){let[e,r]=u.Distance.shape2polygon(this,t);return[e,r]}if(t instanceof u.PlanarSet){let[e,r]=u.Distance.shape2planarSet(this,t);return[e,r]}if(t instanceof u.Multiline)return u.Distance.shape2multiline(this,t)}breakToFunctional(){let t=[],e=[0,Math.PI/2,Math.PI,3*Math.PI/2],r=this.startAngle,n=this.endAngle;if(u.Utils.EQ(Math.abs(r-n),u.PIx2))n=r;if(Math.abs(r)>u.PIx2)r-=Math.trunc(r/u.PIx2)*u.PIx2;if(r<0)r+=u.PIx2;if(Math.abs(n)>u.PIx2)n-=Math.trunc(n/u.PIx2)*u.PIx2;if(n<0)n+=u.PIx2;let i=r,s,o,c;if(this.counterClockwise)o=Math.ceil(r/(Math.PI/2))%4,c=1;else o=Math.floor(r/(Math.PI/2))%4,c=-1;for(let l=0,a=o;l<4;l++,a=(a+c+4)%4){if(s=e[a],s===i)continue;let p=this.counterClockwise?s-r:r-s;if(p<0)p+=u.PIx2;if(p>this.sweep)break;t.push(new u.Arc(this.pc,this.r,i,s,this.counterClockwise)),i=s}if(t.length===0)return t.push(this),t;if(s=n,i!==s)t.push(new u.Arc(this.pc,this.r,i,s,this.counterClockwise));return t}tangentInStart(){let t=new u.Vector(this.pc,this.start),e=this.counterClockwise?Math.PI/2:-Math.PI/2;return t.rotate(e).normalize()}tangentInEnd(){let t=new u.Vector(this.pc,this.end),e=this.counterClockwise?-Math.PI/2:Math.PI/2;return t.rotate(e).normalize()}reverse(){return new u.Arc(this.pc,this.r,this.endAngle,this.startAngle,!this.counterClockwise)}transform(t=new u.Matrix){let e=this.start.transform(t),r=this.end.transform(t),n=this.pc.transform(t),i=this.counterClockwise;if(t.a*t.d<0)i=!i;return u.Arc.arcSE(n,e,r,i)}static arcSE(t,e,r,n){let{vector:i}=u,s=i(t,e).slope,o=i(t,r).slope;if(u.Utils.EQ(s,o))o+=2*Math.PI,n=!0;let c=i(t,e).length;return new u.Arc(t,c,s,o,n)}definiteIntegral(t=0){return this.breakToFunctional().reduce((n,i)=>n+i.circularSegmentDefiniteIntegral(t),0)}circularSegmentDefiniteIntegral(t){let r=new u.Segment(this.start,this.end).definiteIntegral(t),n=u.Utils.EQ(this.sweep,u.PIx2)?0:this.circularSegmentArea();return this.counterClockwise?r-n:r+n}circularSegmentArea(){return 0.5*this.r*this.r*(this.sweep-Math.sin(this.sweep))}sortPoints(t){let{vector:e}=u;return t.slice().sort((r,n)=>{let i=e(this.pc,r).slope,s=e(this.pc,n).slope;if(i<s)return-1;if(i>s)return 1;return 0})}get name(){return"arc"}svg(t={}){let e=this.sweep<=Math.PI?"0":"1",r=this.counterClockwise?"1":"0";if(u.Utils.EQ(this.sweep,2*Math.PI))return new u.Circle(this.pc,this.r).svg(t);else return`
<path d="M${this.start.x},${this.start.y}
                             A${this.r},${this.r} 0 ${e},${r} ${this.end.x},${this.end.y}"
                    ${Or({fill:"none",...t})} />`}}u.Arc=_h;var IA=(...t)=>new u.Arc(...t);u.arc=IA;class Tr extends Ge{constructor(t=void 0,e=void 0,r=void 0,n=void 0){super();this.xmin=t,this.ymin=e,this.xmax=r,this.ymax=n}clone(){return new Tr(this.xmin,this.ymin,this.xmax,this.ymax)}get low(){return new u.Point(this.xmin,this.ymin)}get high(){return new u.Point(this.xmax,this.ymax)}get max(){return this.clone()}get center(){return new u.Point((this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)}get width(){return Math.abs(this.xmax-this.xmin)}get height(){return Math.abs(this.ymax-this.ymin)}get box(){return this.clone()}not_intersect(t){return this.xmax<t.xmin||this.xmin>t.xmax||this.ymax<t.ymin||this.ymin>t.ymax}intersect(t){return!this.not_intersect(t)}merge(t){return new Tr(this.xmin===void 0?t.xmin:Math.min(this.xmin,t.xmin),this.ymin===void 0?t.ymin:Math.min(this.ymin,t.ymin),this.xmax===void 0?t.xmax:Math.max(this.xmax,t.xmax),this.ymax===void 0?t.ymax:Math.max(this.ymax,t.ymax))}less_than(t){if(this.low.lessThan(t.low))return!0;if(this.low.equalTo(t.low)&&this.high.lessThan(t.high))return!0;return!1}equal_to(t){return this.low.equalTo(t.low)&&this.high.equalTo(t.high)}output(){return this.clone()}comparable_less_than(t,e){return t.lessThan(e)}set(t,e,r,n){this.xmin=t,this.ymin=e,this.xmax=r,this.ymax=n}extend(t){if(t<=0)return this.clone();return new Tr(this.xmin-t,this.ymin-t,this.xmax+t,this.ymax+t)}toPoints(){return[new u.Point(this.xmin,this.ymin),new u.Point(this.xmax,this.ymin),new u.Point(this.xmax,this.ymax),new u.Point(this.xmin,this.ymax)]}toSegments(){let t=this.toPoints();return[new u.Segment(t[0],t[1]),new u.Segment(t[1],t[2]),new u.Segment(t[2],t[3]),new u.Segment(t[3],t[0])]}rotate(t,e=new u.Point){throw $t.OPERATION_IS_NOT_SUPPORTED}transform(t=new u.Matrix){return this.toPoints().map((r)=>r.transform(t)).reduce((r,n)=>r.merge(n.box),new Tr)}contains(t){if(t instanceof u.Point)return t.x>=this.xmin&&t.x<=this.xmax&&t.y>=this.ymin&&t.y<=this.ymax;if(t instanceof u.Segment)return t.vertices.every((e)=>this.contains(e));if(t instanceof u.Box)return t.toSegments().every((e)=>this.contains(e));if(t instanceof u.Circle)return this.contains(t.box);if(t instanceof u.Arc)return t.vertices.every((e)=>this.contains(e))&&this.toSegments().every((e)=>li(e,t).length===0);if(t instanceof u.Line||t instanceof u.Ray)return!1;if(t instanceof u.Multiline)return t.toShapes().every((e)=>this.contains(e));if(t instanceof u.Polygon)return this.contains(t.box)}distanceTo(t){let e=this.toSegments().map((n)=>n.distanceTo(t)),r=[Number.MAX_SAFE_INTEGER,null];return e.forEach((n)=>{if(n[0]<r[0])r=n}),r}get name(){return"box"}svg(t={}){let e=this.xmax-this.xmin,r=this.ymax-this.ymin;return`
<rect x="${this.xmin}" y="${this.ymin}" width="${e}" height="${r}"
                ${Or({fill:"none",...t})} />`}}u.Box=Tr;var FA=(...t)=>new u.Box(...t);u.box=FA;class R1{constructor(t){this.shape=t,this.next=void 0,this.prev=void 0,this.face=void 0,this.arc_length=0,this.bvStart=void 0,this.bvEnd=void 0,this.bv=void 0,this.overlap=void 0}get start(){return this.shape.start}get end(){return this.shape.end}get length(){return this.shape.length}get box(){return this.shape.box}get isSegment(){return this.shape instanceof u.Segment}get isArc(){return this.shape instanceof u.Arc}get isLine(){return this.shape instanceof u.Line}get isRay(){return this.shape instanceof u.Ray}middle(){return this.shape.middle()}pointAtLength(t){return this.shape.pointAtLength(t)}contains(t){return this.shape.contains(t)}setInclusion(t){if(this.bv!==void 0)return this.bv;if(this.shape instanceof u.Line||this.shape instanceof u.Ray)return this.bv=u.OUTSIDE,this.bv;if(this.bvStart===void 0)this.bvStart=xo(t,this.start);if(this.bvEnd===void 0)this.bvEnd=xo(t,this.end);if(this.bvStart===u.OUTSIDE||this.bvEnd==u.OUTSIDE)this.bv=u.OUTSIDE;else if(this.bvStart===u.INSIDE||this.bvEnd==u.INSIDE)this.bv=u.INSIDE;else{let e=xo(t,this.middle());this.bv=e}return this.bv}setOverlap(t){let e=void 0,r=this.shape,n=t.shape;if(r instanceof u.Segment&&n instanceof u.Segment){if(r.start.equalTo(n.start)&&r.end.equalTo(n.end))e=u.OVERLAP_SAME;else if(r.start.equalTo(n.end)&&r.end.equalTo(n.start))e=u.OVERLAP_OPPOSITE}else if(r instanceof u.Arc&&n instanceof u.Arc){if(r.start.equalTo(n.start)&&r.end.equalTo(n.end)&&r.middle().equalTo(n.middle()))e=u.OVERLAP_SAME;else if(r.start.equalTo(n.end)&&r.end.equalTo(n.start)&&r.middle().equalTo(n.middle()))e=u.OVERLAP_OPPOSITE}else if(r instanceof u.Segment&&n instanceof u.Arc||r instanceof u.Arc&&n instanceof u.Segment){if(r.start.equalTo(n.start)&&r.end.equalTo(n.end)&&r.middle().equalTo(n.middle()))e=u.OVERLAP_SAME;else if(r.start.equalTo(n.end)&&r.end.equalTo(n.start)&&r.middle().equalTo(n.middle()))e=u.OVERLAP_OPPOSITE}if(this.overlap===void 0)this.overlap=e;if(t.overlap===void 0)t.overlap=e}svg(){if(this.shape instanceof u.Segment)return` L${this.shape.end.x},${this.shape.end.y}`;else if(this.shape instanceof u.Arc){let t=this.shape,e,r=t.counterClockwise?"1":"0";if(u.Utils.EQ(t.sweep,2*Math.PI)){let n=t.counterClockwise?1:-1,i=new u.Arc(t.pc,t.r,t.startAngle,t.startAngle+n*Math.PI,t.counterClockwise),s=new u.Arc(t.pc,t.r,t.startAngle+n*Math.PI,t.endAngle,t.counterClockwise);return e="0",` A${i.r},${i.r} 0 ${e},${r} ${i.end.x},${i.end.y}
                    A${s.r},${s.r} 0 ${e},${r} ${s.end.x},${s.end.y}`}else return e=t.sweep<=Math.PI?"0":"1",` A${t.r},${t.r} 0 ${e},${r} ${t.end.x},${t.end.y}`}}toJSON(){return this.shape.toJSON()}}u.Edge=R1;class O1 extends Ls{constructor(t,e){super(t,e);this.setCircularLinks()}setCircularLinks(){if(this.isEmpty())return;this.last.next=this.first,this.first.prev=this.last}[Symbol.iterator](){let t=void 0;return{next:()=>{let e=t?t:this.first,r=this.first?t?t===this.first:!1:!0;return t=e?e.next:void 0,{value:e,done:r}}}}append(t){return super.append(t),this.setCircularLinks(),this}insert(t,e){return super.insert(t,e),this.setCircularLinks(),this}remove(t){return super.remove(t),this}}class ri extends O1{constructor(t,...e){super();if(this._box=void 0,this._orientation=void 0,e.length===0)return;if(e.length===1){if(e[0]instanceof Array){let r=e[0];if(r.length===0)return;if(r.every((n)=>n instanceof u.Point)){let n=ri.points2segments(r);this.shapes2face(t.edges,n)}else if(r.every((n)=>n instanceof Array&&n.length===2)){let n=r.map((s)=>new u.Point(s[0],s[1])),i=ri.points2segments(n);this.shapes2face(t.edges,i)}else if(r.every((n)=>n instanceof u.Segment||n instanceof u.Arc))this.shapes2face(t.edges,r);else if(r.every((n)=>n.name==="segment"||n.name==="arc")){let n=[];for(let i of r){let s;if(i.name==="segment")s=new u.Segment(i);else s=new u.Arc(i);n.push(s)}this.shapes2face(t.edges,n)}}else if(e[0]instanceof ri){let r=e[0];this.first=r.first,this.last=r.last;for(let n of r)t.edges.add(n)}else if(e[0]instanceof u.Circle)this.shapes2face(t.edges,[e[0].toArc(!0)]);else if(e[0]instanceof u.Box){let r=e[0];this.shapes2face(t.edges,[new u.Segment(new u.Point(r.xmin,r.ymin),new u.Point(r.xmax,r.ymin)),new u.Segment(new u.Point(r.xmax,r.ymin),new u.Point(r.xmax,r.ymax)),new u.Segment(new u.Point(r.xmax,r.ymax),new u.Point(r.xmin,r.ymax)),new u.Segment(new u.Point(r.xmin,r.ymax),new u.Point(r.xmin,r.ymin))])}}if(e.length===2&&e[0]instanceof u.Edge&&e[1]instanceof u.Edge)this.first=e[0],this.last=e[1],this.last.next=this.first,this.first.prev=this.last,this.setArcLength()}get edges(){return this.toArray()}get vertices(){return this.edges.map((t)=>t.shape.start.clone())}get shapes(){return this.edges.map((t)=>t.shape.clone())}get box(){if(this._box===void 0){let t=new u.Box;for(let e of this)t=t.merge(e.box);this._box=t}return this._box}get perimeter(){return this.last.arc_length+this.last.length}pointAtLength(t){if(t>this.perimeter||t<0)return null;let e=null;for(let r of this)if(t>=r.arc_length&&(r===this.last||t<r.next.arc_length)){e=r.pointAtLength(t-r.arc_length);break}return e}static points2segments(t){let e=[];for(let r=0;r<t.length;r++){if(t[r].equalTo(t[(r+1)%t.length]))continue;e.push(new u.Segment(t[r],t[(r+1)%t.length]))}return e}shapes2face(t,e){for(let r of e){let n=new u.Edge(r);this.append(n),t.add(n)}}append(t){return super.append(t),this.setOneEdgeArcLength(t),t.face=this,this}insert(t,e){return super.insert(t,e),this.setOneEdgeArcLength(t),t.face=this,this}remove(t){return super.remove(t),this.setArcLength(),this}merge_with_next_edge(t){return t.shape.end.x=t.next.shape.end.x,t.shape.end.y=t.next.shape.end.y,this.remove(t.next),this}reverse(){let t=[],e=this.last;do e.shape=e.shape.reverse(),t.push(e),e=e.prev;while(e!==this.last);this.first=void 0,this.last=void 0;for(let r of t){if(this.first===void 0)r.prev=r,r.next=r,this.first=r,this.last=r;else r.prev=this.last,this.last.next=r,this.last=r,this.last.next=this.first,this.first.prev=this.last;this.setOneEdgeArcLength(r)}if(this._orientation!==void 0)this._orientation=void 0,this._orientation=this.orientation()}setArcLength(){for(let t of this)this.setOneEdgeArcLength(t),t.face=this}setOneEdgeArcLength(t){if(t===this.first)t.arc_length=0;else t.arc_length=t.prev.arc_length+t.prev.length}area(){return Math.abs(this.signedArea())}signedArea(){let t=0,e=this.box.ymin;for(let r of this)t+=r.shape.definiteIntegral(e);return t}orientation(){if(this._orientation===void 0){let t=this.signedArea();if(u.Utils.EQ_0(t))this._orientation=ni.NOT_ORIENTABLE;else if(u.Utils.LT(t,0))this._orientation=ni.CCW;else this._orientation=ni.CW}return this._orientation}isSimple(t){return ri.getSelfIntersections(this,t,!0).length===0}static getSelfIntersections(t,e,r=!1){let n=[];for(let i of t){let s=e.search(i.box);for(let o of s){if(i===o)continue;if(o.face!==t)continue;if(i.shape instanceof u.Segment&&o.shape instanceof u.Segment&&(i.next===o||i.prev===o))continue;let c=i.shape.intersect(o.shape);for(let l of c){if(l.equalTo(i.start)&&l.equalTo(o.end)&&o===i.prev)continue;if(l.equalTo(i.end)&&l.equalTo(o.start)&&o===i.next)continue;if(n.push(l),r)break}if(n.length>0&&r)break}if(n.length>0&&r)break}return n}findEdgeByPoint(t){let e;for(let r of this){if(t.equalTo(r.shape.start))continue;if(t.equalTo(r.shape.end)||r.shape.contains(t)){e=r;break}}return e}toPolygon(){return new u.Polygon(this.shapes)}toJSON(){return this.edges.map((t)=>t.toJSON())}svg(){let t=`M${this.first.start.x},${this.first.start.y}`;for(let e of this)t+=e.svg();return t+=" z",t}}u.Face=ri;class gh extends Ge{constructor(...t){super();if(this.pt=new u.Point,this.norm=new u.Vector(0,1),t.length===0)return;if(t.length>=1&&t[0]instanceof u.Point)this.pt=t[0].clone();if(t.length===1)return;if(t.length===2&&t[1]instanceof u.Vector){this.norm=t[1].clone();return}throw $t.ILLEGAL_PARAMETERS}clone(){return new gh(this.pt,this.norm)}get slope(){return new u.Vector(this.norm.y,-this.norm.x).slope}get box(){let t=this.slope;return new u.Box(t>Math.PI/2&&t<3*Math.PI/2?Number.NEGATIVE_INFINITY:this.pt.x,t>=0&&t<=Math.PI?this.pt.y:Number.NEGATIVE_INFINITY,t>=Math.PI/2&&t<=3*Math.PI/2?this.pt.x:Number.POSITIVE_INFINITY,t>=Math.PI&&t<=2*Math.PI||t===0?this.pt.y:Number.POSITIVE_INFINITY)}get start(){return this.pt}get end(){return}get length(){return Number.POSITIVE_INFINITY}contains(t){if(this.pt.equalTo(t))return!0;let e=new u.Vector(this.pt,t);return u.Utils.EQ_0(this.norm.dot(e))&&u.Utils.GE(e.cross(this.norm),0)}coord(t){return L1(t.x,t.y).cross(this.norm)}split(t){if(!this.contains(t))return[];if(this.pt.equalTo(t))return[this];return[new u.Segment(this.pt,t),new u.Ray(t,this.norm)]}intersect(t){if(t instanceof u.Point)return this.contains(t)?[t]:[];if(t instanceof u.Segment)return mh(this,t);if(t instanceof u.Arc)return uh(this,t);if(t instanceof u.Line)return b1(this,t);if(t instanceof u.Ray)return U3(this,t);if(t instanceof u.Circle)return x1(this,t);if(t instanceof u.Box)return z3(this,t);if(t instanceof u.Polygon)return v1(this,t);if(t instanceof u.Multiline)return pi(this,t)}rotate(t,e=new u.Point){return new u.Ray(this.pt.rotate(t,e),this.norm.rotate(t))}transform(t){return new u.Ray(this.pt.transform(t),this.norm.clone())}get name(){return"ray"}svg(t,e={}){let r=new u.Line(this.pt,this.norm),n=ii(r,t);if(n=n.filter((s)=>this.contains(s)),n.length===0||n.length===2)return"";return new u.Segment(this.pt,n[0]).svg(e)}}u.Ray=gh;var MA=(...t)=>new u.Ray(...t);u.ray=MA;var W1=class t{constructor(){this.faces=new u.PlanarSet,this.edges=new u.PlanarSet;let e=[...arguments];if(e.length===1&&(e[0]instanceof Array&&e[0].length>0||e[0]instanceof u.Circle||e[0]instanceof u.Box)){let r=e[0];if(e[0]instanceof Array&&e[0].every((n)=>n instanceof Array))if(r.every((n)=>n instanceof Array&&n.length===2&&typeof n[0]==="number"&&typeof n[1]==="number"))this.faces.add(new u.Face(this,r));else for(let n of r)if(n instanceof Array&&n[0]instanceof Array&&n[0].every((i)=>i instanceof Array&&i.length===2&&typeof i[0]==="number"&&typeof i[1]==="number"))for(let i of n)this.faces.add(new u.Face(this,i));else this.faces.add(new u.Face(this,n));else this.faces.add(new u.Face(this,r))}}get box(){return[...this.faces].reduce((e,r)=>e.merge(r.box),new u.Box)}get vertices(){return[...this.faces].flatMap((e)=>e.vertices)}clone(){let e=new t;for(let r of this.faces)e.addFace(r.shapes);return e}createFromArray(e){let r=new t;return e.forEach((n)=>[...n.faces].forEach((i)=>r.addFace(i.shapes))),r}isEmpty(){return this.edges.size===0||this.faces.size===0}isValid(){let e=!0;for(let r of this.faces)if(!r.isSimple(this.edges)){e=!1;break}return e}area(){let e=[...this.faces].reduce((r,n)=>r+n.signedArea(),0);return Math.abs(e)}addFace(...e){let r=new u.Face(this,...e);return this.faces.add(r),r}deleteFace(e){for(let r of e)this.edges.delete(r);return this.faces.delete(e)}recreateFaces(){this.faces.clear();for(let n of this.edges)n.face=null;let e,r=!0;while(r){r=!1;for(let n of this.edges)if(n.face===null){e=n,r=!0;break}if(r){let n=e;do n=n.next;while(n.next!==e);this.addFace(e,n)}}}removeChain(e,r,n){if(n.next===r){this.deleteFace(e);return}for(let i=r;i!==n.next;i=i.next)if(e.remove(i),this.edges.delete(i),e.isEmpty()){this.deleteFace(e);break}}addVertex(e,r){let n=r.shape.split(e);if(n[0]===null)return r.prev;if(n[1]===null)return r;let i=new u.Edge(n[0]),s=r.prev;return r.face.insert(i,s),this.edges.delete(r),this.edges.add(i),r.shape=n[1],this.edges.add(r),i}removeEndVertex(e){let r=e.next;if(r===e)return;e.face.merge_with_next_edge(e),this.edges.delete(r)}cut(e){let n=this.splitToIslands().flatMap((i)=>i._cutSingleIsland(e)).filter((i)=>i.isValid()&&i.isEmpty()===!1);return this.createFromArray(n)}_cutSingleIsland(e){let r=this.clone(),n=e.clone(),i={int_points1:[],int_points2:[],int_points1_sorted:[],int_points2_sorted:[]};for(let c of n.edges)for(let l of r.edges){let a=y1(c,l);for(let p of a)oi(c,p,i.int_points1),oi(l,p,i.int_points2)}if(i.int_points1.length===0)return r;i.int_points1_sorted=mr(i.int_points1),i.int_points2_sorted=mr(i.int_points2),ai(n,i.int_points1_sorted),ai(r,i.int_points2_sorted),fh(i),i.int_points1_sorted=mr(i.int_points1),i.int_points2_sorted=mr(i.int_points2),nh(i.int_points1),ih(i.int_points1,r);for(let c of i.int_points1_sorted)if(c.edge_before&&c.edge_after&&c.edge_before.bv===c.edge_after.bv)i.int_points2[c.id]=-1,c.id=-1;if(i.int_points1=i.int_points1.filter((c)=>c.id>=0),i.int_points2=i.int_points2.filter((c)=>c.id>=0),i.int_points1.forEach((c,l)=>{c.id=l}),i.int_points2.forEach((c,l)=>{c.id=l}),i.int_points1.length===0)return r;i.int_points1_sorted=mr(i.int_points1),i.int_points2_sorted=mr(i.int_points2);let s,o;for(let c=1;c<i.int_points1_sorted.length;c++)if(o=i.int_points1_sorted[c],s=i.int_points1_sorted[c-1],o.edge_before&&o.edge_before.bv===1){let l=s.edge_after,a=o.edge_before,p=n.getChain(l,a);Hb(i.int_points2[s.id],i.int_points2[o.id],p),p.forEach((d)=>r.edges.add(d)),p=p.reverse().map((d)=>new u.Edge(d.shape.reverse()));for(let d=0;d<p.length-1;d++)p[d].next=p[d+1],p[d+1].prev=p[d];Hb(i.int_points2[o.id],i.int_points2[s.id],p),p.forEach((d)=>r.edges.add(d))}return r.recreateFaces(),r}cutWithLine(e){let r=new $r([e]);return this.cut(r)}findEdgeByPoint(e){let r;for(let n of this.faces)if(r=n.findEdgeByPoint(e),r!==void 0)break;return r}splitToIslands(){if(this.isEmpty())return[];let e=this.toArray();e.sort((i,s)=>s.area()-i.area());let r=[...e[0].faces][0].orientation(),n=e.filter((i)=>[...i.faces][0].orientation()===r);for(let i of e){let s=[...i.faces][0];if(s.orientation()===r)continue;for(let o of n)if(s.shapes.every((c)=>o.contains(c))){o.addFace(s.shapes);break}}return n}rearrange(){if(this.faces.size<=1)return this.clone();let e=this.splitToIslands(),r=new t;return e.forEach((n)=>{n.faces.forEach((i)=>r.addFace(i.shapes))}),r}orientation(){if(this.isEmpty())return ni.NOT_ORIENTABLE;return[...this.faces][0].orientation()}isOuter(e){return e.orientation()===this.orientation()}isMultiPolygon(){let e=0;return this.faces.forEach((r)=>{if(this.isOuter(r))e++}),e>1}reverse(){for(let e of this.faces)e.reverse();return this}contains(e){if(e instanceof u.Point){let r=xo(this,e);return r===1||r===2}else return C1(this,e)}distanceTo(e){if(e instanceof u.Point){let[r,n]=u.Distance.point2polygon(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Circle||e instanceof u.Line||e instanceof u.Segment||e instanceof u.Arc){let[r,n]=u.Distance.shape2polygon(e,this);return n=n.reverse(),[r,n]}if(e instanceof u.Box)return this.distanceTo(new u.Polygon(e));if(e instanceof u.Polygon){let r=[Number.POSITIVE_INFINITY,new u.Segment],n,i;for(let s of this.edges){let o=r[0];if([n,i]=u.Distance.shape2planarSet(s.shape,e.edges,o),u.Utils.LT(n,o))r=[n,i]}return r}}intersect(e){if(e instanceof u.Point)return this.contains(e)?[e]:[];if(e instanceof u.Line)return Ao(e,this);if(e instanceof u.Ray)return v1(e,this);if(e instanceof u.Circle)return f1(e,this);if(e instanceof u.Segment)return hh(e,this);if(e instanceof u.Arc)return dh(e,this);if(e instanceof u.Polygon)return D3(e,this);if(e instanceof u.Multiline)return X3(e,this)}translate(e){let r=new t;for(let n of this.faces)r.addFace(n.shapes.map((i)=>i.translate(e)));return r}rotate(e=0,r=new u.Point){let n=new t;for(let i of this.faces)n.addFace(i.shapes.map((s)=>s.rotate(e,r)));return n}scale(e,r){let n=new t;for(let i of this.faces)n.addFace(i.shapes.map((s)=>s.scale(e,r)));return n}transform(e=new u.Matrix){let r=new t;for(let n of this.faces)r.addFace(n.shapes.map((i)=>i.transform(e)));return r}toJSON(){return[...this.faces].map((e)=>e.toJSON())}toArray(){return[...this.faces].map((e)=>e.toPolygon())}dpath(){return[...this.faces].reduce((e,r)=>e+r.svg(),"")}svg(e={}){let r=`
<path ${Or({fillRule:"evenodd",fill:"lightcyan",...e})} d="`;for(let n of this.faces)r+=`
${n.svg()}`;return r+=`" >
</path>`,r}};u.Polygon=W1;var CA=(...t)=>new u.Polygon(...t);u.polygon=CA;var{Circle:th,Line:r1,Point:n1,Vector:Ns,Utils:eh}=u;class bo{constructor(t){this.circle=t}get inversion_circle(){return this.circle}static inversePoint(t,e){let r=new Ns(t.pc,e),n=t.r*t.r,i=r.dot(r);return eh.EQ_0(i)?new n1(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY):t.pc.translate(r.multiply(n/i))}static inverseCircle(t,e){let r=t.pc.distanceTo(e.pc)[0];if(eh.EQ(r,e.r)){let n=t.r*t.r/(2*e.r),i=new Ns(t.pc,e.pc);i=i.normalize();let s=t.pc.translate(i.multiply(n));return new r1(s,i)}else{let n=new Ns(t.pc,e.pc),i=t.r*t.r/(n.dot(n)-e.r*e.r),s=t.pc.translate(n.multiply(i)),o=Math.abs(i)*e.r;return new th(s,o)}}static inverseLine(t,e){let[r,n]=t.pc.distanceTo(e);if(eh.EQ_0(r))return e.clone();else{let i=t.r*t.r/(2*r),s=new Ns(t.pc,n.end);return s=s.multiply(i/r),new th(t.pc.translate(s),i)}}inverse(t){if(t instanceof n1)return bo.inversePoint(this.circle,t);else if(t instanceof th)return bo.inverseCircle(this.circle,t);else if(t instanceof r1)return bo.inverseLine(this.circle,t)}}u.Inversion=bo;var kA=(t)=>new u.Inversion(t);u.inversion=kA;class ht{static point2point(t,e){return t.distanceTo(e)}static point2line(t,e){let r=t.projectionOn(e);return[new u.Vector(t,r).length,new u.Segment(t,r)]}static point2circle(t,e){let[r,n]=t.distanceTo(e.center);if(u.Utils.EQ_0(r))return[e.r,new u.Segment(t,e.toArc().start)];else{let i=Math.abs(r-e.r),s=new u.Vector(e.pc,t).normalize().multiply(e.r),o=e.pc.translate(s);return[i,new u.Segment(t,o)]}}static point2segment(t,e){if(e.start.equalTo(e.end))return ht.point2point(t,e.start);let r=new u.Vector(e.start,e.end),n=new u.Vector(e.start,t),i=new u.Vector(e.end,t),s=r.dot(n),o=-r.dot(i),c,l;if(u.Utils.GE(s,0)&&u.Utils.GE(o,0)){let a=e.tangentInStart();return c=Math.abs(a.cross(n)),l=e.start.translate(a.multiply(a.dot(n))),[c,new u.Segment(t,l)]}else if(s<0)return t.distanceTo(e.start);else return t.distanceTo(e.end)}static point2arc(t,e){let r=new u.Circle(e.pc,e.r),n=[],i,s;if([i,s]=ht.point2circle(t,r),s.end.on(e))n.push(ht.point2circle(t,r));return n.push(ht.point2point(t,e.start)),n.push(ht.point2point(t,e.end)),ht.sort(n),n[0]}static point2edge(t,e){return e.shape instanceof u.Segment?ht.point2segment(t,e.shape):ht.point2arc(t,e.shape)}static segment2line(t,e){let r=t.intersect(e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let n=[];return n.push(ht.point2line(t.start,e)),n.push(ht.point2line(t.end,e)),ht.sort(n),n[0]}static segment2segment(t,e){let r=Es(t,e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let n=[],i,s;return[i,s]=ht.point2segment(e.start,t),n.push([i,s.reverse()]),[i,s]=ht.point2segment(e.end,t),n.push([i,s.reverse()]),n.push(ht.point2segment(t.start,e)),n.push(ht.point2segment(t.end,e)),ht.sort(n),n[0]}static segment2circle(t,e){let r=t.intersect(e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let n=new u.Line(t.ps,t.pe),[i,s]=ht.point2line(e.center,n);if(u.Utils.GE(i,e.r)&&s.end.on(t))return ht.point2circle(s.end,e);else{let[o,c]=ht.point2circle(t.start,e),[l,a]=ht.point2circle(t.end,e);return u.Utils.LT(o,l)?[o,c]:[l,a]}}static segment2arc(t,e){let r=t.intersect(e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let n=new u.Line(t.ps,t.pe),i=new u.Circle(e.pc,e.r),[s,o]=ht.point2line(i.center,n);if(u.Utils.GE(s,i.r)&&o.end.on(t)){let[p,d]=ht.point2circle(o.end,i);if(d.end.on(e))return[p,d]}let c=[];c.push(ht.point2arc(t.start,e)),c.push(ht.point2arc(t.end,e));let l,a;return[l,a]=ht.point2segment(e.start,t),c.push([l,a.reverse()]),[l,a]=ht.point2segment(e.end,t),c.push([l,a.reverse()]),ht.sort(c),c[0]}static circle2circle(t,e){let r=t.intersect(e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];if(t.center.equalTo(e.center)){let n=t.toArc(),i=e.toArc();return ht.point2point(n.start,i.start)}else{let n=new u.Line(t.center,e.center),i=n.intersect(t),s=n.intersect(e),o=[];return o.push(ht.point2point(i[0],s[0])),o.push(ht.point2point(i[0],s[1])),o.push(ht.point2point(i[1],s[0])),o.push(ht.point2point(i[1],s[1])),ht.sort(o),o[0]}}static circle2line(t,e){let r=t.intersect(e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let[n,i]=ht.point2line(t.center,e),[s,o]=ht.point2circle(i.end,t);return o=o.reverse(),[s,o]}static arc2line(t,e){let r=e.intersect(t);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let n=new u.Circle(t.center,t.r),[i,s]=ht.point2line(n.center,e);if(u.Utils.GE(i,n.r)){let[o,c]=ht.point2circle(s.end,n);if(c.end.on(t))return[o,c]}else{let o=[];return o.push(ht.point2line(t.start,e)),o.push(ht.point2line(t.end,e)),ht.sort(o),o[0]}}static arc2circle(t,e){let r=t.intersect(e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let n=new u.Circle(t.center,t.r),[i,s]=ht.circle2circle(n,e);if(s.start.on(t))return[i,s];else{let o=[];return o.push(ht.point2circle(t.start,e)),o.push(ht.point2circle(t.end,e)),ht.sort(o),o[0]}}static arc2arc(t,e){let r=t.intersect(e);if(r.length>0)return[0,new u.Segment(r[0],r[0])];let n=new u.Circle(t.center,t.r),i=new u.Circle(e.center,e.r),[s,o]=ht.circle2circle(n,i);if(o.start.on(t)&&o.end.on(e))return[s,o];else{let c=[],l,a;if([l,a]=ht.point2arc(t.start,e),a.end.on(e))c.push([l,a]);if([l,a]=ht.point2arc(t.end,e),a.end.on(e))c.push([l,a]);if([l,a]=ht.point2arc(e.start,t),a.end.on(t))c.push([l,a.reverse()]);if([l,a]=ht.point2arc(e.end,t),a.end.on(t))c.push([l,a.reverse()]);return[l,a]=ht.point2point(t.start,e.start),c.push([l,a]),[l,a]=ht.point2point(t.start,e.end),c.push([l,a]),[l,a]=ht.point2point(t.end,e.start),c.push([l,a]),[l,a]=ht.point2point(t.end,e.end),c.push([l,a]),ht.sort(c),c[0]}}static point2polygon(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e.edges){let[i,s]=ht.point2edge(t,n);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static shape2polygon(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e.edges){let[i,s]=t.distanceTo(n.shape);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static polygon2polygon(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of t.edges)for(let i of e.edges){let[s,o]=n.shape.distanceTo(i.shape);if(u.Utils.LT(s,r[0]))r=[s,o]}return r}static box2box_minmax(t,e){let r=Math.max(Math.max(t.xmin-e.xmax,0),Math.max(e.xmin-t.xmax,0)),n=Math.max(Math.max(t.ymin-e.ymax,0),Math.max(e.ymin-t.ymax,0)),i=r*r+n*n,s=t.merge(e),o=s.xmax-s.xmin,c=s.ymax-s.ymin,l=o*o+c*c;return[i,l]}static minmax_tree_process_level(t,e,r,n){let i,s;for(let a of e){[i,s]=ht.box2box_minmax(t.box,a.item.key);for(let p of a.item.values)if(p instanceof u.Edge)n.insert([i,s],p.shape);else n.insert([i,s],p);if(u.Utils.LT(s,r))r=s}if(e.length===0)return r;let o=e.map((a)=>a.left.isNil()?void 0:a.left).filter((a)=>a!==void 0),c=e.map((a)=>a.right.isNil()?void 0:a.right).filter((a)=>a!==void 0),l=[...o,...c].filter((a)=>{let[p,d]=ht.box2box_minmax(t.box,a.max);return u.Utils.LE(p,r)});return r=ht.minmax_tree_process_level(t,l,r,n),r}static minmax_tree(t,e,r){let n=new So,i=[e.index.root],s=r<Number.POSITIVE_INFINITY?r*r:Number.POSITIVE_INFINITY;return s=ht.minmax_tree_process_level(t,i,s,n),n}static minmax_tree_calc_distance(t,e,r){let n,i;if(e!=null&&!e.isNil()){if([n,i]=ht.minmax_tree_calc_distance(t,e.left,r),i)return[n,i];if(u.Utils.LT(n[0],Math.sqrt(e.item.key.low)))return[n,!0];let[s,o]=ht.distanceToArray(t,e.item.values);if(u.Utils.LT(s,n[0]))n=[s,o];return[n,i]=ht.minmax_tree_calc_distance(t,e.right,n),[n,i]}return[r,!1]}static shape2planarSet(t,e,r=Number.POSITIVE_INFINITY){let n=[r,new u.Segment],i=!1;if(e instanceof u.PlanarSet){let s=ht.minmax_tree(t,e,r);[n,i]=ht.minmax_tree_calc_distance(t,s.root,n)}return n}static sort(t){t.sort((e,r)=>{if(u.Utils.LT(e[0],r[0]))return-1;if(u.Utils.GT(e[0],r[0]))return 1;return 0})}static distance(t,e){return t.distanceTo(e)}static distanceToArray(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e){let[i,s]=t.distanceTo(n);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static shape2multiline(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of e){let[i,s]=ht.distance(t,n.shape);if(u.Utils.LT(i,r[0]))r=[i,s]}return r}static multiline2multiline(t,e){let r=[Number.POSITIVE_INFINITY,new u.Segment];for(let n of t)for(let i of e){let[s,o]=ht.distance(n.shape,i.shape);if(u.Utils.LT(s,r[0]))r=[s,o]}return r}}u.Distance=ht;var{Multiline:NA,Point:$1,Segment:YA,Polygon:j1}=u;function xh(t){return new $1(t.split(" ").map(Number))}function X1(t){return t.split(", ").map(xh)}function bh(t){let e=X1(t),r=[];for(let n=0;n<e.length-1;n++)r.push(new YA(e[n],e[n+1]));return new NA(r)}function LA(t){return t.replace(/\(\(/,"").replace(/\)\)$/,"").split("), (").map(bh)}function D1(t){let e=t.replace(/\(\(/,"").replace(/\)\)$/,"").split("), ("),r=new j1,n;return e.forEach((i,s)=>{let o=i.split(", ").map((l)=>new $1(l.split(" ").map(Number))),c=r.addFace(o);if(s===0)n=c.orientation();else if(c.orientation()===n)c.reverse()}),r}function TA(t){let r=t.split(/\)\), \(\(/).map((s)=>"(("+s+"))").map(D1),n=new j1;return r.reduce((s,o)=>[...s,...o?.faces],[]).forEach((s)=>n.addFace([...s?.shapes])),n}function EA(t){if(t.startsWith("POLYGON")){let e=t.replace(/^POLYGON /,"");return D1(e)}else{let e=t.replace(/^MULTIPOLYGON \(\(\((.*)\)\)\)$/,"$1");return TA(e)}}function RA(t){return t.split(`
`).map((r)=>r.match(/\(([^)]+)\)/)[1]).map(xh)}function OA(t){return t.split(`
`).map((r)=>r.match(/\(([^)]+)\)/)[1]).map(bh).reduce((r,n)=>[...r,...n],[])}function V1(t){if(t.startsWith("POINT")){let e=t.replace(/^POINT \(/,"").replace(/\)$/,"");return xh(e)}else if(t.startsWith("MULTIPOINT")){let e=t.replace(/^MULTIPOINT \(/,"").replace(/\)$/,"");return X1(e)}else if(t.startsWith("LINESTRING")){let e=t.replace(/^LINESTRING \(/,"").replace(/\)$/,"");return bh(e)}else if(t.startsWith("MULTILINESTRING")){let e=t.replace(/^MULTILINESTRING /,"");return LA(e)}else if(t.startsWith("POLYGON")||t.startsWith("MULTIPOLYGON"))return EA(t);else if(t.startsWith("GEOMETRYCOLLECTION")){let e=/(?<type>POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON) \((?:[^\(\)]|\([^\)]*\))*\)/g,r=t.match(e);if(r[0].startsWith("GEOMETRYCOLLECTION"))r[0]=r[0].replace("GEOMETRYCOLLECTION (","");return r.map(V1).map((i)=>i instanceof Array?i:[i]).reduce((i,s)=>[...i,...s],[])}else if(z1(t))return RA(t);else if(U1(t))return OA(t);return[]}function z1(t){return t.split(`
`)?.every((e)=>e.includes("POINT"))}function U1(t){return t.split(`
`)?.every((e)=>e.includes("LINESTRING"))}function WA(t){return t.startsWith("POINT")||z1(t)||t.startsWith("LINESTRING")||U1(t)||t.startsWith("MULTILINESTRING")||t.startsWith("POLYGON")||t.startsWith("MULTIPOINT")||t.startsWith("MULTIPOLYGON")||t.startsWith("GEOMETRYCOLLECTION")}u.isWktString=WA;u.parseWKT=V1;u.BooleanOperations=oA;u.Relations=xA;function G1(t,e,r){if(!e||!r)return;let n=t.get(e);if(!n)n=new Set,t.set(e,n);n.add(r);let i=t.get(r);if(!i)i=new Set,t.set(r,i);i.add(e)}function H1(t,e){if(!e.subcircuit_id&&!e.source_group_id)return[...t];let r=e;if(e.subcircuit_id){let c=new Set([e.subcircuit_id]),l=new Map,a=new Map;for(let d of t)if(d.type==="source_group"){let{source_group_id:m,subcircuit_id:f}=d;if(f)a.set(m,f);let _=d.parent_source_group_id;if(_){if(!l.has(_))l.set(_,[]);l.get(_).push(m)}}let p;for(let[d,m]of a)if(m===e.subcircuit_id){p=d;break}if(p){let d=(m)=>{let f=l.get(m)||[];for(let _ of f){let g=a.get(_);if(g)c.add(g);d(_)}};d(p),r={...e,subcircuit_ids:Array.from(c)}}}let n=new Map;for(let c of t){let l=`${c.type}_id`,a=c[l];if(typeof a==="string")n.set(a,c)}let i=new Map;for(let c of t){let l=Object.entries(c);for(let[a,p]of l){if(a==="parent_source_group_id")continue;if(a.endsWith("_id")&&typeof p==="string"){let d=n.get(p);G1(i,c,d)}else if(a.endsWith("_ids")&&Array.isArray(p)){for(let d of p)if(typeof d==="string"){let m=n.get(d);G1(i,c,m)}}}}let s=[],o=new Set;for(let c of t){let l=!1;if(r.subcircuit_id&&"subcircuit_id"in c&&c.subcircuit_id===r.subcircuit_id)l=!0;else if(r.subcircuit_ids&&"subcircuit_id"in c&&c.subcircuit_id&&r.subcircuit_ids.includes(c.subcircuit_id))l=!0;else if(r.source_group_id&&"source_group_id"in c&&c.source_group_id===r.source_group_id)l=!0;else if(r.source_group_id&&"member_source_group_ids"in c&&Array.isArray(c.member_source_group_ids)&&c.member_source_group_ids.includes(r.source_group_id))l=!0;if(l)s.push(c),o.add(c)}while(s.length>0){let c=s.shift(),l=i.get(c);if(!l)continue;for(let a of l)if(!o.has(a))o.add(a),s.push(a)}return t.filter((c)=>o.has(c))}var Io=(t,e={})=>{let r=t,n=r._internal_store;if(!n){n={counts:{},editCount:0},r._internal_store=n;for(let s of r){let o=s.type,c=s[`${o}_id`];if(!c)continue;let l=Number.parseInt(c.split("_").pop());if(!Number.isNaN(l))n.counts[o]=Math.max(n.counts[o]??0,l)}}let i=new Proxy({},{get:(s,o)=>{if(o==="toArray")return()=>(r.editCount=n.editCount,r);if(o==="editCount")return n.editCount;if(o==="subtree")return(l)=>Io(H1(r,l),e);if(o==="insert")return(l)=>{let a=l.type;if(!a)throw Error("insert requires an element with a type");n.counts[a]??=-1,n.counts[a]++;let p=n.counts[a],d={...l,type:a,[`${a}_id`]:`${a}_${p}`};if(e.validateInserts)(ei[a]??ti).parse(d);return r.push(d),n.editCount++,d};if(o==="insertAll")return(l)=>l.map((a)=>i.insert(a));let c=o;return{get:(l)=>r.find((a)=>a.type===c&&a[`${c}_id`]===l),getUsing:(l)=>{let a=Object.keys(l);if(a.length!==1)throw Error("getUsing requires exactly one key, e.g. { pcb_component_id }");let p=a[0],d=p.replace("_id",""),m=r.find((f)=>f.type===d&&f[p]===l[p]);if(!m)return null;return r.find((f)=>f.type===c&&f[`${c}_id`]===m[`${c}_id`])},getWhere:(l)=>{let a=Object.keys(l);return r.find((p)=>p.type===c&&a.every((d)=>p[d]===l[d]))},list:(l)=>{let a=!l?[]:Object.keys(l);return r.filter((p)=>p.type===c&&a.every((d)=>p[d]===l[d]))},insert:(l)=>{n.counts[c]??=-1,n.counts[c]++;let a=n.counts[c],p={type:c,[`${c}_id`]:`${c}_${a}`,...l};if(e.validateInserts)(ei[c]??ti).parse(p);return r.push(p),n.editCount++,p},delete:(l)=>{let a=r.find((p)=>p[`${c}_id`]===l);if(!a)return;r.splice(r.indexOf(a),1),n.editCount++},update:(l,a)=>{let p=r.find((d)=>d.type===c&&d[`${c}_id`]===l);if(!p)return null;return Object.assign(p,a),n.editCount++,p},select:(l)=>{if(c==="source_component")return r.find((a)=>a.type==="source_component"&&a.name===l.replace(/\./g,""));else if(c==="pcb_port"||c==="source_port"||c==="schematic_port"){let[a,p]=l.replace(/\./g,"").split(/[\s\>]+/),d=r.find((f)=>f.type==="source_component"&&f.name===a);if(!d)return null;let m=r.find((f)=>f.type==="source_port"&&f.source_component_id===d.source_component_id&&(f.name===p||(f.port_hints??[]).includes(p)));if(!m)return null;if(c==="source_port")return m;if(c==="pcb_port")return r.find((f)=>f.type==="pcb_port"&&f.source_port_id===m.source_port_id);else if(c==="schematic_port")return r.find((f)=>f.type==="schematic_port"&&f.source_port_id===m.source_port_id)}}}}});return i};Io.unparsed=Io;var Kt=Io,wh=Io;function vh(t){let e=t.type;return`${e}:${t[`${e}_id`]}`}var Sh=(t,e={})=>{let r=t._internal_store_indexed;if(!r){r={counts:{},editCount:0,indexes:{}};for(let o of t){let c=o.type,l=o[`${c}_id`];if(!l)continue;let a=Number.parseInt(l.split("_").pop()||"");if(!Number.isNaN(a))r.counts[c]=Math.max(r.counts[c]??0,a)}let i=e.indexConfig||{},s=r.indexes;if(i.byId)s.byId=new Map;if(i.byType)s.byType=new Map;if(i.byRelation)s.byRelation=new Map;if(i.bySubcircuit)s.bySubcircuit=new Map;if(i.byCustomField&&i.byCustomField.length>0){s.byCustomField=new Map;for(let o of i.byCustomField)s.byCustomField.set(o,new Map)}for(let o of t){if(i.byId){let c=vh(o);s.byId.set(c,o)}if(i.byType){let c=s.byType.get(o.type)||[];c.push(o),s.byType.set(o.type,c)}if(i.byRelation){let c=Object.entries(o);for(let[l,a]of c)if(l.endsWith("_id")&&l!==`${o.type}_id`&&typeof a==="string"){let p=s.byRelation.get(l)||new Map,d=p.get(a)||[];d.push(o),p.set(a,d),s.byRelation.set(l,p)}}if(i.bySubcircuit&&"subcircuit_id"in o){let c=o.subcircuit_id;if(c&&typeof c==="string"){let l=s.bySubcircuit.get(c)||[];l.push(o),s.bySubcircuit.set(c,l)}}if(i.byCustomField&&s.byCustomField){for(let c of i.byCustomField)if(c in o){let l=o[c];if(l!==void 0&&(typeof l==="string"||typeof l==="number")){let a=String(l),p=s.byCustomField.get(c),d=p.get(a)||[];d.push(o),p.set(a,d)}}}}t._internal_store_indexed=r}let n=new Proxy({},{get:(i,s)=>{if(s==="toArray")return()=>(t.editCount=r.editCount,t);if(s==="editCount")return r.editCount;if(s==="insert")return(c)=>{let{type:l,...a}=c;if(!l)throw Error("insert requires an element with a type");return delete a[`${l}_id`],n[l].insert(a)};if(s==="insertAll")return(c)=>c.map((l)=>n.insert(l));if(s==="subtree")return(c)=>Sh(H1(t,c),e);let o=s;return{get:(c)=>{let l=e.indexConfig||{};if(l.byId&&r.indexes.byId)return r.indexes.byId.get(`${o}:${c}`)||null;if(l.byType&&r.indexes.byType)return(r.indexes.byType.get(o)||[]).find((p)=>p[`${o}_id`]===c)||null;return t.find((a)=>a.type===o&&a[`${o}_id`]===c)||null},getUsing:(c)=>{let l=e.indexConfig||{},a=Object.keys(c);if(a.length!==1)throw Error("getUsing requires exactly one key, e.g. { pcb_component_id }");let p=a[0],d=p.replace("_id","");if(l.byRelation&&r.indexes.byRelation){let f=r.indexes.byRelation.get(p);if(f){let g=(f.get(c[p])||[]).find((S)=>S.type===d);if(!g)return null;let y=g[`${o}_id`];if(l.byId&&r.indexes.byId)return r.indexes.byId.get(`${o}:${y}`)||null;if(l.byType&&r.indexes.byType)return(r.indexes.byType.get(o)||[]).find((P)=>P[`${o}_id`]===y)||null;return t.find((S)=>S.type===o&&S[`${o}_id`]===y)||null}}let m=t.find((f)=>f.type===d&&f[p]===c[p]);if(!m)return null;return t.find((f)=>f.type===o&&f[`${o}_id`]===m[`${o}_id`])||null},getWhere:(c)=>{let l=e.indexConfig||{},a=Object.keys(c);if(a.length===1&&l.byCustomField&&r.indexes.byCustomField){let p=a[0],d=r.indexes.byCustomField.get(p);if(d){let m=String(c[p]);return(d.get(m)||[]).find((_)=>_.type===o)||null}}if("subcircuit_id"in c&&l.bySubcircuit&&r.indexes.bySubcircuit){let p=c.subcircuit_id;return(r.indexes.bySubcircuit.get(p)||[]).find((m)=>m.type===o&&a.every((f)=>m[f]===c[f]))||null}if(l.byType&&r.indexes.byType)return(r.indexes.byType.get(o)||[]).find((d)=>a.every((m)=>d[m]===c[m]))||null;return t.find((p)=>p.type===o&&a.every((d)=>p[d]===c[d]))||null},list:(c)=>{let l=e.indexConfig||{},a=!c?[]:Object.keys(c);if(a.length===0&&l.byType&&r.indexes.byType)return(r.indexes.byType.get(o)||[]).slice();if(a.length===1&&a[0]==="subcircuit_id"&&l.bySubcircuit&&r.indexes.bySubcircuit){let d=c.subcircuit_id;return(r.indexes.bySubcircuit.get(d)||[]).filter((f)=>f.type===o)}let p;if(l.byType&&r.indexes.byType)p=r.indexes.byType.get(o)||[];else p=t.filter((d)=>d.type===o);if(a.length>0)return p.filter((d)=>a.every((m)=>d[m]===c[m]));return p.slice()},insert:(c)=>{r.counts[o]??=-1,r.counts[o]++;let l=r.counts[o],a={type:o,[`${o}_id`]:`${o}_${l}`,...c};if(e.validateInserts)(ei[o]??ti).parse(a);t.push(a),r.editCount++;let p=e.indexConfig||{};if(p.byId&&r.indexes.byId){let d=vh(a);r.indexes.byId.set(d,a)}if(p.byType&&r.indexes.byType){let d=r.indexes.byType.get(o)||[];d.push(a),r.indexes.byType.set(o,d)}if(p.byRelation&&r.indexes.byRelation){let d=Object.entries(a);for(let[m,f]of d)if(m.endsWith("_id")&&m!==`${a.type}_id`&&typeof f==="string"){let _=r.indexes.byRelation.get(m)||new Map,g=_.get(f)||[];g.push(a),_.set(f,g),r.indexes.byRelation.set(m,_)}}if(p.bySubcircuit&&r.indexes.bySubcircuit&&"subcircuit_id"in a){let d=a.subcircuit_id;if(d&&typeof d==="string"){let m=r.indexes.bySubcircuit.get(d)||[];m.push(a),r.indexes.bySubcircuit.set(d,m)}}if(p.byCustomField&&r.indexes.byCustomField){for(let d of p.byCustomField)if(d in a){let m=a[d];if(m!==void 0&&(typeof m==="string"||typeof m==="number")){let f=String(m),_=r.indexes.byCustomField.get(d),g=_.get(f)||[];g.push(a),_.set(f,g)}}}return a},delete:(c)=>{let l=e.indexConfig||{},a;if(l.byId&&r.indexes.byId)a=r.indexes.byId.get(`${o}:${c}`);else if(l.byType&&r.indexes.byType)a=(r.indexes.byType.get(o)||[]).find((m)=>m[`${o}_id`]===c);else a=t.find((d)=>d[`${o}_id`]===c);if(!a)return;let p=t.indexOf(a);if(p>=0)t.splice(p,1),r.editCount++;if(l.byId&&r.indexes.byId){let d=vh(a);r.indexes.byId.delete(d)}if(l.byType&&r.indexes.byType){let m=(r.indexes.byType.get(o)||[]).filter((f)=>f[`${o}_id`]!==c);r.indexes.byType.set(o,m)}if(l.byRelation&&r.indexes.byRelation)for(let[d,m]of r.indexes.byRelation.entries())for(let[f,_]of m.entries()){let g=_.filter((y)=>y!==a);if(g.length===0)m.delete(f);else m.set(f,g)}if(l.bySubcircuit&&r.indexes.bySubcircuit&&"subcircuit_id"in a){let d=a.subcircuit_id;if(d){let f=(r.indexes.bySubcircuit.get(d)||[]).filter((_)=>_!==a);if(f.length===0)r.indexes.bySubcircuit.delete(d);else r.indexes.bySubcircuit.set(d,f)}}if(l.byCustomField&&r.indexes.byCustomField)for(let d of r.indexes.byCustomField.values())for(let[m,f]of d.entries()){let _=f.filter((g)=>g!==a);if(_.length===0)d.delete(m);else d.set(m,_)}},update:(c,l)=>{let a=e.indexConfig||{},p;if(a.byId&&r.indexes.byId)p=r.indexes.byId.get(`${o}:${c}`);else if(a.byType&&r.indexes.byType)p=(r.indexes.byType.get(o)||[]).find((m)=>m[`${o}_id`]===c);else p=t.find((d)=>d.type===o&&d[`${o}_id`]===c);if(!p)return null;if(a.byRelation&&r.indexes.byRelation){let d=Object.entries(p);for(let[m,f]of d)if(m.endsWith("_id")&&m!==`${p.type}_id`&&typeof f==="string"){if(m in l&&l[m]!==f){let _=r.indexes.byRelation.get(m);if(_){let y=(_.get(f)||[]).filter((S)=>S!==p);if(y.length===0)_.delete(f);else _.set(f,y)}}}}if(a.bySubcircuit&&r.indexes.bySubcircuit&&"subcircuit_id"in p&&"subcircuit_id"in l){let d=p.subcircuit_id,m=l.subcircuit_id;if(d!==m){let _=(r.indexes.bySubcircuit.get(d)||[]).filter((g)=>g!==p);if(_.length===0)r.indexes.bySubcircuit.delete(d);else r.indexes.bySubcircuit.set(d,_)}}if(a.byCustomField&&r.indexes.byCustomField){for(let d of a.byCustomField)if(d in p&&d in l&&p[d]!==l[d]){let m=r.indexes.byCustomField.get(d);if(m){let f=String(p[d]),g=(m.get(f)||[]).filter((y)=>y!==p);if(g.length===0)m.delete(f);else m.set(f,g)}}}if(Object.assign(p,l),r.editCount++,a.byRelation&&r.indexes.byRelation){let d=Object.entries(p);for(let[m,f]of d)if(m.endsWith("_id")&&m!==`${p.type}_id`&&typeof f==="string"){if(m in l){let _=r.indexes.byRelation.get(m)||new Map,g=_.get(f)||[];if(!g.includes(p))g.push(p),_.set(f,g),r.indexes.byRelation.set(m,_)}}}if(a.bySubcircuit&&r.indexes.bySubcircuit&&"subcircuit_id"in p&&"subcircuit_id"in l){let d=p.subcircuit_id;if(d&&typeof d==="string"){let m=r.indexes.bySubcircuit.get(d)||[];if(!m.includes(p))m.push(p),r.indexes.bySubcircuit.set(d,m)}}if(a.byCustomField&&r.indexes.byCustomField){for(let d of a.byCustomField)if(d in p&&d in l){let m=p[d];if(m!==void 0&&(typeof m==="string"||typeof m==="number")){let f=String(m),_=r.indexes.byCustomField.get(d),g=_.get(f)||[];if(!g.includes(p))g.push(p),_.set(f,g)}}}return p},select:(c)=>{if(o==="source_component")return t.find((l)=>l.type==="source_component"&&l.name===c.replace(/\./g,""))||null;else if(o==="pcb_port"||o==="source_port"||o==="schematic_port"){let[l,a]=c.replace(/\./g,"").split(/[\s\>]+/),p=t.find((m)=>m.type==="source_component"&&m.name===l);if(!p)return null;let d=t.find((m)=>m.type==="source_port"&&m.source_component_id===p.source_component_id&&(m.name===a||(m.port_hints??[]).includes(a)));if(!d)return null;if(o==="source_port")return d;if(o==="pcb_port")return t.find((m)=>m.type==="pcb_port"&&m.source_port_id===d.source_port_id)||null;else if(o==="schematic_port")return t.find((m)=>m.type==="schematic_port"&&m.source_port_id===d.source_port_id)||null}return null}}}});return n};Sh.unparsed=Sh;var $A={leftside_top:{side:"leftside",alignment:"top"},leftside_bottom:{side:"leftside",alignment:"bottom"},rightside_top:{side:"rightside",alignment:"top"},rightside_bottom:{side:"rightside",alignment:"bottom"},topside_left:{side:"topside",alignment:"left"},topside_right:{side:"topside",alignment:"right"},bottomside_left:{side:"bottomside",alignment:"left"},bottomside_right:{side:"bottomside",alignment:"right"}},xK=Object.keys($A);var di=(t)=>{let e=new Map;for(let r of t)if(r.type==="schematic_sheet"&&r.name)e.set(r.schematic_sheet_id,r.name);return e};var jA=(t)=>t.type==="schematic_box",Q1=(t)=>t.type==="schematic_component",Ah=(t)=>t.schematic_sheet_id,XA=(t,e)=>{if(!e)return;return wh(t).source_component.get(e)?.name},DA=(t,e)=>{if(!t.schematic_component_id)return{};let r=wh(e),n=r.schematic_component.get(t.schematic_component_id);if(!n?.source_component_id)return{};let i=r.source_component.get(n.source_component_id);return{sourceComponentId:n.source_component_id,sourceComponentName:i?.name}},VA=(t,e,r,n)=>{let i=Ah(t);if(i===void 0&&n)i=Ah(n);let s;if(i)s=r.get(i);let o={lineItemType:"SchematicBoxPlacement",positionAnchor:"center",schX:t.center.x,schY:t.center.y,width:n?.width??t.size.width,height:n?.height??t.size.height,sourceComponentId:t.source_component_id,sourceComponentName:XA(e,t.source_component_id),schematicComponentId:t.schematic_component_id,schematicSymbolId:n?.schematic_symbol_id??t.schematic_symbol_id,subcircuitId:t.subcircuit_id??n?.subcircuit_id};if(i)o.schematicSheetId=i;if(s)o.schematicSheetName=s;return o},zA=(t,e,r)=>{let n=Ah(t),i;if(n)i=r.get(n);let s={lineItemType:"SchematicBoxPlacement",positionAnchor:"center",schX:t.x+t.width/2,schY:t.y+t.height/2,width:t.width,height:t.height,...DA(t,e),schematicComponentId:t.schematic_component_id,schematicSymbolId:t.schematic_symbol_id,subcircuitId:t.subcircuit_id};if(n)s.schematicSheetId=n;if(i)s.schematicSheetName=i;return s},Z1=(t)=>{let e=t.filter(jA).filter((s)=>s.schematic_component_id||s.schematic_symbol_id),r=di(t),n=new Set(t.filter(Q1).map((s)=>s.schematic_component_id)),i=[...t.filter(Q1).map((s)=>VA(s,t,r,e.find((o)=>o.schematic_component_id===s.schematic_component_id))),...e.filter((s)=>!s.schematic_component_id||!n.has(s.schematic_component_id)).map((s)=>zA(s,t,r))];return{circuitJson:t,componentPlacements:i}};class Ws extends U{params;constructor(t){super();this.params=t}_step(){let t=new tt(this.params.ctx);for(let e of tp(t)){let{resistor:r,switchBox:n,signalPort:i,signalSchY:s,pullDirection:o}=e;if(e.horizontalPushbutton)continue;let c=t.connected(i.source_port_id);if(t.portsByNet.get(c)?.length!==2)continue;if(i.needs_external_pullup||i.needs_external_pulldown)continue;let l=o==="up"?s-(r.schY+r.height/2):r.schY-r.height/2-s;if(l<=1.5)continue;let a=o==="up"?"above":"below";this.params.issues.push({lineItemType:"PullResistorOnWrongSide",resistorSchematicBox:r,hostSchematicBox:n,signalSourcePortId:i.source_port_id,signalPinName:i.name,signalSchY:s,pullDirection:o,preferredSide:a,wrongSideGap:l,maxRecommendedWrongSideGap:1.5,message:`place ${r.sourceComponentName} ${a} ${n.sourceComponentName} so the pull-${o} branch reads toward ${o==="up"?"power":"ground"}`})}this.solved=!0}}function $s(t,e){let r=t.find((l)=>l.type==="source_trace"&&l.source_trace_id===e.source_trace_id);if(r?.type==="source_trace"&&r.name)return r.name;let n=e.edges[0],i=e.edges.at(-1),s=(l,a)=>{let p=t.filter((S)=>S.type==="schematic_port"&&S.schematic_sheet_id===e.schematic_sheet_id&&(a?S.schematic_port_id===a:Math.hypot(S.center.x-l.x,S.center.y-l.y)<=0.01));if(p.length!==1||p[0]?.type!=="schematic_port")return;let d=p[0],m=t.find((S)=>S.type==="source_port"&&S.source_port_id===d.source_port_id),f=t.find((S)=>S.type==="schematic_component"&&S.schematic_component_id===d.schematic_component_id),_=m?.type==="source_port"?m.source_component_id:f?.type==="schematic_component"?f.source_component_id:void 0,g=t.find((S)=>S.type==="source_component"&&S.source_component_id===_);if(g?.type!=="source_component"||!g.name)return;let y=m?.type==="source_port"&&m.name?m.name:d.pin_number!==void 0?`pin${d.pin_number}`:d.display_pin_label;return y?`${g.name}.${y}`:g.name},o=n&&s(n.from,n.from_schematic_port_id),c=i&&s(i.to,i.to_schematic_port_id);if(o&&c)return`${o} to ${c}`;return r?.type==="source_trace"&&r.display_name||o||c||"trace"}var q1=(t,e,r)=>{let n=[{x:t.x,y:t.y}],i=(t.x+e.x)/2,s=(t.y+e.y)/2,o={x:e.x,y:e.y};switch(e.facingDirection){case"x+":o.x+=r;break;case"x-":o.x-=r;break;case"y+":o.y+=r;break;case"y-":o.y-=r;break}let c=t.facingDirection??"none",l=e.facingDirection??"none",a=(m)=>{let f=n[n.length-1];if(f.x!==m.x||f.y!==m.y)n.push(m)},p=Math.abs(t.y-e.y)<=Math.max(0.000001,r*0.1),d=Math.abs(t.x-e.x)<=Math.max(0.000001,r*0.1);if(c==="none"&&l==="none")globalThis.__DEBUG_CALCULATE_ELBOW_CASE=1,a({x:i,y:t.y}),a({x:i,y:e.y});else if(c==="x+"&&l==="y+")if(globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2,t.x>e.x&&t.y<e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.1,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:e.y+r}),a({x:e.x,y:e.y+r});else if(!d&&!p&&t.x<e.x&&t.y>e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.2,a({x:e.x,y:t.y});else if(d)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.3,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:e.y+r}),a({x:e.x,y:e.y+r});else if(t.x<e.x)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.4,a({x:i,y:t.y}),a({x:i,y:o.y}),a({x:e.x,y:o.y});else if(t.y<=e.y+r)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.5,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y+r}),a({x:e.x,y:t.y+r}),a({x:e.x,y:e.y});else globalThis.__DEBUG_CALCULATE_ELBOW_CASE=2.6,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:(t.y+e.y)/2}),a({x:e.x,y:(t.y+e.y)/2});else if(c==="x+"&&l==="x+"&&!p){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=3;let m=Math.max(t.x+r,o.x);a({x:m,y:t.y}),a({x:m,y:e.y})}else if(c==="x+"&&l==="x+"&&p)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=3.1,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y+r}),a({x:e.x+r,y:t.y+r}),a({x:e.x+r,y:e.y});else if(c==="x+"&&l==="y-")if(d&&t.y<=e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.11,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:s}),a({x:e.x,y:s});else if(d&&t.y>e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.12,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:e.y-r}),a({x:e.x,y:e.y-r});else if(t.x<e.x&&t.y<e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.2,a({x:e.x,y:t.y});else if(t.x>e.x&&t.y<e.y){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.3;let m=t.x+r;a({x:m,y:t.y}),a({x:m,y:s}),a({x:e.x,y:s})}else if(t.x>e.x&&t.y>e.y){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.4;let m=t.x+r;a({x:m,y:t.y}),a({x:m,y:o.y}),a({x:e.x,y:o.y})}else if(t.y===e.y)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.5,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y-r}),a({x:e.x,y:t.y-r});else globalThis.__DEBUG_CALCULATE_ELBOW_CASE=4.6,a({x:i,y:t.y}),a({x:i,y:o.y}),a({x:e.x,y:o.y});else if(c==="x+"&&l==="x-"&&t.x+r>=e.x-r&&!p){globalThis.__DEBUG_CALCULATE_ELBOW_CASE=5;let m=t.x+r;a({x:m,y:t.y}),a({x:m,y:s}),a({x:o.x,y:s}),a({x:o.x,y:o.y})}else if(c==="x+"&&l==="x-"&&p&&e.x>t.x);else if(c==="x+"&&l==="x-"&&p)globalThis.__DEBUG_CALCULATE_ELBOW_CASE=7,a({x:t.x+r,y:t.y}),a({x:t.x+r,y:t.y+r}),a({x:e.x-r,y:t.y+r}),a({x:e.x-r,y:t.y});else{if(globalThis.__DEBUG_CALCULATE_ELBOW_CASE=8,c==="x+")a({x:t.x+r,y:t.y});a({x:i,y:n[n.length-1].y}),a({x:i,y:o.y}),a({x:o.x,y:o.y})}return a({x:e.x,y:e.y}),n};var Ph=(t,e,r={})=>{let n=t,i=e,s=!1;if(n.x>i.x||n.x===i.x&&n.y>i.y)s=!0,[n,i]=[i,n];let o=n.facingDirection==="x-",c=n.facingDirection==="y-",l=(P)=>{let b=o?n.x-(P.x-n.x):P.x,C=c?n.y-(P.y-n.y):P.y,L=P.facingDirection;if(o){if(L==="x+")L="x-";else if(L==="x-")L="x+"}if(c){if(L==="y+")L="y-";else if(L==="y-")L="y+"}return{x:b,y:C,facingDirection:L}},a=(P,b)=>{let C=P.x-b.x,L=P.y-b.y,B=b.x+L,k=b.y-C,I=P.facingDirection;switch(I){case"x+":I="y-";break;case"y-":I="x-";break;case"x-":I="y+";break;case"y+":I="x+";break}return{x:B,y:k,facingDirection:I}},p=(P,b)=>{let C=P.x-b.x,L=P.y-b.y;return{x:b.x-L,y:b.y+C}},d=o||c?l(n):n,m=o||c?l(i):i,f=d,_=m,g=!1;if(d.facingDirection==="y+")g=!0,f={...d,facingDirection:"x+"},_=a(m,d);let y=r?.overshoot??0.1*Math.max(Math.abs(f.x-_.x),Math.abs(f.y-_.y)),S=q1(f,_,y);if(g)S=S.map((P)=>p(P,f));if(o||c)S=S.map(({x:P,y:b})=>({x:o?n.x-(P-n.x):P,y:c?n.y-(b-n.y):b}));return s?S.reverse():S};class de extends U{static EPSILON=0.01;ctx;out;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e}_step(){let t=this.ctx.circuitJson.filter((i)=>i.type==="schematic_port"),e=new Map(t.map((i)=>[i.schematic_port_id,i])),r=new Map(this.ctx.componentPlacements.flatMap((i)=>i.schematicComponentId?[[i.schematicComponentId,i]]:[])),n=new Set;for(let i of this.ctx.circuitJson.filter((s)=>s.type==="schematic_trace")){let s=this.getTracePoints(i),o=this.countTurns(s);if(o!==3)continue;let c=[this.getCandidate({trace:i,points:s,atStart:!0,currentTurnCount:o,ports:t,portsById:e,placementsByComponentId:r}),this.getCandidate({trace:i,points:s,atStart:!1,currentTurnCount:o,ports:t,portsById:e,placementsByComponentId:r})].filter((a)=>Boolean(a));for(let a of[...c]){if(!a.target.sourceComponentName?.startsWith("U"))continue;for(let p of[s[0],s.at(-1)]){let d=this.findPortAtPoint(t,p,i.schematic_sheet_id),m=d?.schematic_component_id?r.get(d.schematic_component_id):void 0;if(!m||!/^[CR]/.test(m.sourceComponentName??""))continue;c.push({target:m,deltaSchX:-a.deltaSchX,deltaSchY:-a.deltaSchY,currentTurnCount:o,suggestedTurnCount:a.suggestedTurnCount})}}let l=(a)=>/^[CR]/.test(a.target.sourceComponentName??"")?0:a.target.sourceComponentName?.startsWith("U")?2:1;c.sort((a,p)=>l(a)-l(p));for(let a of c){if(this.wouldOverlapAnotherComponent(a))continue;if(!this.validateMove(i,a,t))continue;let p=[a.target.schematicComponentId,a.deltaSchX.toFixed(3),a.deltaSchY.toFixed(3)].join("\x00");if(n.has(p))break;n.add(p),this.out.push(this.makeIssue(i,a));break}}this.solved=!0}getCandidate({trace:t,points:e,atStart:r,currentTurnCount:n,ports:i,portsById:s,placementsByComponentId:o}){if(e.length<4)return;let c=r?0:e.length-1,l=r?1:e.length-2,a=r?2:e.length-3,p=r?3:e.length-4,d=e[c],m=e[l],f=e[a],_=e[p],g=r?t.edges[0]:t.edges.at(-1);if(!g)return;let y=r?g.from_schematic_port_id:g.to_schematic_port_id,S=y?s.get(y):this.findPortAtPoint(i,d,t.schematic_sheet_id);if(!S?.schematic_component_id||!S.facing_direction)return;let P=this.getAxis(d,m),b=this.getAxis(m,f),C=this.getAxis(f,_),L=S.facing_direction==="left"||S.facing_direction==="right"?"horizontal":"vertical";if(!P||!b||!C)return;if(P!==L||b===L||C!==L)return;if(!this.isPointInFacingDirection(d,m,S.facing_direction)||!this.isPointInFacingDirection(f,_,S.facing_direction))return;let B=o.get(S.schematic_component_id);if(!B)return;let k=f.x-m.x,I=f.y-m.y;if(Math.abs(k)<=de.EPSILON&&Math.abs(I)<=de.EPSILON)return;let j={x:d.x+k,y:d.y+I},Q=r?[j,...e.slice(2)]:[...e.slice(0,-2),j],lt=this.countTurns(Q);if(lt===void 0||lt!==1||lt>=n)return;return{target:B,deltaSchX:k,deltaSchY:I,currentTurnCount:n,suggestedTurnCount:lt}}validateMove(t,e,r){let n=e.target.schematicComponentId,i=e.target.schematicSheetId,s=r.filter((b)=>b.schematic_sheet_id===i),o=s.filter((b)=>b.schematic_component_id===n),c=this.ctx.circuitJson.filter((b)=>b.type==="schematic_trace"&&b.schematic_sheet_id===i),l=(b,C)=>b.edges.some((L)=>L.from_schematic_port_id===C.schematic_port_id||L.to_schematic_port_id===C.schematic_port_id||this.pointsEqual(L.from,C.center)||this.pointsEqual(L.to,C.center)),a=c.filter((b)=>o.some((C)=>l(b,C)));if(!a.includes(t))return!1;if(this.ctx.circuitJson.some((b)=>b.type==="schematic_net_label"&&b.schematic_sheet_id===i&&o.some((C)=>this.pointsEqual(b.anchor_position??b.center,C.center))))return!1;let p=(b)=>({x:b.x+e.deltaSchX,y:b.y+e.deltaSchY}),d={left:"x-",right:"x+",up:"y+",down:"y-"},m=(b,C)=>({...C&&b.schematic_component_id===n?p(b.center):b.center,facingDirection:d[b.facing_direction]}),f=(b)=>b.slice(1).reduce((C,L,B)=>C+Math.abs(L.x-b[B].x)+Math.abs(L.y-b[B].y),0),_=(b)=>b.slice(1).map((C,L)=>({from:b[L],to:C})),g=zt(e.target.schX+e.deltaSchX,e.target.schY+e.deltaSchY,e.target.width,e.target.height),y=c.filter((b)=>!a.includes(b));if(y.some((b)=>b.edges.some((C)=>hn(C.from,C.to,tr(g)))))return!1;let S=this.ctx.circuitJson.flatMap((b)=>{if(b.type==="schematic_net_label"&&b.schematic_sheet_id===i)return[tr(Ke(b))];if(b.type!=="schematic_text"||b.schematic_sheet_id!==i)return[];return br(b.schematic_component_id===n?{...b,position:p(b.position)}:b)});if(S.some((b)=>Di(b,tr(g))))return!1;let P=[];for(let b of a){let C=this.getTracePoints(b);if(C.length<2||b.junctions?.length)return!1;let L=(z,N)=>{let at=s.filter((ot)=>N?ot.schematic_port_id===N:this.pointsEqual(ot.center,z));return at.length===1&&this.pointsEqual(at[0].center,z)?at[0]:void 0},B=L(C[0],b.edges[0].from_schematic_port_id),k=L(C.at(-1),b.edges.at(-1).to_schematic_port_id);if(!B?.facing_direction||!k?.facing_direction)return!1;if(o.some((z)=>l(b,z)&&z!==B&&z!==k))return!1;let I=(z)=>!this.pointsEqual(z,B.center)&&!this.pointsEqual(z,k.center)&&_(C).some(({from:N,to:at})=>Math.abs(Math.hypot(z.x-N.x,z.y-N.y)+Math.hypot(z.x-at.x,z.y-at.y)-Math.hypot(at.x-N.x,at.y-N.y))<0.000001);if(c.some((z)=>z!==b&&z.edges.some((N)=>I(N.from)||I(N.to))))return!1;if(this.ctx.circuitJson.some((z)=>z.type==="schematic_net_label"&&z.schematic_sheet_id===i&&I(z.anchor_position??z.center)))return!1;let j=Ph(m(B,!0),m(k,!0)).filter((z,N,at)=>N===0||!this.pointsEqual(z,at[N-1])),Q=this.countTurns(j),lt=this.countTurns(C);if(j.length<2||Q===void 0||lt===void 0||Q>lt||f(j)>f(C)+0.000001)return!1;if(!this.isPointInFacingDirection(j[0],j[1],B.facing_direction)||!this.isPointInFacingDirection(j.at(-1),j.at(-2),k.facing_direction))return!1;if(b===t){let z=this.countTurns(Ph(m(B,!1),m(k,!1)));if(Q>=lt||z===void 0||Q>=z)return!1;e.suggestedTurnCount=Q}for(let z of _(j)){if(S.some((ot)=>hn(z.from,z.to,ot)))return!1;if(this.ctx.componentPlacements.some((ot)=>{if(ot.schematicSheetId!==i)return!1;let et=ot.schematicComponentId===n?g:zt(ot.schX,ot.schY,ot.width,ot.height);return hn(z.from,z.to,tr(et))}))return!1;let N=Vi(z.from,z.to);if(!N)continue;if([...y.flatMap((ot)=>ot.edges),...P.flatMap((ot)=>_(ot.points))].some((ot)=>{if([B,k].some((D)=>D.schematic_component_id!==n&&[z.from,z.to].some((it)=>this.pointsEqual(it,D.center))&&[ot.from,ot.to].some((it)=>this.pointsEqual(it,D.center)))&&this.getAxis(z.from,z.to)!==this.getAxis(ot.from,ot.to))return!1;let et=Vi(ot.from,ot.to);return et&&Di(N,et)}))return!1}P.push({schematicTraceId:b.schematic_trace_id,points:j})}return e.suggestedTraces=P,!0}getTracePoints(t){let e=t.edges[0];if(!e)return[];let r=[e.from];for(let n of t.edges){let i=r.at(-1);if(!this.pointsEqual(i,n.from))return[];r.push(n.to)}return r}countTurns(t){let e=[];for(let[r,n]of t.slice(1).entries()){let i=t[r];if(this.pointsEqual(i,n))continue;let s=this.getAxis(i,n);if(!s)return;e.push(s)}return e.slice(1).filter((r,n)=>r!==e[n]).length}pointsEqual(t,e){let{EPSILON:r}=de;return Math.abs(t.x-e.x)<=r&&Math.abs(t.y-e.y)<=r}getAxis(t,e){let r=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),{EPSILON:i}=de;if(r<=i&&n>i)return"vertical";if(n<=i&&r>i)return"horizontal";return}isPointInFacingDirection(t,e,r){let{EPSILON:n}=de;switch(r){case"left":return e.x<t.x-n;case"right":return e.x>t.x+n;case"up":return e.y>t.y+n;case"down":return e.y<t.y-n}}findPortAtPoint(t,e,r){let{EPSILON:n}=de;return t.find((i)=>i.schematic_sheet_id===r&&Math.abs(i.center.x-e.x)<=n&&Math.abs(i.center.y-e.y)<=n)}wouldOverlapAnotherComponent(t){let e=zt(t.target.schX+t.deltaSchX,t.target.schY+t.deltaSchY,t.target.width,t.target.height);return this.ctx.componentPlacements.some((r)=>{if(r===t.target)return!1;if(r.schematicSheetId!==t.target.schematicSheetId)return!1;return Boolean(xr(e,zt(r.schX,r.schY,r.width,r.height)))})}makeIssue(t,e){let r=e.target.sourceComponentName||"component",n=this.getMoveDirection(e.deltaSchX,e.deltaSchY),i=Math.abs(e.deltaSchX||e.deltaSchY),s=e.target.schX+e.deltaSchX,o=e.target.schY+e.deltaSchY;return{lineItemType:"TraceCanBeSimplifiedByMovingComponent",schematicTraceId:t.schematic_trace_id,traceName:$s(this.ctx.circuitJson,t),targetComponent:e.target,deltaSchX:e.deltaSchX,deltaSchY:e.deltaSchY,newSchX:s,newSchY:o,currentTurnCount:e.currentTurnCount,suggestedTurnCount:e.suggestedTurnCount,suggestedTraces:e.suggestedTraces,message:`move ${r} ${n} by ${Hr(i)} (to schX=${Hr(s)}, schY=${Hr(o)}) to reduce this trace from ${e.currentTurnCount} turns to ${e.suggestedTurnCount}`}}getMoveDirection(t,e){if(Math.abs(t)>de.EPSILON)return t>0?"right":"left";return e>0?"up":"down"}static issueToString(t){let e=[];return v(e,"traceName",t.traceName),v(e,"targetComponentName",t.targetComponent.sourceComponentName),v(e,"deltaSchX",t.deltaSchX,{formatDelta:!0}),v(e,"deltaSchY",t.deltaSchY,{formatDelta:!0}),v(e,"newSchX",t.newSchX),v(e,"newSchY",t.newSchY),v(e,"currentTurnCount",t.currentTurnCount),v(e,"suggestedTurnCount",t.suggestedTurnCount),v(e,"message",t.message),`<TraceCanBeSimplifiedByMovingComponent ${e.join(" ")} />`}}function J1(t){let e=new Set,r=new Map;for(let s of t){if(s.type!=="source_net"&&s.type!=="source_port")continue;let o=s.type==="source_net"?s.source_net_id:s.source_port_id;if(s.type==="source_net"?s.is_power||s.is_ground||s.is_positive_voltage_source:s.provides_power||s.requires_power||s.provides_ground||s.requires_ground)e.add(o);let l=s.subcircuit_connectivity_map_key;if(l!==void 0){let a=r.get(l)??[];a.push(o),r.set(l,a)}}let n=cs(t),i=Kl([...Object.values(n.netMap),...r.values()]);for(let s of Object.values(i))if(s.some((o)=>e.has(o)))for(let o of s)e.add(o);return e}class me extends U{static EPSILON=0.01;ctx;out;powerOrGroundConnectionIds;constructor({ctx:t,issues:e}){super();this.ctx=t,this.out=e,this.powerOrGroundConnectionIds=J1(t.circuitJson)}_step(){let t=this.ctx.circuitJson.filter((s)=>s.type==="schematic_port"),e=new Map(t.map((s)=>[s.schematic_port_id,s])),r=new Map;for(let s of t){if(!s.schematic_component_id)continue;let o=r.get(s.schematic_component_id)??[];o.push(s),r.set(s.schematic_component_id,o)}let n=new Map(this.ctx.componentPlacements.flatMap((s)=>s.schematicComponentId?[[s.schematicComponentId,s]]:[])),i=new Map;for(let s of this.ctx.circuitJson.filter((o)=>o.type==="schematic_trace")){let o=this.getTracePoints(s),c=this.countTurns(o);if(c===void 0||c<2)continue;let l=this.getTraceEndpoints(s,o,t,e);if(!l)continue;for(let[a,p]of[l,[l[1],l[0]]]){let d=this.getFlipCandidate({trace:s,targetEndpoint:a,connectedEndpoint:p,currentTurnCount:c,portsByComponentId:r,placementsByComponentId:n});if(!d)continue;let m=d.targetPort.schematic_component_id,f=i.get(m);if(!f||this.isBetterCandidate(d,f))i.set(m,d)}}for(let s of i.values())this.out.push(this.makeIssue(s));this.solved=!0}getFlipCandidate({trace:t,targetEndpoint:e,connectedEndpoint:r,currentTurnCount:n,portsByComponentId:i,placementsByComponentId:s}){let o=e.port,c=r.port,l=o.schematic_component_id,a=c.schematic_component_id;if(!l||!a||l===a||o.schematic_sheet_id!==c.schematic_sheet_id)return;let p=i.get(l);if(p?.length!==2)return;if(p.some((b)=>b.source_port_id&&this.powerOrGroundConnectionIds.has(b.source_port_id)))return;if((i.get(a)??[]).length<=2)return;let m=p.find((b)=>b.schematic_port_id!==o.schematic_port_id);if(!m||!this.areOppositePorts(o,m))return;let f=o.facing_direction,_=m.facing_direction;if(!f||!_)return;if(!this.traceLeavesPortInFacingDirection(e))return;let g=c.center;if(this.isPointInFacingDirection(o.center,g,f)||!this.isPointInFacingDirection(m.center,g,_)||!c.facing_direction||!this.isPointInFacingDirection(g,m.center,c.facing_direction))return;let y=this.getMinimumTurnCount(m.center,g,_);if(y>=n)return;let S=s.get(l),P=s.get(a);if(!S||!P)return;return{trace:t,targetPort:o,targetPlacement:S,connectedPlacement:P,suggestedFacingDirection:_,currentTurnCount:n,suggestedTurnCount:y,traceLength:this.getTraceLength(e.pointsFromEndpoint)}}getTraceEndpoints(t,e,r,n){let i=t.edges[0],s=t.edges.at(-1);if(!i||!s||e.length<2)return;let o=i.from_schematic_port_id?n.get(i.from_schematic_port_id):this.findPortAtPoint(r,e[0],t.schematic_sheet_id),c=s.to_schematic_port_id?n.get(s.to_schematic_port_id):this.findPortAtPoint(r,e.at(-1),t.schematic_sheet_id);if(!o||!c)return;return[{port:o,pointsFromEndpoint:e},{port:c,pointsFromEndpoint:[...e].reverse()}]}getTracePoints(t){let e=t.edges[0];if(!e)return[];let r=[e.from];for(let n of t.edges){if(!this.pointsEqual(r.at(-1),n.from))return[];r.push(n.to)}return r}countTurns(t){let e=[];for(let[r,n]of t.slice(1).entries()){let i=t[r];if(this.pointsEqual(i,n))continue;let s=this.getAxis(i,n);if(!s)return;if(e.at(-1)!==s)e.push(s)}return Math.max(0,e.length-1)}traceLeavesPortInFacingDirection(t){let e=t.pointsFromEndpoint.find((r)=>!this.pointsEqual(r,t.port.center));return Boolean(e&&t.port.facing_direction&&this.isPointInFacingDirection(t.port.center,e,t.port.facing_direction))}areOppositePorts(t,e){let r=(t.facing_direction==="left"&&e.facing_direction==="right"||t.facing_direction==="right"&&e.facing_direction==="left")&&Math.abs(t.center.y-e.center.y)<=me.EPSILON,n=(t.facing_direction==="up"&&e.facing_direction==="down"||t.facing_direction==="down"&&e.facing_direction==="up")&&Math.abs(t.center.x-e.center.x)<=me.EPSILON;return r||n}getMinimumTurnCount(t,e,r){return(r==="left"||r==="right"?Math.abs(t.y-e.y)<=me.EPSILON:Math.abs(t.x-e.x)<=me.EPSILON)?0:1}isPointInFacingDirection(t,e,r){let{EPSILON:n}=me;switch(r){case"left":return e.x<t.x-n;case"right":return e.x>t.x+n;case"up":return e.y>t.y+n;case"down":return e.y<t.y-n}}getAxis(t,e){let r=Math.abs(t.x-e.x),n=Math.abs(t.y-e.y),{EPSILON:i}=me;if(r<=i&&n>i)return"vertical";if(n<=i&&r>i)return"horizontal";return}pointsEqual(t,e){let{EPSILON:r}=me;return Math.abs(t.x-e.x)<=r&&Math.abs(t.y-e.y)<=r}findPortAtPoint(t,e,r){return t.find((n)=>n.schematic_sheet_id===r&&this.pointsEqual(n.center,e))}getTraceLength(t){return t.slice(1).reduce((e,r,n)=>{let i=t[n];return e+Math.abs(r.x-i.x)+Math.abs(r.y-i.y)},0)}isBetterCandidate(t,e){let r=t.currentTurnCount-t.suggestedTurnCount,n=e.currentTurnCount-e.suggestedTurnCount;return r>n||r===n&&t.traceLength>e.traceLength}makeIssue(t){let e=t.targetPlacement.sourceComponentName||"component",r=t.connectedPlacement.sourceComponentName||"component",n=t.targetPort.pin_number?`pin${t.targetPort.pin_number}`:t.targetPort.display_pin_label;return{lineItemType:"TwoPinComponentCouldBeFlipped",schematicTraceId:t.trace.schematic_trace_id,traceName:$s(this.ctx.circuitJson,t.trace),targetComponent:t.targetPlacement,connectedComponent:t.connectedPlacement,targetPin:n,currentFacingDirection:t.targetPort.facing_direction,suggestedFacingDirection:t.suggestedFacingDirection,deltaSchRotation:180,currentTurnCount:t.currentTurnCount,suggestedTurnCount:t.suggestedTurnCount,message:`rotate ${e} by 180° so ${n??"its connected pin"} faces ${r} and reduce this trace from ${t.currentTurnCount} turns to ${t.suggestedTurnCount}`}}static issueToString(t){let e=[];return v(e,"traceName",t.traceName),v(e,"targetComponentName",t.targetComponent.sourceComponentName),v(e,"connectedComponentName",t.connectedComponent.sourceComponentName),v(e,"targetPin",t.targetPin),v(e,"currentFacingDirection",t.currentFacingDirection),v(e,"suggestedFacingDirection",t.suggestedFacingDirection),v(e,"deltaSchRotation",t.deltaSchRotation),v(e,"currentTurnCount",t.currentTurnCount),v(e,"suggestedTurnCount",t.suggestedTurnCount),v(e,"message",t.message),`<TwoPinComponentCouldBeFlipped ${e.join(" ")} />`}}class mi extends U{params;VERBOSE_NET_LABEL_MESSAGE="Create trace with schDisplayLabel";netLabels;tokenToInvolvedPin;schematicSheetNameById;currentIndex=0;seen=new Set;constructor(t){super();this.params=t;let{circuitJson:e}=t.ctx;this.netLabels=e.filter((r)=>this.isSchematicNetLabel(r)),this.tokenToInvolvedPin=this.buildTokenToInvolvedPinMap(e),this.schematicSheetNameById=di(e),this.solved=this.netLabels.length===0}_step(){let t=this.netLabels[this.currentIndex++];if(!t){this.solved=!0;return}this.solved=this.currentIndex>=this.netLabels.length;let e=`${t.schematic_sheet_id??""}:${t.text}`;if(!t.text.includes("/")||this.seen.has(e))return;this.seen.add(e);let r;if(t.schematic_sheet_id)r=this.schematicSheetNameById.get(t.schematic_sheet_id);let n={lineItemType:"VerboseSchematicNetLabel",schematicNetLabelId:t.schematic_net_label_id,sourceNetId:t.source_net_id,schematicSheetId:t.schematic_sheet_id,schematicSheetName:r,text:t.text,involvedPins:this.getInvolvedPins(t.text,this.tokenToInvolvedPin),schX:t.center.x,schY:t.center.y,message:this.VERBOSE_NET_LABEL_MESSAGE};this.params.issues.push(n)}static issueToString(t){let e=[];return v(e,"message",t.message),v(e,"text",t.text),v(e,"involvedPins",t.involvedPins.join(",")),v(e,"schSheetName",t.schematicSheetName),v(e,"schX",t.schX),v(e,"schY",t.schY),`<VerboseSchematicNetLabel ${e.join(" ")} />`}isSchematicNetLabel(t){return t.type==="schematic_net_label"}isSourcePort(t){return t.type==="source_port"}getSourceComponentWithName(t){if(t.type!=="source_component"||!("source_component_id"in t)||!("name"in t)||typeof t.source_component_id!=="string"||typeof t.name!=="string")return null;return{source_component_id:t.source_component_id,name:t.name}}getSourcePortNameCandidates(t){return[t.most_frequently_referenced_by_name,t.name,...t.port_hints??[],t.pin_number===void 0?void 0:String(t.pin_number)].filter((e)=>Boolean(e))}getBestSourcePortName(t){return t.most_frequently_referenced_by_name??t.name??(t.pin_number===void 0?"":`pin${t.pin_number}`)}buildTokenToInvolvedPinMap(t){let e=new Map(t.flatMap((n)=>{let i=this.getSourceComponentWithName(n);return i?[i]:[]}).map((n)=>[n.source_component_id,n])),r=new Map;for(let n of t.filter((i)=>this.isSourcePort(i))){if(!n.source_component_id)continue;let i=e.get(n.source_component_id);if(!i?.name)continue;let s=`${i.name}.${this.getBestSourcePortName(n)}`;for(let o of this.getSourcePortNameCandidates(n))r.set(`${i.name}_${o}`,s)}return r}getInvolvedPins(t,e){let r=new Set;for(let n of t.split("/")){let i=e.get(n);if(i)r.add(i)}return Array.from(r)}}class ui extends U{params;texts;obstacles;sheetNames;index=0;constructor(t){super();this.params=t;let{ctx:e}=t;this.sheetNames=di(e.circuitJson);let r=new Set(e.circuitJson.flatMap((i)=>i.type==="schematic_component"&&i.is_box_with_pins===!1&&!i.symbol_name?[i.schematic_component_id]:[])),n=new Set;this.texts=e.circuitJson.flatMap((i)=>{if(i.type!=="schematic_text")return[];if(i.schematic_component_id||i.schematic_symbol_id)return[];let s=br(i);if(!s.length)return[];let o=i.schematic_sheet_id,c=JSON.stringify([o,i.text,i.position.x,i.position.y,i.font_size,i.anchor,i.rotation,i.color]);if(n.has(c))return[];return n.add(c),[{text:i,isTraceLabel:Boolean("source_trace_id"in i&&i.source_trace_id),polygons:s,sheetId:o,object:{type:"text",id:i.schematic_text_id,text:i.text}}]}),this.obstacles=[...e.componentPlacements.flatMap((i)=>i.schematicComponentId&&!r.has(i.schematicComponentId)?[{object:{type:"component",id:i.schematicComponentId,componentName:i.sourceComponentName,schematicComponentId:i.schematicComponentId},polygons:[tr(zt(i.schX,i.schY,i.width,i.height))],sheetId:i.schematicSheetId}]:[]),...e.circuitJson.flatMap((i)=>i.type==="schematic_trace"?[{object:{type:"trace",id:i.schematic_trace_id},sheetId:i.schematic_sheet_id,segments:i.edges,polygons:i.edges.flatMap((s)=>{let o=Vi(s.from,s.to);return o?[o]:[]})}]:[])],this.solved=this.texts.length===0}_step(){let t=this.texts[this.index],r=[...this.obstacles,...this.texts.slice(this.index+1)].filter((n)=>this.collides(t,n));if(r.length){let n=t.isTraceLabel?void 0:this.findClearPosition(t);for(let i of r){let s=i.object.componentName??i.object.text;this.params.issues.push({lineItemType:"SchematicTextCollision",schematicSheetId:t.sheetId,schematicSheetName:t.sheetId?this.sheetNames.get(t.sheetId):void 0,schematicTextId:t.text.schematic_text_id,text:t.text.text,collidingObject:i.object,textBounds:zi(t.polygons),collidingObjectBounds:zi(i.polygons),suggestedMove:n,message:`Text "${t.text.text}" overlaps ${i.object.type}${s?` ${s}`:""}; ${t.isTraceLabel?"adjust the owning trace's label placement or remove stale duplicates to leave the visible text area clear.":"reposition the text to leave its visible area clear."}`})}}this.index++,this.solved=this.index>=this.texts.length}collides(t,e){if(t.sheetId!==e.sheetId)return!1;return t.polygons.some((r)=>e.segments?e.segments.some((n)=>hn(n.from,n.to,r)):e.polygons.some((n)=>Di(r,n)))}findClearPosition(t){let e=[...this.obstacles,...this.texts.filter((n)=>n!==t)],r=Math.max(0.1,t.text.font_size/2);for(let n=r;n<=Math.max(4,t.text.font_size*8);n+=r)for(let[i,s]of[[0,n],[0,-n],[-n,0],[n,0]]){let o=Math.round((t.text.position.x+i)*1000)/1000,c=Math.round((t.text.position.y+s)*1000)/1000,l={...t,polygons:br({...t.text,position:{x:o,y:c}})};if(e.every((a)=>!this.collides(l,a)))return{newSchX:o,newSchY:c}}return}static issueToString(t){let e=[];return v(e,"text",t.text),v(e,"collidingObjectType",t.collidingObject.type),v(e,"collidingText",t.collidingObject.text),v(e,"newSchX",t.suggestedMove?.newSchX),v(e,"newSchY",t.suggestedMove?.newSchY),v(e,"message",t.message),`<SchematicTextCollision ${e.join(" ")} />`}}class Xr extends U{params;static MIN_DISTANCE=6;networks;index=0;constructor(t){super();this.params=t;this.networks=this.findNetworks(t.ctx),this.solved=this.networks.length===0}_step(){let t=this.networks[this.index],e=t.members.slice(0,2),r=Math.max(Xr.MIN_DISTANCE,...e.map((i)=>3*Math.max(i.width,i.height))),n=e.map((i)=>Math.hypot(Math.max(0,Math.abs(i.schX-t.pinPosition.x)-i.width/2),Math.max(0,Math.abs(i.schY-t.pinPosition.y)-i.height/2)));if(n.some((i)=>i>r)){let i=t.host.sourceComponentName||"component",s=K1(t.pin),o=e.map((c)=>c.sourceComponentName||"component").join(", ");this.params.issues.push({lineItemType:"ResetNetworkNotGrouped",hostSchematicBox:t.host,resetSourcePortId:t.pin.source_port_id,resetPinName:s,supportNetworkComponents:t.members,maxDistanceFromResetPin:Math.round(Math.max(...n)*100)/100,maxRecommendedDistance:r,message:`Group ${o} near ${i}.${s} so the reset pull-up and capacitor can be read together. Preserve all net connections; associated test points may remain in a debug area.`})}this.index++,this.solved=this.index>=this.networks.length}findNetworks(t){let e=Zo(t.circuitJson),r=t.circuitJson.filter((_)=>_.type==="source_component"),n=new Map(r.map((_)=>[_.source_component_id,_])),i=t.circuitJson.filter((_)=>_.type==="source_port"),s=new Map,o=new Map,c=new Set,l=new Set;for(let _ of i){if(!_.source_component_id)continue;let g=s.get(_.source_component_id)??[];g.push(_),s.set(_.source_component_id,g);let y=e(_.source_port_id),S=o.get(y)??[];if(S.push(_),o.set(y,S),_.provides_power||_.requires_power)c.add(y);if(_.provides_ground||_.requires_ground)l.add(y)}for(let _ of t.circuitJson){if(_.type!=="source_net")continue;if(_.is_power||_.is_positive_voltage_source)c.add(e(_.source_net_id));if(_.is_ground)l.add(e(_.source_net_id))}let a=new Map(t.componentPlacements.flatMap((_)=>_.sourceComponentId?[[_.sourceComponentId,_]]:[])),p=t.circuitJson.filter((_)=>_.type==="schematic_port"),d=new Map(t.circuitJson.filter((_)=>_.type==="schematic_component").map((_)=>[_.schematic_component_id,_])),m=[],f=new Set;for(let _ of i){if(!_.source_component_id||!K1(_)||_.do_not_connect)continue;if(n.get(_.source_component_id)?.ftype!=="simple_chip")continue;let g=e(_.source_port_id);if(f.has(g)||c.has(g)||l.has(g))continue;f.add(g);let y=o.get(g)??[];if(new Set(y.filter((Q)=>Q.source_component_id&&n.get(Q.source_component_id)?.ftype==="simple_chip").map((Q)=>Q.source_component_id)).size!==1)continue;let P=a.get(_.source_component_id),b=p.find((Q)=>Q.source_port_id===_.source_port_id&&Q.schematic_component_id===P?.schematicComponentId);if(!P||!b||b.schematic_sheet_id!==P.schematicSheetId)continue;let C=[],L=[],B=[],k=!1;for(let Q of new Set(y.map((lt)=>lt.source_component_id))){if(!Q||Q===_.source_component_id)continue;let lt=n.get(Q)?.ftype,z=s.get(Q)??[],N=a.get(Q);if(lt==="simple_connector"||lt==="simple_pin_header")continue;if(!N){k=!0;break}if(lt==="simple_test_point"&&z.length===1){B.push(N);continue}if(z.length!==2){k=!0;break}let at=z.find((et)=>e(et.source_port_id)!==g);if(!at){k=!0;break}let ot=e(at.source_port_id);if(lt==="simple_resistor"&&c.has(ot)&&!l.has(ot))C.push(N);else if(lt==="simple_capacitor"&&l.has(ot)&&!c.has(ot))L.push(N);else{k=!0;break}}if(k||C.length!==1||L.length!==1)continue;let I=[...C,...L,...B],j=P.schematicComponentId?d.get(P.schematicComponentId)?.schematic_group_id:void 0;if(I.some((Q)=>{let lt=Q.schematicComponentId?d.get(Q.schematicComponentId)?.schematic_group_id:void 0;return Q.schematicSheetId!==P.schematicSheetId||Q.subcircuitId!==P.subcircuitId||lt!==j}))continue;m.push({host:P,pin:_,pinPosition:b.center,members:I})}return m}static issueToString(t){let e=[];return v(e,"hostComponentName",t.hostSchematicBox.sourceComponentName),v(e,"resetPin",t.resetPinName),v(e,"supportNetworkComponents",t.supportNetworkComponents.map((r)=>r.sourceComponentName||"component").join(",")),v(e,"maxDistanceFromResetPin",t.maxDistanceFromResetPin),v(e,"maxRecommendedDistance",t.maxRecommendedDistance),v(e,"message",t.message),`<ResetNetworkNotGrouped ${e.join(" ")} />`}}var K1=(t)=>[t.name,...t.port_hints??[]].find((e)=>/^N?(RESET|RST)(N|B)?$/.test(e.toUpperCase().replace(/[_\-!~#/]/g,"")));var UA={FuseConnectorNotAligned:[Qr],TransistorLedNotAligned:[Zr],TransistorResistorNotAligned:[qr],PotentiometerHasIncorrectRailOrientation:[Jr],CapacitorSeparatedFromResistorDivider:[Kr],SeriesResistorsNotAligned:[tn],FuseDiodeNotAligned:[nn],InductorSeparatedFromChipPins:[on],SwitchMatrixDiodeSeparatedFromSwitch:[vr],SwitchMatrixBranchesTooSpreadOut:[vr],TransistorHasIncorrectRailOrientation:[xn],ParallelLedBranchesDrawnInline:[cn],SeriesLedChainNotOrdered:[wn],RailPathTooSpreadOut:[Fn],ResistorSeparatedFromChipPin:[Pn],InductorSeparatedFromChipPin:[bn],CapacitorSeparatedFromChipPins:[Mn],CrystalSeparatedFromChipPins:[fn],SharedNodeDiodesInline:[vn],DiodeCapacitorJunctionTooSpreadOut:[Sn],PiFilterComponentsNotGrouped:[Cn],MosfetGateNetworkNotGrouped:[kn],FlybackDiodeSeparatedFromRelayCoil:[Nn],ComponentOverlap:[Pr],SchematicBoxHasALotOfSurroundingWhitespace:[],CapacitorSymbolHorizontal:[le,_e],VerboseSchematicNetLabel:[mi],PinHeaderSchematicBoxTooWide:[Br],GenericSchematicBoxTooWide:[Br],SchematicBoxInnerLabelCollision:[$n],SchematicBoxInnerLabelOutOfBounds:[gn],SchematicPinPaddingToEdgeTooLarge:[jn],DiodeResistorNotAligned:[Ae],HighPassRcFilterComponentsNotGrouped:[sn],SeriesRcFilterComponentsNotGrouped:[dn],SwitchRcNetworkNotGrouped:[pn],ParallelResistorsDrawnInline:[mn],ResistorSeparatedFromCrystal:[ln],ParallelCapacitorsDrawnInline:[un],ParallelRcNotAligned:[An],ParallelDiodeResistorNotAligned:[Bn],ParallelDiodesNotAligned:[en],SeriesRcBranchNotGrouped:[rn],ParallelDiodeCapacitorNotAligned:[an],ComponentPinsWouldAlignWithVerticalShift:[sr],TraceCanBeSimplifiedByMovingComponent:[de],CrystalNotCenteredOverLoadCapacitors:[Oe],ComponentNetLabelCollision:[or],ComponentBoxNetLabelCollision:[or],NetLabelCollision:[or],FeedbackNetworkNotCompact:[Ar],PullResistorOnWrongSide:[ar,Ws],SchematicTextCollision:[ui],ResetNetworkNotGrouped:[Xr],TwoPinComponentCouldBeFlipped:[me],TwoPinComponentShouldBeVertical:[_e],TwoPinComponentHasInvertedRails:[_e],DecouplingCapacitorsNotCloseTogether:[Re],ConnectorPositionCausesTraceDetours:[Rn],LowSideTransistorNotAlignedWithLoad:[On],UsbSeriesResistorsNotAligned:[Wn],CurrentSenseShuntSeparatedFromInputs:[Yn],VoltageDividerSupplyResistorBelowGroundResistor:[Ln],RegulatorCapacitorsOnWrongSides:[Tn]};class Bh extends ly{ctx;issues=[];pipelineDef=[mt("FuseConnectorAlignmentSolver",Qr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("TransistorLedAlignmentSolver",Zr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("TransistorResistorAlignmentSolver",qr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("PotentiometerRailOrientationSolver",Jr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ResistorDividerCapacitorPlacementSolver",Kr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SeriesResistorAlignmentSolver",tn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("FuseDiodeAlignmentSolver",nn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SwitchRcNetworkGroupingSolver",pn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SwitchMatrixDiodePlacementSolver",vr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ParallelResistorPlacementSolver",mn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ParallelLedBranchPlacementSolver",cn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SeriesLedChainPlacementSolver",wn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ParallelRcPlacementSolver",An,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ParallelDiodeResistorPlacementSolver",Bn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ParallelDiodeAlignmentSolver",en,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SeriesRcBranchGroupingSolver",rn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ParallelDiodeCapacitorAlignmentSolver",an,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SchematicTextClearanceSolver",ui,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ResetNetworkGroupingSolver",Xr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SchematicBoxOverlapSolver",Pr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("CapacitorOrientationSolver",le,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("VerboseNetLabelSolver",mi,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SchematicBoxTooWideSolver",Br,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SchematicPinPaddingToEdgeSolver",jn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SchematicBoxInnerLabelBoundsSolver",gn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SchematicBoxInnerLabelCollisionSolver",$n,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("DiodeResistorAlignmentSolver",Ae,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ComponentPinAlignmentSolver",sr,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("TraceSimplificationSolver",de,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("CrystalLoadCapacitorPlacementSolver",Oe,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("TwoPinComponentOrientationSolver",me,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("FeedbackNetworkPlacementSolver",Ar,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("TransistorRailOrientationSolver",xn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("TwoPinComponentRailOrientationSolver",_e,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("PullResistorPlacementSolver",ar,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SwitchPullResistorPlacementSolver",Ws,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ComponentNetLabelCollisionSolver",or,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("DecouplingCapacitorGroupingSolver",Re,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ConnectorPlacementSolver",Rn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("LowSideTransistorPlacementSolver",On,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("UsbSeriesResistorPlacementSolver",Wn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("RegulatorInputOutputCapacitorPlacementSolver",Tn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("VoltageDividerPlacementSolver",Ln,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("CurrentSenseShuntPlacementSolver",Yn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("RelayFlybackDiodePlacementSolver",Nn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SharedNodeDiodePlacementSolver",vn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("DiodeCapacitorStagePlacementSolver",Sn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("PiFilterPlacementSolver",Cn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("MosfetGateNetworkPlacementSolver",kn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ChipSupplyInductorPlacementSolver",bn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ChipPinResistorPlacementSolver",Pn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ChipPinPairCapacitorPlacementSolver",Mn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ChipPinCrystalPlacementSolver",fn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("RailPathVisibilitySolver",Fn,(t)=>[{ctx:t.ctx,issues:t.issues,maxSpan:t.railPathVisibility?.maxSpan,maxLength:t.railPathVisibility?.maxPathLength}]),mt("HighPassRcFilterPlacementSolver",sn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("SeriesRcFilterPlacementSolver",dn,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("CrystalResistorPlacementSolver",ln,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ParallelCapacitorAlignmentSolver",un,(t)=>[{ctx:t.ctx,issues:t.issues}]),mt("ChipPinPairInductorPlacementSolver",on,(t)=>[{ctx:t.ctx,issues:t.issues}])];selectedIssueTypes;railPathVisibility;constructor(t,e={}){super(t);if(this.railPathVisibility=e.railPathVisibility,e.issueTypes!==void 0){this.selectedIssueTypes=new Set(e.issueTypes);let r=new Set(e.issueTypes.flatMap((n)=>UA[n]));this.pipelineDef=this.pipelineDef.filter((n)=>r.has(n.solverClass))}}_setup(){this.ctx=Z1(this.inputProblem)}getOutput(){let t=new Set(this.issues.flatMap((e)=>e.lineItemType==="TwoPinComponentShouldBeVertical"&&e.schematicBox.schematicComponentId?[e.schematicBox.schematicComponentId]:[]));return{issues:this.issues.filter((e)=>e.lineItemType!=="CapacitorSymbolHorizontal"||!t.has(e.schematicBox.schematicComponentId??"")).filter((e)=>this.selectedIssueTypes===void 0||this.selectedIssueTypes.has(e.lineItemType)),componentPlacements:this.ctx.componentPlacements}}}var js=({issues:t,componentPlacements:e,circuitJson:r})=>{let n=new Set,i=new Map(e.flatMap((l)=>l.schematicComponentId?[[l.schematicComponentId,l]]:[])),s=new Map;for(let l of e){if(!l.sourceComponentName)continue;let a=s.get(l.sourceComponentName);if(a)a.push(l);else s.set(l.sourceComponentName,[l])}let o=(l)=>{if(!l)return;let a=l.schematicComponentId?i.get(l.schematicComponentId):e.find((p)=>p.sourceComponentId===l.sourceComponentId&&p.schX===l.schX&&p.schY===l.schY);if(a)n.add(a)},c=(l,a)=>{if(!l)return;for(let p of s.get(l)??[])if(a===void 0||p.schematicSheetId===a)n.add(p)};for(let l of t)switch(l.lineItemType){case"FuseConnectorNotAligned":o(l.fuseSchematicBox),o(l.connectorSchematicBox);break;case"TransistorLedNotAligned":o(l.transistorSchematicBox),o(l.ledSchematicBox);break;case"TransistorResistorNotAligned":o(l.transistorSchematicBox),o(l.resistorSchematicBox);break;case"PotentiometerHasIncorrectRailOrientation":o(l.schematicBox);break;case"CapacitorSeparatedFromResistorDivider":o(l.capacitorSchematicBox);for(let a of l.resistorSchematicBoxes)o(a);break;case"SeriesResistorsNotAligned":o(l.firstResistorSchematicBox),o(l.secondResistorSchematicBox);break;case"FuseDiodeNotAligned":o(l.fuseSchematicBox),o(l.diodeSchematicBox);break;case"InductorSeparatedFromChipPins":o(l.hostSchematicBox),o(l.inductorSchematicBox);break;case"ParallelLedBranchesDrawnInline":case"SwitchMatrixBranchesTooSpreadOut":for(let a of l.branchSchematicBoxes)o(a);break;case"SwitchMatrixDiodeSeparatedFromSwitch":o(l.switchSchematicBox),o(l.diodeSchematicBox);break;case"SeriesLedChainNotOrdered":for(let a of l.ledSchematicBoxes)o(a);break;case"InductorSeparatedFromChipPin":o(l.hostSchematicBox),o(l.inductorSchematicBox);break;case"ResistorSeparatedFromChipPin":o(l.hostSchematicBox),o(l.resistorSchematicBox);break;case"CrystalSeparatedFromChipPins":o(l.hostSchematicBox),o(l.crystalSchematicBox);break;case"CapacitorSeparatedFromChipPins":o(l.hostSchematicBox),o(l.capacitorSchematicBox);break;case"TransistorHasIncorrectRailOrientation":o(l.transistorSchematicBox),o(l.supplyResistorSchematicBox),o(l.groundResistorSchematicBox);break;case"SharedNodeDiodesInline":for(let a of l.diodeSchematicBoxes)o(a);break;case"DiodeCapacitorJunctionTooSpreadOut":o(l.capacitorSchematicBox);for(let a of l.diodeSchematicBoxes)o(a);break;case"PiFilterComponentsNotGrouped":o(l.inductorSchematicBox),o(l.firstCapacitorSchematicBox),o(l.secondCapacitorSchematicBox);break;case"MosfetGateNetworkNotGrouped":o(l.mosfetSchematicBox),o(l.seriesGateResistorSchematicBox),o(l.gateSourceResistorSchematicBox);break;case"FlybackDiodeSeparatedFromRelayCoil":o(l.relaySchematicBox),o(l.diodeSchematicBox);break;case"CurrentSenseShuntSeparatedFromInputs":o(l.amplifierSchematicBox),o(l.shuntSchematicBox);break;case"VoltageDividerSupplyResistorBelowGroundResistor":o(l.supplyResistorSchematicBox),o(l.groundResistorSchematicBox);break;case"RegulatorCapacitorsOnWrongSides":o(l.regulatorSchematicBox),o(l.inputCapacitorSchematicBox),o(l.outputCapacitorSchematicBox);break;case"UsbSeriesResistorsNotAligned":o(l.positiveResistorSchematicBox),o(l.negativeResistorSchematicBox);break;case"LowSideTransistorNotAlignedWithLoad":o(l.transistorSchematicBox),o(l.loadSchematicBox),o(l.baseResistorSchematicBox),o(l.clampDiodeSchematicBox);break;case"DecouplingCapacitorsNotCloseTogether":for(let a of l.capacitorSchematicBoxes)o(a);break;case"ConnectorPositionCausesTraceDetours":o(l.connectorSchematicBox);for(let a of l.connectedComponents)o(a);break;case"ResetNetworkNotGrouped":o(l.hostSchematicBox);for(let a of l.supportNetworkComponents)o(a);break;case"SchematicTextCollision":if(l.collidingObject.schematicComponentId)o(i.get(l.collidingObject.schematicComponentId));if(l.collidingObject.type==="trace")for(let a of t2({schematicTraceId:l.collidingObject.id,circuitJson:r,placementByComponentId:i}))o(a);break;case"ComponentOverlap":o(l.firstComponent),o(l.secondComponent);break;case"SchematicBoxHasALotOfSurroundingWhitespace":case"CapacitorSymbolHorizontal":case"PinHeaderSchematicBoxTooWide":case"GenericSchematicBoxTooWide":case"SchematicBoxInnerLabelCollision":case"SchematicBoxInnerLabelOutOfBounds":case"SchematicPinPaddingToEdgeTooLarge":o(l.schematicBox);break;case"VerboseSchematicNetLabel":for(let a of l.involvedPins)c(GA(a),l.schematicSheetId);break;case"SwitchRcNetworkNotGrouped":if(o(l.switchSchematicBox),o(l.capacitorSchematicBox),l.resistorSchematicBox)o(l.resistorSchematicBox);break;case"ResistorSeparatedFromCrystal":o(l.crystalSchematicBox),o(l.resistorSchematicBox);break;case"ParallelCapacitorsDrawnInline":o(l.firstCapacitorSchematicBox),o(l.secondCapacitorSchematicBox);break;case"ParallelResistorsDrawnInline":o(l.firstResistorSchematicBox),o(l.secondResistorSchematicBox);break;case"HighPassRcFilterComponentsNotGrouped":case"SeriesRcFilterComponentsNotGrouped":case"ParallelRcNotAligned":o(l.resistorSchematicBox),o(l.capacitorSchematicBox);break;case"ParallelDiodesNotAligned":o(l.firstDiodeSchematicBox),o(l.secondDiodeSchematicBox);break;case"SeriesRcBranchNotGrouped":o(l.resistorSchematicBox),o(l.capacitorSchematicBox);break;case"ParallelDiodeCapacitorNotAligned":o(l.diodeSchematicBox),o(l.capacitorSchematicBox);break;case"ParallelDiodeResistorNotAligned":case"DiodeResistorNotAligned":o(l.diodeSchematicBox),o(l.resistorSchematicBox);break;case"ComponentPinsWouldAlignWithVerticalShift":o(l.firstComponent),o(l.secondComponent),o(l.targetComponent);break;case"TraceCanBeSimplifiedByMovingComponent":o(l.targetComponent);for(let a of t2({schematicTraceId:l.schematicTraceId,circuitJson:r,placementByComponentId:i}))n.add(a);break;case"CrystalNotCenteredOverLoadCapacitors":o(l.crystalSchematicBox),o(l.firstLoadCapacitorSchematicBox),o(l.secondLoadCapacitorSchematicBox);break;case"TwoPinComponentCouldBeFlipped":o(l.targetComponent),o(l.connectedComponent);break;case"FeedbackNetworkNotCompact":o(l.amplifierSchematicBox);for(let a of l.feedbackComponents)o(a);break;case"TwoPinComponentShouldBeVertical":case"TwoPinComponentHasInvertedRails":o(l.schematicBox);break;case"RailPathTooSpreadOut":o(l.hostSchematicBox);for(let a of l.supportSchematicBoxes)o(a);break;case"PullResistorOnWrongSide":o(l.resistorSchematicBox),o(l.hostSchematicBox);break;case"ComponentNetLabelCollision":o(l.firstComponent),o(l.secondComponent);break;case"ComponentBoxNetLabelCollision":o(l.boxComponent),o(l.labelComponent);break;case"NetLabelCollision":for(let a of l.pairs)c(a.comp1Name,l.schematicSheetId),c(a.comp2Name,l.schematicSheetId);for(let a of l.moves)c(a.componentName,l.schematicSheetId);break}return e.filter((l)=>n.has(l))},Dr=(t)=>{if("schematicSheetId"in t||"schematicSheetName"in t){let e="schematicSheetId"in t&&typeof t.schematicSheetId==="string"?t.schematicSheetId:void 0,r="schematicSheetName"in t&&typeof t.schematicSheetName==="string"?t.schematicSheetName:void 0;if(e||r)return{schematicSheetId:e,schematicSheetName:r}}for(let e of Object.values(t).flat())if(HA(e))return{schematicSheetId:e.schematicSheetId,schematicSheetName:e.schematicSheetName};return{}},GA=(t)=>{let e=t.lastIndexOf(".");return e===-1?t:t.slice(0,e)},HA=(t)=>Boolean(t&&typeof t==="object"&&"positionAnchor"in t&&t.positionAnchor==="center"&&"schX"in t&&"schY"in t&&"width"in t&&"height"in t),t2=({schematicTraceId:t,circuitJson:e,placementByComponentId:r})=>{let n=e.find((a)=>a.type==="schematic_trace"&&a.schematic_trace_id===t),i=n?.edges[0],s=n?.edges.at(-1);if(!n||!i||!s)return[];let o=e.filter((a)=>a.type==="schematic_port"),c=new Map(o.map((a)=>[a.schematic_port_id,a]));return[i.from_schematic_port_id?c.get(i.from_schematic_port_id):e2(o,i.from,n.schematic_sheet_id),s.to_schematic_port_id?c.get(s.to_schematic_port_id):e2(o,s.to,n.schematic_sheet_id)].flatMap((a)=>{let p=a?.schematic_component_id?r.get(a.schematic_component_id):void 0;return p?[p]:[]})},e2=(t,e,r)=>t.find((n)=>n.schematic_sheet_id===r&&Math.abs(n.center.x-e.x)<=0.01&&Math.abs(n.center.y-e.y)<=0.01);class Ih{lineItems;groupBySchematicSheet;constructor(t,e=!1){this.lineItems=t;this.groupBySchematicSheet=e}getLineItems(){return this.lineItems}getIssues(t={}){return this.lineItems.flatMap((e)=>e.lineItemType==="SchematicPlacementIssues"?e.issues:[]).filter((e)=>(t.issueTypes===void 0||t.issueTypes.includes(e.lineItemType))&&(t.schematicSheetId===void 0||(Dr(e).schematicSheetId??"")===t.schematicSheetId))}getIssueCounts(t={}){let e={FuseConnectorNotAligned:0,TransistorLedNotAligned:0,TransistorResistorNotAligned:0,PotentiometerHasIncorrectRailOrientation:0,CapacitorSeparatedFromResistorDivider:0,SeriesResistorsNotAligned:0,FuseDiodeNotAligned:0,InductorSeparatedFromChipPins:0,TransistorHasIncorrectRailOrientation:0,FlybackDiodeSeparatedFromRelayCoil:0,ComponentOverlap:0,SchematicBoxHasALotOfSurroundingWhitespace:0,CapacitorSymbolHorizontal:0,VerboseSchematicNetLabel:0,PinHeaderSchematicBoxTooWide:0,GenericSchematicBoxTooWide:0,SchematicBoxInnerLabelCollision:0,SchematicBoxInnerLabelOutOfBounds:0,SchematicPinPaddingToEdgeTooLarge:0,DiodeResistorNotAligned:0,HighPassRcFilterComponentsNotGrouped:0,SeriesRcFilterComponentsNotGrouped:0,SwitchRcNetworkNotGrouped:0,ParallelResistorsDrawnInline:0,ResistorSeparatedFromCrystal:0,ParallelCapacitorsDrawnInline:0,ParallelRcNotAligned:0,ParallelDiodeResistorNotAligned:0,ParallelDiodesNotAligned:0,SeriesRcBranchNotGrouped:0,ParallelDiodeCapacitorNotAligned:0,ComponentPinsWouldAlignWithVerticalShift:0,TraceCanBeSimplifiedByMovingComponent:0,CrystalNotCenteredOverLoadCapacitors:0,ComponentNetLabelCollision:0,ComponentBoxNetLabelCollision:0,NetLabelCollision:0,FeedbackNetworkNotCompact:0,PullResistorOnWrongSide:0,SchematicTextCollision:0,ResetNetworkNotGrouped:0,TwoPinComponentCouldBeFlipped:0,TwoPinComponentShouldBeVertical:0,TwoPinComponentHasInvertedRails:0,DecouplingCapacitorsNotCloseTogether:0,ConnectorPositionCausesTraceDetours:0,LowSideTransistorNotAlignedWithLoad:0,UsbSeriesResistorsNotAligned:0,RegulatorCapacitorsOnWrongSides:0,VoltageDividerSupplyResistorBelowGroundResistor:0,CurrentSenseShuntSeparatedFromInputs:0,DiodeCapacitorJunctionTooSpreadOut:0,SharedNodeDiodesInline:0,PiFilterComponentsNotGrouped:0,MosfetGateNetworkNotGrouped:0,CapacitorSeparatedFromChipPins:0,CrystalSeparatedFromChipPins:0,ResistorSeparatedFromChipPin:0,InductorSeparatedFromChipPin:0,RailPathTooSpreadOut:0,SwitchMatrixDiodeSeparatedFromSwitch:0,SwitchMatrixBranchesTooSpreadOut:0,ParallelLedBranchesDrawnInline:0,SeriesLedChainNotOrdered:0};for(let r of this.getIssues(t))e[r.lineItemType]++;return e}getString(){return this.toString()}schematicBoxPlacementsToString(t){let e=[];return v(e,"componentName",t.sourceComponentName),v(e,"positionAnchor",t.positionAnchor),v(e,"schX",t.schX),v(e,"schY",t.schY),v(e,"width",t.width),v(e,"height",t.height),`<SchematicBoxPlacement ${e.join(" ")} />`}schematicIssuesToString(t){switch(t.lineItemType){case"FuseConnectorNotAligned":return Qr.issueToString(t);case"TransistorLedNotAligned":return Zr.issueToString(t);case"TransistorResistorNotAligned":return qr.issueToString(t);case"PotentiometerHasIncorrectRailOrientation":return Jr.issueToString(t);case"CapacitorSeparatedFromResistorDivider":return Kr.issueToString(t);case"SeriesResistorsNotAligned":return tn.issueToString(t);case"FuseDiodeNotAligned":return nn.issueToString(t);case"InductorSeparatedFromChipPins":return on.issueToString(t);case"TransistorHasIncorrectRailOrientation":return xn.issueToString(t);case"SwitchMatrixBranchesTooSpreadOut":case"SwitchMatrixDiodeSeparatedFromSwitch":return vr.issueToString(t);case"ParallelLedBranchesDrawnInline":return cn.issueToString(t);case"SeriesLedChainNotOrdered":return wn.issueToString(t);case"InductorSeparatedFromChipPin":return bn.issueToString(t);case"ResistorSeparatedFromChipPin":return Pn.issueToString(t);case"CrystalSeparatedFromChipPins":return fn.issueToString(t);case"CapacitorSeparatedFromChipPins":return Mn.issueToString(t);case"SharedNodeDiodesInline":return vn.issueToString(t);case"DiodeCapacitorJunctionTooSpreadOut":return Sn.issueToString(t);case"PiFilterComponentsNotGrouped":return Cn.issueToString(t);case"MosfetGateNetworkNotGrouped":return kn.issueToString(t);case"CurrentSenseShuntSeparatedFromInputs":return Yn.issueToString(t);case"ComponentOverlap":return Pr.issueToString(t);case"CapacitorSymbolHorizontal":return le.issueToString(t);case"DecouplingCapacitorsNotCloseTogether":return Re.issueToString(t);case"VerboseSchematicNetLabel":return mi.issueToString(t);case"PinHeaderSchematicBoxTooWide":case"GenericSchematicBoxTooWide":return Br.issueToString(t);case"SchematicBoxInnerLabelOutOfBounds":return gn.issueToString(t);case"SchematicBoxInnerLabelCollision":return $n.issueToString(t);case"SchematicPinPaddingToEdgeTooLarge":return jn.issueToString(t);case"HighPassRcFilterComponentsNotGrouped":return sn.issueToString(t);case"SeriesRcFilterComponentsNotGrouped":return dn.issueToString(t);case"SwitchRcNetworkNotGrouped":return pn.issueToString(t);case"ResistorSeparatedFromCrystal":return ln.issueToString(t);case"ParallelCapacitorsDrawnInline":return un.issueToString(t);case"ParallelResistorsDrawnInline":return mn.issueToString(t);case"ParallelRcNotAligned":return An.issueToString(t);case"ParallelDiodesNotAligned":return en.issueToString(t);case"SeriesRcBranchNotGrouped":return rn.issueToString(t);case"ParallelDiodeCapacitorNotAligned":return an.issueToString(t);case"ParallelDiodeResistorNotAligned":return Bn.issueToString(t);case"DiodeResistorNotAligned":return Ae.issueToString(t);case"ComponentPinsWouldAlignWithVerticalShift":return sr.issueToString(t);case"TraceCanBeSimplifiedByMovingComponent":return de.issueToString(t);case"CrystalNotCenteredOverLoadCapacitors":return Oe.issueToString(t);case"TwoPinComponentCouldBeFlipped":return me.issueToString(t);case"FeedbackNetworkNotCompact":return Ar.issueToString(t);case"TwoPinComponentShouldBeVertical":case"TwoPinComponentHasInvertedRails":return _e.issueToString(t);case"RailPathTooSpreadOut":return Fn.issueToString(t);case"PullResistorOnWrongSide":return ar.issueToString(t);case"NetLabelCollision":return or.netLabelCollisionToString(t);case"SchematicTextCollision":return ui.issueToString(t);case"ResetNetworkNotGrouped":return Xr.issueToString(t);case"ConnectorPositionCausesTraceDetours":return Rn.issueToString(t);case"LowSideTransistorNotAlignedWithLoad":return On.issueToString(t);case"FlybackDiodeSeparatedFromRelayCoil":return Nn.issueToString(t);case"VoltageDividerSupplyResistorBelowGroundResistor":return Ln.issueToString(t);case"RegulatorCapacitorsOnWrongSides":return Tn.issueToString(t);case"UsbSeriesResistorsNotAligned":return Wn.issueToString(t);default:return""}}toString(){let t=this.lineItems.filter((i)=>i.lineItemType==="SchematicBoxPlacement"),e=this.lineItems.flatMap((i)=>i.lineItemType==="SchematicPlacementIssues"?i.issues:[]);if(e.length===0)return"";if(!this.groupBySchematicSheet)return this.issueContextToLines(t,e).join(`
`);let r=new Map,n=(i)=>{let s=i.schematicSheetId??i.schematicSheetName??"__default__",o=r.get(s);if(o)return o;let c={...i,placements:[],issues:[]};return r.set(s,c),c};for(let i of e)n(Dr(i)).issues.push(i);for(let i of t)n({schematicSheetId:i.schematicSheetId,schematicSheetName:i.schematicSheetName}).placements.push(i);return[...r.values()].flatMap((i)=>{let s=[];return v(s,"name",i.schematicSheetName),v(s,"id",i.schematicSheetId),[`<SchematicSheet${s.length>0?` ${s.join(" ")}`:""}>`,...this.issueContextToLines(i.placements,i.issues),"</SchematicSheet>"]}).join(`
`)}issueContextToLines(t,e){return[...t.length>0?["<SchematicBoxPositions>",...t.map(this.schematicBoxPlacementsToString),"</SchematicBoxPositions>"]:[],"<SchematicPlacementIssues>",...e.map(this.schematicIssuesToString),"</SchematicPlacementIssues>"]}}var Fh=(t,e={})=>{let r=new Bh(t,e);r.solve();let{issues:n,componentPlacements:i}=r.getOutput(),o=[...js({issues:n,componentPlacements:i,circuitJson:t}),...n.length>0?[{lineItemType:"SchematicPlacementIssues",issues:n}]:[]],c=new Set(t.flatMap((l)=>("schematic_sheet_id"in l)&&typeof l.schematic_sheet_id==="string"?[l.schematic_sheet_id]:[]));return new Ih(o,c.size>1)};function QA(t){let e=t.match(/<svg([^>]*)>/);if(!e)throw Error("Invalid SVG string: No <svg> tag found");let r={},n={},i=e[1]??"",s=/([A-Za-z_:][A-Za-z0-9_.:-]*)=(?:"([^"]*)"|'([^']*)')/g,o;while((o=s.exec(i))!==null){let y=o[1],S=o[2]??o[3];if(!y||S===void 0)continue;if(y==="xmlns"||y.startsWith("xmlns:"))n[y]=S;r[y]=S}let c=0,l=0,a,p,d,m,f;if(r.viewBox){a=r.viewBox;let y=a.trim().split(/[\s,]+/).map((S)=>Number.parseFloat(S));if(Number.isFinite(y[0]))p=y[0];if(Number.isFinite(y[1]))d=y[1];if(Number.isFinite(y[2]))m=y[2];if(Number.isFinite(y[3]))f=y[3];if(!r.width&&Number.isFinite(m))c=m;if(!r.height&&Number.isFinite(f))l=f}if(r.width){let y=Number.parseFloat(r.width);if(Number.isFinite(y))c=y}if(r.height){let y=Number.parseFloat(r.height);if(Number.isFinite(y))l=y}if(!Number.isFinite(c))c=0;if(!Number.isFinite(l))l=0;let g=t.match(/<svg[^>]*>([\s\S]*)<\/svg>/)?.[1]?.trim()??"";return{width:c,height:l,viewBox:a,viewBoxMinX:p,viewBoxMinY:d,viewBoxWidth:m,viewBoxHeight:f,content:g,attributes:r,xmlnsAttributes:n}}function ZA(t,e,r){let n=[];if(n.push(`translate(${e}, ${r})`),t.viewBoxMinX!==void 0&&t.viewBoxMinY!==void 0&&t.viewBoxWidth&&t.viewBoxHeight){let{viewBoxMinX:s,viewBoxMinY:o}=t,c=t.width||t.viewBoxWidth,l=t.height||t.viewBoxHeight,a=c/t.viewBoxWidth,p=l/t.viewBoxHeight;n.push(`scale(${a}, ${p})`),n.push(`translate(${-s}, ${-o})`)}return n.join(" ")}function qA(t,e){let r=new Map,n=/\bid="([^"]+)"/g,i;while((i=n.exec(t))!==null){let o=i[1];if(!o)continue;let c=`${o}${e}`;r.set(o,c)}if(r.size===0)return t;let s=t.replace(n,(o,c)=>`id="${r.get(c)||c}"`);return s=s.replace(/url\(#([^)]+)\)/g,(o,c)=>r.has(c)?`url(#${r.get(c)})`:o),s=s.replace(/(xlink:href|href)="#([^"]+)"/g,(o,c,l)=>r.has(l)?`${c}="#${r.get(l)}"`:o),s=s.replace(/style="([^"]*)"/g,(o,c)=>`style="${c.replace(/url\(#([^)]+)\)/g,(a,p)=>r.has(p)?`url(#${r.get(p)})`:a)}"`),s}function JA(t,e){if(t.length===0)return t;let r=0;for(let i of t){let s=Math.max(i.width,i.height);if(s>r)r=s}if(r===0)return t;let n=e??r;return t.map((i)=>{let s=Math.max(i.width,i.height);if(s===0)return i;let o=n/s;return{...i,width:i.width*o,height:i.height*o}})}function KA(t){let e={};e.xmlns="http://www.w3.org/2000/svg";for(let r of t)for(let[n,i]of Object.entries(r.xmlnsAttributes))if(!e[n])e[n]=i;return e}function tP(t){return Object.entries(t).map(([e,r])=>`${e}="${r}"`).join(" ")}function r2(t,e={}){let r=e.gap??0;if(!Number.isFinite(r))r=0;let n=e.normalizeSize??!0;if(t.length===0)return'<svg width="0" height="0" viewBox="0 0 0 0" xmlns="http://www.w3.org/2000/svg"></svg>';let i=t.map((f,_)=>{try{return QA(f)}catch(g){throw Error(`Failed to parse SVG at index ${_}: ${g.message}`)}}),s=n?JA(i,e.targetSize):i,o=Math.max(...s.map((f)=>f.width)),c=s.reduce((f,_)=>f+_.height,0)+r*(s.length-1),l=0,a=[];for(let f=0;f<s.length;f++){let _=s[f];if(!_)continue;let g=(o-_.width)/2,y=f===0?_.content:qA(_.content,`__stack${f}`),S=ZA(_,g,l);a.push(`  <g transform="${S}">
    ${y}
  </g>`),l+=_.height+r}let p=KA(s),d={width:o.toString(),height:c.toString(),viewBox:`0 0 ${o} ${c}`,...p,...e.rootAttributes||{}};return`<svg ${tP(d)}>
${a.join(`
`)}
</svg>`}var n2="T1RUTwAJAIAAAwAQQ0ZGIFhQSpcAAAcwAABJ3U9TLzJqmmVhAAABAAAAAGBjbWFwFN0WswAABEwAAALEaGVhZC1P1HwAAACcAAAANmhoZWEDrgI1AAAA1AAAACRobXR44xAAAAAAURAAAAFQbWF4cABUUAAAAAD4AAAABm5hbWUZQ94BAAABYAAAAutwb3N0AAMAAAAABxAAAAAgAAEAAAABAADb+Z65Xw889QADA+gAAAAA5e9IsgAAAADl70iy/9P/PwKHAvkAAAADAAIAAAAAAAAAAQAAA6z/LAAAArQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAFQAAFAAAFQAAAADArQB9AAFAAACigK7AAAAjAKKArsAAAHfADEBAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAABYWFhYAEAAIQB6A6z/LAAAAvkAwQAAAAEAAAAAAiwC1wAAAAAAAAAAACIBngABAAAAAAAAAAEAWQABAAAAAAABABEAAAABAAAAAAACAAcAMwABAAAAAAADABsA/AABAAAAAAAEABkASAABAAAAAAAFAAsA2wABAAAAAAAGABgAkwABAAAAAAAHAAEAWQABAAAAAAAIAAEAWQABAAAAAAAJAAEAWQABAAAAAAAKAAEAWQABAAAAAAALAAEAWQABAAAAAAAMAAEAWQABAAAAAAANAAEAWQABAAAAAAAOAAEAWQABAAAAAAAQABEAAAABAAAAAAARAAcAMwADAAEECQAAAAIAgwADAAEECQABACIAEQADAAEECQACAA4AOgADAAEECQADADYBFwADAAEECQAEADIAYQADAAEECQAFABYA5gADAAEECQAGADAAqwADAAEECQAHAAIAgwADAAEECQAIAAIAgwADAAEECQAJAAIAgwADAAEECQAKAAIAgwADAAEECQALAAIAgwADAAEECQAMAAIAgwADAAEECQANAAIAgwADAAEECQAOAAIAgwADAAEECQAQACIAEQADAAEECQARAA4AOlRzY2lyY3VpdEFscGhhYmV0AFQAcwBjAGkAcgBjAHUAaQB0AEEAbABwAGgAYQBiAGUAdFJlZ3VsYXIAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0IFJlZ3VsYXIAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgBUAHMAYwBpAHIAYwB1AGkAdABBAGwAcABoAGEAYgBlAHQAUgBlAGcAdQBsAGEAclZlcnNpb24gMC4xAFYAZQByAHMAaQBvAG4AIAAwAC4AMSA6VHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhcgAgADoAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAcgAAAAABAAMAAQAAAAwABAK4AAAAqgCAAAYAKgAAACEAIgAjACQAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA8AD0APgBBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGEAYgBjAGQAZQBmAGcAaABpAGoAawBsAG0AbgBvAHAAcQByAHMAdAB1AHYAdwB4AHkAev//AAAAAAAhACIAIwAkACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAPAA9AD4AQQBCAEMARABFAEYARwBIAEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAVgBXAFgAWQBaAFsAXABdAF4AXwBhAGIAYwBkAGUAZgBnAGgAaQBqAGsAbABtAG4AbwBwAHEAcgBzAHQAdQB2AHcAeAB5AHr//wAA/+D/4P/g/+D/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/c/9z/3P/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2QABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEABAEAAQEBGVRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgABAQEo+BsA+BwC+B0D+B4Ei/tV+kD5SAUdAAABOQ8dAAAB4BGLHQAASd0SAFcBAQwlNj0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkFZlcnNpb24gMC4xVHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhclRzY2lyY3VpdEFscGhhYmV0UmVndWxhciEiIyQnKCkqKywtLi8wMTIzNDU2Nzg5PD0+QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2FiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6AAAAAYsBjAGNAY4BjwGQAZEBkgGTAZQBlQGWAZcBmAGZAZoBmwGcAZ0BngGfAaABoQGiAaMBpAGlAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AbUBtgG3AbgBuQG6AbsBvAG9Ab4BvwHAAcEBwgHDAcQBxQHGAccByAHJAcoBywHMAc0BzgHPAdAB0QHSAdMB1AHVAdYB1wHYAdkB2gHbAdwB3QBUAgABAAQAeADuAgwFUgWPBmUHOwffCGMIzwkMCUgJhQq1CzwMhg5ADwwQUBHfEt8U3hYZFqIXFxeiGEIZtBsIHCccsh0sHpIfGh9XIC8gtiEFIjwjJSRTJWUmviftKXQp2CqzK0gsfS0ILW8uPy6iLuAvQy+2L/IxEDItM0A0XjWWNlQ39zjFOTk59zp9Oro76Dy1Pd8+/EAaQJVCDELOQ49EGEVZReRGgUdR+UgO+Uj37vlBFYv8VgWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+FYFjpsFlZkFmpQFnI8FnIcFmoIFlX0FL/z3Fe+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBSeLBXqOBX2UBYGZBYebBY+bBZWZBZmUBQ75SPdm+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQX3p3sVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj3XvcoFYAiBYZ7BYB/BXyDBXmJBXqQBX6VBYOaBYmbBZPgBSR/BXqMBXuSBX+YBYaaBYycBZOaBZiVBZyRBfcPmgWe91QFKH8FeYwFfJIFf5gFhZoFjZwFkpkFmZYFm5EF9wyZBZ33RgWQmgWWmAWakwWdjQWchgWYgQWUfAWMewV7+zIF9zifBZr3JgWQmgWWmAWbkwWcjQWchgWZgQWTfAWNewV++xMF8JcFnIoFm4QFl34FkHwFinoFg30FfoAFeoUF+w19BXj7VQXslwWdigWahAWXfwWRewWKegWDfQV+gAV6hgX7CnwFfvscBYZ7BX9/BXyDBXqJBXqQBX2VBYOaBYmbBZf3CQX7MM0V9zifBZ/3VAX7OHcFDvlI9/T5XhWL/awFiHoFgX4FfIEFeogFeo4FfJUFgpgFh5wFi/msBY+bBZSZBZqUBZyOBZyIBZqCBZV9BfcB+2YVNd0FgpkFiJsFjpsFlZkFmpQFnI4FnIcFmoIF4DkFlX0FjnoFh3sFgX4FfYIFeYgFeo4FQ9sV+z+bBXuQBX2VBYOaBYmbBZCbBZeYBZqTBZ2MBfc+ewWchgWZgAWTfQWMegWGfAWAfgV8gwX7LqUVKjgFe4MFeogFeo8FfZUFgpkFiJwFkJsFlZgF7d4FmpMFnI0FnIcFmYEFlH0FjnsFh3sFLD4VZvsHBYN8BX2BBXqGBXqMBXuTBYCYBYabBY2bBa/3CAWTmQWZlgWckAWciQWbgwWWfwWQewVkIRWkSQWNegWHewWAfgV8gwV6iQV6jwV9lQWCmQVyzQWJmwWPmwWWmQWakwWcjQWchwWZgQWdTxXUWgWXfwWRewWKewWEfAV+fwV7hgV5iwV7kgVCvQV/lwWFmgWLnAWTmgWYlgWbkQWdigXTWhX3fFkFm4QFl38FkXwFi3oFhHwFfoAFe4UFeYwF+3y8BXuSBX+XBYWaBYycBZKaBZeWBZyRBfedUhXVWgWWfwWSewWKewWEfAV+fwV6hgV6iwV7kgVCvAV/mAWFmgWLnAWTmgWXlgWckQWcigX2PBWjOAWMewWGewV/fgV8hAV5igV6kAV+lgWDmQVz3gWKmwWQmwWXmAWakgWdjAWbhgWZgAWp+xAVW/sHBYF9BX2BBXqIBXmOBX2UBYGYBYebBY6cBbz3BwWUmQWalQWcjgWciAWaggWVfQWPewU/+y8V+w5aBXqHBXmOBX2UBYGZBYebBY6bBZWZBZmUBfcOvQWcjgWciAWaggWVfgWPewWIewWBfQX7M00V+zObBXuQBX2WBYOZBYqcBZCaBZaYBZuTBZyMBfczewWchgWYgAWTfAWNewWFewWAfwV7gwX7VqAVNb0Ff5YFg5oFi5sFkZsFl5cFm5IFnIsFnIYF4FkFmIAFknwFjHoFhXwFf38Fe4QFeYoF+wzZFWbuBYmbBY+bBZaYBZqUBZyNBZyHBZmBBZR9BbAnBY17BYd7BYB+BXyDBXmIBXqQBX2VBQ75SPfu+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj4Ko0VsmUFlX0FjnsFh3sFgX0FfYIFeYgFeo8FfZQFYrMFio0FiYwFY7sFiowFiowFYsMFiowFiowFY8oFio4FiY0FbcoFio4FiY4Fd8oFi44Fio0FgcMFi5IFi5IFlcMFjI0Fi44Fn8oFjY4FjI4FqcoFjY0FjI4Fs8oFjIwFjIwFtMMFjIwFjIwFs7sFjYwFjI0FtLMFmZQFnI8FnYgFmYIFlX0Fj3sFiHsFgX0FZGUFZV4FZFUFZE8Fb1AFeFEFg10Fk10FnlEFp1AFsk8FslUFDvlI95tWFYqJBWJjBX2CBXqHBXmOBX2UBYGZBYebBY6bBZWZBbKxBbG4BbLBBbLHBafGBZ7FBZO5BYO5BXjFBW/GBWTHBWTBBWW4BWSxBYGZBYibBY+bBZWZBZqUBZyOBZyHBZmCBbRjBYyJBY2KBbRbBYuKBY2KBbNTBYyKBYyKBbRMBYuIBY2JBapMBYuIBY2IBZ9MBYuIBYyJBZVTBYuEBYuEBYFTBYqJBYuIBXdMBYmIBYuIBWxMBYmJBYuIBWJMBYqKBYqKBWNTBYmKBYuKBWJbBQ75SPeU+FUV+zRWBXqIBXqPBX2VBYKZBYicBY+bBZaYBZqTBfc5wgUh9yQFhJoFi5sFkZsFmJYFm5IFnIsFm4UFmIAF8fsfBfH3HwWYlgWbkQWciwWchAWXgAWRewWLewWEfAUh+yQF9zlUBZqDBZZ+BY97BYh6BYJ9BX2BBXqHBXqOBfs0wAWL+yoFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFDvlI95T39hWL90sFjpwFlZgFmpUFnI4FnIgFmoEFlX4FjnoFi/tLBfdpiwWciAWaggWVfQWOewWIegWBfgV8ggV6hwX7aYsFi/tLBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3SwX7aYsFeo8FfJQFgZgFiJwFjpsFlZkFmpQFnI4FDvlI96puFcJVBZV9BY56BYd7BYF+BXyCBXqIBXqOBX2VBTXfBYeRBYaRBYuMBYqMBYqSBYmSBYyMBYqMBY2SBYyTBYyLBYuMBZCRBY+RBfc/9zwFmpUFnI4FnIgFmoMFlX0Fj3sFiHsFgX0FDvlI90L35RX3kosFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogF+5KLBXqOBXyUBYGZBYibBY6bBZWZBZqUBQ75SPf/7RX7D4sFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9w+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBQ75SKOAFfhx+WMFl5cFm5EFnYwFm4UFmIAFknwFjHoFhXwF/HH9YwV/fwV7hQV5igV7kQV+lgWEmgWKnAUO+Uj4CfkPFUOeBUN4BUZQBWMvBYH7JQWj+wwFxi0F2F0FyYsF2LkFxukFo/cMBYH3JQVj5wVq9x4VjYoFkYgFkYgFjIoFjYoF4EEFi4sFjIoFj4UFkIUFi4oFjIoFuSEFjIQFjYUFlvsyBYqGBYuGBXH7GQWIhQWJhAVH+wIFiYoFiokFhocFh4YFiYoFiooFKVEFh4kFiIkFhooFh4oFh4sFh4oFM4sFh4wFh4sFh4wFhowFiI0Fh40FKcUFiowFiYwFh5AFho8Fio0FiowFRvcCBYmSBYiRBXH3GQWLkAWKkAWW9zIFjZEFjJIFufUFjIwFi4wFkJEFj5EFjIwFjIsF39UFjYwFjIwFkY4FkY4FjYwFjYsF6aMFjowFjowFkYoFkYwFjooFjooF6XMFDvlI9/v5ZRWQjgWNjAWNjAWSiwWSjQWMigWNiwWSigWSiQWMigWNiwWRhwWQhwWMigWNigWOhQWPhQWMigWLiQWMhQWNhAWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/i2BTRFBXuDBXqJBXqPBX2WBYOZBYmbBY+bBZaYBfc19xUFDvlI90rmFffoiwWdiAWZggWVfQWOewWIewWBfQV9ggV5iAX8TosFg4wFg4wFiowFiosFhY8FhI8Fi4sFiowFhpEFh5EFi4wFiowFipIFiZIFi4wFi4wFjJIFjJIFjIwFi4wFj5EFj5EF9zn3PgX3L/dKBcTlBZezBYueBYOqBXeiBV6dBUaQBWaGBVBzBWttBX9mBYN9BX6ABXqGBXmNBXyTBYCYBYaaBYycBZu6BYuMBYyNBY+QBY6RBYyMBYyNBbi2BYuLBYuLBZOQBZKQBYuLBYuLBdWoBZCNBZGMBbqSBZCKBZCMBd2FBZKJBZKKBclxBYyKBY2LBZCHBZGHBYyKBY2JBaxlBYyKBYuKBY+FBY6EBYuKBYyKBZdeBYuFBYyGBYptBYqGBYuGBX1ZBYiFBYmGBUwpBYmJBYqJBfsy+04FiooFiooFDvlI9wqUFYeMBVObBXySBX+YBYabBY2bBZOaBZmVBZuQBZ2KBcB8BdeABeiJBb2WBdGxBbW2BZy5BYOvBWWzBUStBTSiBT2UBYiMBYiLBYWOBYaMBYmNBYiNBYePBYeOBYmOBYmNBYmQBYmQBYuOBYqOBYuQBYuRBYyNBYuOBY2QBY2QBY2NBY2OBY+PBY+PBY6MBY2NBZCNBZGNBY6LBY6MBduVBeKdBdGpBauoBZGqBXWtBV2uBUagBTyPBUp2BVZxBWhxBXyEBXmKBXuQBX2WBYOZBYqcBZCaBZeYBbCnBY+MBY6OBceoBY6MBY6NBdikBZOMBZSMBemGBZCKBZGKBd1yBZKIBZOHBcVeBZCGBZCGBa9UBY2EBY6FBYuKBYyKBYqEBYuDBYBQBYmHBYqHBYmIBYmHBYiIBYiHBVxfBYWGBYSHBUduBdFqBZGGBZKHBcBUBYyIBY6JBY2GBY6HBYuIBY2HBZZQBYuJBYyIBYqFBYuGBYqIBYuJBXNKBYuLBYuLBYeEBYaEBYuLBYuLBVZUBYWHBYaHBTlfBYWJBYWIBU19BYWLBYWKBSeNBYiMBYiLBTmWBQ75SPgF98IVi+oFj5sFlJgFmpUFnI4FnIgFmoEFlX4FjnsFiywF6YsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogFLYsFi/s9BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3PQX71IsFhIwFhYwFiYwFiYsFhY8FhY0Fio0FiYwFh5AFh5AFi40FiY0FipEFiZEFi40Fi40FjJEFjJEFjI0Fi40Fj5EFjpAF+Ab4PgWYlgWcjwWcigWbgwWWfgWQfAWKegWCfQX7yfv5BQ75SKn5QRWOmwWVmQWalAWcjwX4WIsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogF/CuLBYv7dwX3HakFk4sFk4wF9x57BZOIBZOJBcJuBZGGBZGHBbFiBYyJBYyKBY6FBY+FBYuKBYyJBaj7BAWLigWLigWLhAWMhAWKigWLiQV9UQWLiwWLigWHhAWIhAWLiwWKigVnXgWFhQWFhgVFYQWFiQWFiAU5dQWGigWGigU+hwWFjAWGiwVKlwWGjQWGjAVWogWGjgWFjwVUugWAmAWHmwWOmwWUmQWZlQWcjwWciQWaggW9YQW0eQXCgQXNjgXSngXFrgWlqwWUswVz5wVxpwVjoAX7DZkF+01iBYaLBYaKBYeMBYiKBYaNBYaMBYiNBYeMBYePBYeNBYmOBYiNBYmQBYiPBYuOBYmPBYuPBYqQBQ75SPch96QVi4sFi4sFbW4FioMFnlkFm24FtWEFtHIFzoEF2o8FxaMFsqoFnrMFjaoFf7MFeKwFcqQFZ5sFUJcFU44FU4MFU28F+yxcFYqPBYyRBYy5BYuLBYuLBY7cBY2RBYyRBafaBYyNBYuNBbTfBZCSBZCRBcC7BY6NBY2NBdC4BZGOBZCOBdykBYyLBYuLBeKlBZ2NBZuGBZmBBZN8BY17BYZ7BYB+BXyDBTRyBUFzBU9kBV5jBWdABXJEBYp7BZGOBZCPBdGtBZKNBZKOBc6UBZCLBY+LBcuJBY+KBY+LBc58BZCKBZCJBbt2BZKGBZKHBa5oBY6GBY+GBaNhBYyHBY2HBZpZBYyEBYyFBYlbBYuLBYuLBYmDBYmDBYuLBYuLBW9UBYuKBYqKBYaGBYeFBYqKBYqLBVhiBYaIBYaIBUNtBYOJBYOJBS+GBYeMBYaLBTmXBYqLBYqLBYSOBYOOBYuLBYqLBVasBYiPBYaNBVq8BYeQBYeQBXaxBYqOBYqOBXXHBYqSBYmTBQ75SPfP90gVg/saBYd7BYF+BXyCBXmJBXqPBX2VBYKZBYmbBZL3HAWMjQWLjQWc9wcFi4wFjI0Fms0FjI0Fi4wFnsYFjIwFi40FoL4FjIwFi40ForcFjIwFi40Fo7EFjIwFjI0FoqoFjI0FjIwFoqYFjYwF+96LBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfhfiwWQigWQigWOigWPigWPiAWQiQWOiQWNiQWOhwWPhwWMiAWNiAWMhgWNhgWLiAWMiAWJhgWLhgWKiAWKiAWIhwWJhgWIiQWJiAWHiAWHiAVqeQV9gQVkaAV3dAV2bgV1aAV2YgV4WwV5UwV8TAUO+Uj3pvf2FUR0BUpaBXBZBYleBaZdBcVnBdlzBciJBeCmBb6wBaLEBYLEBWK1BTi2BVKfBdH3sxU4kQVLgAVXcwVrXQWVaQW4ZQW/bAXDeAWwlgXetQWdpgWMwwV1rwVr9wEVi4sFk4gFk4kFi4sFjIsF0GgFjokFj4kFjocFj4gFjYgFjYgFrVIFjIkFjYgFjIYFjYYFiogFjIgFiTwFi4gFi4kFiYUFioYFiYkFiogFbVwFiYkFiYgFh4gFh4cFiIoFiYkFUm4F0mYFkIcFkYcFw1IFjYcFj4gFjIcFjYgFjIYFjIcFmDoFi4kFi4kFioUFi4UFiokFiokFbDwFiYcFiogFh4cFiYgFiIgFiIkFR1sFhYgFhYcFJ2sFg4oFg4oFP40FhY0FhIsFMqcFho4FhY0FQ7gFio0FiYwFho8Fh5AFio0FiYwFZc0Fio4Fio4FipAFiZAFjI4Fio4Fjs0Fi4wFi4sFjZMFjZIFi4wFi4sFr80Fi4wFjIwFkJAFkJEFi4wFjIsF2sYFkY4Fko8FmI8FaZ8FiI4Fh40FUrwFiY0FiI4FiY8FiI8Fio4FiY4FeMsFi40Fi4wFipIFi5IFi4wFi4wFjpIFjZIFjIsFjI0Fu9IFjo4FjY4Fj44Fj44Fjo0Fjo0F0KsFkYwFkY0F15gFkIsFkYwF7YQFDvlI+Fr4mBWVnQV8xwVwqwVfoAVIkwVHgwVTdAVnagV+XwWYYAWvaQXDdAXMhAXMmgW8qgVf/BoVi4oFZ0IFgX4FfIIFeYgFeo8FfZUFgpkFiJsFj5sFr9QFtuoFwPcXBYuLBYuMBZKcBT55BYOKBYKLBTuUBYWNBYWMBUWoBYSPBYSQBVm6BYqNBYmMBYiQBYeQBYuOBYqNBXfNBYqOBYqOBYyQBYqQBYyOBYyPBZ/NBYyNBYuNBY+QBY6QBY2NBYyNBb26BZKPBZKQBdGnBZGMBZGNBduVBZGKBZGMBduBBZKJBZKJBcdvBYyKBYyLBZGGBZGHBYuKBYyKBbNcBYyKBYyKBY6FBY6FBYuJBYyKBZ83BYuFBYyEBYqJBYuJBYmFBYmGBYqHBUH7SAVW+xgFi4oFiooFXysFDvlI9y/3yxX4OvtDBZqBBZR9BY57BYd7BYF9BXyCBXqJBXqOBfyY92oFhI8FhY8FiowFiowFh5EFh5EFi4wFiosFipMFiZIFi4wFi4wFjZIFjJIFjIwFi4wFj5EFj5EFjIwFjIsFkY8Fko8F+Jj3agWcjwWciAWaggWVfgWPewWIegWCfQV8ggUO+Ui2+GkV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAWc+4gV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj44/fpFYyKBY+FBY+FBYuKBYyKBYyEBY2EBYuKBYuKBYmEBYqDBYqLBYuKBYeFBYeFBYqKBYqKBYWHBYSHBfyY+2oFeogFeo0FfJQFgZkFh5sFjpsFlJkFmpUF+Dv3QwX8O/dDBXyUBYKZBYicBY+bBZWYBZqUBZyOBZyHBfiY+2oFkocFkYcFDvlI+Ev3kxWGigX7q4sFi4sFLPtyBYF9BX2CBXqIBXmOBX2UBYGYBYecBY6bBfek+REFkJIFkJIFi4sFi4sFko8FkpAFi4sFjIsFk40Fk40FjIsFi4sFk4kFlIoFi4sFi4sFkoYFkocFjIsFi4sFkIQFj4QF97r9EQWPewWIegWBfgV9gQV6iAV5jgV9lAWBmAX7IvfIFfsB94AFJvuABQ75SPe++GUV2bYFlMsFTL8F+weeBSmGBYv7VgX32vxEFYSJBYmLBYmLBfv7hwWKiwWLiwWDjAWCjQWLiwWLiwWEjwWEkAWKiwWLiwWGkgWHkQWLjAWKiwWKkwWJkgWLjAWLiwWL+QoFjJIFjZIFi4wFi4wFkJEFjpEFjIwFjIwFkY8FkY8FjYsFjIwFkowFk40F9yWTBZCKBZCLBfcZdQWOigWPigWQiQWQiQWNiQWOiQXlQQWNiAWPiQWNhwWOhwWMhwWNiAWLhgWMhwWLhwWLhwV9+wAFiokFi4gFiIYFiYYFiYkFiogFh4cFh4cFiIoFiYkFSGYF9wJmBY6JBY+KBY+IBY+JBY2IBY6IBdE3BY6GBY6FBYyJBYuKBYyEBYyEBYX7AAWLiQWLiQWJhQWJhQWKiQWKiQVsWwWIiQWKiAWHiAWHhwWIigWIiQU+ZAWJigWJigVu3BXEqAWeqAWP3QVYyQX7JLsF+1CWBYv7nAUO+Uj4ZPclFaDbBZOZBZiXBZuQBZ2KBZuEBZd/BZF7BYp7BXIwBYqIBYqHBYiHBYmHBYiIBYmIBUNLBYiJBYmJBYaJBYaIBYiLBYiJBSl1BYuLBYuLBYOLBYKLBYuLBYuLBfsEnAWJiwWKjAWEjQWEjgWKjAWKiwVRsQWFkQWFkQVU3QWLiwWLiwWIkwWIkgWLiwWLiwVm918Fi5MFi5MFuvdeBYyMBYuNBY+RBY2RBY2MBYyNBc7XBYyMBYuLBZGQBZKQBYuLBYuLBdGsBZKNBZKOBdqVBYyLBYyLBZOKBZKLBYyKBY2LBfVqBYyLBYyLBZKHBZGHBYyLBYyKBcNZBYyLBYuKBZCFBY+FBYyKBYuLBapEBY57BYh7BYF9BXyCBXqIBXqOBXyVBYGYBXDJBWKwBTSlBU6EBVVxBVRNBWD7TAWt+04FuUgFtG8F6H0F2JwFDvlI93uVFYaKBfs1iAWLiwWKiwWDjAWDjQWKiwWLiwWEjwWEjwWLjAWKiwWHkgWGkQWLjAWLiwWJkwWJkgWMjAWKiwWT+QQFjJAFi5EFjY0Fi48Fj48FjY8FjY4FjY0FkI4Fj44Fjo0FjowFkIwFkY0F7pgFj4sFjowF14kFkYoFkIsF9xBrBYuLBYuLBZOHBZKIBYyLBYuKBeZIBYyKBYuLBZCFBZGFBYuLBYuKBb8wBY2FBY6GBaAsBYuHBYyHBY1EBYqHBYuIBYJOBYmHBYqHBXhXBYeFBYmGBUw8BYWGBYWGBTdZBYWJBYWIBfsdaAV53hX3EasF0rUFwM4Fm7UFlMAFicsFeOAFXtoFPsQF+wGnBUiMBVGDBYX8tAUO+Uj3EeUV+CGLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfxOiwV6jgV8lAWCmQWHmwWL99MFi/fSBY+bBZSZBZqUBZyPBfhOiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX8IYsFi/t+BfeciwWdiAWZggWVfQWOewWIegWBfgV9ggV5hwX7nIsFDvlI9xf32hWL+6oFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBYyKBfgviwWciAWZggWVfQWPewWHewWBfQV9ggV6iAX8FYsFi/t4BffQiwWdiAWZggWVfQWOewWIewWBfQV9ggV5hwUO+Uj4fve0Ffs1iwV6jwV9lAWBmQWImwWOmwWVmQWZlAWdjgX3bIsFj4oFkIsFj4kFj4oFj4kFj4kFjogFj4kFjYgFjocFjYgFjYcFjIcFjYcFi4cFjIcFiocFi4cFXvtaBYqJBYuIBYiGBYiGBYmJBYqJBUtGBYmKBYqJBYWIBYaHBYmKBYmKBTpwBYqLBYuKBYOKBYOKBYqLBYqLBTWSBYSNBYSNBTmuBYWOBYaOBUfCBYaQBYaQBV/QBYuMBYqMBYmRBYiSBYuMBYuMBXf3UgWLkQWLkgWx90IFjIwFi40FjpEFjpEFjIwFjI0FzdsFjIwFi4wFkZAFkY8FjIwFjIsF37QFi4sFi4sFk40Fk44Fi4sFi4sF9xeVBZKKBZGLBfcQcQWbhQWXfwWRfAWLegWEfAV+gAV7hQV5iwX7CKMF+weCBUhrBVZJBWj7MwWe+0IFrlUFxFwF0W4Fz4UFx6AFvL8FDvlI+H74OhWL95sFj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3tgX8DosFi/u2BYd7BYJ9BXyCBXqIBXqOBXyUBYGZBYibBYv34AWL98UFjpsFlZkFmpQFnI8FnIcFmoIFlH0Fj3sFi/ubBQ75SPfu+UEVi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5EQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Ui/9z4Vio4Fia8FjpsFlJkFmZUFnY4FnIkFmoIFlX4Fj3sFjGsFkXIFlXYFmXkFnX0FunoFzoQFu5EFwp8FoJkFnJ0Fl6EFk70FivhxBY6bBZWZBZqUBZyPBZyHBZqCBZR+BY96BYz8dAWKiAWLiAWCTgWJhQWJhAV5awWHhgWIhwVycQWHiAWIiAVtdwWGiQWGiAVKcwWGigWFigVRhAWGiwWGiwU8kwWFjAWFjAVRoQWFjwWFjQVvoQWHjwWHjgV2pQWJkAWIjwV+qAWKkAWJjwWEqwUO+Uj3Uff3FfsBOQWL+3UFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBZmCBZV9BY57BYv7xAX4Hve7BZuSBZyNBZyGBZiABZR8BYx7BYZ7BX9/Bfui+14F9+b70AWVfQWPewWHewWCfQV8ggV6iAV6jgV8lAUO+Uj3DOUV+CuLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfxYiwV6jgV9lAWBmQWHmwWL+REFj5sFlZkFmZQFnI8FnYcFmYIFlX0FjnsFDvlI+KH5WxWOjwWNjQWNjQWRjQWPjgWOjAWOjAWRjAWRjAWOigWOiwWQiQWRigWNigWOigWQhwWPiAWNiQWNiQWOhgWOhgWMiQWMiAWLhgWNhQWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h1BftD+6wFiYkFiokFhocFh4cFiYkFiYoFhYkFhYgFiYsFiIoFhYwFhYoFiIwFiYsFhY4FhY0FiYwFiY0Fh48Fho8Fio0FiY0F+0P3rAWL/HUFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY2RBYuQBYyOBYyNBY6QBY6QBY2NBY2NBY+OBZCPBY6MBY2MBZGMBZCNBY6LBY6MBZGKBZGKBY6KBY6KBY+IBZGJBY2JBY2JBY6HBY+HBfdw+/UF93D39QUO+Uj4e/dPFYT4hgWOmwWVmQWZlAWcjwWdiAWZggWVfQWPewWU/REFioYFi4cFiocFiocFiYgFiYcFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4oFhosFh4oFhosFh4sFh40Fh4wFh40Fh4wFiI4Fh44FiI4FiI4F/BT4oQWL/IkFh3sFgn0FfIIFeogFeo4FfJQFgZkFiJsFi/kRBYyPBYuPBYyPBYyPBY6PBYyOBY6OBY6PBY6NBY6OBZCNBY+NBY+MBY6NBZCLBZCMBY+KBY+LBY+JBZCKBY+JBY6KBY+IBY+IBY2IBY6IBQ75SPgblBWFiAWJiwWJiwUzgAWKiwWKigWEjAWDjAWKiwWKiwUypQWJjAWIjAWGjgWGjgWJjQWJjAU62gWJjgWIjgWJjwWIjwWLjwWJjgVP96AFi40Fi4wFi5IFi5IFjIwFi40FxPddBY2PBYyPBY6OBY2PBY6NBY6PBdHEBYyMBYyMBZKOBZGOBY2LBYyMBfcOqQWPiwWPjAWQigWPjAWPiQWPiwX3B2cFjIoFjYsFkYcFkYgFjIoFjYkFzkoFjYgFjYkFjocFjYYFjIgFjIgFxfuJBYuDBYuDBW/7LgWIhAWJhQVYMgWKiQWLigWGhgWGhgWKigWKigUwTgWJigWKigUg0BXOkwXUvAW11gWl9x8FVvd1BVm8BTCoBShzBVdgBVj7RgXD+4sFy00FDvlI93j3xxWJigX7AooFi/uVBYd7BYF9BX2CBXqIBXmOBX2UBYGZBYibBYv5BQWMkQWMkgWMjAWLjQWPkQWOkAWNjAWMjQWQjwWRjwWNiwWMjAWSjQWRjAX3HZcFjosFj4sF9w6EBY+KBZCLBdp2BY+KBY+KBa96BZCIBZCIBcRbBYuKBYuLBZCFBZCEBYuLBYyLBaRXBY2EBY2EBZA/BYuJBYuJBYqFBYqFBYqJBYuJBXRcBYqJBYqJBYeHBYeFBYmKBYqKBWhxBYWIBYWIBVN2BYeKBYeJBTp8BYiLBYmLBfsCggWF4BX1kwXWmQW5nAWgmwWZpwWGxAV6sAVesQVxlwVEnQX7BpIFL4MFi/uJBQ75SPiTtRXQOQWTfAWNewWFewWAfwV7gwV6igV6kAV+lQVRzwVUYAWIigWJiQWGiQWGiAWHiwWIigU1fgWJjAWJigWEjAWFiwWJjAWIiwU0qQWJjAWIjAWGjgWGjgWJjgWJjAU75AWKjgWJjQWJkAWIkAWLjgWKjQVQ98MFi4sFi4sFi5MFi5MFi4sFi4wFw/d2BY2OBYyPBY2PBY6PBY2OBY2OBdDLBY2MBYyNBZGOBZGOBY2MBY2MBfcLrAWRjAWRjAWNigWOjAWRiQWRigX3BGMFjYoFjooFj4cFkYgFjIkFjYoFzUEFjIkFjYkFjYYFjoYFjIgFjIkFw/uoBYuEBYuEBW/7QgWJhQWJhQX7K0AVMfUFg5oFipsFkJsFlpcFm5MFnIwFnIYFmIEF0zcFmqkFpfc1BVb3lgVZxAU0qgUucQVXWgVY+2IFwvuvBctDBcx2BcmUBQ75SPfz+EoV3JcFrpgFoJsFlqIFjLMFfbkFgZYFd5gFcZUFQZsF+xSQBfsofgWL+10F90g8FftIhQWL+7cFh3oFgn4FfIEFeogFeo4FfJUFgZgFiJwFi/j8BYyRBYyRBYyNBYuNBY+QBY6RBY2MBYyNBZGOBZCPBY2MBY2MBZGMBZKNBfdUmwWOiwWOjAX3G4UFj4oFj4sF3HoFj4kFj4sFrX0Fj4kFj4kFp3kFj4cFkIgFoHQFi4oFjIsFjoQFj4UFi4oFjIoFnU0FjIUFjIUFiVQFi4sFiYMFiYMFi4sFeWQFiooFi4oFhoUFhoUFiosFi4oFaXAFhIgFhYcFXXoFhooFhokFNX8F94H7rQWTfQWNegWGewV/fwV8gwV5igV6kAV+lgX7nPfLBYOaBQ75SOXBFYaOBYqNBYiNBYmQBYeQBVr3AQWHnAWOmwWVmQWZlAWcjgWdiAWZggWVfgW3KgXNaQX3IIcF7bgFq/AFdsUFS68F+4ezBYiNBYiLBYaNBYaNBYmOBYiMBUu+BYiPBYiOBYmOBYiOBYqQBYmOBXrHBYuPBYqOBYuQBYuPBYyPBYyPBbT3DAWOkAWNkAWNjQWMjQWQjwWPjwXvzAWRjgWQjgWOiwWNjAWRiwWRjAX3R4IFjYoFjIwFkogFkooFjIoFjYoFkIcFkYcFjIoFjIoF1zAFknwFjXoFhXwFgH4Fe4QFeYoFe5AFfpYFTNYF+yOTBUBaBWssBZVoBbZoBfeDYwWTiQWTiAXfWgWQhwWQhwWNiQWMigWOhQWOhgWrNgWLhgWNhwWLhwWLiAWKhgWKhgVi+xgFi4oFiooFh4UFiIQFiosFiooFhYYFhYcFiosFiooF+xJRBYmLBYqKBYSKBYSJBYmLBYmLBfs2jwWJjAWJiwWFjQWEjAWJjAWJjAUzuQUO+Uj3yflsFfeiiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX7dYsFi/znBYh7BYF9BX2CBXmIBXqOBXyUBYKZBYebBYv45wX7hYsFeo4FfJQFgZkFiJsFjpsFlZkFmpQFnI8FDvlI+HT3hxWQ+E4Fj5sFlZkFmZQFnY4FnIcFmYIFlX0FjnsFhvxQBYqIBYyJBYFHBYqHBYqGBXdYBYmIBYmHBX53BYiHBYiIBW1sBYWHBYaHBVhxBYSJBYSJBU2BBYWLBYSLBTOUBYaNBYWMBUWlBYWPBYWOBVyvBYeQBYWQBWjCBYiRBYiRBXnSBYqPBYqOBYTsBYuNBYuMBYr39wWOmwWVmQWalAWcjwWchwWaggWVfgWOegWM+/UFki8Fm00Fp2EFr28FxXYF14IFu5MFsJ4FoqIFk5cFnLYFDvlI99H3NRX3a/ivBZSZBZqVBZyPBZyIBZqCBZV+BY97BYh6BfuS/REFi4sFi4oFhoUFh4QFi4sFiooFhIcFhYYFiosFi4sFg4kFg4oFiosFi4sFg4wFgowFi4wFiosFhI8FhI8Fi4sFi4wFhpEFhpEFi4wFi4sF+7j5EgWHmwWOmwWVmQWZlAWcjwWciAWaggWVfQUO+Uj4dvdYFdf4gwWQmwWXlwWbkgWcjAWchgWYgAWTfAWMegUq/REFiYcFioYFiYgFiocFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4kFh4sFhooFh4sFh4sFho0Fh4sFh40Fh40FiI4Fh40FiI4FiI4FiY8FiI4F+0b3/wX7Ofv2BYiHBYiGBYmJBYmJBYaIBYeHBYiKBYiKBYaKBYWJBYiLBYiLBYWMBYaLBYiNBYiLBYaOBYaOBYmNBYiNBYiPBYiPBYqOBYmOBYqQBYmQBTv5CQWNnAWTmQWYlgWckAWcigWbhAWWfgWRewXH/G8F9x/3vgWPkAWPkQWMjAWMjAWRjwWRjwWNiwWMjAWSjAWSjQWNiwWMiwWSiQWTigWMiwWMigWRhwWSiAWMigWMigWPhQWPhQUO+Uj3/Pf/FfeZ+7QFlH0FjXsFhnsFgH4FfIMFeYkFeo8FfpYF+5D3qQX7kPupBX6ABXqHBXmNBXyTBYCYBYabBY2bBZSZBfeZ97QF+5/3uwWCmQWJnAWQmwWWlwWalAWdjAWchwWYgQX3lvuxBfeW97EFmZUFm48FnYoFmoIFln8FkHsFiXoFgn0FDvlI9+j4EhWV++EFiHsFgn0FfYEFeogFeY0FfJQFgZkFh5sFgffjBfud96cFgpkFiJsFj5sFlpkFmpMFnI4FnIcFmYEF94n7kQX3k/eQBZqVBZyPBZyIBZqCBZV+BY96BYh7BYJ9BQ75SPci5RX4KosFnYgFmYIFlX0FjnsFiHsFgX0FfYIFeYgF/IKLBYWMBYaLBYiMBYeMBYeOBYaNBYmNBYiNBYiPBYePBYqOBYmOBYqQBYmPBYuPBYuOBYyQBYuQBYyOBYyOBY6PBY2QBfhP+M4F/CqLBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfiCiwWRigWQigWOigWPigWPiQWQiAWNiQWOiQWOhwWPhwWMiAWNiAWMhwWNhgWLiAWLhwWKhgWLhgWKiAWKiAWIhwWJhgUO+Uj3h3QV9zaLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqHBftjiwV5jwV9lAWBmQWImwWL+Z8FjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfs2iwUO+Ujw+VgV+HH9YwWRfAWKegWEfAV+gAV7hQV5jAV7kQV/lwX8cfljBYWaBYycBZKaBZiWBZuRBZ2KBZuFBQ75SPhWShWHewWBfQV9ggV6hwX7Y4sFeY8FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9zaLBYv5SwX7NosFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BQ75SPeo+WQVko8FjIsFjIwFkowFk40FjIoFjIwFk4kFkooFjIoFjIsFkocFkYcF9577ggWVfgWPewWIegWBfQV9ggV6hwV6jgV8lAX7f/dmBft/+2YFfIIFeogFeo8FfZQFgZkFiJwFj5sFlZgF9573ggUO+UiL+wEV+O6LBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfzuiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj4POoVxcIFi/eQBVLBBVCnBS+LBVBvBUxQBWsvBYtQBaswBcpPBcdvBeaLBfcIZhWHiAWFhwVAZwWKigWJigWEigWFiQWJjAWJigX7BYsFiYwFiYoFhI0FhYwFiYwFiYwFQK8FhY8FhY8FP9MFiowFiowFiJEFh5EFiowFiowFZvYFipIFipIFi9IFjJIFjJEFsPcABYyNBYyMBY+RBY6RBYyMBYyMBdfTBZGPBZGPBdeuBYyMBY2MBZKMBZKNBYyKBY2MBfcFiwWMigWNjAWSiQWSigWMigWNigXWaAWQhwWQiAWLjwWPnAWUmAWalQWcjgWciAWagQWVfgWOegWL/IoFiHsFgX4FfIEFeogFeo4FfJUFgpgFh5sFDvlI9xOvFYaOBYuKBYd6BYF+BX2CBXqHBXmPBX2UBYGYBYicBYv5OAWOmwWVmQWZlAWdjgWciAWZggWVfQWPewWL+3YFkI4FkY8F1asFjIsFjIsFko0Fk40FjIoFjIwF9wSLBYyLBYuLBZOJBZOJBYyLBYuLBddrBZCHBZKIBdZKBYyKBY2KBY6FBY+GBYyJBYyKBbApBYyEBYyEBYtLBYqEBYqDBWYrBYqKBYqJBYeGBYiFBYmKBYqJBUBLBYWIBYWHBUBqBYqLBYqLBYSJBYOJBYqLBYqLBfsEiwWKjAWKigWDjQWEjQWKiwWKiwVBrAWA9w0VwlwFxnEF54sFx6UFycAFqdoFi70FbdsFTcAFT6QFL4sFUHIFVFwFDvlI+DLqFczNBZqVBZyPBZyIBZqDBZV9BY97BYl7BYF9BUVDBYWHBYWHBUZmBYiLBYmJBYWKBYWJBYiMBYmKBSGLBYmMBYiKBYWNBYWMBYmNBYmLBUSwBYWPBYWPBUXTBYqMBYqMBYeRBYeRBYuMBYqMBWn2BYqRBYqSBYvSBYyRBYySBa33AAWMjAWLjAWPkQWPkQWMjAWMjAXR0wWRjwWRjwXSrwWNiwWNjQWRjAWSjQWNigWNjAX1iwWNigWNjAWSiQWRigWNiQWNiwXRZwWRhwWRhwXRQwWVfQWNewWHewWBfQV8gwV6iAV6jwV8lQVKzQVWpgU3iwVVcAVRUAVtLgWLUAWoLwXGUAXCbwXdiwUO+Uj4PfUVwroFi/dxBVS6BVCkBS+LBU9yBU1WBW07BYtZBak8BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKiwWEiQWDiQWKjAWKigX7BIsFiosFiosFhI0Fg40FiosFiosFQKwFhY8Fho4FP8sFio0FiYwFiJEFh5AFio0FiowFZusFipMFipIFi8sFjJIFjJIFsO0FjIwFjI0Fj5AFjpEFjYwFjIwF18wFkY4FkI8F16sFi4sFjIsFk40Fk40Fi4sFjIsF9wSLBYyKBYyMBZOJBZKJBYyLBYyLBdVrBZGHBZCIBYv3dgWPmwWVmQWZlAWcjgWdiAWZggWVfQWOewWL/TgFiHoFgX4FfYIFeYcFeo8FfZQFgZgFh5wFDvlI9x74IBV8YQX4GIsFg5QFZs0FbaYFS6cFJosFSm8F93r7/BXXzgWZlAWdjgWchwWZggWVfQWNegWIewWAfgU6QwWGiAWFhwU8ZgWJiwWKigWEigWEiQWJiwWKiwX7DYsFiosFiosFg40FhIwFiowFiosFOrAFhY8FhY4FO9MFiYwFiowFh5EFh5AFi40Fio0FY/YFipIFipIFi9IFjJIFjJIFs/cABYyNBYuNBY+QBY+QBYyNBY2MBdvTBZKOBZCPBdyvBYyLBYyMBZOMBZKNBYyLBYyLBfcNiwWMiwWMiwWTiQWSigWMigWMiwXbZwWQhwWRiAW1ZwWPhQWQhQWyRAWQewWJegWDfQV/ggWUhQWVfgWOegWIewWBfQV9ggV5iAX8SYsFi3UFrDAFz08FzG4F8IsFDvlI97n4VhWL/CQFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/gkBfsGiwV6jgV8lQWCmAWHmwWPnAWUmAWalQWcjgX3BosFi8AFi40Fi40FjZEFjJEFjY0Fi4wFwOoFkZEFkJEFi4sFi4wFk44Fko8F9asFkowFkowF9YsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFKIsFOXIFZEUFi2EF9zuLBZyIBZqBBZV+BY56BYh7BYF+BXyBBXqIBQ75SPg99yMVwroFi/dxBVS7BVCkBS+LBU9yBU1WBW06BYtaBak7BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKigWEigWDiQWKiwWKiwX7BIsFiosFiosFg40FhIwFiowFiosFQKwFhY8FhY4FQMwFiowFiYwFiJEFh5AFio0FiowFZuwFipIFipIFi8wFjJIFjJIFsOwFjI0FjI0Fj5AFjpAFjY0FjIwF1swFko4FkI8F16sFi4sFjIwFk4wFk40Fi4sFjIsF9wSLBYyLBYyLBZOJBZKKBYyKBYyLBdVrBZGHBZCIBYuLBY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYv8mAWKhAWKhAVmKgWKigWKiQWHhgWIhQWJigWKiQVlawWFhwWFhwVBbAWKigWKiwWEiQWDigWKiwWKiwX7BIsFiosFi4sFg4wFg40FiosFi4sFP6sFho8FhI8FQMsFio0FiYwFiJAFh5AFio0Fio0FZuwFiZwFj5sFlZgFm5QFnI0FnIcFmYEFlH0FrDQFyVYFx3EF54sFxqUFpKAFqdoFDvlI+L34CRWNhAWL+9AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/fIBW7TBVqfBSyLBU1yBS49BYv7vQWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+SwFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/uSBbKsBZGOBZGPBdeqBYyLBYuMBZOMBZONBYyLBYuLBfcGiwWMiwWLiwWTiQWTigWMigWLiwXXbAWLiwWLiwWShgWShwWLigWMiwWPhAWQhQWLigWLiwWxLAUO+Uj3mfmIFduLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBTuLBXqOBXyUBYGZBYibBY6bBZWZBZqUBfH7mRWL/E4FiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/hOBY6cBZWYBZqVBZyOBZyIBZqBBZV+BQ75SPgV+YgVyYsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFTYsFeo4FfJQFgpkFh5sFj5sFlJkFmpQF+wn+MhWGigWIjQWHiwUpqQV8kwWAmAWGmwWNmwWUmQWZlgWbjwWdiQXhcQXpoQWhyQWL+I4Fj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/yVBYqEBYqFBWswBYiGBYmHBYmIBYmIBYeIBYeIBYiJBYiJBYaKBYaJBfsXbQWIiwWHigUO+Uj3f/eMFfsRLwWLIQWIewWBfQV8ggV6iAV6jgV8lAWCmQWHmwWL+SwFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/xXBff495sFm5IFnIwFnIYFmIEFk3wFjHoFhnwFgH4F+2v7MgX3mPtwBZV+BZB7BYh7BYJ9BX2BBXqHBXqNBXyTBQ75SPfu+WMVi/0xBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5MQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj43/iYFZCGBYuKBYyJBYyFBY2EBYuKBYyJBYv8WwWHewWBfQV9ggV6iAV5jgV9lAWBmQWImwWL+EgFfJYFXIsFdHgFVDEFi/vmBYh7BYF9BX2CBXmIBXqOBX2UBYGZBYebBYv36gVo4wV1nAVdiwVzeAVVMQWL++YFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h9BY6cBZWYBZmVBZ2OBZyIBZmBBZV+BY2ABa2mBZGOBZGPBY2LBYyMBZKLBZKNBduLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyJBY2KBY+GBY+GBYuJBY2JBZN1BZynBZCQBZCRBbWtBZGPBZGPBY2LBYyMBZKLBZKNBdyLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyKBYyKBQ75SPi++B0VjIUFi/vyBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv36wVt3QVaoQUtiwVPcAUsMwWL++AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/h9BY6cBZWYBZqVBZyOBZyIBZqBBZV+BY56BYtlBbCtBZKPBZCPBdiuBYyLBYyMBZKMBZONBYyLBYyLBfcGiwWMiwWNiwWSiQWSigWMigWNiwXWaAWMiwWLiwWShgWRhgWMiwWLiwWPhAWPhAWLiwWLiwWyIQUO+Uj37Ph4FTWLBVRwBU9PBWwvBYtQBaowBcdPBcNvBeCLBcKnBcfHBarmBYvGBWznBU/HBWH3AxWNjAWRiQWSigWNiQWNiwXTaAWRhgWRhwXTQwWLigWMiwWPhAWPhQWLigWMigWv+wAFjIUFjIQFi0QFioQFioUFZyAFiooFi4oFh4QFh4UFiosFi4oFQ0MFhYcFhYcFQ2YFiYsFiYkFhYoFhIkFiYwFiYoF+wCLBYmMBYmKBYSNBYWMBYmNBYmLBUOwBYWPBYWPBUPTBYuMBYqLBYeRBYeSBYuMBYqMBWf2BYqRBYqSBYvSBYySBYyRBa/3AAWMjAWLjAWPkQWPkgWMiwWLjAXT0wWSjwWQkAXTrgWNiwWNjQWSjAWRjQWNigWNjAX3AIsFDvlI9xTXFYWPBYv7dQWHewWCfQV8ggV6iAV6jgV8lAWBmQWImwWL+TMFjpwFlZgFmpUFnI4FnIgFmoEFlH4Fj3oFi4sFkY8FkI4F1asFjIsFjIwFk4wFko0FjIsFjIsF9wSLBYyLBYuLBZOJBZOKBYyKBYuLBdZsBZGHBZGHBdZLBY2KBYyJBY+GBY+GBYuJBY2JBa8rBY2EBYyDBYtLBYqEBYmEBWYsBYqJBYuJBYeGBYeFBYqKBYmKBUBLBYWHBYaIBUBqBYqLBYqKBYOKBYSJBYqLBYqLBfsEiwWKiwWKiwWDjQWEjAWKjAWKiwVBrAWA9w0VwlwFxnEF54sFx6UFyb8FqdoFi7wFbdsFTb8FT6QFL4sFUHIFVFwFDvlI+D33JRXCugWL924FVLoFUKQFL4sFT3IFTVcFbTsFi1oFqTwFyVcFx3EF54sF9wZiFYaIBYWHBUFqBYqLBYqLBYSJBYOJBYqMBYqKBfsEiwWKjAWKigWEjQWDjQWKiwWKiwVArAWGjgWFjwVAywWJjAWKjQWHkAWHkAWLjQWKjQVm6gWJkgWKkwWLywWMkgWNkgWw6wWMjQWLjQWPkAWPkQWMjAWNjAXWywWRjwWRjwXWqgWLiwWMjAWTjAWTjQWLiwWMiwX3BIsFjIsFjIsFkokFk4oFjIoFjIsF1WwFkIcFkYgFi4sFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/00BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBQ75SPfp+MsVk40F9yaLBZyIBZmBBZV+BY96BYd7BYF+BX2BBXqIBfsdiwU4bgU5TwViNAWL+6MFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/h9BY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYtWBdTABZGNBZGPBeutBQ75SO6nFYSQBYuLBYuMBYeSBYeSBXLSBYmcBY+bBZaYBZuTBZyNBZyGBZmBBZN9BZ9TBbt0BfWLBeSsBbuhBYuoBVHCBfsBygX7BIsFiYsFiosFhI0FhIwFiowFiYwFQK8FhY8Fho8FiowFiYwFiJEFh5EFi4wFio0FipEFipIFi9IFjJMFjZMFi4sFi4wFkJEFj5IF1tMFjIsFjIwFkY8Fko8FjIsFi4wF764Fk4wFk40F9xGLBYyKBY2MBZKJBZKKBYyKBY2KBdZoBZmBBZN8BY17BYd7BYB+BXyDBXmJBXqPBUqqBSGLBTluBVRWBYtuBbN4BfcGiwWOigWPiwWQiQWQigWOigWPiQX3EEQFj4cFkIgF1kQFj4QFkIQFi4sFi4sFjYMFjIMFi0MFioUFioQFiooFi4kFh4UFiIYFiYoFiokFhYgFhoYFQGgFiYsFiYkFJ2cFg4oFg4kF+xGLBYmMBYmKBYWNBYSMBYmMBYqMBUCvBQ75SPdd+DEV+wyLBXqOBXyUBYGZBYibBY6bBZWZBZqUBZyOBfcMiwWL9zcFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/s3BfdDiwWciAWaggWVfQWOewWIewWBfQV8ggV6iAX7Q4sFi/uCBbNMBeF0BfOLBZyHBZqCBZV9BY57BYh7BYF9BXyCBXqIBfsCiwWFjAWFjAX7AqgFg48FhI4Fi4sFiowFhpEFhZAFVOIFio4FiY4FipAFiZAFjI4Fio4FDvlI+GX3SRWL9+AFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/x9BYh6BYF+BXyBBXqIBXqOBXyVBYGYBYicBYuyBWZpBYWHBYWHBT9oBYmKBYqKBYSKBYSJBYmMBYqKBfsGiwWJjAWKigWEjQWEjAWJjAWKjAU/rgWEkAWEkAWLiwWLiwWHkgWHkgVk9AWKkgWKkQWL9/IFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/vrBak6Bb10BeeLBcinBQ75SPfB9xcV92j4JgWWmAWakwWcjQWchwWZgQWUfQWNegWHewX7kfxyBYiHBYiGBYiJBYqJBYaIBYaIBYiKBYiKBYaKBYWKBYiLBYiLBYWMBYaMBYiMBYiMBYaOBYaOBYqNBYiNBYiQBYiPBfuQ+HIFhpsFjZwFlJkFmZUFnI8FnIkFmoMFln4FDvlI+Fj3TRX29+kFk5oFmZUFm5AFnYoFmoMFl34FkHsFiXsF+yr8cgWIhwWKhwWIiAWKhwWHiQWIhwWHiQWIiQWGiQWHiQWHiwWHigWHiwWGiwWHjAWHiwWHjQWGjQWIjQWHjQWIjwWIjQWJjwWIjgWKjwWIjwUg9+kFIPvpBYiHBYqHBYiIBYmHBYiJBYiHBYeJBYiJBYaJBYeJBYeLBYeKBYeLBYaLBYeMBYeLBYeNBYaNBYiNBYeNBYiPBYiNBYmPBYiOBYqPBYiPBfsq+HIFiZsFkJsFl5gFmpMFnYwFm4YFmYEFk3wF9wD76QX29+kFjY8FjI8Fjo4FjY8Fj44Fjo4Fjo0Fj40Fj40Fj40Fj4sFj4wFkIsFkIsFj4oFj4sFj4kFkIkFjokFjokFjogFj4gFjYcFjogFjIcFjYcFDvlI+AL3pxX3evtlBZV+BY97BYh7BYF9BX2BBXqIBXmOBX2UBft992YF+337ZgV9ggV5iAV6jgV9lQWBmQWImwWPmwWVmAX3evdlBft692UFgZgFh5sFjpwFlZgFmZUFnI4FnYgFmYMF9337ZwX3ffdnBZmTBZ2OBZyIBZmBBZV+BY56BYd7BYF+BQ75SOj7TxWDigWLiwWLiwVjiwV6jgV8lAWBmQWImwWOmwWVmQWalAWcjgWqiwXLpQXOwQXJ7gX7dfg4BYebBY2bBZSaBZiVBZyPBZ2JBZqDBZZ+BfdX/AEF91n4AQWWmAWakwWdjQWbhwWZgQWUfAWNewWGewX7gfxMBYuKBYqJBT37EQWGhQWGhgU9TAWEiAWGhwU8bAWLiwWLiwUO+Uj3UtkV98+LBZ2IBZmCBZV9BY57BYh7BYF9BX2CBXmIBfwsiwWEjAWFiwWJjQWIiwWGjgWGjgWJjQWJjAWHkAWHkAWKjQWKjQWKkQWJkAWLjgWLjQWMkQWLkQWNjQWLjQWPkAWOkQX38vguBfvPiwV5jgV9lAWBmQWImwWOmwWVmQWZlAWdjgX4LIsFkooFkYsFjYoFjooFkIgFkYgFjIkFjYoFj4YFj4YFjIkFjIkFjIUFjYYFi4gFi4kFioUFi4UFiYkFi4kFh4YFiIYFDgAAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAA==";var Rw=ae(ce(),1);var Vit=ae(ce(),1);var Ow=ae(c2(),1);var qot=ae(ce(),1);var sst=ae(ce(),1);var ust=ae(ce(),1);var wst=ae(ce(),1);function ue(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function l2(t){return typeof t>"u"}function p2(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function Mc(...t){t=Array.isArray(t[0])?t[0]:t;let e=(r,n)=>({a:r.a*n.a+r.c*n.b,c:r.a*n.c+r.c*n.d,e:r.a*n.e+r.c*n.f+r.e,b:r.b*n.a+r.d*n.b,d:r.b*n.c+r.d*n.d,f:r.b*n.e+r.d*n.f+r.f});switch(t.length){case 0:throw Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{let[r,n,...i]=t,s=e(r,n);return Mc(s,...i)}}}var{cos:bP,sin:vP,PI:Trt}=Math;function SP(t,e,r){let n=bP(t),i=vP(t),s={a:n,c:-i,e:0,b:i,d:n,f:0};return l2(e)||l2(r)?s:Mc([p2(e,r),s,p2(-e,-r)])}var{tan:Ert}=Math;function wP(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Cc(t,e,r,n){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Cc.prototype),i.expected=e,i.found=r,i.location=n,i.name="SyntaxError",i}wP(Cc,Error);function Ch(t,e,r){return r=r||" ",t.length>e?t:(e-=t.length,r+=r.repeat(e),t+r.slice(0,e))}Cc.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n<t.length;n++)if(t[n].source===this.location.source){r=t[n].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,s=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,o=this.location.source+":"+s.line+":"+s.column;if(r){var c=this.location.end,l=Ch("",s.line.toString().length," "),a=r[i.line-1],p=i.line===c.line?c.column:a.length+1,d=p-i.column||1;e+=`
 --> `+o+`
`+l+` |
`+s.line+" | "+a+`
`+l+" | "+Ch("",i.column-1," ")+Ch("",d,"^")}else e+=`
 at `+o}return e};Cc.buildMessage=function(t,e){var r={literal:function(a){return'"'+i(a.text)+'"'},class:function(a){var p=a.parts.map(function(d){return Array.isArray(d)?s(d[0])+"-"+s(d[1]):s(d)});return"["+(a.inverted?"^":"")+p.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(a){return a.description}};function n(a){return a.charCodeAt(0).toString(16).toUpperCase()}function i(a){return a.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(p){return"\\x0"+n(p)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(p){return"\\x"+n(p)})}function s(a){return a.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(p){return"\\x0"+n(p)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(p){return"\\x"+n(p)})}function o(a){return r[a.type](a)}function c(a){var p=a.map(o),d,m;if(p.sort(),p.length>0){for(d=1,m=1;d<p.length;d++)p[d-1]!==p[d]&&(p[m]=p[d],m++);p.length=m}switch(p.length){case 1:return p[0];case 2:return p[0]+" or "+p[1];default:return p.slice(0,-1).join(", ")+", or "+p[p.length-1]}}function l(a){return a?'"'+i(a)+'"':"end of input"}return"Expected "+c(t)+" but "+l(e)+" found."};function He(t){if(t.length===0)return{minX:0,maxX:0,minY:0,maxY:0};let e=1/0,r=-1/0,n=1/0,i=-1/0,s=(o)=>{e=Math.min(e,o.x),r=Math.max(r,o.x),n=Math.min(n,o.y),i=Math.max(i,o.y)};return t.forEach((o)=>{switch(o.type){case"path":o.points.forEach(s);break;case"text":s({x:o.x,y:o.y});break;case"circle":{let{x:c,y:l,radius:a}=o;s({x:c-a,y:l-a}),s({x:c+a,y:l+a});break}case"box":{let{x:c,y:l,width:a,height:p}=o,d=a/2,m=p/2;s({x:c-d,y:l-m}),s({x:c+d,y:l+m});break}}}),{minX:e,maxX:r,minY:n,maxY:i}}var AP=(t,e="right")=>{switch(e){case"down":switch(t){case"middle_top":return"middle_right";case"middle_bottom":return"middle_left";case"middle_left":return"middle_bottom";case"middle_right":return"middle_top"}break;case"up":switch(t){case"middle_top":return"middle_left";case"middle_bottom":return"middle_right";case"middle_left":return"middle_top";case"middle_right":return"middle_bottom"}break;case"left":switch(t){case"middle_top":return"middle_bottom";case"middle_bottom":return"middle_top";case"middle_left":return"middle_right";case"middle_right":return"middle_left"}break;case"right":return t}return t},Si=(t,e)=>{let{primitives:r,center:n,ports:i,size:s}=t,o=Mc({a:1,b:0,c:0,d:-1,e:0,f:2*n.y}),c=r.map((a)=>{switch(a={...a},a.type){case"path":return{...a,points:a.points.map((f)=>ue(o,f))};case"text":let p=ue(o,{x:a.x,y:a.y}),d={top_left:"bottom_left",top_right:"bottom_right",bottom_left:"top_left",bottom_right:"top_right",center:"center",middle_top:"middle_bottom",middle_bottom:"middle_top",middle_left:"middle_left",middle_right:"middle_right"};return{...a,x:p.x,y:p.y,anchor:d[a.anchor]};case"circle":case"box":let m=ue(o,{x:a.x,y:a.y});return{...a,x:m.x,y:m.y}}}),l=i.map((a)=>({...a,...ue(o,a)}));return{primitives:c,center:n,ports:l,size:s,...e}},wi=(t,e)=>{let{primitives:r,center:n,ports:i,size:s}=t,o=Mc({a:-1,b:0,c:0,d:1,e:0,f:2*n.x}),c=r.map((a)=>{switch(a={...a},a.type){case"path":return{...a,points:a.points.map((f)=>ue(o,f))};case"text":let p=ue(o,{x:a.x,y:a.y}),d={top_left:"top_right",top_right:"top_left",bottom_left:"bottom_right",bottom_right:"bottom_left",center:"center",middle_top:"middle_top",middle_bottom:"middle_bottom",middle_left:"middle_right",middle_right:"middle_left"};return{...a,x:p.x,y:p.y,anchor:d[a.anchor]};case"circle":case"box":let m=ue(o,{x:a.x,y:a.y});return{...a,x:m.x,y:m.y}}}),l=i.map((a)=>({...a,...ue(o,a)}));return{primitives:c,center:n,ports:l,size:s,...e}},Lo=(t,e)=>{let{newOrientation:r,overrides:n}=e,i={up:Math.PI/2,right:0,down:-Math.PI/2,left:-Math.PI},s=SP(r?i[r]:Math.PI/2,t.center.x,t.center.y),{primitives:o,center:c,size:l,ports:a}=t,p=o.map((f)=>{switch(f={...f},f.type){case"path":return{...f,points:f.points.map((S)=>ue(s,S))};case"text":let _=ue(s,{x:f.x,y:f.y});return f.anchor=AP(f.anchor,r??"right"),{...f,x:_.x,y:_.y};case"circle":let g=ue(s,{x:f.x,y:f.y});return{...f,x:g.x,y:g.y};case"box":let y=ue(s,{x:f.x,y:f.y});return{...f,x:y.x,y:y.y,width:f.height,height:f.width}}}),d=a.map((f)=>({...f,...ue(s,f)})),m=He(p);return{primitives:p,center:c,ports:d,size:{width:m.maxX-m.minX,height:m.maxY-m.minY},...n}},Z=(t,e="down",r={})=>Lo(t,{newOrientation:e,overrides:r}),PP=class{symbol;constructor(t){this.symbol=JSON.parse(JSON.stringify(t)),this.symbol.size=this.computeSize()}changeTextAnchor(t,e,r){return this.symbol={...this.symbol,primitives:this.symbol.primitives.map((n)=>n.type==="text"&&n.text===t?{...n,anchor:e,...r?{x:n.x+r.x,y:n.y+r.y}:{}}:n)},this}labelPort(t,e){return this.symbol={...this.symbol,ports:this.symbol.ports.map((r)=>r.labels.includes(t)?{...r,labels:e}:r)},this}rotateRightFacingSymbol(t){return this.symbol=Lo(this.symbol,{newOrientation:t}),this}computeSize(){let t=He(this.symbol.primitives);return{width:t.maxX-t.minX,height:t.maxY-t.minY}}build(){return{...this.symbol,size:this.computeSize()}}},Y=(t)=>{let e=t.primitives??[...Object.values(t.paths??{}),...Object.values(t.texts??{}),...Object.values(t.circles??{}),...Object.values(t.rects??{})],r=t.ports??Object.entries(t.refblocks).flatMap(([i,s])=>[{...s,labels:[i]}]),n=t.center??{x:t.bounds.centerX,y:t.bounds.centerY};return r.length===2&&(n={x:(r[0].x+r[1].x)/2,y:(r[0].y+r[1].y)/2}),new PP({...t,primitives:e,ports:r,center:n})},Ai={paths:{path11:{type:"path",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.04}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0.04},{x:0.54,y:0.04}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:0.1,y:0.13},{x:0,y:-0.06},{x:-0.11,y:0.13}],color:"primary",fill:!1},path17:{type:"path",points:[{x:0,y:-0.13},{x:0.07,y:-0.11}],color:"primary",fill:!1},path18:{type:"path",points:[{x:0.07,y:-0.11},{x:0.14,y:-0.13}],color:"primary",fill:!1},path19:{type:"path",points:[{x:-0.15,y:-0.13},{x:-0.07,y:-0.11}],color:"primary",fill:!1},path20:{type:"path",points:[{x:-0.07,y:-0.11},{x:0,y:-0.13}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.17,y:0.4},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:-0.4}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.79,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0.04,radius:0.29,color:"primary",fill:!1}}},{paths:BP,texts:Rrt,bounds:Vs,refblocks:h2,circles:IP}=Ai,FP=Y({primitives:[...Object.values(BP),...Object.values(IP),{type:"text",text:"{REF}",x:-0.15,y:0.3894553499999995},{type:"text",text:"{VAL}",x:0.15,y:0.3894553499999995}],ports:[{...h2.left1,labels:["1"]},{...h2.right1,labels:["2"]}],size:{width:Vs.width,height:Vs.height},center:{x:Vs.centerX,y:Vs.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:MP,texts:Ort,bounds:zs,refblocks:d2,circles:CP}=Ai,kP=Y({primitives:[...Object.values(MP),...Object.values(CP),{type:"text",text:"{REF}",x:-0,y:0.4094553499999995},{type:"text",text:"{VAL}",x:0,y:-0.4094553499999995}],ports:[{...d2.left1,labels:["1"]},{...d2.right1,labels:["2"]}],size:{width:zs.width,height:zs.height},center:{x:zs.centerX,y:zs.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:NP,texts:Wrt,bounds:Us,refblocks:m2,circles:YP}=Ai,LP=Y({primitives:[...Object.values(NP),...Object.values(YP),{type:"text",text:"{REF}",x:-0,y:-0.3094553499999995},{type:"text",text:"{VAL}",x:0,y:0.4094553499999995}],ports:[{...m2.left1,labels:["1"]},{...m2.right1,labels:["2"]}],size:{width:Us.width,height:Us.height},center:{x:Us.centerX,y:Us.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:TP,texts:$rt,bounds:Gs,refblocks:u2,circles:EP}=Ai,RP=Y({primitives:[...Object.values(TP),...Object.values(EP),{type:"text",text:"{REF}",x:-0,y:0.4094553499999995},{type:"text",text:"{VAL}",x:0,y:-0.4094553499999995}],ports:[{...u2.left1,labels:["1"]},{...u2.right1,labels:["2"]}],size:{width:Gs.width,height:Gs.height},center:{x:Gs.centerX,y:Gs.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:OP,texts:jrt,bounds:Hs,refblocks:f2,circles:WP}=Ai,$P=Y({primitives:[...Object.values(OP),...Object.values(WP),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...f2.left1,labels:["1"]},{...f2.right1,labels:["2"]}],size:{width:Hs.width,height:Hs.height},center:{x:Hs.centerX,y:Hs.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:jP,texts:Xrt,bounds:Qs,refblocks:y2,circles:XP}=Ai,DP=Y({primitives:[...Object.values(jP),...Object.values(XP),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...y2.left1,labels:["1"]},{...y2.right1,labels:["2"]}],size:{width:Qs.width,height:Qs.height},center:{x:Qs.centerX,y:Qs.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Pi={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:0.14,y:0.18},{x:0.08,y:0.2}],color:"primary",fill:!1},"path43-8-3":{type:"path",points:[{x:0.21,y:-0.11},{x:0.15,y:-0.09}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:VP,texts:Drt,bounds:Zs,refblocks:_2,circles:zP}=Pi,UP=Y({primitives:[...Object.values(VP),...Object.values(zP),{type:"text",text:"{REF}",x:-0.15,y:0.3294553499999995},{type:"text",text:"{VAL}",x:0.15,y:0.3294553499999995}],ports:[{..._2.left1,labels:["1"]},{..._2.right1,labels:["2"]}],size:{width:Zs.width,height:Zs.height},center:{x:Zs.centerX,y:Zs.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),GP=Y(Pi).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1","neg"]).labelPort("right1",["2","pos"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:HP,texts:Vrt,bounds:qs,refblocks:g2,circles:QP}=Pi,ZP=Y({primitives:[...Object.values(HP),...Object.values(QP),{type:"text",text:"{REF}",x:-0,y:-0.2294553499999995},{type:"text",text:"{VAL}",x:0,y:0.3294553499999995}],ports:[{...g2.left1,labels:["1"]},{...g2.right1,labels:["2"]}],size:{width:qs.width,height:qs.height},center:{x:qs.centerX,y:qs.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),qP=Y(Pi).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1","neg"]).labelPort("right1",["2","pos"]).changeTextAnchor("{REF}","middle_bottom").build(),kc={paths:{"anode-lead":{type:"path",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.07000000000000006,y:0.1399999999999999},{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001},{x:0.16999999999999993,y:-0.1399999999999999}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},JP={boxresistor:{horizontalOffset:0.16,horizontalHeight:0.65,verticalX:0.16,verticalRefY:0.16,verticalValY:-0.16,verticalWidth:0.9},capacitor:{horizontalOffset:0.24,horizontalHeight:0.65,verticalX:0.2,verticalRefY:0.095,verticalValY:-0.095,verticalWidth:0.9},led:{horizontalOffset:0.38,horizontalHeight:0.9,verticalX:0.38,verticalRefY:0.14,verticalValY:-0.14,verticalWidth:1.1},diode:{horizontalOffset:0.22,horizontalHeight:0.65,verticalX:0.2,verticalRefY:0.14,verticalValY:-0.14,verticalWidth:0.9},resistor:{horizontalOffset:0.22,horizontalHeight:0.65,verticalX:0.2,verticalRefY:0.14,verticalValY:-0.14,verticalWidth:0.9}},yt=(t,{kind:e,orientation:r,pin1Labels:n=["1"],pin2Labels:i=["2"]})=>{let s=JP[e],o=Y({...t,texts:{}}).rotateRightFacingSymbol(r).labelPort("left1",n).labelPort("right1",i).build(),c=r==="right"||r==="left",l=c?[{type:"text",text:"{REF}",x:0,y:s.horizontalOffset,anchor:"middle_bottom"},{type:"text",text:"{VAL}",x:0,y:-s.horizontalOffset,anchor:"middle_top"}]:[{type:"text",text:"{REF}",x:s.verticalX,y:s.verticalRefY,anchor:"middle_left"},{type:"text",text:"{VAL}",x:s.verticalX,y:s.verticalValY,anchor:"middle_left"}],[a,p]=o.ports,d=Math.hypot(p.x-a.x,p.y-a.y);return{...o,primitives:[...o.primitives,...l],size:c?{width:d,height:s.horizontalHeight}:{width:s.verticalWidth,height:d}}},KP=yt(kc,{kind:"diode",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),tB=yt(kc,{kind:"diode",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),eB=yt(kc,{kind:"diode",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),rB=yt(kc,{kind:"diode",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),{paths:nB,texts:zrt,bounds:Js,refblocks:x2,circles:iB}=Pi,oB=Y({primitives:[...Object.values(nB),...Object.values(iB),{type:"text",text:"{REF}",x:0.15,y:-0.2294553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2294553499999995}],ports:[{...x2.left1,labels:["1"]},{...x2.right1,labels:["2"]}],size:{width:Js.width,height:Js.height},center:{x:Js.centerX,y:Js.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:sB,texts:Urt,bounds:Ks,refblocks:b2,circles:aB}=Pi,cB=Y({primitives:[...Object.values(sB),...Object.values(aB),{type:"text",text:"{REF}",x:0.15,y:-0.2294553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2294553499999995}],ports:[{...b2.left1,labels:["1"]},{...b2.right1,labels:["2"]}],size:{width:Ks.width,height:Ks.height},center:{x:Ks.centerX,y:Ks.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Nc={paths:{"anode-lead":{type:"path",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.050000000000000044,y:0.11999999999999988},{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009},{x:0.15000000000000013,y:-0.1200000000000001}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.25,maxY:0.25,width:0.34999999999999987,height:0.5,centerX:0.00000000000000011102230246251565,centerY:0},circles:{}},lB=yt(Nc,{kind:"diode",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),pB=yt(Nc,{kind:"diode",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),hB=yt(Nc,{kind:"diode",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),dB=yt(Nc,{kind:"diode",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),Yc={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:"primary",fill:!1},path44:{type:"path",points:[{x:0.14,y:0.04},{x:-0.52,y:0.04}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:0.18,y:0.18},{x:0.11,y:0.18}],color:"primary",fill:!1},"path43-8-8":{type:"path",points:[{x:0.18,y:-0.09},{x:0.11,y:-0.09}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:mB,texts:Grt,bounds:ta,refblocks:v2,circles:uB}=Yc,fB=Y({primitives:[...Object.values(mB),...Object.values(uB),{type:"text",text:"{REF}",x:-0.16,y:0.2294553499999995},{type:"text",text:"{VAL}",x:0.16,y:0.2294553499999995}],ports:[{...v2.left1,labels:["1"]},{...v2.right1,labels:["2"]}],size:{width:ta.width,height:ta.height},center:{x:ta.centerX,y:ta.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),{paths:yB,texts:Hrt,bounds:ea,refblocks:S2,circles:_B}=Yc,Wv=Y({primitives:[...Object.values(yB),...Object.values(_B),{type:"text",text:"{REF}",x:-0.0001118,y:-0.18},{type:"text",text:"{VAL}",x:0.0001118,y:0.2738453}],ports:[{...S2.left1,labels:["1"]},{...S2.right1,labels:["2"]}],size:{width:ea.width,height:ea.height},center:{x:ea.centerX,y:ea.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").labelPort("left1",["2"]).labelPort("right1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:gB,texts:Qrt,bounds:ra,refblocks:w2,circles:xB}=Yc,bB=Y({primitives:[...Object.values(gB),...Object.values(xB),{type:"text",text:"{REF}",x:-0.0050250999999996715,y:0.27384529999999985,anchor:"middle_left"},{type:"text",text:"{VAL}",x:-0.00011179999999999524,y:-0.27384530000000007,anchor:"middle_left"}],ports:[{...w2.left1,labels:["1"]},{...w2.right1,labels:["2"]}],size:{width:ra.width,height:ra.height},center:{x:ra.centerX,y:ra.centerY}}).changeTextAnchor("{VAL}","middle_top").labelPort("right1",["2"]).labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:Zrt,texts:qrt,bounds:Jrt,refblocks:Krt,circles:tnt}=Yc,ad=Z(Wv,"down"),cd=ad.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),ld=ad.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");cd.anchor="middle_left";ld.anchor="middle_left";cd.x=0.25;cd.y+=0.21;ld.y-=0.21;ld.x=0.25;var vB=ad,To={paths:{path43:{type:"path",points:[{x:-0.06,y:0.19},{x:-0.06,y:-0.12}],color:"primary",fill:!1},"path43-6":{type:"path",points:[{x:0.02,y:0.13},{x:0.02,y:-0.06}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.06,y:0.03},{x:-0.5,y:0.03}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.5,y:0.03},{x:0.03,y:0.03}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.03,y:0.27},bottom1:{type:"text",text:"{VAL}",x:-0.03,y:-0.28}},refblocks:{left1:{x:-0.5,y:0.03},right1:{x:0.5,y:0.03}},bounds:{minX:-0.5,maxX:0.5,minY:-0.38,maxY:0.27,width:1,height:0.29,centerX:0,centerY:0.06},circles:{}},{paths:SB,bounds:A2,refblocks:P2,circles:wB}=To,AB=Y({primitives:[...Object.values(SB),...Object.values(wB),{type:"text",text:"{REF}",x:-0.2,y:0.31},{type:"text",text:"{VAL}",x:0.2,y:0.31}],ports:[{...P2.left1,labels:["1"]},{...P2.right1,labels:["2"]}],center:{x:A2.centerX,y:A2.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("down").changeTextAnchor("{REF}","middle_left").build(),PB={...AB,size:{width:1,height:0.9}};function Yt(t){let e=t.size;if(!e){let r=He(t.primitives);e={width:r.maxX-r.minX,height:r.maxY-r.minY}}return{...t,size:e}}var{paths:BB,texts:B2,bounds:na,refblocks:I2,circles:IB}=To,$v=Yt({primitives:[...Object.values(BB),...Object.values(IB),{...B2.top1,anchor:"middle_bottom"},{...B2.bottom1,anchor:"middle_top"}],ports:[{...I2.left1,labels:["1"]},{...I2.right1,labels:["2"]}],size:{width:na.width,height:na.height},center:{x:na.centerX,y:na.centerY}}),{paths:FB,bounds:F2,refblocks:M2,circles:MB}=To,CB=Y({primitives:[...Object.values(FB),...Object.values(MB),{type:"text",text:"{REF}",x:0,y:-0.22},{type:"text",text:"{VAL}",x:0,y:0.28}],ports:[{...M2.left1,labels:["1"]},{...M2.right1,labels:["2"]}],center:{x:F2.centerX,y:F2.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").changeTextAnchor("{REF}","middle_bottom").build(),kB={...CB,size:{width:1,height:0.65}},{paths:NB,bounds:C2,refblocks:k2,circles:YB}=To,LB=Y({primitives:[...Object.values(NB),...Object.values(YB),{type:"text",text:"{REF}",x:0,y:0.28},{type:"text",text:"{VAL}",x:0,y:-0.22}],ports:[{...k2.left1,labels:["1"]},{...k2.right1,labels:["2"]}],center:{x:C2.centerX,y:C2.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").changeTextAnchor("{REF}","middle_bottom").build(),TB={...LB,size:{width:1,height:0.65}},{paths:EB,bounds:N2,refblocks:Y2,circles:RB}=To,OB=Y({primitives:[...Object.values(EB),...Object.values(RB),{type:"text",text:"{REF}",x:0.2,y:-0.25},{type:"text",text:"{VAL}",x:-0.2,y:-0.25}],ports:[{...Y2.left1,labels:["1"]},{...Y2.right1,labels:["2"]}],center:{x:N2.centerX,y:N2.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("up").changeTextAnchor("{REF}","middle_left").build(),WB={...OB,size:{width:1,height:0.9}},$B=Lo($v,{newOrientation:"up"}),Lc={paths:{path1:{type:"path",points:[{x:-0.3,y:0},{x:-0.19998,y:0}],color:"primary",fill:!1,strokeWidth:0.012},path2:{type:"path",points:[{x:0.19998,y:0},{x:0.3,y:0}],color:"primary",fill:!1,strokeWidth:0.012},path3:{type:"path",points:[{x:-0.19998,y:0.07998},{x:0.19998,y:0.07998},{x:0.19998,y:-0.07998},{x:-0.19998,y:-0.07998},{x:-0.19998,y:0.07998}],color:"primary",fill:!1,strokeWidth:0.012}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.3,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.45,anchor:"middle_bottom"}},refblocks:{left1:{x:-0.3,y:0},right1:{x:0.3,y:0}},bounds:{minX:-0.3,maxX:0.3,minY:-0.45,maxY:0.3,width:0.6,height:0.75,centerX:0,centerY:0},circles:{}},{paths:jB,texts:ent,bounds:L2,refblocks:T2,circles:XB}=Lc,DB=Y({primitives:[...Object.values(jB),...Object.values(XB),{type:"text",text:"{REF}",x:-0.16,y:0.16},{type:"text",text:"{VAL}",x:0.16,y:0.16}],ports:[{...T2.left1,labels:["1"]},{...T2.right1,labels:["2"]}],center:{x:L2.centerX,y:L2.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),VB={...DB,size:{width:0.9,height:0.6}},{paths:zB,texts:rnt,bounds:E2,refblocks:R2,circles:UB}=Lc,GB=Y({primitives:[...Object.values(zB),...Object.values(UB),{type:"text",text:"{REF}",x:0,y:-0.16},{type:"text",text:"{VAL}",x:0,y:0.16}],ports:[{...R2.left1,labels:["1"]},{...R2.right1,labels:["2"]}],center:{x:E2.centerX,y:E2.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),HB={...GB,size:{width:0.6,height:0.65}},{paths:QB,texts:nnt,bounds:O2,refblocks:W2,circles:ZB}=Lc,qB=Y({primitives:[...Object.values(QB),...Object.values(ZB),{type:"text",text:"{REF}",x:0,y:0.16},{type:"text",text:"{VAL}",x:0,y:-0.16}],ports:[{...W2.left1,labels:["1"]},{...W2.right1,labels:["2"]}],center:{x:O2.centerX,y:O2.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),JB={...qB,size:{width:0.6,height:0.65}},Tc={paths:{"left-lead":{type:"path",points:[{x:-0.25,y:0},{x:-0.175,y:0}],color:"primary",fill:!1,strokeWidth:0.012},body:{type:"path",points:[{x:-0.175,y:0.075},{x:0.175,y:0.075},{x:0.175,y:-0.075},{x:-0.175,y:-0.075},{x:-0.175,y:0.075}],color:"primary",fill:!1,strokeWidth:0.012},"right-lead":{type:"path",points:[{x:0.175,y:0},{x:0.25,y:0}],color:"primary",fill:!1,strokeWidth:0.012}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25,anchor:"middle_top"}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},KB=yt(Tc,{kind:"boxresistor",orientation:"down"}),t8=yt(Tc,{kind:"boxresistor",orientation:"left"}),e8=yt(Tc,{kind:"boxresistor",orientation:"right"}),r8=yt(Tc,{kind:"boxresistor",orientation:"up"}),Ec={paths:{path2:{type:"path",points:[{x:0.15,y:-0.01},{x:0.55,y:-0.01}],color:"primary",fill:!0},"path2-5":{type:"path",points:[{x:-0.15,y:0.06},{x:0.14,y:0.06}],color:"primary",fill:!0},"path2-5-1":{type:"path",points:[{x:0.14,y:0.06},{x:0.14,y:-0.08}],color:"primary",fill:!0},"path2-5-1-6":{type:"path",points:[{x:-0.16,y:0.06},{x:-0.16,y:-0.08}],color:"primary",fill:!0},"path2-5-4":{type:"path",points:[{x:-0.15,y:-0.08},{x:0.14,y:-0.08}],color:"primary",fill:!0},"path2-9":{type:"path",points:[{x:-0.55,y:-0.01},{x:-0.17,y:-0.01}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.17},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.17}},refblocks:{left1:{x:-0.55,y:-0.01},right1:{x:0.55,y:-0.01}},bounds:{minX:-0.58,maxX:0.58,minY:-0.17,maxY:0.17,width:1.16,height:0.35,centerX:0,centerY:0},circles:{}},{paths:n8,texts:int,bounds:ia,refblocks:$2,circles:i8}=Ec,o8=Y({primitives:[...Object.values(n8),...Object.values(i8),{type:"text",text:"{REF}",x:-0.2,y:0.1404553499999995},{type:"text",text:"{VAL}",x:0.2,y:0.1494553499999995}],ports:[{...$2.left1,labels:["1"]},{...$2.right1,labels:["2"]}],size:{width:ia.width,height:ia.height},center:{x:ia.centerX,y:ia.centerY}}).rotateRightFacingSymbol("down").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:s8,texts:ont,bounds:oa,refblocks:j2,circles:a8}=Ec,c8=Y({primitives:[...Object.values(s8),...Object.values(a8),{type:"text",text:"{REF}",x:0,y:-0.2294553499999995},{type:"text",text:"{VAL}",x:0,y:0.1704553499999995}],ports:[{...j2.left1,labels:["1"]},{...j2.right1,labels:["2"]}],size:{width:oa.width,height:oa.height},center:{x:oa.centerX,y:oa.centerY}}).rotateRightFacingSymbol("left").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),{paths:l8,texts:snt,bounds:sa,refblocks:X2,circles:p8}=Ec,h8=Y({primitives:[...Object.values(l8),...Object.values(p8),{type:"text",text:"{REF}",x:0,y:0.2294553499999995},{type:"text",text:"{VAL}",x:0,y:-0.1704553499999995}],ports:[{...X2.left1,labels:["1"]},{...X2.right1,labels:["2"]}],size:{width:sa.width,height:sa.height},center:{x:sa.centerX,y:sa.centerY}}).rotateRightFacingSymbol("right").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),{paths:d8,texts:ant,bounds:aa,refblocks:D2,circles:m8}=Ec,u8=Y({primitives:[...Object.values(d8),...Object.values(m8),{type:"text",text:"{REF}",x:0.2,y:-0.1404553499999995},{type:"text",text:"{VAL}",x:-0.2,y:-0.1494553499999995}],ports:[{...D2.left1,labels:["1"]},{...D2.right1,labels:["2"]}],size:{width:aa.width,height:aa.height},center:{x:aa.centerX,y:aa.centerY}}).rotateRightFacingSymbol("up").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:f8,texts:cnt,bounds:V2,refblocks:z2,circles:y8}=Lc,_8=Y({primitives:[...Object.values(f8),...Object.values(y8),{type:"text",text:"{REF}",x:0.16,y:-0.16},{type:"text",text:"{VAL}",x:-0.16,y:-0.16}],ports:[{...z2.left1,labels:["1"]},{...z2.right1,labels:["2"]}],center:{x:V2.centerX,y:V2.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),g8={..._8,size:{width:0.9,height:0.6}},Rc={paths:{"left-lead":{type:"path",points:[{x:-0.175,y:0},{x:-0.14,y:0}],color:"primary",fill:!1,strokeWidth:0.012},body:{type:"path",points:[{x:-0.14,y:0.065},{x:0.14,y:0.065},{x:0.14,y:-0.065},{x:-0.14,y:-0.065},{x:-0.14,y:0.065}],color:"primary",fill:!1,strokeWidth:0.012},"right-lead":{type:"path",points:[{x:0.14,y:0},{x:0.175,y:0}],color:"primary",fill:!1,strokeWidth:0.012}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25,anchor:"middle_top"}},refblocks:{left1:{x:-0.175,y:0},right1:{x:0.175,y:0}},bounds:{minX:-0.175,maxX:0.175,minY:-0.25,maxY:0.25,width:0.35,height:0.5,centerX:0,centerY:0},circles:{}},x8=yt(Rc,{kind:"boxresistor",orientation:"down"}),b8=yt(Rc,{kind:"boxresistor",orientation:"left"}),v8=yt(Rc,{kind:"boxresistor",orientation:"right"}),S8=yt(Rc,{kind:"boxresistor",orientation:"up"}),pd={paths:{"horizontal-bar":{type:"path",points:[{x:-0.4,y:0},{x:0.4,y:0}],color:"primary",fill:!1},"middle-dash-1":{type:"path",points:[{x:0,y:0.2},{x:0,y:0.07}],color:"primary",fill:!1},"middle-dash-2":{type:"path",points:[{x:0,y:0.01},{x:0,y:-0.12}],color:"primary",fill:!1},"middle-dash-3":{type:"path",points:[{x:0,y:-0.18},{x:0,y:-0.31}],color:"primary",fill:!1},"left-vertical":{type:"path",points:[{x:-0.25,y:0},{x:-0.25,y:-0.2}],color:"primary",fill:!1},"right-vertical":{type:"path",points:[{x:0.25,y:0},{x:0.25,y:-0.2}],color:"primary",fill:!1},"left-ground":{type:"path",points:[{x:-0.3,y:-0.2},{x:-0.25,y:-0.3},{x:-0.2,y:-0.2},{x:-0.3,y:-0.2}],color:"primary",fill:!1},"right-ground":{type:"path",points:[{x:0.2,y:-0.2},{x:0.25,y:-0.3},{x:0.3,y:-0.2},{x:0.2,y:-0.2}],color:"primary",fill:!1}},refblocks:{left1:{x:-0.4,y:0},right1:{x:0.4,y:0}},texts:{ref:{type:"text",text:"{REF}",x:0,y:0.35}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.35,width:0.8,height:0.75,centerX:0,centerY:-0.02},circles:{}},{paths:w8,texts:lnt,bounds:U2,refblocks:G2,circles:A8}=pd,P8=Y({primitives:[...Object.values(w8),...Object.values(A8),{type:"text",text:"{REF}",x:0,y:0.2594553499999995}],ports:[{...G2.left1,labels:["1"]},{...G2.right1,labels:["2"]}],center:{x:U2.centerX,y:U2.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),{paths:B8,texts:pnt,bounds:H2,refblocks:Q2,circles:I8}=pd,jv=Y({primitives:[...Object.values(B8),...Object.values(I8),{type:"text",text:"{REF}",x:0,y:0.2594553499999995}],ports:[{...Q2.left1,labels:["1"]},{...Q2.right1,labels:["2"]}],center:{x:H2.centerX,y:H2.centerY}}).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),F8=wi(jv),{paths:M8,texts:hnt,bounds:Z2,refblocks:q2,circles:C8}=pd,k8=Y({primitives:[...Object.values(M8),...Object.values(C8),{type:"text",text:"{REF}",x:0,y:0.2594553499999995}],ports:[{...q2.left1,labels:["1"]},{...q2.right1,labels:["2"]}],center:{x:Z2.centerX,y:Z2.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_right").build(),Oc={paths:{path27:{type:"path",points:[{x:0.3,y:0},{x:0.06,y:0}],color:"primary",fill:!1,strokeWidth:0.012},path28:{type:"path",points:[{x:-0.06,y:0},{x:-0.3,y:0}],color:"primary",fill:!1,strokeWidth:0.012},path29:{type:"path",points:[{x:0.06,y:0.16002},{x:0.06,y:-0.16002}],color:"primary",fill:!1,strokeWidth:0.012},path30:{type:"path",points:[{x:-0.06,y:0.16002},{x:-0.06,y:-0.16002}],color:"primary",fill:!1,strokeWidth:0.012}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.24,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.24,anchor:"middle_top"}},refblocks:{left1:{x:-0.3,y:0},right1:{x:0.3,y:0}},bounds:{minX:-0.3,maxX:0.3,minY:-0.24,maxY:0.24,width:0.6,height:0.48,centerX:0,centerY:0},circles:{}},{paths:N8,texts:dnt,bounds:ca,refblocks:J2,circles:Y8}=Oc,L8=Y({primitives:[...Object.values(N8),...Object.values(Y8),{type:"text",text:"{REF}",x:-0.2,y:0.115},{type:"text",text:"{VAL}",x:0.2,y:0.115}],ports:[{...J2.left1,labels:["1"]},{...J2.right1,labels:["2"]}],size:{width:ca.width,height:ca.height},center:{x:ca.centerX,y:ca.centerY}}).changeTextAnchor("{VAL}","top_left").rotateRightFacingSymbol("down").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","bottom_left").build(),T8={...L8,size:{width:0.9,height:0.6}},E8=Y(Oc).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["2","neg"]).labelPort("right1",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").build(),R8={...E8,size:{width:0.6,height:0.65}},Wc={paths:{path27:{type:"path",points:[{x:0.3,y:0},{x:0.000657,y:0}],color:"primary",fill:!1,strokeWidth:0.012},path28:{type:"path",points:[{x:-0.038683,y:0},{x:-0.3,y:0}],color:"primary",fill:!1,strokeWidth:0.012},path30:{type:"path",points:[{x:-0.074255,y:0.16002},{x:-0.074255,y:0.16002},{x:-0.069544,y:0.149352},{x:-0.065126,y:0.138684},{x:-0.061005,y:0.128016},{x:-0.057182,y:0.117348},{x:-0.053663,y:0.10668},{x:-0.05045,y:0.096012},{x:-0.047547,y:0.085344},{x:-0.044957,y:0.074676},{x:-0.042684,y:0.064008},{x:-0.040732,y:0.05334},{x:-0.039103,y:0.042672},{x:-0.037801,y:0.032004},{x:-0.03683,y:0.021336},{x:-0.036193,y:0.010668},{x:-0.035893,y:0},{x:-0.036193,y:-0.010668},{x:-0.03683,y:-0.021336},{x:-0.037801,y:-0.032004},{x:-0.039103,y:-0.042672},{x:-0.040732,y:-0.05334},{x:-0.042684,y:-0.064008},{x:-0.044957,y:-0.074676},{x:-0.047547,y:-0.085344},{x:-0.05045,y:-0.096012},{x:-0.053663,y:-0.10668},{x:-0.057182,y:-0.117348},{x:-0.061005,y:-0.128016},{x:-0.065126,y:-0.138684},{x:-0.069544,y:-0.149352},{x:-0.074255,y:-0.16002},{x:-0.074255,y:-0.16002}],color:"primary",fill:!1,strokeWidth:0.012},"path30-7":{type:"path",points:[{x:-0.000385,y:0.16002},{x:-0.000385,y:-0.16002}],color:"primary",fill:!1,strokeWidth:0.012},"path30-9-2":{type:"path",points:[{x:0.156026,y:0.2},{x:0.085846,y:0.2}],color:"primary",fill:!1,strokeWidth:0.012},"path30-9-2-9":{type:"path",points:[{x:0.120936,y:0.16491},{x:0.120936,y:0.23509}],color:"primary",fill:!1,strokeWidth:0.012}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.42,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.42,anchor:"middle_top"}},refblocks:{left1:{x:-0.3,y:0},right1:{x:0.3,y:0}},bounds:{minX:-0.3,maxX:0.3,minY:-0.55,maxY:0.55,width:0.6,height:1.1,centerX:0,centerY:0},circles:{"viewbox-padding-min":{type:"circle",x:-0.3,y:-0.55,radius:0,fill:!1,color:"transparent"},"viewbox-padding-max":{type:"circle",x:0.3,y:0.55,radius:0,fill:!1,color:"transparent"}}},O8=Y(Wc).rotateRightFacingSymbol("up").labelPort("left1",["2","neg"]).labelPort("right1",["1","pos"]).changeTextAnchor("{REF}","middle_left",{x:0.7,y:0.3}).changeTextAnchor("{VAL}","middle_left",{x:-0.12,y:-0.3}).build(),W8=Y(Wc).rotateRightFacingSymbol("right").labelPort("left1",["2","neg"]).labelPort("right1",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),$8=Y(Wc).rotateRightFacingSymbol("left").labelPort("left1",["2","neg"]).labelPort("right1",["1","pos"]).changeTextAnchor("{REF}","middle_bottom",{x:0,y:0.78}).changeTextAnchor("{VAL}","middle_top",{x:0,y:-0.78}).build(),j8=Y(Wc).rotateRightFacingSymbol("down").labelPort("left1",["2","neg"]).labelPort("right1",["1","pos"]).changeTextAnchor("{REF}","middle_left",{x:-0.12,y:0.3}).changeTextAnchor("{VAL}","middle_left",{x:0.72,y:-0.3}).build(),X8=Y(Oc).rotateRightFacingSymbol("right").changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","middle_bottom").build(),D8={...X8,size:{width:0.6,height:0.65}},$c={paths:{"left-lead":{type:"path",points:[{x:-0.25,y:0},{x:-0.06,y:0}],color:"primary",fill:!1,strokeWidth:0.012},"left-plate":{type:"path",points:[{x:-0.06,y:0.16},{x:-0.06,y:-0.16}],color:"primary",fill:!1,strokeWidth:0.012},"right-plate":{type:"path",points:[{x:0.06,y:0.16},{x:0.06,y:-0.16}],color:"primary",fill:!1,strokeWidth:0.012},"right-lead":{type:"path",points:[{x:0.06,y:0},{x:0.25,y:0}],color:"primary",fill:!1,strokeWidth:0.012}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25,anchor:"middle_top"}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},V8=yt($c,{kind:"capacitor",orientation:"down",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),z8=yt($c,{kind:"capacitor",orientation:"left",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),U8=yt($c,{kind:"capacitor",orientation:"right",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),G8=yt($c,{kind:"capacitor",orientation:"up",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),{paths:H8,texts:mnt,bounds:la,refblocks:K2,circles:Q8}=Oc,Z8=Y({primitives:[...Object.values(H8),...Object.values(Q8),{type:"text",text:"{REF}",x:0.2,y:-0.095},{type:"text",text:"{VAL}",x:-0.2,y:-0.095}],ports:[{...K2.left1,labels:["1"]},{...K2.right1,labels:["2"]}],size:{width:la.width,height:la.height},center:{x:la.centerX,y:la.centerY}}).changeTextAnchor("{VAL}","top_left").rotateRightFacingSymbol("up").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","bottom_left").build(),q8={...Z8,size:{width:0.9,height:0.6}},jc={paths:{"left-lead":{type:"path",points:[{x:-0.175,y:0},{x:-0.05,y:0}],color:"primary",fill:!1,strokeWidth:0.012},"left-plate":{type:"path",points:[{x:-0.05,y:0.14},{x:-0.05,y:-0.14}],color:"primary",fill:!1,strokeWidth:0.012},"right-plate":{type:"path",points:[{x:0.05,y:0.14},{x:0.05,y:-0.14}],color:"primary",fill:!1,strokeWidth:0.012},"right-lead":{type:"path",points:[{x:0.05,y:0},{x:0.175,y:0}],color:"primary",fill:!1,strokeWidth:0.012}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25,anchor:"middle_top"}},refblocks:{left1:{x:-0.175,y:0},right1:{x:0.175,y:0}},bounds:{minX:-0.175,maxX:0.175,minY:-0.25,maxY:0.25,width:0.35,height:0.5,centerX:0,centerY:0},circles:{}},J8=yt(jc,{kind:"capacitor",orientation:"down",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),K8=yt(jc,{kind:"capacitor",orientation:"left",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),tI=yt(jc,{kind:"capacitor",orientation:"right",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),eI=yt(jc,{kind:"capacitor",orientation:"up",pin1Labels:["1","pos"],pin2Labels:["2","neg"]}),Bi={paths:{path11:{type:"path",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.03}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0.03},{x:0.54,y:0.03}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.29,y:0.29},{x:0.29,y:-0.23}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.02,y:0.37},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:-0.37}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.03}},bounds:{minX:-0.57,maxX:0.57,minY:-0.37,maxY:0.37,width:1.14,height:0.74,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0.04,radius:0.29,color:"primary",fill:!1}}},{paths:rI,texts:unt,bounds:pa,refblocks:t9,circles:nI}=Bi,iI=Y({primitives:[...Object.values(rI),...Object.values(nI),{type:"text",text:"{REF}",x:-0.15,y:0.3894553499999995},{type:"text",text:"{VAL}",x:0.15,y:0.3894553499999995}],ports:[{...t9.left1,labels:["1"]},{...t9.right1,labels:["2"]}],size:{width:pa.width,height:pa.height},center:{x:pa.centerX,y:pa.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),oI=Y(Bi).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:sI,texts:fnt,bounds:ha,refblocks:e9,circles:aI}=Bi,cI=Y({primitives:[...Object.values(sI),...Object.values(aI),{type:"text",text:"{REF}",x:-0,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:0,y:0.3894553499999995}],ports:[{...e9.left1,labels:["1"]},{...e9.right1,labels:["2"]}],size:{width:ha.width,height:ha.height},center:{x:ha.centerX,y:ha.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),lI=Y(Bi).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1","neg"]).labelPort("right1",["2","pos"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:pI,texts:ynt,bounds:da,refblocks:r9,circles:hI}=Bi,dI=Y({primitives:[...Object.values(pI),...Object.values(hI),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...r9.left1,labels:["1"]},{...r9.right1,labels:["2"]}],size:{width:da.width,height:da.height},center:{x:da.centerX,y:da.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:mI,texts:_nt,bounds:ma,refblocks:n9,circles:uI}=Bi,fI=Y({primitives:[...Object.values(mI),...Object.values(uI),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...n9.left1,labels:["1"]},{...n9.right1,labels:["2"]}],size:{width:ma.width,height:ma.height},center:{x:ma.centerX,y:ma.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Xc={paths:{path27:{type:"path",points:[{x:0.54,y:-0.01},{x:0.13,y:-0.01}],color:"primary",fill:!1},path29:{type:"path",points:[{x:0.13,y:0.25},{x:0.13,y:-0.27}],color:"primary",fill:!1},"path29-2":{type:"path",points:[{x:0.07,y:0.25},{x:0.07,y:-0.28}],color:"primary",fill:!1},path30:{type:"path",points:[{x:-0.14,y:0.25},{x:-0.14,y:-0.27}],color:"primary",fill:!1},"path29-5":{type:"path",points:[{x:-0.08,y:0.26},{x:-0.08,y:-0.27}],color:"primary",fill:!1},"path29-2-7":{type:"path",points:[{x:0.07,y:0.26},{x:-0.08,y:0.26}],color:"primary",fill:!1},"path29-2-7-6":{type:"path",points:[{x:0.07,y:-0.28},{x:-0.08,y:-0.28}],color:"primary",fill:!1},path43:{type:"path",points:[{x:-0.21,y:0.32},{x:0.2,y:0.32}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0,y:0.71},{x:0,y:0.33},{x:0,y:0.32}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:-0.21,y:0.32},{x:-0.21,y:0.25}],color:"primary",fill:!1},"path43-8-8":{type:"path",points:[{x:0.2,y:0.32},{x:0.2,y:0.25}],color:"primary",fill:!1},"path43-9":{type:"path",points:[{x:0.19,y:-0.35},{x:-0.22,y:-0.35}],color:"primary",fill:!1},"path44-0-5":{type:"path",points:[{x:-0.02,y:-0.71},{x:-0.02,y:-0.36},{x:-0.02,y:-0.35}],color:"primary",fill:!1},"path43-8-1":{type:"path",points:[{x:0.19,y:-0.35},{x:0.19,y:-0.28}],color:"primary",fill:!1},"path43-8-8-9":{type:"path",points:[{x:-0.22,y:-0.35},{x:-0.22,y:-0.28}],color:"primary",fill:!1},path28:{type:"path",points:[{x:-0.14,y:-0.01},{x:-0.54,y:-0.01}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"{REF}",x:0.53,y:0.28},right1:{type:"text",text:"{VAL}",x:0.54,y:-0.28}},refblocks:{top1:{x:0,y:0.71},bottom1:{x:-0.02,y:-0.71},left1:{x:-0.54,y:-0.01},right1:{x:0.54,y:-0.01}},bounds:{minX:-0.57,maxX:0.57,minY:-0.74,maxY:0.74,width:1.14,height:1.48,centerX:0,centerY:0},circles:{}},{paths:yI,texts:gnt,bounds:ua,refblocks:fa,circles:_I}=Xc,gI=Y({primitives:[...Object.values(yI),...Object.values(_I),{type:"text",text:"{REF}",x:-0.4,y:0.4094554499999995},{type:"text",text:"{VAL}",x:0.4,y:0.4094553499999995}],ports:[{...fa.left1,labels:["1"]},{...fa.right1,labels:["3"]},{...fa.bottom1,labels:["2"]},{...fa.top1,labels:["4"]}],size:{width:ua.width,height:ua.height},center:{x:ua.centerX,y:ua.centerY}}).rotateRightFacingSymbol("down").changeTextAnchor("{REF}","bottom_left").changeTextAnchor("{VAL}","top_left").build(),xI=Y(Xc).labelPort("top1",["2","gnd1"]).labelPort("bottom1",["4","gnd2"]).labelPort("left1",["3"]).labelPort("right1",["1"]).changeTextAnchor("{REF}","bottom_left").changeTextAnchor("{VAL}","top_left").build(),bI=Y(Xc).labelPort("top1",["4","gnd1"]).labelPort("bottom1",["2","gnd2"]).labelPort("left1",["1"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","bottom_left").changeTextAnchor("{VAL}","top_left").build(),{paths:vI,texts:xnt,bounds:ya,refblocks:_a,circles:SI}=Xc,wI=Y({primitives:[...Object.values(vI),...Object.values(SI),{type:"text",text:"{VAL}",x:-0.4,y:-0.4094554499999995},{type:"text",text:"{REF}",x:0.4,y:-0.4094553499999995}],ports:[{..._a.left1,labels:["1"]},{..._a.right1,labels:["3"]},{..._a.bottom1,labels:["2"]},{..._a.top1,labels:["4"]}],size:{width:ya.width,height:ya.height},center:{x:ya.centerX,y:ya.centerY}}).rotateRightFacingSymbol("up").changeTextAnchor("{REF}","bottom_left").changeTextAnchor("{VAL}","top_left").build(),Dc={paths:{path27:{type:"path",points:[{x:0.55,y:-0.01},{x:0.13,y:-0.01}],color:"primary",fill:!1},path28:{type:"path",points:[{x:-0.14,y:-0.01},{x:-0.55,y:-0.01}],color:"primary",fill:!1},path29:{type:"path",points:[{x:0.13,y:-0.28},{x:0.13,y:0.25}],color:"primary",fill:!1},"path29-2":{type:"path",points:[{x:0.07,y:-0.28},{x:0.07,y:0.25}],color:"primary",fill:!1},path30:{type:"path",points:[{x:-0.14,y:-0.28},{x:-0.14,y:0.25}],color:"primary",fill:!1},"path29-5":{type:"path",points:[{x:-0.08,y:-0.28},{x:-0.08,y:0.25}],color:"primary",fill:!1},"path29-2-7":{type:"path",points:[{x:0.07,y:-0.28},{x:-0.08,y:-0.28}],color:"primary",fill:!1},"path29-2-7-6":{type:"path",points:[{x:0.07,y:0.26},{x:-0.08,y:0.26}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{VAL}",x:-0.01,y:-0.42},bottom1:{type:"text",text:"{REF}",x:0,y:0.43}},refblocks:{left1:{x:-0.55,y:-0.01},right1:{x:0.55,y:-0.01}},bounds:{minX:-0.58,maxX:0.58,minY:-0.52,maxY:0.43,width:1.16,height:1,centerX:0,centerY:-0.04},circles:{}},{paths:AI,texts:bnt,bounds:ga,refblocks:i9,circles:PI}=Dc,BI=Y({primitives:[...Object.values(AI),...Object.values(PI),{type:"text",text:"{REF}",x:-0.3,y:0.3094553499999995},{type:"text",text:"{VAL}",x:0.3,y:0.3094553499999995}],ports:[{...i9.left1,labels:["1"]},{...i9.right1,labels:["2"]}],size:{width:ga.width,height:ga.height},center:{x:ga.centerX,y:ga.centerY}}).changeTextAnchor("{VAL}","top_left").rotateRightFacingSymbol("down").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","bottom_left").build(),II=Y(Dc).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["2","neg"]).labelPort("right1",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").build(),FI=Y(Dc).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:MI,texts:vnt,bounds:xa,refblocks:o9,circles:CI}=Dc,kI=Y({primitives:[...Object.values(MI),...Object.values(CI),{type:"text",text:"{REF}",x:0.3,y:-0.3094553499999995},{type:"text",text:"{VAL}",x:-0.3,y:-0.3094553499999995}],ports:[{...o9.left1,labels:["1"]},{...o9.right1,labels:["2"]}],size:{width:xa.width,height:xa.height},center:{x:xa.centerX,y:xa.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("up").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","bottom_left").build(),Mo=0.6,kh=0.3,NI=[{type:"path",points:[{x:-Mo,y:0},{x:-kh,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:kh,y:0},{x:Mo,y:0}],color:"primary",fill:!1},{type:"circle",x:0,y:0,radius:kh,color:"primary",fill:!1},{type:"path",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:"primary",fill:!1}],YI=Y({primitives:[...NI,{type:"text",text:"{REF}",x:-0.2,y:0.35},{type:"text",text:"{VAL}",x:0.2,y:0.35}],ports:[{x:-Mo,y:0,labels:["1"]},{x:Mo,y:0,labels:["2"]}],center:{x:0,y:0},size:{width:Mo*2,height:0.9}}).rotateRightFacingSymbol("down").changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Co=0.6,Nh=0.3,LI=[{type:"path",points:[{x:-Co,y:0},{x:-Nh,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:Nh,y:0},{x:Co,y:0}],color:"primary",fill:!1},{type:"circle",x:0,y:0,radius:Nh,color:"primary",fill:!1},{type:"path",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:"primary",fill:!1}],TI=Y({primitives:[...LI,{type:"text",text:"{REF}",x:0,y:-0.4},{type:"text",text:"{VAL}",x:0,y:0.4}],ports:[{x:-Co,y:0,labels:["1"]},{x:Co,y:0,labels:["2"]}],center:{x:0,y:0},size:{width:Co*2,height:0.9}}).rotateRightFacingSymbol("left").changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),ko=0.6,Yh=0.3,EI=[{type:"path",points:[{x:-ko,y:0},{x:-Yh,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:Yh,y:0},{x:ko,y:0}],color:"primary",fill:!1},{type:"circle",x:0,y:0,radius:Yh,color:"primary",fill:!1},{type:"path",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:"primary",fill:!1}],RI=Y({primitives:[...EI,{type:"text",text:"{REF}",x:0,y:0.4},{type:"text",text:"{VAL}",x:0,y:-0.4}],ports:[{x:-ko,y:0,labels:["1"]},{x:ko,y:0,labels:["2"]}],center:{x:0,y:0},size:{width:ko*2,height:0.9}}).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),No=0.6,Lh=0.3,OI=[{type:"path",points:[{x:-No,y:0},{x:-Lh,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:Lh,y:0},{x:No,y:0}],color:"primary",fill:!1},{type:"circle",x:0,y:0,radius:Lh,color:"primary",fill:!1},{type:"path",points:[{x:-0.1,y:0},{x:0.15,y:0}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:0.08}],color:"primary",fill:!1},{type:"path",points:[{x:0.15,y:0},{x:0.05,y:-0.08}],color:"primary",fill:!1}],WI=Y({primitives:[...OI,{type:"text",text:"{REF}",x:0.2,y:-0.35},{type:"text",text:"{VAL}",x:-0.2,y:-0.35}],ports:[{x:-No,y:0,labels:["1"]},{x:No,y:0,labels:["2"]}],center:{x:0,y:0},size:{width:No*2,height:0.9}}).rotateRightFacingSymbol("up").changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Ii={paths:{path11:{type:"path",points:[{x:1.99,y:-1.64},{x:2.1,y:-1.64}],color:"primary",fill:!1},"path40-0":{type:"path",points:[{x:2.1,y:-1.48},{x:2.1,y:-1.8}],color:"primary",fill:!1},"path40-0-5":{type:"path",points:[{x:2.22,y:-1.5},{x:2.11,y:-1.58}],color:"primary",fill:!1},"path40-0-5-0":{type:"path",points:[{x:2.23,y:-1.78},{x:2.11,y:-1.7}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:2.23,y:-1.49},{x:2.23,y:-1.14}],color:"primary",fill:!1},"path12-1-5-3":{type:"path",points:[{x:2.23,y:-1.97},{x:2.23,y:-1.79}],color:"primary",fill:!1},"arrow-2":{type:"path",points:[{x:2.17,y:-1.7},{x:2.13,y:-1.76},{x:2.19,y:-1.76},{x:2.17,y:-1.7}],color:"primary",fill:!0},path1:{type:"path",points:[{x:1.6,y:-1.5},{x:1.86,y:-1.5}],color:"primary",fill:!1},path2:{type:"path",points:[{x:1.87,y:-1.34},{x:1.87,y:-1.66}],color:"primary",fill:!1},path3:{type:"path",points:[{x:1.99,y:-1.36},{x:1.87,y:-1.44}],color:"primary",fill:!1},path4:{type:"path",points:[{x:1.99,y:-1.64},{x:1.88,y:-1.56}],color:"primary",fill:!1},"arrow-1":{type:"path",points:[{x:1.94,y:-1.56},{x:1.89,y:-1.62},{x:1.96,y:-1.62},{x:1.94,y:-1.56}],color:"primary",fill:!0},path9:{type:"path",points:[{x:1.99,y:-1.35},{x:2.23,y:-1.36}],color:"primary",fill:!1}},texts:{bottom1:{type:"text",text:"{VAL}",x:1.88,y:-1.94},right1:{type:"text",text:"{REF}",x:1.88,y:-1.14}},refblocks:{right1:{x:2.23,y:-1.97},right2:{x:1.6,y:-1.5},right3:{x:2.23,y:-1.14}},bounds:{minX:1.58,maxX:2.35,minY:-1.98,maxY:-1.12,width:0.77,height:0.86,centerX:1.96,centerY:-1.55},circles:{"path1-0":{type:"circle",x:2.05,y:-1.54,radius:0.3,color:"primary",fill:!1}}},$I=Y(Ii).rotateRightFacingSymbol("down").labelPort("right2",["1"]).labelPort("right1",["2"]).labelPort("right3",["3"]).changeTextAnchor("{VAL}","middle_left",{x:0.8,y:-0.15}).changeTextAnchor("{REF}","middle_left",{x:0,y:0.15}).build(),jI=Y(Ii).rotateRightFacingSymbol("right").labelPort("right2",["1"]).labelPort("right1",["2"]).labelPort("right3",["3"]).changeTextAnchor("{VAL}","middle_right").changeTextAnchor("{REF}","middle_right").build(),XI=Y(Ii).rotateRightFacingSymbol("left").labelPort("right2",["1"]).labelPort("right1",["2"]).labelPort("right3",["3"]).changeTextAnchor("{VAL}","middle_left",{x:0,y:-0.8}).changeTextAnchor("{REF}","middle_left",{x:0,y:0.8}).build(),DI=Y(Ii).rotateRightFacingSymbol("right").labelPort("right2",["1"]).labelPort("right1",["2"]).labelPort("right3",["3"]).changeTextAnchor("{VAL}","middle_right").changeTextAnchor("{REF}","middle_right").build(),VI=Y(Ii).rotateRightFacingSymbol("up").labelPort("right2",["1"]).labelPort("right1",["2"]).labelPort("right3",["3"]).changeTextAnchor("{VAL}","middle_left",{x:0,y:-0.15}).changeTextAnchor("{REF}","middle_left",{x:0.8,y:0.15}).build(),zI=Y(Ii).rotateRightFacingSymbol("up").labelPort("right2",["1"]).labelPort("right1",["2"]).labelPort("right3",["3"]).changeTextAnchor("{VAL}","middle_left",{x:0,y:-0.15}).changeTextAnchor("{REF}","middle_left",{x:0.8,y:0.15}).build(),UI={paths:{path11:{type:"path",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0},{x:0.54,y:0}],color:"primary",fill:!1},path2:{type:"path",points:[{x:-0.12,y:0.09},{x:0.12,y:0.09}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.18,y:-0.45},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.35},left1:{type:"text",text:"A",x:0,y:-0.1}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:-0.09,maxY:0.09,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:s9,bounds:ba,refblocks:a9,circles:GI}=UI,Eo=Yt({primitives:[s9.path11,s9.path12,{type:"path",points:[{x:-0.12,y:0.14},{x:0.12,y:0.14}],color:"primary",fill:!1},...Object.values(GI),{type:"text",text:"{REF}",x:0,y:0.3594553499999995,anchor:"middle_bottom"},{type:"text",text:"{VAL}",x:0,y:-0.35,anchor:"middle_top"},{type:"path",points:[{x:-0.095,y:-0.16},{x:0,y:0.09}],color:"primary",fill:!1},{type:"path",points:[{x:0,y:0.09},{x:0.095,y:-0.16}],color:"primary",fill:!1},{type:"path",points:[{x:-0.048,y:-0.045},{x:0.048,y:-0.045}],color:"primary",fill:!1}],ports:[{...a9.left1,labels:["1"]},{...a9.right1,labels:["2"]}],size:{width:ba.width,height:ba.height},center:{x:ba.centerX,y:ba.centerY}}),nd=structuredClone(Eo);nd.primitives=nd.primitives.map((t)=>t.type!=="text"?t:t.text==="{REF}"?{...t,x:-0.16,y:0.3594553499999995,anchor:"middle_bottom"}:t.text==="{VAL}"?{...t,x:0.16,y:0.35,anchor:"middle_bottom"}:t);var c9=Lo(nd,{newOrientation:"down"}),HI=wi(Eo),QI=Eo,id=structuredClone(Eo);id.primitives=id.primitives.map((t)=>t.type!=="text"?t:t.text==="{REF}"?{...t,x:0.16,y:-0.3594553499999995,anchor:"middle_top"}:t.text==="{VAL}"?{...t,x:-0.16,y:-0.35,anchor:"middle_top"}:t);var ZI=Lo(id,{newOrientation:"up"}),Fi={paths:{path11:{type:"path",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.04}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0.04},{x:0.54,y:0.04}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:0.1,y:0.13},{x:0,y:-0.06},{x:-0.11,y:0.13}],color:"primary",fill:!1},path2:{type:"path",points:[{x:-0.12,y:-0.14},{x:0.12,y:-0.14}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.17,y:0.4},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:-0.4}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.79,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0.04,radius:0.29,color:"primary",fill:!1}}},{paths:qI,texts:Snt,bounds:va,refblocks:l9,circles:JI}=Fi,KI=Y({primitives:[...Object.values(qI),...Object.values(JI),{type:"text",text:"{REF}",x:-0.15,y:0.3894553499999995},{type:"text",text:"{VAL}",x:0.15,y:0.3894553499999995}],ports:[{...l9.left1,labels:["1"]},{...l9.right1,labels:["2"]}],size:{width:va.width,height:va.height},center:{x:va.centerX,y:va.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:tF,texts:wnt,bounds:Sa,refblocks:p9,circles:eF}=Fi,rF=Y({primitives:[...Object.values(tF),...Object.values(eF),{type:"text",text:"{REF}",x:-0,y:0.3894553499999995},{type:"text",text:"{VAL}",x:0,y:-0.3294553499999995}],ports:[{...p9.left1,labels:["1"]},{...p9.right1,labels:["2"]}],size:{width:Sa.width,height:Sa.height},center:{x:Sa.centerX,y:Sa.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:nF,texts:Ant,bounds:wa,refblocks:h9,circles:iF}=Fi,oF=Y({primitives:[...Object.values(nF),...Object.values(iF),{type:"text",text:"{REF}",x:-0,y:-0.3294553499999995},{type:"text",text:"{VAL}",x:0,y:0.4294553499999995}],ports:[{...h9.left1,labels:["1"]},{...h9.right1,labels:["2"]}],size:{width:wa.width,height:wa.height},center:{x:wa.centerX,y:wa.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:sF,texts:Pnt,bounds:Aa,refblocks:d9,circles:aF}=Fi,cF=Y({primitives:[...Object.values(sF),...Object.values(aF),{type:"text",text:"{REF}",x:-0,y:0.3894553499999995},{type:"text",text:"{VAL}",x:0,y:-0.3294553499999995}],ports:[{...d9.left1,labels:["1"]},{...d9.right1,labels:["2"]}],size:{width:Aa.width,height:Aa.height},center:{x:Aa.centerX,y:Aa.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:lF,texts:Bnt,bounds:Pa,refblocks:m9,circles:pF}=Fi,hF=Y({primitives:[...Object.values(lF),...Object.values(pF),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...m9.left1,labels:["1"]},{...m9.right1,labels:["2"]}],size:{width:Pa.width,height:Pa.height},center:{x:Pa.centerX,y:Pa.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:dF,texts:Int,bounds:Ba,refblocks:u9,circles:mF}=Fi,uF=Y({primitives:[...Object.values(dF),...Object.values(mF),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...u9.left1,labels:["1"]},{...u9.right1,labels:["2"]}],size:{width:Ba.width,height:Ba.height},center:{x:Ba.centerX,y:Ba.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Mi={paths:{path11:{type:"path",points:[{x:-0.54,y:0.04},{x:-0.11,y:0.04}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.1,y:0.04},{x:0.54,y:0.04}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-0.09,y:-0.15},{x:-0.09,y:0.26}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:0.09,y:-0.15},{x:0.09,y:0.26}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-0.08,y:0.06},{x:-0.08,y:-0.15},{x:0.09,y:-0.05},{x:-0.08,y:0.06}],color:"primary",fill:!0},"path11-0-9-0":{type:"path",points:[{x:0.08,y:0.26},{x:0.08,y:0.05},{x:-0.09,y:0.15},{x:0.07,y:0.26}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.03,y:0.42},bottom1:{type:"text",text:"{VAL}",x:-0.03,y:-0.42}},refblocks:{left1:{x:-0.54,y:0.04},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.42,maxY:0.42,width:1.14,height:0.83,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0.05,radius:0.29,color:"primary",fill:!1}}},fF=Y(Mi).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left",{x:-0.03,y:0.2}).changeTextAnchor("{VAL}","middle_left",{x:0.8,y:-0.2}).build(),yF=Y(Mi).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom",{x:0,y:0.1}).changeTextAnchor("{VAL}","middle_top").build(),_F=Y(Mi).rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom",{x:0,y:0.8}).changeTextAnchor("{VAL}","middle_top",{x:0,y:-0.9}).build(),gF=Y(Mi).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom",{x:0,y:0.1}).changeTextAnchor("{VAL}","middle_top").build(),xF=Y(Mi).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left",{x:0.7,y:0.2}).changeTextAnchor("{VAL}","middle_left",{x:-0.13,y:-0.2}).build(),bF=Y(Mi).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left",{x:0.7,y:0.2}).changeTextAnchor("{VAL}","middle_left",{x:-0.13,y:-0.2}).build(),Vc={paths:{triangle:{type:"path",points:[{x:-0.06,y:-0.09},{x:-0.06,y:0.09},{x:0.06,y:0},{x:-0.06,y:-0.09}],color:"primary",fill:!1},stem:{type:"path",points:[{x:-0.11,y:0},{x:-0.06,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.03}},refblocks:{left1:{x:-0.11,y:0}},bounds:{minX:-0.57,maxX:0.57,minY:-0.37,maxY:0.37,width:1.14,height:0.74,centerX:0,centerY:0},circles:{}},{paths:vF,bounds:f9,refblocks:SF}=Vc,wF=Y({primitives:[...Object.values(vF),{type:"text",text:"{REF}",x:-0.13,y:-0}],ports:[{...SF.left1,labels:["1"]}],center:{x:f9.centerX,y:f9.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_top").build(),{paths:AF,bounds:y9,refblocks:PF}=Vc,BF=Y({primitives:[...Object.values(AF),{type:"text",text:"{REF}",x:-0.13,y:0}],ports:[{...PF.left1,labels:["1"]}],center:{x:y9.centerX,y:y9.centerY}}).rotateRightFacingSymbol("right").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_right").build(),{paths:IF,bounds:_9,refblocks:FF}=Vc,MF=Y({primitives:[...Object.values(IF),{type:"text",text:"{REF}",x:-0.13,y:-0}],ports:[{...FF.left1,labels:["1"]}],center:{x:_9.centerX,y:_9.centerY}}).rotateRightFacingSymbol("left").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_left").build(),{paths:CF,bounds:g9,refblocks:kF}=Vc,NF=Y({primitives:[...Object.values(CF),{type:"text",text:"{REF}",x:-0.13,y:0}],ports:[{...kF.left1,labels:["1"]}],center:{x:g9.centerX,y:g9.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),YF={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},zc=Y(YF).labelPort("left1",["1","pos","anode"]).labelPort("right1",["2","neg","cathode"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),LF=Z(zc,"down"),TF=Z(zc,"left"),Uc={paths:{"anode-lead":{type:"path",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},EF=yt(Uc,{kind:"diode",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),RF=yt(Uc,{kind:"diode",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),OF=yt(Uc,{kind:"diode",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),WF=yt(Uc,{kind:"diode",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),$F=Z(zc,"up"),Gc={paths:{"anode-lead":{type:"path",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.25,maxY:0.25,width:0.34999999999999987,height:0.5,centerX:0.00000000000000011102230246251565,centerY:0},circles:{}},jF=yt(Gc,{kind:"diode",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),XF=yt(Gc,{kind:"diode",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),DF=yt(Gc,{kind:"diode",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),VF=yt(Gc,{kind:"diode",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),zF={paths:{path1:{type:"path",points:[{x:-0.37,y:0.22},{x:-0.13,y:0.22}],color:"primary",fill:!1},"path-1-2":{type:"path",points:[{x:-0.07,y:0.22},{x:0.11,y:0.16}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.1,y:0.13},{x:0.37,y:0.13}],color:"primary",fill:!1},path3:{type:"path",points:[{x:0.12,y:0.36},{x:0.37,y:0.36}],color:"primary",fill:!1},path4:{type:"path",points:[{x:-0.37,y:-0.18},{x:-0.13,y:-0.18}],color:"primary",fill:!1},"path4-5":{type:"path",points:[{x:-0.07,y:-0.19},{x:0.1,y:-0.24}],color:"primary",fill:!1},path5:{type:"path",points:[{x:0.1,y:-0.27},{x:0.37,y:-0.27}],color:"primary",fill:!1},path6:{type:"path",points:[{x:0.12,y:-0.04},{x:0.37,y:-0.04}],color:"primary",fill:!1},"path1-4-join":{type:"path",points:[{x:0,y:-0.2},{x:0,y:0.19}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.56},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.42}},refblocks:{left1:{x:-0.37,y:0.22},left2:{x:-0.37,y:-0.18},right1:{x:0.37,y:0.36},right2:{x:0.37,y:0.13},right3:{x:0.37,y:-0.04},right5:{x:0.37,y:-0.27}},bounds:{minX:-0.4,maxX:0.4,minY:-0.47,maxY:0.56,width:1,height:1.04,centerX:0,centerY:0.05},circles:{"circle-2":{type:"circle",x:0.08,y:0.13,radius:0.02,color:"primary",fill:!1},"circle-5":{type:"circle",x:0.08,y:-0.27,radius:0.02,color:"primary",fill:!1},"circle-3":{type:"circle",x:0.08,y:0.37,radius:0.02,color:"primary",fill:!1},"circle-6":{type:"circle",x:0.08,y:-0.04,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.1,y:0.22,radius:0.02,color:"primary",fill:!1},"circle-4":{type:"circle",x:-0.1,y:-0.18,radius:0.02,color:"primary",fill:!1}}},Hc=Y(zF).labelPort("left1",["1"]).labelPort("right1",["3"]).labelPort("right2",["2"]).labelPort("right3",["6"]).labelPort("left2",["4"]).labelPort("right5",["5"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),hd=Z(Hc,"down"),dd=hd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),md=hd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");dd.anchor="middle_bottom";md.anchor="middle_top";dd.x=0;dd.y+=0.537;md.y-=0.5375;md.x=0;var UF=hd,ud=Z(Hc,"left"),fd=ud.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),yd=ud.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");fd.anchor="middle_bottom";yd.anchor="middle_top";fd.x=0;fd.y+=1;yd.y-=1;yd.x=0;var GF=ud,_d=Z(Hc,"up"),gd=_d.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),xd=_d.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");gd.anchor="middle_bottom";xd.anchor="middle_top";gd.x=0;gd.y+=0.537;xd.y-=0.5375;xd.x=0;var HF=_d,QF={paths:{path1:{type:"path",points:[{x:-0.37,y:0.22},{x:-0.13,y:0.22}],color:"primary",fill:!1},"path-1-3":{type:"path",points:[{x:-0.07,y:0.23},{x:0.11,y:0.33}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.1,y:0.13},{x:0.37,y:0.13}],color:"primary",fill:!1},path3:{type:"path",points:[{x:0.12,y:0.36},{x:0.37,y:0.36}],color:"primary",fill:!1},path4:{type:"path",points:[{x:-0.37,y:-0.18},{x:-0.13,y:-0.18}],color:"primary",fill:!1},"path4-6":{type:"path",points:[{x:-0.07,y:-0.18},{x:0.11,y:-0.07}],color:"primary",fill:!1},path5:{type:"path",points:[{x:0.1,y:-0.27},{x:0.37,y:-0.27}],color:"primary",fill:!1},path6:{type:"path",points:[{x:0.12,y:-0.04},{x:0.37,y:-0.04}],color:"primary",fill:!1},"path1-4-join":{type:"path",points:[{x:0,y:-0.12},{x:0,y:0.27}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.61},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.52}},refblocks:{left1:{x:-0.37,y:0.22},left2:{x:-0.37,y:-0.18},right1:{x:0.37,y:0.36},right2:{x:0.37,y:0.13},right3:{x:0.37,y:-0.04},right5:{x:0.37,y:-0.27}},bounds:{minX:-0.4,maxX:0.4,minY:-0.47,maxY:0.56,width:1,height:1.04,centerX:0,centerY:0.05},circles:{"circle-2":{type:"circle",x:0.08,y:0.13,radius:0.02,color:"primary",fill:!1},"circle-5":{type:"circle",x:0.08,y:-0.27,radius:0.02,color:"primary",fill:!1},"circle-3":{type:"circle",x:0.08,y:0.37,radius:0.02,color:"primary",fill:!1},"circle-6":{type:"circle",x:0.08,y:-0.04,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.1,y:0.22,radius:0.02,color:"primary",fill:!1},"circle-4":{type:"circle",x:-0.1,y:-0.18,radius:0.02,color:"primary",fill:!1}}},Qc=Y(QF).labelPort("left1",["1"]).labelPort("right1",["3"]).labelPort("right2",["2"]).labelPort("right3",["6"]).labelPort("left2",["4"]).labelPort("right5",["5"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),bd=Z(Qc,"down"),vd=bd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Sd=bd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");vd.anchor="middle_bottom";Sd.anchor="middle_top";vd.x=0;vd.y+=0.565;Sd.y-=0.555;Sd.x=0;var ZF=bd,wd=Z(Qc,"left"),Ad=wd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Pd=wd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Ad.anchor="middle_bottom";Pd.anchor="middle_top";Ad.x=0;Ad.y+=1.09;Pd.y-=1.09;Pd.x=0;var qF=wd,Bd=Z(Qc,"up"),Id=Bd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Fd=Bd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Id.anchor="middle_bottom";Fd.anchor="middle_top";Id.x=0;Id.y+=0.565;Fd.y-=0.555;Fd.x=0;var JF=Bd,KF={paths:{path11:{type:"path",points:[{x:-0.38,y:0.06},{x:-0.14,y:0.06}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-0.09,y:0.07},{x:0.11,y:0.11}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.13,y:0.06},{x:0.38,y:0.06}],color:"primary",fill:!1},"path11-5":{type:"path",points:[{x:-0.38,y:-0.17},{x:-0.14,y:-0.17}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:-0.09,y:-0.17},{x:0.11,y:-0.12}],color:"primary",fill:!1},"path12-0":{type:"path",points:[{x:0.13,y:-0.17},{x:0.38,y:-0.17}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.31},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.31}},refblocks:{left1:{x:-0.38,y:-0.17},left3:{x:-0.38,y:0.06},right1:{x:0.38,y:-0.17},right3:{x:0.38,y:0.06}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.81,height:0.79,centerX:0,centerY:0},circles:{"circle-4":{type:"circle",x:0.1,y:0.06,radius:0.02,color:"primary",fill:!1},"circle-2":{type:"circle",x:0.1,y:-0.17,radius:0.02,color:"primary",fill:!1},"circle-3":{type:"circle",x:-0.11,y:0.06,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.11,y:-0.17,radius:0.02,color:"primary",fill:!1}}},Zc=Y(KF).labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("right3",["4"]).labelPort("left3",["3"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),Md=Z(Zc,"down"),Cd=Md.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),kd=Md.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Cd.anchor="middle_bottom";kd.anchor="middle_top";Cd.x=0.4;Cd.y+=0.265;kd.y-=0.265;kd.x=0.4;var t6=Md,Nd=Z(Zc,"left"),Yd=Nd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Ld=Nd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Yd.anchor="middle_bottom";Ld.anchor="middle_top";Yd.x=0;Yd.y+=0.67;Ld.y-=0.67;Ld.x=0;var e6=Nd,Td=Z(Zc,"up"),Ed=Td.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Rd=Td.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Ed.anchor="middle_bottom";Rd.anchor="middle_top";Ed.x=0.46;Ed.y+=0.265;Rd.y-=0.265;Rd.x=0.46;var r6=Td,n6={paths:{path11:{type:"path",points:[{x:-0.38,y:0.06},{x:-0.14,y:0.06}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-0.09,y:0.07},{x:0.1,y:0.2}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.13,y:0.06},{x:0.38,y:0.06}],color:"primary",fill:!1},"path11-5":{type:"path",points:[{x:-0.38,y:-0.17},{x:-0.14,y:-0.17}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:-0.09,y:-0.16},{x:0.1,y:-0.03}],color:"primary",fill:!1},"path12-0":{type:"path",points:[{x:0.13,y:-0.17},{x:0.38,y:-0.17}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.42},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.42}},refblocks:{left1:{x:-0.38,y:-0.17},left3:{x:-0.38,y:0.06},right1:{x:0.38,y:-0.17},right3:{x:0.38,y:0.06}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.81,height:0.79,centerX:0,centerY:0},circles:{"circle-4":{type:"circle",x:0.1,y:0.06,radius:0.02,color:"primary",fill:!1},"circle-2":{type:"circle",x:0.1,y:-0.17,radius:0.02,color:"primary",fill:!1},"circle-3":{type:"circle",x:-0.11,y:0.06,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.11,y:-0.17,radius:0.02,color:"primary",fill:!1}}},qc=Y(n6).labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("right3",["4"]).labelPort("left3",["3"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),Od=Z(qc,"down"),Wd=Od.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),$d=Od.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Wd.anchor="middle_bottom";$d.anchor="middle_top";Wd.x=0.4;Wd.y+=0.295;$d.y-=0.295;$d.x=0.42;var i6=Od,jd=Z(qc,"left"),Xd=jd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Dd=jd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Xd.anchor="middle_bottom";Dd.anchor="middle_top";Xd.x=0;Xd.y+=0.795;Dd.y-=0.795;Dd.x=0;var o6=jd,Vd=Z(qc,"up"),zd=Vd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Ud=Vd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");zd.anchor="middle_bottom";Ud.anchor="middle_top";zd.x=0.46;zd.y+=0.315;Ud.y-=0.315;Ud.x=0.46;var s6=Vd,Xv={paths:{path5:{type:"path",points:[{x:-0.44,y:0},{x:-0.16,y:0}],color:"primary",fill:!1},path6:{type:"path",points:[{x:0.17,y:0},{x:0.44,y:0.01}],color:"primary",fill:!1},path9:{type:"path",points:[{x:-0.25,y:-0.16},{x:0.02,y:0.3},{x:0.25,y:0.17},{x:-0.02,y:-0.29},{x:-0.25,y:-0.16}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.37},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.37}},refblocks:{left1:{x:-0.44,y:0},right1:{x:0.44,y:0.01}},bounds:{minX:-0.57,maxX:0.57,minY:-0.25,maxY:0.25,width:1.13,height:0.5,centerX:0,centerY:0},circles:{}},{paths:a6,texts:Fnt,bounds:Ia,refblocks:x9,circles:c6}=Xv,Dv=Y({primitives:[...Object.values(a6),...Object.values(c6),{type:"text",text:"{REF}",x:0.18,y:-0.3204553499999995},{type:"text",text:"{VAL}",x:-0.25,y:-0.3294553499999995}],ports:[{...x9.left1,labels:["1"]},{...x9.right1,labels:["2"]}],size:{width:Ia.width,height:Ia.height},center:{x:Ia.centerX,y:Ia.centerY}}).rotateRightFacingSymbol("up").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Gd=Si(Dv),Hd=Gd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Qd=Gd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Hd.anchor="middle_left";Qd.anchor="middle_left";Hd.y+=0.4;Hd.x=0.32;Qd.y-=0.45;Qd.x=0.32;var l6=Gd,Vv=Y(Xv).labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),p6=wi(Vv),Ci={paths:{path11:{type:"path",points:[{x:-0.56,y:0.04},{x:-0.22,y:0.04}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.14,y:0.05},{x:0.48,y:0.05}],color:"primary",fill:!1},"path12-6":{type:"path",points:[{x:0.14,y:-0.15},{x:0.14,y:0.25}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-0.22,y:0.25},{x:-0.21,y:-0.15},{x:0.14,y:0.05},{x:-0.22,y:0.25}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.09,y:0.38},bottom1:{type:"text",text:"{VAL}",x:-0.07,y:-0.38},right1:{type:"text",text:"",x:0.59,y:-0.33}},refblocks:{left1:{x:-0.56,y:0.04},right1:{x:0.48,y:0.05}},bounds:{minX:-0.59,maxX:0.59,minY:-0.38,maxY:0.38,width:1.18,height:0.76,centerX:0,centerY:0},circles:{}},{paths:h6,texts:Mnt,bounds:Fa,refblocks:b9,circles:d6}=Ci,m6=Y({primitives:[...Object.values(h6),...Object.values(d6),{type:"text",text:"{REF}",x:-0.15,y:0.3294553499999995},{type:"text",text:"{VAL}",x:0.15,y:0.3294553499999995}],ports:[{...b9.left1,labels:["1"]},{...b9.right1,labels:["2"]}],size:{width:Fa.width,height:Fa.height},center:{x:Fa.centerX,y:Fa.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:u6,texts:Cnt,bounds:Ma,refblocks:v9,circles:f6}=Ci,y6=Y({primitives:[...Object.values(u6),...Object.values(f6),{type:"text",text:"{REF}",x:-0,y:0.4094553499999995},{type:"text",text:"{VAL}",x:0,y:-0.4094553499999995}],ports:[{...v9.left1,labels:["1"]},{...v9.right1,labels:["2"]}],size:{width:Ma.width,height:Ma.height},center:{x:Ma.centerX,y:Ma.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:_6,texts:knt,bounds:Ca,refblocks:S9,circles:g6}=Ci,x6=Y({primitives:[...Object.values(_6),...Object.values(g6),{type:"text",text:"{REF}",x:-0,y:-0.3094553499999995},{type:"text",text:"{VAL}",x:0,y:0.4094553499999995}],ports:[{...S9.left1,labels:["1"]},{...S9.right1,labels:["2"]}],size:{width:Ca.width,height:Ca.height},center:{x:Ca.centerX,y:Ca.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:b6,texts:Nnt,bounds:ka,refblocks:w9,circles:v6}=Ci,S6=Y({primitives:[...Object.values(b6),...Object.values(v6),{type:"text",text:"{REF}",x:-0,y:0.4094553499999995},{type:"text",text:"{VAL}",x:0,y:-0.4094553499999995}],ports:[{...w9.left1,labels:["1"]},{...w9.right1,labels:["2"]}],size:{width:ka.width,height:ka.height},center:{x:ka.centerX,y:ka.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:w6,texts:Ynt,bounds:Na,refblocks:A9,circles:A6}=Ci,P6=Y({primitives:[...Object.values(w6),...Object.values(A6),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...A9.left1,labels:["1"]},{...A9.right1,labels:["2"]}],size:{width:Na.width,height:Na.height},center:{x:Na.centerX,y:Na.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:B6,texts:Lnt,bounds:Ya,refblocks:P9,circles:I6}=Ci,F6=Y({primitives:[...Object.values(B6),...Object.values(I6),{type:"text",text:"{REF}",x:0.15,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2894553499999995}],ports:[{...P9.left1,labels:["1"]},{...P9.right1,labels:["2"]}],size:{width:Ya.width,height:Ya.height},center:{x:Ya.centerX,y:Ya.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),M6={paths:{path11:{type:"path",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0},{x:0.54,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.18,y:-0.36},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.43},left1:{type:"text",text:"Hz",x:0,y:-0.04}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:-0.01,y:-0.01,radius:0.29,color:"primary",fill:!1}}},{paths:C6,texts:k6,bounds:La,refblocks:B9,circles:N6}=M6,Zd=Yt({primitives:[...Object.values(C6),...Object.values(N6),{type:"text",text:"{REF}",x:0,y:-0.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:0.35,anchor:"middle_bottom"},{...k6.left1,x:0,y:0.01,anchor:"center",fontSize:0.2}],ports:[{...B9.left1,labels:["1"]},{...B9.right1,labels:["2"]}],size:{width:La.width,height:La.height},center:{x:La.centerX,y:La.centerY}}),{5:Y6,...L6}=Zd.primitives;function T6(t){return typeof t=="object"}var I9=Z({...Zd,primitives:Object.values(L6).filter(T6)}),E6={...I9,primitives:[...I9.primitives,Y6]},R6={paths:{path10:{type:"path",points:[{x:-0.53,y:0.04},{x:0.53,y:0.04}],color:"primary",fill:!1},path14:{type:"path",points:[{x:0,y:0.17},{x:0.27,y:0.17},{x:0.27,y:-0.1},{x:-0.26,y:-0.1},{x:-0.26,y:0.17},{x:0,y:0.17}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.24},bottom1:{type:"text",text:"{VAL}",x:-0.17,y:-0.24}},refblocks:{left1:{x:-0.53,y:0.04},right1:{x:0.53,y:0.04}},bounds:{minX:-0.56,maxX:0.56,minY:-0.24,maxY:0.24,width:1.13,height:0.47,centerX:0,centerY:0},circles:{}},{paths:O6,texts:W6,bounds:Ta,refblocks:F9}=R6,zv=Yt({primitives:[...Object.values(O6),{...W6.top1,anchor:"middle_bottom"},{type:"text",text:"{VAL}",x:0,y:-0.2,anchor:"middle_top"}],ports:[{...F9.left1,labels:["1"]},{...F9.right1,labels:["2"]}],size:{width:Ta.width,height:Ta.height},center:{x:Ta.centerX,y:Ta.centerY}}),$6=Z(zv),ki={paths:{path1:{type:"path",points:[{x:-0.29,y:0.01},{x:0.04,y:0}],color:"primary",fill:!0},path2:{type:"path",points:[{x:0.04,y:-0.22},{x:0.04,y:0.22}],color:"primary",fill:!0},path3:{type:"path",points:[{x:0.12,y:-0.17},{x:0.12,y:0.17}],color:"primary",fill:!0},path4:{type:"path",points:[{x:0.19,y:-0.06},{x:0.19,y:0.06}],color:"primary",fill:!0}},texts:{right1:{type:"text",text:"{REF}",x:0.31,y:-0.02}},refblocks:{left1:{x:-0.29,y:0.01}},bounds:{minX:-0.31,maxX:0.31,minY:-0.22,maxY:0.22,width:0.62,height:0.45,centerX:0,centerY:0},circles:{}},j6=Y(ki).rotateRightFacingSymbol("down").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_top").build(),X6=Y(ki).rotateRightFacingSymbol("right").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_left").build(),D6=Y(ki).rotateRightFacingSymbol("left").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_right").build(),V6=Y(ki).rotateRightFacingSymbol("right").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_left").build(),z6=Y(ki).rotateRightFacingSymbol("up").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),U6=Y(ki).rotateRightFacingSymbol("up").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),qd={paths:{path11:{type:"path",points:[{x:-0.52,y:0.03},{x:-0.18,y:0.04}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.19,y:0.04},{x:0.52,y:0.04}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-0.31,y:0.2},{x:-0.31,y:-0.11},{x:-0.01,y:0.04},{x:-0.3,y:0.2}],color:"primary",fill:!0},"path11-0-9-5":{type:"path",points:[{x:0.33,y:0.2},{x:0.33,y:-0.1},{x:0.04,y:0.04},{x:0.33,y:0.2}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:0.04,y:0.32},bottom1:{type:"text",text:"{VAL}",x:0.04,y:-0.32}},refblocks:{left1:{x:-0.52,y:0.03},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.32,maxY:0.32,width:1.09,height:0.63,centerX:0,centerY:0},circles:{}},{paths:Tnt,texts:Ent,bounds:Rnt,refblocks:Ont,circles:Wnt}=qd,G6=Y(qd).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),H6=Y(qd).rotateRightFacingSymbol("down").changeTextAnchor("{VAL}","middle_right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),Q6={paths:{path45:{type:"path",points:[{x:0.14,y:0},{x:-0.13,y:-0.14}],color:"primary",fill:!1},"path1-8":{type:"path",points:[{x:0.13,y:0},{x:0.3,y:0}],color:"primary",fill:!1},path46:{type:"path",points:[{x:-0.13,y:0.13},{x:0.14,y:0}],color:"primary",fill:!1},path47:{type:"path",points:[{x:-0.13,y:-0.14},{x:-0.13,y:0.13}],color:"primary",fill:!1},path48:{type:"path",points:[{x:0.14,y:0.13},{x:0.14,y:-0.14}],color:"primary",fill:!1},path49:{type:"path",points:[{x:-0.13,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path25:{type:"path",points:[{x:0.16,y:0.29},{x:0.25,y:0.3},{x:0.22,y:0.21}],color:"primary",fill:!0},path78:{type:"path",points:[{x:0.08,y:0.17},{x:0.09,y:0.17},{x:0.21,y:0.27},{x:0.21,y:0.27}],color:"primary",fill:!1},"path25-0":{type:"path",points:[{x:-0.02,y:0.31},{x:0.08,y:0.32},{x:0.04,y:0.23}],color:"primary",fill:!0},"path78-6":{type:"path",points:[{x:-0.1,y:0.19},{x:-0.09,y:0.2},{x:0.04,y:0.29},{x:0.04,y:0.29}],color:"primary",fill:!1},box:{type:"path",points:[{x:-0.3,y:-0.4},{x:0.3,y:-0.4},{x:0.3,y:0.4},{x:-0.3,y:0.4},{x:-0.3,y:-0.4},{x:-0.3,y:0.4}],color:"primary",fill:!1},"path48-1":{type:"path",points:[{x:-0.3,y:0.13},{x:-0.54,y:0.13}],color:"primary",fill:!1},"path48-2":{type:"path",points:[{x:-0.3,y:-0.13},{x:-0.54,y:-0.13}],color:"primary",fill:!1},"path48-3":{type:"path",points:[{x:0.3,y:-0.13},{x:0.54,y:-0.13}],color:"primary",fill:!1},"path48-4":{type:"path",points:[{x:0.3,y:0.13},{x:0.54,y:0.13}],color:"primary",fill:!1}},texts:{bottom1:{type:"text",text:"{VAL}",x:0,y:-0.43},right1:{type:"text",text:"{REF}",x:0,y:0.43}},refblocks:{left1:{x:-0.54,y:0.13},left2:{x:-0.54,y:-0.13},right1:{x:0.54,y:-0.13},right2:{x:0.54,y:0.13}},bounds:{minX:-0.56,maxX:0.56,minY:-0.32,maxY:0.32,width:1.13,height:0.65,centerX:0,centerY:0},circles:{}},Jc=Y(Q6).labelPort("left1",["1","DIN"]).labelPort("left2",["2","POWER"]).labelPort("right1",["3","GND"]).labelPort("right2",["4","DOUT"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),Z6=Z(Jc,"down"),q6=wi(Jc),Jd=Z(Jc,"up"),Kd=Jd.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),tm=Jd.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Kd.anchor="middle_left";tm.anchor="middle_left";Kd.y+=0.21;Kd.x=0.44;tm.y-=0.21;tm.x=0.44;var J6=Jd,K6={paths:{path11:{type:"path",points:[{x:-0.4,y:0},{x:-0.01,y:0}],color:"primary",fill:!1},path40:{type:"path",points:[{x:0.07,y:0.19},{x:0.07,y:-0.18}],color:"primary",fill:!1},path42:{type:"path",points:[{x:0.01,y:-0.12},{x:0.01,y:0.14}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.28,y:-0.25},{x:0.28,y:-0.56}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:0.28,y:0.56},{x:0.28,y:0.27}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.17,y:-0.22},{x:0.28,y:-0.23},{x:0.23,y:-0.14}],color:"primary",fill:!0},path17:{type:"path",points:[{x:0.08,y:-0.09},{x:0.23,y:-0.2}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.07,y:0.11},{x:0.28,y:0.26}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.36},bottom1:{type:"text",text:"{VAL}",x:0.02,y:-0.42}},refblocks:{top1:{x:0.28,y:0.56},bottom1:{x:0.28,y:-0.56},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.17,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.14,y:0.01,radius:0.29,color:"primary",fill:!1}}},Uv=Y(K6).changeTextAnchor("{VAL}","middle_right").labelPort("left1",["3"]).labelPort("top1",["2"]).labelPort("bottom1",["1"]).changeTextAnchor("{REF}","middle_right").build(),em=Z(Uv),rm=em.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Gv=em.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");rm.anchor="middle_left";Gv.anchor="middle_right";rm.x=0.45;rm.y+=0.065;Gv.y+=0.065;var t7=em,e7={paths:{"path12-1-8-6-9":{type:"path",points:[{x:0.02,y:-0.02},{x:0.02,y:-0.1}],color:"primary",fill:!1},"path12-1-5-6":{type:"path",points:[{x:-0.47,y:-0.19},{x:-0.17,y:-0.19}],color:"primary",fill:!1},"path12-1-5-6-8":{type:"path",points:[{x:0.02,y:0.17},{x:0.02,y:0.11}],color:"primary",fill:!1},"path12-1-8-0":{type:"path",points:[{x:-0.15,y:-0.03},{x:0.2,y:-0.19}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:0.2,y:-0.19},{x:0.47,y:-0.19}],color:"primary",fill:!1},"path12-1-8-6-9-4":{type:"path",points:[{x:0.02,y:0.12},{x:0.02,y:0.02}],color:"primary",fill:!1},"path12-1-8-6-9-4-3":{type:"path",points:[{x:0.08,y:0.11},{x:0.08,y:0.05}],color:"primary",fill:!1},"path12-1-8-6-9-4-3-1":{type:"path",points:[{x:-0.04,y:0.11},{x:-0.04,y:0.05}],color:"primary",fill:!1},"path12-1-8-6-9-4-4":{type:"path",points:[{x:0.08,y:0.11},{x:-0.04,y:0.11}],color:"primary",fill:!1},"path14-5":{type:"path",points:[{x:-0.01,y:0.28},{x:0.01,y:0.25},{x:0.04,y:0.23},{x:0.06,y:0.2}],color:"primary",fill:!0},"path14-5-3":{type:"path",points:[{x:-0.01,y:0.2},{x:0.01,y:0.23},{x:0.04,y:0.25},{x:0.06,y:0.28}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:0.01,y:0.38},bottom1:{type:"text",text:"{VAL}",x:0.06,y:-0.38}},refblocks:{left1:{x:-0.47,y:-0.19},right1:{x:0.47,y:-0.19}},bounds:{minX:-0.5,maxX:0.5,minY:-0.38,maxY:0.38,width:1,height:0.76,centerX:0,centerY:0},circles:{path9:{type:"circle",x:0.02,y:0.24,radius:0.06,color:"primary",fill:!1}}},Hv=Y(e7).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),Qv=Z(Hv),Zv=Qv.primitives.filter((t)=>t.type==="text"),nm=Zv.find((t)=>t.text==="{VAL}");nm.x=-0.35;nm.y=0;nm.anchor="middle_right";var im=Zv.find((t)=>t.text==="{REF}");im.y=0;im.x=0.35;im.anchor="middle_left";var r7=Qv,Kc={paths:{path8698:{type:"path",points:[{x:-0.19796749999999919,y:-0.023826854587889912},{x:-0.2004570399999992,y:-0.018993393814014044},{x:-0.2029465799999992,y:-0.014174384106555204},{x:-0.20543611999999922,y:-0.009384187436300498},{x:-0.20792565999999923,y:-0.004636988132081332},{x:-0.21041519999999925,y:0.00005329457033053167},{x:-0.21290473999999926,y:0.004673092344940184},{x:-0.21539427999999927,y:0.009209271428771242},{x:-0.21788381999999928,y:0.013649213595881985},{x:-0.2203733599999993,y:0.01798089395292432},{x:-0.2228628999999993,y:0.022192955076609913},{x:-0.22535243999999932,y:0.02627477703600152},{x:-0.22784197999999933,y:0.030216542867918667},{x:-0.23033151999999935,y:0.03400929910178016},{x:-0.23282105999999936,y:0.03764501096072756},{x:-0.23531059999999937,y:0.04111661189869628},{x:-0.23780013999999938,y:0.04441804716802203},{x:-0.2402896799999994,y:0.04754431114897349},{x:-0.2427792199999994,y:0.05049147821106258},{x:-0.24526875999999942,y:0.053256726915861724},{x:-0.24775829999999943,y:0.05583835741211009},{x:-0.25024783999999944,y:0.05823580191586174},{x:-0.25273737999999946,y:0.060449628211062575},{x:-0.25522691999999947,y:0.0624815361489735},{x:-0.2577164599999995,y:0.06433434716802203},{x:-0.2602059999999995,y:0.06601198689869628},{x:-0.2626955399999995,y:0.06751946096072757},{x:-0.2651850799999995,y:0.06886282410178016},{x:-0.26767461999999953,y:0.07004914286791866},{x:-0.27016415999999954,y:0.0710864520360015},{x:-0.27265369999999955,y:0.07198370507660991},{x:-0.27514323999999957,y:0.07275071895292433},{x:-0.2776327799999996,y:0.07339811359588198},{x:-0.2801223199999996,y:0.07393724642877124},{x:-0.2826118599999996,y:0.07438014234494018},{x:-0.2851013999999996,y:0.07473941957033053},{x:-0.28759093999999963,y:0.07502821186791866},{x:-0.29008047999999964,y:0.07526008756369952},{x:-0.29257001999999965,y:0.07544896589344477},{x:-0.29505955999999967,y:0.07560903118598594},{x:-0.2975490999999997,y:0.07575464541211008},{x:-0.30003863749999965,y:0.07560903118598594},{x:-0.3025281749999997,y:0.07544896589344477},{x:-0.30501771249999965,y:0.07526008756369951},{x:-0.3075072499999996,y:0.07502821186791866},{x:-0.30999678749999965,y:0.07473941957033052},{x:-0.3124863249999996,y:0.07438014234494018},{x:-0.3149758624999996,y:0.07393724642877124},{x:-0.31746539999999956,y:0.07339811359588198},{x:-0.3199549374999996,y:0.07275071895292431},{x:-0.32244447499999956,y:0.07198370507660991},{x:-0.32493401249999954,y:0.0710864520360015},{x:-0.32742354999999956,y:0.07004914286791866},{x:-0.32991308749999954,y:0.06886282410178016},{x:-0.3324026249999995,y:0.06751946096072756},{x:-0.33489216249999954,y:0.06601198689869628},{x:-0.3373816999999995,y:0.06433434716802203},{x:-0.3398712374999995,y:0.06248153614897349},{x:-0.3423607749999995,y:0.06044962821106258},{x:-0.3448503124999994,y:0.05823580191586174},{x:-0.34733984999999945,y:0.05583835741211009},{x:-0.3498293874999995,y:0.053256726915861724},{x:-0.35231892499999945,y:0.050491478211062576},{x:-0.3548084624999994,y:0.0475443111489735},{x:-0.3572979999999994,y:0.04441804716802203},{x:-0.35978753749999937,y:0.04111661189869628},{x:-0.3622770749999994,y:0.03764501096072756},{x:-0.36476661249999937,y:0.03400929910178016},{x:-0.36725614999999934,y:0.030216542867918673},{x:-0.36974568749999936,y:0.02627477703600152},{x:-0.37223522499999934,y:0.022192955076609917},{x:-0.3747247624999993,y:0.017980893952924324},{x:-0.37721429999999934,y:0.013649213595881985},{x:-0.3797038374999993,y:0.00920927142877125},{x:-0.3821933749999993,y:0.004673092344940191},{x:-0.3846829124999993,y:0.00005329457033053514},{x:-0.3871724499999993,y:-0.004636988132081328},{x:-0.38966198749999925,y:-0.009384187436300498},{x:-0.3921515249999992,y:-0.014174384106555197},{x:-0.39464106249999925,y:-0.01899339381401404},{x:-0.3971305999999992,y:-0.023826854587889912}],color:"primary",fill:!1},path8700:{type:"path",points:[{x:0.0011955000000007932,y:-0.02382615458789039},{x:-0.00129403749999919,y:-0.01899269131401453},{x:-0.0037835749999991734,y:-0.014173679106555696},{x:-0.006273112499999156,y:-0.009383479936300985},{x:-0.00876264999999914,y:-0.004636278132081827},{x:-0.011252187499999122,y:0.00005400707033003174},{x:-0.013741724999999105,y:0.004673807344939681},{x:-0.016231262499999087,y:0.009209988928770731},{x:-0.018720799999999073,y:0.013649933595881476},{x:-0.021210337499999055,y:0.017981616452923805},{x:-0.023699874999999038,y:0.022193680076609393},{x:-0.026189412499999024,y:0.026275504536001},{x:-0.028678949999999002,y:0.030217272867918137},{x:-0.03116848749999899,y:0.034010031601779636},{x:-0.03365802499999897,y:0.03764574596072702},{x:-0.03614756249999895,y:0.04111734939869574},{x:-0.03863709999999894,y:0.04441878716802149},{x:-0.04112663749999892,y:0.04754505364897295},{x:-0.043616174999998904,y:0.05049222321106203},{x:-0.04610571249999888,y:0.05325747441586117},{x:-0.04859524999999887,y:0.055839107412109526},{x:-0.051084787499998854,y:0.05823655441586117},{x:-0.05357432499999884,y:0.06045038321106201},{x:-0.05606386249999881,y:0.06248229364897292},{x:-0.0585533999999988,y:0.06433510716802145},{x:-0.061042937499998784,y:0.0660127493986957},{x:-0.06353247499999877,y:0.06752022596072697},{x:-0.06602201249999876,y:0.06886359160177957},{x:-0.06851154999999873,y:0.07004991286791806},{x:-0.07100108749999871,y:0.07108722453600091},{x:-0.0734906249999987,y:0.0719844800766093},{x:-0.07598016249999869,y:0.07275149645292371},{x:-0.07846969999999867,y:0.07339889359588138},{x:-0.08095923749999864,y:0.07393802892877062},{x:-0.08344877499999863,y:0.07438092734493956},{x:-0.08593831249999861,y:0.07474020707032991},{x:-0.0884278499999986,y:0.07502900186791804},{x:-0.09091738749999859,y:0.07526088006369888},{x:-0.09340692499999856,y:0.07544976089344414},{x:-0.09589646249999854,y:0.0756098286859853},{x:-0.09838599999999853,y:0.07575544541210943},{x:-0.10087553999999854,y:0.0756098286859853},{x:-0.10336507999999855,y:0.07544976089344414},{x:-0.10585461999999857,y:0.07526088006369887},{x:-0.10834415999999858,y:0.07502900186791804},{x:-0.11083369999999859,y:0.0747402070703299},{x:-0.1133232399999986,y:0.07438092734493956},{x:-0.11581277999999862,y:0.07393802892877062},{x:-0.11830231999999863,y:0.07339889359588138},{x:-0.12079185999999864,y:0.07275149645292371},{x:-0.12328139999999865,y:0.0719844800766093},{x:-0.12577093999999867,y:0.07108722453600091},{x:-0.12826047999999868,y:0.07004991286791806},{x:-0.1307500199999987,y:0.06886359160177957},{x:-0.1332395599999987,y:0.06752022596072697},{x:-0.13572909999999871,y:0.0660127493986957},{x:-0.13821863999999873,y:0.06433510716802145},{x:-0.14070817999999874,y:0.06248229364897291},{x:-0.14319771999999875,y:0.06045038321106202},{x:-0.14568725999999876,y:0.05823655441586117},{x:-0.14817679999999878,y:0.055839107412109526},{x:-0.1506663399999988,y:0.05325747441586117},{x:-0.1531558799999988,y:0.05049222321106202},{x:-0.1556454199999988,y:0.047545053648972956},{x:-0.15813495999999883,y:0.04441878716802149},{x:-0.16062449999999884,y:0.04111734939869574},{x:-0.16311403999999885,y:0.03764574596072702},{x:-0.16560357999999886,y:0.034010031601779636},{x:-0.16809311999999887,y:0.03021727286791814},{x:-0.1705826599999989,y:0.026275504536001},{x:-0.1730721999999989,y:0.022193680076609396},{x:-0.1755617399999989,y:0.017981616452923805},{x:-0.17805127999999892,y:0.013649933595881474},{x:-0.18054081999999894,y:0.00920998892877074},{x:-0.18303035999999895,y:0.0046738073449396865},{x:-0.18551989999999896,y:0.00005400707033003521},{x:-0.18800943999999897,y:-0.004636278132081827},{x:-0.19049897999999899,y:-0.009383479936300985},{x:-0.192988519999999,y:-0.01417367910655569},{x:-0.19547805999999898,y:-0.018992691314014522},{x:-0.19796759999999902,y:-0.02382615458789039}],color:"primary",fill:!1},path8702:{type:"path",points:[{x:0.2003586000000006,y:-0.02382615458789039},{x:0.19786906000000057,y:-0.01899269131401453},{x:0.19537952000000058,y:-0.014173679106555696},{x:0.19288998000000057,y:-0.009383479936300985},{x:0.1904004400000006,y:-0.004636278132081827},{x:0.18791090000000055,y:0.00005400707033003174},{x:0.1854213600000005,y:0.004673807344939681},{x:0.18293182000000052,y:0.009209988928770731},{x:0.1804422800000005,y:0.013649933595881476},{x:0.17795274000000053,y:0.017981616452923805},{x:0.17546320000000049,y:0.022193680076609393},{x:0.17297366000000047,y:0.026275504536001},{x:0.17048412000000046,y:0.030217272867918137},{x:0.16799458000000045,y:0.034010031601779636},{x:0.16550504000000044,y:0.03764574596072702},{x:0.16301550000000042,y:0.04111734939869574},{x:0.1605259600000004,y:0.04441878716802149},{x:0.1580364200000004,y:0.04754505364897295},{x:0.1555468800000004,y:0.05049222321106203},{x:0.15305734000000037,y:0.05325747441586117},{x:0.15056780000000036,y:0.055839107412109526},{x:0.14807826000000035,y:0.05823655441586117},{x:0.14558872000000034,y:0.06045038321106201},{x:0.14309918000000033,y:0.06248229364897292},{x:0.1406096400000003,y:0.06433510716802145},{x:0.1381201000000003,y:0.0660127493986957},{x:0.1356305600000003,y:0.06752022596072697},{x:0.13314102000000028,y:0.06886359160177957},{x:0.13065148000000026,y:0.07004991286791806},{x:0.12816194000000025,y:0.07108722453600091},{x:0.12567240000000024,y:0.0719844800766093},{x:0.12318286000000023,y:0.07275149645292371},{x:0.12069332000000021,y:0.07339889359588138},{x:0.1182037800000002,y:0.07393802892877062},{x:0.11571424000000019,y:0.07438092734493956},{x:0.11322470000000018,y:0.07474020707032991},{x:0.11073516000000017,y:0.07502900186791804},{x:0.10824562000000015,y:0.07526088006369888},{x:0.10575608000000014,y:0.07544976089344414},{x:0.10326654000000013,y:0.0756098286859853},{x:0.10077700000000012,y:0.07575544541210943},{x:0.09828746250000013,y:0.0756098286859853},{x:0.09579792500000014,y:0.07544976089344414},{x:0.09330838750000017,y:0.07526088006369887},{x:0.09081885000000019,y:0.07502900186791804},{x:0.0883293125000002,y:0.0747402070703299},{x:0.08583977500000022,y:0.07438092734493956},{x:0.08335023750000023,y:0.07393802892877062},{x:0.08086070000000026,y:0.07339889359588138},{x:0.07837116250000027,y:0.07275149645292371},{x:0.07588162500000029,y:0.0719844800766093},{x:0.0733920875000003,y:0.07108722453600091},{x:0.07090255000000031,y:0.07004991286791806},{x:0.06841301250000034,y:0.06886359160177957},{x:0.06592347500000036,y:0.06752022596072697},{x:0.06343393750000037,y:0.0660127493986957},{x:0.060944400000000384,y:0.06433510716802145},{x:0.0584548625000004,y:0.06248229364897291},{x:0.05596532500000043,y:0.06045038321106202},{x:0.05347578750000044,y:0.05823655441586117},{x:0.050986250000000455,y:0.055839107412109526},{x:0.04849671250000047,y:0.05325747441586117},{x:0.04600717500000048,y:0.05049222321106202},{x:0.04351763750000051,y:0.047545053648972956},{x:0.041028100000000525,y:0.04441878716802149},{x:0.03853856250000054,y:0.04111734939869574},{x:0.036049025000000554,y:0.03764574596072702},{x:0.03355948750000057,y:0.034010031601779636},{x:0.031069950000000596,y:0.03021727286791814},{x:0.02858041250000061,y:0.026275504536001},{x:0.026090875000000624,y:0.022193680076609396},{x:0.023601337500000638,y:0.017981616452923805},{x:0.021111800000000652,y:0.013649933595881474},{x:0.01862226250000068,y:0.00920998892877074},{x:0.016132725000000694,y:0.0046738073449396865},{x:0.013643187500000709,y:0.00005400707033003521},{x:0.011153650000000723,y:-0.004636278132081827},{x:0.008664112500000737,y:-0.009383479936300985},{x:0.006174575000000764,y:-0.01417367910655569},{x:0.0036850375000007786,y:-0.018992691314014522},{x:0.0011955000000007932,y:-0.02382615458789039}],color:"primary",fill:!1},path8704:{type:"path",points:[{x:0.3995216000000006,y:-0.02382615458789039},{x:0.39703206250000056,y:-0.01899269131401453},{x:0.3945425250000006,y:-0.014173679106555696},{x:0.3920529875000006,y:-0.009383479936300985},{x:0.38956345000000064,y:-0.004636278132081827},{x:0.38707391250000067,y:0.00005400707033003174},{x:0.3845843750000007,y:0.004673807344939681},{x:0.38209483750000073,y:0.009209988928770731},{x:0.37960530000000076,y:0.013649933595881476},{x:0.3771157625000008,y:0.017981616452923805},{x:0.37462622500000076,y:0.022193680076609393},{x:0.37213668750000073,y:0.026275504536001},{x:0.36964715000000076,y:0.030217272867918137},{x:0.3671576125000008,y:0.034010031601779636},{x:0.3646680750000008,y:0.03764574596072702},{x:0.36217853750000084,y:0.04111734939869574},{x:0.3596890000000008,y:0.04441878716802149},{x:0.3571994625000009,y:0.04754505364897295},{x:0.35470992500000087,y:0.05049222321106203},{x:0.35222038750000095,y:0.05325747441586117},{x:0.3497308500000009,y:0.055839107412109526},{x:0.3472413125000009,y:0.05823655441586117},{x:0.344751775000001,y:0.06045038321106201},{x:0.34226223750000095,y:0.06248229364897292},{x:0.33977270000000104,y:0.06433510716802145},{x:0.337283162500001,y:0.0660127493986957},{x:0.334793625000001,y:0.06752022596072697},{x:0.33230408750000107,y:0.06886359160177957},{x:0.3298145500000011,y:0.07004991286791806},{x:0.32732501250000107,y:0.07108722453600091},{x:0.3248354750000011,y:0.0719844800766093},{x:0.3223459375000011,y:0.07275149645292371},{x:0.3198564000000011,y:0.07339889359588138},{x:0.3173668625000012,y:0.07393802892877062},{x:0.31487732500000115,y:0.07438092734493956},{x:0.3123877875000012,y:0.07474020707032991},{x:0.3098982500000012,y:0.07502900186791804},{x:0.30740871250000124,y:0.07526088006369888},{x:0.30491917500000126,y:0.07544976089344414},{x:0.30242963750000124,y:0.0756098286859853},{x:0.29994010000000126,y:0.07575544541210943},{x:0.29745056000000125,y:0.0756098286859853},{x:0.29496102000000124,y:0.07544976089344414},{x:0.2924714800000012,y:0.07526088006369887},{x:0.2899819400000012,y:0.07502900186791804},{x:0.2874924000000012,y:0.0747402070703299},{x:0.2850028600000012,y:0.07438092734493956},{x:0.2825133200000012,y:0.07393802892877062},{x:0.28002378000000117,y:0.07339889359588138},{x:0.27753424000000115,y:0.07275149645292371},{x:0.27504470000000114,y:0.0719844800766093},{x:0.27255516000000113,y:0.07108722453600091},{x:0.2700656200000011,y:0.07004991286791806},{x:0.2675760800000011,y:0.06886359160177957},{x:0.2650865400000011,y:0.06752022596072697},{x:0.2625970000000011,y:0.0660127493986957},{x:0.26010746000000107,y:0.06433510716802145},{x:0.25761792000000105,y:0.06248229364897291},{x:0.25512838000000104,y:0.06045038321106202},{x:0.25263884000000103,y:0.05823655441586117},{x:0.250149300000001,y:0.055839107412109526},{x:0.247659760000001,y:0.05325747441586117},{x:0.245170220000001,y:0.05049222321106202},{x:0.24268068000000098,y:0.047545053648972956},{x:0.24019114000000097,y:0.04441878716802149},{x:0.23770160000000096,y:0.04111734939869574},{x:0.23521206000000094,y:0.03764574596072702},{x:0.23272252000000093,y:0.034010031601779636},{x:0.23023298000000092,y:0.03021727286791814},{x:0.2277434400000009,y:0.026275504536001},{x:0.2252539000000009,y:0.022193680076609396},{x:0.22276436000000088,y:0.017981616452923805},{x:0.22027482000000087,y:0.013649933595881474},{x:0.21778528000000086,y:0.00920998892877074},{x:0.21529574000000085,y:0.0046738073449396865},{x:0.21280620000000083,y:0.00005400707033003521},{x:0.21031666000000082,y:-0.004636278132081827},{x:0.2078271200000008,y:-0.009383479936300985},{x:0.2053375800000008,y:-0.01417367910655569},{x:0.20284804000000078,y:-0.018992691314014522},{x:0.20035850000000077,y:-0.02382615458789039}],color:"primary",fill:!1},path8706:{type:"path",points:[{x:-0.40026109999999937,y:-0.022544054587890106},{x:-0.5272914999999991,y:-0.022544054587890106}],color:"primary",fill:!1},"path8706-5":{type:"path",points:[{x:0.5282280000000006,y:-0.027111054587890093},{x:0.4011975999999997,y:-0.027111054587890093}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.0020145999999989783,y:0.22997364541210996},bottom1:{type:"text",text:"{VAL}",x:-0.002185205294839676,y:-0.22997364541210996}},refblocks:{left1:{x:-0.5279125,y:-0.021272154587890446},right1:{x:0.5279125,y:-0.026521254587889898}},bounds:{minX:-0.556070941,maxX:0.556070941,minY:-0.22997364541210996,maxY:0.22997364541210996,width:1.112141882,height:0.4599472908242199,centerX:0,centerY:0},circles:{}},n7=Y(Kc).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_right",{x:-0.5,y:0}).changeTextAnchor("{VAL}","middle_left",{x:0.5,y:0}).build(),i7=Y(Kc).rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom",{x:0,y:0.5}).changeTextAnchor("{VAL}","middle_top",{x:0,y:-0.5}).build(),o7=Y(Kc).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),s7=Y(Kc).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_right").changeTextAnchor("{VAL}","middle_left").build(),qv={paths:{path11:{type:"path",points:[{x:-0.54,y:-0.06},{x:-0.15,y:-0.06}],color:"primary",fill:!1},path40:{type:"path",points:[{x:0.13,y:-0.05},{x:-0.13,y:-0.18}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.13,y:0.08},{x:0.13,y:-0.05}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.13,y:-0.18},{x:-0.13,y:0.08}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.13,y:0.08},{x:0.13,y:-0.18}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.14,y:-0.05},{x:0.54,y:-0.06}],color:"primary",fill:!1},"path25-0-9-8":{type:"path",points:[{x:-0.03,y:0.39},{x:-0.05,y:0.47},{x:-0.08,y:0.39}],color:"primary",fill:!0},"path78-6-5-5":{type:"path",points:[{x:-0.05,y:0.27},{x:-0.05,y:0.29},{x:-0.05,y:0.41},{x:-0.05,y:0.42}],color:"primary",fill:!1},"path25-0-9-8-2":{type:"path",points:[{x:0.07,y:0.39},{x:0.04,y:0.47},{x:0.02,y:0.39}],color:"primary",fill:!0},"path78-6-5-5-7":{type:"path",points:[{x:0.04,y:0.27},{x:0.04,y:0.29},{x:0.04,y:0.41},{x:0.04,y:0.42}],color:"primary",fill:!1},"path43-1":{type:"path",points:[{x:0.03,y:0.06},{x:0.03,y:-0.16}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0.38,y:0.38},bottom1:{type:"text",text:"{VAL}",x:0.38,y:-0.47}},refblocks:{left1:{x:-0.54,y:-0.06},right1:{x:0.54,y:-0.06}},bounds:{minX:-0.57,maxX:0.57,minY:-0.47,maxY:0.47,width:1.14,height:0.93,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:-0.05,radius:0.29,color:"primary",fill:!1}}};qv.bounds.width+=0.2;var tl=Y(qv).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1","anode","pos"]).labelPort("right1",["2","cathode","neg"]).changeTextAnchor("{REF}","middle_bottom").build(),om=Z(tl,"down"),sm=om.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),am=om.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");sm.anchor="middle_left";am.anchor="middle_left";sm.y+=0.9;sm.x=0.3;am.y-=0.1;am.x=0.3;var a7=om,cm=Z(tl,"left"),lm=cm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),pm=cm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");lm.anchor="middle_left";pm.anchor="middle_left";lm.y+=0.71;lm.x=0.44;pm.y-=0.71;pm.x=0.44;var c7=cm,hm=Z(tl,"up"),dm=hm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),mm=hm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");dm.anchor="middle_left";mm.anchor="middle_left";dm.y+=0.1;dm.x=0.3;mm.y-=0.71;mm.x=0.3;var l7=hm,p7={paths:{path45:{type:"path",points:[{x:0.14,y:0},{x:-0.13,y:-0.14}],color:"primary",fill:!1},"path1-8":{type:"path",points:[{x:0.13,y:0},{x:0.54,y:0}],color:"primary",fill:!1},path46:{type:"path",points:[{x:-0.13,y:0.13},{x:0.14,y:0}],color:"primary",fill:!1},path47:{type:"path",points:[{x:-0.13,y:-0.14},{x:-0.13,y:0.13}],color:"primary",fill:!1},path48:{type:"path",points:[{x:0.14,y:0.13},{x:0.14,y:-0.14}],color:"primary",fill:!1},path49:{type:"path",points:[{x:-0.13,y:0},{x:-0.54,y:0}],color:"primary",fill:!1},path25:{type:"path",points:[{x:0.16,y:0.29},{x:0.25,y:0.3},{x:0.22,y:0.21}],color:"primary",fill:!0},path78:{type:"path",points:[{x:0.08,y:0.17},{x:0.09,y:0.17},{x:0.21,y:0.27},{x:0.21,y:0.27}],color:"primary",fill:!1},"path25-0":{type:"path",points:[{x:-0.02,y:0.31},{x:0.08,y:0.32},{x:0.04,y:0.23}],color:"primary",fill:!0},"path78-6":{type:"path",points:[{x:-0.1,y:0.19},{x:-0.09,y:0.2},{x:0.04,y:0.29},{x:0.04,y:0.29}],color:"primary",fill:!1}},texts:{bottom1:{type:"text",text:"{VAL}",x:0,y:-0.21},right1:{type:"text",text:"{REF}",x:0,y:0.41}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.56,maxX:0.56,minY:-0.32,maxY:0.32,width:1.13,height:0.65,centerX:0,centerY:0},circles:{}},{paths:h7,texts:M9,bounds:Ea,refblocks:C9,circles:d7}=p7,um=Yt({primitives:[...Object.values(h7),...Object.values(d7),{...M9.bottom1,anchor:"middle_top"},{...M9.right1,anchor:"middle_bottom"}],ports:[{...C9.left1,labels:["1","anode","pos"]},{...C9.right1,labels:["2","cathode","neg"]}],size:{width:Ea.width,height:Ea.height},center:{x:Ea.centerX,y:Ea.centerY}}),fm=Z(um,"up"),ym=fm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),_m=fm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");ym.anchor="middle_left";_m.anchor="middle_left";ym.y+=0.21;ym.x=0.21;_m.y-=0.21;_m.x=0.21;var Jv=fm,gm=Si(Jv),xm=gm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),bm=gm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");xm.anchor="middle_left";bm.anchor="middle_left";xm.y+=0.4;xm.x=0.2;bm.y-=0.41;bm.x=0.2;var m7=gm,u7=wi(um),el={paths:{"anode-lead":{type:"path",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:"primary",fill:!1},"emission-0-shaft":{type:"path",points:[{x:-0.11999999999999988,y:0.15999999999999992},{x:-0.030000000000000027,y:0.29000000000000004}],color:"primary",fill:!1},"emission-0-head":{type:"path",points:[{x:-0.08499999999999996,y:0.2699999999999998},{x:-0.030000000000000027,y:0.29000000000000004},{x:-0.030000000000000027,y:0.22999999999999998}],color:"primary",fill:!1},"emission-1-shaft":{type:"path",points:[{x:0,y:0.15999999999999992},{x:0.09000000000000008,y:0.29000000000000004}],color:"primary",fill:!1},"emission-1-head":{type:"path",points:[{x:0.03500000000000014,y:0.2699999999999998},{x:0.09000000000000008,y:0.29000000000000004},{x:0.09000000000000008,y:0.22999999999999998}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.3999999999999999},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.40000000000000013}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.40000000000000013,maxY:0.3999999999999999,width:0.5,height:0.8,centerX:0,centerY:-0.00000000000000011102230246251565},circles:{}},f7=yt(el,{kind:"led",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),y7=yt(el,{kind:"led",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),_7=yt(el,{kind:"led",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),g7=yt(el,{kind:"led",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),rl={paths:{"anode-lead":{type:"path",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:"primary",fill:!1},"emission-0-shaft":{type:"path",points:[{x:-0.11999999999999988,y:0.15999999999999992},{x:-0.030000000000000027,y:0.29000000000000004}],color:"primary",fill:!1},"emission-0-head":{type:"path",points:[{x:-0.08499999999999996,y:0.2699999999999998},{x:-0.030000000000000027,y:0.29000000000000004},{x:-0.030000000000000027,y:0.22999999999999998}],color:"primary",fill:!1},"emission-1-shaft":{type:"path",points:[{x:0,y:0.15999999999999992},{x:0.09000000000000008,y:0.29000000000000004}],color:"primary",fill:!1},"emission-1-head":{type:"path",points:[{x:0.03500000000000014,y:0.2699999999999998},{x:0.09000000000000008,y:0.29000000000000004},{x:0.09000000000000008,y:0.22999999999999998}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.3999999999999999},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.40000000000000013}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.40000000000000013,maxY:0.3999999999999999,width:0.34999999999999987,height:0.8,centerX:0.00000000000000011102230246251565,centerY:-0.00000000000000011102230246251565},circles:{}},x7=yt(rl,{kind:"led",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),b7=yt(rl,{kind:"led",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),v7=yt(rl,{kind:"led",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),S7=yt(rl,{kind:"led",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),w7={paths:{path11:{type:"path",points:[{x:-0.52,y:-0.01},{x:-0.18,y:-0.01}],color:"primary",fill:!1},"path11-2":{type:"path",points:[{x:-0.17,y:-0.11},{x:-0.17,y:0.08}],color:"primary",fill:!1},"path11-5":{type:"path",points:[{x:-0.17,y:-0.12},{x:0.16,y:-0.12}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:-0.17,y:0.08},{x:0.16,y:0.08}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.17,y:-0.01},{x:0.52,y:-0.01}],color:"primary",fill:!1},"path11-2-1":{type:"path",points:[{x:0.16,y:-0.12},{x:0.16,y:0.08}],color:"primary",fill:!1},"path25-0-9":{type:"path",points:[{x:-0.4,y:-0.21},{x:-0.33,y:-0.18},{x:-0.34,y:-0.27}],color:"primary",fill:!0},"path78-6-5":{type:"path",points:[{x:-0.45,y:-0.34},{x:-0.44,y:-0.32},{x:-0.35,y:-0.22},{x:-0.35,y:-0.22}],color:"primary",fill:!1},"path25-0-9-0":{type:"path",points:[{x:-0.3,y:-0.34},{x:-0.22,y:-0.31},{x:-0.24,y:-0.4}],color:"primary",fill:!0},"path78-6-5-9":{type:"path",points:[{x:-0.35,y:-0.46},{x:-0.34,y:-0.45},{x:-0.25,y:-0.35},{x:-0.25,y:-0.35}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.17,y:-0.41},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.46}},refblocks:{left1:{x:-0.52,y:-0.01},right1:{x:0.52,y:-0.01}},bounds:{minX:-0.55,maxX:0.55,minY:-0.51,maxY:0.46,width:1.1,height:0.62,centerX:0,centerY:-0.02},circles:{path1:{type:"circle",x:0,y:-0.02,radius:0.28,color:"primary",fill:!1}}},{paths:A7,texts:k9,bounds:Ra,refblocks:N9,circles:P7}=w7,Kv=Yt({primitives:[...Object.values(A7),...Object.values(P7),{...k9.top1,anchor:"middle_left",x:0},{...k9.bottom1,anchor:"middle_left",x:0}],ports:[{...N9.left1,labels:["1"]},{...N9.right1,labels:["2"]}],size:{width:Ra.width,height:Ra.height},center:{x:Ra.centerX,y:Ra.centerY}}),tS=Z(Kv),eS=tS.primitives.filter((t)=>t.type==="text"),vm=eS.find((t)=>t.text==="{VAL}");vm.x=-0.35;vm.y=0;vm.anchor="middle_right";var Sm=eS.find((t)=>t.text==="{REF}");Sm.y=0;Sm.x=0.35;Sm.anchor="middle_left";var B7=tS,I7={paths:{path208:{type:"path",points:[{x:0.38,y:0.13},{x:0.52,y:-0.13}],color:"primary",fill:!1},path209:{type:"path",points:[{x:0.25,y:-0.13},{x:0.38,y:0.13}],color:"primary",fill:!1},path210:{type:"path",points:[{x:0.52,y:-0.13},{x:0.25,y:-0.13}],color:"primary",fill:!1},path211:{type:"path",points:[{x:0.25,y:0.13},{x:0.52,y:0.13}],color:"primary",fill:!1},path212:{type:"path",points:[{x:0.12,y:-0.4},{x:0.38,y:-0.4}],color:"primary",fill:!1},path213:{type:"path",points:[{x:0.38,y:0.4},{x:0.12,y:0.4}],color:"primary",fill:!1},path214:{type:"path",points:[{x:0.12,y:0.54},{x:0.12,y:0.18}],color:"primary",fill:!1},path215:{type:"path",points:[{x:0.12,y:-0.54},{x:0.12,y:0}],color:"primary",fill:!1},path216:{type:"path",points:[{x:0.38,y:-0.4},{x:0.38,y:0.4}],color:"primary",fill:!1},path217:{type:"path",points:[{x:-0.14,y:0.26},{x:-0.14,y:-0.27}],color:"primary",fill:!1},path218:{type:"path",points:[{x:-0.22,y:-0.27},{x:-0.22,y:0.26}],color:"primary",fill:!1},path219:{type:"path",points:[{x:-0.54,y:-0.27},{x:-0.22,y:-0.27}],color:"primary",fill:!1},path220:{type:"path",points:[{x:-0.14,y:-0.19},{x:0.12,y:-0.19}],color:"primary",fill:!1},path221:{type:"path",points:[{x:-0.14,y:0.18},{x:0.12,y:0.18}],color:"primary",fill:!1},path222:{type:"path",points:[{x:-0.07,y:0},{x:0.12,y:0}],color:"primary",fill:!1}},texts:{right1:{type:"text",text:"{VAL}",x:0.57,y:0.02},right2:{type:"text",text:"{REF}",x:0.57,y:0.21}},refblocks:{top1:{x:0.12,y:0.54},bottom1:{x:0.12,y:-0.54},left1:{x:-0.54,y:-0.27}},bounds:{minX:-0.57,maxX:0.57,minY:-0.57,maxY:0.57,width:1.14,height:1.14,centerX:0,centerY:0},circles:{}};function Ro(t,e){return{width:Math.max(...e.map((r)=>Math.abs(r.x-t.x)))*2,height:Math.max(...e.map((r)=>Math.abs(r.y-t.y)))*2}}var{paths:F7,texts:Y9,bounds:L9,refblocks:gi}=I7,T9={x:L9.centerX+0.2,y:L9.centerY},rS=Yt({primitives:[...Object.values(F7),{...Y9.right1,anchor:"middle_left"},{...Y9.right2,anchor:"middle_left"}],ports:[{...gi.top1,labels:["1"]},{...gi.bottom1,labels:["2"]},{...gi.left1,labels:["3"]}],size:Ro(T9,[gi.top1,gi.bottom1,gi.left1]),center:T9}),wm=Z(rS),nS=wm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Am=wm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");nS.anchor="middle_top";Am.anchor="middle_top";nS.x=Am.x;Am.y+=0.15;var M7=wm,C7={paths:{"path12-1-8-6-9":{type:"path",points:[{x:0.01,y:0.07},{x:0.01,y:-0.01}],color:"primary",fill:!1},"path12-1-5-6":{type:"path",points:[{x:-0.47,y:-0.09},{x:-0.17,y:-0.09}],color:"primary",fill:!1},"path12-1-8-0":{type:"path",points:[{x:-0.16,y:-0.01},{x:0.17,y:-0.01}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:0.2,y:-0.09},{x:0.47,y:-0.09}],color:"primary",fill:!1},path2:{type:"path",points:[{x:-0.1,y:0.06},{x:-0.1,y:0.06},{x:-0.1,y:0.07},{x:-0.1,y:0.07},{x:-0.1,y:0.07},{x:-0.1,y:0.08},{x:-0.1,y:0.08},{x:-0.1,y:0.08},{x:-0.1,y:0.09},{x:-0.09,y:0.09},{x:-0.09,y:0.09},{x:-0.09,y:0.1},{x:-0.09,y:0.1},{x:-0.09,y:0.1},{x:-0.09,y:0.1},{x:-0.09,y:0.11},{x:-0.09,y:0.11},{x:-0.08,y:0.11},{x:-0.08,y:0.12},{x:-0.08,y:0.12},{x:-0.08,y:0.12},{x:-0.08,y:0.12},{x:-0.07,y:0.13},{x:-0.07,y:0.13},{x:-0.07,y:0.13},{x:-0.07,y:0.13},{x:-0.06,y:0.14},{x:-0.06,y:0.14},{x:-0.06,y:0.14},{x:-0.06,y:0.14},{x:-0.05,y:0.14},{x:-0.05,y:0.15},{x:-0.05,y:0.15},{x:-0.04,y:0.15},{x:-0.04,y:0.15},{x:-0.04,y:0.15},{x:-0.04,y:0.15},{x:-0.03,y:0.16},{x:-0.03,y:0.16},{x:-0.03,y:0.16},{x:-0.02,y:0.16},{x:-0.02,y:0.16},{x:-0.02,y:0.16},{x:-0.01,y:0.16},{x:-0.01,y:0.16},{x:0,y:0.16},{x:0,y:0.16},{x:0,y:0.16},{x:0.01,y:0.16},{x:0.01,y:0.16},{x:0.01,y:0.16},{x:0.02,y:0.16},{x:0.02,y:0.16},{x:0.02,y:0.16},{x:0.03,y:0.16},{x:0.03,y:0.16},{x:0.03,y:0.16},{x:0.04,y:0.16},{x:0.04,y:0.16},{x:0.04,y:0.16},{x:0.05,y:0.15},{x:0.05,y:0.15},{x:0.05,y:0.15},{x:0.06,y:0.15},{x:0.06,y:0.15},{x:0.06,y:0.15},{x:0.06,y:0.14},{x:0.07,y:0.14},{x:0.07,y:0.14},{x:0.07,y:0.14},{x:0.08,y:0.14},{x:0.08,y:0.13},{x:0.08,y:0.13},{x:0.08,y:0.13},{x:0.09,y:0.13},{x:0.09,y:0.12},{x:0.09,y:0.12},{x:0.09,y:0.12},{x:0.09,y:0.12},{x:0.1,y:0.11},{x:0.1,y:0.11},{x:0.1,y:0.1},{x:0.1,y:0.1},{x:0.11,y:0.09},{x:0.11,y:0.09},{x:0.11,y:0.09},{x:0.11,y:0.08},{x:0.11,y:0.08},{x:0.11,y:0.08},{x:0.11,y:0.07},{x:0.11,y:0.07},{x:0.11,y:0.07},{x:0.11,y:0.06},{x:0.11,y:0.06},{x:0.1,y:0.06},{x:0.1,y:0.06},{x:0.09,y:0.06},{x:0.09,y:0.06},{x:0.08,y:0.06},{x:0.07,y:0.06},{x:0.07,y:0.06},{x:0.06,y:0.06},{x:0.05,y:0.06},{x:0.05,y:0.06},{x:0.04,y:0.06},{x:0.03,y:0.06},{x:0.03,y:0.06},{x:0.02,y:0.06},{x:0.01,y:0.06},{x:0.01,y:0.06},{x:0,y:0.06},{x:-0.01,y:0.06},{x:-0.01,y:0.06},{x:-0.02,y:0.06},{x:-0.03,y:0.06},{x:-0.03,y:0.06},{x:-0.04,y:0.06},{x:-0.05,y:0.06},{x:-0.05,y:0.06},{x:-0.06,y:0.06},{x:-0.07,y:0.06},{x:-0.07,y:0.06},{x:-0.08,y:0.06},{x:-0.09,y:0.06},{x:-0.09,y:0.06}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:-0.16,y:-0.27}},refblocks:{left1:{x:-0.47,y:-0.09},right1:{x:0.47,y:-0.09}},bounds:{minX:-0.5,maxX:0.5,minY:-0.27,maxY:0.27,width:1,height:0.53,centerX:0,centerY:0},circles:{}},{paths:k7,texts:E9,bounds:Oa,refblocks:R9,circles:N7}=C7,iS=Yt({primitives:[...Object.values(k7),...Object.values(N7),{...E9.top1,anchor:"middle_bottom",x:0},{...E9.bottom1,anchor:"middle_top",x:0}],ports:[{...R9.left1,labels:["1"]},{...R9.right1,labels:["2"]}],size:{width:Oa.width,height:Oa.height},center:{x:Oa.centerX+0.006,y:Oa.centerY+0.06}}),Pm=Z(iS),Yo=Pm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Fc=Pm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Yo.anchor="middle_left";Fc.anchor="middle_right";Yo.x=Yo.x-0.03;Yo.y=Yo.y;Fc.x=Fc.x;Fc.y=0;var Y7=Pm,Lt=({horizontalSymbol:t,verticalSymbol:e,gateSide:r,drainSide:n})=>{let i=r==="left"||r==="right",s=n==="left"||n==="right";if(i===s)throw Error(`Invalid MOSFET orientation: gate ${r}, drain ${n}. Gate and drain must be perpendicular.`);let o=i?t:e;return(r==="right"||s&&n==="left")&&(o=wi(o)),(r==="bottom"||!s&&n==="bottom")&&(o=Si(o)),o},L7={paths:{path11:{type:"path",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:"primary",fill:!1},path40:{type:"path",points:[{x:0.09,y:0.19},{x:0.09,y:-0.18}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.27,y:-0.04},{x:0.27,y:0.03},{x:0.2,y:0},{x:0.27,y:-0.04}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:0.05,y:0.17},{x:0.05,y:-0.11}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.13,y:0.36},bottom1:{type:"text",text:"{VAL}",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.16,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:T7,texts:O9,bounds:W9,refblocks:zr,circles:E7}=L7,oS={x:W9.centerX,y:W9.centerY},R7={x:oS.x,y:zr.left1.y},ke=Yt({primitives:[...Object.values(T7),...Object.values(E7),{...O9.top1,anchor:"middle_right",x:0},{...O9.bottom1,anchor:"middle_right",x:0}],ports:[{...zr.top1,labels:["1","drain"]},{...zr.bottom1,labels:["2","source"]},{...zr.left1,labels:["3","gate"]}],size:Ro(oS,[zr.top1,zr.bottom1,zr.left1]),center:R7}),sS=Z(ke),aS=sS.primitives.filter((t)=>t.type==="text"),Bm=aS.find((t)=>t.text==="{VAL}");Bm.x=-0.35;Bm.y=0;Bm.anchor="middle_right";var Im=aS.find((t)=>t.text==="{REF}");Im.y=0;Im.x=0.35;Im.anchor="middle_left";var Qe=sS,O7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"bottom",drainSide:"left"}),W7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"bottom",drainSide:"right"}),$7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"left",drainSide:"bottom"}),j7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"left",drainSide:"top"}),X7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"right",drainSide:"bottom"}),D7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"right",drainSide:"top"}),V7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"top",drainSide:"left"}),z7=Lt({horizontalSymbol:ke,verticalSymbol:Qe,gateSide:"top",drainSide:"right"}),U7={paths:{path11:{type:"path",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:"primary",fill:!1},"path2-8-3-7":{type:"path",points:[{x:0.09,y:0.15},{x:0.09,y:0.07}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:"primary",fill:!1},"path2-8-3":{type:"path",points:[{x:0.09,y:-0.08},{x:0.09,y:-0.15}],color:"primary",fill:!1},"path2-8-3-2":{type:"path",points:[{x:0.09,y:0.03},{x:0.09,y:-0.04}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.27,y:-0.04},{x:0.27,y:0.03},{x:0.2,y:0},{x:0.27,y:-0.04}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:0.05,y:0.11},{x:0.05,y:-0.11}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.13,y:0.36},bottom1:{type:"text",text:"{VAL}",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.16,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:G7,texts:$9,bounds:j9,refblocks:xi,circles:H7}=U7,X9={x:j9.centerX,y:j9.centerY},Ne=Yt({primitives:[...Object.values(G7),...Object.values(H7),{...$9.top1,anchor:"middle_right",x:0},{...$9.bottom1,anchor:"middle_right",x:0}],ports:[{...xi.top1,labels:["1","drain"]},{...xi.bottom1,labels:["2","source"]},{...xi.left1,labels:["3","gate"]}],size:Ro(X9,[xi.top1,xi.bottom1,xi.left1]),center:X9}),cS=Z(Ne),lS=cS.primitives.filter((t)=>t.type==="text"),Fm=lS.find((t)=>t.text==="{VAL}");Fm.x=-0.35;Fm.y=0;Fm.anchor="middle_right";var Mm=lS.find((t)=>t.text==="{REF}");Mm.y=0;Mm.x=0.35;Mm.anchor="middle_left";var Ze=cS,Q7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"bottom",drainSide:"left"}),Z7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"bottom",drainSide:"right"}),q7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"left",drainSide:"bottom"}),J7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"left",drainSide:"top"}),K7=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"right",drainSide:"bottom"}),tM=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"right",drainSide:"top"}),eM=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"top",drainSide:"left"}),rM=Lt({horizontalSymbol:Ne,verticalSymbol:Ze,gateSide:"top",drainSide:"right"}),nM={paths:{path11:{type:"path",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:"primary",fill:!1},path40:{type:"path",points:[{x:0.07,y:0.19},{x:0.07,y:-0.18}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:0.28,y:0.55},{x:0.28,y:0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.1}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.07,y:0.11},{x:0.29,y:0.11}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:0.07,y:-0.1},{x:0.29,y:-0.1}],color:"primary",fill:!1},path15:{type:"path",points:[{x:-0.08,y:0.06},{x:-0.08,y:-0.07},{x:0.01,y:0},{x:-0.08,y:0.06}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.15,y:0.36},bottom1:{type:"text",text:"{VAL}",x:0.04,y:-0.42}},refblocks:{top1:{x:0.28,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.14,y:0,radius:0.29,color:"primary",fill:!1}}};var{paths:iM,texts:D9,bounds:Wa,refblocks:Th,circles:oM}=nM,pS=Yt({primitives:[...Object.values(iM),...Object.values(oM),{...D9.top1,anchor:"middle_right",x:0},{...D9.bottom1,anchor:"middle_right",x:0}],ports:[{...Th.top1,labels:["1","drain"]},{...Th.bottom1,labels:["2","source"]},{...Th.left1,labels:["3","gate"]}],size:{width:Wa.width,height:Wa.height},center:{x:Wa.centerX,y:Wa.centerY}}),hS=Z(pS),dS=hS.primitives.filter((t)=>t.type==="text"),Cm=dS.find((t)=>t.text==="{VAL}");Cm.x=-0.35;Cm.y=0;Cm.anchor="middle_right";var km=dS.find((t)=>t.text==="{REF}");km.y=0;km.x=0.35;km.anchor="middle_left";var sM=hS,aM={paths:{diag1:{type:"path",points:[{x:-0.1,y:-0.1},{x:0.1,y:0.1}],color:"primary",fill:!1},diag2:{type:"path",points:[{x:-0.1,y:0.1},{x:0.1,y:-0.1}],color:"primary",fill:!1},stem:{type:"path",points:[{x:-0.2,y:0},{x:0,y:0}],color:"primary",fill:!1}},texts:{},refblocks:{left1:{x:-0.2,y:0}},bounds:{minX:-0.19,maxX:0.2,minY:-0.12,maxY:0.12,width:0.39,height:0.24,centerX:0,centerY:0},circles:{}},{paths:cM,bounds:V9,refblocks:lM}=aM,nl=Y({primitives:[...Object.values(cM)],ports:[{...lM.left1,labels:["1"]}],center:{x:V9.centerX,y:V9.centerY}}).rotateRightFacingSymbol("right").labelPort("left1",["1"]).build(),pM=Z(nl,"down"),hM=Z(nl,"left"),dM=Z(nl,"up"),Ni={paths:{path11:{type:"path",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:"primary",fill:!1},"path40-0":{type:"path",points:[{x:0.07,y:0.27},{x:0.07,y:-0.28}],color:"primary",fill:!1},"path40-0-5":{type:"path",points:[{x:0.28,y:0.24},{x:0.08,y:0.11}],color:"primary",fill:!1},"path40-0-5-0":{type:"path",points:[{x:0.29,y:-0.24},{x:0.09,y:-0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.29,y:0.25},{x:0.29,y:0.55}],color:"primary",fill:!1},"path12-1-5-3":{type:"path",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.25}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.19,y:-0.1},{x:0.12,y:-0.2},{x:0.22,y:-0.2},{x:0.19,y:-0.1}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.08,y:0.36},bottom1:{type:"text",text:"{VAL}",x:-0.07,y:-0.41}},refblocks:{top1:{x:0.29,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{"path1-0":{type:"circle",x:0.14,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:mM,texts:$nt,bounds:$a,refblocks:Eh,circles:uM}=Ni,fM=Y({primitives:[...Object.values(mM),...Object.values(uM),{type:"text",text:"{REF}",x:-0.3,y:0.5094553499999995},{type:"text",text:"{VAL}",x:-0.3,y:-0.5094553499999995}],ports:[{...Eh.top1,labels:["1","collector"]},{...Eh.bottom1,labels:["3","emitter"]},{...Eh.left1,labels:["2","base"]}],size:{width:$a.width,height:$a.height},center:{x:$a.centerX,y:$a.centerY}}).rotateRightFacingSymbol("right").changeTextAnchor("{REF}","middle_right").changeTextAnchor("{VAL}","middle_right").build(),{paths:yM,texts:jnt,bounds:ja,refblocks:Rh,circles:_M}=Ni,gM=Y({primitives:[...Object.values(yM),...Object.values(_M),{type:"text",text:"{REF}",x:0.55,y:-0.4094553499999995},{type:"text",text:"{VAL}",x:-0.3,y:-0.4094553499999995}],ports:[{...Rh.top1,labels:["1","collector"]},{...Rh.bottom1,labels:["3","emitter"]},{...Rh.left1,labels:["2","base"]}],size:{width:ja.width,height:ja.height},center:{x:ja.centerX,y:ja.centerY}}).rotateRightFacingSymbol("up").changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),{paths:xM,texts:Xnt,bounds:Xa,refblocks:Oh,circles:bM}=Ni,vM=Y({primitives:[...Object.values(xM),...Object.values(bM),{type:"text",text:"{REF}",x:-0.5,y:0.3094553499999995},{type:"text",text:"{VAL}",x:0.55,y:0.3094553499999995}],ports:[{...Oh.top1,labels:["1","collector"]},{...Oh.bottom1,labels:["3","emitter"]},{...Oh.left1,labels:["2","base"]}],size:{width:Xa.width,height:Xa.height},center:{x:Xa.centerX,y:Xa.centerY}}).rotateRightFacingSymbol("down").changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),{paths:SM,texts:Dnt,bounds:Da,refblocks:Wh,circles:wM}=Ni,AM=Y({primitives:[...Object.values(SM),...Object.values(wM),{type:"text",text:"{REF}",x:0.55,y:-0.4094553499999995},{type:"text",text:"{VAL}",x:-0.3,y:-0.4094553499999995}],ports:[{...Wh.top1,labels:["1","collector"]},{...Wh.bottom1,labels:["3","emitter"]},{...Wh.left1,labels:["2","base"]}],size:{width:Da.width,height:Da.height},center:{x:Da.centerX,y:Da.centerY}}).rotateRightFacingSymbol("up").changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),{paths:PM,texts:Vnt,bounds:Va,refblocks:$h,circles:BM}=Ni,IM=Y({primitives:[...Object.values(PM),...Object.values(BM),{type:"text",text:"{REF}",x:-0.3,y:-0.4094553499999995},{type:"text",text:"{VAL}",x:-0.3,y:0.4094553499999995}],ports:[{...$h.top1,labels:["1","collector"]},{...$h.bottom1,labels:["3","emitter"]},{...$h.left1,labels:["2","base"]}],size:{width:Va.width,height:Va.height},center:{x:Va.centerX,y:Va.centerY}}).rotateRightFacingSymbol("left").changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:FM,texts:znt,bounds:za,refblocks:jh,circles:MM}=Ni,CM=Y({primitives:[...Object.values(FM),...Object.values(MM),{type:"text",text:"{REF}",x:-0.3,y:-0.4094553499999995},{type:"text",text:"{VAL}",x:-0.3,y:0.4094553499999995}],ports:[{...jh.top1,labels:["1","collector"]},{...jh.bottom1,labels:["3","emitter"]},{...jh.left1,labels:["2","base"]}],size:{width:za.width,height:za.height},center:{x:za.centerX,y:za.centerY}}).rotateRightFacingSymbol("left").changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),kM={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.32,y:-0.21}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.32,y:0.31},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.32,y:-0.21},{x:-0.32,y:0.31}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.32,y:0.18},{x:-0.57,y:0.18}],color:"primary",fill:!1},path45:{type:"path",points:[{x:-0.32,y:-0.09},{x:-0.57,y:-0.09}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.43,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1},"rect1577-3":{type:"path",points:[{x:-0.19,y:-0.09},{x:-0.27,y:-0.09}],color:"primary",fill:!0},"rect1577-4":{type:"path",points:[{x:-0.19,y:0.18},{x:-0.27,y:0.18}],color:"primary",fill:!0},"rect1577-4-7":{type:"path",points:[{x:-0.23,y:0.14},{x:-0.23,y:0.22}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.42},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.3}},refblocks:{left1:{x:-0.57,y:0.18},left2:{x:-0.57,y:-0.09},right1:{x:0.43,y:0.04}},bounds:{minX:-0.57,maxX:0.43,minY:-0.38,maxY:0.27,width:1.09,height:0.3,centerX:-0.07,centerY:0.05},circles:{}},il=Y(kM).labelPort("left1",["1","inp1"]).labelPort("left2",["2","inp2"]).labelPort("right1",["3","out"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),NM=Z(il,"down"),YM=Si(Z(il,"left")),LM=Z(il,"up"),TM={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.32,y:-0.21}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.32,y:0.31},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.32,y:-0.21},{x:-0.32,y:0.31}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.32,y:0.18},{x:-0.57,y:0.18}],color:"primary",fill:!1},path45:{type:"path",points:[{x:-0.32,y:-0.09},{x:-0.57,y:-0.09}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.43,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1},"path44-1":{type:"path",points:[{x:-0.1,y:0.44},{x:-0.1,y:0.18}],color:"primary",fill:!1},"path44-2":{type:"path",points:[{x:-0.09,y:-0.34},{x:-0.09,y:-0.09}],color:"primary",fill:!1},"rect1577-3":{type:"path",points:[{x:-0.19,y:0.18},{x:-0.27,y:0.18}],color:"primary",fill:!0},"rect1577-4":{type:"path",points:[{x:-0.19,y:-0.09},{x:-0.27,y:-0.09}],color:"primary",fill:!0},"rect1577-4-7":{type:"path",points:[{x:-0.23,y:0.14},{x:-0.23,y:0.22}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:0.25,y:0.32},bottom1:{type:"text",text:"{VAL}",x:0.25,y:-0.24}},refblocks:{left1:{x:-0.57,y:0.18},left2:{x:-0.57,y:-0.09},right1:{x:0.43,y:0.04},top2:{x:-0.1,y:0.44},bottom1:{x:-0.09,y:-0.34}},bounds:{minX:-0.57,maxX:0.43,minY:-0.38,maxY:0.27,width:1.09,height:0.3,centerX:-0.07,centerY:0.05},circles:{}},ol=Y(TM).labelPort("left1",["1","inp1"]).labelPort("left2",["2","inp2"]).labelPort("right1",["4","out"]).labelPort("top2",["5","V+"]).labelPort("bottom1",["3","V-"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),EM=Z(ol,"down"),RM=Si(Z(ol,"left")),OM=Z(ol,"up"),WM={paths:{path11:{type:"path",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:"primary",fill:!1},path40:{type:"path",points:[{x:0.09,y:0.19},{x:0.09,y:-0.18}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.2,y:0.03},{x:0.2,y:-0.04},{x:0.27,y:-0.01},{x:0.2,y:0.03}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:0.05,y:0.17},{x:0.05,y:-0.11}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.13,y:0.36},bottom1:{type:"text",text:"{VAL}",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.16,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:$M,texts:z9,bounds:U9,refblocks:bi,circles:jM}=WM,G9={x:U9.centerX,y:U9.centerY},Ye=Yt({primitives:[...Object.values($M),...Object.values(jM),{...z9.top1,anchor:"middle_right",x:0},{...z9.bottom1,anchor:"middle_right",x:0}],ports:[{...bi.top1,labels:["1","drain"]},{...bi.bottom1,labels:["2","source"]},{...bi.left1,labels:["3","gate"]}],size:Ro(G9,[bi.top1,bi.bottom1,bi.left1]),center:G9}),mS=Z(Ye),uS=mS.primitives.filter((t)=>t.type==="text"),Nm=uS.find((t)=>t.text==="{VAL}");Nm.x=-0.35;Nm.y=0;Nm.anchor="middle_right";var Ym=uS.find((t)=>t.text==="{REF}");Ym.y=0;Ym.x=0.35;Ym.anchor="middle_left";var qe=mS,XM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"bottom",drainSide:"left"}),DM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"bottom",drainSide:"right"}),VM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"left",drainSide:"bottom"}),zM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"left",drainSide:"top"}),UM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"right",drainSide:"bottom"}),GM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"right",drainSide:"top"}),HM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"top",drainSide:"left"}),QM=Lt({horizontalSymbol:Ye,verticalSymbol:qe,gateSide:"top",drainSide:"right"}),ZM={paths:{path11:{type:"path",points:[{x:-0.42,y:-0.1},{x:0.05,y:-0.11}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:0.3,y:0.55},{x:0.3,y:0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.31,y:-0.55},{x:0.31,y:-0.01}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.09,y:0.11},{x:0.31,y:0.11}],color:"primary",fill:!1},"path2-8-3-7":{type:"path",points:[{x:0.09,y:0.15},{x:0.09,y:0.07}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:0.09,y:-0.1},{x:0.31,y:-0.1}],color:"primary",fill:!1},"path2-8-3":{type:"path",points:[{x:0.09,y:-0.08},{x:0.09,y:-0.15}],color:"primary",fill:!1},"path2-8-3-2":{type:"path",points:[{x:0.09,y:0.03},{x:0.09,y:-0.04}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.2,y:0.03},{x:0.2,y:-0.04},{x:0.27,y:-0.01},{x:0.2,y:0.03}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:0.09,y:0},{x:0.31,y:-0.01}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:0.05,y:0.11},{x:0.05,y:-0.11}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.13,y:0.36},bottom1:{type:"text",text:"{VAL}",x:0.06,y:-0.42}},refblocks:{top1:{x:0.3,y:0.55},bottom1:{x:0.31,y:-0.55},left1:{x:-0.42,y:-0.1}},bounds:{minX:-0.45,maxX:0.45,minY:-0.58,maxY:0.58,width:0.89,height:1.16,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.16,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:qM,texts:H9,bounds:Q9,refblocks:vi,circles:JM}=ZM,Z9={x:Q9.centerX,y:Q9.centerY},Le=Yt({primitives:[...Object.values(qM),...Object.values(JM),{...H9.top1,anchor:"middle_right",x:0},{...H9.bottom1,anchor:"middle_right",x:0}],ports:[{...vi.top1,labels:["1","drain"]},{...vi.bottom1,labels:["2","source"]},{...vi.left1,labels:["3","gate"]}],size:Ro(Z9,[vi.top1,vi.bottom1,vi.left1]),center:Z9}),fS=Z(Le),yS=fS.primitives.filter((t)=>t.type==="text"),Lm=yS.find((t)=>t.text==="{VAL}");Lm.x=-0.35;Lm.y=0;Lm.anchor="middle_right";var Tm=yS.find((t)=>t.text==="{REF}");Tm.y=0;Tm.x=0.35;Tm.anchor="middle_left";var Je=fS,KM=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"bottom",drainSide:"left"}),tC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"bottom",drainSide:"right"}),eC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"left",drainSide:"bottom"}),rC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"left",drainSide:"top"}),nC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"right",drainSide:"bottom"}),iC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"right",drainSide:"top"}),oC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"top",drainSide:"left"}),sC=Lt({horizontalSymbol:Le,verticalSymbol:Je,gateSide:"top",drainSide:"right"}),aC={paths:{path11:{type:"path",points:[{x:-0.54,y:-0.01},{x:-0.15,y:-0.02}],color:"primary",fill:!1},path40:{type:"path",points:[{x:0.13,y:0},{x:-0.13,y:-0.13}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.13,y:0.13},{x:0.13,y:0}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.13,y:-0.13},{x:-0.13,y:0.13}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.13,y:0.13},{x:0.13,y:-0.13}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.14,y:0},{x:0.54,y:-0.01}],color:"primary",fill:!1},"path25-0":{type:"path",points:[{x:0.2,y:0.38},{x:0.16,y:0.28},{x:0.26,y:0.3}],color:"primary",fill:!0},"path78-6":{type:"path",points:[{x:0.33,y:0.43},{x:0.32,y:0.42},{x:0.21,y:0.31},{x:0.21,y:0.31}],color:"primary",fill:!1},"path25-0-9":{type:"path",points:[{x:0.35,y:0.35},{x:0.31,y:0.26},{x:0.41,y:0.27}],color:"primary",fill:!0},"path78-6-5":{type:"path",points:[{x:0.48,y:0.4},{x:0.47,y:0.39},{x:0.35,y:0.29},{x:0.35,y:0.29}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.1,y:0.35},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.43}},refblocks:{left1:{x:-0.54,y:-0.01},right1:{x:0.54,y:-0.01}},bounds:{minX:-0.57,maxX:0.57,minY:-0.43,maxY:0.43,width:1.14,height:0.85,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:-0.01,radius:0.29,color:"primary",fill:!1}}},_S=Y(aC).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),gS=Z(_S),cC=gS.primitives.filter((t)=>t.type==="text"),xS=cC.find((t)=>t.text==="{REF}");xS.y=0;xS.anchor="middle_left";var lC=gS,pC={paths:{path11:{type:"path",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:"primary",fill:!1},path40:{type:"path",points:[{x:0.07,y:0.19},{x:0.07,y:-0.18}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:0.28,y:0.55},{x:0.28,y:0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.1}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.07,y:0.11},{x:0.29,y:0.11}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:0.07,y:-0.1},{x:0.29,y:-0.1}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.01,y:-0.07},{x:0.01,y:0.06},{x:-0.08,y:0},{x:0.01,y:-0.07}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.15,y:0.36},bottom1:{type:"text",text:"{VAL}",x:0.04,y:-0.42}},refblocks:{top1:{x:0.28,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.14,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:hC,texts:q9,bounds:Ua,refblocks:Xh,circles:dC}=pC,bS=Yt({primitives:[...Object.values(hC),...Object.values(dC),{...q9.top1,anchor:"middle_right",x:0},{...q9.bottom1,anchor:"middle_right"}],ports:[{...Xh.top1,labels:["1","drain"]},{...Xh.bottom1,labels:["2","source"]},{...Xh.left1,labels:["3","gate"]}],size:{width:Ua.width,height:Ua.height},center:{x:Ua.centerX,y:Ua.centerY}}),vS=Z(bS),SS=vS.primitives.filter((t)=>t.type==="text"),Em=SS.find((t)=>t.text==="{VAL}");Em.x=-0.35;Em.y=0;Em.anchor="middle_right";var Rm=SS.find((t)=>t.text==="{REF}");Rm.y=0;Rm.x=0.35;Rm.anchor="middle_left";var mC=vS,Ur={paths:{path11:{type:"path",points:[{x:-0.4,y:0},{x:0.06,y:-0.01}],color:"primary",fill:!1},"path40-0":{type:"path",points:[{x:0.07,y:0.27},{x:0.07,y:-0.28}],color:"primary",fill:!1},"path40-0-5":{type:"path",points:[{x:0.28,y:0.24},{x:0.08,y:0.11}],color:"primary",fill:!1},"path40-0-5-0":{type:"path",points:[{x:0.29,y:-0.24},{x:0.09,y:-0.11}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:0.29,y:0.25},{x:0.29,y:0.55}],color:"primary",fill:!1},"path12-1-5-3":{type:"path",points:[{x:0.29,y:-0.55},{x:0.29,y:-0.25}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0.15,y:-0.23},{x:0.22,y:-0.12},{x:0.12,y:-0.12},{x:0.15,y:-0.23}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.08,y:0.37},bottom1:{type:"text",text:"{VAL}",x:-0.07,y:-0.41}},refblocks:{top1:{x:0.29,y:0.55},bottom1:{x:0.29,y:-0.55},left1:{x:-0.4,y:0}},bounds:{minX:-0.43,maxX:0.43,minY:-0.58,maxY:0.58,width:0.85,height:1.16,centerX:0,centerY:0},circles:{"path1-0":{type:"circle",x:0.14,y:0,radius:0.29,color:"primary",fill:!1}}},{paths:uC,texts:Unt,bounds:Ga,refblocks:Dh,circles:fC}=Ur,yC=Y({primitives:[...Object.values(uC),...Object.values(fC),{type:"text",text:"{REF}",x:-0.1,y:0.3094553499999995},{type:"text",text:"{VAL}",x:-0.1,y:-0.3094553499999995}],ports:[{...Dh.top1,labels:["1","collector"]},{...Dh.bottom1,labels:["3","emitter"]},{...Dh.left1,labels:["2","base"]}],size:{width:Ga.width,height:Ga.height},center:{x:Ga.centerX,y:Ga.centerY}}).rotateRightFacingSymbol("right").changeTextAnchor("{REF}","middle_right").changeTextAnchor("{VAL}","middle_right").build(),{paths:Gnt,texts:Hnt,bounds:Qnt,refblocks:Znt,circles:qnt}=Ur,_C=Y(Ur).rotateRightFacingSymbol("up").changeTextAnchor("{VAL}","middle_left").labelPort("left1",["2","base"]).labelPort("top1",["1","collector"]).labelPort("bottom1",["3","emitter"]).changeTextAnchor("{REF}","middle_right").build(),{paths:gC,texts:Jnt,bounds:Ha,refblocks:Vh,circles:xC}=Ur,bC=Y({primitives:[...Object.values(gC),...Object.values(xC),{type:"text",text:"{REF}",x:-0.1,y:-0.3094553499999995},{type:"text",text:"{VAL}",x:-0.1,y:0.3094553499999995}],ports:[{...Vh.top1,labels:["1","collector"]},{...Vh.bottom1,labels:["3","emitter"]},{...Vh.left1,labels:["2","base"]}],size:{width:Ha.width,height:Ha.height},center:{x:Ha.centerX,y:Ha.centerY}}).rotateRightFacingSymbol("down").changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_bottom").build(),{paths:vC,texts:Knt,bounds:Qa,refblocks:zh,circles:SC}=Ur,wC=Y({primitives:[...Object.values(vC),...Object.values(SC),{type:"text",text:"{REF}",x:-0.1,y:-0.3094553499999995},{type:"text",text:"{VAL}",x:-0.1,y:0.3094553499999995}],ports:[{...zh.top1,labels:["1","collector"]},{...zh.bottom1,labels:["3","emitter"]},{...zh.left1,labels:["2","base"]}],size:{width:Qa.width,height:Qa.height},center:{x:Qa.centerX,y:Qa.centerY}}).rotateRightFacingSymbol("up").changeTextAnchor("{REF}","middle_top").changeTextAnchor("{VAL}","middle_top").build(),{paths:AC,texts:tit,bounds:Za,refblocks:Uh,circles:PC}=Ur,BC=Y({primitives:[...Object.values(AC),...Object.values(PC),{type:"text",text:"{REF}",x:-0.1,y:-0.3094553499999995},{type:"text",text:"{VAL}",x:-0.1,y:0.3094553499999995}],ports:[{...Uh.top1,labels:["1","collector"]},{...Uh.bottom1,labels:["3","emitter"]},{...Uh.left1,labels:["2","base"]}],size:{width:Za.width,height:Za.height},center:{x:Za.centerX,y:Za.centerY}}).rotateRightFacingSymbol("left").changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:IC,texts:eit,bounds:qa,refblocks:Gh,circles:FC}=Ur,MC=Y({primitives:[...Object.values(IC),...Object.values(FC),{type:"text",text:"{REF}",x:-0.1,y:-0.3094553499999995},{type:"text",text:"{VAL}",x:-0.1,y:0.3094553499999995}],ports:[{...Gh.top1,labels:["1","collector"]},{...Gh.bottom1,labels:["3","emitter"]},{...Gh.left1,labels:["2","base"]}],size:{width:qa.width,height:qa.height},center:{x:qa.centerX,y:qa.centerY}}).rotateRightFacingSymbol("left").changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),CC={paths:{path40:{type:"path",points:[{x:-0.19,y:0.33},{x:-0.26,y:0.14}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.38,y:0.26},{x:-0.19,y:0.33}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.26,y:0.14},{x:-0.38,y:0.26}],color:"primary",fill:!1},path43:{type:"path",points:[{x:-0.26,y:0.39},{x:-0.13,y:0.26}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.32,y:0.2},{x:-0.52,y:0}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0,y:0.52},{x:-0.19,y:0.33}],color:"primary",fill:!1},"path40-4":{type:"path",points:[{x:-0.19,y:-0.32},{x:-0.38,y:-0.26}],color:"primary",fill:!1},"path41-1":{type:"path",points:[{x:-0.26,y:-0.13},{x:-0.19,y:-0.32}],color:"primary",fill:!1},"path42-7":{type:"path",points:[{x:-0.38,y:-0.26},{x:-0.26,y:-0.13}],color:"primary",fill:!1},"path43-1":{type:"path",points:[{x:-0.13,y:-0.26},{x:-0.26,y:-0.39}],color:"primary",fill:!1},"path44-8":{type:"path",points:[{x:-0.32,y:-0.19},{x:-0.51,y:-0.01}],color:"primary",fill:!1},"path44-0-7":{type:"path",points:[{x:-0.01,y:-0.5},{x:-0.19,y:-0.32}],color:"primary",fill:!1},"path40-4-0":{type:"path",points:[{x:0.32,y:0.19},{x:0.13,y:0.26}],color:"primary",fill:!1},"path41-1-2":{type:"path",points:[{x:0.26,y:0.38},{x:0.32,y:0.19}],color:"primary",fill:!1},"path42-7-1":{type:"path",points:[{x:0.13,y:0.26},{x:0.26,y:0.38}],color:"primary",fill:!1},"path43-1-8":{type:"path",points:[{x:0.39,y:0.26},{x:0.26,y:0.13}],color:"primary",fill:!1},"path44-8-7":{type:"path",points:[{x:0.2,y:0.32},{x:0.01,y:0.51}],color:"primary",fill:!1},"path44-0-7-1":{type:"path",points:[{x:0.52,y:0},{x:0.32,y:0.19}],color:"primary",fill:!1},"path40-4-8":{type:"path",points:[{x:0.32,y:-0.19},{x:0.26,y:-0.38}],color:"primary",fill:!1},"path41-1-4":{type:"path",points:[{x:0.13,y:-0.26},{x:0.32,y:-0.19}],color:"primary",fill:!1},"path42-7-0":{type:"path",points:[{x:0.26,y:-0.38},{x:0.13,y:-0.26}],color:"primary",fill:!1},"path43-1-0":{type:"path",points:[{x:0.26,y:-0.13},{x:0.39,y:-0.26}],color:"primary",fill:!1},"path44-8-9":{type:"path",points:[{x:0.19,y:-0.32},{x:0,y:-0.52}],color:"primary",fill:!1},"path44-0-7-3":{type:"path",points:[{x:0.5,y:-0.01},{x:0.32,y:-0.19}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.29,y:0.46},bottom1:{type:"text",text:"{VAL}",x:-0.29,y:-0.5}},refblocks:{top1:{x:0,y:0.52},bottom1:{x:0,y:-0.52},left1:{x:-0.52,y:0},right1:{x:0.52,y:0}},bounds:{minX:-0.55,maxX:0.55,minY:-0.55,maxY:0.55,width:1.09,height:1.09,centerX:0,centerY:0},circles:{}},{paths:kC,texts:J9,bounds:Ja,refblocks:K9}=CC,wS=Yt({primitives:[...Object.values(kC),{...J9.bottom1,y:0.35,anchor:"middle_top"},{...J9.top1,anchor:"middle_left"}],ports:[{...K9.left1,labels:["1"]},{...K9.right1,labels:["2"]}],size:{width:Ja.width+0.05,height:Ja.height},center:{x:Ja.centerX,y:Ja.centerY}}),NC=Z(wS),YC=NC,LC={paths:{path18:{type:"path",points:[{x:-0.53,y:0},{x:-0.27,y:0}],color:"primary",fill:!1},path19:{type:"path",points:[{x:0.26,y:0},{x:0.53,y:0}],color:"primary",fill:!1},path20:{type:"path",points:[{x:0,y:0.13},{x:0.26,y:0.13},{x:0.26,y:-0.13},{x:-0.27,y:-0.13},{x:-0.27,y:0.13},{x:0,y:0.13}],color:"primary",fill:!1},path24:{type:"path",points:[{x:0.29,y:-0.29},{x:0.26,y:-0.16},{x:0.16,y:-0.26},{x:0.29,y:-0.29}],color:"primary",fill:!0},path26:{type:"path",points:[{x:-0.3,y:0.29},{x:0.2,y:-0.2}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0.06,y:0.2},bottom1:{type:"text",text:"{VAL}",x:-0.1,y:-0.28}},refblocks:{left1:{x:-0.53,y:0},right1:{x:0.53,y:0}},bounds:{minX:-0.56,maxX:0.56,minY:-0.29,maxY:0.29,width:1.13,height:0.58,centerX:0,centerY:0},circles:{}},{paths:TC,texts:tv,bounds:Ka,refblocks:ev}=LC,sl=Yt({primitives:[...Object.values(TC),{...tv.bottom1,x:0,y:-0.35,anchor:"middle_top"},{...tv.top1,x:0,y:0.35,anchor:"middle_bottom"}],ports:[{...ev.left1,labels:["1"]},{...ev.right1,labels:["2"]}],size:{width:Ka.width+0.05,height:Ka.height},center:{x:Ka.centerX,y:Ka.centerY}}),Om=Z(sl,"down"),Wm=Om.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),$m=Om.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Wm.anchor="middle_left";$m.anchor="middle_left";Wm.y+=0.31;Wm.x=0.34;$m.y-=0.31;$m.x=0.34;var EC=Om,jm=Z(sl,"left"),Xm=jm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Dm=jm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Xm.anchor="middle_bottom";Dm.anchor="middle_top";Xm.y+=0.73;Xm.x=0;Dm.y-=0.7;Dm.x=0;var RC=jm,Vm=Z(sl,"up"),zm=Vm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Um=Vm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");zm.anchor="middle_left";Um.anchor="middle_left";zm.y+=0.21;zm.x=0.34;Um.y-=0.21;Um.x=0.34;var OC=Vm,al={paths:{path1:{type:"path",points:[{x:-0.42,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},"path1-2-1":{type:"path",points:[{x:-0.3,y:0},{x:-0.25,y:0.1},{x:-0.15,y:-0.1},{x:-0.05,y:0.1},{x:0.05,y:-0.1},{x:0.15,y:0.1},{x:0.25,y:-0.1},{x:0.3,y:0}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.3,y:0},{x:0.42,y:0}],color:"primary",fill:!1},path3:{type:"path",points:[{x:0,y:-0.17},{x:0,y:-0.4}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0,y:-0.12},{x:0.05,y:-0.2},{x:-0.05,y:-0.2},{x:0,y:-0.12}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:0.3,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0.3,y:-0.25}},refblocks:{left:{x:-0.42,y:0},right:{x:0.42,y:0},bottom:{x:0,y:-0.4}},bounds:{minX:-0.42,maxX:0.42,minY:-0.2,maxY:0.2,width:0.84,height:0.4,centerX:0,centerY:0},circles:{}},{paths:WC,texts:rit,bounds:tc,refblocks:Hh,circles:$C}=al,jC=Y({primitives:[...Object.values(WC),...Object.values($C),{type:"text",text:"{REF}",x:-0.15,y:0.2394553499999995},{type:"text",text:"{VAL}",x:0.15,y:0.2394553499999995}],ports:[{...Hh.left,labels:["1"]},{...Hh.right,labels:["3"]},{...Hh.bottom,labels:["2"]}],size:{width:tc.width,height:tc.height},center:{x:tc.centerX,y:tc.centerY}}).rotateRightFacingSymbol("down").labelPort("left",["1"]).labelPort("right",["2"]).labelPort("bottom",["3"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:XC,texts:nit,bounds:ec,refblocks:Qh,circles:DC}=al,VC=Y({primitives:[...Object.values(XC),...Object.values(DC),{type:"text",text:"{REF}",x:-0.3,y:-0.3894553499999995},{type:"text",text:"{VAL}",x:-0.3,y:0.3194553499999995}],ports:[{...Qh.left,labels:["1"]},{...Qh.right,labels:["3"]},{...Qh.bottom,labels:["2"]}],size:{width:ec.width,height:ec.height},center:{x:ec.centerX,y:ec.centerY}}).rotateRightFacingSymbol("left").labelPort("left",["1"]).labelPort("right",["2"]).labelPort("bottom",["3"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),zC=Y(al).labelPort("left",["1"]).labelPort("right",["3"]).labelPort("bottom",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),{paths:UC,texts:iit,bounds:rc,refblocks:Zh,circles:GC}=al,HC=Y({primitives:[...Object.values(UC),...Object.values(GC),{type:"text",text:"{REF}",x:0.3,y:-0.2894553499999995},{type:"text",text:"{VAL}",x:-0.3,y:-0.2894553499999995}],ports:[{...Zh.left,labels:["1"]},{...Zh.right,labels:["3"]},{...Zh.bottom,labels:["2"]}],size:{width:rc.width,height:rc.height},center:{x:rc.centerX,y:rc.centerY}}).rotateRightFacingSymbol("up").labelPort("left",["1"]).labelPort("right",["2"]).labelPort("bottom",["3"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),QC={paths:{path11:{type:"path",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.03}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0.03},{x:0.54,y:0.03}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.16,y:0.4},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.4},left1:{type:"text",text:"COS φ",x:-0.15,y:0.01}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.03}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.79,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0.04,radius:0.29,color:"primary",fill:!1}}},{paths:ZC,texts:oit,bounds:nc,refblocks:rv,circles:qC}=QC,AS=Yt({primitives:[...Object.values(ZC),...Object.values(qC),{type:"text",text:"{REF}",x:0,y:0.43330070000000065,anchor:"middle_bottom"},{type:"text",text:"{VAL}",x:0,y:-0.43330070000000065,anchor:"middle_top"},{type:"text",text:"COS φ",x:0,y:0.014279000000000375,anchor:"center"}],ports:[{...rv.left1,labels:["1"]},{...rv.right1,labels:["2"]}],size:{width:nc.width,height:nc.height},center:{x:nc.centerX,y:nc.centerY}}),PS=Z(AS),Gm=PS.primitives.filter((t)=>t.type==="text"),od=Gm.find((t)=>t.text==="{REF}"),Hm=Gm.find((t)=>t.text==="{VAL}"),sd=Gm.find((t)=>t.text==="COS φ");od.x=0.35;od.y=0.4279000000000375,od.anchor="middle_left";Hm.anchor="middle_left";Hm.x=0.35;Hm.y=-0.4279000000000375,sd.x=0;sd.y=0.014279000000000375,sd.anchor="center";var JC=PS,KC={paths:{"path12-1-8-6-9-9":{type:"path",points:[{x:0.01,y:0.03},{x:0.01,y:-0.09}],color:"primary",fill:!1},"path12-1-5-6-4":{type:"path",points:[{x:-0.47,y:-0.05},{x:-0.17,y:-0.05}],color:"primary",fill:!1},"path12-1-8-0-0":{type:"path",points:[{x:-0.16,y:-0.09},{x:0.18,y:-0.09}],color:"primary",fill:!1},"path12-1-0-1":{type:"path",points:[{x:0.2,y:-0.05},{x:0.47,y:-0.05}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0.01,y:0.22},bottom1:{type:"text",text:"{VAL}",x:-0.16,y:-0.22}},refblocks:{left1:{x:-0.47,y:-0.05},right1:{x:0.47,y:-0.05}},bounds:{minX:-0.5,maxX:0.5,minY:-0.22,maxY:0.22,width:1,height:0.45,centerX:0,centerY:0},circles:{"circle-2":{type:"circle",x:-0.14,y:-0.05,radius:0.02,color:"primary",fill:!1},circle:{type:"circle",x:0.17,y:-0.05,radius:0.02,color:"primary",fill:!1}}},{paths:tk,texts:nv,bounds:iv,refblocks:ov,circles:ek}=KC,BS=Yt({primitives:[...Object.values(tk),...Object.values(ek),{...nv.top1,anchor:"middle_left"},{...nv.bottom1,anchor:"middle_left"}],ports:[{...ov.left1,labels:["1"]},{...ov.right1,labels:["2"]}],center:{x:iv.centerX,y:iv.centerY}}),rk=Z(BS,"up"),IS={paths:{"path12-1-8-6-9-9":{type:"path",points:[{x:-0.05,y:0.09},{x:-0.05,y:0.04}],color:"primary",fill:!1},"path12-1-8-7-9-9":{type:"path",points:[{x:-0.05,y:0.09},{x:0.07,y:0.09}],color:"primary",fill:!1},"path12-1-8-6-9-10":{type:"path",points:[{x:0.07,y:0.09},{x:0.07,y:0.04}],color:"primary",fill:!1},"path12-1-5-6-4":{type:"path",points:[{x:-0.47,y:-0.05},{x:-0.17,y:-0.05}],color:"primary",fill:!1},"path12-1-8-0-0":{type:"path",points:[{x:-0.16,y:0.04},{x:0.18,y:0.04}],color:"primary",fill:!1},"path12-1-0-1":{type:"path",points:[{x:0.2,y:-0.05},{x:0.47,y:-0.05}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0.01,y:0.29},bottom1:{type:"text",text:"{VAL}",x:-0.16,y:-0.22}},refblocks:{left1:{x:-0.47,y:-0.05},right1:{x:0.47,y:-0.05}},bounds:{minX:-0.5,maxX:0.5,minY:-0.22,maxY:0.22,width:1,height:0.45,centerX:0,centerY:0},circles:{"circle-2":{type:"circle",x:-0.14,y:-0.05,radius:0.02,color:"primary",fill:!1},circle:{type:"circle",x:0.17,y:-0.05,radius:0.02,color:"primary",fill:!1}}},{paths:nk,texts:sv,bounds:ik,refblocks:qh,circles:ok}=IS,Oo=Yt({primitives:[...Object.values(nk),...Object.values(ok),{...sv.top1,x:0,y:0.3594553499999995,anchor:"middle_bottom"},{...sv.bottom1,x:0,y:-0.3594553499999995,anchor:"middle_top"}],ports:[{...qh.left1,labels:["1"]},{...qh.right1,labels:["2"]}],center:{x:ik.centerX,y:qh.left1.y}}),Qm=Z(Oo,"down"),Zm=Qm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),qm=Qm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Zm.anchor="middle_bottom";qm.anchor="middle_top";Zm.y=0.4;Zm.x=0.35;qm.y=-0.4;qm.x=0.35;var sk=Qm,{paths:ak,texts:av,bounds:ck,refblocks:Jh,circles:lk}=IS,pk=Yt({primitives:[...Object.values(ak),...Object.values(lk),{...av.top1,x:0,y:0.3594553499999995,anchor:"middle_bottom"},{...av.bottom1,x:0,y:-0.3594553499999995,anchor:"middle_top"}],ports:[{...Jh.left1,labels:["1"]},{...Jh.right1,labels:["2"]}],center:{x:ck.centerX,y:Jh.left1.y}}),Jm=Z(Oo,"left"),Km=Jm.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),tu=Jm.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Km.anchor="middle_bottom";tu.anchor="middle_top";Km.y=0.4;Km.x=0;tu.y=-0.4;tu.x=0;var hk=Jm,eu=Z(Oo,"up"),ru=eu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),nu=eu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");ru.anchor="middle_left";nu.anchor="middle_left";ru.y+=0.4;ru.x=0.34;nu.y-=0.41;nu.x=0.34;var dk=eu,iu=Z(Oo,"up"),ou=iu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),su=iu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");ou.anchor="middle_left";su.anchor="middle_left";ou.y+=0.4;ou.x=0.34;su.y-=0.41;su.x=0.34;var mk=iu,cl={paths:{path12_rotated:{type:"path",points:[{x:-0.09,y:0.12},{x:-0.09,y:-0.12}],color:"primary",fill:!1},path2_rotated:{type:"path",points:[{x:-0.09,y:0},{x:0.09,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.03}},refblocks:{left1:{x:0.09,y:0}},bounds:{minX:-0.57,maxX:0.57,minY:-0.37,maxY:0.37,width:1.14,height:0.74,centerX:0,centerY:0},circles:{}},{paths:uk,texts:sit,bounds:cv,refblocks:fk,circles:yk}=cl,_k=Y({primitives:[...Object.values(uk),...Object.values(yk),{type:"text",text:"{REF}",x:-0.14,y:-0}],ports:[{...fk.left1,labels:["1"]}],center:{x:cv.centerX,y:cv.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_top").build(),{paths:gk,texts:ait,bounds:lv,refblocks:xk,circles:bk}=cl,vk=Y({primitives:[...Object.values(gk),...Object.values(bk),{type:"text",text:"{REF}",x:-0.13,y:0}],ports:[{...xk.left1,labels:["1"]}],center:{x:lv.centerX,y:lv.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_right").build(),{paths:Sk,texts:cit,bounds:pv,refblocks:wk,circles:Ak}=cl,Pk=Y({primitives:[...Object.values(Sk),...Object.values(Ak),{type:"text",text:"{REF}",x:-0.14,y:-0}],ports:[{...wk.left1,labels:["1"]}],center:{x:pv.centerX,y:pv.centerY}}).rotateRightFacingSymbol("left").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_left").build(),{paths:Bk,texts:lit,bounds:hv,refblocks:Ik}=cl,Fk=Y({primitives:[...Object.values(Bk),{type:"text",text:"{REF}",x:-0.14,y:0}],ports:[{...Ik.left1,labels:["1"]}],center:{x:hv.centerX,y:hv.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),Mk={paths:{path40:{type:"path",points:[{x:-0.19,y:-0.33},{x:-0.26,y:-0.14}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.38,y:-0.26},{x:-0.19,y:-0.33}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.26,y:-0.14},{x:-0.38,y:-0.26}],color:"primary",fill:!1},path43:{type:"path",points:[{x:-0.26,y:-0.39},{x:-0.13,y:-0.26}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.32,y:-0.2},{x:-0.52,y:0}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0,y:-0.52},{x:-0.19,y:-0.33}],color:"primary",fill:!1},"path40-4":{type:"path",points:[{x:-0.19,y:0.32},{x:-0.38,y:0.26}],color:"primary",fill:!1},"path41-1":{type:"path",points:[{x:-0.26,y:0.13},{x:-0.19,y:0.32}],color:"primary",fill:!1},"path42-7":{type:"path",points:[{x:-0.38,y:0.26},{x:-0.26,y:0.13}],color:"primary",fill:!1},"path43-1":{type:"path",points:[{x:-0.13,y:0.26},{x:-0.26,y:0.39}],color:"primary",fill:!1},"path44-8":{type:"path",points:[{x:-0.32,y:0.19},{x:-0.51,y:0.01}],color:"primary",fill:!1},"path44-0-7":{type:"path",points:[{x:-0.01,y:0.5},{x:-0.19,y:0.32}],color:"primary",fill:!1},"path40-4-0":{type:"path",points:[{x:0.32,y:-0.19},{x:0.13,y:-0.26}],color:"primary",fill:!1},"path41-1-2":{type:"path",points:[{x:0.26,y:-0.38},{x:0.32,y:-0.19}],color:"primary",fill:!1},"path42-7-1":{type:"path",points:[{x:0.13,y:-0.26},{x:0.26,y:-0.38}],color:"primary",fill:!1},"path43-1-8":{type:"path",points:[{x:0.39,y:-0.26},{x:0.26,y:-0.13}],color:"primary",fill:!1},"path44-8-7":{type:"path",points:[{x:0.2,y:-0.32},{x:0.01,y:-0.51}],color:"primary",fill:!1},"path44-0-7-1":{type:"path",points:[{x:0.52,y:0},{x:0.32,y:-0.19}],color:"primary",fill:!1},"path40-4-8":{type:"path",points:[{x:0.32,y:0.19},{x:0.26,y:0.38}],color:"primary",fill:!1},"path41-1-4":{type:"path",points:[{x:0.13,y:0.26},{x:0.32,y:0.19}],color:"primary",fill:!1},"path42-7-0":{type:"path",points:[{x:0.26,y:0.38},{x:0.13,y:0.26}],color:"primary",fill:!1},"path43-1-0":{type:"path",points:[{x:0.26,y:0.13},{x:0.39,y:0.26}],color:"primary",fill:!1},"path44-8-9":{type:"path",points:[{x:0.19,y:0.32},{x:0,y:0.52}],color:"primary",fill:!1},"path44-0-7-3":{type:"path",points:[{x:0.5,y:0.01},{x:0.32,y:0.19}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.29,y:-0.46},bottom1:{type:"text",text:"{VAL}",x:-0.29,y:0.5}},refblocks:{top1:{x:0,y:-0.52},bottom1:{x:0,y:0.52},left1:{x:-0.52,y:0},right1:{x:0.52,y:0}},bounds:{minX:-0.55,maxX:0.55,minY:-0.56,maxY:0.55,width:1.09,height:1.1,centerX:0,centerY:0},circles:{}},{paths:Ck,texts:dv,bounds:ic,refblocks:oc,circles:kk}=Mk,FS=Yt({primitives:[...Object.values(Ck),...Object.values(kk),{...dv.top1,anchor:"middle_right"},{...dv.bottom1,anchor:"middle_right"}],ports:[{...oc.top1,labels:["1"]},{...oc.bottom1,labels:["2"]},{...oc.left1,labels:["3"]},{...oc.right1,labels:["4"]}],size:{width:ic.width,height:ic.height},center:{x:ic.centerX,y:ic.centerY}}),au=Z(FS),Nk=au.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Yk=au.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Nk.anchor="middle_left";Yk.anchor="middle_right";var Lk=au,ll={paths:{path27:{type:"path",points:[{x:0.47,y:0.04},{x:0.21,y:0.04}],color:"primary",fill:!1},"path27-0":{type:"path",points:[{x:-0.21,y:0.04},{x:-0.47,y:0.04}],color:"primary",fill:!1},"path27-8-2-4":{type:"path",points:[{x:0.21,y:0.04},{x:0.19,y:-0.05}],color:"primary",fill:!1},"path27-8-2-4-29":{type:"path",points:[{x:-0.19,y:0.14},{x:-0.21,y:0.04}],color:"primary",fill:!1},"path27-8-2-4-5":{type:"path",points:[{x:0.19,y:-0.05},{x:0.13,y:0.14}],color:"primary",fill:!1},"path27-8-2-4-5-1":{type:"path",points:[{x:0.08,y:-0.05},{x:0.13,y:0.14}],color:"primary",fill:!1},"path27-8-2-4-5-1-9":{type:"path",points:[{x:0.08,y:-0.05},{x:0.03,y:0.14}],color:"primary",fill:!1},"path27-8-2-4-5-1-9-2":{type:"path",points:[{x:-0.03,y:-0.05},{x:0.03,y:0.14}],color:"primary",fill:!1},"path27-8-2-4-5-1-9-2-1":{type:"path",points:[{x:-0.03,y:-0.05},{x:-0.08,y:0.14}],color:"primary",fill:!1},"path27-8-2-4-5-1-9-2-1-2":{type:"path",points:[{x:-0.13,y:-0.05},{x:-0.08,y:0.14}],color:"primary",fill:!1},"path27-8-2-4-5-1-9-2-1-2-2":{type:"path",points:[{x:-0.13,y:-0.05},{x:-0.19,y:0.14}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.05,y:0.42},bottom1:{type:"text",text:"{VAL}",x:-0.04,y:-0.42}},refblocks:{left1:{x:-0.47,y:0.04},right1:{x:0.47,y:0.04}},bounds:{minX:-0.49,maxX:0.49,minY:-0.42,maxY:0.42,width:0.99,height:0.84,centerX:0,centerY:0},circles:{}},{paths:Tk,texts:pit,bounds:sc,refblocks:mv,circles:Ek}=ll,Rk=Y({primitives:[...Object.values(Tk),...Object.values(Ek),{type:"text",text:"{REF}",x:-0.2,y:0.2194553499999995},{type:"text",text:"{VAL}",x:0.2,y:0.2194553499999995}],ports:[{...mv.left1,labels:["1"]},{...mv.right1,labels:["2"]}],size:{width:sc.width,height:sc.height},center:{x:sc.centerX,y:sc.centerY}}).rotateRightFacingSymbol("down").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),{paths:Ok,texts:hit,bounds:ac,refblocks:uv,circles:Wk}=ll,$k=Y({primitives:[...Object.values(Ok),...Object.values(Wk),{type:"text",text:"{REF}",x:0,y:-0.1704553499999995},{type:"text",text:"{VAL}",x:0,y:0.2294553499999995}],ports:[{...uv.left1,labels:["1"]},{...uv.right1,labels:["2"]}],size:{width:ac.width,height:ac.height},center:{x:ac.centerX,y:ac.centerY}}).rotateRightFacingSymbol("left").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),{paths:jk,texts:dit,bounds:cc,refblocks:fv,circles:Xk}=ll,Dk=Y({primitives:[...Object.values(jk),...Object.values(Xk),{type:"text",text:"{REF}",x:0,y:0.2294553499999995},{type:"text",text:"{VAL}",x:0,y:-0.1704553499999995}],ports:[{...fv.left1,labels:["1"]},{...fv.right1,labels:["2"]}],size:{width:cc.width,height:cc.height},center:{x:cc.centerX,y:cc.centerY}}).rotateRightFacingSymbol("right").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),pl={paths:{"left-lead":{type:"path",points:[{x:-0.25,y:0},{x:-0.16,y:0}],color:"primary",fill:!1,strokeWidth:0.02},zigzag:{type:"path",points:[{x:-0.16,y:0},{x:-0.12,y:0.095},{x:-0.07,y:-0.095},{x:-0.02,y:0.095},{x:0.02,y:-0.095},{x:0.07,y:0.095},{x:0.12,y:-0.095},{x:0.16,y:0}],color:"primary",fill:!1,strokeWidth:0.02},"right-lead":{type:"path",points:[{x:0.16,y:0},{x:0.25,y:0}],color:"primary",fill:!1,strokeWidth:0.02}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25,anchor:"middle_top"}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},Vk=yt(pl,{kind:"resistor",orientation:"down"}),zk=yt(pl,{kind:"resistor",orientation:"left"}),Uk=yt(pl,{kind:"resistor",orientation:"right"}),Gk=yt(pl,{kind:"resistor",orientation:"up"}),{paths:Hk,texts:mit,bounds:lc,refblocks:yv,circles:Qk}=ll,Zk=Y({primitives:[...Object.values(Hk),...Object.values(Qk),{type:"text",text:"{REF}",x:0.2,y:-0.1404553499999995},{type:"text",text:"{VAL}",x:-0.2,y:-0.1494553499999995}],ports:[{...yv.left1,labels:["1"]},{...yv.right1,labels:["2"]}],size:{width:lc.width,height:lc.height},center:{x:lc.centerX,y:lc.centerY}}).rotateRightFacingSymbol("up").labelPort("left",["1"]).labelPort("right",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),hl={paths:{"left-lead":{type:"path",points:[{x:-0.175,y:0},{x:-0.115,y:0}],color:"primary",fill:!1,strokeWidth:0.02},zigzag:{type:"path",points:[{x:-0.115,y:0},{x:-0.07,y:0.095},{x:-0.025,y:-0.095},{x:0.025,y:0.095},{x:0.07,y:-0.095},{x:0.115,y:0}],color:"primary",fill:!1,strokeWidth:0.02},"right-lead":{type:"path",points:[{x:0.115,y:0},{x:0.175,y:0}],color:"primary",fill:!1,strokeWidth:0.02}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25,anchor:"middle_bottom"},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25,anchor:"middle_top"}},refblocks:{left1:{x:-0.175,y:0},right1:{x:0.175,y:0}},bounds:{minX:-0.175,maxX:0.175,minY:-0.25,maxY:0.25,width:0.35,height:0.5,centerX:0,centerY:0},circles:{}},qk=yt(hl,{kind:"resistor",orientation:"down"}),Jk=yt(hl,{kind:"resistor",orientation:"left"}),Kk=yt(hl,{kind:"resistor",orientation:"right"}),tN=yt(hl,{kind:"resistor",orientation:"up"}),MS={paths:{path27:{type:"path",points:[{x:0.76,y:-0.28},{x:0.31,y:-0.28}],color:"primary",fill:!1},path28:{type:"path",points:[{x:-0.3,y:-0.02},{x:-0.77,y:-0.02}],color:"primary",fill:!1},path30:{type:"path",points:[{x:-0.3,y:0.35},{x:-0.3,y:-0.28}],color:"primary",fill:!1},"path27-3":{type:"path",points:[{x:0.77,y:0.35},{x:0.32,y:0.35}],color:"primary",fill:!1},"path29-5":{type:"path",points:[{x:-0.07,y:-0.28},{x:-0.3,y:-0.28}],color:"primary",fill:!1},"path29-5-7":{type:"path",points:[{x:0.33,y:-0.28},{x:0.11,y:-0.28}],color:"primary",fill:!1},"path29-5-7-6":{type:"path",points:[{x:-0.06,y:-0.17},{x:-0.06,y:-0.39}],color:"primary",fill:!1},"path29-5-7-6-6":{type:"path",points:[{x:0.09,y:-0.17},{x:0.09,y:-0.39}],color:"primary",fill:!1},"path29-5-9":{type:"path",points:[{x:-0.07,y:0.35},{x:-0.3,y:0.35}],color:"primary",fill:!1},"path29-5-7-2":{type:"path",points:[{x:0.33,y:0.35},{x:0.11,y:0.35}],color:"primary",fill:!1},"path29-5-7-6-0":{type:"path",points:[{x:-0.06,y:0.46},{x:-0.06,y:0.24}],color:"primary",fill:!1},"path29-5-7-6-6-2":{type:"path",points:[{x:0.09,y:0.46},{x:0.09,y:0.24}],color:"primary",fill:!1},"path29-5-92":{type:"path",points:[{x:0.33,y:0.13},{x:0.33,y:0.35}],color:"primary",fill:!1},"path29-5-7-28":{type:"path",points:[{x:0.33,y:-0.28},{x:0.33,y:-0.05}],color:"primary",fill:!1},"path29-5-7-6-9":{type:"path",points:[{x:0.44,y:0.11},{x:0.22,y:0.11}],color:"primary",fill:!1},"path29-5-7-6-6-7":{type:"path",points:[{x:0.44,y:-0.04},{x:0.22,y:-0.04}],color:"primary",fill:!1},"path29-5-7-6-9-2":{type:"path",points:[{x:0.44,y:0.07},{x:0.22,y:0.07}],color:"primary",fill:!1},"path29-5-7-6-9-2-4":{type:"path",points:[{x:0.44,y:0},{x:0.44,y:0.07}],color:"primary",fill:!1},"path29-5-7-6-9-2-4-6":{type:"path",points:[{x:0.22,y:0},{x:0.22,y:0.07}],color:"primary",fill:!1},"path29-5-7-6-9-2-9":{type:"path",points:[{x:0.44,y:0},{x:0.22,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0.02,y:0.53},bottom1:{type:"text",text:"{VAL}",x:0.01,y:-0.54}},refblocks:{left1:{x:-0.77,y:-0.02},right1:{x:0.76,y:-0.28},right2:{x:0.77,y:0.35}},bounds:{minX:-0.79,maxX:0.79,minY:-0.54,maxY:0.54,width:1.59,height:1.07,centerX:0,centerY:0},circles:{}},{paths:eN,texts:_v,bounds:pc,refblocks:Kh,circles:rN}=MS,dl=Yt({primitives:[...Object.values(eN),...Object.values(rN),{..._v.top1,anchor:"middle_bottom"},{..._v.bottom1,anchor:"middle_top"}],ports:[{...Kh.left1,labels:["1"]},{...Kh.right1,labels:["2"]},{...Kh.right2,labels:["3"]}],size:{width:pc.width,height:pc.height},center:{x:pc.centerX,y:pc.centerY}}),cu=Z(dl,"down"),lu=cu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),pu=cu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");lu.anchor="middle_bottom";pu.anchor="middle_top";lu.y+=0.3;lu.x+=0.101;pu.y-=0.49999;pu.x+=1.19999;var nN=cu,{paths:iN,texts:uit,bounds:hc,refblocks:td,circles:oN}=MS,CS=Yt({primitives:[...Object.values(iN),...Object.values(oN),{type:"text",text:"{REF}",x:0.01596175000000022,y:-0.5308501500000009,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0.013116750000000454,y:0.5408501499999989,anchor:"middle_bottom"}],ports:[{...td.left1,labels:["1"]},{...td.right1,labels:["2"]},{...td.right2,labels:["3"]}],size:{width:hc.width,height:hc.height},center:{x:hc.centerX,y:hc.centerY}}),hu=Z(dl,"left"),du=hu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),mu=hu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");du.anchor="middle_bottom";mu.anchor="middle_top";du.y+=0.99;du.x-=0;mu.y-=1.10999;mu.x=0;var sN=hu,uu=Z(dl,"up"),fu=uu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),yu=uu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");fu.anchor="middle_bottom";yu.anchor="middle_top";fu.y+=0.499;fu.x=0.62;yu.y-=0.29999;yu.x+=0.1;var aN=uu,cN=Z(CS),lN={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1},"path43-7":{type:"path",points:[{x:0.21,y:0.18},{x:0.14,y:0.18}],color:"primary",fill:!1},"path43-7-9":{type:"path",points:[{x:0.21,y:0.13},{x:0.21,y:0.18}],color:"primary",fill:!1},"path43-7-2":{type:"path",points:[{x:0.08,y:-0.09},{x:0.14,y:-0.09}],color:"primary",fill:!1},"path43-7-9-3":{type:"path",points:[{x:0.08,y:-0.04},{x:0.08,y:-0.09}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},ml=Y(lN).labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{VAL}","middle_top").changeTextAnchor("{REF}","middle_bottom").build(),_u=Z(ml,"down"),gu=_u.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),xu=_u.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");gu.anchor="middle_left";xu.anchor="middle_left";gu.y+=0.3;gu.x=0.3;xu.y-=0.3;xu.x=0.3;var pN=_u,bu=Z(ml,"left"),vu=bu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Su=bu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");vu.anchor="middle_bottom";Su.anchor="middle_top";vu.y+=0.5;vu.x=0;Su.y-=0.55;Su.x=0;var hN=bu,wu=Z(ml,"up"),Au=wu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Pu=wu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Au.anchor="middle_left";Pu.anchor="middle_left";Au.y+=0.3;Au.x=0.3;Pu.y-=0.3;Pu.x=0.3;var dN=wu,kS={paths:{path11:{type:"path",points:[{x:-0.52,y:0.04},{x:-0.18,y:0.04}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.19,y:0.05},{x:0.52,y:0.05}],color:"primary",fill:!1},"path12-6":{type:"path",points:[{x:0.18,y:-0.15},{x:0.18,y:0.25}],color:"primary",fill:!1},"path12-2":{type:"path",points:[{x:0.19,y:0},{x:0.35,y:-0.14}],color:"primary",fill:!1},"path12-2-9":{type:"path",points:[{x:0.35,y:-0.14},{x:0.34,y:-0.35}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-0.17,y:0.27},{x:-0.17,y:-0.15},{x:0.18,y:0.05},{x:-0.17,y:0.27}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.22,y:0.38},bottom1:{type:"text",text:"{VAL}",x:0.11,y:-0.38}},refblocks:{bottom1:{x:0.34,y:-0.35},left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.05}},bounds:{minX:-0.55,maxX:0.55,minY:-0.38,maxY:0.38,width:1.09,height:0.77,centerX:0,centerY:0},circles:{}},{paths:fit,texts:yit,bounds:_it,refblocks:git,circles:xit}=kS,NS=Y(kS).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("bottom1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),YS=Z(NS),mN=YS.primitives.filter((t)=>t.type==="text"),LS=mN.find((t)=>t.text==="{REF}");LS.y=0;LS.anchor="middle_left";var uN=YS,TS={paths:{path44:{type:"path",points:[{x:-0.195,y:-0.025},{x:-0.45,y:-0.025}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.45,y:-0.025},{x:0.195,y:-0.025}],color:"primary",fill:!1},"path44-0-7":{type:"path",points:[{x:0.07,y:-0.025},{x:-0.07,y:-0.025}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.07,y:0.1},{x:0.07,y:-0.15}],color:"primary",fill:!0},"path2-8":{type:"path",points:[{x:-0.07,y:0.1},{x:-0.07,y:-0.15}],color:"primary",fill:!0},"path8704-1":{type:"path",points:[{x:-0.07,y:0.1},{x:-0.082252,y:0.099398},{x:-0.094386,y:0.097598},{x:-0.106286,y:0.094618},{x:-0.117835,y:0.090485},{x:-0.128925,y:0.08524},{x:-0.139446,y:0.078934},{x:-0.149299,y:0.071626},{x:-0.158388,y:0.063388},{x:-0.166626,y:0.054299},{x:-0.173934,y:0.044446},{x:-0.18024,y:0.033925},{x:-0.185485,y:0.022835},{x:-0.189618,y:0.011286},{x:-0.192598,y:-0.000614},{x:-0.194398,y:-0.012748},{x:-0.195,y:-0.025},{x:-0.194398,y:-0.037252},{x:-0.192598,y:-0.049386},{x:-0.189618,y:-0.061286},{x:-0.185485,y:-0.072835},{x:-0.18024,y:-0.083925},{x:-0.173934,y:-0.094446},{x:-0.166626,y:-0.104299},{x:-0.158388,y:-0.113388},{x:-0.149299,y:-0.121626},{x:-0.139446,y:-0.128934},{x:-0.128925,y:-0.13524},{x:-0.117835,y:-0.140485},{x:-0.106286,y:-0.144618},{x:-0.094386,y:-0.147598},{x:-0.082252,y:-0.149398},{x:-0.07,y:-0.15}],color:"primary",fill:!1},"path8704-1-7":{type:"path",points:[{x:0.07,y:0.1},{x:0.082252,y:0.099398},{x:0.094386,y:0.097598},{x:0.106286,y:0.094618},{x:0.117835,y:0.090485},{x:0.128925,y:0.08524},{x:0.139446,y:0.078934},{x:0.149299,y:0.071626},{x:0.158388,y:0.063388},{x:0.166626,y:0.054299},{x:0.173934,y:0.044446},{x:0.18024,y:0.033925},{x:0.185485,y:0.022835},{x:0.189618,y:0.011286},{x:0.192598,y:-0.000614},{x:0.194398,y:-0.012748},{x:0.195,y:-0.025},{x:0.194398,y:-0.037252},{x:0.192598,y:-0.049386},{x:0.189618,y:-0.061286},{x:0.185485,y:-0.072835},{x:0.18024,y:-0.083925},{x:0.173934,y:-0.094446},{x:0.166626,y:-0.104299},{x:0.158388,y:-0.113388},{x:0.149299,y:-0.121626},{x:0.139446,y:-0.128934},{x:0.128925,y:-0.13524},{x:0.117835,y:-0.140485},{x:0.106286,y:-0.144618},{x:0.094386,y:-0.147598},{x:0.082252,y:-0.149398},{x:0.07,y:-0.15}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.020635199999998965,y:0.15414649999999952}},refblocks:{left1:{x:-0.4458008,y:-0.025023700000000426},right1:{x:0.4458008,y:-0.02514810000000045}},bounds:{minX:-0.45,maxX:0.45,minY:-0.15,maxY:0.1,width:0.9,height:0.25,centerX:0,centerY:-0.025},circles:{}},fN=Y(TS).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),Bu=Y(TS).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),ES=Z(Bu,"left"),Iu=ES.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Iu.anchor="middle_bottom";Iu.y+=0.4;Iu.x=0;var yN=ES,RS=Z(Bu,"up"),Fu=RS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Fu.anchor="middle_left";Fu.y+=0;Fu.x=0.2;var _N=RS,OS={paths:{path44:{type:"path",points:[{x:-0.195,y:-0.025},{x:-0.45,y:-0.025}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.45,y:-0.025},{x:0.195,y:-0.025}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.07,y:0.1},{x:0.07,y:-0.15}],color:"primary",fill:!0},"path2-8":{type:"path",points:[{x:-0.07,y:0.1},{x:-0.07,y:-0.15}],color:"primary",fill:!0},"path8704-1":{type:"path",points:[{x:-0.07,y:0.1},{x:-0.082252,y:0.099398},{x:-0.094386,y:0.097598},{x:-0.106286,y:0.094618},{x:-0.117835,y:0.090485},{x:-0.128925,y:0.08524},{x:-0.139446,y:0.078934},{x:-0.149299,y:0.071626},{x:-0.158388,y:0.063388},{x:-0.166626,y:0.054299},{x:-0.173934,y:0.044446},{x:-0.18024,y:0.033925},{x:-0.185485,y:0.022835},{x:-0.189618,y:0.011286},{x:-0.192598,y:-0.000614},{x:-0.194398,y:-0.012748},{x:-0.195,y:-0.025},{x:-0.194398,y:-0.037252},{x:-0.192598,y:-0.049386},{x:-0.189618,y:-0.061286},{x:-0.185485,y:-0.072835},{x:-0.18024,y:-0.083925},{x:-0.173934,y:-0.094446},{x:-0.166626,y:-0.104299},{x:-0.158388,y:-0.113388},{x:-0.149299,y:-0.121626},{x:-0.139446,y:-0.128934},{x:-0.128925,y:-0.13524},{x:-0.117835,y:-0.140485},{x:-0.106286,y:-0.144618},{x:-0.094386,y:-0.147598},{x:-0.082252,y:-0.149398},{x:-0.07,y:-0.15}],color:"primary",fill:!1},"path8704-1-7":{type:"path",points:[{x:0.07,y:0.1},{x:0.082252,y:0.099398},{x:0.094386,y:0.097598},{x:0.106286,y:0.094618},{x:0.117835,y:0.090485},{x:0.128925,y:0.08524},{x:0.139446,y:0.078934},{x:0.149299,y:0.071626},{x:0.158388,y:0.063388},{x:0.166626,y:0.054299},{x:0.173934,y:0.044446},{x:0.18024,y:0.033925},{x:0.185485,y:0.022835},{x:0.189618,y:0.011286},{x:0.192598,y:-0.000614},{x:0.194398,y:-0.012748},{x:0.195,y:-0.025},{x:0.194398,y:-0.037252},{x:0.192598,y:-0.049386},{x:0.189618,y:-0.061286},{x:0.185485,y:-0.072835},{x:0.18024,y:-0.083925},{x:0.173934,y:-0.094446},{x:0.166626,y:-0.104299},{x:0.158388,y:-0.113388},{x:0.149299,y:-0.121626},{x:0.139446,y:-0.128934},{x:0.128925,y:-0.13524},{x:0.117835,y:-0.140485},{x:0.106286,y:-0.144618},{x:0.094386,y:-0.147598},{x:0.082252,y:-0.149398},{x:0.07,y:-0.15}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.020635199999998965,y:0.15414649999999952}},refblocks:{left1:{x:-0.44,y:-0.02},right1:{x:0.4458008,y:-0.02514810000000045}},bounds:{minX:-0.45,maxX:0.45,minY:-0.15,maxY:0.1,width:0.9,height:0.25,centerX:0,centerY:-0.025},circles:{}},gN=Y(OS).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),Mu=Y(OS).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),WS=Z(Mu,"left"),Cu=WS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Cu.anchor="middle_bottom";Cu.y+=0.4;Cu.x=0;var xN=WS,$S=Z(Mu,"up"),ku=$S.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");ku.anchor="middle_left";ku.y+=0.05;ku.x=0.2;var bN=$S,jS={paths:{path44:{type:"path",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:"primary",fill:!1},"path44-5":{type:"path",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:"primary",fill:!0},"path2-88":{type:"path",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5":{type:"path",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5-1":{type:"path",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:"primary",fill:!0},"path2-88-5-1-6":{type:"path",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-8":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:"primary",fill:!0},"path8704-1":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:"primary",fill:!1},"path8704-1-7":{type:"path",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:"primary",fill:!1},path1:{type:"path",points:[{x:-0.045,y:0.1},{x:-0.125,y:0.1}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.020635199999998965,y:0.28075747049999955}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},vN=Y(jS).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_left").build(),Nu=Y(jS).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),XS=Z(Nu,"left"),Yu=XS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Yu.anchor="middle_left";Yu.y+=0.5;Yu.x=0.2;var SN=XS,DS=Z(Nu,"up"),Lu=DS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Lu.anchor="middle_left";Lu.y+=0.3;Lu.x=0.2;var wN=DS,VS={paths:{path44:{type:"path",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:"primary",fill:!1},"path44-5":{type:"path",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:"primary",fill:!0},"path2-88":{type:"path",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5":{type:"path",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5-1":{type:"path",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:"primary",fill:!0},"path2-88-5-1-6":{type:"path",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-8":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:"primary",fill:!0},"path8704-1":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:"primary",fill:!1},"path8704-1-7":{type:"path",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:"primary",fill:!1},path1:{type:"path",points:[{x:-0.045,y:0.1},{x:-0.125,y:0.1}],color:"primary",fill:!1},"path44-0-7":{type:"path",points:[{x:0.125,y:0.1},{x:0.045,y:0.1}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.28}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},AN=Y(VS).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_left").build(),Tu=Y(VS).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),zS=Z(Tu,"left"),Eu=zS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Eu.anchor="middle_left";Eu.y+=0.5;Eu.x=0.2;var PN=zS,US=Z(Tu,"up"),Ru=US.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Ru.anchor="middle_left";Ru.y+=0.4;Ru.x=0.2;var BN=US,GS={paths:{path44:{type:"path",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:"primary",fill:!1},"path44-5":{type:"path",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:"primary",fill:!0},"path2-88":{type:"path",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5":{type:"path",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5-1":{type:"path",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:"primary",fill:!0},"path2-88-5-1-6":{type:"path",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-8":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:"primary",fill:!0},"path8704-1":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:"primary",fill:!1},"path8704-1-7":{type:"path",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:"primary",fill:!1},"path44-0-7":{type:"path",points:[{x:0.125,y:0.1},{x:0.045,y:0.1}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.28}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},IN=Y(GS).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_left").build(),Ou=Y(GS).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),HS=Z(Ou,"left"),Wu=HS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Wu.anchor="middle_left";Wu.y+=0.6;Wu.x=0.3;var FN=HS,QS=Z(Ou,"up"),$u=QS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");$u.anchor="middle_left";$u.y+=0.4;$u.x=0.2;var MN=QS,ZS={paths:{path44:{type:"path",points:[{x:-0.25,y:0.1},{x:-0.45,y:0.1}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.45,y:0.1},{x:0.25,y:0.1}],color:"primary",fill:!1},"path44-5":{type:"path",points:[{x:0,y:-0.025},{x:0,y:-0.275}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.125,y:0.225},{x:0.125,y:-0.025}],color:"primary",fill:!0},"path2-88":{type:"path",points:[{x:0.045,y:0.225},{x:0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5":{type:"path",points:[{x:-0.045,y:0.225},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-88-5-1":{type:"path",points:[{x:0.045,y:0.225},{x:-0.045,y:0.225}],color:"primary",fill:!0},"path2-88-5-1-6":{type:"path",points:[{x:0.045,y:-0.025},{x:-0.045,y:-0.025}],color:"primary",fill:!0},"path2-8":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.125,y:-0.025}],color:"primary",fill:!0},"path8704-1":{type:"path",points:[{x:-0.125,y:0.225},{x:-0.137252,y:0.224398},{x:-0.149386,y:0.222598},{x:-0.161286,y:0.219618},{x:-0.172835,y:0.215485},{x:-0.183925,y:0.21024},{x:-0.194446,y:0.203934},{x:-0.204299,y:0.196626},{x:-0.213388,y:0.188388},{x:-0.221626,y:0.179299},{x:-0.228934,y:0.169446},{x:-0.23524,y:0.158925},{x:-0.240485,y:0.147835},{x:-0.244618,y:0.136286},{x:-0.247598,y:0.124386},{x:-0.249398,y:0.112252},{x:-0.25,y:0.1},{x:-0.249398,y:0.087748},{x:-0.247598,y:0.075614},{x:-0.244618,y:0.063714},{x:-0.240485,y:0.052165},{x:-0.23524,y:0.041075},{x:-0.228934,y:0.030554},{x:-0.221626,y:0.020701},{x:-0.213388,y:0.011612},{x:-0.204299,y:0.003374},{x:-0.194446,y:-0.003934},{x:-0.183925,y:-0.01024},{x:-0.172835,y:-0.015485},{x:-0.161286,y:-0.019618},{x:-0.149386,y:-0.022598},{x:-0.137252,y:-0.024398},{x:-0.125,y:-0.025}],color:"primary",fill:!1},"path8704-1-7":{type:"path",points:[{x:0.125,y:0.225},{x:0.137252,y:0.224398},{x:0.149386,y:0.222598},{x:0.161286,y:0.219618},{x:0.172835,y:0.215485},{x:0.183925,y:0.21024},{x:0.194446,y:0.203934},{x:0.204299,y:0.196626},{x:0.213388,y:0.188388},{x:0.221626,y:0.179299},{x:0.228934,y:0.169446},{x:0.23524,y:0.158925},{x:0.240485,y:0.147835},{x:0.244618,y:0.136286},{x:0.247598,y:0.124386},{x:0.249398,y:0.112252},{x:0.25,y:0.1},{x:0.249398,y:0.087748},{x:0.247598,y:0.075614},{x:0.244618,y:0.063714},{x:0.240485,y:0.052165},{x:0.23524,y:0.041075},{x:0.228934,y:0.030554},{x:0.221626,y:0.020701},{x:0.213388,y:0.011612},{x:0.204299,y:0.003374},{x:0.194446,y:-0.003934},{x:0.183925,y:-0.01024},{x:0.172835,y:-0.015485},{x:0.161286,y:-0.019618},{x:0.149386,y:-0.022598},{x:0.137252,y:-0.024398},{x:0.125,y:-0.025}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.020635199999998965,y:0.28075747049999955}},refblocks:{left1:{x:-0.45,y:0.1},right1:{x:0.45,y:0.1},bottom1:{x:0,y:-0.275}},bounds:{minX:-0.45,maxX:0.45,minY:-0.28,maxY:0.28,width:0.9,height:0.56,centerX:0,centerY:0},circles:{}},CN=Y(ZS).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_left").build(),ju=Y(ZS).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("bottom1",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),qS=Z(ju,"left"),Xu=qS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Xu.anchor="middle_left";Xu.y+=0.5;Xu.x=0.3;var kN=qS,JS=Z(ju,"up"),Du=JS.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");Du.anchor="middle_left";Du.y+=0.3;Du.x=0.2;var NN=JS,YN={paths:{path1:{type:"path",points:[{x:-0.37,y:0.03},{x:-0.13,y:0.03}],color:"primary",fill:!1},"path-1-3":{type:"path",points:[{x:-0.07,y:0.03},{x:0.11,y:-0.03}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.1,y:-0.06},{x:0.37,y:-0.06}],color:"primary",fill:!1},path3:{type:"path",points:[{x:0.12,y:0.17},{x:0.37,y:0.17}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.37},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.37}},refblocks:{left1:{x:-0.37,y:0.03},right1:{x:0.37,y:-0.06},right2:{x:0.37,y:0.17}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.79,height:0.79,centerX:0,centerY:0},circles:{"circle-3":{type:"circle",x:0.08,y:-0.07,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.1,y:0.03,radius:0.02,color:"primary",fill:!1},"circle-2":{type:"circle",x:0.08,y:0.17,radius:0.02,color:"primary",fill:!1}}},ul=Y(YN).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right2",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),Vu=Z(ul,"down"),zu=Vu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Uu=Vu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");zu.anchor="middle_bottom";Uu.anchor="middle_top";zu.x=0.44;zu.y+=0.28;Uu.y-=0.28;Uu.x=0.44;var LN=Vu,Gu=Z(ul,"left"),Hu=Gu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Qu=Gu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Hu.anchor="middle_bottom";Qu.anchor="middle_top";Hu.x=0;Hu.y+=0.625;Qu.y-=0.695;Qu.x=0;var TN=Gu,Zu=Z(ul,"up"),qu=Zu.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Ju=Zu.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");qu.anchor="middle_bottom";Ju.anchor="middle_top";qu.x=0.4;qu.y+=0.28;Ju.y-=0.28;Ju.x=0.4;var EN=Zu,RN={paths:{path1:{type:"path",points:[{x:-0.37,y:0.03},{x:-0.13,y:0.03}],color:"primary",fill:!1},"path-1-3":{type:"path",points:[{x:-0.07,y:0.03},{x:0.11,y:0.14}],color:"primary",fill:!1},path2:{type:"path",points:[{x:0.1,y:-0.06},{x:0.37,y:-0.06}],color:"primary",fill:!1},path3:{type:"path",points:[{x:0.12,y:0.17},{x:0.37,y:0.17}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.4},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.4}},refblocks:{left1:{x:-0.37,y:0.03},right1:{x:0.37,y:-0.06},right3:{x:0.37,y:0.17}},bounds:{minX:-0.4,maxX:0.4,minY:-0.4,maxY:0.4,width:0.79,height:0.79,centerX:0,centerY:0},circles:{"circle-3":{type:"circle",x:0.08,y:-0.07,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.1,y:0.03,radius:0.02,color:"primary",fill:!1},"circle-2":{type:"circle",x:0.08,y:0.17,radius:0.02,color:"primary",fill:!1}}},fl=Y(RN).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right3",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),Ku=Z(fl,"down"),tf=Ku.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),ef=Ku.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");tf.anchor="middle_bottom";ef.anchor="middle_top";tf.x=0.44;tf.y+=0.28;ef.y-=0.28;ef.x=0.44;var ON=Ku,rf=Z(fl,"left"),nf=rf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),of=rf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");nf.anchor="middle_bottom";of.anchor="middle_top";nf.x=0;nf.y+=0.625;of.y-=0.695;of.x=0;var WN=rf,sf=Z(fl,"up"),af=sf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),cf=sf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");af.anchor="middle_bottom";cf.anchor="middle_top";af.x=0.4;af.y+=0.28;cf.y-=0.28;cf.x=0.4;var $N=sf,Yi={paths:{"lead-positive":{type:"path",points:[{x:-0.4,y:0.19999999999999996},{x:-0.20000000000000007,y:0.19999999999999996}],color:"primary",fill:!1},"lead-negative":{type:"path",points:[{x:-0.4,y:-0.20000000000000018},{x:-0.20000000000000007,y:-0.20000000000000018}],color:"primary",fill:!1},"voice-coil":{type:"path",points:[{x:-0.20000000000000007,y:0.19999999999999996},{x:0,y:0.19999999999999996},{x:0,y:-0.20000000000000018},{x:-0.20000000000000007,y:-0.20000000000000018},{x:-0.20000000000000007,y:0.19999999999999996}],color:"primary",fill:!1},cone:{type:"path",points:[{x:0,y:0.19999999999999996},{x:0.3999999999999999,y:0.3999999999999999},{x:0.3999999999999999,y:-0.40000000000000013},{x:0,y:-0.20000000000000018},{x:0,y:0.19999999999999996}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.6},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.6000000000000001}},refblocks:{left1:{x:-0.4,y:-0.20000000000000018},left2:{x:-0.4,y:0.19999999999999996}},bounds:{minX:-0.4,maxX:0.3999999999999999,minY:-0.6000000000000001,maxY:0.6,width:0.7999999999999999,height:1.2000000000000002,centerX:-0.00000000000000005551115123125783,centerY:-0.00000000000000005551115123125783},circles:{}},KS=Y(Yi).rotateRightFacingSymbol("down").labelPort("left1",["2","neg"]).labelPort("left2",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),dc=He(KS.primitives),jN={...KS,center:{x:(dc.minX+dc.maxX)/2,y:(dc.minY+dc.maxY)/2}},tw=Y(Yi).rotateRightFacingSymbol("right").labelPort("left1",["2","neg"]).labelPort("left2",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),mc=He(tw.primitives),XN={...tw,center:{x:(mc.minX+mc.maxX)/2,y:(mc.minY+mc.maxY)/2}},ew=Y(Yi).rotateRightFacingSymbol("left").labelPort("left1",["2","neg"]).labelPort("left2",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),uc=He(ew.primitives),DN={...ew,center:{x:(uc.minX+uc.maxX)/2,y:(uc.minY+uc.maxY)/2}},rw=Y(Yi).rotateRightFacingSymbol("right").labelPort("left1",["2","neg"]).labelPort("left2",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),fc=He(rw.primitives),VN={...rw,center:{x:(fc.minX+fc.maxX)/2,y:(fc.minY+fc.maxY)/2}},nw=Y(Yi).rotateRightFacingSymbol("up").labelPort("left1",["2","neg"]).labelPort("left2",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),yc=He(nw.primitives),zN={...nw,center:{x:(yc.minX+yc.maxX)/2,y:(yc.minY+yc.maxY)/2}},iw=Y(Yi).rotateRightFacingSymbol("up").labelPort("left1",["2","neg"]).labelPort("left2",["1","pos"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),_c=He(iw.primitives),UN={...iw,center:{x:(_c.minX+_c.maxX)/2,y:(_c.minY+_c.maxY)/2}},yl={paths:{path11:{type:"path",points:[{x:-0.38,y:0},{x:-0.12,y:-0.01}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-0.07,y:0},{x:0.11,y:0.05}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.12,y:-0.01},{x:0.38,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.31},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.28}},refblocks:{left1:{x:-0.12,y:-0.01},left2:{x:-0.38,y:0},right1:{x:0.12,y:-0.01},right2:{x:0.38,y:0}},bounds:{minX:-0.4,maxX:0.4,minY:-0.25,maxY:0.25,width:0.81,height:0.5,centerX:0,centerY:0},circles:{"circle-2":{type:"circle",x:0.1,y:0,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.1,y:0,radius:0.02,color:"primary",fill:!1}}};delete yl.refblocks.left1;delete yl.refblocks.right1;yl.bounds.width+=0.2;var _l=Y(yl).changeTextAnchor("{VAL}","middle_top").labelPort("left2",["1"]).labelPort("right2",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),lf=Z(_l,"down"),pf=lf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),hf=lf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");pf.anchor="middle_bottom";hf.anchor="middle_top";pf.x=0.3;pf.y+=0.265;hf.y-=0.265;hf.x=0.3;var GN=lf,df=Z(_l,"left"),mf=df.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),uf=df.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");mf.anchor="middle_bottom";uf.anchor="middle_top";mf.x=0;mf.y+=0.57;uf.y-=0.57;uf.x=0;var HN=df,ff=Z(_l,"up"),yf=ff.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),_f=ff.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");yf.anchor="middle_bottom";_f.anchor="middle_top";yf.x=0.3;yf.y+=0.265;_f.y-=0.265;_f.x=0.3;var QN=ff,gl={paths:{path11:{type:"path",points:[{x:-0.38,y:0},{x:-0.12,y:-0.01}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-0.07,y:0.01},{x:0.1,y:0.14}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.12,y:-0.01},{x:0.38,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25}},refblocks:{left1:{x:-0.12,y:-0.01},left2:{x:-0.38,y:0},right1:{x:0.12,y:-0.01},right2:{x:0.38,y:0}},bounds:{minX:-0.4,maxX:0.4,minY:-0.25,maxY:0.25,width:0.81,height:0.5,centerX:0,centerY:0},circles:{"circle-2":{type:"circle",x:0.1,y:0,radius:0.02,color:"primary",fill:!1},"circle-1":{type:"circle",x:-0.1,y:0,radius:0.02,color:"primary",fill:!1}}};delete gl.refblocks.left1;delete gl.refblocks.right1;gl.bounds.width+=0.2;var xl=Y(gl).changeTextAnchor("{VAL}","middle_top").labelPort("left2",["1"]).labelPort("right2",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),gf=Z(xl,"down"),xf=gf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),bf=gf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");xf.anchor="middle_bottom";bf.anchor="middle_top";xf.x=0.3;xf.y+=0.265;bf.y-=0.265;bf.x=0.3;var ZN=gf,vf=Z(xl,"left"),Sf=vf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),wf=vf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Sf.anchor="middle_bottom";wf.anchor="middle_top";Sf.x=0;Sf.y+=0.57;wf.y-=0.57;wf.x=0;var qN=vf,Af=Z(xl,"up"),Pf=Af.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Bf=Af.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Pf.anchor="middle_bottom";Bf.anchor="middle_top";Pf.x=0.3;Pf.y+=0.265;Bf.y-=0.265;Bf.x=0.3;var JN=Af,bl={paths:{path44:{type:"path",points:[{x:-0.16845120000000047,y:0.02621170000000017},{x:-0.4458008,y:0.02709619999999968}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.4458008,y:0.026971799999999657},{x:0.1677968999999997,y:0.027926399999999685}],color:"primary",fill:!1},"path8704-1":{type:"path",points:[{x:-0.0040837000000002455,y:-0.13467459999999964},{x:-0.0040837000000002455,y:-0.13467459999999964},{x:-0.017668143940740948,y:-0.1311205263185182},{x:-0.03043520885925943,y:-0.12727072121481456},{x:-0.04240966440000013,y:-0.1231399985999998},{x:-0.05361628020740751,y:-0.11874317238518502},{x:-0.064079825925926,y:-0.11409505648148131},{x:-0.07382507120000005,y:-0.10921046479999987},{x:-0.0828767856740741,y:-0.10410421125185171},{x:-0.0912597389925926,y:-0.09879110974814802},{x:-0.09899870079999995,y:-0.0932859741999998},{x:-0.10611844074074069,y:-0.08760361851851838},{x:-0.11264372845925916,y:-0.0817588566148146},{x:-0.11859933359999993,y:-0.07576650239999982},{x:-0.12401002580740728,y:-0.06964136978518495},{x:-0.12890057472592584,y:-0.06339827268148127},{x:-0.13329574999999985,y:-0.05705202499999972},{x:-0.13722032127407394,y:-0.05061744065185156},{x:-0.14069905819259243,y:-0.04410933354814783},{x:-0.14375673039999987,y:-0.03754251759999966},{x:-0.14641810754074058,y:-0.030931806718518143},{x:-0.1487079592592591,y:-0.0242920148148144},{x:-0.15065105519999983,y:-0.017637955799999563},{x:-0.15227216500740723,y:-0.01098444358518472},{x:-0.15359605832592574,y:-0.004346292081480994},{x:-0.1546475047999998,y:0.00226168480000051},{x:-0.15545127407407386,y:0.008824673148148676},{x:-0.1560321357925924,y:0.015327859051852397},{x:-0.1564148595999998,y:0.02175642860000056},{x:-0.1566242151407405,y:0.028095567881482052},{x:-0.15668497205925902,y:0.03433046298518576},{x:-0.15662189999999976,y:0.04044630000000058},{x:-0.15662189999999976,y:0.0404463000000006},{x:-0.15662189999999976,y:0.0404463000000006},{x:-0.15622857394444417,y:0.04717166472222282},{x:-0.1553217675555553,y:0.05388046444444503},{x:-0.15392183849999977,y:0.060558907500000585},{x:-0.1520491444444442,y:0.0671932022222228},{x:-0.1497240430555553,y:0.07376955694444502},{x:-0.14696689199999974,y:0.08027418000000058},{x:-0.14379804894444415,y:0.0866932797222228},{x:-0.1402378715555553,y:0.09301306444444506},{x:-0.13630671749999965,y:0.09921974250000057},{x:-0.13202494444444415,y:0.10529952222222282},{x:-0.12741291005555522,y:0.11123861194444501},{x:-0.1224909719999997,y:0.1170232200000006},{x:-0.11727948794444407,y:0.12263955472222278},{x:-0.11179881555555524,y:0.12807382444444504},{x:-0.10606931249999965,y:0.13331223750000057},{x:-0.1001113364444441,y:0.13834100222222284},{x:-0.09394524505555521,y:0.14314632694444504},{x:-0.08759139599999967,y:0.14771442000000062},{x:-0.08107014694444413,y:0.15203148972222283},{x:-0.07440185555555523,y:0.15608374444444503},{x:-0.0676068794999997,y:0.15985739250000058},{x:-0.06070557644444415,y:0.16333864222222283},{x:-0.05371830405555529,y:0.16651370194444504},{x:-0.04666541999999976,y:0.1693687800000006},{x:-0.03956728194444424,y:0.1718900847222228},{x:-0.03244424755555539,y:0.17406382444444501},{x:-0.025316674499999876,y:0.17587620750000055},{x:-0.01820492044444437,y:0.17731344222222278},{x:-0.01112934305555553,y:0.178361736944445},{x:-0.004110300000000034,y:0.17900730000000054},{x:-0.004110300000000011,y:0.17900730000000054}],color:"primary",fill:!1},"path8704-1-9":{type:"path",points:[{x:0.004158700000000071,y:-0.1355885000000001},{x:0.004158700000000071,y:-0.1355885000000001},{x:0.017743143940740766,y:-0.1320344263185187},{x:0.03051020885925925,y:-0.12818462121481505},{x:0.042484664399999955,y:-0.12405389860000024},{x:0.053691280207407335,y:-0.11965707238518546},{x:0.0641548259259258,y:-0.11500895648148178},{x:0.07390007119999986,y:-0.1101243648000003},{x:0.0829517856740739,y:-0.10501811125185218},{x:0.0913347389925924,y:-0.09970500974814848},{x:0.09907370079999973,y:-0.09419987420000027},{x:0.10619344074074046,y:-0.08851751851851883},{x:0.11271872845925893,y:-0.08267275661481507},{x:0.11867433359999968,y:-0.07668040240000029},{x:0.12408502580740703,y:-0.0705552697851854},{x:0.12897557472592555,y:-0.06431217268148172},{x:0.13337074999999957,y:-0.05796592500000018},{x:0.13729532127407365,y:-0.05153134065185202},{x:0.14077405819259214,y:-0.045023233548148286},{x:0.14383173039999952,y:-0.038456417600000126},{x:0.14649310754074024,y:-0.03184570671851861},{x:0.14878295925925875,y:-0.02520591481481487},{x:0.1507260551999995,y:-0.01855185580000003},{x:0.15234716500740686,y:-0.011898343585185192},{x:0.15367105832592537,y:-0.005260192081481464},{x:0.15472250479999944,y:0.001347784800000043},{x:0.1555262740740735,y:0.007910773148148207},{x:0.156107135792592,y:0.01441395905185193},{x:0.1564898595999994,y:0.020842528600000094},{x:0.15669921514074014,y:0.02718166788148159},{x:0.15675997205925862,y:0.03341656298518529},{x:0.15669689999999936,y:0.03953240000000011},{x:0.15669689999999936,y:0.039532400000000134},{x:0.15669689999999936,y:0.039532400000000134},{x:0.1563035739444438,y:0.04625776472222235},{x:0.15539676755555493,y:0.05296656444444457},{x:0.15399683849999934,y:0.05964500750000013},{x:0.1521241444444438,y:0.06627930222222234},{x:0.14979904305555491,y:0.07285565694444456},{x:0.14704189199999937,y:0.07936028000000013},{x:0.1438730489444438,y:0.08577937972222234},{x:0.1403128715555549,y:0.09209916444444458},{x:0.13638171749999925,y:0.0983058425000001},{x:0.13209994444444376,y:0.10438562222222235},{x:0.12748791005555482,y:0.11032471194444453},{x:0.12256597199999929,y:0.11610932000000013},{x:0.1173544879444437,y:0.1217256547222223},{x:0.11187381555555485,y:0.12715992444444457},{x:0.10614431249999925,y:0.1323983375000001},{x:0.10018633644444369,y:0.13742710222222235},{x:0.09402024505555481,y:0.14223242694444457},{x:0.08766639599999927,y:0.14680052000000016},{x:0.08114514694444372,y:0.15111758972222236},{x:0.07447685555555483,y:0.15516984444444457},{x:0.06768187949999929,y:0.15894349250000012},{x:0.06078057644444377,y:0.16242474222222236},{x:0.053793304055554894,y:0.16559980194444457},{x:0.046740419999999366,y:0.16845488000000014},{x:0.039642281944443844,y:0.17097618472222234},{x:0.03251924755555499,y:0.17314992444444455},{x:0.02539167449999948,y:0.17496230750000008},{x:0.018279920444443973,y:0.17639954222222232},{x:0.011204343055555134,y:0.17744783694444452},{x:0.004185299999999637,y:0.17809340000000007},{x:0.004185299999999614,y:0.17809340000000007}],color:"primary",fill:!1},path4:{type:"path",points:[{x:-0.08039130000000005,y:0.0179576999999993},{x:-0.08039130000000005,y:0.09650599999999931}],color:"primary",fill:!0},"path4-5":{type:"path",points:[{x:0.01494479999999987,y:-0.055216500000000224},{x:0.01494479999999987,y:0.09691909999999937}],color:"primary",fill:!0},"path4-5-8":{type:"path",points:[{x:0.06871169999999927,y:-0.056870000000000864},{x:0.06871169999999927,y:0.018784499999999538}],color:"primary",fill:!0},"path4-1":{type:"path",points:[{x:-0.08179359999999969,y:0.09650570000000003},{x:0.015771699999999722,y:0.09650570000000003}],color:"primary",fill:!0},"path4-1-6":{type:"path",points:[{x:0.0117995999999998,y:-0.05594970000000088},{x:0.06843709999999925,y:-0.05594970000000088}],color:"primary",fill:!0},"rect1577-4":{type:"path",points:[{x:-0.17162450000000073,y:0.11125030000000025},{x:-0.2688274000000015,y:0.11125030000000025},{x:-0.2688274000000015,y:0.11469129999999961},{x:-0.17162450000000073,y:0.11469129999999961}],color:"primary",fill:!0},"rect1577-4-7":{type:"path",points:[{x:-0.2184661999999995,y:0.16159429999999997},{x:-0.2184661999999995,y:0.06439139999999943},{x:-0.22190719999999908,y:0.06439139999999943},{x:-0.22190719999999908,y:0.16159429999999997}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.0024445000000006267,y:0.23933980000000044},bottom1:{type:"text",text:"{VAL}",x:0.00341719999999901,y:-0.23933980000000066}},refblocks:{left1:{x:-0.4458008,y:0.02709619999999968},right1:{x:0.4458008,y:0.026971799999999657}},bounds:{minX:-0.473959241,maxX:0.473959241,minY:-0.23933980000000066,maxY:0.23933980000000044,width:0.947918482,height:0.4786796000000011,centerX:0,centerY:-0.00000000000000011102230246251565},circles:{}},KN=Y(bl).rotateRightFacingSymbol("down").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","middle_left",{x:0.02,y:0.2}).changeTextAnchor("{VAL}","middle_left",{x:0.5,y:-0.2}).build(),tY=Y(bl).rotateRightFacingSymbol("left").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","middle_bottom",{x:0,y:0.45}).changeTextAnchor("{VAL}","middle_top",{x:0,y:-0.55}).build(),eY=Y(bl).rotateRightFacingSymbol("right").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),rY=Y(bl).rotateRightFacingSymbol("up").labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{VAL}","middle_left",{x:0.02,y:-0.2}).changeTextAnchor("{REF}","middle_left",{x:0.5,y:0.2}).build(),ow={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1},"path43-5":{type:"path",points:[{x:0.19,y:-0.09},{x:0.15,y:-0.09}],color:"primary",fill:!1},"path43-5-2":{type:"path",points:[{x:0.19,y:-0.14},{x:0.19,y:-0.09}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:bit,texts:vit,bounds:Sit,refblocks:wit,circles:Ait}=ow,sw=Y(ow).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),nY=Z(sw),iY={paths:{path11:{type:"path",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0},{x:0.54,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.18,y:-0.36},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.43},left1:{type:"text",text:"RPM",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:-0.01,y:-0.01,radius:0.29,color:"primary",fill:!1}}},{paths:oY,texts:sY,bounds:gc,refblocks:gv,circles:aY}=iY,If=Yt({primitives:[...Object.values(oY),...Object.values(aY),{type:"text",text:"{REF}",x:0,y:-0.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:0.35,anchor:"middle_bottom"},{...sY.left1,y:0.01,anchor:"center",fontSize:0.2}],ports:[{...gv.left1,labels:["1"]},{...gv.right1,labels:["2"]}],size:{width:gc.width,height:gc.height},center:{x:gc.centerX,y:gc.centerY}}),{5:cY,...lY}=If.primitives;function pY(t){return typeof t=="object"}var xv=Z({...If,primitives:Object.values(lY).filter(pY)}),hY={...xv,primitives:[...xv.primitives,cY]},vl=Yt({primitives:[{type:"path",points:[{x:-0.2,y:0},{x:0,y:0}],color:"primary",fill:!1},{type:"path",points:Array.from({length:32},(t,e)=>{let r=Math.PI/2-e*Math.PI/31,n=0.1;return{x:0.1-n*Math.cos(r),y:n*Math.sin(r)}}),color:"primary",fill:!1},{type:"text",text:"{REF}",x:0.125,y:0,anchor:"middle_left"}],ports:[{x:-0.2,y:0,labels:["1"]}],center:{x:0,y:0}}),aw=Z(vl,"down"),bv=aw.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");bv&&(bv.anchor="middle_top");var dY=aw,mY=Z(vl,"left"),cw=Z(vl,"up"),vv=cw.primitives.find((t)=>t.type==="text"&&t.text==="{REF}");vv&&(vv.anchor="middle_bottom");var uY=cw,fY={paths:{path40:{type:"path",points:[{x:0.44,y:0.04},{x:0.19,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:0.19,y:0.18},{x:0.44,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:0.19,y:-0.09},{x:0.19,y:0.18}],color:"primary",fill:!1},path44:{type:"path",points:[{x:0.19,y:0.04},{x:-0.11,y:0.04}],color:"primary",fill:!1},path45:{type:"path",points:[{x:-0.43,y:0.22},{x:-0.11,y:0.04}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{right1:{x:-0.43,y:0.22}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},Ff=Y(fY).labelPort("right1",["1"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),Mf=Z(Ff,"up"),Cf=Mf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),kf=Mf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Cf.anchor="middle_bottom";kf.anchor="middle_top";Cf.x=0.4;Cf.y+=0.2;kf.y-=0.3;kf.x=0.4;var lw=Mf,Nf=Si(lw),Yf=Nf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Lf=Nf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Yf.anchor="middle_bottom";Lf.anchor="middle_top";Yf.x=0.35;Yf.y+=0.4;Lf.y-=0.4;Lf.x=0.35;var yY=Nf,Tf=Z(Ff,"left"),Ef=Tf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),Rf=Tf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");Ef.anchor="middle_bottom";Rf.anchor="middle_top";Ef.x=0;Ef.y+=0.5;Rf.y-=0.6;Rf.x=0;var _Y=Tf,pw={paths:{path11:{type:"path",points:[{x:-0.54,y:0.04},{x:-0.11,y:0.04}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.1,y:0.04},{x:0.54,y:0.04}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-0.09,y:-0.15},{x:-0.09,y:0.26}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:0.09,y:-0.15},{x:0.09,y:0.26}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-0.08,y:0.06},{x:-0.08,y:-0.15},{x:0.09,y:-0.05},{x:-0.08,y:0.06}],color:"primary",fill:!0},"path11-0-9-0":{type:"path",points:[{x:0.08,y:0.26},{x:0.08,y:0.05},{x:-0.09,y:0.15},{x:0.07,y:0.26}],color:"primary",fill:!0},"path12-2":{type:"path",points:[{x:0.09,y:-0.06},{x:0.27,y:-0.17}],color:"primary",fill:!1},"path12-2-9":{type:"path",points:[{x:0.27,y:-0.18},{x:0.27,y:-0.31}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0.01,y:0.42},bottom1:{type:"text",text:"{VAL}",x:-0.03,y:-0.42}},refblocks:{bottom1:{x:0.27,y:-0.31},left1:{x:-0.54,y:0.04},right1:{x:0.54,y:0.04}},bounds:{minX:-0.57,maxX:0.57,minY:-0.42,maxY:0.42,width:1.14,height:0.83,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0.05,radius:0.29,color:"primary",fill:!1}}},{paths:Pit,texts:Bit,bounds:Iit,refblocks:Fit,circles:Mit}=pw,hw=Y(pw).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("bottom1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),dw=Z(hw),mw=dw.primitives.filter((t)=>t.type==="text"),gY=mw.find((t)=>t.text==="{REF}"),xY=mw.find((t)=>t.text==="{VAL}");gY.y=0;xY.y=0;var bY=dw,vY={paths:{path40:{type:"path",points:[{x:0.14,y:0.04},{x:-0.12,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.12,y:0.18},{x:0.14,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.12,y:-0.09},{x:-0.12,y:0.18}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.14,y:0.18},{x:0.14,y:-0.09}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.12,y:0.04},{x:-0.52,y:0.04}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.52,y:0.04},{x:0.15,y:0.04}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:0.14,y:0.18},{x:0.08,y:0.18}],color:"primary",fill:!1},"path43-8-8":{type:"path",points:[{x:0.14,y:-0.09},{x:0.08,y:-0.09}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:SY,texts:Sv,bounds:xc,refblocks:wv,circles:wY}=vY,uw=Yt({primitives:[...Object.values(SY),...Object.values(wY),{...Sv.top1,anchor:"middle_bottom"},{...Sv.bottom1,anchor:"middle_top"}],ports:[{...wv.left1,labels:["1"]},{...wv.right1,labels:["2"]}],size:{width:xc.width,height:xc.height},center:{x:xc.centerX,y:xc.centerY}}),Of=Z(uw),AY=Of.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),PY=Of.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");AY.anchor="middle_left";PY.anchor="middle_right";var BY=Of,IY={paths:{path11:{type:"path",points:[{x:-0.34,y:0.22},{x:-0.02,y:0.01}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.23,y:0.13},{x:0.23,y:0.4}],color:"primary",fill:!1},"path12-2":{type:"path",points:[{x:0.23,y:-0.08},{x:0.23,y:-0.35}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-0.01,y:-0.18},{x:-0.01,y:0.23}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:0.23,y:0.12},{x:-0.01,y:0.12}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-0.11,y:0.13},{x:-0.17,y:0.04},{x:-0.06,y:0.03},{x:-0.11,y:0.13}],color:"primary",fill:!0},"path11-0-3-8":{type:"path",points:[{x:0.23,y:-0.08},{x:-0.01,y:-0.08}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.2,y:0.39},bottom1:{type:"text",text:"{VAL}",x:-0.03,y:-0.42}},refblocks:{top1:{x:0.23,y:0.4},bottom1:{x:0.23,y:-0.35},left1:{x:-0.34,y:0.22}},bounds:{minX:-0.37,maxX:0.37,minY:-0.42,maxY:0.42,width:0.74,height:0.85,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0.08,y:0.01,radius:0.29,color:"primary",fill:!1}}},{paths:FY,texts:Av,bounds:bc,refblocks:ed,circles:MY}=IY,fw=Yt({primitives:[...Object.values(FY),...Object.values(MY),{...Av.top1,anchor:"middle_left"},{...Av.bottom1,anchor:"middle_right"}],ports:[{...ed.top1,labels:["1"]},{...ed.bottom1,labels:["2"]},{...ed.left1,labels:["3"]}],size:{width:bc.width,height:bc.height},center:{x:bc.centerX,y:bc.centerY}}),yw=Z(fw),_w=yw.primitives.filter((t)=>t.type==="text"),CY=_w.find((t)=>t.text==="{REF}");CY.y=0.1;var gw=_w.find((t)=>t.text==="{VAL}");gw.y=0.1;gw.x=-0.4;var kY=yw,NY={paths:{capsule_outer:{type:"path",points:[{x:-0.44,y:0.34},{x:-0.45,y:0.39},{x:-0.46,y:0.42},{x:-0.49,y:0.44},{x:-0.52,y:0.46},{x:-0.56,y:0.46},{x:-0.6,y:0.46},{x:-0.63,y:0.44},{x:-0.65,y:0.42},{x:-0.67,y:0.39},{x:-0.68,y:0.34},{x:-0.68,y:-0.34},{x:-0.67,y:-0.39},{x:-0.65,y:-0.42},{x:-0.63,y:-0.44},{x:-0.6,y:-0.45},{x:-0.56,y:-0.46},{x:-0.52,y:-0.45},{x:-0.49,y:-0.44},{x:-0.46,y:-0.42},{x:-0.45,y:-0.39},{x:-0.44,y:-0.34},{x:-0.44,y:0.34}],color:"primary",fill:!1},capsule_inner:{type:"path",points:[{x:-0.51,y:0.28},{x:-0.52,y:0.32},{x:-0.53,y:0.34},{x:-0.56,y:0.35},{x:-0.57,y:0.35},{x:-0.58,y:0.34},{x:-0.6,y:0.32},{x:-0.61,y:0.28},{x:-0.61,y:-0.28},{x:-0.6,y:-0.32},{x:-0.58,y:-0.34},{x:-0.57,y:-0.35},{x:-0.56,y:-0.35},{x:-0.53,y:-0.34},{x:-0.52,y:-0.32},{x:-0.51,y:-0.28},{x:-0.51,y:0.28}],color:"primary",fill:!0},usb_vertical:{type:"path",points:[{x:0.1,y:-0.4},{x:0.1,y:0.4}],color:"primary",fill:!1},usb_left_branch:{type:"path",points:[{x:0.1,y:-0.1},{x:-0.03,y:0.05},{x:-0.03,y:0.15}],color:"primary",fill:!1},usb_right_branch:{type:"path",points:[{x:0.1,y:0},{x:0.25,y:0.15},{x:0.25,y:0.25}],color:"primary",fill:!1},usb_arrow:{type:"path",points:[{x:0.05,y:0.4},{x:0.1,y:0.5},{x:0.15,y:0.4},{x:0.05,y:0.4}],color:"primary",fill:!0},usb_square:{type:"path",points:[{x:0.2,y:0.25},{x:0.3,y:0.25},{x:0.3,y:0.35},{x:0.2,y:0.35},{x:0.2,y:0.25}],color:"primary",fill:!0}},circles:{usb_base:{type:"circle",x:0.1,y:-0.4,radius:0.07,color:"primary",fill:!0},usb_tip_circle:{type:"circle",x:-0.03,y:0.15,radius:0.04,color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-0.25,y:0.7}},refblocks:{},bounds:{minX:-0.75,maxX:0.35,minY:-0.6,maxY:0.75,width:1.1,height:1.35,centerX:-0.2,centerY:0.08}},YY=Y(NY).changeTextAnchor("{REF}","middle_bottom").build(),LY={paths:{path11:{type:"path",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0},{x:0.54,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.18,y:-0.36},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.43},left1:{type:"text",text:"Var",x:-0.19,y:0.07}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:-0.01,y:-0.01,radius:0.29,color:"primary",fill:!1}}},{paths:TY,texts:rd,bounds:vc,refblocks:Pv,circles:EY}=LY,xw=Yt({primitives:[...Object.values(TY),...Object.values(EY),{...rd.top1,x:0,y:-0.3594553499999995,anchor:"middle_top"},{...rd.bottom1,x:0,y:0.35,anchor:"middle_bottom"},{...rd.left1,x:-0.02,y:0.01,fontSize:0.2,anchor:"center"}],ports:[{...Pv.left1,labels:["1"]},{...Pv.right1,labels:["2"]}],size:{width:vc.width,height:vc.height},center:{x:vc.centerX,y:vc.centerY}}),RY=Z(xw),OY={paths:{path40:{type:"path",points:[{x:0.08,y:0.04},{x:-0.18,y:-0.09}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.18,y:0.18},{x:0.08,y:0.04}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.18,y:-0.09},{x:-0.18,y:0.18}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.09,y:0.17},{x:0.1,y:-0.09}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.2,y:0.04},{x:-0.52,y:0.04}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.52,y:0.04},{x:0.21,y:0.04}],color:"primary",fill:!1},"path43-6":{type:"path",points:[{x:0.19,y:0.17},{x:0.19,y:-0.09}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.01,y:0.27},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.27}},refblocks:{left1:{x:-0.52,y:0.04},right1:{x:0.52,y:0.04}},bounds:{minX:-0.55,maxX:0.55,minY:-0.27,maxY:0.27,width:1.09,height:0.55,centerX:0,centerY:0},circles:{}},{paths:WY,texts:Bv,bounds:Sc,refblocks:Iv,circles:$Y}=OY,bw=Yt({primitives:[...Object.values(WY),...Object.values($Y),{...Bv.top1,anchor:"middle_bottom"},{...Bv.bottom1,anchor:"middle_top"}],ports:[{...Iv.left1,labels:["1"]},{...Iv.right1,labels:["2"]}],size:{width:Sc.width,height:Sc.height},center:{x:Sc.centerX,y:Sc.centerY}}),Wf=Z(bw),jY=Wf.primitives.find((t)=>t.type==="text"&&t.text==="{REF}"),XY=Wf.primitives.find((t)=>t.type==="text"&&t.text==="{VAL}");jY.anchor="middle_left";XY.anchor="middle_right";var DY=Wf,VY={paths:{path5:{type:"path",points:[{x:-0.54,y:0},{x:-0.26,y:0}],color:"primary",fill:!1},path6:{type:"path",points:[{x:0.27,y:0},{x:0.54,y:0}],color:"primary",fill:!1},path7:{type:"path",points:[{x:0.27,y:-0.23},{x:-0.26,y:0.24}],color:"primary",fill:!1},path8:{type:"path",points:[{x:0.38,y:-0.23},{x:0.27,y:-0.23}],color:"primary",fill:!1},path9:{type:"path",points:[{x:0,y:0.14},{x:0.27,y:0.14},{x:0.27,y:-0.13},{x:-0.26,y:-0.13},{x:-0.26,y:0.14},{x:0,y:0.14}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.06,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0.01,y:-0.25}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.57,maxX:0.57,minY:-0.25,maxY:0.25,width:1.13,height:0.5,centerX:0,centerY:0},circles:{}},{paths:zY,texts:Fv,bounds:wc,refblocks:Mv}=VY,vw=Yt({primitives:[...Object.values(zY),{...Fv.top1,x:0,anchor:"middle_bottom"},{...Fv.bottom1,x:0,anchor:"middle_top"}],ports:[{...Mv.left1,labels:["1","-"]},{...Mv.right1,labels:["2","+"]}],size:{width:wc.width,height:wc.height},center:{x:wc.centerX,y:wc.centerY}}),Sw=Z(vw),ww=Sw.primitives.filter((t)=>t.type==="text"),$f=ww.find((t)=>t.text==="{REF}"),jf=ww.find((t)=>t.text==="{VAL}");$f.x=0.3;$f.y=0.15;$f.anchor="middle_left";jf.x=0.3;jf.y=-0.15;jf.anchor="middle_left";var UY=Sw,GY={paths:{path11:{type:"path",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0},{x:0.54,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.18,y:-0.36},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.43},left1:{type:"text",text:"Var",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:-0.01,y:-0.01,radius:0.29,color:"primary",fill:!1}}},{paths:HY,texts:QY,bounds:Ac,refblocks:Cv,circles:ZY}=GY,Xf=Yt({primitives:[...Object.values(HY),...Object.values(ZY),{type:"text",text:"{REF}",x:0,y:-0.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:0.35,anchor:"middle_bottom"},{...QY.left1,anchor:"center",y:0.02,fontSize:0.2}],ports:[{...Cv.left1,labels:["1"]},{...Cv.right1,labels:["2"]}],size:{width:Ac.width,height:Ac.height},center:{x:Ac.centerX,y:Ac.centerY}}),{5:qY,...JY}=Xf.primitives;function KY(t){return typeof t=="object"}var kv=Z({...Xf,primitives:Object.values(JY).filter(KY)}),tL={...kv,primitives:[...kv.primitives,qY]},Sl={paths:{"path28-2":{type:"path",points:[{x:0.19,y:0},{x:0,y:0.09}],color:"primary",fill:!1},"path28-2-6":{type:"path",points:[{x:0.19,y:0},{x:0,y:-0.09}],color:"primary",fill:!1},"path29-3":{type:"path",points:[{x:0.19,y:0},{x:-0.23,y:0}],color:"primary",fill:!1}},texts:{right1:{type:"text",text:"{REF}",x:0.25,y:0}},refblocks:{left1:{x:-0.23,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.09,maxY:0.09,width:0.5,height:0.19,centerX:0,centerY:0},circles:{}};function wl(t,e){let{width:r,height:n}=t.size,i=1,s=1;e.width!==void 0&&e.height!==void 0?(i=e.width/r,s=e.height/n):e.width!==void 0?i=s=e.width/r:e.height!==void 0&&(i=s=e.height/n);let o=t.primitives.map((c)=>{switch(c.type){case"path":return{...c,points:c.points.map((l)=>({x:l.x*i,y:l.y*s}))};case"text":return{...c,x:c.x*i,y:c.y*s,fontSize:c.fontSize?c.fontSize*i:void 0};case"circle":return{...c,x:c.x*i,y:c.y*s,radius:c.radius*i};case"box":return{...c,x:c.x*i,y:c.y*s,width:c.width*i,height:c.height*s};default:return c}});return{...t,primitives:o,center:{x:t.center.x*i,y:t.center.y*s},ports:t.ports.map((c)=>({...c,x:c.x*i,y:c.y*s})),size:{width:r*i,height:n*s}}}var eL=Y(Sl).rotateRightFacingSymbol("down").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_top").build(),rL=wl(eL,{width:0.24,height:0.23}),nL=Y(Sl).rotateRightFacingSymbol("left").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_right").build(),iL=wl(nL,{width:0.23,height:0.24}),oL=Y(Sl).rotateRightFacingSymbol("right").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_left").build(),sL=wl(oL,{width:0.23,height:0.24}),aL=Y(Sl).rotateRightFacingSymbol("up").labelPort("left1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),cL=wl(aL,{width:0.24,height:0.23}),Df={paths:{path11:{type:"path",points:[{x:-0.54,y:0.03},{x:-0.3,y:0.03}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:0.1,y:0.13},{x:0,y:-0.06},{x:-0.11,y:0.13}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0.03},{x:0.54,y:0.03}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.02,y:0.4},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:-0.4}},refblocks:{left1:{x:-0.54,y:0.03},right1:{x:0.54,y:0.03}},bounds:{minX:-0.57,maxX:0.57,minY:-0.4,maxY:0.4,width:1.14,height:0.8,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0.04,radius:0.29,color:"primary",fill:!1}}},{paths:Cit,texts:kit,bounds:Nit,circles:Yit,refblocks:Lit}=Df,lL=Y(Df).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:pL,texts:Tit,bounds:Nv,circles:hL,refblocks:Yv}=Df,dL=Y({primitives:[...Object.values(pL),...Object.values(hL),{type:"text",text:"{REF}",x:-0.2,y:0.35},{type:"text",text:"{VAL}",x:0.2,y:0.35}],ports:[{...Yv.left1,labels:["left1"]},{...Yv.right1,labels:["right1"]}],center:{x:Nv.centerX,y:Nv.centerY}}).rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),mL=dL,uL={paths:{path11:{type:"path",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0},{x:0.54,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.18,y:-0.36},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.43},left1:{type:"text",text:"Wh",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:-0.01,y:-0.01,radius:0.29,color:"primary",fill:!1}}},{paths:fL,texts:yL,bounds:Pc,refblocks:Lv,circles:_L}=uL,Vf=Yt({primitives:[...Object.values(fL),...Object.values(_L),{type:"text",text:"{REF}",x:0,y:-0.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:0.35,anchor:"middle_bottom"},{...yL.left1,anchor:"center",y:0.01,fontSize:0.2}],ports:[{...Lv.left1,labels:["1"]},{...Lv.right1,labels:["2"]}],size:{width:Pc.width,height:Pc.height},center:{x:Pc.centerX,y:Pc.centerY}}),{5:gL,...xL}=Vf.primitives;function bL(t){return typeof t=="object"}var Tv=Z({...Vf,primitives:Object.values(xL).filter(bL)}),vL={...Tv,primitives:[...Tv.primitives,gL]},SL={paths:{path11:{type:"path",points:[{x:-0.54,y:0},{x:-0.3,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:0.29,y:0},{x:0.54,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.18,y:-0.36},bottom1:{type:"text",text:"{VAL}",x:-0.01,y:0.43},left1:{type:"text",text:"W",x:0,y:-0.02}},refblocks:{left1:{x:-0.54,y:0},right1:{x:0.54,y:0}},bounds:{minX:-0.53,maxX:0.53,minY:0,maxY:0,width:1.06,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:-0.01,y:-0.01,radius:0.29,color:"primary",fill:!1}}},{paths:wL,texts:AL,bounds:Bc,refblocks:Ev,circles:PL}=SL,zf=Yt({primitives:[...Object.values(wL),...Object.values(PL),{type:"text",text:"{REF}",x:0,y:-0.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:0.35,anchor:"middle_bottom"},{...AL.left1,anchor:"center",y:0.01,fontSize:0.3}],ports:[{...Ev.left1,labels:["1"]},{...Ev.right1,labels:["2"]}],size:{width:Bc.width,height:Bc.height},center:{x:Bc.centerX,y:Bc.centerY}}),{5:BL,...IL}=zf.primitives;function FL(t){return typeof t=="object"}var Rv=Z({...zf,primitives:Object.values(IL).filter(FL)}),ML={...Rv,primitives:[...Rv.primitives,BL]},Aw={paths:{path40:{type:"path",points:[{x:0.14458890000000002,y:0.04403629999999992},{x:-0.1199943999999995,y:-0.08825540000000043}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-0.1199943999999995,y:0.17632800000000026},{x:0.14458890000000002,y:0.04403629999999992}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-0.1199943999999995,y:-0.0882553999999991},{x:-0.1199943999999995,y:0.17632800000000026}],color:"primary",fill:!1},path43:{type:"path",points:[{x:0.14458890000000002,y:0.17632800000000026},{x:0.14458890000000002,y:-0.0882553999999991}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-0.12219909999999956,y:0.04403629999999992},{x:-0.5168693999999996,y:0.04403629999999992}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:0.5233797000000002,y:0.043951100000000354},{x:0.1496715999999998,y:0.043951100000000354}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:0.14458890000000002,y:0.17632800000000026},{x:0.21069330000000042,y:0.17632800000000026}],color:"primary",fill:!1},"path43-8-8":{type:"path",points:[{x:0.14458890000000002,y:-0.0882553999999991},{x:0.07848449999999962,y:-0.0882553999999991}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-0.0050250999999996715,y:0.27384530000000007},bottom1:{type:"text",text:"{VAL}",x:-0.00011179999999977319,y:-0.27384529999999985}},refblocks:{left1:{x:-0.5191471000000001,y:0.044920700000000924},right1:{x:0.5191470999999999,y:0.04389609999999999}},bounds:{minX:-0.5473055410000001,maxX:0.5473055409999998,minY:-0.27384529999999985,maxY:0.27384530000000007,width:1.094611082,height:0.5476905999999999,centerX:-0.00000000000000011102230246251565,centerY:0.00000000000000011102230246251565},circles:{}},CL=Y(Aw).rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Al={paths:{"anode-lead":{type:"path",points:[{x:-0.25,y:0},{x:-0.11999999999999988,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.11999999999999988,y:0.11999999999999988},{x:0.1200000000000001,y:0},{x:-0.11999999999999988,y:-0.1200000000000001},{x:-0.11999999999999988,y:0.11999999999999988}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.16999999999999993,y:0.11999999999999988},{x:0.1200000000000001,y:0.11999999999999988},{x:0.1200000000000001,y:-0.1200000000000001},{x:0.07000000000000006,y:-0.1200000000000001}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.1200000000000001,y:0},{x:0.25,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25}},refblocks:{left1:{x:-0.25,y:0},right1:{x:0.25,y:0}},bounds:{minX:-0.25,maxX:0.25,minY:-0.25,maxY:0.25,width:0.5,height:0.5,centerX:0,centerY:0},circles:{}},kL=yt(Al,{kind:"diode",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),NL=yt(Al,{kind:"diode",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),YL=yt(Al,{kind:"diode",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),LL=yt(Al,{kind:"diode",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),{paths:TL,bounds:Ic,refblocks:Ov,circles:EL}=Aw,RL=Y({primitives:[...Object.values(TL),...Object.values(EL),{type:"text",text:"{REF}",x:0.15,y:-0.2294553499999995},{type:"text",text:"{VAL}",x:-0.15,y:-0.2294553499999995}],ports:[{...Ov.left1,labels:["1"]},{...Ov.right1,labels:["2"]}],size:{width:Ic.width,height:Ic.height},center:{x:Ic.centerX,y:Ic.centerY}}).rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").changeTextAnchor("{VAL}","middle_left").build(),Pl={paths:{"anode-lead":{type:"path",points:[{x:-0.17499999999999982,y:0},{x:-0.09999999999999987,y:0}],color:"primary",fill:!1},body:{type:"path",points:[{x:-0.09999999999999987,y:0.09999999999999987},{x:0.10000000000000009,y:0},{x:-0.09999999999999987,y:-0.10000000000000009},{x:-0.09999999999999987,y:0.09999999999999987}],color:"primary",fill:!1},"cathode-bar":{type:"path",points:[{x:0.15000000000000013,y:0.09999999999999987},{x:0.10000000000000009,y:0.09999999999999987},{x:0.10000000000000009,y:-0.10000000000000009},{x:0.050000000000000044,y:-0.10000000000000009}],color:"primary",fill:!1},"cathode-lead":{type:"path",points:[{x:0.10000000000000009,y:0},{x:0.17500000000000004,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:0.25},bottom1:{type:"text",text:"{VAL}",x:0,y:-0.25}},refblocks:{left1:{x:-0.17499999999999982,y:0},right1:{x:0.17500000000000004,y:0}},bounds:{minX:-0.17499999999999982,maxX:0.17500000000000004,minY:-0.25,maxY:0.25,width:0.34999999999999987,height:0.5,centerX:0.00000000000000011102230246251565,centerY:0},circles:{}},OL=yt(Pl,{kind:"diode",orientation:"down",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),WL=yt(Pl,{kind:"diode",orientation:"left",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),$L=yt(Pl,{kind:"diode",orientation:"right",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),jL=yt(Pl,{kind:"diode",orientation:"up",pin1Labels:["1","pos","anode"],pin2Labels:["2","neg","cathode"]}),Gr={ac_voltmeter_down:FP,ac_voltmeter_horz:kP,ac_voltmeter_left:LP,ac_voltmeter_right:RP,ac_voltmeter_up:$P,ac_voltmeter_vert:DP,avalanche_diode_down:UP,avalanche_diode_horz:GP,avalanche_diode_left:ZP,avalanche_diode_right:qP,avalanche_diode_sm_down:KP,avalanche_diode_sm_left:tB,avalanche_diode_sm_right:eB,avalanche_diode_sm_up:rB,avalanche_diode_up:oB,avalanche_diode_vert:cB,avalanche_diode_xs_down:lB,avalanche_diode_xs_left:pB,avalanche_diode_xs_right:hB,avalanche_diode_xs_up:dB,backward_diode_down:fB,backward_diode_left:Wv,backward_diode_right:bB,backward_diode_up:vB,battery_down:PB,battery_horz:$v,battery_left:kB,battery_right:TB,battery_up:WB,battery_vert:$B,boxresistor_down:VB,boxresistor_left:HB,boxresistor_right:JB,boxresistor_sm_down:KB,boxresistor_sm_left:t8,boxresistor_sm_right:e8,boxresistor_sm_up:r8,boxresistor_small_down:o8,boxresistor_small_left:c8,boxresistor_small_right:h8,boxresistor_small_up:u8,boxresistor_up:g8,boxresistor_xs_down:x8,boxresistor_xs_left:b8,boxresistor_xs_right:v8,boxresistor_xs_up:S8,bridged_ground_down:P8,bridged_ground_left:F8,bridged_ground_right:jv,bridged_ground_up:k8,capacitor_down:T8,capacitor_left:R8,capacitor_polarized_down:O8,capacitor_polarized_left:W8,capacitor_polarized_right:$8,capacitor_polarized_up:j8,capacitor_right:D8,capacitor_sm_down:V8,capacitor_sm_left:z8,capacitor_sm_right:U8,capacitor_sm_up:G8,capacitor_up:q8,capacitor_xs_down:J8,capacitor_xs_left:K8,capacitor_xs_right:tI,capacitor_xs_up:eI,constant_current_diode_down:iI,constant_current_diode_horz:oI,constant_current_diode_left:cI,constant_current_diode_right:lI,constant_current_diode_up:dI,constant_current_diode_vert:fI,crystal_4pin_down:gI,crystal_4pin_left:xI,crystal_4pin_right:bI,crystal_4pin_up:wI,crystal_down:BI,crystal_left:II,crystal_right:FI,crystal_up:kI,current_source_down:YI,current_source_left:TI,current_source_right:RI,current_source_up:WI,darlington_pair_transistor_down:$I,darlington_pair_transistor_horz:jI,darlington_pair_transistor_left:XI,darlington_pair_transistor_right:DI,darlington_pair_transistor_up:VI,darlington_pair_transistor_vert:zI,dc_ammeter_down:c9,dc_ammeter_horz:Eo,dc_ammeter_left:HI,dc_ammeter_right:QI,dc_ammeter_up:ZI,dc_ammeter_vert:c9,dc_voltmeter_down:KI,dc_voltmeter_horz:rF,dc_voltmeter_left:oF,dc_voltmeter_right:cF,dc_voltmeter_up:hF,dc_voltmeter_vert:uF,diac_down:fF,diac_horz:yF,diac_left:_F,diac_right:gF,diac_up:xF,diac_vert:bF,digital_ground_down:wF,digital_ground_left:BF,digital_ground_right:MF,digital_ground_up:NF,diode_down:LF,diode_left:TF,diode_right:zc,diode_sm_down:EF,diode_sm_left:RF,diode_sm_right:OF,diode_sm_up:WF,diode_up:$F,diode_xs_down:jF,diode_xs_left:XF,diode_xs_right:DF,diode_xs_up:VF,dpdt_normally_closed_switch_down:UF,dpdt_normally_closed_switch_left:GF,dpdt_normally_closed_switch_right:Hc,dpdt_normally_closed_switch_up:HF,dpdt_switch_down:ZF,dpdt_switch_left:qF,dpdt_switch_right:Qc,dpdt_switch_up:JF,dpst_normally_closed_switch_down:t6,dpst_normally_closed_switch_left:e6,dpst_normally_closed_switch_right:Zc,dpst_normally_closed_switch_up:r6,dpst_switch_down:i6,dpst_switch_left:o6,dpst_switch_right:qc,dpst_switch_up:s6,ferrite_bead_down:l6,ferrite_bead_left:p6,ferrite_bead_right:Vv,ferrite_bead_up:Dv,filled_diode_down:m6,filled_diode_horz:y6,filled_diode_left:x6,filled_diode_right:S6,filled_diode_up:P6,filled_diode_vert:F6,frequency_meter_horz:Zd,frequency_meter_vert:E6,fuse_horz:zv,fuse_vert:$6,ground_down:j6,ground_horz:X6,ground_left:D6,ground_right:V6,ground_up:z6,ground_vert:U6,gunn_diode_horz:G6,gunn_diode_vert:H6,icled_down:Z6,icled_left:q6,icled_right:Jc,icled_up:J6,igbt_transistor_horz:Uv,igbt_transistor_vert:t7,illuminated_push_button_normally_open_horz:Hv,illuminated_push_button_normally_open_vert:r7,inductor_down:n7,inductor_left:i7,inductor_right:o7,inductor_up:s7,laser_diode_down:a7,laser_diode_left:c7,laser_diode_right:tl,laser_diode_up:l7,led_down:m7,led_left:u7,led_right:um,led_sm_down:f7,led_sm_left:y7,led_sm_right:_7,led_sm_up:g7,led_up:Jv,led_xs_down:x7,led_xs_left:b7,led_xs_right:v7,led_xs_up:S7,light_dependent_resistor_horz:Kv,light_dependent_resistor_vert:B7,mosfet_depletion_normally_on_horz:rS,mosfet_depletion_normally_on_vert:M7,mushroom_head_normally_open_momentary_horz:iS,mushroom_head_normally_open_momentary_vert:Y7,n_channel_d_mosfet_transistor_gate_bottom_drain_left:O7,n_channel_d_mosfet_transistor_gate_bottom_drain_right:W7,n_channel_d_mosfet_transistor_gate_left_drain_bottom:$7,n_channel_d_mosfet_transistor_gate_left_drain_top:j7,n_channel_d_mosfet_transistor_gate_right_drain_bottom:X7,n_channel_d_mosfet_transistor_gate_right_drain_top:D7,n_channel_d_mosfet_transistor_gate_top_drain_left:V7,n_channel_d_mosfet_transistor_gate_top_drain_right:z7,n_channel_d_mosfet_transistor_horz:ke,n_channel_d_mosfet_transistor_vert:Qe,n_channel_e_mosfet_transistor_gate_bottom_drain_left:Q7,n_channel_e_mosfet_transistor_gate_bottom_drain_right:Z7,n_channel_e_mosfet_transistor_gate_left_drain_bottom:q7,n_channel_e_mosfet_transistor_gate_left_drain_top:J7,n_channel_e_mosfet_transistor_gate_right_drain_bottom:K7,n_channel_e_mosfet_transistor_gate_right_drain_top:tM,n_channel_e_mosfet_transistor_gate_top_drain_left:eM,n_channel_e_mosfet_transistor_gate_top_drain_right:rM,n_channel_e_mosfet_transistor_horz:Ne,n_channel_e_mosfet_transistor_vert:Ze,njfet_transistor_horz:pS,njfet_transistor_vert:sM,not_connected_down:pM,not_connected_left:hM,not_connected_right:nl,not_connected_up:dM,npn_bipolar_transistor_down:fM,npn_bipolar_transistor_horz:gM,npn_bipolar_transistor_left:vM,npn_bipolar_transistor_right:AM,npn_bipolar_transistor_up:IM,npn_bipolar_transistor_vert:CM,opamp_no_power_down:NM,opamp_no_power_left:YM,opamp_no_power_right:il,opamp_no_power_up:LM,opamp_with_power_down:EM,opamp_with_power_left:RM,opamp_with_power_right:ol,opamp_with_power_up:OM,p_channel_d_mosfet_transistor_gate_bottom_drain_left:XM,p_channel_d_mosfet_transistor_gate_bottom_drain_right:DM,p_channel_d_mosfet_transistor_gate_left_drain_bottom:VM,p_channel_d_mosfet_transistor_gate_left_drain_top:zM,p_channel_d_mosfet_transistor_gate_right_drain_bottom:UM,p_channel_d_mosfet_transistor_gate_right_drain_top:GM,p_channel_d_mosfet_transistor_gate_top_drain_left:HM,p_channel_d_mosfet_transistor_gate_top_drain_right:QM,p_channel_d_mosfet_transistor_horz:Ye,p_channel_d_mosfet_transistor_vert:qe,p_channel_e_mosfet_transistor_gate_bottom_drain_left:KM,p_channel_e_mosfet_transistor_gate_bottom_drain_right:tC,p_channel_e_mosfet_transistor_gate_left_drain_bottom:eC,p_channel_e_mosfet_transistor_gate_left_drain_top:rC,p_channel_e_mosfet_transistor_gate_right_drain_bottom:nC,p_channel_e_mosfet_transistor_gate_right_drain_top:iC,p_channel_e_mosfet_transistor_gate_top_drain_left:oC,p_channel_e_mosfet_transistor_gate_top_drain_right:sC,p_channel_e_mosfet_transistor_horz:Le,p_channel_e_mosfet_transistor_vert:Je,photodiode_horz:_S,photodiode_vert:lC,pjfet_transistor_horz:bS,pjfet_transistor_vert:mC,pnp_bipolar_transistor_down:yC,pnp_bipolar_transistor_horz:_C,pnp_bipolar_transistor_left:bC,pnp_bipolar_transistor_right:wC,pnp_bipolar_transistor_up:BC,pnp_bipolar_transistor_vert:MC,potentiometer_horz:wS,potentiometer_vert:YC,potentiometer2_down:EC,potentiometer2_left:RC,potentiometer2_right:sl,potentiometer2_up:OC,potentiometer3_down:jC,potentiometer3_left:VC,potentiometer3_right:zC,potentiometer3_up:HC,power_factor_meter_horz:AS,power_factor_meter_vert:JC,push_button_normally_closed_momentary_horz:BS,push_button_normally_closed_momentary_vert:rk,push_button_normally_open_momentary_down:sk,push_button_normally_open_momentary_horz:pk,push_button_normally_open_momentary_left:hk,push_button_normally_open_momentary_right:Oo,push_button_normally_open_momentary_up:dk,push_button_normally_open_momentary_vert:mk,rail_down:_k,rail_left:vk,rail_right:Pk,rail_up:Fk,rectifier_diode_horz:FS,rectifier_diode_vert:Lk,resistor_down:Rk,resistor_left:$k,resistor_right:Dk,resistor_sm_down:Vk,resistor_sm_left:zk,resistor_sm_right:Uk,resistor_sm_up:Gk,resistor_up:Zk,resistor_xs_down:qk,resistor_xs_left:Jk,resistor_xs_right:Kk,resistor_xs_up:tN,resonator_down:nN,resonator_horz:CS,resonator_left:sN,resonator_right:dl,resonator_up:aN,resonator_vert:cN,schottky_diode_down:pN,schottky_diode_left:hN,schottky_diode_right:ml,schottky_diode_up:dN,silicon_controlled_rectifier_horz:NS,silicon_controlled_rectifier_vert:uN,solderjumper2_bridged12_down:fN,solderjumper2_bridged12_left:yN,solderjumper2_bridged12_right:Bu,solderjumper2_bridged12_up:_N,solderjumper2_down:gN,solderjumper2_left:xN,solderjumper2_right:Mu,solderjumper2_up:bN,solderjumper3_bridged12_down:vN,solderjumper3_bridged12_left:SN,solderjumper3_bridged12_right:Nu,solderjumper3_bridged12_up:wN,solderjumper3_bridged123_down:AN,solderjumper3_bridged123_left:PN,solderjumper3_bridged123_right:Tu,solderjumper3_bridged123_up:BN,solderjumper3_bridged23_down:IN,solderjumper3_bridged23_left:FN,solderjumper3_bridged23_right:Ou,solderjumper3_bridged23_up:MN,solderjumper3_down:CN,solderjumper3_left:kN,solderjumper3_right:ju,solderjumper3_up:NN,spdt_normally_closed_switch_down:LN,spdt_normally_closed_switch_left:TN,spdt_normally_closed_switch_right:ul,spdt_normally_closed_switch_up:EN,spdt_switch_down:ON,spdt_switch_left:WN,spdt_switch_right:fl,spdt_switch_up:$N,speaker_down:jN,speaker_horz:XN,speaker_left:DN,speaker_right:VN,speaker_up:zN,speaker_vert:UN,spst_normally_closed_switch_down:GN,spst_normally_closed_switch_left:HN,spst_normally_closed_switch_right:_l,spst_normally_closed_switch_up:QN,spst_switch_down:ZN,spst_switch_left:qN,spst_switch_right:xl,spst_switch_up:JN,square_wave_down:KN,square_wave_left:tY,square_wave_right:eY,square_wave_up:rY,step_recovery_diode_horz:sw,step_recovery_diode_vert:nY,tachometer_horz:If,tachometer_vert:hY,testpoint_down:dY,testpoint_left:mY,testpoint_right:vl,testpoint_up:uY,tilted_ground_down:yY,tilted_ground_left:_Y,tilted_ground_right:Ff,tilted_ground_up:lw,triac_horz:hw,triac_vert:bY,tunnel_diode_horz:uw,tunnel_diode_vert:BY,unijunction_transistor_horz:fw,unijunction_transistor_vert:kY,usbc:YY,var_meter_horz:xw,var_meter_vert:RY,varactor_diode_horz:bw,varactor_diode_vert:DY,varistor_horz:vw,varistor_vert:UY,varmeter_horz:Xf,varmeter_vert:tL,vcc_down:rL,vcc_left:iL,vcc_right:sL,vcc_up:cL,volt_meter_horz:lL,volt_meter_vert:mL,watt_hour_meter_horz:Vf,watt_hour_meter_vert:vL,wattmeter_horz:zf,wattmeter_vert:ML,zener_diode_horz:CL,zener_diode_sm_down:kL,zener_diode_sm_left:NL,zener_diode_sm_right:YL,zener_diode_sm_up:LL,zener_diode_vert:RL,zener_diode_xs_down:OL,zener_diode_xs_left:WL,zener_diode_xs_right:$L,zener_diode_xs_up:jL};var Eit=Object.fromEntries(Object.keys(Gr).map((t)=>[t,t]));var oat=ae(ce(),1);var lat=ae(ce(),1);var nE=ae(ce(),1);var iE=ae(ce(),1);var Fat=ae(ce(),1);var XL="TscircuitAlphabet",Pw="data-tscircuit-alphabet-font";function DL(t){let e=(n)=>({...n,children:(n.children??[]).filter((i)=>!(Pw in(i.attributes??{}))).map(e)}),r=e(t);return r.children.push({name:"style",type:"element",value:"",attributes:{[Pw]:"",type:"text/css"},children:[{name:"",type:"text",value:`@font-face { font-family: '${XL}'; src: url('data:font/ttf;base64,${n2}') format('truetype'); font-weight: normal; font-style: normal; }`,attributes:{},children:[]}]}),Rw.stringify(r)}var Ww=Ow.default("circuit-to-svg"),Jit=Ww.extend("pcb"),Kit=Ww.extend("sch");var re={"3d_viewer":{background_bottom:"rgb(102, 102, 128)",background_top:"rgb(204, 204, 230)",board:"rgb(51, 43, 23)",copper:"rgb(179, 156, 0)",silkscreen_bottom:"rgb(230, 230, 230)",silkscreen_top:"rgb(230, 230, 230)",soldermask:"rgb(20, 51, 36)",solderpaste:"rgb(128, 128, 128)"},board:{anchor:"rgb(255, 38, 226)",aux_items:"rgb(255, 255, 255)",b_adhes:"rgb(0, 0, 132)",b_crtyd:"rgb(255, 38, 226)",b_fab:"rgb(88, 93, 132)",b_mask:"rgba(2, 255, 238, 0.400)",b_paste:"rgb(0, 194, 194)",b_silks:"rgb(232, 178, 167)",background:"rgb(0, 16, 35)",cmts_user:"rgb(89, 148, 220)",copper:{b:"rgb(77, 127, 196)",f:"rgb(200, 52, 52)",in1:"rgb(127, 200, 127)",in10:"rgb(237, 124, 51)",in11:"rgb(91, 195, 235)",in12:"rgb(247, 111, 142)",in13:"rgb(167, 165, 198)",in14:"rgb(40, 204, 217)",in15:"rgb(232, 178, 167)",in16:"rgb(242, 237, 161)",in17:"rgb(237, 124, 51)",in18:"rgb(91, 195, 235)",in19:"rgb(247, 111, 142)",in2:"rgb(206, 125, 44)",in20:"rgb(167, 165, 198)",in21:"rgb(40, 204, 217)",in22:"rgb(232, 178, 167)",in23:"rgb(242, 237, 161)",in24:"rgb(237, 124, 51)",in25:"rgb(91, 195, 235)",in26:"rgb(247, 111, 142)",in27:"rgb(167, 165, 198)",in28:"rgb(40, 204, 217)",in29:"rgb(232, 178, 167)",in3:"rgb(79, 203, 203)",in30:"rgb(242, 237, 161)",in4:"rgb(219, 98, 139)",in5:"rgb(167, 165, 198)",in6:"rgb(40, 204, 217)",in7:"rgb(232, 178, 167)",in8:"rgb(242, 237, 161)",in9:"rgb(141, 203, 129)"},cursor:"rgb(255, 255, 255)",drc:"rgb(194, 194, 194)",drc_error:"rgba(215, 91, 107, 0.800)",drc_exclusion:"rgb(255, 255, 255)",drc_warning:"rgba(255, 208, 66, 0.902)",dwgs_user:"rgb(194, 194, 194)",eco1_user:"rgb(180, 219, 210)",eco2_user:"rgb(216, 200, 82)",edge_cuts:"rgb(208, 210, 205)",f_adhes:"rgb(132, 0, 132)",f_crtyd:"rgb(255, 0, 245)",f_fab:"rgb(175, 175, 175)",f_mask:"rgba(216, 100, 255, 0.400)",f_paste:"rgba(180, 160, 154, 0.902)",f_silks:"rgb(242, 237, 161)",footprint_text_back:"rgb(0, 0, 132)",footprint_text_front:"rgb(194, 194, 194)",footprint_text_invisible:"rgb(132, 132, 132)",grid:"rgb(132, 132, 132)",grid_axes:"rgb(194, 194, 194)",margin:"rgb(255, 38, 226)",microvia:"rgb(0, 132, 132)",no_connect:"rgb(0, 0, 132)",pad_back:"rgb(77, 127, 196)",pad_front:"rgb(200, 52, 52)",pad_plated_hole:"rgb(194, 194, 0)",pad_through_hole:"rgb(227, 183, 46)",plated_hole:"rgb(26, 196, 210)",ratsnest:"rgba(245, 255, 213, 0.702)",select_overlay:"rgb(4, 255, 67)",through_via:"rgb(236, 236, 236)",user_1:"rgb(194, 194, 194)",user_2:"rgb(89, 148, 220)",user_3:"rgb(180, 219, 210)",user_4:"rgb(216, 200, 82)",user_5:"rgb(194, 194, 194)",user_6:"rgb(89, 148, 220)",user_7:"rgb(180, 219, 210)",user_8:"rgb(216, 200, 82)",user_9:"rgb(232, 178, 167)",via_blind_buried:"rgb(187, 151, 38)",via_hole:"rgb(227, 183, 46)",via_micro:"rgb(0, 132, 132)",via_through:"rgb(236, 236, 236)",worksheet:"rgb(200, 114, 171)"},gerbview:{axes:"rgb(0, 0, 132)",background:"rgb(0, 0, 0)",dcodes:"rgb(255, 255, 255)",grid:"rgb(132, 132, 132)",layers:["rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)"],negative_objects:"rgb(132, 132, 132)",worksheet:"rgb(0, 0, 132)"},meta:{filename:"kicad_2020",name:"KiCad 2020",version:2},simulation_palette:["#1f77b4","#d62728","#2ca02c","#ff7f0e","#9467bd","#17becf","#8c564b","#e377c2","#7f7f7f","#bcbd22"],palette:["rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)"],schematic:{aux_items:"rgb(46, 46, 46)",background:"rgb(245, 241, 237)",brightened:"rgb(255, 0, 255)",bus:"rgb(0, 0, 132)",bus_junction:"rgb(0, 0, 132)",component_body:"rgb(255, 255, 194)",component_outline:"rgb(132, 0, 0)",cursor:"rgb(15, 15, 15)",erc_error:"rgba(230, 9, 13, 0.800)",erc_warning:"rgba(209, 146, 0, 0.800)",fields:"rgb(132, 0, 132)",grid:"rgb(181, 181, 181)",grid_axes:"rgb(0, 0, 132)",hidden:"rgb(194, 194, 194)",junction:"rgb(0, 150, 0)",label_global:"rgb(132, 0, 0)",label_background:"rgba(255, 255, 255, 0.6)",label_hier:"rgb(114, 86, 0)",label_local:"rgb(15, 15, 15)",net_name:"rgb(132, 132, 132)",no_connect:"rgb(132, 0, 0)",note:"rgb(0, 0, 194)",override_item_colors:!1,pin:"rgb(132, 0, 0)",pin_name:"rgb(0, 100, 100)",pin_number:"rgb(169, 0, 0)",reference:"rgb(0, 100, 100)",shadow:"rgba(102, 179, 255, 0.800)",sheet:"rgb(132, 0, 0)",sheet_background:"rgba(253, 255, 231, 0.000)",sheet_fields:"rgb(132, 0, 132)",sheet_filename:"rgb(114, 86, 0)",sheet_label:"rgb(0, 100, 100)",sheet_name:"rgb(0, 100, 100)",table:"rgb(102, 102, 102)",value:"rgb(0, 100, 100)",wire:"rgb(0, 150, 0)",wire_crossing:"rgb(30, 180, 30)",worksheet:"rgb(132, 0, 0)"}};var sot=re.board.user_2;var cot=re.board.user_2,lot=re.board.user_2;var hot=re.board.user_2;var mot=re.board.user_2;var Bw=0.94,Bl=0.045,VL=Object.fromEntries(Object.entries(Wi).map(([t,e])=>{let r=e.flatMap((i)=>[i.x1,i.x2]),n=e.flatMap((i)=>[i.y1,i.y2]);return[t,e.length?{minX:Math.min(...r)-Bl,maxX:Math.max(...r)+Bl,minY:-(Math.max(...n)+Bl)*Bw,maxY:-(Math.min(...n)-Bl)*Bw}:null]})),bot=Math.round(Math.max(...Object.values(VL).map((t)=>t?t.maxX-t.minX:0))*1000)/1000;var El={copper:{top:"rgb(200, 52, 52)",inner1:"rgb(255, 140, 0)",inner2:"rgb(255, 215, 0)",inner3:"rgb(50, 205, 50)",inner4:"rgb(64, 224, 208)",inner5:"rgb(138, 43, 226)",inner6:"rgb(255, 105, 180)",inner7:"rgb(0, 191, 255)",inner8:"rgb(160, 82, 45)",bottom:"rgb(77, 127, 196)"},soldermaskWithCopperUnderneath:{top:"rgb(18, 82, 50)",bottom:"rgb(18, 82, 50)"},soldermask:{top:"rgb(12, 55, 33)",bottom:"rgb(12, 55, 33)"},soldermaskOverCopper:{top:"rgb(52, 135, 73)",bottom:"rgb(52, 135, 73)"},substrate:"rgb(201, 162, 110)",drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",courtyard:{top:"#FF00FF",bottom:"rgb(38, 233, 255)"},keepout:"#FF6B6B",debugComponent:{fill:null,stroke:null}},wot=El.drill,Aot=El.silkscreen.top,Pot=El.silkscreen.bottom,Bot={...El.copper};var zL=4;var $w=5;var UL=2,zot=$w+2,Uot=UL+2,Got=$w+zL+6;function GL(t){return t.find((r)=>r.type==="project_software_metadata"||r.type==="source_project_metadata")?.software_used_string}var HL={name:"circuit-to-svg",type:"module",version:"0.0.426",repository:{type:"git",url:"https://github.com/tscircuit/circuit-to-svg.git"},description:"Convert Circuit JSON to SVG",main:"dist/index.js",files:["dist"],scripts:{start:"cosmos",prepublish:"npm run build",prepare:"node scripts/prepare-git.cjs",build:"tsup-node ./lib/index.ts --format esm --dts --sourcemap --external tscircuit",format:"biome format . --write","format:check":"biome format .",cosmos:"cosmos","cosmos-export":"cosmos-export"},license:"ISC",devDependencies:{"@biomejs/biome":"^1.9.4","@resvg/resvg-js":"^2.6.2","@tscircuit/alphabet":"^0.0.27","@tscircuit/checks-latest":"npm:@tscircuit/checks@0.0.179","@types/bun":"^1.2.8","@types/debug":"^4.1.12","@vitejs/plugin-react":"5.0.0",biome:"^0.3.3","bun-match-svg":"^0.0.12","circuit-json":"^0.0.491",esbuild:"^0.20.2","format-si-unit":"^0.0.12","performance-now":"^2.1.0",react:"19.1.0","react-cosmos":"7.0.0","react-cosmos-plugin-vite":"7.0.0","react-dom":"19.1.0",tscircuit:"^0.0.2018",tsup:"^8.0.2",typescript:"^5.4.5","vite-tsconfig-paths":"^5.0.1"},peerDependencies:{"@tscircuit/alphabet":"*"},dependencies:{"@types/node":"^22.5.5","bun-types":"^1.1.40","calculate-elbow":"0.0.12",debug:"^4.4.3","svg-path-commander":"^2.1.11",svgson:"^5.3.1","transformation-matrix":"^2.16.1"}},QL=HL.version;function ZL(t,e="error_text_overlay"){let r=t.filter((s)=>s.type.endsWith("_error"));if(r.length===0)return null;let n=r.map((s)=>s.message).filter((s)=>!!s);if(n.length===0)return null;return{name:"text",type:"element",value:"",attributes:{x:"10",y:"20",fill:"red","font-family":"monospace","font-size":"12px","data-type":e,"data-layer":"global"},children:n.map((s,o)=>({name:"tspan",type:"element",value:"",attributes:{x:"10",dy:o===0?"0":"1.2em"},children:[{type:"text",value:s,name:"",attributes:{},children:[]}]}))}}var qL={pin_number:0.15,negated_pin_number:0.12,reference_designator:0.18,manufacturer_number:0.18,net_label:0.18,error:0.05},yr=(t,e)=>e??qL[t],fe=(t,e,r)=>Math.abs(t.a)*yr(e,r);function JL(t){let{minX:e,minY:r,maxX:n,maxY:i}=t.bounds,s=t.cellSize??1,o=t.labelCells??!1,c=[],l=(a,p)=>{let[d,m]=O(t.transform,[a,p]);return{x:d,y:m}};for(let a=Math.floor(e);a<=Math.ceil(n);a+=s){let p=l(a,r),d=l(a,i);c.push({name:"line",type:"element",attributes:{x1:p.x.toString(),y1:p.y.toString(),x2:d.x.toString(),y2:d.y.toString(),stroke:re.schematic.grid,"stroke-width":(0.01*Math.abs(t.transform.a)).toString(),"stroke-opacity":"0.5"}})}for(let a=Math.floor(r);a<=Math.ceil(i);a+=s){let p=l(e,a),d=l(n,a);c.push({name:"line",type:"element",attributes:{x1:p.x.toString(),y1:p.y.toString(),x2:d.x.toString(),y2:d.y.toString(),stroke:re.schematic.grid,"stroke-width":(0.01*Math.abs(t.transform.a)).toString(),"stroke-opacity":"0.5"}})}if(o){let a=(p,d)=>{if(s<=0.1)return`${p.toFixed(1)},${d.toFixed(1)}`;return`${p},${d}`};for(let p=Math.floor(e);p<=Math.ceil(n);p+=s)for(let d=Math.floor(r);d<=Math.ceil(i);d+=s){let m=l(p,d);c.push({name:"text",type:"element",attributes:{x:(m.x-2.5).toString(),y:(m.y-5).toString(),fill:re.schematic.grid,"font-size":(s/5*Math.abs(t.transform.a)).toString(),"fill-opacity":"0.5","text-anchor":"middle","dominant-baseline":"middle","font-family":"sans-serif"},children:[{type:"text",value:a(p,d),name:"",attributes:{},children:[]}]})}}return{name:"g",value:"",type:"element",attributes:{class:"grid sch-grid"},children:c}}function KL(t){let{points:e,transform:r}=t,n=[];for(let i of e){let[s,o]=O(r,[i.x-0.1,i.y-0.1]),[c,l]=O(r,[i.x+0.1,i.y+0.1]),[a,p]=O(r,[i.x-0.1,i.y+0.1]),[d,m]=O(r,[i.x+0.1,i.y-0.1]);n.push({name:"path",type:"element",attributes:{d:`M${s},${o} L${c},${l} M${a},${p} L${d},${m}`,stroke:re.schematic.grid,"stroke-width":(0.02*Math.abs(r.a)).toString(),"stroke-opacity":"0.7"}});let[f,_]=O(r,[i.x+0.15,i.y-0.15]);n.push({name:"text",type:"element",attributes:{x:f.toString(),y:_.toString(),fill:re.schematic.grid,"font-size":(0.1*Math.abs(r.a)).toString(),"fill-opacity":"0.7","text-anchor":"start","font-family":"sans-serif","dominant-baseline":"middle"},children:[{type:"text",value:i.label||`(${i.x},${i.y})`,name:"",attributes:{},children:[]}]})}return{name:"g",value:"",type:"element",attributes:{class:"labeled-points sch-labeled-points"},children:n}}function tT(t){return t.reduce((e,r)=>{if(!e)return r;if(r.sheet_index===void 0)return e;if(e.sheet_index===void 0)return r;return r.sheet_index<e.sheet_index?r:e},void 0)}var Iw={"0":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"1":{width:13,height:27,ascent:22,descent:5,left:-3,right:9},"2":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"3":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"4":{width:13,height:27,ascent:22,descent:5,left:0,right:12},"5":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"6":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"7":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"8":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"9":{width:13,height:27,ascent:22,descent:5,left:-1,right:12}," ":{width:7,height:27,ascent:22,descent:5,left:0,right:0},"!":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},'"':{width:9,height:27,ascent:22,descent:5,left:-1,right:7},"#":{width:13,height:27,ascent:22,descent:5,left:0,right:13},$:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"%":{width:21,height:27,ascent:22,descent:5,left:-1,right:20},"&":{width:16,height:27,ascent:22,descent:5,left:-1,right:15},"'":{width:5,height:27,ascent:22,descent:5,left:-1,right:3},"(":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},")":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},"*":{width:9,height:27,ascent:22,descent:5,left:-1,right:8},"+":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},",":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},"-":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},".":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},"/":{width:7,height:27,ascent:22,descent:5,left:0,right:7},":":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},";":{width:7,height:27,ascent:22,descent:5,left:-2,right:5},"<":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},"=":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},">":{width:14,height:27,ascent:22,descent:5,left:-1,right:13},"?":{width:13,height:27,ascent:22,descent:5,left:-1,right:12},"@":{width:24,height:27,ascent:22,descent:5,left:-1,right:23},A:{width:16,height:27,ascent:22,descent:5,left:0,right:16},B:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},C:{width:17,height:27,ascent:22,descent:5,left:-1,right:16},D:{width:17,height:27,ascent:22,descent:5,left:-2,right:16},E:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},F:{width:15,height:27,ascent:22,descent:5,left:-2,right:14},G:{width:19,height:27,ascent:22,descent:5,left:-1,right:17},H:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},I:{width:7,height:27,ascent:22,descent:5,left:-2,right:5},J:{width:12,height:27,ascent:22,descent:5,left:-1,right:10},K:{width:16,height:27,ascent:22,descent:5,left:-2,right:16},L:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},M:{width:20,height:27,ascent:22,descent:5,left:-2,right:18},N:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},O:{width:19,height:27,ascent:22,descent:5,left:-1,right:18},P:{width:16,height:27,ascent:22,descent:5,left:-2,right:15},Q:{width:19,height:27,ascent:22,descent:5,left:-1,right:18},R:{width:17,height:27,ascent:22,descent:5,left:-2,right:17},S:{width:16,height:27,ascent:22,descent:5,left:-1,right:15},T:{width:15,height:27,ascent:22,descent:5,left:-1,right:14},U:{width:17,height:27,ascent:22,descent:5,left:-2,right:15},V:{width:16,height:27,ascent:22,descent:5,left:0,right:16},W:{width:23,height:27,ascent:22,descent:5,left:0,right:22},X:{width:16,height:27,ascent:22,descent:5,left:0,right:16},Y:{width:16,height:27,ascent:22,descent:5,left:0,right:16},Z:{width:15,height:27,ascent:22,descent:5,left:0,right:14},"[":{width:7,height:27,ascent:22,descent:5,left:-2,right:6},"\\":{width:7,height:27,ascent:22,descent:5,left:0,right:7},"]":{width:7,height:27,ascent:22,descent:5,left:0,right:5},"^":{width:11,height:27,ascent:22,descent:5,left:-1,right:11},_:{width:13,height:27,ascent:22,descent:5,left:0,right:14},"`":{width:8,height:27,ascent:22,descent:5,left:-1,right:5},a:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},b:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},c:{width:12,height:27,ascent:22,descent:5,left:-1,right:12},d:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},e:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},f:{width:7,height:27,ascent:22,descent:5,left:0,right:8},g:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},h:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},i:{width:5,height:27,ascent:22,descent:5,left:-2,right:4},j:{width:5,height:27,ascent:22,descent:5,left:1,right:4},k:{width:12,height:27,ascent:22,descent:5,left:-2,right:12},l:{width:5,height:27,ascent:22,descent:5,left:-2,right:4},m:{width:20,height:27,ascent:22,descent:5,left:-2,right:18},n:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},o:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},p:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},q:{width:13,height:27,ascent:22,descent:5,left:-1,right:12},r:{width:8,height:27,ascent:22,descent:5,left:-2,right:8},s:{width:12,height:27,ascent:22,descent:5,left:-1,right:11},t:{width:7,height:27,ascent:22,descent:5,left:0,right:6},u:{width:13,height:27,ascent:22,descent:5,left:-2,right:12},v:{width:12,height:27,ascent:22,descent:5,left:0,right:12},w:{width:17,height:27,ascent:22,descent:5,left:0,right:17},x:{width:12,height:27,ascent:22,descent:5,left:0,right:12},y:{width:12,height:27,ascent:22,descent:5,left:0,right:12},z:{width:12,height:27,ascent:22,descent:5,left:0,right:11},"{":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},"|":{width:6,height:27,ascent:22,descent:5,left:-2,right:4},"}":{width:8,height:27,ascent:22,descent:5,left:-1,right:7},"~":{width:14,height:27,ascent:22,descent:5,left:-1,right:13}},Do=(t)=>{if(!t)return 0;let e=0;for(let r of t){let n=Iw[r];if(n)e+=n.width;else e+=Iw["?"].width}return e/27},jw=0.65,Xw=0.08;function Ll(t){return Do(t.text||"")+(t.display_superscript?Xw+Do(t.display_superscript)*jw:0)}function Hf(t,e,r,n="central"){let i=[{type:"text",value:t,name:"",attributes:{},children:[]}];if(e)i.push({type:"element",name:"tspan",value:"",attributes:{class:"sch-net-label-superscript","font-size":`${r*jw}px`,dx:`${r*Xw}`,dy:`${-r*(n==="ideographic"?0.5:0.25)}`},children:[{type:"text",value:e,name:"",attributes:{},children:[]}]});return i}var Oi=(t)=>{switch(t){case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1};case"left":return{x:1,y:0};case"right":return{x:-1,y:0}}throw Error(`Invalid side: ${t}`)},fr=0.3,Ei=0.3,Ri=0.06,Dw=0.2,Vw=(t)=>({"data-circuit-json-type":"schematic_net_label","data-schematic-net-label-id":t.schematic_net_label_id}),eT={top_left:"start",top_right:"end",middle_left:"start",middle_right:"end",bottom_left:"start",bottom_right:"end",center:"middle",middle_top:"middle",middle_bottom:"middle"},Fw={top_left:"hanging",top_right:"hanging",bottom_left:"ideographic",bottom_right:"ideographic",center:"middle",middle_left:"middle",middle_right:"middle",middle_top:"hanging",middle_bottom:"ideographic"};function rT(t){return{left:180,top:90,bottom:-90,right:0}[t]??0}function nT(t,e,r){let n=r+fr*2+Ri*t.text.length+Ei,i=Oi(t.anchor_side);return t.anchor_position??{x:t.center.x-i.x*n*e/2,y:t.center.y-i.y*n*e/2}}var iT=(t,e)=>{let r=t<0?t+2*Math.PI:t,n=e<0?e+2*Math.PI:e,i=Math.abs(r-n);if(i>Math.PI)i=2*Math.PI-i;return i},zw=({schPorts:t,symbol:e,schComponent:r})=>{let n=t.map((c)=>{let l=c.center.x-r.center.x,a=c.center.y-r.center.y;return{port:c,angle:Math.atan2(a,l)}}),i=e.ports.map((c)=>{let l=c.x-e.center.x,a=c.y-e.center.y;return{port:c,angle:Math.atan2(a,l)}});n.sort((c,l)=>c.angle-l.angle),i.sort((c,l)=>c.angle-l.angle);let s=[],o=new Set;for(let c of n){let l=null;for(let a of i){if(o.has(a.port))continue;let p=iT(c.angle,a.angle);if(l===null||p<l.angleDiff)l={symbolPort:a.port,angleDiff:p}}if(l&&l.angleDiff<Math.PI/4)s.push({schPort:c.port,symbolPort:l.symbolPort}),o.add(l.symbolPort)}return s};function Uw(t,e,r,n){let i=Math.sqrt((r.x-t.x)**2+(r.y-t.y)**2),o=Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2)/i,c=e.x-o*t.x,l=e.y-o*t.y,a=Rt(c,l),p=oe(o,o);return Ct(a,p)}function oT(t){let e=[],r=new Map,n=new Map,i=null;for(let s of t)if(s.type==="schematic_component")e.push(s);else if(s.type==="schematic_port"&&s.schematic_component_id){let o=r.get(s.schematic_component_id)??[];o.push(s),r.set(s.schematic_component_id,o)}else if(s.type==="source_component")n.set(s.source_component_id,s);for(let s of e){let o=sT({component:s,schematicPorts:r.get(s.schematic_component_id)??[],sourceComponent:s.source_component_id?n.get(s.source_component_id):void 0});if(!o)continue;i=i?Gw(i,o):o}return i}function sT({component:t,schematicPorts:e,sourceComponent:r}){if(!t.symbol_name)return null;let n=Gr[t.symbol_name];if(!n)return null;let i=zw({schPorts:e,symbol:n,schComponent:t});if(!i[0])return null;let s=Uw(i[1]?.symbolPort??n.center,i[1]?.schPort.center??t.center,i[0].symbolPort,i[0].schPort.center),o=null;for(let c of n.primitives){if(c.type!=="text")continue;let l=aT({primitive:c,component:t,sourceComponent:r});if(!l)continue;let a=O(s,c),p=yr("reference_designator"),d=cT({x:a.x,y:a.y,width:Do(l)*p,height:p,anchor:c.anchor});o=o?Gw(o,d):d}return o}function aT({primitive:t,component:e,sourceComponent:r}){if(t.text==="{REF}")return r?.display_name??r?.name??"";if(t.text==="{VAL}")return e.symbol_display_value??"";return""}function cT({x:t,y:e,width:r,height:n,anchor:i}){let s=t,o=t,c=e-n/2,l=e+n/2;if(i.includes("left"))o=t+r;else if(i.includes("right"))s=t-r;else s=t-r/2,o=t+r/2;if(i.includes("top"))c=e-n,l=e;else if(i.includes("bottom"))c=e,l=e+n;return{minX:s,minY:c,maxX:o,maxY:l}}function Gw(t,e){return{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}var Hw=(t,e)=>{if(t.column_widths&&t.column_widths.length>0&&t.row_heights&&t.row_heights.length>0){let p=(d)=>{if(typeof d==="number")return d;if(d.endsWith("mm"))return parseFloat(d);if(d.endsWith("in"))return parseFloat(d)*25.4;return parseFloat(d)};return{column_widths:t.column_widths.map(p),row_heights:t.row_heights.map(p)}}let r=e.filter((p)=>p.type==="schematic_table_cell"&&p.schematic_table_id===t.schematic_table_id);if(r.length===0)return{column_widths:[],row_heights:[]};let n=r.reduce((p,d)=>Math.max(p,d.end_column_index),-1)+1,i=r.reduce((p,d)=>Math.max(p,d.end_row_index),-1)+1,{cell_padding:s=0.2}=t,o=Array(n).fill(0),c=Array(i).fill(0),l={},a={};for(let p of r){let d=yr("reference_designator",p.font_size),f=Do(p.text??"")*d+2*s,_=d*1.2+2*s,g=`${p.start_row_index}-${p.start_column_index}`;l[g]=f,a[g]=_}for(let p=0;p<i;p++)for(let d=0;d<n;d++){let m=`${p}-${d}`;if(l[m]&&l[m]>o[d])o[d]=l[m];if(a[m]&&a[m]>c[p])c[p]=a[m]}for(let p of r){if(p.start_column_index===p.end_column_index&&p.start_row_index===p.end_row_index)continue;let d=`${p.start_row_index}-${p.start_column_index}`,m=l[d],f=a[d];if(m===void 0||f===void 0)continue;let _=0;for(let y=p.start_column_index;y<=p.end_column_index;y++)_+=o[y];if(m>_){let S=(m-_)/(p.end_column_index-p.start_column_index+1);for(let P=p.start_column_index;P<=p.end_column_index;P++)o[P]+=S}let g=0;for(let y=p.start_row_index;y<=p.end_row_index;y++)g+=c[y];if(f>g){let S=(f-g)/(p.end_row_index-p.start_row_index+1);for(let P=p.start_row_index;P<=p.end_row_index;P++)c[P]+=S}}return{column_widths:o,row_heights:c}},lT=10.16,pT=1.1,_r=lT/pT,hT=297/_r,dT=210/_r,Vst=20/_r,Il=5/_r;function Qf(t={}){let e=t.center??{x:0,y:0},r=t.sheet_width===void 0?hT:t.sheet_width/_r,n=t.sheet_height===void 0?dT:t.sheet_height/_r,i=e.x-r/2,s=e.x+r/2,o=e.y-n/2,c=e.y+n/2;return{center:e,width:r,height:n,minX:i,maxX:s,minY:o,maxY:c,innerMinX:i+Il,innerMaxX:s-Il,innerMinY:o+Il,innerMaxY:c-Il}}function mT(t,e=0.5){let{POSITIVE_INFINITY:r,POSITIVE_INFINITY:n,NEGATIVE_INFINITY:i,NEGATIVE_INFINITY:s}=Number,o=0.2;for(let a of t)if(a.type==="schematic_sheet"){let p=Qf(a);l(p.center,{width:p.width,height:p.height},0)}else if(a.type==="schematic_component")l(a.center,a.size,0);else if(a.type==="schematic_port")l(a.center,{width:o,height:o},0);else if(a.type==="schematic_debug_object"){if(a.shape==="rect")l(a.center,a.size,0);else if(a.shape==="line")l(a.start,{width:0.1,height:0.1},0),l(a.end,{width:0.1,height:0.1},0)}else if(a.type==="schematic_net_label"){let p=yr("net_label"),d=Ll(a),f=(d+fr*2+Ri*(a.text?.length||0)+Ei)*p,_=Dw,g=rT(a.anchor_side)/180*Math.PI,y=nT(a,p,d),S=Oi(a.anchor_side),P={x:y.x+S.x*f/2,y:y.y+S.y*f/2};l(P,{width:f,height:_},g)}else if(a.type==="schematic_trace")for(let p of a.edges)l(p.from,{width:0.1,height:0.1},0),l(p.to,{width:0.1,height:0.1},0);else if(a.type==="schematic_text"){let d=yr("reference_designator",a.font_size)??0.18,m=a.text??"",f=a.display_superscript;if(f){let _=m.split(`
`),g=Math.max(..._.map((B,k)=>Ll({text:B,display_superscript:k===_.length-1?f:void 0})))*d,y=a.anchor,S=y==="left"||y.endsWith("_left")?g/2:y==="right"||y.endsWith("_right")?-g/2:0,P=y==="top"||y.startsWith("top_")?0:y==="bottom"||y.startsWith("bottom_")?-d:-d/2,b=(_.length+0.3)*d,C=-(P-0.3*d+b/2),L=-(a.rotation??0)*Math.PI/180;l({x:a.position.x+S*Math.cos(L)-C*Math.sin(L),y:a.position.y+S*Math.sin(L)+C*Math.cos(L)},{width:g,height:b},L)}else{let _=m.length*d,g=d;l(a.position,{width:_,height:g},a.rotation??0)}}else if(a.type==="schematic_voltage_probe"){if(l(a.position,{width:0.2,height:0.4},0),a.name){let p=yr("net_label"),d=Do(a.name)*p,m=p,f=0.3,_=a.label_alignment??"top_right",g=a.position.x,y=a.position.y;if(_.includes("top"))y+=0.3+m/2;else if(_.includes("bottom"))y-=0.3+m/2;if(_.includes("right"))g+=0.3+d/2;else if(_.includes("left"))g-=0.3+d/2;l({x:g,y},{width:d,height:m},0)}}else if(a.type==="schematic_box")l({x:a.x+a.width/2,y:a.y+a.height/2},{width:a.width,height:a.height},0);else if(a.type==="schematic_table"){let{column_widths:p,row_heights:d}=Hw(a,t),m=p.reduce((b,C)=>b+C,0),f=d.reduce((b,C)=>b+C,0),_=a.anchor??"center",g=a.anchor_position.x,y=a.anchor_position.y;if(_.includes("center"))g-=m/2;else if(_.includes("right"))g-=m;if(_.includes("center"))y+=f/2;else if(_.includes("bottom"))y+=f;let S=g+m/2,P=y-f/2;l({x:S,y:P},{width:m,height:f},0)}else if(a.type==="schematic_line")l({x:a.x1,y:a.y1},{width:0.02,height:0.02},0),l({x:a.x2,y:a.y2},{width:0.02,height:0.02},0);else if(a.type==="schematic_circle")l(a.center,{width:a.radius*2,height:a.radius*2},0);else if(a.type==="schematic_rect")l(a.center,{width:a.width,height:a.height},a.rotation);else if(a.type==="schematic_arc")l(a.center,{width:a.radius*2,height:a.radius*2},0);else if(a.type==="schematic_path"){if(a.points&&a.points.length>0)for(let p of a.points)l(p,{width:0.02,height:0.02},0)}if(!Number.isFinite(r))r=-1,n=-1,i=1,s=1;r-=e,n-=e,i+=e,s+=e;let c=oT(t);if(c){if(c.minX<r)r=c.minX-e;if(c.minY<n)n=c.minY-e;if(c.maxX>i)i=c.maxX+e;if(c.maxY>s)s=c.maxY+e}return{minX:r,minY:n,maxX:i,maxY:s};function l(a,p,d){let m=[{x:-p.width/2,y:-p.height/2},{x:p.width/2,y:-p.height/2},{x:p.width/2,y:p.height/2},{x:-p.width/2,y:p.height/2}];for(let f of m){let _=f.x*Math.cos(d)-f.y*Math.sin(d)+a.x,g=f.x*Math.sin(d)+f.y*Math.cos(d)+a.y;r=Math.min(r,_),n=Math.min(n,g),i=Math.max(i,_),s=Math.max(s,g)}}}function Fl(t){if(!Number.isFinite(t))return"0";return Number.parseFloat(t.toFixed(6)).toString()}var Vo="image/svg+xml";function uT({schematicGraphic:t,viewport:e}){let r=fT(t);return{name:"g",type:"element",value:"",attributes:{class:"schematic-graphic","pointer-events":"none","data-circuit-json-type":"schematic_graphic","data-schematic-graphic-id":t.schematic_graphic_id,...t.schematic_sheet_id?{"data-schematic-sheet-id":t.schematic_sheet_id}:{}},children:[{name:"image",type:"element",value:"",attributes:{href:r,x:Fl(e.x),y:Fl(e.y),width:Fl(e.width),height:Fl(e.height),preserveAspectRatio:"xMidYMid meet",overflow:"hidden","pointer-events":"none"},children:[]}]}}function fT(t){let e=`Unable to render schematic graphic "${t.schematic_graphic_id}"`,{asset:r,svg_content:n}=t;if(!r){if(n!==void 0)return Mw(n);throw Error(`${e}: asset or svg_content is required`)}if(Qw(r.mimetype)!==Vo)throw Error(`${e}: asset.mimetype must be "${Vo}" (received ${JSON.stringify(r.mimetype)})`);let i=r.url.trim();if(i.toLowerCase().startsWith("data:"))return yT(i,e),i;if(n!==void 0)return Mw(n);throw Error(`${e}: asset.url must be an inline SVG data URL because circuit-to-svg cannot synchronously load ${JSON.stringify(r.url)}`)}function yT(t,e){let r=t.match(/^data:([^,]*),(.*)$/is);if(!r)throw Error(`${e}: asset.url is not a valid SVG data URL`);let n=r[1].split(";").map((l)=>l.trim());if(Qw(n.shift()??"")!==Vo)throw Error(`${e}: asset.url must use the "${Vo}" media type`);let s=r[2],o=n.findIndex((l)=>l.toLowerCase()==="base64"),c=o!==-1;if(c&&o!==n.length-1)throw Error(`${e}: asset.url must place "base64" as its final metadata token`);if(c){let l=s.replace(/\s+/g,"");if(!/^(?:[a-z\d+/]{4})*(?:[a-z\d+/]{2}==|[a-z\d+/]{3}=)?$/i.test(l))throw Error(`${e}: asset.url is not a valid SVG data URL`);return}if(s.includes("#"))throw Error(`${e}: asset.url must percent-encode "#" in a non-base64 SVG data URL`);try{decodeURIComponent(s)}catch(l){throw Error(`${e}: asset.url is not a valid SVG data URL`,{cause:l})}}function Mw(t){let e=new TextEncoder().encode(t),r="",n=32768;for(let i=0;i<e.length;i+=n)r+=String.fromCharCode(...e.subarray(i,i+n));return`data:${Vo};base64,${btoa(r)}`}function Qw(t){return(t.split(";",1)[0]??"").trim().toLowerCase()}var Gt=(t)=>Math.abs(t.a)*0.02,Gf=({text:t,realCenter:e,realToScreenTransform:r})=>{let n=O(r,e);return{type:"element",name:"text",value:"",attributes:{x:n.x.toString(),y:n.y.toString(),fill:"red","text-anchor":"middle","dominant-baseline":"middle","font-family":"sans-serif","font-size":`${fe(r,"error")}px`},children:[{type:"text",value:t,name:"",attributes:{},children:[]}]}},_T=({schNetLabel:t,realToScreenTransform:e,colorMap:r})=>{if(!t.text)return[];let n=t.text.startsWith("N_"),i=n?t.text.slice(2):t.text,s=Vw(t),o=[],c=Gr[t.symbol_name];if(!c){let et=Gf({text:`Symbol not found: ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e});return et.attributes={...et.attributes,...s},o.push(et),o}let l=c.primitives.filter((et)=>et.type==="path"),a=c.primitives.filter((et)=>et.type==="text"),p=c.primitives.filter((et)=>et.type==="circle"),d=c.primitives.filter((et)=>et.type==="box"),m={minX:Math.min(...l.flatMap((et)=>et.points.map((D)=>D.x))),maxX:Math.max(...l.flatMap((et)=>et.points.map((D)=>D.x))),minY:Math.min(...l.flatMap((et)=>et.points.map((D)=>D.y))),maxY:Math.max(...l.flatMap((et)=>et.points.map((D)=>D.y)))},f=yr("net_label"),g=Ll({...t,text:i})+fr*2+Ri*i.length+Ei,y=Oi(t.anchor_side),S=t.anchor_position??{x:t.center.x-y.x*g*f/2,y:t.center.y-y.y*g*f/2},b=Se(0/180*Math.PI),C={minX:Math.min(...c.primitives.flatMap((et)=>et.type==="path"?et.points.map((D)=>D.x):[])),maxX:Math.max(...c.primitives.flatMap((et)=>et.type==="path"?et.points.map((D)=>D.x):[])),minY:Math.min(...c.primitives.flatMap((et)=>et.type==="path"?et.points.map((D)=>D.y):[])),maxY:Math.max(...c.primitives.flatMap((et)=>et.type==="path"?et.points.map((D)=>D.y):[]))},L=c.ports?.[0]?{x:c.ports[0].x,y:c.ports[0].y}:{x:C.minX,y:(C.minY+C.maxY)/2},B=O(b,L),k=Ct(Rt(S.x-B.x,S.y-B.y),b,oe(1)),[I,j]=O(Ct(e,k),[m.minX,m.minY]),[Q,lt]=O(Ct(e,k),[m.maxX,m.maxY]),z=Math.abs(lt-j),N=Math.min(j,lt),at=Math.abs(Q-I),ot=Math.min(I,Q);o.push({name:"rect",type:"element",value:"",attributes:{class:"component-overlay sch-component-overlay sch-net-label-overlay",...s,x:ot.toString(),y:N.toString(),width:at.toString(),height:z.toString(),fill:"transparent"},children:[]});for(let et of l){let D=et.points.map((it,rt)=>{let[G,H]=O(Ct(e,k),[it.x,it.y]);return`${rt===0?"M":"L"} ${G} ${H}`}).join(" ");o.push({name:"path",type:"element",attributes:{class:"sch-net-label-symbol-path",...s,d:D+(et.closed?" Z":""),stroke:r.schematic.component_outline,fill:"none","stroke-width":`${Gt(e)}px`,"stroke-linecap":"round"},value:"",children:[]})}for(let et of a){let D=O(Ct(e,k),et),it=et.text;if(it==="{REF}")it=i||"";else if(it==="{VAL}")it="";let G=Math.abs(e.a)*0.1,H={x:D.x,y:D.y};o.push({name:"text",type:"element",attributes:{class:"sch-net-label-symbol-text",...s,x:H.x.toString(),y:H.y.toString(),fill:r.schematic.label_local,"font-family":"sans-serif","text-anchor":eT[et.anchor],"dominant-baseline":Fw[et.anchor],"font-size":`${fe(e,"reference_designator")}px`,...n&&it===i?{style:"text-decoration: overline;"}:{}},children:Hf(it,et.text==="{REF}"?t.display_superscript:void 0,fe(e,"reference_designator"),Fw[et.anchor]),value:""})}for(let et of d){let D=O(Ct(e,k),et),it=Ct(e,k).a;o.push({name:"rect",type:"element",attributes:{class:"sch-net-label-symbol-box",...s,x:D.x.toString(),y:D.y.toString(),width:(et.width*it).toString(),height:(et.height*it).toString(),fill:"red"},value:"",children:[]})}for(let et of p){let D=O(Ct(e,k),et),it=Ct(e,k).a;o.push({name:"circle",type:"element",attributes:{class:"sch-net-label-symbol-circle",...s,cx:D.x.toString(),cy:D.y.toString(),r:(et.radius*it).toString(),fill:"none",stroke:r.schematic.component_outline,"stroke-width":`${Gt(e)}px`},value:"",children:[]})}return o},gT=({schNetLabel:t,realToScreenTransform:e,colorMap:r})=>{if(!t.text)return[];let n=t.text;if(t.symbol_name)return _T({schNetLabel:t,realToScreenTransform:e,colorMap:r});let i=Vw(t),s=[],o=fe(e,"net_label"),c=yr("net_label"),l=Dw/c/2,a=Ll({...t,text:n}),p=O(e,t.center),d=Oi(t.anchor_side),m={...d};m.y*=-1;let f=a+fr*2+Ri*n.length+Ei,_=t.anchor_position?O(e,t.anchor_position):{x:p.x-m.x*f*o/2,y:p.y-m.y*f*o/2},g=t.anchor_position??{x:t.center.x-d.x*f*c/2,y:t.center.y-d.y*f*c/2},y={left:0,top:-90,bottom:90,right:180}[t.anchor_side],S=[{x:0,y:0},{x:fr,y:l},{x:fr*2+Ei+Ri*n.length+a,y:l},{x:fr*2+Ei+Ri*n.length+a,y:-l},{x:fr,y:-l}].map((B)=>O(Ct(e,Rt(g.x,g.y),oe(c),Se(y/180*Math.PI)),B)),P=`
    M ${S[0].x},${S[0].y}
    L ${S[1].x},${S[1].y}
    L ${S[2].x},${S[2].y}
    L ${S[3].x},${S[3].y}
    L ${S[4].x},${S[4].y}
    Z
  `;s.push({name:"path",type:"element",attributes:{class:"net-label sch-net-label",...i,d:P,fill:r.schematic.label_background,stroke:r.schematic.label_global,"stroke-width":`${Gt(e)}px`},value:"",children:[]});let b={x:_.x+m.x*o*0.5,y:_.y+m.y*o*0.5},C={left:"start",top:"start",bottom:"start",right:"end"}[t.anchor_side],L={left:"",right:"",top:`rotate(90 ${b.x} ${b.y})`,bottom:`rotate(-90 ${b.x} ${b.y})`}[t.anchor_side];return s.push({name:"text",type:"element",attributes:{class:"net-label-text sch-net-label-text",...i,x:b.x.toString(),y:b.y.toString(),fill:r.schematic.label_global,"text-anchor":C,"dominant-baseline":"central","font-family":"sans-serif","font-variant-numeric":"tabular-nums","font-size":`${o}px`,transform:L},children:Hf(n,t.display_superscript,o),value:""}),s},xT=0.02,bT=({schPort:t,transform:e})=>{let r=O(e,t.center),n=Math.abs(e.a)*xT*2;return[{name:"g",type:"element",value:"",attributes:{class:"schematic-port-hover sch-port-hover","data-schematic-port-id":t.source_port_id,...t.schematic_sheet_id?{"data-schematic-sheet-id":t.schematic_sheet_id}:{}},children:[{name:"circle",type:"element",value:"",attributes:{cx:r.x.toString(),cy:r.y.toString(),r:n.toString(),fill:"red",opacity:"0"},children:[]}]}]},vT=({component:t,transform:e,circuitJson:r})=>{let n=Kt(r).schematic_port.list({schematic_component_id:t.schematic_component_id}),i=[];for(let s of n)i.push(...bT({schPort:s,transform:e}));return i},ST=({schPort:t,transform:e,colorMap:r})=>{let{x:i,y:s}=t.center,o=[-1,1].map((c)=>{let l=O(e,{x:i-0.05,y:s-c*0.05}),a=O(e,{x:i+0.05,y:s+c*0.05});return`M ${l.x} ${l.y} L ${a.x} ${a.y}`}).join(" ");return{name:"path",type:"element",value:"",attributes:{class:"sch-port-no-connect","data-schematic-port-id":t.schematic_port_id,"data-source-port-id":t.source_port_id,d:o,fill:"none",stroke:r.schematic.no_connect,"stroke-width":`${Gt(e)}px`,"stroke-linecap":"round"},children:[]}},Cw=0.02,wT=({schPort:t,transform:e,circuitJson:r,colorMap:n})=>{let i=[],s=Math.abs(e.a)*Cw,o=Math.abs(e.a)*Cw,c=O(e,t.center),l=r.find((p)=>p.type==="source_port"&&p.source_port_id===t.source_port_id);if(!l?.do_not_connect)i.push({name:"circle",type:"element",value:"",attributes:{class:"component-pin sch-component-pin sch-port-indicator",cx:c.x.toString(),cy:c.y.toString(),r:s.toString(),fill:"none",stroke:n.schematic.component_outline,"stroke-width":o.toString(),"data-schematic-port-id":t.schematic_port_id},children:[]});let a=t.display_pin_label??l?.name;if(a){let p={...t.center},d=t.distance_from_component_edge??0,m=0.05,f="middle",_="";switch(t.facing_direction){case"left":p.x+=d/2,p.y+=0.05,f="start";break;case"right":p.x-=d/2,p.y+=0.05,f="end";break;case"up":p.y-=d/2,p.x-=0.05,f="middle";break;case"down":p.y+=d/2,p.x-=0.05,f="middle";break}let g=O(e,p),y=fe(e,"pin_number");if(t.facing_direction==="up"||t.facing_direction==="down")_=`rotate(-90 ${g.x} ${g.y})`;i.push({name:"text",type:"element",value:"",attributes:{class:"port-indicator-label sch-port-label",x:g.x.toString(),y:g.y.toString(),fill:n.schematic.component_outline,"font-family":"sans-serif","font-size":`${y*0.7}px`,"text-anchor":f,"dominant-baseline":"middle",..._&&{transform:_}},children:[{type:"text",value:a,name:"",attributes:{},children:[]}]})}return i},Zw=(t)=>({type:"element",name:"tspan",value:"",attributes:t.is_overlined?{"text-decoration":"overline"}:{},children:[{type:"text",name:"",value:t.text,attributes:{},children:[]}]}),AT=(t)=>t.filter((e)=>e.text).map(Zw),PT=(t)=>{let e=[[]];for(let r of t)r.text.split(`
`).forEach((n,i)=>{if(i>0)e.push([]);if(n)e.at(-1).push(Zw({...r,text:n}))});return e},Zf=({elm:t,transform:e,colorMap:r})=>{let n=O(e,t.position),i={center:"middle",center_right:"end",bottom_left:"start",bottom_center:"middle",bottom_right:"end",left:"start",right:"end",top:"middle",bottom:"middle",top_left:"start",top_center:"middle",top_right:"end",center_left:"start"},s={center:"middle",center_right:"middle",bottom_left:"ideographic",bottom_center:"ideographic",bottom_right:"ideographic",left:"middle",right:"middle",top:"hanging",bottom:"ideographic",top_left:"hanging",top_center:"hanging",top_right:"hanging",center_left:"middle"},o=t.text.split(`
`),c=PT(t.text_parts??[]),l=o.length===1?t.text_parts?.length?c[0]:[{type:"text",value:t.text,name:t.schematic_text_id,attributes:{},children:[]}]:o.map((a,p)=>({type:"element",name:"tspan",value:"",attributes:{x:n.x.toString(),...p>0?{dy:"1em"}:{}},children:t.text_parts?.length?c[p]??[]:[{type:"text",value:a,name:p===0?t.schematic_text_id:"",attributes:{},children:[]}]}));if(t.display_superscript)(o.length===1?l:l[l.length-1].children).push(...Hf("",t.display_superscript,fe(e,"reference_designator",t.font_size),s[t.anchor]).slice(1));return{type:"element",name:"text",value:"",attributes:{class:"sch-text",x:n.x.toString(),y:n.y.toString(),fill:t.color??r.schematic.sheet_label,"text-anchor":i[t.anchor],"dominant-baseline":s[t.anchor],"font-family":"sans-serif","font-size":`${fe(e,"reference_designator",t.font_size)}px`,transform:`rotate(${t.rotation}, ${n.x}, ${n.y})`},children:l}};function qw({schArc:t,transform:e,colorMap:r}){let n=O(e,t.center),i=Math.abs(e.a)*t.radius,s=t.stroke_width??0.02,o=Math.abs(e.a)*s,c=t.start_angle_degrees*Math.PI/180,l=t.end_angle_degrees*Math.PI/180,a=n.x+i*Math.cos(c),p=n.y+i*Math.sin(c),d=n.x+i*Math.cos(l),m=n.y+i*Math.sin(l),f=t.end_angle_degrees-t.start_angle_degrees;if(t.direction==="clockwise")f=-f;if(f<0)f+=360;let _=f>180?1:0,g=t.direction==="clockwise"?1:0;return[{name:"path",type:"element",attributes:{class:"sch-arc",d:`M ${a} ${p} A ${i} ${i} 0 ${_} ${g} ${d} ${m}`,fill:"none",stroke:t.color,"stroke-width":o.toString(),...t.is_dashed&&{"stroke-dasharray":(o*3).toString()},"data-schematic-arc-id":t.schematic_arc_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}var BT=({schematicBox:t,transform:e,colorMap:r})=>{let n=O(e,{x:t.x,y:t.y}),i=O(e,{x:t.x+t.width,y:t.y+t.height}),s=Math.min(n.y,i.y),o=Math.max(n.y,i.y),c=Math.min(n.x,i.x),l=Math.max(n.x,i.x),a=Gt(e),p={class:"schematic-box sch-box",x:c.toString(),y:s.toString(),width:(l-c).toString(),height:(o-s).toString(),"stroke-width":`${a}px`,stroke:r.schematic.component_outline||"black",fill:"transparent"};if(t.is_dashed){let d=8*a,m=4*a;p["stroke-dasharray"]=`${d} ${m}`}return[{name:"rect",type:"element",value:"",attributes:p,children:[]}]};function Jw({schCircle:t,transform:e,colorMap:r}){let n=O(e,t.center),i=Math.abs(e.a)*t.radius,s=t.stroke_width??0.02,o=Math.abs(e.a)*s;return[{name:"circle",type:"element",attributes:{class:"sch-circle",cx:n.x.toString(),cy:n.y.toString(),r:i.toString(),fill:t.is_filled?t.fill_color??t.color:"none",stroke:t.color,"stroke-width":o.toString(),...t.is_dashed&&{"stroke-dasharray":(o*3).toString()},"data-schematic-circle-id":t.schematic_circle_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}var Kw=(t,e)=>{for(let r of t){if(r.type!=="source_trace")continue;let n=r;if(Array.isArray(n.connected_source_port_ids)&&n.connected_source_port_ids.includes(e))return!0}return!1},IT={top_left:"start",top_right:"end",middle_left:"start",middle_right:"end",bottom_left:"start",bottom_right:"end",center:"middle",middle_top:"middle",middle_bottom:"middle"},FT={top_left:"hanging",top_right:"hanging",bottom_left:"ideographic",bottom_right:"ideographic",center:"middle",middle_left:"middle",middle_right:"middle",middle_top:"hanging",middle_bottom:"ideographic"},MT=({component:t,transform:e,circuitJson:r,colorMap:n})=>{let i=[],s=Gr[t.symbol_name];if(!s)return[Gf({text:`Symbol not found: ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e})];let o=Kt(r).schematic_port.list({schematic_component_id:t.schematic_component_id}),c=Kt(r).source_component.get(t.source_component_id),l=zw({schPorts:o,symbol:s,schComponent:t});if(!l[0])return[Gf({text:`Could not match ports for symbol ${t.symbol_name}`,realCenter:t.center,realToScreenTransform:e})];let a=Uw(l[1]?.symbolPort??s.center,l[1]?.schPort.center??t.center,l[0].symbolPort,l[0].schPort.center),p=s.primitives.filter((I)=>I.type==="path"),d=s.primitives.filter((I)=>I.type==="text"),m=s.primitives.filter((I)=>I.type==="circle"),f=s.primitives.filter((I)=>I.type==="box"),_=new Set;for(let I of l)if(Kw(r,I.schPort.source_port_id)||Kt(r).source_port.get(I.schPort.source_port_id)?.do_not_connect)_.add(I.symbolPort);let g={minX:Math.min(...p.flatMap((I)=>I.points.map((j)=>j.x))),maxX:Math.max(...p.flatMap((I)=>I.points.map((j)=>j.x))),minY:Math.min(...p.flatMap((I)=>I.points.map((j)=>j.y))),maxY:Math.max(...p.flatMap((I)=>I.points.map((j)=>j.y)))},[y,S]=O(Ct(e,a),[g.minX,g.minY]),[P,b]=O(Ct(e,a),[g.maxX,g.maxY]),C=Math.abs(b-S),L=Math.min(S,b),B=Math.abs(P-y),k=Math.min(y,P);i.push({name:"rect",type:"element",value:"",attributes:{class:"component-overlay sch-component-overlay",x:k.toString(),y:L.toString(),width:B.toString(),height:C.toString(),fill:"transparent"},children:[]});for(let I of p){let{points:j,color:Q,closed:lt,fill:z}=I;i.push({type:"element",name:"path",attributes:{class:"sch-component-symbol-path",d:j.map((N,at)=>{let[ot,et]=O(Ct(e,a),[N.x,N.y]);return`${at===0?"M":"L"} ${ot} ${et}`}).join(" ")+(lt?" Z":""),stroke:n.schematic.component_outline,fill:"none","stroke-width":`${Gt(e)}px`,"stroke-linecap":"round"},value:"",children:[]})}for(let I of d){let j=O(Ct(e,a),I),Q="",lt=I.text==="{REF}";if(lt)Q=c?.display_name??c?.name??"";else if(I.text==="{VAL}")Q=t.symbol_display_value??"";let z=FT[I.anchor];i.push({name:"text",type:"element",attributes:{class:lt?"sch-component-name sch-component-text":"sch-component-text",x:j.x.toString(),y:j.y.toString(),...lt?{stroke:n.schematic.background,"stroke-width":`${Gt(e)}px`,"paint-order":"stroke"}:{},fill:n.schematic.label_local,"font-family":"sans-serif","text-anchor":IT[I.anchor],"dominant-baseline":z,"font-size":`${fe(e,"reference_designator")}px`},value:"",children:[{type:"text",value:Q,name:"",attributes:{},children:[]}]})}for(let I of f){let j=O(Ct(e,a),I),Q=Ct(e,a).a;i.push({name:"rect",type:"element",attributes:{class:"sch-component-symbol-box",x:j.x.toString(),y:j.y.toString(),width:(I.width*Q).toString(),height:(I.height*Q).toString(),fill:"red"},value:"",children:[]})}for(let I of s.ports){if(_.has(I))continue;let j=O(Ct(e,a),I);i.push({type:"element",name:"circle",attributes:{class:"component-pin sch-component-pin",cx:j.x.toString(),cy:j.y.toString(),r:`${Math.abs(e.a)*0.02}px`,"stroke-width":`${Gt(e)}px`,fill:"none",stroke:n.schematic.component_outline},value:"",children:[]})}for(let I of m){let j=O(Ct(e,a),I),Q=Math.abs(I.radius*e.a);i.push({type:"element",name:"circle",attributes:{class:"sch-component-symbol-circle",cx:j.x.toString(),cy:j.y.toString(),r:`${Q}px`,"stroke-width":`${Gt(e)}px`,fill:"none",stroke:n.schematic.component_outline},value:"",children:[]})}return i},Wo=0.02,kw=(t,e,r,n,i)=>{let s=Math.PI/6,o={x:t.x-r*Math.cos(e-s),y:t.y-r*Math.sin(e-s)},c={x:t.x-r*Math.cos(e+s),y:t.y-r*Math.sin(e+s)};return{name:"polygon",type:"element",attributes:{points:`${t.x},${t.y} ${o.x},${o.y} ${c.x},${c.y}`,fill:"white",stroke:n,"stroke-width":`${i}px`},value:"",children:[]}},CT=({schPort:t,schComponent:e,transform:r,circuitJson:n})=>{let i=[],s=Kt(n).source_port.get(t.source_port_id),o={x:t.center.x,y:t.center.y},c=t.distance_from_component_edge??0.4;switch(t.side_of_component){case"left":o.x+=c;break;case"right":o.x-=c;break;case"top":o.y-=c;break;case"bottom":o.y+=c;break}let l=O(r,t.center),a=O(r,o),p=s!=null&&s.source_component_id==null&&typeof t.is_connected==="boolean"?t.is_connected:Kw(n,t.source_port_id),d=t.is_drawn_with_inversion_circle??!1,m=0.06,f={...t.center};if(!p&&!s?.do_not_connect)switch(t.side_of_component){case"left":f.x+=Wo;break;case"right":f.x-=Wo;break;case"top":f.y-=Wo;break;case"bottom":f.y+=Wo;break}let _=O(r,f);if(d){let b=Math.abs(r.a)*m,C={...a};switch(t.side_of_component){case"left":C.x-=b,a.x-=b*2;break;case"right":C.x+=b,a.x+=b*2;break;case"top":C.y-=b,a.y-=b*2;break;case"bottom":C.y+=b,a.y+=b*2;break}i.push({name:"circle",type:"element",attributes:{class:"component-pin sch-component-pin sch-inversion-bubble",cx:C.x.toString(),cy:C.y.toString(),r:b.toString(),fill:"white",stroke:re.schematic.component_outline,"stroke-width":`${Gt(r)}px`},value:"",children:[]})}i.push({name:"line",type:"element",attributes:{class:"component-pin sch-component-pin sch-port-line",x1:a.x.toString(),y1:a.y.toString(),x2:_.x.toString(),y2:_.y.toString(),"stroke-width":`${Gt(r)}px`},value:"",children:[]});let g=Math.abs(r.a)*Wo,y=[];if(!p&&!s?.do_not_connect)y.push({name:"circle",type:"element",attributes:{class:"component-pin sch-component-pin sch-port-terminal",cx:l.x.toString(),cy:l.y.toString(),r:g.toString(),"stroke-width":`${Gt(r)}px`},value:"",children:[]});y.push({name:"rect",type:"element",attributes:{x:(l.x-g).toString(),y:(l.y-g).toString(),width:(g*2).toString(),height:(g*2).toString(),opacity:"0"},value:"",children:[]}),i.push({name:"g",type:"element",value:"",attributes:{class:"sch-port","data-schematic-port-id":t.source_port_id},children:y});let{has_input_arrow:S,has_output_arrow:P}=t;if((S||P)&&t.side_of_component){let b=Math.abs(r.a)*0.1,C=re.schematic.component_outline,L=b*Math.cos(Math.PI/6),B=Gt(r)/3,k=0,I=0;if(t.side_of_component==="left")k=0,I=Math.PI;else if(t.side_of_component==="right")k=Math.PI,I=0;else if(t.side_of_component==="top")k=Math.PI/2,I=-Math.PI/2;else if(t.side_of_component==="bottom")k=-Math.PI/2,I=Math.PI/2;let j=S&&P,Q={...a},lt={...a};if(j){let z=L;if(t.side_of_component==="left")lt.x-=z;else if(t.side_of_component==="right")lt.x+=z;else if(t.side_of_component==="top")lt.y-=z;else if(t.side_of_component==="bottom")lt.y+=z}if(S)i.push(kw(Q,k,b,C,B));if(P){let z={x:lt.x+b*Math.cos(I),y:lt.y+b*Math.sin(I)};i.push(kw(z,I,b,C,B))}}return i},kT=(t)=>{let e=[],{schPort:r,schComponent:n,transform:i,circuitJson:s}=t,o={x:r.center.x,y:r.center.y};if(!r.side_of_component)return[];let c=Oi(r.side_of_component),l=r.distance_from_component_edge??0.4;if(o.x+=c.x*l/2,o.y+=c.y*l/2,r.side_of_component==="top"||r.side_of_component==="bottom")o.x-=0.02;else o.y+=0.02;let a=O(i,o);return e.push({name:"text",type:"element",attributes:{class:"pin-number sch-pin-number",x:a.x.toString(),y:a.y.toString(),style:"font-family: sans-serif;",fill:re.schematic.pin_number,"text-anchor":"middle","dominant-baseline":"auto","font-size":`${fe(i,"pin_number")}px`,transform:r.side_of_component==="top"||r.side_of_component==="bottom"?`rotate(-90 ${a.x} ${a.y})`:""},children:[{type:"text",value:r.pin_number?.toString()||"",name:"",attributes:{},children:[]}],value:""}),e},Nw=0.1,t4=(t)=>{let e=[],{schPort:r,schComponent:n,transform:i,labelColor:s=re.schematic.pin_number,labelClassName:o="pin-number sch-pin-label"}=t,c={x:r.center.x,y:r.center.y};if(!r.side_of_component)return[];let l=Oi(r.side_of_component),a=r.distance_from_component_edge??0.4;c.x+=l.x*(a+Nw),c.y+=l.y*(a+Nw);let p=O(i,c),d=r.display_pin_label??n.port_labels?.[`${r.pin_number}`];if(!d)return[];let m=d.startsWith("N_"),f=m?d.slice(2):d,_=r.display_pin_label_text_parts,g=r.is_drawn_with_inversion_circle??!1,y=fe(i,m||g?"negated_pin_number":"pin_number",r.display_pin_label_font_size);return e.push({name:"text",type:"element",attributes:{class:o,x:p.x.toString(),y:p.y.toString(),style:`font-family: sans-serif;${m&&!_?.length?" text-decoration: overline;":""}`,fill:s,"text-anchor":r.side_of_component==="left"||r.side_of_component==="bottom"?"start":"end","dominant-baseline":"middle","font-size":`${y}px`,transform:r.side_of_component==="top"||r.side_of_component==="bottom"?`rotate(-90 ${p.x} ${p.y})`:""},children:_?.length?AT(_):[{type:"text",value:f||"",name:"",attributes:{},children:[]}],value:""}),e},NT=(t)=>{let e=[],{schPort:r,schComponent:n,transform:i,circuitJson:s}=t;return e.push(...CT(t)),e.push(...kT(t)),e.push(...t4(t)),e},YT=({component:t,transform:e,circuitJson:r,colorMap:n})=>{let i=[],s=O(e,{x:t.center.x-t.size.width/2,y:t.center.y+t.size.height/2}),o=O(e,{x:t.center.x+t.size.width/2,y:t.center.y-t.size.height/2}),c=o.x-s.x,l=o.y-s.y;i.push({name:"rect",type:"element",value:"",attributes:{class:"component chip sch-component-body",x:s.x.toString(),y:s.y.toString(),width:c.toString(),height:l.toString(),"stroke-width":`${Gt(e)}px`,fill:n.schematic.component_body,stroke:n.schematic.component_outline},children:[]}),i.push({name:"rect",type:"element",value:"",attributes:{class:"component-overlay sch-component-overlay",x:s.x.toString(),y:s.y.toString(),width:c.toString(),height:l.toString(),fill:"transparent"},children:[]});let a=Kt(r).schematic_text.list();for(let d of a)if(d.schematic_component_id===t.schematic_component_id)i.push(Zf({elm:d,transform:e,colorMap:n}));let p=Kt(r).schematic_port.list({schematic_component_id:t.schematic_component_id});for(let d of p)i.push(...NT({schPort:d,schComponent:t,transform:e,circuitJson:r}));return i};function e4({isDashed:t,dashLength:e,dashGap:r,strokeWidth:n,transform:i}){if(!t)return;let s=Math.abs(i.a),o=n*s*3,c=e!==void 0?e*s:o,l=r!==void 0?r*s:o;return`${c} ${l}`}function r4({schLine:t,transform:e,colorMap:r}){let n=O(e,{x:t.x1,y:t.y1}),i=O(e,{x:t.x2,y:t.y2}),s=t.stroke_width??0.02,o=Math.abs(e.a)*s,c=e4({isDashed:t.is_dashed,dashLength:t.dash_length,dashGap:t.dash_gap,strokeWidth:s,transform:e});return[{name:"line",type:"element",attributes:{class:"sch-line",x1:n.x.toString(),y1:n.y.toString(),x2:i.x.toString(),y2:i.y.toString(),stroke:t.color,"stroke-width":o.toString(),...c&&{"stroke-dasharray":c},"data-schematic-line-id":t.schematic_line_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}function n4({schRect:t,transform:e,colorMap:r}){let n=O(e,t.center),i=Math.abs(e.a)*t.width,s=Math.abs(e.d)*t.height,o=t.stroke_width??0.02,c=Math.abs(e.a)*o,l=n.x-i/2,a=n.y-s/2;return[{name:"rect",type:"element",attributes:{class:"sch-rect",x:l.toString(),y:a.toString(),width:i.toString(),height:s.toString(),fill:t.is_filled?t.fill_color??t.color:"none",stroke:t.color,"stroke-width":c.toString(),...t.is_dashed&&{"stroke-dasharray":(c*3).toString()},...t.rotation!==0&&{transform:`rotate(${t.rotation} ${n.x} ${n.y})`},"data-schematic-rect-id":t.schematic_rect_id,...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}function i4({schPath:t,transform:e,colorMap:r}){let n=t.stroke_color??r.schematic.component_outline,i=t.fill_color??"none",s=t.stroke_width??0.02,o=Math.abs(e.a)*s,c=e4({isDashed:t.is_dashed,dashLength:t.dash_length,dashGap:t.dash_gap,strokeWidth:s,transform:e});if(!t.points||t.points.length<2)return[];return[{name:"path",type:"element",attributes:{class:"sch-path",d:t.points.map((p)=>O(e,{x:p.x,y:p.y})).map((p,d)=>`${d===0?"M":"L"} ${p.x} ${p.y}`).join(" "),stroke:n,"stroke-width":o.toString(),fill:t.is_filled?i:"none","stroke-linecap":"round","stroke-linejoin":"round",...c&&{"stroke-dasharray":c},...t.schematic_component_id&&{"data-schematic-component-id":t.schematic_component_id}},children:[],value:""}]}var LT=({component:t,transform:e,circuitJson:r,colorMap:n})=>{let i=[],s=t.schematic_component_id;for(let o of r){if(!("schematic_component_id"in o)||o.schematic_component_id!==s)continue;if(o.type==="schematic_text"&&t.is_box_with_pins===!1)i.push(Zf({elm:o,transform:e,colorMap:n}));else if(o.type==="schematic_line")i.push(...r4({schLine:o,transform:e,colorMap:n}));else if(o.type==="schematic_circle")i.push(...Jw({schCircle:o,transform:e,colorMap:n}));else if(o.type==="schematic_rect")i.push(...n4({schRect:o,transform:e,colorMap:n}));else if(o.type==="schematic_arc")i.push(...qw({schArc:o,transform:e,colorMap:n}));else if(o.type==="schematic_path")i.push(...i4({schPath:o,transform:e,colorMap:n}))}if(t.is_box_with_pins===!1){let o=r.filter((l)=>l.type==="schematic_line"&&l.schematic_component_id===s),c=r.filter((l)=>l.type==="schematic_port"&&l.schematic_component_id===s);for(let l of c){let a=o.find((g)=>g.x1===l.center.x&&g.y1===l.center.y||g.x2===l.center.x&&g.y2===l.center.y);if(!a)continue;let p=a.x1===l.center.x&&a.y1===l.center.y?{x:a.x2,y:a.y2}:{x:a.x1,y:a.y1},d=p.x-l.center.x,m=p.y-l.center.y,f=Math.abs(d)>Math.abs(m)?d>0?"left":"right":m>0?"bottom":"top",_=Math.max(Math.abs(d),Math.abs(m));i.push(...t4({schPort:{...l,side_of_component:f,distance_from_component_edge:_},schComponent:t,transform:e,circuitJson:r,labelClassName:"port-label sch-pin-label",labelColor:n.schematic.pin_name}))}}return i};function TT(t){let{component:e}=t,r=[];if(e.is_box_with_pins!==!1)if(e.symbol_name)r=MT(t);else r=YT(t);let n=LT(t),i=[...r,...n];return[{type:"element",name:"g",attributes:{class:"sch-component","data-circuit-json-type":"schematic_component","data-schematic-component-id":e.schematic_component_id,...e.schematic_sheet_id?{"data-schematic-sheet-id":e.schematic_sheet_id}:{}},children:i,value:""}]}function ET({debugObject:t,transform:e}){if(t.shape==="rect"){let[r,n]=O(e,[t.center.x-t.size.width/2,t.center.y-t.size.height/2]),[i,s]=O(e,[t.center.x+t.size.width/2,t.center.y+t.size.height/2]);[n,s]=[Math.min(n,s),Math.max(n,s)];let o=Math.abs(i-r),c=Math.abs(s-n),[l,a]=O(e,[t.center.x,t.center.y]);return[{name:"rect",type:"element",value:"",attributes:{x:r.toString(),y:n.toString(),width:o.toString(),height:c.toString(),fill:"none",stroke:"red","stroke-width":(0.02*Math.abs(e.a)).toString(),"stroke-dasharray":"5,5"},children:t.label?[{name:"text",type:"element",value:"",attributes:{x:l.toString(),y:(a-10).toString(),"text-anchor":"middle","font-size":(0.2*Math.abs(e.a)).toString(),fill:"red"},children:[{type:"text",value:t.label,name:"",attributes:{},children:[]}]}]:[]}]}if(t.shape==="line"){let[r,n]=O(e,[t.start.x,t.start.y]),[i,s]=O(e,[t.end.x,t.end.y]),o=(r+i)/2,c=(n+s)/2;return[{name:"line",type:"element",value:"",attributes:{x1:r.toString(),y1:n.toString(),x2:i.toString(),y2:s.toString(),stroke:"red","stroke-width":(0.02*Math.abs(e.a)).toString(),"stroke-dasharray":"5,5"},children:t.label?[{name:"text",type:"element",value:"",attributes:{x:o.toString(),y:(c-10).toString(),"text-anchor":"middle","font-size":(0.2*Math.abs(e.a)).toString(),fill:"red"},children:[{type:"text",value:t.label,name:"",attributes:{},children:[]}]}]:[]}]}return[]}var o4=0.2/_r,RT=3/_r,Ml=["1","2","3","4","5","6"],$o=["A","B","C","D"];function OT({schematicSheet:t,transform:e,colorMap:r}){let n=Qf(t),i=r.schematic.sheet,s=r.schematic.net_name,o=[Yw({id:`${t.schematic_sheet_id}_outer`,center:n.center,width:n.width,height:n.height,transform:e,color:i}),Yw({id:`${t.schematic_sheet_id}_inner`,center:n.center,width:n.innerMaxX-n.innerMinX,height:n.innerMaxY-n.innerMinY,transform:e,color:i})];for(let c=1;c<Ml.length;c++){let l=n.innerMinX+(n.innerMaxX-n.innerMinX)*c/Ml.length;o.push(Cl({id:`${t.schematic_sheet_id}_top_column_${c}`,x1:l,y1:n.maxY,x2:l,y2:n.innerMaxY,transform:e,color:i}),Cl({id:`${t.schematic_sheet_id}_bottom_column_${c}`,x1:l,y1:n.minY,x2:l,y2:n.innerMinY,transform:e,color:i}))}for(let c=1;c<$o.length;c++){let l=n.innerMinY+(n.innerMaxY-n.innerMinY)*c/$o.length;o.push(Cl({id:`${t.schematic_sheet_id}_left_row_${c}`,x1:n.minX,y1:l,x2:n.innerMinX,y2:l,transform:e,color:i}),Cl({id:`${t.schematic_sheet_id}_right_row_${c}`,x1:n.maxX,y1:l,x2:n.innerMaxX,y2:l,transform:e,color:i}))}return Ml.forEach((c,l)=>{let a=n.innerMinX+(n.innerMaxX-n.innerMinX)*(l+0.5)/Ml.length;o.push(kl({text:c,x:a,y:(n.maxY+n.innerMaxY)/2,transform:e,color:s}),kl({text:c,x:a,y:(n.minY+n.innerMinY)/2,transform:e,color:s}))}),$o.forEach((c,l)=>{let a=n.innerMinY+(n.innerMaxY-n.innerMinY)*($o.length-l-0.5)/$o.length;o.push(kl({text:c,x:(n.minX+n.innerMinX)/2,y:a,transform:e,color:s}),kl({text:c,x:(n.maxX+n.innerMaxX)/2,y:a,transform:e,color:s}))}),[{name:"g",type:"element",value:"",attributes:{class:"schematic-sheet","data-circuit-json-type":"schematic_sheet","data-schematic-sheet-id":t.schematic_sheet_id},children:o}]}function Yw({id:t,center:e,width:r,height:n,transform:i,color:s}){let o=O(i,e),c=Math.abs(i.a)*r,l=Math.abs(i.d)*n;return{name:"rect",type:"element",value:"",attributes:{class:"sch-rect",x:(o.x-c/2).toString(),y:(o.y-l/2).toString(),width:c.toString(),height:l.toString(),fill:"none",stroke:s,"stroke-width":(Math.abs(i.a)*o4).toString(),"data-schematic-rect-id":t},children:[]}}function Cl({id:t,x1:e,y1:r,x2:n,y2:i,transform:s,color:o}){let c=O(s,{x:e,y:r}),l=O(s,{x:n,y:i});return{name:"line",type:"element",value:"",attributes:{class:"sch-line",x1:c.x.toString(),y1:c.y.toString(),x2:l.x.toString(),y2:l.y.toString(),stroke:o,"stroke-width":(Math.abs(s.a)*o4).toString(),"data-schematic-line-id":t},children:[]}}function kl({text:t,x:e,y:r,transform:n,color:i}){let s=O(n,{x:e,y:r});return{type:"element",name:"text",value:"",attributes:{class:"sch-text",x:s.x.toString(),y:s.y.toString(),fill:i,"text-anchor":"middle","dominant-baseline":"middle","font-family":"sans-serif","font-size":`${fe(n,"reference_designator",RT)}px`,transform:`rotate(0, ${s.x}, ${s.y})`},children:[{type:"text",value:t,name:"",attributes:{},children:[]}]}}var WT=({schematicTable:t,transform:e,colorMap:r,circuitJson:n})=>{let{anchor_position:i,border_width:s=0.05,anchor:o="center"}=t,{column_widths:c,row_heights:l}=Hw(t,n),a=c.reduce((k,I)=>k+I,0),p=l.reduce((k,I)=>k+I,0),{x:d,y:m}=i;if(o.includes("center"))d-=a/2;else if(o.includes("right"))d-=a;if(o.includes("center"))m+=p/2;else if(o.includes("bottom"))m+=p;let f=[],_=s*Math.abs(e.a),g=Gt(e),[y,S]=O(e,[d,m]),[P,b]=O(e,[d+a,m-p]);f.push({name:"rect",type:"element",attributes:{class:"sch-table-border",x:y.toString(),y:S.toString(),width:(P-y).toString(),height:(b-S).toString(),fill:"none",stroke:r.schematic.table,"stroke-width":_.toString()},children:[],value:""});let C=n.filter((k)=>k.type==="schematic_table_cell"&&k.schematic_table_id===t.schematic_table_id),L=d;for(let k=0;k<c.length-1;k++){L+=c[k];let I=m;for(let j=0;j<l.length;j++){let Q=I-l[j];if(!C.some((z)=>z.start_column_index<=k&&z.end_column_index>k&&z.start_row_index<=j&&z.end_row_index>=j)){let z=O(e,{x:L,y:I}),N=O(e,{x:L,y:Q});f.push({name:"line",type:"element",attributes:{class:"sch-table-grid-line",x1:z.x.toString(),y1:z.y.toString(),x2:N.x.toString(),y2:N.y.toString(),stroke:r.schematic.table,"stroke-width":g.toString()},children:[],value:""})}I=Q}}let B=m;for(let k=0;k<l.length-1;k++){B-=l[k];let I=d;for(let j=0;j<c.length;j++){let Q=I+c[j];if(!C.some((z)=>z.start_row_index<=k&&z.end_row_index>k&&z.start_column_index<=j&&z.end_column_index>=j)){let z=O(e,{x:I,y:B}),N=O(e,{x:Q,y:B});f.push({name:"line",type:"element",attributes:{class:"sch-table-grid-line",x1:z.x.toString(),y1:z.y.toString(),x2:N.x.toString(),y2:N.y.toString(),stroke:r.schematic.table,"stroke-width":g.toString()},children:[],value:""})}I=Q}}for(let k of C)if(k.text){let I=c.slice(k.start_column_index,k.end_column_index+1).reduce((G,H)=>G+H,0),j=l.slice(k.start_row_index,k.end_row_index+1).reduce((G,H)=>G+H,0),Q=d+c.slice(0,k.start_column_index).reduce((G,H)=>G+H,0),lt=m-l.slice(0,k.start_row_index).reduce((G,H)=>G+H,0),{cell_padding:z=0.2}=t,N=k.horizontal_align??"center",at=k.vertical_align??"middle",ot={x:Q+I/2,y:lt-j/2};if(N==="left")ot.x=Q+z;else if(N==="right")ot.x=Q+I-z;if(at==="top")ot.y=lt-z;else if(at==="bottom")ot.y=lt-j+z;let et=O(e,ot),D=fe(e,"reference_designator",k.font_size),it={left:"start",center:"middle",right:"end"},rt={top:"hanging",middle:"middle",bottom:"ideographic"};f.push({name:"text",type:"element",attributes:{class:"sch-table-text",x:et.x.toString(),y:et.y.toString(),"font-size":`${D}px`,"text-anchor":it[N],"dominant-baseline":rt[at],fill:r.schematic.table,"font-family":"sans-serif"},children:[{type:"text",value:k.text,name:"",attributes:{},children:[]}],value:""})}return[{name:"g",type:"element",attributes:{class:"sch-table","data-schematic-table-id":t.schematic_table_id},children:f,value:""}]};function $T({trace:t,transform:e,colorMap:r}){let n=t.edges;if(n.length===0)return[];let i=[],s=[],o="";for(let c=0;c<n.length;c++){let l=n[c];if(l.is_crossing)continue;let[a,p]=O(e,[l.from.x,l.from.y]),[d,m]=O(e,[l.to.x,l.to.y]);if(c===0||n[c-1]?.is_crossing)o+=`M ${a} ${p} L ${d} ${m}`;else o+=` L ${d} ${m}`}if(o)i.push({name:"path",type:"element",attributes:{d:o,class:"trace-invisible-hover-outline sch-trace-hitbox",stroke:r.schematic.wire,fill:"none","stroke-width":`${Gt(e)*8}px`,"stroke-linecap":"round",opacity:"0","stroke-linejoin":"round"},value:"",children:[]}),i.push({name:"path",type:"element",attributes:{class:"sch-trace-path",d:o,stroke:r.schematic.wire,fill:"none","stroke-width":`${Gt(e)}px`,"stroke-linecap":"round","stroke-linejoin":"round"},value:"",children:[]});for(let c of n){if(!c.is_crossing)continue;let[l,a]=O(e,[c.from.x,c.from.y]),[p,d]=O(e,[c.to.x,c.to.y]),m=(l+p)/2,f=(a+d)/2,_=p-l,g=d-a,y=Math.sqrt(_*_+g*g),S=y*0.7,P=-g/y*S,b=_/y*S,C=m+P,L=f-Math.abs(b);s.push({name:"path",type:"element",attributes:{class:"trace-crossing-outline sch-trace-crossing-outline",d:`M ${l} ${a} Q ${C} ${L} ${p} ${d}`,stroke:r.schematic.background,fill:"none","stroke-width":`${Gt(e)*1.5}px`,"stroke-linecap":"butt"},value:"",children:[]}),s.push({name:"path",type:"element",attributes:{class:"sch-trace-crossing-path",d:`M ${l} ${a} Q ${C} ${L} ${p} ${d}`,stroke:r.schematic.wire,fill:"none","stroke-width":`${Gt(e)}px`,"stroke-linecap":"round"},value:"",children:[]})}if(t.junctions)for(let c of t.junctions){let[l,a]=O(e,[c.x,c.y]);s.push({name:"circle",type:"element",attributes:{cx:l.toString(),cy:a.toString(),r:(Math.abs(e.a)*0.03).toString(),class:"trace-junction sch-trace-junction",fill:r.schematic.junction},value:"",children:[]})}return[{name:"g",type:"element",value:"",attributes:{class:"trace sch-trace","data-layer":"base","data-circuit-json-type":"schematic_trace","data-schematic-trace-id":t.schematic_trace_id,...t.subcircuit_connectivity_map_key&&{"data-subcircuit-connectivity-map-key":t.subcircuit_connectivity_map_key}},children:i},{name:"g",type:"element",value:"",attributes:{class:"trace-overlays sch-trace-overlays","data-layer":"overlay","data-circuit-json-type":"schematic_trace","data-schematic-trace-id":t.schematic_trace_id,...t.subcircuit_connectivity_map_key&&{"data-subcircuit-connectivity-map-key":t.subcircuit_connectivity_map_key}},children:s}]}function jT({probe:t,transform:e,colorMap:r,fallbackColor:n}){let[i,s]=O(e,[t.position.x,t.position.y]),o=t.color??n??r.schematic.reference,c=Math.abs(e.a)*0.6,l=Math.abs(e.a)*0.28,a=t.label_alignment??"top_right",p,d,m,f;switch(a){case"top_left":p=-135*Math.PI/180,d="end",m=-8,f=-8;break;case"top_center":p=-90*Math.PI/180,d="middle",m=0,f=-8;break;case"top_right":p=-45*Math.PI/180,d="start",m=8,f=-8;break;case"center_left":p=180*Math.PI/180,d="end",m=-8,f=0;break;case"center":p=-90*Math.PI/180,d="middle",m=0,f=-8;break;case"center_right":p=0*Math.PI/180,d="start",m=8,f=0;break;case"bottom_left":p=135*Math.PI/180,d="end",m=-8,f=8;break;case"bottom_center":p=90*Math.PI/180,d="middle",m=0,f=8;break;case"bottom_right":p=45*Math.PI/180,d="start",m=8,f=8;break;default:p=-50*Math.PI/180,d="start",m=8,f=0}let _=i+c*Math.cos(p),g=s+c*Math.sin(p),y=i,S=s,P=[`M ${_},${g}`,`L ${y},${S}`,`M ${y},${S}`,`L ${y-l*Math.cos((p*180/Math.PI+150)*Math.PI/180)},${S-l*Math.sin((p*180/Math.PI+150)*Math.PI/180)}`,`L ${y-l*Math.cos((p*180/Math.PI+210)*Math.PI/180)},${S-l*Math.sin((p*180/Math.PI+210)*Math.PI/180)}`,"Z"].join(" "),b=(_+m).toString(),C=(g+f).toString(),L=[];if(t.name&&t.voltage!==void 0)L.push({type:"element",name:"tspan",value:"",attributes:{x:b},children:[{type:"text",value:t.name,name:"",attributes:{},children:[]}]}),L.push({type:"element",name:"tspan",value:"",attributes:{x:b,dy:"1.2em"},children:[{type:"text",value:`${t.voltage}V`,name:"",attributes:{},children:[]}]});else{let B=[];if(t.name)B.push(t.name);if(t.voltage!==void 0)B.push(`${t.voltage}V`);L.push({type:"text",value:B.join(" "),name:"",attributes:{},children:[]})}return[{name:"path",type:"element",attributes:{class:"sch-voltage-probe",d:P,stroke:o,fill:o,"stroke-width":`${Gt(e)}px`},value:"",children:[]},{type:"element",name:"text",value:"",attributes:{class:"sch-voltage-probe-label",x:b,y:C,fill:o,"text-anchor":d,"dominant-baseline":"middle","font-family":"sans-serif","font-size":`${fe(e,"reference_designator")}px`,"font-weight":"bold","data-schematic-voltage-probe-id":t.schematic_voltage_probe_id},children:L}]}var Xo=6,Nl=12,te=12,Li=6,Lw=14,Yl=11,Tw=280,XT=140,s4=(t)=>t.type==="schematic_component_overlap_warning"||t.type==="schematic_component_styling_warning"||t.type==="schematic_element_outside_sheet_warning"||t.type==="schematic_manual_edit_conflict_warning";function DT({circuitJson:t,transform:e,svgWidth:r,svgHeight:n,colorMap:i}){let s=i.schematic.erc_warning,o=[];return t.filter(s4).flatMap((c)=>{let l=VT(c,t,e);if(!l)return[];let a=Math.max(1,r-te*2),p=qT(c.message,Math.max(12,Math.floor((Math.min(Tw,a)-Li*2)/(Yl*0.56)))),d=Math.max(...p.map((b)=>b.length)),m=Math.min(Tw,a,Math.max(Math.min(XT,a),d*Yl*0.56+Li*2)),f=Li*2+p.length*Lw,_=HT({targetBounds:l,calloutWidth:m,calloutHeight:f,svgWidth:r,svgHeight:n,occupiedCalloutBounds:o});o.push(_);let g=ZT(c),y=Tl(l,Xo),S=QT(_,y);return[{name:"g",type:"element",value:"",attributes:{class:"schematic-warning","data-type":c.type,"data-warning-id":g,role:"note","aria-label":c.message},children:[{name:"rect",type:"element",value:"",attributes:{x:y.minX.toString(),y:y.minY.toString(),width:(y.maxX-y.minX).toString(),height:(y.maxY-y.minY).toString(),rx:"6",fill:"none",stroke:s,"stroke-width":"1","stroke-dasharray":"4,3","data-warning-reference":"target"},children:[]},{name:"line",type:"element",value:"",attributes:{x1:S.from.x.toString(),y1:S.from.y.toString(),x2:S.to.x.toString(),y2:S.to.y.toString(),stroke:s,"stroke-width":"1","data-warning-reference":"leader"},children:[]},{name:"rect",type:"element",value:"",attributes:{x:_.minX.toString(),y:_.minY.toString(),width:m.toString(),height:f.toString(),fill:"rgba(255, 250, 235, 0.97)",stroke:s,"stroke-width":"1","data-warning-reference":"callout"},children:[]},{name:"text",type:"element",value:"",attributes:{x:(_.minX+Li).toString(),y:(_.minY+Li+Yl).toString(),fill:"#5c4300","font-family":"sans-serif","font-size":Yl.toString()},children:p.map((b,C)=>({name:"tspan",type:"element",value:"",attributes:{x:(_.minX+Li).toString(),dy:C===0?"0":Lw.toString()},children:[tE(b)]}))}]}]})}function VT(t,e,r){let i=zT(t).map((s)=>UT(e,s)).filter((s)=>Boolean(s)).map((s)=>GT(s,r)).filter((s)=>Boolean(s));if(i.length===0)return null;return i.reduce(JT)}function zT(t){switch(t.type){case"schematic_component_overlap_warning":return t.schematic_component_ids;case"schematic_component_styling_warning":return[t.schematic_component_id,...t.schematic_port_ids??[]];case"schematic_manual_edit_conflict_warning":return[t.schematic_component_id];case"schematic_element_outside_sheet_warning":return[t.schematic_element_id]}}function UT(t,e){return t.find((r)=>{if(!r.type.startsWith("schematic_"))return!1;let n=`${r.type}_id`;return r[n]===e})}function GT(t,e){if(t.type==="schematic_component"){let r=O(e,{x:t.center.x-t.size.width/2,y:t.center.y+t.size.height/2}),n=O(e,{x:t.center.x+t.size.width/2,y:t.center.y-t.size.height/2});return Uf([r,n])}if(t.type==="schematic_port"){let r=O(e,t.center);return Tl(Uf([r]),4)}if(t.type==="schematic_net_label"){let r=O(e,t.anchor_position??t.center),n=Math.max(28,t.text.length*8);return{minX:r.x-n/2,minY:r.y-10,maxX:r.x+n/2,maxY:r.y+10}}if(t.type==="schematic_trace"){let r=t.edges.flatMap((n)=>[O(e,n.from),O(e,n.to)]);if(r.length===0)return null;return Tl(Uf(r),4)}return null}function HT({targetBounds:t,calloutWidth:e,calloutHeight:r,svgWidth:n,svgHeight:i,occupiedCalloutBounds:s}){let o=(t.minX+t.maxX)/2,c=(t.minY+t.maxY)/2,l=t.minY-Xo-Nl-r,a=t.maxY+Xo+Nl,p=t.minX-Xo-Nl-e,d=t.maxX+Xo+Nl,m=[];if(l>=te)m.push(jo({x:Ti(o-e/2,te,n-te-e),y:l,width:e,height:r,side:"top"}));if(a+r<=i-te)m.push(jo({x:Ti(o-e/2,te,n-te-e),y:a,width:e,height:r,side:"bottom"}));if(d+e<=n-te)m.push(jo({x:d,y:Ti(c-r/2,te,i-te-r),width:e,height:r,side:"right"}));if(p>=te)m.push(jo({x:p,y:Ti(c-r/2,te,i-te-r),width:e,height:r,side:"left"}));let f=m.find((_)=>s.every((g)=>!KT(Tl(_,4),g)));if(f)return f;if(m[0])return m[0];return jo({x:Ti(o-e/2,te,n-te-e),y:Ti(l,te,i-te-r),width:e,height:r,side:"top"})}function QT(t,e){let r=(e.minX+e.maxX)/2,n=(e.minY+e.maxY)/2,i=(t.minX+t.maxX)/2,s=(t.minY+t.maxY)/2;switch(t.side){case"top":return{from:{x:i,y:t.maxY},to:{x:r,y:e.minY}};case"bottom":return{from:{x:i,y:t.minY},to:{x:r,y:e.maxY}};case"left":return{from:{x:t.maxX,y:s},to:{x:e.minX,y:n}};case"right":return{from:{x:t.minX,y:s},to:{x:e.maxX,y:n}}}}function ZT(t){switch(t.type){case"schematic_component_overlap_warning":return t.schematic_component_overlap_warning_id;case"schematic_component_styling_warning":return t.schematic_component_styling_warning_id;case"schematic_element_outside_sheet_warning":return t.schematic_element_outside_sheet_warning_id;case"schematic_manual_edit_conflict_warning":return t.schematic_manual_edit_conflict_warning_id}}function qT(t,e){let r=t.trim().split(/\s+/),n=[],i="";for(let s of r){let o=i?`${i} ${s}`:s;if(o.length<=e||i.length===0){i=o;continue}n.push(i),i=s}if(i)n.push(i);return n.length>0?n:["Warning"]}function Uf(t){return{minX:Math.min(...t.map((e)=>e.x)),minY:Math.min(...t.map((e)=>e.y)),maxX:Math.max(...t.map((e)=>e.x)),maxY:Math.max(...t.map((e)=>e.y))}}function JT(t,e){return{minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}}function Tl(t,e){return{minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e}}function KT(t,e){return!(t.maxX<=e.minX||t.minX>=e.maxX||t.maxY<=e.minY||t.minY>=e.maxY)}function jo({x:t,y:e,width:r,height:n,side:i}){return{minX:t,minY:e,maxX:t+r,maxY:e+n,side:i}}function Ti(t,e,r){if(r<e)return(e+r)/2;return Math.min(Math.max(t,e),r)}function tE(t){return{name:"",type:"text",value:t,attributes:{},children:[]}}function a4(t,e){let r=t.filter((V)=>V.type==="schematic_sheet"),n=tT(r),i=n;if(e?.schematicSheetId!==void 0)i=r.find((V)=>V.schematic_sheet_id===e.schematicSheetId)??n;else if(e?.schematicSheetIndex!==void 0)i=r.find((V)=>V.sheet_index===e.schematicSheetIndex)??n;let s=i?t.filter((V)=>!V.type.startsWith("schematic_")||s4(V)||("schematic_sheet_id"in V)&&V.schematic_sheet_id===i.schematic_sheet_id):t,o=mT(s),c=o.maxX-o.minX,l=o.maxY-o.minY,a=e?.width??1200,p=e?.height??600,d=e?.colorOverrides,m={...re,schematic:{...re.schematic,...d?.schematic??{}}},f=c/l,_=a/p,g;if(f>_){let V=a/f;g={x:0,y:(p-V)/2}}else{let V=p*f;g={x:(a-V)/2,y:0}}let y=Vb([{x:o.minX,y:o.maxY},{x:o.maxX,y:o.maxY},{x:o.maxX,y:o.minY}],[{x:g.x,y:g.y},{x:a-g.x,y:g.y},{x:a-g.x,y:p-g.y}]),S=[];if(S.push({name:"rect",type:"element",attributes:{class:"boundary",x:"0",y:"0",width:a.toString(),height:p.toString()},children:[],value:""}),e?.grid){let V=typeof e.grid==="object"?e.grid:{};S.push(JL({bounds:o,transform:y,...V}))}let P=[],b=[],C=[],L=[],B=[],k=[],I=[],j=[],Q=[],lt=[],z=[],N=[],at=[],ot=[],et=[],D=[],it=[],rt=eE({transform:y,svgWidth:a,svgHeight:p,schematicSheet:i}),G=Array.isArray(m.simulation_palette)?m.simulation_palette:Array.isArray(m.palette)?m.palette:[],H=0;for(let V of s)if(V.type==="schematic_sheet")D.push(...OT({schematicSheet:V,transform:y,colorMap:m}));else if(V.type==="schematic_graphic")it.push(uT({schematicGraphic:V,viewport:rE({availableViewport:rt,schematicGraphic:V,transform:y})}));else if(V.type==="schematic_debug_object")P.push(...ET({debugObject:V,transform:y}));else if(V.type==="schematic_component")b.push(...TT({component:V,transform:y,circuitJson:s,colorMap:m})),Q.push(...vT({component:V,transform:y,circuitJson:s}));else if(V.type==="schematic_box")I.push(...BT({schematicBox:V,transform:y,colorMap:m}));else if(V.type==="schematic_trace")C.push(...$T({trace:V,transform:y,colorMap:m}));else if(V.type==="schematic_net_label")L.push(...gT({schNetLabel:V,realToScreenTransform:y,colorMap:m}));else if(V.type==="schematic_text"&&!V.schematic_component_id)B.push(Zf({elm:V,transform:y,colorMap:m}));else if(V.type==="schematic_voltage_probe"){let ft=G.length>0?G[H%G.length]:void 0;H+=1,k.push(...jT({probe:V,transform:y,colorMap:m,fallbackColor:ft}))}else if(V.type==="schematic_table")j.push(...WT({schematicTable:V,transform:y,colorMap:m,circuitJson:s}));else if(V.type==="schematic_line"){if(V.schematic_component_id)continue;z.push(...r4({schLine:V,transform:y,colorMap:m}))}else if(V.type==="schematic_circle"){if(V.schematic_component_id)continue;N.push(...Jw({schCircle:V,transform:y,colorMap:m}))}else if(V.type==="schematic_rect"){if(V.schematic_component_id)continue;at.push(...n4({schRect:V,transform:y,colorMap:m}))}else if(V.type==="schematic_arc"){if(V.schematic_component_id)continue;ot.push(...qw({schArc:V,transform:y,colorMap:m}))}else if(V.type==="schematic_path"){if(V.schematic_component_id)continue;et.push(...i4({schPath:V,transform:y,colorMap:m}))}else if(V.type==="schematic_port"){let ft=s.find((Pt)=>Pt.type==="source_port"&&Pt.source_port_id===V.source_port_id);if(ft?.type==="source_port"&&ft.do_not_connect===!0)lt.push(ST({schPort:V,transform:y,colorMap:m}));if(e?.drawPorts)lt.push(...wT({schPort:V,transform:y,circuitJson:s,colorMap:m}))}let J=C.filter((V)=>V.attributes?.["data-layer"]!=="overlay"),q=C.filter((V)=>V.attributes?.["data-layer"]==="overlay");if(S.push(...it,...P,...D,...J,...q,...z,...N,...at,...ot,...et,...b,...Q,...lt,...L,...B,...I,...k,...j),e?.labeledPoints)S.push(KL({points:e.labeledPoints,transform:y}));if(e?.shouldDrawWarnings)S.push(...DT({circuitJson:s,transform:y,svgWidth:a,svgHeight:p,colorMap:m}));let st=GL(t),bt=QL;if(e?.showErrorsInTextOverlay){let V=ZL(t);if(V)S.push(V)}let xt={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",class:["tscircuit-schematic",e?.className].filter(Boolean).join(" "),width:a.toString(),height:p.toString(),style:`background-color: ${m.schematic.background}`,"data-real-to-screen-transform":Xb(y),...st&&{"data-software-used-string":st},...e?.includeVersion&&{"data-circuit-to-svg-version":bt}},children:[{name:"style",type:"element",children:[{type:"text",value:`
              .boundary { fill: ${m.schematic.background}; }
              .schematic-boundary { fill: none; stroke: #fff; }
              .component { fill: none; stroke: ${m.schematic.component_outline}; }
              .chip { fill: ${m.schematic.component_body}; stroke: ${m.schematic.component_outline}; }
              .component-pin { fill: none; stroke: ${m.schematic.component_outline}; }
              .text { font-family: sans-serif; fill: ${m.schematic.wire}; }
              .pin-number { fill: ${m.schematic.pin_number}; }
              .port-label { fill: ${m.schematic.reference}; }
              .component-name { fill: ${m.schematic.reference}; }
              ${e?.css??""}
            `,name:"",attributes:{},children:[]}],value:"",attributes:{}},...S],value:""};return DL(xt)}function eE({transform:t,svgWidth:e,svgHeight:r,schematicSheet:n}){if(!n)return{x:0,y:0,width:e,height:r};let i=Qf(n),s=O(t,{x:i.innerMinX,y:i.innerMaxY}),o=O(t,{x:i.innerMaxX,y:i.innerMinY});return{x:Math.min(s.x,o.x),y:Math.min(s.y,o.y),width:Math.abs(o.x-s.x),height:Math.abs(o.y-s.y)}}function rE({availableViewport:t,schematicGraphic:e,transform:r}){if(e.width===void 0&&e.height===void 0)return t;let n=e.width===void 0?t.width:Ew(e.width*Math.hypot(r.a,r.b),t.width),i=e.height===void 0?t.height:Ew(e.height*Math.hypot(r.c,r.d),t.height);return{x:t.x+(t.width-n)/2,y:t.y+(t.height-i)/2,width:n,height:i}}function Ew(t,e){if(!Number.isFinite(t))return e;return Math.max(0,Math.min(t,e))}var qf=11;function c4(t,e=1){let r=12*e,n=26*e,i=t.left+r,s=t.right-r,o=t.top+r,c=t.bottom-r,l=[],a=Math.ceil(Math.max(t.right-t.left,t.bottom-t.top)/n);return(p)=>{let d={x:Math.max(i,Math.min(s,p.x)),y:Math.max(o,Math.min(c,p.y))};for(let m=0;m<=a;m++)for(let f=-m;f<=m;f++)for(let _=-m;_<=m;_++){if(Math.max(Math.abs(f),Math.abs(_))!==m)continue;let g={x:d.x+f*n,y:d.y+_*n};if(g.x<i||g.x>s||g.y<o||g.y>c)continue;if(l.some((y)=>Math.hypot(y.x-g.x,y.y-g.y)<n-0.000001*e))continue;return l.push(g),g}throw Error("Not enough room for issue markers; increase the schematic width or height")}}function oE(t){return[...new Set(t.flatMap((r)=>r.type.startsWith("schematic_")&&!r.type.endsWith("_warning")&&!r.type.endsWith("_error")&&r.type!=="schematic_symbol"&&!(r.type==="schematic_group"&&r.is_subcircuit&&!r.show_as_schematic_box)?[("schematic_sheet_id"in r?r.schematic_sheet_id:void 0)??""]:[]))].map((r)=>{let n=t.find((i)=>i.type==="schematic_sheet"&&i.schematic_sheet_id===r);return{id:r,name:n?.type==="schematic_sheet"?n.name||r:r||"Unassigned sheet"}})}var Jf=(t)=>t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll('"',"&quot;").replaceAll(">","&gt;"),zo=(t)=>zt(t.schX,t.schY,t.width,t.height);function l4(t){let{circuitJson:e,analysis:r}=t,n=t.schematicSheetId??oE(e)[0]?.id??"",i=e.filter((N)=>!N.type.startsWith("schematic_")||N.type==="schematic_symbol"||(("schematic_sheet_id"in N?N.schematic_sheet_id:void 0)??"")===n),s=a4(i,{width:t.width??1400,height:t.height??900}),o=s.match(/data-real-to-screen-transform="matrix\(([^)]+)\)"/);if(!o)throw Error("Schematic renderer did not provide its coordinate transform");let c=o[1].split(/[\s,]+/).map(Number);if(c.length!==6||c.some((N)=>!Number.isFinite(N)))throw Error("Invalid schematic transform");let[l,a,p,d,m,f]=c,_=(N,at)=>({x:l*N+p*at+m,y:a*N+d*at+f}),g=[],y=[],S=(N)=>{g.push(N);for(let at of[N.left,N.right])for(let ot of[N.bottom,N.top])y.push(_(at,ot))},P=r.getLineItems().filter((N)=>N.lineItemType==="SchematicBoxPlacement"),b=new Set,C=r.getIssues().flatMap((N,at)=>{if((Dr(N).schematicSheetId??"")!==n||t.issueTypes!==void 0&&!t.issueTypes.includes(N.lineItemType)||t.issueIndex!==void 0&&at!==t.issueIndex)return[];let ot=js({issues:[N],componentPlacements:P,circuitJson:e}),et=[],D,it=new Map,rt=(J,q=!1,st)=>{S(J),D??={x:J.left,y:J.top};let bt=[q?"context":"issue",J.left,J.bottom,J.right,J.top].join(":");if(!q)it.set(bt,{x:J.left,y:J.top});if(b.has(bt))return;b.add(bt);let xt=st?` class="pin-label-collision-highlight" data-highlight-schematic-port-id="${Jf(st.schematicPortId)}" data-highlight-label="${Jf(st.text)}"`:"",V=st?wy(st):J,ft=`<rect${xt} x="${V.left}" y="${V.bottom}" width="${V.right-V.left}" height="${V.top-V.bottom}" fill="${q?"none":"#ef444433"}" stroke="${q?"#2563eb":"#dc2626"}" stroke-width="${q?0.35:0.5}" ${q?'stroke-dasharray="5 3"':""} vector-effect="non-scaling-stroke" />`;et.push(ft)};for(let J of ot)rt(zo(J),!0);switch(D=void 0,N.lineItemType){case"RailPathTooSpreadOut":{S(N.pathBounds),D=N.pathPoints[0],et.push(`<polyline points="${N.pathPoints.map((J)=>`${J.x},${J.y}`).join(" ")}" fill="none" stroke="#dc2626" stroke-width="3" stroke-opacity="0.75" vector-effect="non-scaling-stroke" />`);break}case"ComponentOverlap":{let J=zo(N.firstComponent),q=zo(N.secondComponent);rt({left:Math.max(J.left,q.left),right:Math.min(J.right,q.right),top:Math.min(J.top,q.top),bottom:Math.max(J.bottom,q.bottom)});break}case"NetLabelCollision":for(let J of N.collisionBounds??[])rt(J);break;case"SchematicTextCollision":rt(N.textBounds),rt(N.collidingObjectBounds);break;case"SchematicBoxInnerLabelOutOfBounds":for(let J of N.overflowingLabels)rt(J.bounds,!1,J);break;case"SchematicBoxInnerLabelCollision":if(N.labelPairs?.length)for(let J of N.labelPairs)rt(J.firstLabel.bounds,!1,J.firstLabel),rt(J.secondLabel.bounds,!1,J.secondLabel);else for(let J of ot)rt(zo(J));break;case"ComponentNetLabelCollision":rt(N.overlappingLabel1Bounds),rt(N.overlappingLabel2Bounds);break;case"ComponentBoxNetLabelCollision":rt(N.boxBounds),rt(N.labelBounds);break;case"VerboseSchematicNetLabel":{D={x:N.schX,y:N.schY},S(zt(D.x,D.y,18/Math.abs(l),18/Math.abs(d))),et.push(`<circle cx="${D.x}" cy="${D.y}" r="${9/Math.abs(l)}" fill="#ef444433" stroke="#dc2626" stroke-width="0.5" vector-effect="non-scaling-stroke" />`);break}case"TraceCanBeSimplifiedByMovingComponent":{if(N.suggestedTraces){let q=zt(N.newSchX,N.newSchY,N.targetComponent.width,N.targetComponent.height);S(q),et.push(`<rect x="${q.left}" y="${q.bottom}" width="${q.right-q.left}" height="${q.top-q.bottom}" fill="#16a34a22" stroke="#16a34a" stroke-width="1.5" vector-effect="non-scaling-stroke" />`);for(let st of N.suggestedTraces)for(let[bt,xt]of st.points.slice(1).entries()){let V=st.points[bt];S({left:Math.min(V.x,xt.x),right:Math.max(V.x,xt.x),bottom:Math.min(V.y,xt.y),top:Math.max(V.y,xt.y)}),et.push(`<line x1="${V.x}" y1="${V.y}" x2="${xt.x}" y2="${xt.y}" stroke="#16a34a" stroke-width="1.5" vector-effect="non-scaling-stroke" />`)}}let J=i.find((q)=>q.type==="schematic_trace"&&q.schematic_trace_id===N.schematicTraceId);if(J?.type==="schematic_trace")for(let q of J.edges)S({left:Math.min(q.from.x,q.to.x),right:Math.max(q.from.x,q.to.x),bottom:Math.min(q.from.y,q.to.y),top:Math.max(q.from.y,q.to.y)}),D??=q.from,et.push(`<line x1="${q.from.x}" y1="${q.from.y}" x2="${q.to.x}" y2="${q.to.y}" stroke="#dc2626" stroke-width="0.5" vector-effect="non-scaling-stroke" />`);break}default:for(let J of ot)rt(zo(J))}D??=ot[0]?{x:ot[0].schX,y:ot[0].schY}:void 0;let G=(it.size?[...it.values()]:D?[D]:[]).map((J)=>_(J.x,J.y)),H=Jf(`#${at+1} ${N.lineItemType}
${r.schematicIssuesToString(N)}`);return[{index:at,points:G,title:H,geometry:`<title>${H}</title><g transform="matrix(${c.join(" ")})">${et.join("")}</g>`,issueType:N.lineItemType}]}),L=s,B=1,k={left:0,top:0,right:t.width??1400,bottom:t.height??900};if(t.viewportBounds){y.length=0;for(let N of[t.viewportBounds.left,t.viewportBounds.right])for(let at of[t.viewportBounds.bottom,t.viewportBounds.top])y.push(_(N,at))}if(!t.showFullSchematic&&y.length>0){let N=Math.min(...y.map((st)=>st.x)),at=Math.max(...y.map((st)=>st.x)),ot=Math.min(...y.map((st)=>st.y)),et=Math.max(...y.map((st)=>st.y)),D=t.viewportBounds?0:Math.max((at-N)/2,12),it=t.viewportBounds?0:Math.max((et-ot)/2,12),rt=at-N+D*2,G=et-ot+it*2;k={left:N-D,top:ot-it,right:at+D,bottom:et+it};let H=`${k.left} ${k.top} ${rt} ${G}`;L=s.replace(/^<svg\b[^>]*>/,(st)=>st.replace(/\sviewBox="[^"]*"/,"").replace(/>$/,` viewBox="${H}">`)),B=Math.max(rt/(t.width??1400),G/(t.height??900));let J=(t.width??1400)*B,q=(t.height??900)*B;k={left:(N+at-J)/2,right:(N+at+J)/2,top:(ot+et-q)/2,bottom:(ot+et+q)/2}}let I=g.length?{left:Math.min(...g.map((N)=>N.left)),right:Math.max(...g.map((N)=>N.right)),top:Math.max(...g.map((N)=>N.top)),bottom:Math.min(...g.map((N)=>N.bottom))}:void 0;if(t.showOverlay===!1)return{svg:L,bounds:I};let j=c4(k,B),Q=[],lt=[],z=C.map(({index:N,points:at,title:ot,geometry:et,issueType:D})=>{for(let it of at){let rt={x:it.x,y:it.y-(qf+1)*B},G=j(rt);if(G.x!==rt.x||G.y!==rt.y)Q.push(`<line x1="${it.x}" y1="${it.y}" x2="${G.x}" y2="${G.y}" stroke="#b91c1c" stroke-width="0.5" />`);lt.push(`<g data-issue-number="${N+1}" data-issue-type="${D}" transform="translate(${G.x} ${G.y}) scale(${B})"><title>${ot}</title><circle r="${qf}" fill="#b91c1c" /><text y="4" text-anchor="middle" fill="white" font-family="sans-serif" font-size="11">${N+1}</text></g>`)}return t.showIssueGeometry===!1?"":`<g data-issue-index="${N}" data-issue-type="${D}">${et}</g>`});return{bounds:I,svg:L.replace(/<\/svg>\s*$/,`<g class="placement-issue-overlays">${z.join(`
`)}${Q.join(`
`)}${lt.join(`
`)}</g></svg>`)}}function p4(t,e,r=[]){let n=Math.max(20,Math.floor((e-(r.length?70:36))/10)),i=[],s=[],o=[...r],c=0,l;for(let f of t?t.split(`
`):[]){if(f.startsWith("<SchematicSheet "))l=f.match(/\bid="([^"]*)"/)?.[1];let _=o.findIndex((g)=>g.text&&t.startsWith(g.text,c)&&(l===void 0||l===g.sheetId));if(_!==-1){let[g]=o.splice(_,1);s.push({number:g.number,lineIndex:i.length})}i.push(...aE(f,Math.min(96,n))),c+=f.length+1}let a=22,p=18,d=s.length?52:p,m=p*2+i.length*a;return[`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${m}" viewBox="0 0 ${e} ${m}">`,'<rect width="100%" height="100%" fill="#fff" />',`<text x="${d}" y="${p+a}" fill="#d00" font-family="Menlo, Consolas, monospace" font-size="16">`,...i.map((f,_)=>`<tspan x="${d}" dy="${_===0?0:a}">${sE(f)}</tspan>`),"</text>",...s.map(({number:f,lineIndex:_})=>{let g=p+(_+1)*a-5;return`<g data-listing-issue-number="${f}"><circle cx="${p+6}" cy="${g}" r="11" fill="#b91c1c" /><text x="${p+6}" y="${g}" dy="0.35em" text-anchor="middle" font-family="sans-serif" font-size="11" fill="white">${f}</text></g>`}),"</svg>"].join(`
`)}function sE(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function aE(t,e){if(t.length<=e)return[t];let r=[],n=t;while(n.length>e){let i=n.lastIndexOf(" ",e),s=i>0?i:e;r.push(n.slice(0,s)),n=`  ${n.slice(s).trimStart()}`}return r.push(n),r}function cE(t,e={}){let r=e.width??1400,n=e.height??900;if(!Number.isFinite(r)||r<320||!Number.isFinite(n)||n<=0)throw Error("Artifact width must be at least 320 and height must be positive (finite pixels)");let i=e.analysis??Fh(t),s=i.getIssues();return i.getIssues(e).map((o)=>{let c=s.indexOf(o),{schematicSheetId:l}=Dr(o),{svg:a,bounds:p}=l4({circuitJson:t,analysis:i,issueIndex:c,schematicSheetId:l??"",width:r,height:n}),d=i.schematicIssuesToString(o)||`<${o.lineItemType} details="${Xl(JSON.stringify(o))}" />`,m=r2([`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">${a}</svg>`,p4(d,r)],{normalizeSize:!1,gap:0}).replace(/[ \t]+$/gm,"");return{issueIndex:c,issue:o,schematicSheetId:l,bounds:p,descriptionXml:d,fileName:`issue-${String(c+1).padStart(4,"0")}-${o.lineItemType}.svg`,contentType:"image/svg+xml",content:m}})}export{Ih as SchematicPlacementAnalysis,Fh as analyzeSchematicPlacement,cE as createSchematicPlacementIssueArtifacts};