@tscircuit/runframe 0.0.429 → 0.0.430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13422,4 +13422,4 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}return S0e}nfn();function zYe(n,e,t,r=
|
|
|
13422
13422
|
}
|
|
13423
13423
|
`,onClick:r=>{r.stopPropagation(),t()},children:[ut.jsx("input",{type:"checkbox",checked:e}),ut.jsx("span",{style:{color:"#eee"},children:n})]}),Mhn=({children:n,elements:e})=>{const[t,r]=zx(K=>[K.is_mouse_over_container,K.setIsMouseOverContainer]),[i,a]=vt.useState(!1),[o,s]=vt.useState(!1),[l,c]=vt.useState(!1),[u,f]=zx(K=>[K.selected_layer,K.selectLayer]),[p,y,x,T,w,S]=zx(K=>[K.in_move_footprint_mode,K.in_draw_trace_mode,K.is_showing_rats_nest,K.is_showing_multiple_traces_length,K.is_showing_autorouting,K.is_showing_drc_errors]),A=zx(K=>K.setEditMode),z=zx(K=>K.setIsShowingRatsNest),I=zx(K=>K.setIsShowingMultipleTracesLength),G=zx(K=>K.setIsShowingAutorouting),Y=zx(K=>K.setIsShowingDrcErrors);vS("1",()=>f("top")),vS("2",()=>f("bottom")),vS("3",()=>f("inner1")),vS("4",()=>f("inner2")),vS("5",()=>f("inner3")),vS("6",()=>f("inner4")),vS("7",()=>f("inner5")),vS("8",()=>f("inner6"));const Q=(e==null?void 0:e.filter(K=>K.type.includes("error")).length)??0;return ut.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{r(!0)},onMouseLeave:K=>{r(!1),s(!1)},children:[n,ut.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",Ehn.version]}),ut.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:h3.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[ut.jsxs(zT,{onClick:()=>{s(!o)},onMouseLeave:()=>{o&&s(!1)},children:[ut.jsxs("div",{children:["layer:"," ",ut.jsx("span",{style:{marginLeft:2,fontWeight:500,color:OT[u]},children:u})]}),o&&ut.jsx("div",{style:{marginTop:4,minWidth:120},children:rfe.map(K=>K.replace(/-/g,"")).map(K=>ut.jsx(Thn,{name:K,selected:K===u,onClick:()=>{f(K.replace(/-/,""))}},K))})]}),ut.jsxs(zT,{style:Q>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[ut.jsxs("div",{children:[Q," errors"]}),l&&ut.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(K=>K.type.includes("error")).map((K,re)=>ut.jsxs(vt.Fragment,{children:[ut.jsx("div",{children:K.error_type}),ut.jsx("div",{children:K.message})]},re))})]}),ut.jsx(zT,{style:{},onClick:()=>{A(y?"off":"draw_trace")},children:ut.jsxs("div",{children:[y?"✖ ":"","Edit Traces"]})}),ut.jsx(zT,{style:{},onClick:()=>{A(p?"off":"move_footprint")},children:ut.jsxs("div",{children:[p?"✖ ":"","Move Components"]})}),ut.jsx(zT,{style:{},onClick:()=>{z(!x)},children:ut.jsxs("div",{children:[x?"✖ ":"","Rats Nest"]})}),ut.jsx(zT,{onClick:()=>{a(!i)},children:ut.jsxs("div",{children:[ut.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",ut.jsx("span",{style:{fontSize:"8px",transform:i?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),i&&ut.jsxs("div",{style:{marginTop:4,minWidth:120},children:[ut.jsx(lfe,{label:"Show All Trace Lengths",checked:T,onClick:()=>{I(!T)}}),ut.jsx(lfe,{label:"Show Autorouting Animation",checked:w,onClick:()=>{G(!w)}}),ut.jsx(lfe,{label:"Show DRC Errors",checked:S,onClick:()=>{Y(!S)}})]})]})})]})]})},Chn=n=>{const{transform:e,elements:t}=n,[r,i]=vt.useMemo(()=>{const c=n.elements.flatMap(f=>Ipn(f,n.elements)),u=zb(n.elements);return[c,u]},[n.elements]),[a,o]=vt.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=vt.useMemo(()=>zpn({primitivesWithoutInteractionMetadata:r,drawingObjectIdsWithMouseOver:a.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:a.primitiveIdsInMousedOverNet}),[r,a]),l=vt.useCallback(c=>{var p,y;const u=[];for(const x of c)if(x._element){const T=i.getNetConnectedToId("pcb_port_id"in x._element?(p=x._element)==null?void 0:p.pcb_port_id:"pcb_trace_id"in x._element?(y=x._element)==null?void 0:y.pcb_trace_id:"");u.push(...i.getIdsConnectedToNet(T))}const f=new Set(c.map(x=>x._pcb_drawing_object_id));o({drawingObjectIdsWithMouseOver:f,primitiveIdsInMousedOverNet:u})},[i]);return ut.jsx(Shn,{elements:t,transform:e,primitives:r,onMouseHoverOverPrimitives:l,children:ut.jsx(ahn,{disabled:!n.allowEditing,transform:e,soup:t,cancelPanDrag:n.cancelPanDrag,onCreateEditEvent:n.onCreateEditEvent,onModifyEditEvent:n.onModifyEditEvent,children:ut.jsx(chn,{disabled:!n.allowEditing,transform:e,soup:t,cancelPanDrag:n.cancelPanDrag,onCreateEditEvent:n.onCreateEditEvent,onModifyEditEvent:n.onModifyEditEvent,children:ut.jsx(rhn,{transform:e,focusOnHover:n.focusOnHover,children:ut.jsx(Mhn,{elements:t,children:ut.jsx(dhn,{transform:e,elements:t,children:ut.jsx(whn,{transform:e,soup:t,children:ut.jsx(thn,{transform:e,debugGraphics:n.debugGraphics,children:ut.jsx(nhn,{transform:e,elements:t,children:ut.jsx(ehn,{transform:e,primitives:s,width:n.width,height:n.height,grid:n.grid})})})})})})})})})})},Rhn=Rc(q0(400,300),$2(40,-40)),Ahn=({circuitJson:n,debugGraphics:e,height:t=600,initialState:r,allowEditing:i=!0,editEvents:a,onEditEventsChanged:o,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=vt.useState(!l),[f,p]=ofe(),[y,x]=vt.useState(Rhn),{ref:T,setTransform:w,cancelDrag:S}=Opn({transform:y,onSetTransform:x,enabled:c});let[A,z]=vt.useState([]);A=a??A;const I=vt.useRef(!1),G=`${(n==null?void 0:n.length)||0}_${(n==null?void 0:n.editCount)||0}`,Y=()=>{const fe=(p==null?void 0:p.width)>0?p:{width:500,height:500},{center:me,width:ve,height:Te}=K.some(Ce=>Ce.type.startsWith("pcb_"))?Epn(K.filter(Ce=>Ce.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},Pe=Math.min((fe.width??0)/ve,(fe.height??0)/Te,100)*.75,we=Rc(q0((fe.width??0)/2,(fe.height??0)/2),$2(Pe,-Pe,0,0),q0(-me.x,-me.y));w(we)};vt.useEffect(()=>{p!=null&&p.width&&n&&n.length!==0&&(I.current||(Y(),I.current=!0))},[n,p]);const Q=vt.useMemo(()=>(n==null?void 0:n.filter(fe=>fe.type.startsWith("pcb_")||fe.type.startsWith("source_")))??[],[G]),K=vt.useMemo(()=>Zun({circuitJson:Q,editEvents:A}),[Q,A]),re=fe=>{z([...A,fe]),o==null||o([...A,fe])},J=fe=>{const me=A.map(ve=>ve.edit_event_id===fe.edit_event_id?{...ve,...fe}:ve);z(me),o==null||o(me)};return ut.jsxs("div",{ref:T,style:{position:"relative"},children:[ut.jsx("div",{ref:f,children:ut.jsxs(Mpn,{initialState:r,children:[ut.jsx(Chn,{transform:y,height:t,width:p.width,allowEditing:i,focusOnHover:s,cancelPanDrag:S,onCreateEditEvent:re,onModifyEditEvent:J,grid:{spacing:1,view_window:{left:0,right:p.width||500,top:t,bottom:0}},elements:K,debugGraphics:e},p.width),ut.jsx(Rpn,{})]})}),l&&!c&&ut.jsx("div",{onClick:()=>{u(!0),Y()},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:ut.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:"Click to Interact"})})]})};const Phn=({containerClassName:n,...e})=>{const t=vt.useRef(null),[r,i]=vt.useState(620);return vt.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;i(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),ut.jsx("div",{ref:t,className:n||"rf-w-full rf-h-full",children:ut.jsx(Ahn,{...e,height:r})})},Nhn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[620px\\]{height:620px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-96px\\)\\]{height:calc(100vh - 96px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.\\!rf-max-h-\\[70\\%\\]{max-height:70%!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[60vw\\]{max-width:60vw!important}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.\\!rf-overflow-x-hidden{overflow-x:hidden!important}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-tight{line-height:1.25}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-text-left{text-align:left}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',Dhn=()=>{vt.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=Nhn,document.head.appendChild(e)},[])};var jWe={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},cfe=new Set;for(const[n,e]of Object.entries(jWe)){cfe.add(n);for(const t of Object.keys(e.variants))cfe.add(t)}function Lhn(n){for(const[e,t]of Object.entries(jWe))if(n in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[n]};return{baseUnit:n,conversionFactor:1}}var HWe={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12},_b=n=>{var s;if(typeof n>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof n=="string"&&n.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(n),parsedUnit:null,unitOfValue:null};if(typeof n=="number")return{value:n,parsedUnit:null,unitOfValue:null};if(typeof n=="object"&&"x"in n&&"y"in n){const{parsedUnit:l,unitOfValue:c}=_b(n.x);return{parsedUnit:l,unitOfValue:c,value:{x:_b(n.x).value,y:_b(n.y).value}}}const t=(s=n.toString().split("").reverse().join("").match(/[^\d\s]+/))==null?void 0:s[0];if(!t)throw new Error(`Could not determine unit: "${n}"`);const r=t.split("").reverse().join(""),i=n.slice(0,-r.length);if(r in HWe&&!cfe.has(r)){const l=HWe[r];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(i)*l}}const{baseUnit:a,conversionFactor:o}=Lhn(r);return{parsedUnit:r,unitOfValue:a,value:o*Number.parseFloat(i)}},dP=b.string().or(b.number()).transform(n=>_b(n).value),pP=b.string().or(b.number()).transform(n=>_b(n).value).transform(n=>Number.parseFloat(n.toPrecision(12))),VWe=b.string().or(b.number()).transform(n=>_b(n).value),hP=b.string().or(b.number()).transform(n=>_b(n).value),u1=b.string().or(b.number()).transform(n=>_b(n).value),ufe=b.string().or(b.number()).transform(n=>_b(n).value),yi=u1;b.string().or(b.number()).transform(n=>_b(n).value),b.string().or(b.number()).transform(n=>_b(n).value);var d6=b.string().or(b.number()).transform(n=>typeof n=="number"?n:n.endsWith("deg")?Number.parseFloat(n.split("deg")[0]):n.endsWith("rad")?Number.parseFloat(n.split("rad")[0])*180/Math.PI:Number.parseFloat(n)),Ohn=b.number().or(b.string().endsWith("mAh")).transform(n=>{if(typeof n=="string"){const e=n.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return n}).describe("Battery capacity in mAh"),pv=b.object({x:yi,y:yi}),$B=b.object({x:yi,y:yi,z:yi}),$We=b.object({width:b.number(),height:b.number()}),Rm=n=>b.string().optional().default(()=>`${n}_${Nw(10)}`),GWe=b.enum(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),T5=b.object({type:b.literal("source_component"),ftype:b.string().optional(),source_component_id:b.string(),name:b.string(),manufacturer_part_number:b.string().optional(),supplier_part_numbers:b.record(GWe,b.array(b.string())).optional(),display_value:b.string().optional()}),qWe=T5.extend({ftype:b.literal("simple_capacitor"),capacitance:pP,max_voltage_rating:hP.optional(),display_capacitance:b.string().optional(),max_decoupling_trace_length:yi.optional()}),YWe=T5.extend({ftype:b.literal("simple_resistor"),resistance:dP,display_resistance:b.string().optional()}),ffe=T5.extend({ftype:b.literal("simple_diode")}),zhn=T5.extend({ftype:b.literal("simple_ground")}),XWe=T5.extend({ftype:b.literal("simple_bug")}).describe("@deprecated"),WWe=T5.extend({ftype:b.literal("simple_chip")}),ZWe=ffe.extend({ftype:b.literal("led")}),QWe=T5.extend({ftype:b.literal("simple_power_source"),voltage:hP}),KWe=T5.extend({ftype:b.literal("simple_battery"),capacity:Ohn}),JWe=T5.extend({ftype:b.literal("simple_inductor"),inductance:VWe}),eZe=T5.extend({ftype:b.literal("simple_push_button")}),tZe=T5.extend({ftype:b.literal("simple_potentiometer"),max_resistance:dP}),Uhn=T5.extend({ftype:b.literal("simple_crystal"),frequency:b.number().describe("Frequency in Hz"),load_capacitance:b.number().optional().describe("Load capacitance in pF")}),nZe=T5.extend({ftype:b.literal("simple_pin_header"),pin_count:b.number(),gender:b.enum(["male","female"]).optional().default("male")}),rZe=T5.extend({ftype:b.literal("simple_resonator"),load_capacitance:pP,equivalent_series_resistance:dP.optional(),frequency:ufe}),iZe=T5.extend({ftype:b.literal("simple_transistor"),transistor_type:b.enum(["npn","pnp"])}),aZe=T5.extend({ftype:b.literal("simple_mosfet"),channel_type:b.enum(["n","p"]),mosfet_mode:b.enum(["enhancement","depletion"])}),oZe=T5.extend({ftype:b.literal("simple_switch")}),sZe=b.object({type:b.literal("source_project_metadata"),name:b.string().optional(),software_used_string:b.string().optional(),created_at:b.string().datetime().optional()}),khn=b.union([YWe,qWe,ffe,zhn,WWe,XWe,ZWe,QWe,KWe,JWe,eZe,tZe,Uhn,nZe,rZe,oZe,iZe,aZe,sZe]),Ihn=b.object({type:b.literal("source_port"),pin_number:b.number().optional(),port_hints:b.array(b.string()).optional(),name:b.string(),source_port_id:b.string(),source_component_id:b.string(),subcircuit_id:b.string().optional()}),Fhn=b.object({type:b.literal("source_trace"),source_trace_id:b.string(),connected_source_port_ids:b.array(b.string()),connected_source_net_ids:b.array(b.string()),subcircuit_id:b.string().optional(),subcircuit_connectivity_map_key:b.string().optional(),max_length:b.number().optional(),min_trace_thickness:b.number().optional(),display_name:b.string().optional()}),Bhn=b.object({type:b.literal("source_group"),source_group_id:b.string(),subcircuit_id:b.string().optional(),parent_subcircuit_id:b.string().optional(),is_subcircuit:b.boolean().optional(),name:b.string().optional()}),jhn=b.object({type:b.literal("source_net"),source_net_id:b.string(),name:b.string(),member_source_group_ids:b.array(b.string()),is_power:b.boolean().optional(),is_ground:b.boolean().optional(),is_digital_signal:b.boolean().optional(),is_analog_signal:b.boolean().optional(),trace_width:b.number().optional(),subcircuit_id:b.string().optional()}),Hhn=b.object({type:b.literal("schematic_box"),schematic_component_id:b.string(),width:yi,height:yi,x:yi,y:yi}).describe("Draws a box on the schematic"),Vhn=b.object({type:b.literal("schematic_path"),schematic_component_id:b.string(),fill_color:b.enum(["red","blue"]).optional(),is_filled:b.boolean().optional(),points:b.array(pv)}),$hn=b.record(b.object({left_margin:u1.optional(),right_margin:u1.optional(),top_margin:u1.optional(),bottom_margin:u1.optional()})),Ghn=b.object({left_size:b.number(),right_size:b.number(),top_size:b.number().optional(),bottom_size:b.number().optional()}),qhn=b.object({left_side:b.object({pins:b.array(b.number()),direction:b.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:b.object({pins:b.array(b.number()),direction:b.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:b.object({pins:b.array(b.number()),direction:b.enum(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:b.object({pins:b.array(b.number()),direction:b.enum(["left-to-right","right-to-left"]).optional()}).optional()}),Yhn=b.union([Ghn,qhn]),Xhn=b.object({type:b.literal("schematic_component"),size:$We,center:pv,source_component_id:b.string(),schematic_component_id:b.string(),pin_spacing:u1.optional(),pin_styles:$hn.optional(),box_width:u1.optional(),symbol_name:b.string().optional(),port_arrangement:Yhn.optional(),port_labels:b.record(b.string()).optional(),symbol_display_value:b.string().optional()}),Whn=b.object({type:b.literal("schematic_line"),schematic_component_id:b.string(),x1:yi,x2:yi,y1:yi,y2:yi}),Zhn=b.object({type:b.literal("schematic_trace"),schematic_trace_id:b.string(),source_trace_id:b.string(),junctions:b.array(b.object({x:b.number(),y:b.number()})),edges:b.array(b.object({from:b.object({x:b.number(),y:b.number()}),to:b.object({x:b.number(),y:b.number()}),is_crossing:b.boolean().optional(),from_schematic_port_id:b.string().optional(),to_schematic_port_id:b.string().optional()}))}),Qhn=b.object({type:b.literal("schematic_text"),schematic_component_id:b.string(),schematic_text_id:b.string(),text:b.string(),position:b.object({x:yi,y:yi}),rotation:b.number().default(0),anchor:b.enum(["center","left","right","top","bottom"]).default("center"),color:b.string().default("#000000")}),Khn=b.object({type:b.literal("schematic_port"),schematic_port_id:b.string(),source_port_id:b.string(),schematic_component_id:b.string().optional(),center:pv,facing_direction:b.enum(["up","down","left","right"]).optional(),distance_from_component_edge:b.number().optional(),side_of_component:b.enum(["top","bottom","left","right"]).optional(),true_ccw_index:b.number().optional(),pin_number:b.number().optional(),display_pin_label:b.string().optional()}).describe("Defines a port on a schematic component"),Jhn=b.object({type:b.literal("schematic_net_label"),source_net_id:b.string(),center:pv,anchor_position:pv.optional(),anchor_side:b.enum(["top","bottom","left","right"]),text:b.string(),symbol_name:b.string().optional()}),emn=b.object({type:b.literal("schematic_error"),schematic_error_id:b.string(),error_type:b.literal("schematic_port_not_found"),message:b.string()}).describe("Defines a schematic error on the schematic"),dfe=b.object({type:b.literal("schematic_debug_object"),label:b.string().optional()}),tmn=dfe.extend({shape:b.literal("rect"),center:pv,size:$We}),nmn=dfe.extend({shape:b.literal("line"),start:pv,end:pv}),rmn=dfe.extend({shape:b.literal("point"),center:pv}),imn=b.discriminatedUnion("shape",[tmn,nmn,rmn]),amn=b.object({type:b.literal("schematic_voltage_probe"),schematic_voltage_probe_id:b.string(),position:pv,schematic_trace_id:b.string(),voltage:hP.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),lZe=b.object({type:b.literal("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:Rm("schematic_manual_edit_conflict_warning"),message:b.string(),schematic_component_id:b.string(),schematic_group_id:b.string().optional(),subcircuit_id:b.string().optional(),source_component_id:b.string()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),omn=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],cZe=b.enum(omn),S1=cZe.or(b.object({name:cZe})).transform(n=>typeof n=="string"?n:n.name),mP=b.enum(["top","bottom"]),smn=b.object({x:yi,y:yi,via:b.boolean().optional(),via_to_layer:S1.optional()});b.array(smn);var gS=b.object({x:yi,y:yi,via:b.boolean().optional(),to_layer:S1.optional(),trace_width:yi.optional()}),lmn=b.object({type:b.literal("pcb_component"),pcb_component_id:Rm("pcb_component"),source_component_id:b.string(),center:pv,layer:S1,rotation:d6,width:u1,height:u1,subcircuit_id:b.string().optional()}).describe("Defines a component on the PCB"),uZe=b.object({type:b.literal("pcb_hole"),pcb_hole_id:Rm("pcb_hole"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),hole_shape:b.enum(["circle","square"]),hole_diameter:b.number(),x:yi,y:yi});uZe.describe("Defines a circular or square hole on the PCB");var fZe=b.object({type:b.literal("pcb_hole"),pcb_hole_id:Rm("pcb_hole"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),hole_shape:b.literal("oval"),hole_width:b.number(),hole_height:b.number(),x:yi,y:yi});fZe.describe("Defines an oval hole on the PCB");var cmn=uZe.or(fZe),umn=b.object({type:b.literal("pcb_plated_hole"),shape:b.literal("circle"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),outer_diameter:b.number(),hole_diameter:b.number(),x:yi,y:yi,layers:b.array(S1),port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional(),pcb_plated_hole_id:Rm("pcb_plated_hole")}),fmn=b.object({type:b.literal("pcb_plated_hole"),shape:b.enum(["oval","pill"]),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),outer_width:b.number(),outer_height:b.number(),hole_width:b.number(),hole_height:b.number(),x:yi,y:yi,layers:b.array(S1),port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional(),pcb_plated_hole_id:Rm("pcb_plated_hole")}),dmn=b.object({type:b.literal("pcb_plated_hole"),shape:b.literal("circular_hole_with_rect_pad"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),hole_shape:b.literal("circle"),pad_shape:b.literal("rect"),hole_diameter:b.number(),rect_pad_width:b.number(),rect_pad_height:b.number(),x:yi,y:yi,layers:b.array(S1),port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional(),pcb_plated_hole_id:Rm("pcb_plated_hole")});b.object({type:b.literal("pcb_plated_hole"),shape:b.literal("pill_hole_with_rect_pad"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),hole_shape:b.literal("pill"),pad_shape:b.literal("rect"),hole_width:b.number(),hole_height:b.number(),rect_pad_width:b.number(),rect_pad_height:b.number(),x:yi,y:yi,layers:b.array(S1),port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional(),pcb_plated_hole_id:Rm("pcb_plated_hole")});var pmn=b.union([umn,fmn,dmn]),hmn=b.object({type:b.literal("pcb_port"),pcb_port_id:Rm("pcb_port"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),source_port_id:b.string(),pcb_component_id:b.string(),x:yi,y:yi,layers:b.array(S1)}).describe("Defines a port on the PCB"),mmn=b.object({type:b.literal("pcb_smtpad"),shape:b.literal("circle"),pcb_smtpad_id:Rm("pcb_smtpad"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,radius:b.number(),layer:S1,port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional()}),ymn=b.object({type:b.literal("pcb_smtpad"),shape:b.literal("rect"),pcb_smtpad_id:Rm("pcb_smtpad"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,width:b.number(),height:b.number(),layer:S1,port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional()}),vmn=b.object({type:b.literal("pcb_smtpad"),shape:b.literal("rotated_rect"),pcb_smtpad_id:Rm("pcb_smtpad"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,width:b.number(),height:b.number(),ccw_rotation:d6,layer:S1,port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional()}),gmn=b.object({type:b.literal("pcb_smtpad"),shape:b.literal("pill"),pcb_smtpad_id:Rm("pcb_smtpad"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,width:b.number(),height:b.number(),radius:b.number(),layer:S1,port_hints:b.array(b.string()).optional(),pcb_component_id:b.string().optional(),pcb_port_id:b.string().optional()}),_mn=b.union([mmn,ymn,vmn,gmn]).describe("Defines an SMT pad on the PCB"),xmn=b.object({type:b.literal("pcb_solder_paste"),shape:b.literal("circle"),pcb_solder_paste_id:Rm("pcb_solder_paste"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,radius:b.number(),layer:S1,pcb_component_id:b.string().optional(),pcb_smtpad_id:b.string().optional()}),bmn=b.object({type:b.literal("pcb_solder_paste"),shape:b.literal("rect"),pcb_solder_paste_id:Rm("pcb_solder_paste"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,width:b.number(),height:b.number(),layer:S1,pcb_component_id:b.string().optional(),pcb_smtpad_id:b.string().optional()}),Smn=b.object({type:b.literal("pcb_solder_paste"),shape:b.literal("pill"),pcb_solder_paste_id:Rm("pcb_solder_paste"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,width:b.number(),height:b.number(),radius:b.number(),layer:S1,pcb_component_id:b.string().optional(),pcb_smtpad_id:b.string().optional()}),wmn=b.object({type:b.literal("pcb_solder_paste"),shape:b.literal("rotated_rect"),pcb_solder_paste_id:Rm("pcb_solder_paste"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,width:b.number(),height:b.number(),ccw_rotation:yi,layer:S1,pcb_component_id:b.string().optional(),pcb_smtpad_id:b.string().optional()}),Emn=b.object({type:b.literal("pcb_solder_paste"),shape:b.literal("oval"),pcb_solder_paste_id:Rm("pcb_solder_paste"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,width:b.number(),height:b.number(),layer:S1,pcb_component_id:b.string().optional(),pcb_smtpad_id:b.string().optional()}),Tmn=b.union([xmn,bmn,Smn,wmn,Emn]).describe("Defines solderpaste on the PCB"),Mmn=b.object({type:b.literal("pcb_text"),pcb_text_id:Rm("pcb_text"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),text:b.string(),center:pv,layer:S1,width:u1,height:u1,lines:b.number(),align:b.enum(["bottom-left"])}).describe("Defines text on the PCB"),Cmn=b.object({route_type:b.literal("wire"),x:yi,y:yi,width:yi,start_pcb_port_id:b.string().optional(),end_pcb_port_id:b.string().optional(),layer:S1}),Rmn=b.object({route_type:b.literal("via"),x:yi,y:yi,hole_diameter:yi.optional(),outer_diameter:yi.optional(),from_layer:b.string(),to_layer:b.string()}),Amn=b.union([Cmn,Rmn]),Pmn=b.object({type:b.literal("pcb_trace"),source_trace_id:b.string().optional(),pcb_component_id:b.string().optional(),pcb_trace_id:Rm("pcb_trace"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),route_thickness_mode:b.enum(["constant","interpolated"]).default("constant").optional(),route_order_index:b.number().optional(),should_round_corners:b.boolean().optional(),trace_length:b.number().optional(),route:b.array(Amn)}).describe("Defines a trace on the PCB"),Nmn=b.object({type:b.literal("pcb_trace_error"),pcb_trace_error_id:Rm("pcb_trace_error"),error_type:b.literal("pcb_trace_error"),message:b.string(),center:pv.optional(),pcb_trace_id:b.string(),source_trace_id:b.string(),pcb_component_ids:b.array(b.string()),pcb_port_ids:b.array(b.string())}).describe("Defines a trace error on the PCB"),Dmn=b.object({type:b.literal("pcb_port_not_matched_error"),pcb_error_id:Rm("pcb_error"),message:b.string(),pcb_component_ids:b.array(b.string())}).describe("Defines a trace error on the PCB where a port is not matched"),Lmn=b.object({type:b.literal("pcb_via"),pcb_via_id:Rm("pcb_via"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),x:yi,y:yi,outer_diameter:yi.default("0.6mm"),hole_diameter:yi.default("0.25mm"),from_layer:S1.optional(),to_layer:S1.optional(),layers:b.array(S1),pcb_trace_id:b.string().optional()}).describe("Defines a via on the PCB"),Omn=b.object({type:b.literal("pcb_board"),pcb_board_id:Rm("pcb_board"),is_subcircuit:b.boolean().optional(),subcircuit_id:b.string().optional(),width:u1,height:u1,center:pv,thickness:u1.optional().default(1.4),num_layers:b.number().optional().default(4),outline:b.array(pv).optional(),material:b.enum(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),zmn=b.object({type:b.literal("pcb_placement_error"),pcb_placement_error_id:Rm("pcb_placement_error"),message:b.string()}).describe("Defines a placement error on the PCB"),Umn=b.object({type:b.literal("pcb_trace_hint"),pcb_trace_hint_id:Rm("pcb_trace_hint"),pcb_port_id:b.string(),pcb_component_id:b.string(),route:b.array(gS)}).describe("A hint that can be used during generation of a PCB trace"),kmn=b.object({type:b.literal("pcb_silkscreen_line"),pcb_silkscreen_line_id:Rm("pcb_silkscreen_line"),pcb_component_id:b.string(),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),stroke_width:yi.default("0.1mm"),x1:yi,y1:yi,x2:yi,y2:yi,layer:mP}).describe("Defines a silkscreen line on the PCB"),Imn=b.object({type:b.literal("pcb_silkscreen_path"),pcb_silkscreen_path_id:Rm("pcb_silkscreen_path"),pcb_component_id:b.string(),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),layer:mP,route:b.array(pv),stroke_width:u1}).describe("Defines a silkscreen path on the PCB"),Fmn=b.object({type:b.literal("pcb_silkscreen_text"),pcb_silkscreen_text_id:Rm("pcb_silkscreen_text"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),font:b.literal("tscircuit2024").default("tscircuit2024"),font_size:yi.default("0.2mm"),pcb_component_id:b.string(),text:b.string(),ccw_rotation:b.number().optional(),layer:S1,is_mirrored:b.boolean().default(!1).optional(),anchor_position:pv.default({x:0,y:0}),anchor_alignment:b.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center")}).describe("Defines silkscreen text on the PCB"),Bmn=b.object({type:b.literal("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:Rm("pcb_silkscreen_rect"),pcb_component_id:b.string(),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),center:pv,width:u1,height:u1,layer:S1,stroke_width:u1.default("1mm")}).describe("Defines a silkscreen rect on the PCB"),jmn=b.object({type:b.literal("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:Rm("pcb_silkscreen_circle"),pcb_component_id:b.string(),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),center:pv,radius:u1,layer:mP,stroke_width:u1.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),Hmn=b.object({type:b.literal("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:Rm("pcb_silkscreen_oval"),pcb_component_id:b.string(),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),center:pv,radius_x:yi,radius_y:yi,layer:mP}).describe("Defines a silkscreen oval on the PCB"),Vmn=b.object({type:b.literal("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:Rm("pcb_fabrication_note_text"),subcircuit_id:b.string().optional(),pcb_group_id:b.string().optional(),font:b.literal("tscircuit2024").default("tscircuit2024"),font_size:yi.default("1mm"),pcb_component_id:b.string(),text:b.string(),layer:mP,anchor_position:pv.default({x:0,y:0}),anchor_alignment:b.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:b.string().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),$mn=b.object({type:b.literal("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:Rm("pcb_fabrication_note_path"),pcb_component_id:b.string(),subcircuit_id:b.string().optional(),layer:S1,route:b.array(pv),stroke_width:u1,color:b.string().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),Gmn=b.object({type:b.literal("pcb_keepout"),shape:b.literal("rect"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),center:pv,width:yi,height:yi,pcb_keepout_id:b.string(),layers:b.array(b.string()),description:b.string().optional()}).or(b.object({type:b.literal("pcb_keepout"),shape:b.literal("circle"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),center:pv,radius:yi,pcb_keepout_id:b.string(),layers:b.array(b.string()),description:b.string().optional()})),qmn=b.object({type:b.literal("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:Rm("pcb_missing_footprint_error"),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),error_type:b.literal("pcb_missing_footprint_error"),source_component_id:b.string(),message:b.string()}).describe("Defines a missing footprint error on the PCB"),Ymn=b.object({type:b.literal("pcb_group"),pcb_group_id:Rm("pcb_group"),source_group_id:b.string(),is_subcircuit:b.boolean().optional(),subcircuit_id:b.string().optional(),width:u1,height:u1,center:pv,pcb_component_ids:b.array(b.string()),name:b.string().optional(),description:b.string().optional()}).describe("Defines a group of components on the PCB"),Xmn=b.object({type:b.literal("pcb_autorouting_error"),pcb_error_id:Rm("pcb_autorouting_error"),message:b.string()}).describe("The autorouting has failed to route a portion of the board"),dZe=b.object({type:b.literal("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:Rm("pcb_manual_edit_conflict_warning"),message:b.string(),pcb_component_id:b.string(),pcb_group_id:b.string().optional(),subcircuit_id:b.string().optional(),source_component_id:b.string()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),Wmn=b.object({type:b.literal("cad_component"),cad_component_id:b.string(),pcb_component_id:b.string(),source_component_id:b.string(),position:$B,rotation:$B.optional(),size:$B.optional(),layer:S1.optional(),footprinter_string:b.string().optional(),model_obj_url:b.string().optional(),model_stl_url:b.string().optional(),model_3mf_url:b.string().optional(),model_jscad:b.any().optional()}).describe("Defines a component on the PCB");b.union([Fhn,Ihn,khn,ZWe,jhn,Bhn,XWe,WWe,qWe,ffe,YWe,QWe,KWe,JWe,nZe,rZe,oZe,iZe,aZe,tZe,eZe,sZe,lmn,cmn,qmn,dZe,pmn,Gmn,hmn,Mmn,Pmn,Lmn,_mn,Tmn,Omn,Ymn,Umn,kmn,Imn,Fmn,Bmn,jmn,Hmn,Nmn,zmn,Dmn,$mn,Vmn,Xmn,Hhn,Qhn,Whn,Xhn,Khn,Zhn,Vhn,emn,Jhn,imn,amn,lZe,Wmn]);function pfe(n){if(n.length===0)return{minX:0,maxX:0,minY:0,maxY:0};let e=1/0,t=-1/0,r=1/0,i=-1/0;const a=o=>{e=Math.min(e,o.x),t=Math.max(t,o.x),r=Math.min(r,o.y),i=Math.max(i,o.y)};return n.forEach(o=>{switch(o.type){case"path":o.points.forEach(a);break;case"text":a({x:o.x,y:o.y});break;case"circle":{const{x:s,y:l,radius:c}=o;a({x:s-c,y:l-c}),a({x:s+c,y:l+c});break}case"box":{const{x:s,y:l,width:c,height:u}=o,f=c/2,p=u/2;a({x:s-f,y:l-p}),a({x:s+f,y:l+p});break}}}),{minX:e,maxX:t,minY:r,maxY:i}}function Wm(n){let e=n.size;if(!e){const t=pfe(n.primitives);e={width:t.maxX-t.minX,height:t.maxY-t.minY}}return{...n,size:e}}var Zmn={paths:{path11:{type:"path",points:[{x:-.5274831500000005,y:.03018695000000049},{x:-.30105415000000013,y:.03018695000000049}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2932119499999999,y:.03018695000000049},{x:.5339524499999997,y:.03018695000000049}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:.09765764999999949,y:.12845085000000034},{x:-.0011297500000011507,y:-.06303624999999946},{x:-.10778645000000164,y:.12845085000000034}],color:"primary",fill:!1},path17:{type:"path",points:[{x:-.002934749999999875,y:-.13606674999999946},{x:.06869635000000063,y:-.11019914999999947}],color:"primary",fill:!1},path18:{type:"path",points:[{x:.06869635000000063,y:-.11019914999999947},{x:.1403274500000009,y:-.13606674999999946}],color:"primary",fill:!1},path19:{type:"path",points:[{x:-.1461968499999997,y:-.13606674999999946},{x:-.07456574999999921,y:-.11019914999999947}],color:"primary",fill:!1},path20:{type:"path",points:[{x:-.07456575000000054,y:-.11019914999999947},{x:-.0029346500000002607,y:-.13606674999999946}],color:"primary",fill:!1}},refblocks:{left1:{x:-.5413984499999998,y:.029334149999999948},right1:{x:.54139845,y:.030330549999999734}},bounds:{width:1.1391137819999997,height:.5443252999999999,centerX:11102230246251565e-32,centerY:.05499999999999999},circles:{path1:{type:"circle",x:-.0037626500000000895,y:.03731525000000002,radius:.28854213,color:"primary",fill:!1}}},{paths:Qmn,bounds:GB,refblocks:pZe,circles:Kmn}=Zmn,hZe=Wm({primitives:[...Object.values(Qmn),...Object.values(Kmn),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"}],ports:[{...pZe.left1,labels:["1"]},{...pZe.right1,labels:["2"]}],size:{width:GB.width,height:GB.height},center:{x:GB.centerX,y:GB.centerY}}),Jmn=(n,e="right")=>{switch(e){case"down":switch(n){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(n){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(n){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 n}return n},e9n=(n,e)=>{const{primitives:t,center:r,ports:i,size:a}=n,o=N3({a:1,b:0,c:0,d:-1,e:0,f:2*r.y}),s=t.map(c=>{switch(c={...c},c.type){case"path":return{...c,points:c.points.map(y=>gr(o,y))};case"text":const u=gr(o,{x:c.x,y:c.y}),f={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{...c,x:u.x,y:u.y,anchor:f[c.anchor]};case"circle":case"box":const p=gr(o,{x:c.x,y:c.y});return{...c,x:p.x,y:p.y}}}),l=i.map(c=>({...c,...gr(o,c)}));return{primitives:s,center:r,ports:l,size:a,...e}},hfe=(n,e)=>{const{primitives:t,center:r,ports:i,size:a}=n,o=N3({a:-1,b:0,c:0,d:1,e:0,f:2*r.x}),s=t.map(c=>{switch(c={...c},c.type){case"path":return{...c,points:c.points.map(y=>gr(o,y))};case"text":const u=gr(o,{x:c.x,y:c.y}),f={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{...c,x:u.x,y:u.y,anchor:f[c.anchor]};case"circle":case"box":const p=gr(o,{x:c.x,y:c.y});return{...c,x:p.x,y:p.y}}}),l=i.map(c=>({...c,...gr(o,c)}));return{primitives:s,center:r,ports:l,size:a,...e}},yP=(n,e)=>{const{newOrientation:t,overrides:r}=e,i={up:Math.PI/2,right:0,down:-Math.PI/2,left:-Math.PI},a=Kx(t?i[t]:Math.PI/2,n.center.x,n.center.y),{primitives:o,center:s,size:l,ports:c}=n,u=o.map(y=>{switch(y={...y},y.type){case"path":return{...y,points:y.points.map(S=>gr(a,S))};case"text":const x=gr(a,{x:y.x,y:y.y});return y.anchor=Jmn(y.anchor,t??"right"),{...y,x:x.x,y:x.y};case"circle":const T=gr(a,{x:y.x,y:y.y});return{...y,x:T.x,y:T.y};case"box":const w=gr(a,{x:y.x,y:y.y});return{...y,x:w.x,y:w.y,width:y.height,height:y.width}}}),f=c.map(y=>({...y,...gr(a,y)})),p=pfe(u);return{primitives:u,center:s,ports:f,size:{width:p.maxX-p.minX,height:p.maxY-p.minY},...r}},Pl=(n,e="down",t={})=>yP(n,{newOrientation:e,overrides:t}),t9n=yP(hZe,{newOrientation:"up"}),n9n=t9n,r9n={paths:{path40:{type:"path",points:[{x:.14458890000000002,y:.0390362999999998},{x:-.1199943999999995,y:-.09325540000000054}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.1199943999999995,y:.17132800000000015},{x:.14458890000000002,y:.0390362999999998}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.1199943999999995,y:-.09325539999999921},{x:-.1199943999999995,y:.17132800000000015}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.14458890000000002,y:.17132800000000015},{x:.14458890000000002,y:-.09325539999999921}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.12219909999999956,y:.0390362999999998},{x:-.5168693999999996,y:.0390362999999998}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.5233797000000002,y:.03895110000000024},{x:.1496715999999998,y:.03895110000000024}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:.14339119999999994,y:.17181090000000032},{x:.07768859999999966,y:.19542900000000052}],color:"primary",fill:!1},"path43-8-3":{type:"path",points:[{x:.21083259999999981,y:-.1180321000000002},{x:.14512999999999954,y:-.094414}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999996715,y:.26884529999999995},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999977319,y:-.27884529999999996}},refblocks:{left1:{x:-.5191471000000001,y:.03992070000000081},right1:{x:.5191470999999999,y:.03889609999999988}},bounds:{width:1.094611082,height:.2976905999999999,centerX:-11102230246251565e-32,centerY:.05499999999999999},circles:{}},{paths:i9n,texts:mZe,bounds:qB,refblocks:yZe,circles:a9n}=r9n,vZe=Wm({primitives:[...Object.values(i9n),...Object.values(a9n),{...mZe.top1,anchor:"middle_bottom"},{...mZe.bottom1,anchor:"middle_top"}],ports:[{...yZe.left1,labels:["1"]},{...yZe.right1,labels:["2"]}],size:{width:qB.width,height:qB.height},center:{x:qB.centerX,y:qB.centerY}}),o9n=yP(vZe,{newOrientation:"down"}),s9n=o9n,l9n={paths:{path43:{type:"path",points:[{x:-.05901489999999909,y:.18831315000000015},{x:-.05869489999999833,y:-.11814524999999954}],color:"primary",fill:!1},"path43-6":{type:"path",points:[{x:.015375000000000805,y:.12533125000000034},{x:.016669000000000933,y:-.05562075000000033}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.06443049999999961,y:.032673549999999496},{x:-.4368029,y:.032673549999999496}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.4350822999999997,y:.03438825000000034},{x:.028285099999999952,y:.03438825000000034}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.027835099999999446,y:.26564474999999943},bottom1:{type:"text",text:"{VAL}",x:-.028373699999999502,y:-.27564474999999966}},refblocks:{left1:{x:-.4458008,y:.033557849999999334},right1:{x:.4458008,y:.03343344999999931}},bounds:{width:.947918482,height:.2912894999999991,centerX:0,centerY:.055000000000000104},circles:{}},{paths:c9n,texts:gZe,bounds:YB,refblocks:_Ze,circles:u9n}=l9n,xZe=Wm({primitives:[...Object.values(c9n),...Object.values(u9n),{...gZe.top1,anchor:"middle_bottom"},{...gZe.bottom1,anchor:"middle_top"}],ports:[{..._Ze.left1,labels:["1"]},{..._Ze.right1,labels:["2"]}],size:{width:YB.width,height:YB.height},center:{x:YB.centerX,y:YB.centerY}}),f9n=yP(xZe,{newOrientation:"up"}),XB={paths:{path1:{type:"path",points:[{x:-.511850799999999,y:.04616140000000257},{x:-.24726749999999953,y:.04616140000000257}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.2818991000000013,y:.04616140000000257},{x:.5464825000000006,y:.04616140000000257}],color:"primary",fill:!1},path3:{type:"path",points:[{x:.0173157000000006,y:.17845310000000225},{x:.2818990000000001,y:.17845310000000225},{x:.2818990000000001,y:-.0861302999999971},{x:-.24726770000000053,y:-.0861302999999971},{x:-.24726770000000053,y:.17845310000000225},{x:.017315699999998824,y:.17845310000000225}],color:"primary",fill:!1}},refblocks:{left1:{x:-.5337907000000002,y:.04580520000000021},right1:{x:.5337907000000004,y:.04525870000000154}},bounds:{centerX:11102230246251565e-32,centerY:8881784197001252e-31},circles:{}},d9n=class{constructor(n){Je(this,"symbol");this.symbol=JSON.parse(JSON.stringify(n)),this.symbol.size=this.computeSize()}changeTextAnchor(n,e){return this.symbol={...this.symbol,primitives:this.symbol.primitives.map(t=>t.type==="text"&&t.text===n?{...t,anchor:e}:t)},this}labelPort(n,e){return this.symbol={...this.symbol,ports:this.symbol.ports.map(t=>t.labels.includes(n)?{...t,labels:e}:t)},this}rotateRightFacingSymbol(n){return this.symbol=yP(this.symbol,{newOrientation:n}),this}computeSize(){const n=pfe(this.symbol.primitives);return{width:n.maxX-n.minX,height:n.maxY-n.minY}}build(){return{...this.symbol,size:this.computeSize()}}},cd=n=>new d9n({...n,primitives:n.primitives??[...Object.values(n.paths??{}),...Object.values(n.texts??{}),...Object.values(n.circles??{}),...Object.values(n.rects??{})],ports:n.ports??Object.entries(n.refblocks).flatMap(([e,t])=>[{...t,labels:[e]}]),center:n.center??{x:n.bounds.centerX,y:n.bounds.centerY}}),{paths:p9n,bounds:bZe,refblocks:SZe,circles:h9n}=XB,m9n=cd({primitives:[...Object.values(p9n),...Object.values(h9n),{type:"text",text:"{REF}",x:-.16,y:.2294553499999995},{type:"text",text:"{VAL}",x:.16,y:.2294553499999995}],ports:[{...SZe.left1,labels:["1"]},{...SZe.right1,labels:["2"]}],center:{x:bZe.centerX,y:bZe.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),{paths:y9n,bounds:wZe,refblocks:EZe,circles:v9n}=XB,g9n=cd({primitives:[...Object.values(y9n),...Object.values(v9n),{type:"text",text:"{REF}",x:0,y:.2294553499999995},{type:"text",text:"{VAL}",x:0,y:-.1594553499999995}],ports:[{...EZe.left1,labels:["1"]},{...EZe.right1,labels:["2"]}],center:{x:wZe.centerX,y:wZe.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:_9n,bounds:TZe,refblocks:MZe,circles:x9n}=XB,b9n=cd({primitives:[...Object.values(_9n),...Object.values(x9n),{type:"text",text:"{REF}",x:0,y:.2294553499999995},{type:"text",text:"{VAL}",x:0,y:-.1594553499999995}],ports:[{...MZe.left1,labels:["1"]},{...MZe.right1,labels:["2"]}],center:{x:TZe.centerX,y:TZe.centerY}}).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:S9n,bounds:CZe,refblocks:RZe,circles:w9n}=XB,E9n=cd({primitives:[...Object.values(S9n),...Object.values(w9n),{type:"text",text:"{REF}",x:-.16,y:.2294553499999995},{type:"text",text:"{VAL}",x:.16,y:.2294553499999995}],ports:[{...RZe.left1,labels:["1"]},{...RZe.right1,labels:["2"]}],center:{x:CZe.centerX,y:CZe.centerY}}).changeTextAnchor("{VAL}","middle_bottom").rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),WB={paths:{path27:{type:"path",points:[{x:.5229378000000002,y:.017283050000003186},{x:.07314620000000005,y:.017283050000003186}],color:"primary",fill:!1},path28:{type:"path",points:[{x:-.0856037999999999,y:.017283050000003186},{x:-.5353954999999999,y:.017283050000003186}],color:"primary",fill:!1},path29:{type:"path",points:[{x:.0731461999999996,y:.2818663500000014},{x:.07314620000000005,y:-.24730024999999856}],color:"primary",fill:!1},path30:{type:"path",points:[{x:-.0856037999999999,y:.2818663500000014},{x:-.0856037999999999,y:-.24730024999999856}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.012864500000000056,y:.4200086500000033},bottom1:{type:"text",text:"{VAL}",x:-.003850500000000423,y:-.42000864999999976}},refblocks:{left1:{x:-.5512093000000005,y:.01638025000000276},right1:{x:.5512093,y:.016926950000001995}},bounds:{minX:-.5793677410000004,maxX:.579367741,minY:-.42000864999999976,maxY:.4200086500000033,width:1.1587354820000004,height:.8400173000000031,centerX:-2220446049250313e-31,centerY:17763568394002505e-31},circles:{}},{paths:T9n,texts:ESn,bounds:ZB,refblocks:AZe,circles:M9n}=WB,C9n=cd({primitives:[...Object.values(T9n),...Object.values(M9n),{type:"text",text:"{REF}",x:-.2,y:.2094553499999995},{type:"text",text:"{VAL}",x:.2,y:.2094553499999995}],ports:[{...AZe.left1,labels:["1"]},{...AZe.right1,labels:["2"]}],size:{width:ZB.width,height:ZB.height},center:{x:ZB.centerX,y:ZB.centerY}}).changeTextAnchor("{VAL}","top_left").rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","bottom_left").build(),R9n=cd(WB).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["2"]).labelPort("right1",["1"]).changeTextAnchor("{REF}","middle_bottom").build(),mfe={paths:{"path27-5":{type:"path",points:[{x:.4511331000000005,y:.017283050000003186},{x:.001333100000000531,y:.017283050000003186}],color:"primary",fill:!1},"path28-5":{type:"path",points:[{x:-.08560379999999945,y:.017283050000003186},{x:-.5353954999999995,y:.017283050000003186}],color:"primary",fill:!1},"path30-7":{type:"path",points:[{x:-.0024798999999995353,y:.28420285000000334},{x:-.0024798999999995353,y:-.247479349999999}],color:"primary",fill:!1},path8704:{type:"path",points:[{x:-.1433630999999993,y:-.24400714999999806},{x:-.1433630999999993,y:-.24400714999999806},{x:-.14262848833929928,y:-.24277205092349807},{x:-.1418975396743993,y:-.2415360290679981},{x:-.14117026348109932,y:-.24029908349449816},{x:-.14044666923519933,y:-.23906121326399818},{x:-.13972676641249931,y:-.2378224174374982},{x:-.1390105644887993,y:-.23658269507599822},{x:-.13829807293989932,y:-.2353420452404983},{x:-.13758930124159935,y:-.23410046699199832},{x:-.13688425886969938,y:-.23285795939149836},{x:-.13618295529999938,y:-.23161452149999842},{x:-.13548540000829937,y:-.23037015237849842},{x:-.13479160247039934,y:-.22912485108799843},{x:-.13410157216209936,y:-.22787861668949844},{x:-.1334153185591994,y:-.22663144824399842},{x:-.13273285113749936,y:-.22538334481249844},{x:-.13205417937279937,y:-.22413430545599844},{x:-.1313793127408994,y:-.2228843292354985},{x:-.1307082607175994,y:-.22163341521199847},{x:-.13004103277869938,y:-.2203815624464985},{x:-.1293776383999994,y:-.21912876999999853},{x:-.12871808705729942,y:-.21787503693349855},{x:-.12806238822639943,y:-.21662036230799855},{x:-.12741055138309942,y:-.21536474518449858},{x:-.12676258600319942,y:-.21410818462399858},{x:-.12611850156249946,y:-.21285067968749863},{x:-.12547830753679945,y:-.21159222943599865},{x:-.12484201340189946,y:-.21033283293049862},{x:-.12420962863359947,y:-.20907248923199864},{x:-.12358116270769948,y:-.20781119740149864},{x:-.12295662509999947,y:-.20654895649999866},{x:-.12233602528629947,y:-.20528576558849868},{x:-.12171937274239948,y:-.20402162372799865},{x:-.12110667694409948,y:-.20275652997949864},{x:-.12049794736719947,y:-.2014904834039986},{x:-.11989319348749948,y:-.20022348306249865},{x:-.11929242478079949,y:-.19895552801599864},{x:-.11869565072289952,y:-.19768661732549864},{x:-.11810288078959952,y:-.19641675005199866},{x:-.11751412445669952,y:-.19514592525649863},{x:-.1169293911999995,y:-.1938741419999986},{x:-.11634869049529953,y:-.19260139934349865},{x:-.11577203181839951,y:-.1913276963479986},{x:-.11519942464509951,y:-.1900530320744986},{x:-.11463087845119951,y:-.18877740558399858},{x:-.11406640271249952,y:-.1875008159374986},{x:-.11350600690479953,y:-.18622326219599858},{x:-.11294970050389953,y:-.18494474342049858},{x:-.11239749298559953,y:-.1836652586719986},{x:-.11184939382569953,y:-.18238480701149856},{x:-.11130541249999952,y:-.18110338749999852},{x:-.11076555848429954,y:-.17982099919849853},{x:-.11022984125439952,y:-.1785376411679985},{x:-.10969827028609953,y:-.1772533124694985},{x:-.10917085505519954,y:-.17596801216399852},{x:-.10864760503749954,y:-.17468173931249847},{x:-.10812852970879953,y:-.17339449297599843},{x:-.10761363854489954,y:-.17210627221549843},{x:-.10710294102159955,y:-.17081707609199845},{x:-.10659644661469955,y:-.16952690366649845},{x:-.10609416479999954,y:-.1682357539999984},{x:-.10559610505329955,y:-.1669436261534984},{x:-.10510227685039954,y:-.1656505191879984},{x:-.10461268966709955,y:-.16435643216449838},{x:-.10412735297919956,y:-.16306136414399838},{x:-.10364627626249956,y:-.16176531418749837},{x:-.10316946899279957,y:-.16046828135599833},{x:-.10269694064589956,y:-.15917026471049833},{x:-.10222870069759955,y:-.1578712633119983},{x:-.10176475862369955,y:-.1565712762214983},{x:-.10130512389999956,y:-.1552703024999983},{x:-.10084980600229956,y:-.15396834120849828},{x:-.10039881440639958,y:-.15266539140799829},{x:-.09995215858809957,y:-.15136145215949826},{x:-.09950984802319957,y:-.15005652252399826},{x:-.09907189218749957,y:-.14875060156249825},{x:-.09863830055679956,y:-.14744368833599825},{x:-.09820908260689958,y:-.14613578190549825},{x:-.09778424781359957,y:-.14482688133199823},{x:-.09736380565269957,y:-.1435169856764982},{x:-.09694776559999957,y:-.1422060939999982},{x:-.09653613713129958,y:-.1408942053634982},{x:-.09612892972239956,y:-.13958131882799818},{x:-.09572615284909958,y:-.13826743345449818},{x:-.09532781598719958,y:-.13695254830399817},{x:-.09493392861249958,y:-.13563666243749817},{x:-.09454450020079957,y:-.13431977491599817},{x:-.09415954022789956,y:-.13300188480049818},{x:-.09377905816959958,y:-.13168299115199816},{x:-.09340306350169958,y:-.13036309303149818},{x:-.09303156569999958,y:-.12904218949999818},{x:-.09266457424029959,y:-.12772027961849816},{x:-.09230209859839958,y:-.12639736244799815},{x:-.09194414825009957,y:-.12507343704949817},{x:-.09159073267119958,y:-.12374850248399819},{x:-.09124186133749958,y:-.12242255781249818},{x:-.09089754372479958,y:-.12109560209599818},{x:-.09055778930889957,y:-.11976763439549819},{x:-.09022260756559956,y:-.11843865377199818},{x:-.08989200797069956,y:-.11710865928649819},{x:-.08956599999999959,y:-.11577764999999829},{x:-.08956599999999959,y:-.11577764999999829},{x:-.08916166532269958,y:-.1141015840276983},{x:-.08876332646159957,y:-.11242441110159831},{x:-.08837097017289958,y:-.11074614170789834},{x:-.08798458321279957,y:-.10906678633279836},{x:-.08760415233749957,y:-.10738635546249836},{x:-.08722966430319957,y:-.10570485958319836},{x:-.08686110586609956,y:-.10402230918109837},{x:-.08649846378239957,y:-.10233871474239843},{x:-.0861417248082996,y:-.10065408675329846},{x:-.08579087569999959,y:-.09896843569999846},{x:-.08544590321369959,y:-.09728177206869845},{x:-.08510679410559958,y:-.09559410634559845},{x:-.08477353513189957,y:-.09390544901689848},{x:-.08444611304879956,y:-.09221581056879849},{x:-.08412451461249956,y:-.0905252014874985},{x:-.08380872657919955,y:-.0888336322591985},{x:-.08349873570509957,y:-.08714111337009853},{x:-.08319452874639957,y:-.08544765530639854},{x:-.08289609245929955,y:-.08375326855429854},{x:-.08260341359999955,y:-.08205796359999856},{x:-.08231647892469955,y:-.08036175092969856},{x:-.08203527518959956,y:-.07866464102959857},{x:-.08175978915089956,y:-.07696664438589859},{x:-.08149000756479956,y:-.07526777148479862},{x:-.08122591718749958,y:-.07356803281249863},{x:-.08096750477519957,y:-.07186743885519864},{x:-.08071475708409956,y:-.07016600009909864},{x:-.08046766087039958,y:-.06846372703039866},{x:-.08022620289029957,y:-.06676063013529866},{x:-.07999036989999955,y:-.06505671989999867},{x:-.07976014865569958,y:-.06335200681069868},{x:-.07953552591359955,y:-.061646501353598705},{x:-.07931648842989956,y:-.0599402140148987},{x:-.07910302296079955,y:-.0582331552807987},{x:-.07889511626249955,y:-.05652533563749871},{x:-.07869275509119955,y:-.05481676557119872},{x:-.07849592620309954,y:-.053107455568098726},{x:-.07830461635439954,y:-.05139741611439873},{x:-.07811881230129955,y:-.049686657696298736},{x:-.07793850079999953,y:-.04797519079999873},{x:-.07776366860669955,y:-.04626302591169874},{x:-.07759430247759955,y:-.04455017351759874},{x:-.07743038916889955,y:-.042836644103898744},{x:-.07727191543679954,y:-.04112244815679875},{x:-.07711886803749955,y:-.039407596162498754},{x:-.07697123372719955,y:-.03769209860719875},{x:-.07682899926209953,y:-.035975965977098755},{x:-.07669215139839955,y:-.03425920875839876},{x:-.07656067689229953,y:-.032541837437298764},{x:-.07643456249999953,y:-.03082386249999876},{x:-.07631379497769952,y:-.029105294432698766},{x:-.07619836108159952,y:-.02738614372159877},{x:-.07608824756789952,y:-.02566642085289876},{x:-.07598344119279953,y:-.023946136312798766},{x:-.07588392871249951,y:-.02222530058749876},{x:-.0757896968831995,y:-.020503924163198756},{x:-.07570073246109951,y:-.01878201752609876},{x:-.07561702220239952,y:-.017059591162398753},{x:-.07553855286329951,y:-.015336655558298754},{x:-.07546531119999951,y:-.01361322119999875},{x:-.07539728396869952,y:-.011889298573698748},{x:-.07533445792559951,y:-.010164898165598747},{x:-.07527681982689952,y:-.008440030461898743},{x:-.07522435642879952,y:-.006714705948798734},{x:-.07517705448749952,y:-.004988935112498731},{x:-.07513490075919951,y:-.0032627284391987255},{x:-.07509788200009951,y:-.0015360964150987165},{x:-.07506598496639952,y:.0001909504736012889},{x:-.0750391964142995,y:.0019184017407012956},{x:-.07501750309999951,y:.003646246900001303},{x:-.07500089177969951,y:.00537447546530131},{x:-.07498934920959952,y:.00710307695040132},{x:-.0749828621458995,y:.00883204086910133},{x:-.0749814173447995,y:.010561356735201338},{x:-.07498500156249951,y:.012291014062501347},{x:-.0749936015551995,y:.014021002364801359},{x:-.07500720407909953,y:.015751311155901372},{x:-.07502579589039951,y:.017481929949601384},{x:-.0750493637452995,y:.01921284825970139},{x:-.07507789439999951,y:.0209440556000014},{x:-.0751113746106995,y:.022675541484301412},{x:-.0751497911335995,y:.024407295426401427},{x:-.07519313072489951,y:.02613930694010145},{x:-.07524138014079951,y:.027871565539201462},{x:-.07529452613749951,y:.029604060737501478},{x:-.07535255547119951,y:.031336782048801484},{x:-.0754154548980995,y:.0330697189869015},{x:-.07548321117439952,y:.03480286106560152},{x:-.07555581105629952,y:.03653619779870154},{x:-.07563324129999952,y:.038269718700001565},{x:-.07571548866169951,y:.04000341328330158},{x:-.07580253989759951,y:.04173727106240159},{x:-.07589438176389952,y:.043471281551101616},{x:-.07599100101679952,y:.04520543426320164},{x:-.07609238441249952,y:.04693971871250166},{x:-.07619851870719953,y:.048674124412801674},{x:-.07630939065709953,y:.0504086408779017},{x:-.07642498701839952,y:.05214325762160172},{x:-.07654529454729952,y:.05387796415770175},{x:-.07667029999999952,y:.055612750000001654},{x:-.07667029999999952,y:.055612750000001654},{x:-.07680210846969952,y:.05708314936460168},{x:-.07693595411759954,y:.05855396299680169},{x:-.07707186730189955,y:.06002517220420173},{x:-.07720987838079954,y:.06149675829440175},{x:-.07735001771249954,y:.06296870257500178},{x:-.07749231565519954,y:.06444098635360178},{x:-.07763680256709955,y:.0659135909378018},{x:-.07778350880639956,y:.06738649763520185},{x:-.07793246473129956,y:.06885968775340187},{x:-.07808370069999958,y:.07033314260000188},{x:-.07823724707069958,y:.07180684348260188},{x:-.07839313420159956,y:.07328077170880191},{x:-.07855139245089958,y:.07475490858620194},{x:-.07871205217679958,y:.07622923542240194},{x:-.07887514373749958,y:.07770373352500196},{x:-.07904069749119959,y:.07917838420160196},{x:-.07920874379609959,y:.080653168759802},{x:-.07937931301039959,y:.082128068507202},{x:-.07955243549229958,y:.08360306475140203},{x:-.0797281415999996,y:.085078138800002},{x:-.0799064616916996,y:.08655327196060203},{x:-.08008742612559962,y:.08802844554080204},{x:-.08027106525989962,y:.08950364084820207},{x:-.08045740945279962,y:.09097883919040207},{x:-.08064648906249965,y:.0924540218750021},{x:-.08083833444719964,y:.0939291702096021},{x:-.08103297596509963,y:.09540426550180209},{x:-.08123044397439966,y:.09687928905920212},{x:-.08143076883329967,y:.09835422218940212},{x:-.08163398089999965,y:.09982904620000212},{x:-.08184011053269966,y:.10130374239860213},{x:-.08204918808959966,y:.10277829209280215},{x:-.08226124392889968,y:.10425267659020215},{x:-.08247630840879966,y:.10572687719840214},{x:-.08269441188749967,y:.10720087522500214},{x:-.08291558472319968,y:.10867465197760214},{x:-.0831398572740997,y:.11014818876380215},{x:-.08336725989839969,y:.11162146689120216},{x:-.0835978229542997,y:.11309446766740217},{x:-.0838315767999997,y:.11456717240000215},{x:-.08406855179369971,y:.11603956239660215},{x:-.0843087782935997,y:.11751161896480215},{x:-.08455228665789971,y:.11898332341220215},{x:-.0847991072447997,y:.12045465704640215},{x:-.08504927041249971,y:.12192560117500215},{x:-.0853028065191997,y:.12339613710560214},{x:-.08555974592309973,y:.12486624614580213},{x:-.08582011898239973,y:.12633590960320215},{x:-.08608395605529973,y:.12780510878540213},{x:-.08635128749999971,y:.1292738250000021},{x:-.08662214367469973,y:.1307420395546021},{x:-.08689655493759973,y:.1322097337568021},{x:-.08717455164689972,y:.13367688891420207},{x:-.08745616416079972,y:.13514348633440207},{x:-.08774142283749972,y:.13660950732500204},{x:-.08803035803519974,y:.13807493319360203},{x:-.08832300011209973,y:.13953974524780205},{x:-.08861937942639975,y:.14100392479520202},{x:-.08891952633629974,y:.14246745314340203},{x:-.08922347119999974,y:.14393031160000203},{x:-.08953124437569973,y:.145392481472602},{x:-.08984287622159975,y:.14685394406880198},{x:-.09015839709589976,y:.148314680696202},{x:-.09047783735679976,y:.149774672662402},{x:-.09080122736249976,y:.15123390127500197},{x:-.09112859747119977,y:.15269234784160193},{x:-.09145997804109976,y:.15414999366980195},{x:-.09179539943039977,y:.15560682006720195},{x:-.09213489199729977,y:.1570628083414019},{x:-.09247848609999976,y:.1585179398000019},{x:-.09282621209669975,y:.1599721957506019},{x:-.09317810034559978,y:.1614255575008019},{x:-.09353418120489977,y:.16287800635820185},{x:-.09389448503279976,y:.16432952363040182},{x:-.09425904218749978,y:.16578009062500182},{x:-.09462788302719977,y:.1672296886496018},{x:-.09500103791009978,y:.1686782990118018},{x:-.09537853719439979,y:.17012590301920177},{x:-.09576041123829979,y:.17157248197940175},{x:-.09614669039999979,y:.17301801720000176},{x:-.09653740503769978,y:.17446248998860173},{x:-.0969325855095998,y:.17590588165280172},{x:-.09733226217389979,y:.17734817350020168},{x:-.09773646538879979,y:.1787893468384017},{x:-.0981452255124998,y:.18022938297500168},{x:-.0985585729031998,y:.18166826321760166},{x:-.09897653791909979,y:.1831059688738016},{x:-.09939915091839979,y:.1845424812512016},{x:-.0998264422592998,y:.1859777816574016},{x:-.1002584422999998,y:.1874118514000016},{x:-.1006951813986998,y:.18884467178660155},{x:-.1011366899135998,y:.19027622412480152},{x:-.10158299820289979,y:.19170648972220153},{x:-.1020341366247998,y:.1931354498864015},{x:-.1024901355374998,y:.1945630859250015},{x:-.1029510252991998,y:.19598937914560147},{x:-.10341683626809982,y:.19741431085580147},{x:-.1038875988023998,y:.19883786236320142},{x:-.1043633432602998,y:.20026001497540138},{x:-.10484409999999977,y:.2016807500000013},{x:-.10484409999999977,y:.2016807500000013},{x:-.10512829034499978,y:.20251255364660126},{x:-.10541452131999979,y:.2033439212528012},{x:-.10570279283499981,y:.2041748478182012},{x:-.10599310479999982,y:.20500532834240115},{x:-.10628545712499982,y:.20583535782500112},{x:-.10657984971999983,y:.20666493126560112},{x:-.10687628249499985,y:.2074940436638011},{x:-.10717475535999986,y:.20832269001920106},{x:-.10747526822499989,y:.2091508653314011},{x:-.1077778209999999,y:.20997856460000103},{x:-.10808241359499988,y:.21080578282460102},{x:-.10838904591999989,y:.21163251500480096},{x:-.10869771788499989,y:.212458756140201},{x:-.10900842939999988,y:.21328450123040094},{x:-.10932118037499987,y:.21410974527500093},{x:-.10963597071999989,y:.21493448327360093},{x:-.10995280034499992,y:.21575871022580093},{x:-.1102716691599999,y:.2165824211312009},{x:-.1105925770749999,y:.21740561098940095},{x:-.11091552399999992,y:.21822827480000093},{x:-.1112405098449999,y:.2190504075626009},{x:-.11156753451999993,y:.21987200427680093},{x:-.11189659793499994,y:.22069305994220095},{x:-.11222769999999993,y:.22151356955840096},{x:-.11256084062499995,y:.222333528125001},{x:-.11289601971999996,y:.223152930641601},{x:-.11323323719499996,y:.223971772107801},{x:-.11357249295999995,y:.22479004752320103},{x:-.11391378692499997,y:.22560775188740104},{x:-.11425711899999995,y:.22642488020000104},{x:-.11460248909499995,y:.22724142746060105},{x:-.11494989711999995,y:.2280573886688011},{x:-.11529934298499996,y:.22887275882420108},{x:-.11565082659999995,y:.22968753292640107},{x:-.11600434787499994,y:.23050170597500114},{x:-.11635990671999996,y:.23131527296960114},{x:-.11671750304499996,y:.23212822890980117},{x:-.11707713675999995,y:.23294056879520117},{x:-.11743880777499995,y:.2337522876254012},{x:-.11780251599999993,y:.2345633804000012},{x:-.11816826134499994,y:.23537384211860124},{x:-.11853604371999993,y:.23618366778080127},{x:-.11890586303499992,y:.2369928523862013},{x:-.11927771919999992,y:.23780139093440128},{x:-.11965161212499995,y:.23860927842500138},{x:-.12002754171999992,y:.23941650985760138},{x:-.12040550789499993,y:.24022308023180142},{x:-.12078551055999992,y:.24102898454720142},{x:-.12116754962499991,y:.24183421780340145},{x:-.12155162499999989,y:.24263877500000142},{x:-.1219377365949999,y:.2434426511366015},{x:-.1223258843199999,y:.2442458412128015},{x:-.1227160680849999,y:.24504834022820154},{x:-.12310828779999988,y:.24585014318240156},{x:-.12350254337499987,y:.24665124507500158},{x:-.12389883471999988,y:.24745164090560162},{x:-.12429716174499987,y:.24825132567380165},{x:-.12469752435999987,y:.2490502943792017},{x:-.12509992247499988,y:.2498485420214017},{x:-.12550435599999984,y:.25064606360000175},{x:-.12591082484499985,y:.25144285411460177},{x:-.12631932891999986,y:.2522389085648018},{x:-.12672986813499987,y:.25303422195020187},{x:-.12714244239999986,y:.25382878927040187},{x:-.12755705162499986,y:.25462260552500193},{x:-.12797369571999986,y:.25541566571360197},{x:-.12839237459499983,y:.256207964835802},{x:-.12881308815999984,y:.256999497891202},{x:-.12923583632499985,y:.2577902598794021},{x:-.12966061899999984,y:.2585802458000021},{x:-.13008743609499984,y:.25936945065260214},{x:-.13051628751999986,y:.2601578694368022},{x:-.13094717318499982,y:.26094549715220217},{x:-.13138009299999984,y:.26173232879840225},{x:-.13181504687499984,y:.2625183593750023},{x:-.13225203471999986,y:.2633035838816023},{x:-.13269105644499984,y:.26408799731780236},{x:-.13313211195999985,y:.26487159468320237},{x:-.13357520117499982,y:.2656543709774024},{x:-.13402032399999986,y:.26643632120000244},{x:-.13446748034499983,y:.26721744035060246},{x:-.13491667011999983,y:.26799772342880246},{x:-.13536789323499984,y:.2687771654342025},{x:-.13582114959999986,y:.2695557613664026},{x:-.13627643912499987,y:.27033350622500263},{x:-.13673376171999985,y:.27111039500960266},{x:-.13719311729499983,y:.2718864227198026},{x:-.13765450575999985,y:.2726615843552027},{x:-.13811792702499986,y:.2734358749154028},{x:-.1385833809999999,y:.2742092894000028},{x:-.13905086759499988,y:.2749818228086028},{x:-.1395203867199999,y:.2757534701408028},{x:-.1399919382849999,y:.27652422639620283},{x:-.14046552219999991,y:.27729408657440285},{x:-.1409411383749999,y:.2780630456750029},{x:-.1414187867199999,y:.2788310986976029},{x:-.14189846714499993,y:.27959824064180294},{x:-.14238017955999993,y:.2803644665072029},{x:-.1428639238749999,y:.28112977129340294},{x:-.1433496999999999,y:.28189415000000295}],color:"primary",fill:!1},"rect1577-4":{type:"path",points:[{x:.26345180000000035,y:.2455934500000012},{x:.12298460000000011,y:.2455934500000012},{x:.12298460000000011,y:.2505664500000009},{x:.26345180000000035,y:.2505664500000009}],color:"primary",fill:!0},"rect1577-4-7":{type:"path",points:[{x:.19576130000000003,y:.31834525000000014},{x:.19576130000000003,y:.17787805000000034},{x:.1907882999999999,y:.17787805000000034},{x:.1907882999999999,y:.31834525000000014}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.012864499999999612,y:.4200086500000033},bottom1:{type:"text",text:"{VAL}",x:-.003850499999999979,y:-.42000864999999976}},refblocks:{left1:{x:-.5353954999999995,y:.016380250000000984},right1:{x:.4511331000000005,y:.016926950000001995}},bounds:{minX:-.579367741,maxX:.579367741,minY:-.42000864999999976,maxY:.4200086500000033,width:1.158735482,height:.8400173000000031,centerX:0,centerY:17763568394002505e-31},circles:{}},{paths:A9n,texts:TSn,bounds:QB,refblocks:PZe,circles:P9n}=mfe,N9n=cd({primitives:[...Object.values(A9n),...Object.values(P9n),{type:"text",text:"{REF}",x:-.2,y:.2094553499999995},{type:"text",text:"{VAL}",x:.3,y:.2094553499999995}],ports:[{...PZe.left1,labels:["1"]},{...PZe.right1,labels:["2"]}],size:{width:QB.width,height:QB.height},center:{x:QB.centerX,y:QB.centerY}}).changeTextAnchor("{VAL}","top_left").rotateRightFacingSymbol("down").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","bottom_left").build(),NZe=cd(mfe).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),D9n=cd(NZe).changeTextAnchor("{VAL}","middle_top").rotateRightFacingSymbol("left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_top").build(),{paths:L9n,texts:MSn,bounds:KB,refblocks:DZe,circles:O9n}=mfe,z9n=cd({primitives:[...Object.values(L9n),...Object.values(O9n),{type:"text",text:"{REF}",x:.1,y:-.2094553499999995},{type:"text",text:"{VAL}",x:-.2,y:-.2094553499999995}],ports:[{...DZe.left1,labels:["1"]},{...DZe.right1,labels:["2"]}],size:{width:KB.width,height:KB.height},center:{x:KB.centerX,y:KB.centerY}}).changeTextAnchor("{VAL}","top_left").rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","bottom_left").build(),U9n=cd(WB).rotateRightFacingSymbol("right").changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),{paths:k9n,texts:CSn,bounds:JB,refblocks:LZe,circles:I9n}=WB,F9n=cd({primitives:[...Object.values(k9n),...Object.values(I9n),{type:"text",text:"{REF}",x:.2,y:-.2094553499999995},{type:"text",text:"{VAL}",x:-.2,y:-.2094553499999995}],ports:[{...LZe.left1,labels:["1"]},{...LZe.right1,labels:["2"]}],size:{width:JB.width,height:JB.height},center:{x:JB.centerX,y:JB.centerY}}).changeTextAnchor("{VAL}","top_left").rotateRightFacingSymbol("up").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","bottom_left").build(),OZe={paths:{path11:{type:"path",points:[{x:-.5274831500000005,y:.02897970000000072},{x:-.30105415000000013,y:.02897970000000072}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2932119499999999,y:.02897970000000072},{x:.5339524499999997,y:.02897970000000072}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.2932119499999999,y:.2923763000000008},{x:.2932119499999999,y:-.23441689999999937}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.021208049999999812,y:.3692298999999999},bottom1:{type:"text",text:"{VAL}",x:-.00661455000000033,y:-.3692298999999999}},refblocks:{left1:{x:-.5413984499999998,y:.028126900000000177},right1:{x:.54139845,y:.029123299999999963}},bounds:{minX:-.5695568909999997,maxX:.569556891,minY:-.3692298999999999,maxY:.3692298999999999,width:1.1391137819999997,height:.7384597999999998,centerX:11102230246251565e-32,centerY:0},circles:{path1:{type:"circle",x:-.0037626500000000895,y:.03610800000000025,radius:.28854213,color:"primary",fill:!1}}},B9n=cd(OZe).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),j9n=cd(OZe).rotateRightFacingSymbol("down").changeTextAnchor("{VAL}","middle_right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),H9n={paths:{path27:{type:"path",points:[{x:.52188525,y:-.010083950000000286},{x:.1314137500000001,y:-.010083950000000286}],color:"primary",fill:!1},path29:{type:"path",points:[{x:.12501034999999971,y:.25449935000000146},{x:.12501035000000016,y:-.2746672499999985}],color:"primary",fill:!1},"path29-2":{type:"path",points:[{x:.07157854999999946,y:.253778650000001},{x:.07157854999999991,y:-.27538794999999716}],color:"primary",fill:!1},path30:{type:"path",points:[{x:-.13957305000000053,y:.25449935000000146},{x:-.1395730500000001,y:-.2746672499999985}],color:"primary",fill:!1},"path29-5":{type:"path",points:[{x:-.08349325000000052,y:.25541165000000277},{x:-.08349325000000007,y:-.27375494999999894}],color:"primary",fill:!1},"path29-2-7":{type:"path",points:[{x:.07147894999999993,y:.2552525499999998},{x:-.0829032500000002,y:.2552525499999998}],color:"primary",fill:!1},"path29-2-7-6":{type:"path",points:[{x:.07107315000000014,y:-.27817384999999817},{x:-.08330905,y:-.27817384999999817}],color:"primary",fill:!1},path43:{type:"path",points:[{x:-.21327535000000042,y:.31803495000000304},{x:.19712464999999968,y:.31807695}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.003324649999999707,y:.694594949999999},{x:.003324649999999707,y:.3310069500000008},{x:.003324649999999707,y:.3209089500000015}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:-.21327535000000042,y:.3180639499999991},{x:-.21327535000000042,y:.2498769499999991}],color:"primary",fill:!1},"path43-8-8":{type:"path",points:[{x:.19712464999999968,y:.31807695},{x:.19712464999999968,y:.24987695000000443}],color:"primary",fill:!1},"path43-9":{type:"path",points:[{x:.19226054999999942,y:-.3468980499999983},{x:-.21813945000000068,y:-.3469400500000006}],color:"primary",fill:!1},"path44-0-5":{type:"path",points:[{x:-.024339450000000262,y:-.7234580499999996},{x:-.024339450000000262,y:-.3598700499999996},{x:-.024339450000000262,y:-.34977205000000033}],color:"primary",fill:!1},"path43-8-1":{type:"path",points:[{x:.19226054999999942,y:-.3469270499999997},{x:.19226054999999942,y:-.2787400499999979}],color:"primary",fill:!1},"path43-8-8-9":{type:"path",points:[{x:-.21813955000000096,y:-.34694015},{x:-.21813955000000096,y:-.27874015000000085}],color:"primary",fill:!1},path28:{type:"path",points:[{x:-.14368304999999992,y:-.010083950000000286},{x:-.5364480500000002,y:-.010083950000000286}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"{REF}",x:-.38155925000000046,y:.09576035000000083},right1:{type:"text",text:"{VAL}",x:.3369813499999994,y:-.17868404999999754}},refblocks:{top1:{x:.0032092499999998303,y:.7114137500000002},bottom1:{x:-.02355145000000025,y:-.7114137500000002},left1:{x:-.5415391500000004,y:-.00607074999999746},right1:{x:.5415391499999997,y:-.012221549999997805}},bounds:{minX:-.5696975910000004,maxX:.5696975909999997,minY:-.7395721910000002,maxY:.7395721910000002,width:1.1393951820000001,height:1.4791443820000003,centerX:-33306690738754696e-32,centerY:0},circles:{}},zZe=cd(H9n).labelPort("top1",["2","gnd1"]).labelPort("bottom1",["4","gnd2"]).labelPort("left1",["1"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","bottom_right").changeTextAnchor("{VAL}","top_left").build(),V9n=cd(zZe).rotateRightFacingSymbol("up").changeTextAnchor("{REF}","top_right").changeTextAnchor("{VAL}","bottom_left").build(),UZe={paths:{path27:{type:"path",points:[{x:.5229378000000002,y:-.012283099999995883},{x:.13246630000000037,y:-.012283099999995883}],color:"primary",fill:!1},path28:{type:"path",points:[{x:-.14263049999999966,y:-.012283099999995883},{x:-.5353954999999999,y:-.012283099999995883}],color:"primary",fill:!1},path29:{type:"path",points:[{x:.12606289999999998,y:-.2768663999999976},{x:.12606290000000042,y:.2523002000000023}],color:"primary",fill:!1},"path29-2":{type:"path",points:[{x:.07263109999999973,y:-.27614569999999716},{x:.07263110000000017,y:.253020900000001}],color:"primary",fill:!1},path30:{type:"path",points:[{x:-.13852050000000027,y:-.2768663999999976},{x:-.13852049999999982,y:.2523002000000023}],color:"primary",fill:!1},"path29-5":{type:"path",points:[{x:-.08244070000000026,y:-.27777869999999893},{x:-.08244069999999981,y:.2513879000000028}],color:"primary",fill:!1},"path29-2-7":{type:"path",points:[{x:.07253150000000019,y:-.27761959999999597},{x:-.08185069999999994,y:-.27761959999999597}],color:"primary",fill:!1},"path29-2-7-6":{type:"path",points:[{x:.0721257000000004,y:.255806800000002},{x:-.08225649999999973,y:.255806800000002}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.012864500000000056,y:-.4150086999999978},bottom1:{type:"text",text:"{VAL}",x:-.003850500000000423,y:.4250087000000011}},refblocks:{left1:{x:-.5512093000000002,y:-.011380399999998403},right1:{x:.5512093,y:-.011926899999997076}},bounds:{minX:-.5793677410000002,maxX:.579367741,minY:-.5150086999999978,maxY:.4250087000000011,width:1.1587354820000002,height:1,centerX:-11102230246251565e-32,centerY:-.04499999999999832},circles:{}},$9n=cd(UZe).changeTextAnchor("{VAL}","middle_bottom").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_top").build(),G9n=cd(UZe).rotateRightFacingSymbol("down").changeTextAnchor("{VAL}","middle_left").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_right").build(),yfe={paths:{path11:{type:"path",points:[{x:1.9942486145,y:-1.6422072295000003},{x:2.0984258145,y:-1.6428272295000004}],color:"primary",fill:!1},"path40-0":{type:"path",points:[{x:2.1030704145000003,y:-1.4809259295000001},{x:2.1026604145,y:-1.8041042295}],color:"primary",fill:!1},"path40-0-5":{type:"path",points:[{x:2.2218770145,y:-1.4969414295},{x:2.1063461145,y:-1.5757354295000003}],color:"primary",fill:!1},"path40-0-5-0":{type:"path",points:[{x:2.2286252145,y:-1.7819395295000002},{x:2.1136540145000002,y:-1.7033263295}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:2.2273251145,y:-1.4948802295},{x:2.2284101145,y:-1.1518438295000002}],color:"primary",fill:!1},"path12-1-5-3":{type:"path",points:[{x:2.2276017145,y:-1.9567437295},{x:2.2281317145,y:-1.7888340295000003}],color:"primary",fill:!1},"arrow-2":{type:"path",points:[{x:2.1704797145,y:-1.6991380295000003},{x:2.1275815145,y:-1.7604028295000003},{x:2.1917009144999997,y:-1.7601828295000004},{x:2.1704797145,y:-1.6991380295000003}],color:"primary",fill:!0},path1:{type:"path",points:[{x:1.5978828145000001,y:-1.5020091295000002},{x:1.8597023145000002,y:-1.5035561295000002}],color:"primary",fill:!1},path2:{type:"path",points:[{x:1.8686937145000002,y:-1.3411936295000002},{x:1.8682837145,y:-1.6643719295000001}],color:"primary",fill:!1},path3:{type:"path",points:[{x:1.9875004145000004,y:-1.3572092295000002},{x:1.8719693145,y:-1.4360031295000002}],color:"primary",fill:!1},path4:{type:"path",points:[{x:1.9942486145,y:-1.6422072295000003},{x:1.8792773145000001,y:-1.5635940295000004}],color:"primary",fill:!1},"arrow-1":{type:"path",points:[{x:1.9361028144999999,y:-1.5594057295000003},{x:1.8932048145,y:-1.6206705295000003},{x:1.9573242144999998,y:-1.6204505295000005},{x:1.9361028144999999,y:-1.5594057295000003}],color:"primary",fill:!0},path9:{type:"path",points:[{x:1.9943087144999998,y:-1.3539494295000003},{x:2.2269582145,y:-1.3556534295000002}],color:"primary",fill:!1}},texts:{bottom1:{type:"text",text:"{VAL}",x:1.8805772145,y:-1.9423669295000003},right1:{type:"text",text:"{REF}",x:1.8845380145,y:-1.1387692295000003}},refblocks:{right1:{x:2.2278617145000004,y:-1.9651412295000004},right2:{x:1.5977076145000002,y:-1.5027827295000002},right3:{x:2.2278680145,y:-1.1403971295000002}},bounds:{minX:1.5810976555000003,maxX:2.3461148445,minY:-1.9817511885000003,maxY:-1.1237871705000002,width:.7650171889999999,height:.8579640180000001,centerX:1.9636062500000002,centerY:-1.5527691795000003},circles:{"path1-0":{type:"circle",x:2.0463372145000003,y:-1.5363384295000002,radius:.29977763,color:"primary",fill:!1}}},q9n=cd(yfe).changeTextAnchor("{VAL}","middle_top").labelPort("right2",["1"]).labelPort("right3",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build();yfe.bounds.width+=.3;var Y9n=cd(yfe).rotateRightFacingSymbol("down").changeTextAnchor("{VAL}","middle_right").labelPort("right2",["1"]).labelPort("right3",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_left").build(),X9n={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1},path2:{type:"path",points:[{x:-.12447409999999959,y:.0852510999999998},{x:.11626639999999999,y:.0852510999999998}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"A",x:0,y:-.1}},refblocks:{left1:{x:-.5446330999999993,y:0},right1:{x:.5381638000000004,y:0}},bounds:{width:1.0614356000000003,height:1,centerX:5551115123125783e-32,centerY:-11102230246251565e-32},circles:{path1:{type:"circle",x:0,y:0,radius:.28854213,color:"primary",fill:!1}}},{paths:W9n,texts:Z9n,bounds:ej,refblocks:kZe,circles:Q9n}=X9n,vfe=Wm({primitives:[...Object.values(W9n),...Object.values(Q9n),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"},{...Z9n.left1,x:0,y:.01,anchor:"center",fontSize:.3}],ports:[{...kZe.left1,labels:["1"]},{...kZe.right1,labels:["2"]}],size:{width:ej.width,height:ej.height},center:{x:ej.centerX,y:ej.centerY}});function K9n(n){return typeof n=="object"&&n!==null&&n.type==="path"&&Array.isArray(n.points)&&typeof n.color=="string"}function J9n(n){return typeof n=="object"&&n!==null&&n.type==="text"&&typeof n.text=="string"&&typeof n.x=="number"&&typeof n.y=="number"&&typeof n.anchor=="string"}var{6:gfe,2:_fe,...e1n}=vfe.primitives;K9n(_fe)&&_fe.points.map(n=>{n.y+=.05}),J9n(gfe)&&(gfe.y+=.025);function t1n(n){return typeof n=="object"}var IZe=Pl({...vfe,primitives:Object.values(e1n).filter(t1n)}),n1n={...IZe,primitives:[...IZe.primitives,gfe,_fe]},r1n={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:.09442299999999992,y:-.13438304999999984},{x:-.004364400000000712,y:.05710404999999996},{x:-.1110211000000012,y:-.13438304999999984}],color:"primary",fill:!1},path2:{type:"path",points:[{x:-.12447409999999959,y:.13438304999999984},{x:.11626639999999999,y:.13438304999999984}],color:"primary",fill:!1}},refblocks:{left1:{x:-.5446330999999993,y:0},right1:{x:.5381638000000004,y:0}},bounds:{width:1.0614356000000003,height:1,centerX:0,centerY:0},circles:{path1:{type:"circle",x:0,y:0,radius:.28854213,color:"primary",fill:!1}}},{paths:i1n,bounds:tj,refblocks:FZe,circles:a1n}=r1n,xfe=Wm({primitives:[...Object.values(i1n),...Object.values(a1n),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"}],ports:[{...FZe.left1,labels:["1"]},{...FZe.right1,labels:["2"]}],size:{width:tj.width,height:tj.height},center:{x:tj.centerX,y:tj.centerY}}),{2:o1n,3:s1n,...l1n}=xfe.primitives;function c1n(n){return typeof n=="object"}var BZe=Pl({...xfe,primitives:Object.values(l1n).filter(c1n)}),u1n={...BZe,primitives:[...BZe.primitives,o1n,s1n]},f1n={paths:{path11:{type:"path",points:[{x:-.5176700499999997,y:.041745050000000505},{x:-.10888805000000024,y:.041745050000000505}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.1031184499999993,y:.041745050000000505},{x:.5246894499999994,y:.041745050000000505}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-.09343985000000021,y:-.14620634999999882},{x:-.0930998500000002,y:.2583405500000009}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:.08519034999999908,y:-.14503384999999902},{x:.08553034999999909,y:.2595130500000007}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-.08315755000000014,y:.055934450000000524},{x:-.08415755000000047,y:-.14678124999999964},{x:.08653524999999984,y:-.05104664999999953},{x:-.08126175000000035,y:.05647715000000031}],color:"primary",fill:!0},"path11-0-9-0":{type:"path",points:[{x:.07661224999999927,y:.256654450000001},{x:.07761224999999983,y:.05393885000000109},{x:-.0930805500000007,y:.1496734500000012},{x:.07471644999999949,y:.25719715000000143}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.0316381500000007,y:.41683614999999996},bottom1:{type:"text",text:"{VAL}",x:-.03022294999999975,y:-.41683614999999996}},refblocks:{left1:{x:-.54139845,y:.04089205000000051},right1:{x:.5413984499999995,y:.04188845000000008}},bounds:{minX:-.569556891,maxX:.5695568909999995,minY:-.41683614999999996,maxY:.41683614999999996,width:1.1391137819999995,height:.8336722999999999,centerX:-2220446049250313e-31,centerY:0},circles:{path1:{type:"circle",x:-.0037626500000003116,y:.048873150000000365,radius:.28854213,color:"primary",fill:!1}}},jZe=cd(f1n).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),HZe=Pl(jZe),VZe=HZe.primitives.filter(n=>n.type==="text"),d1n=VZe.find(n=>n.text==="{REF}"),p1n=VZe.find(n=>n.text==="{VAL}");d1n.y=0,p1n.y=0;var h1n=HZe,m1n={paths:{path40:{type:"path",points:[{x:.14458890000000002,y:.04403629999999836},{x:-.1199943999999995,y:-.08825540000000132}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.1199943999999995,y:.1763280000000016},{x:.14458890000000002,y:.04403629999999836}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.1199943999999995,y:-.08825539999999776},{x:-.1199943999999995,y:.1763280000000016}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.14458890000000002,y:.1763280000000016},{x:.14458890000000002,y:-.08825539999999776}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.12219909999999956,y:.04403629999999836},{x:-.5168693999999996,y:.04403629999999836}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.5233797,y:.04395110000000102},{x:.14967160000000002,y:.04395110000000102}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999996715,y:.27384529999999785},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999999524,y:-.2738453000000014}},refblocks:{left1:{x:-.5191471000000001,y:.0449206999999987},right1:{x:.5191471000000001,y:.043896100000001326}},bounds:{minX:-.5473055410000001,maxX:.5473055410000001,minY:-.2738453000000014,maxY:.27384529999999785,width:1.0946110820000001,height:.5476905999999993,centerX:0,centerY:-17763568394002505e-31},circles:{}},nj=cd(m1n).labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),y1n=Pl(nj,"down"),v1n=Pl(nj,"left"),g1n=Pl(nj,"up"),_1n={paths:{path1:{type:"path",points:[{x:-.3543580999999998,y:.22373490000000018},{x:-.1279290999999998,y:.22373490000000018}],color:"primary",fill:!1},"path-1-2":{type:"path",points:[{x:-.07134165999999999,y:.215546000000001},{x:.1083980000000001,y:.16078}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.10434800000000011,y:.127178},{x:.345089,y:.127178}],color:"primary",fill:!1},path3:{type:"path",points:[{x:.12008600000000014,y:.36383770000000015},{x:.360827,y:.36383770000000015}],color:"primary",fill:!1},path4:{type:"path",points:[{x:-.3543580999999998,y:-.17811849999999985},{x:-.1279290999999998,y:-.17811849999999985}],color:"primary",fill:!1},"path4-5":{type:"path",points:[{x:-.07134165999999999,y:-.1867987999999997},{x:.10434800000000011,y:-.2376754}],color:"primary",fill:!1},path5:{type:"path",points:[{x:.10434800000000011,y:-.2746754},{x:.345089,y:-.2746754}],color:"primary",fill:!1},path6:{type:"path",points:[{x:.12008600000000014,y:-.038015699999999875},{x:.360827,y:-.038015699999999875}],color:"primary",fill:!1},"path1-4-join":{type:"path",points:[{x:-.001896399999999815,y:-.19827304999999998},{x:-.001896399999999815,y:.190981}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:.5644774000000002},bottom1:{type:"text",text:"{VAL}",x:0,y:-.4244773999999998}},refblocks:{left1:{x:-.3682734999999999,y:.22373490000000018},left2:{x:-.3682734999999999,y:-.17811849999999985},right1:{x:.36827350000000014,y:.36383770000000015},right2:{x:.36827350000000014,y:.12717810000000007},right3:{x:.36827350000000014,y:-.038015699999999875},right5:{x:.36827350000000014,y:-.2746754}},bounds:{minX:-.3964319409999999,maxX:.3964319410000001,minY:-.4744773999999998,maxY:.5644774000000002,width:1,height:1.0389548,centerX:-11102230246251565e-32,centerY:.045000000000000207},circles:{"circle-2":{type:"circle",x:.08200307499999998,y:.127178,radius:.023193523,color:"primary",fill:!1},"circle-5":{type:"circle",x:.08200307499999998,y:-.2745079499999997,radius:.023193523,color:"primary",fill:!1},"circle-3":{type:"circle",x:.08200307499999998,y:.369178,radius:.023193523,color:"primary",fill:!1},"circle-6":{type:"circle",x:.08200307499999998,y:-.03805079499999997,radius:.023193523,color:"primary",fill:!1},"circle-1":{type:"circle",x:-.10003074999999978,y:.219178,radius:.023193523,color:"primary",fill:!1},"circle-4":{type:"circle",x:-.10003074999999978,y:-.18250794999999972,radius:.023193523,color:"primary",fill:!1}}},rj=cd(_1n).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(),bfe=Pl(rj,"down"),Sfe=bfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),wfe=bfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Sfe.anchor="middle_bottom",wfe.anchor="middle_top",Sfe.x=0,Sfe.y+=.537,wfe.y-=.5375,wfe.x=0;var x1n=bfe,Efe=Pl(rj,"left"),Tfe=Efe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Mfe=Efe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Tfe.anchor="middle_bottom",Mfe.anchor="middle_top",Tfe.x=0,Tfe.y+=1,Mfe.y-=1,Mfe.x=0;var b1n=Efe,Cfe=Pl(rj,"up"),Rfe=Cfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Afe=Cfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Rfe.anchor="middle_bottom",Afe.anchor="middle_top",Rfe.x=0,Rfe.y+=.537,Afe.y-=.5375,Afe.x=0;var S1n=Cfe,w1n={paths:{path1:{type:"path",points:[{x:-.3543580999999998,y:.22373490000000018},{x:-.1279290999999998,y:.22373490000000018}],color:"primary",fill:!1},"path-1-3":{type:"path",points:[{x:-.0741659999999987,y:.2290546000000001},{x:.1091012,y:.334}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.10434800000000011,y:.127178},{x:.345089,y:.127178}],color:"primary",fill:!1},path3:{type:"path",points:[{x:.12008600000000014,y:.36383770000000015},{x:.360827,y:.36383770000000015}],color:"primary",fill:!1},path4:{type:"path",points:[{x:-.3543580999999998,y:-.17811849999999985},{x:-.1279290999999998,y:-.17811849999999985}],color:"primary",fill:!1},"path4-6":{type:"path",points:[{x:-.0741659999999987,y:-.1777987999999997},{x:.1091012,y:-.07370029999999998}],color:"primary",fill:!1},path5:{type:"path",points:[{x:.10434800000000011,y:-.2746754},{x:.345089,y:-.2746754}],color:"primary",fill:!1},path6:{type:"path",points:[{x:.12008600000000014,y:-.038015699999999875},{x:.360827,y:-.038015699999999875}],color:"primary",fill:!1},"path1-4-join":{type:"path",points:[{x:-.000896399999999815,y:-.12190304999999999},{x:-.000896399999999815,y:.2708100000000002}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:.6144774000000003},bottom1:{type:"text",text:"{VAL}",x:0,y:-.5244773999999998}},refblocks:{left1:{x:-.3682734999999999,y:.22373490000000018},left2:{x:-.3682734999999999,y:-.17811849999999985},right1:{x:.36827350000000014,y:.36383770000000015},right2:{x:.36827350000000014,y:.12717810000000007},right3:{x:.36827350000000014,y:-.038015699999999875},right5:{x:.36827350000000014,y:-.2746754}},bounds:{minX:-.3964319409999999,maxX:.3964319410000001,minY:-.4744773999999998,maxY:.5644774000000002,width:1,height:1.0389548,centerX:-11102230246251565e-32,centerY:.045000000000000207},circles:{"circle-2":{type:"circle",x:.08200307499999998,y:.127178,radius:.023193523,color:"primary",fill:!1},"circle-5":{type:"circle",x:.08200307499999998,y:-.2745079499999997,radius:.023193523,color:"primary",fill:!1},"circle-3":{type:"circle",x:.08200307499999998,y:.369178,radius:.023193523,color:"primary",fill:!1},"circle-6":{type:"circle",x:.08200307499999998,y:-.03805079499999997,radius:.023193523,color:"primary",fill:!1},"circle-1":{type:"circle",x:-.10003074999999978,y:.219178,radius:.023193523,color:"primary",fill:!1},"circle-4":{type:"circle",x:-.10003074999999978,y:-.18250794999999972,radius:.023193523,color:"primary",fill:!1}}},ij=cd(w1n).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(),Pfe=Pl(ij,"down"),Nfe=Pfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Dfe=Pfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Nfe.anchor="middle_bottom",Dfe.anchor="middle_top",Nfe.x=0,Nfe.y+=.565,Dfe.y-=.555,Dfe.x=0;var E1n=Pfe,Lfe=Pl(ij,"left"),Ofe=Lfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),zfe=Lfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Ofe.anchor="middle_bottom",zfe.anchor="middle_top",Ofe.x=0,Ofe.y+=1.09,zfe.y-=1.09,zfe.x=0;var T1n=Lfe,Ufe=Pl(ij,"up"),kfe=Ufe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Ife=Ufe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");kfe.anchor="middle_bottom",Ife.anchor="middle_top",kfe.x=0,kfe.y+=.565,Ife.y-=.555,Ife.x=0;var M1n=Ufe,C1n={paths:{path11:{type:"path",points:[{x:-.3622268000000006,y:.06287995000000057},{x:-.1357978000000004,y:.06287995000000057}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-.08700995000000007,y:.06634945000000092},{x:.11099564000000006,y:.1105995000000057}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.12795640000000064,y:.06287995000000057},{x:.36869780000000096,y:.06287995000000057}],color:"primary",fill:!1},"path11-5":{type:"path",points:[{x:-.3622270999999999,y:-.16866424999999907},{x:-.1357980999999997,y:-.16866424999999907}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:-.08700995000000007,y:-.17019474999999962},{x:.11099564000000006,y:-.12466424999999907}],color:"primary",fill:!1},"path12-0":{type:"path",points:[{x:.12795610000000002,y:-.16866424999999907},{x:.3686968000000006,y:-.16866424999999907}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:.30716265000000004},bottom1:{type:"text",text:"{VAL}",x:0,y:-.30716265000000004}},refblocks:{left1:{x:-.37614279999999956,y:-.16951715000000012},left3:{x:-.37614279999999956,y:.06202735000000037},right1:{x:.37614279999999933,y:-.16852074999999966},right3:{x:.37614279999999933,y:.06302374999999993}},bounds:{minX:-.40430124099999953,maxX:.4043012409999993,minY:-.39716264999999984,maxY:.39716265000000006,width:.8086024819999988,height:.7943252999999999,centerX:-11102230246251565e-32,centerY:11102230246251565e-32},circles:{"circle-4":{type:"circle",x:.09900307499999998,y:.06478,radius:.023193523,color:"primary",fill:!1},"circle-2":{type:"circle",x:.09900307499999998,y:-.16978,radius:.023193523,color:"primary",fill:!1},"circle-3":{type:"circle",x:-.11003074999999977,y:.06478,radius:.023193523,color:"primary",fill:!1},"circle-1":{type:"circle",x:-.11003074999999977,y:-.16978,radius:.023193523,color:"primary",fill:!1}}},aj=cd(C1n).labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("right3",["4"]).labelPort("left3",["3"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),Ffe=Pl(aj,"down"),Bfe=Ffe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),jfe=Ffe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Bfe.anchor="middle_bottom",jfe.anchor="middle_top",Bfe.x=.4,Bfe.y+=.265,jfe.y-=.265,jfe.x=.4;var R1n=Ffe,Hfe=Pl(aj,"left"),Vfe=Hfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),$fe=Hfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Vfe.anchor="middle_bottom",$fe.anchor="middle_top",Vfe.x=0,Vfe.y+=.67,$fe.y-=.67,$fe.x=0;var A1n=Hfe,Gfe=Pl(aj,"up"),qfe=Gfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Yfe=Gfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");qfe.anchor="middle_bottom",Yfe.anchor="middle_top",qfe.x=.46,qfe.y+=.265,Yfe.y-=.265,Yfe.x=.46;var P1n=Gfe,N1n={paths:{path11:{type:"path",points:[{x:-.3622268000000006,y:.06287995000000057},{x:-.1357978000000004,y:.06287995000000057}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-.08500995000000007,y:.06934945000000092},{x:.10307889999999986,y:.2010388500000011}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.12795640000000064,y:.06287995000000057},{x:.36869780000000096,y:.06287995000000057}],color:"primary",fill:!1},"path11-5":{type:"path",points:[{x:-.3622270999999999,y:-.16866424999999907},{x:-.1357980999999997,y:-.16866424999999907}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:-.08500995000000007,y:-.16201947499999997},{x:.10307860000000058,y:-.03050534999999921}],color:"primary",fill:!1},"path12-0":{type:"path",points:[{x:.12795610000000002,y:-.16866424999999907},{x:.3686968000000006,y:-.16866424999999907}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:.4171626500000001},bottom1:{type:"text",text:"{VAL}",x:0,y:-.41716264999999986}},refblocks:{left1:{x:-.37614279999999956,y:-.16951715000000012},left3:{x:-.37614279999999956,y:.06202735000000037},right1:{x:.37614279999999933,y:-.16852074999999966},right3:{x:.37614279999999933,y:.06302374999999993}},bounds:{minX:-.40430124099999953,maxX:.4043012409999993,minY:-.39716264999999984,maxY:.39716265000000006,width:.8086024819999988,height:.7943252999999999,centerX:-11102230246251565e-32,centerY:11102230246251565e-32},circles:{"circle-4":{type:"circle",x:.09900307499999998,y:.06478,radius:.023193523,color:"primary",fill:!1},"circle-2":{type:"circle",x:.09900307499999998,y:-.16978,radius:.023193523,color:"primary",fill:!1},"circle-3":{type:"circle",x:-.11003074999999977,y:.06478,radius:.023193523,color:"primary",fill:!1},"circle-1":{type:"circle",x:-.11003074999999977,y:-.16978,radius:.023193523,color:"primary",fill:!1}}},oj=cd(N1n).labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("right3",["4"]).labelPort("left3",["3"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),Xfe=Pl(oj,"down"),Wfe=Xfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Zfe=Xfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Wfe.anchor="middle_bottom",Zfe.anchor="middle_top",Wfe.x=.4,Wfe.y+=.295,Zfe.y-=.295,Zfe.x=.42;var D1n=Xfe,Qfe=Pl(oj,"left"),Kfe=Qfe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Jfe=Qfe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Kfe.anchor="middle_bottom",Jfe.anchor="middle_top",Kfe.x=0,Kfe.y+=.795,Jfe.y-=.795,Jfe.x=0;var L1n=Qfe,ede=Pl(oj,"up"),tde=ede.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),nde=ede.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");tde.anchor="middle_bottom",nde.anchor="middle_top",tde.x=.46,tde.y+=.315,nde.y-=.315,nde.x=.46;var O1n=ede,z1n={paths:{path11:{type:"path",points:[{x:-.541495829500001,y:.044368009536419395},{x:-.21998262950000114,y:.044368009536419395}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.14450697049999905,y:.052237309536419474},{x:.46379767049999976,y:.052237309536419474}],color:"primary",fill:!1},"path12-6":{type:"path",points:[{x:.13965347050000032,y:-.14937819046358025},{x:.13854747050000027,y:.2538388095364199}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-.212703829500001,y:.2732984095364195},{x:-.2147708295000006,y:-.1493854904635803},{x:.13782137049999887,y:.050231709536419755},{x:-.2087893295000005,y:.27442980953642016}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.08906882950000083,y:.38011220953641867},bottom1:{type:"text",text:"{VAL}",x:-.0685314901614209,y:-.38011220953641844},right1:{type:"text",text:"",x:.5884896704999998,y:-.3288545904635811}},refblocks:{left1:{x:-.5603312294999999,y:.04351520953641885},right1:{x:.47524967049999955,y:.05238090953641872}},bounds:{minX:-.5884896704999999,maxX:.5884896704999998,minY:-.38011220953641844,maxY:.38011220953641867,width:1.1769793409999996,height:.7602244190728371,centerX:-5551115123125783e-32,centerY:11102230246251565e-32},circles:{}},$Ze=cd(z1n).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),U1n=Pl($Ze),k1n={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"Hz",x:0,y:-.035}},refblocks:{left1:{x:-.5446330999999993,y:.000852800000000542},right1:{x:.5381638000000004,y:-.00014359999999924433}},bounds:{width:1.0614356000000003,height:1,centerX:5551115123125783e-32,centerY:0},circles:{path1:{type:"circle",x:-.006997299999999651,y:-.007128299999999532,radius:.28854213,color:"primary",fill:!1}}},{paths:I1n,texts:F1n,bounds:sj,refblocks:GZe,circles:B1n}=k1n,rde=Wm({primitives:[...Object.values(I1n),...Object.values(B1n),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"},{...F1n.left1,x:0,y:.01,anchor:"center",fontSize:.2}],ports:[{...GZe.left1,labels:["1"]},{...GZe.right1,labels:["2"]}],size:{width:sj.width,height:sj.height},center:{x:sj.centerX,y:sj.centerY}}),{5:j1n,...H1n}=rde.primitives;function V1n(n){return typeof n=="object"}var qZe=Pl({...rde,primitives:Object.values(H1n).filter(V1n)}),$1n={...qZe,primitives:[...qZe.primitives,j1n]},G1n={paths:{path10:{type:"path",points:[{x:-.5283037500000001,y:.036413650000000075},{x:.5300302500000003,y:.036413650000000075}],color:"primary",fill:!1},path14:{type:"path",points:[{x:.0008652499999994845,y:.16870534999999975},{x:.2654482499999995,y:.16870534999999975},{x:.2654482499999995,y:-.0958780499999996},{x:-.2637187499999998,y:-.0958780499999996},{x:-.2637187499999998,y:.16870534999999975},{x:.0008652499999994845,y:.16870534999999975}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.008263949999999909,y:.23591724999999997}},refblocks:{left1:{x:-.5345548500000001,y:.03946054999999937},right1:{x:.5345548500000001,y:.0352561499999986}},bounds:{width:1.1254265820000002,height:.47183449999999993,centerX:0,centerY:0}},{paths:q1n,texts:Y1n,bounds:lj,refblocks:YZe}=G1n,XZe=Wm({primitives:[...Object.values(q1n),{...Y1n.top1,anchor:"middle_bottom"},{type:"text",text:"{VAL}",x:0,y:-.2,anchor:"middle_top"}],ports:[{...YZe.left1,labels:["1"]},{...YZe.right1,labels:["2"]}],size:{width:lj.width,height:lj.height},center:{x:lj.centerX,y:lj.centerY}}),X1n=Pl(XZe),W1n={paths:{path1:{type:"path",points:[{x:-.33997010000000016,y:.4545300000000001},{x:-.03997010000000012,y:.4545300000000001}],color:"primary",fill:!1},path2:{type:"path",points:[{x:-.02032289999999981,y:.25053000000000014},{x:-.020322900000000033,y:.65053}],color:"primary",fill:!1},path3:{type:"path",points:[{x:.050000000000000044,y:.3005300000000002},{x:.050000000000000044,y:.60053}],color:"primary",fill:!1},path4:{type:"path",points:[{x:.1499999999999997,y:.40053000000000005},{x:.1499999999999997,y:.5005300000000001}],color:"primary",fill:!1}},refblocks:{top1:{x:-.33997010000000016,y:.4545300000000001}},circles:{}},{paths:Z1n,circles:Q1n,refblocks:K1n}=W1n,J1n=Wm({primitives:[...Object.values(Z1n),...Object.values(Q1n),{type:"text",text:"{REF}",x:-.1,y:.8,anchor:"middle_bottom"},{type:"text",text:"{VAL}",x:-.1,y:.1,anchor:"middle_top"}],ports:[{...K1n.top1,labels:["1"]}],size:{width:1,height:1},center:{x:0,y:.4}}),WZe=J1n,eyn=cd(WZe).rotateRightFacingSymbol("down").build(),ide={paths:{path11:{type:"path",points:[{x:-.49895505000000084,y:.035186950000000605},{x:-.177441850000001,y:.035186950000000605}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.18704774999999918,y:.043056250000000684},{x:.5063384499999999,y:.043056250000000684}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-.3067105499999998,y:.19836805000000046},{x:-.3084575500000002,y:-.10569684999999973},{x:-.01040014999999972,y:.03790115000000038},{x:-.3034011499999991,y:.1991819500000005}],color:"primary",fill:!0},"path11-0-9-5":{type:"path",points:[{x:.3324594500000002,y:.19920585000000046},{x:.33420945000000013,y:-.10485904999999973},{x:.03615254999999973,y:.03873895000000038},{x:.32915344999999974,y:.2000197500000005}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:.042716749999999415,y:.3158462499999999},bottom1:{type:"text",text:"{VAL}",x:.035355149999999336,y:-.3158462499999999}},refblocks:{left1:{x:-.5177904499999998,y:.03433415000000006},right1:{x:.5177904499999997,y:.04319984999999993}},bounds:{minX:-.5459488909999998,maxX:.5459488909999997,minY:-.3158462499999999,maxY:.3158462499999999,width:1.0918977819999993,height:.6316924999999998,centerX:-5551115123125783e-32,centerY:0},circles:{}},{paths:RSn,texts:ASn,bounds:PSn,refblocks:NSn,circles:DSn}=ide,tyn=cd(ide).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),nyn=cd(ide).rotateRightFacingSymbol("down").changeTextAnchor("{VAL}","middle_right").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_left").build(),ryn={paths:{path45:{type:"path",points:[{x:.13585750000000063,y:-.003696399999999045},{x:-.12872579999999934,y:-.13598810000000228}],color:"primary",fill:!1},"path1-8":{type:"path",points:[{x:.12763670000000094,y:-.003920199999999596},{x:.3,y:-.003920199999999596}],color:"primary",fill:!1},path46:{type:"path",points:[{x:-.12872579999999934,y:.12859530000000063},{x:.13585750000000063,y:-.003696399999999045}],color:"primary",fill:!1},path47:{type:"path",points:[{x:-.12872579999999934,y:-.13598810000000228},{x:-.12872579999999934,y:.12859530000000063}],color:"primary",fill:!1},path48:{type:"path",points:[{x:.13585750000000063,y:.12859530000000063},{x:.13585750000000063,y:-.13598810000000228}],color:"primary",fill:!1},path49:{type:"path",points:[{x:-.13076959999999938,y:-.003696399999999045},{x:-.3,y:-.003696399999999045}],color:"primary",fill:!1},path25:{type:"path",points:[{x:-.1557438999999996,y:.28545279999999806},{x:-.2530861999999994,y:.3023319999999998},{x:-.21878339999999952,y:.20956920000000068}],color:"primary",fill:!0},path78:{type:"path",points:[{x:-.08000449999999937,y:.16590799999999817},{x:-.09202799999999911,y:.1748410000000007},{x:-.2137844999999996,y:.26529680000000155},{x:-.2144144999999993,y:.2662468000000011}],color:"primary",fill:!1},"path25-0":{type:"path",points:[{x:.021722400000000697,y:.30658939999999646},{x:-.07561989999999952,y:.3234685999999982},{x:-.04131709999999922,y:.23070579999999907}],color:"primary",fill:!0},"path78-6":{type:"path",points:[{x:.09746180000000093,y:.18704459999999656},{x:.08543830000000074,y:.19597759999999909},{x:-.0363181999999993,y:.28643339999999995},{x:-.03694819999999943,y:.2873833999999995}],color:"primary",fill:!1},box:{type:"path",points:[{x:-.3,y:-.4},{x:.3,y:-.4},{x:.3,y:.4},{x:-.3,y:.4},{x:-.3,y:-.4},{x:-.3,y:.4}],color:"primary",fill:!1},"path48-1":{type:"path",points:[{x:-.3,y:.1333},{x:-.5362092999999997,y:.1333}],color:"primary",fill:!1},"path48-2":{type:"path",points:[{x:-.3,y:-.1333},{x:-.5362092999999997,y:-.1333}],color:"primary",fill:!1},"path48-3":{type:"path",points:[{x:.3,y:-.1333},{x:.5362093000000003,y:-.1333}],color:"primary",fill:!1},"path48-4":{type:"path",points:[{x:.3,y:.1333},{x:.5362093000000003,y:.1333}],color:"primary",fill:!1}},texts:{bottom1:{type:"text",text:"{VAL}",x:0,y:-.43222},right1:{type:"text",text:"{REF}",x:0,y:.43222}},refblocks:{left1:{x:-.5362092999999997,y:.1333},left2:{x:-.5362092999999997,y:-.1333},right1:{x:.5362093000000003,y:-.1333},right2:{x:.5362093000000003,y:.1333}},bounds:{minX:-.5643677409999996,maxX:.5643677410000003,minY:-.3234685999999982,maxY:.3234685999999982,width:1.128735482,height:.6469371999999964,centerX:33306690738754696e-32,centerY:0},circles:{}},cj=cd(ryn).labelPort("left1",["1","DIN"]).labelPort("left2",["2","POWER"]).labelPort("right1",["4","GND"]).labelPort("right2",["3","DOUT"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),iyn=Pl(cj,"down"),ayn=hfe(cj),ade=Pl(cj,"up"),oyn={...ade,primitives:ade.primitives.map(n=>n.type==="path"&&(n.points.length===3||n.points.length===4)?{...n,points:n.points.map(e=>({x:e.x,y:-e.y+2*ade.center.y}))}:n)},syn=oyn,lyn={paths:{path11:{type:"path",points:[{x:-.3850944445000005,y:.0010025000000009054},{x:-.006525044499999799,y:-.0016204999999989145}],color:"primary",fill:!1},path40:{type:"path",points:[{x:.07415065550000066,y:.19027400000000116},{x:.07322065550000101,y:-.17787549999999852}],color:"primary",fill:!1},path42:{type:"path",points:[{x:.01002445549999953,y:-.12022799999999911},{x:.01002445549999953,y:.1443554000000009}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.28374995550000004,y:-.2462579999999992},{x:.2831499554999999,y:-.5425888999999995}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:.28423665550000043,y:.5370061000000012},{x:.2836366555000003,y:.2678117000000011}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.1731829554999995,y:-.2153930999999989},{x:.2780310554999992,y:-.23045039999999894},{x:.2324710554999987,y:-.14155709999999888}],color:"primary",fill:!0},path17:{type:"path",points:[{x:.07704605550000054,y:-.08544359999999895},{x:.2325688555000005,y:-.19774119999999895}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.07425025549999931,y:.11255990000000127},{x:.28369465549999884,y:.2606293000000013}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.006566644499999885,y:.35624680000000075},bottom1:{type:"text",text:"{VAL}",x:.020614555499999687,y:-.4202180999999998}},refblocks:{top1:{x:.2843894554999997,y:.5566011000000001},bottom1:{x:.2823318555000005,y:-.5566010999999997},left1:{x:-.3990097444999998,y:.00014970000000036343}},bounds:{minX:-.4271681854999998,maxX:.42716818549999985,minY:-.5847595409999997,maxY:.584759541,width:.8543363709999996,height:1.1695190819999999,centerX:27755575615628914e-33,centerY:16653345369377348e-32},circles:{path1:{type:"circle",x:.13862605549999985,y:.008130800000000438,radius:.28854213,color:"primary",fill:!1}}},ZZe=cd(lyn).changeTextAnchor("{VAL}","middle_right").labelPort("left1",["3"]).labelPort("top1",["2"]).labelPort("bottom1",["1"]).changeTextAnchor("{REF}","middle_right").build(),ode=Pl(ZZe),sde=ode.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),QZe=ode.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");sde.anchor="middle_left",QZe.anchor="middle_right",sde.x=.45,sde.y+=.065,QZe.y+=.065;var cyn=ode,uyn={paths:{"path12-1-8-6-9":{type:"path",points:[{x:.023137150000000162,y:-.022408499999999165},{x:.023137150000000162,y:-.10240850000000101}],color:"primary",fill:!1},"path12-1-5-6":{type:"path",points:[{x:-.48740694999999956,y:-.18547949999999958},{x:-.1731006500000003,y:-.18547949999999958}],color:"primary",fill:!1},"path12-1-5-6-8":{type:"path",points:[{x:.023792949999999813,y:.17183650000000128},{x:.023792949999999813,y:.10518850000000057}],color:"primary",fill:!1},"path12-1-8-0":{type:"path",points:[{x:-.14922445000000018,y:-.032671500000001075},{x:.19549865000000022,y:-.18509050000000116}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:.19549885000000078,y:-.18509050000000116},{x:.4881437499999999,y:-.18509050000000116}],color:"primary",fill:!1},"path12-1-8-6-9-4":{type:"path",points:[{x:.023137150000000162,y:.11939749999999982},{x:.023137150000000162,y:.017597499999999044}],color:"primary",fill:!1},"path12-1-8-6-9-4-3":{type:"path",points:[{x:.08312335000000015,y:.10724749999999972},{x:.08312335000000015,y:.050463500000001105}],color:"primary",fill:!1},"path12-1-8-6-9-4-3-1":{type:"path",points:[{x:-.03684904999999983,y:.10724749999999972},{x:-.03684904999999983,y:.050463500000001105}],color:"primary",fill:!1},"path12-1-8-6-9-4-4":{type:"path",points:[{x:.08312335000000015,y:.10724749999999972},{x:-.03684904999999983,y:.10724749999999972}],color:"primary",fill:!1},"path14-5":{type:"path",points:[{x:-.011640198644880861,y:.2824489119921765},{x:.01182744133211866,y:.25421423950368016},{x:.035295081309120846,y:.22597956701517674},{x:.05876272128612037,y:.19774489452667865}],color:"primary",fill:!0},"path14-5-3":{type:"path",points:[{x:-.011818241440559873,y:.19775449269853418},{x:.01171692178543804,y:.22592735480803405},{x:.03525208501144128,y:.25410021691753926},{x:.058787248237439194,y:.2822730790270338}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:.010987250000000337,y:.3808714999999978},bottom1:{type:"text",text:"{VAL}",x:.05578094999999994,y:-.3808714999999996}},refblocks:{left1:{x:-.4717985499999999,y:-.1854504999999982},right1:{x:.4717985499999999,y:-.18547650000000182}},bounds:{minX:-.4999569909999999,maxX:.4999569909999999,minY:-.3808714999999996,maxY:.3808714999999978,width:.9999139819999998,height:.7617429999999974,centerX:0,centerY:-8881784197001252e-31},circles:{path9:{type:"circle",x:.02379285000000042,y:.24000550000000054,radius:.059920847,color:"primary",fill:!1}}},KZe=cd(uyn).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),JZe=Pl(KZe),eQe=JZe.primitives.filter(n=>n.type==="text"),lde=eQe.find(n=>n.text==="{VAL}");lde.x=-.35,lde.y=0,lde.anchor="middle_right";var cde=eQe.find(n=>n.text==="{REF}");cde.y=0,cde.x=.35,cde.anchor="middle_left";var fyn=JZe,dyn={paths:{path8698:{type:"path",points:[{x:-.20003504999999944,y:-.023826854587889912},{x:-.20252458999999945,y:-.018993393814014044},{x:-.20501412999999943,y:-.014174384106555204},{x:-.2075036699999995,y:-.009384187436300498},{x:-.20999320999999949,y:-.004636988132081332},{x:-.2124827499999995,y:5329457033053167e-20},{x:-.2149722899999995,y:.004673092344940186},{x:-.2174618299999995,y:.009209271428771242},{x:-.21995136999999956,y:.013649213595881985},{x:-.22244090999999955,y:.01798089395292432},{x:-.22493044999999956,y:.022192955076609913},{x:-.22741998999999957,y:.02627477703600152},{x:-.22990952999999958,y:.030216542867918667},{x:-.2323990699999996,y:.03400929910178016},{x:-.2348886099999996,y:.03764501096072756},{x:-.23737814999999962,y:.04111661189869628},{x:-.23986768999999963,y:.04441804716802203},{x:-.24235722999999965,y:.04754431114897349},{x:-.24484676999999966,y:.05049147821106258},{x:-.24733630999999967,y:.053256726915861724},{x:-.24982584999999968,y:.05583835741211009},{x:-.2523153899999997,y:.05823580191586174},{x:-.2548049299999997,y:.060449628211062575},{x:-.2572944699999997,y:.0624815361489735},{x:-.25978400999999973,y:.06433434716802203},{x:-.26227354999999974,y:.06601198689869628},{x:-.26476308999999976,y:.06751946096072757},{x:-.26725262999999977,y:.06886282410178016},{x:-.2697421699999998,y:.07004914286791866},{x:-.2722317099999998,y:.0710864520360015},{x:-.2747212499999998,y:.07198370507660991},{x:-.2772107899999998,y:.07275071895292433},{x:-.27970032999999983,y:.07339811359588198},{x:-.28218986999999984,y:.07393724642877124},{x:-.28467940999999986,y:.07438014234494018},{x:-.28716894999999987,y:.07473941957033053},{x:-.2896584899999999,y:.07502821186791866},{x:-.2921480299999999,y:.07526008756369952},{x:-.2946375699999999,y:.07544896589344477},{x:-.2971271099999999,y:.07560903118598594},{x:-.29961664999999993,y:.07575464541211008},{x:-.3021061874999999,y:.07560903118598594},{x:-.30459572499999993,y:.07544896589344477},{x:-.3070852624999999,y:.07526008756369951},{x:-.30957479999999993,y:.07502821186791866},{x:-.31206433749999984,y:.07473941957033052},{x:-.3145538749999998,y:.07438014234494018},{x:-.31704341249999984,y:.07393724642877124},{x:-.31953294999999987,y:.07339811359588198},{x:-.32202248749999984,y:.07275071895292431},{x:-.3245120249999998,y:.07198370507660991},{x:-.3270015624999998,y:.0710864520360015},{x:-.32949109999999976,y:.07004914286791866},{x:-.33198063749999984,y:.06886282410178016},{x:-.33447017499999976,y:.06751946096072757},{x:-.3369597124999998,y:.06601198689869628},{x:-.33944924999999976,y:.06433434716802203},{x:-.34193878749999973,y:.06248153614897349},{x:-.34442832499999976,y:.06044962821106258},{x:-.3469178624999997,y:.05823580191586174},{x:-.3494073999999997,y:.05583835741211009},{x:-.35189693749999973,y:.053256726915861724},{x:-.35438647499999965,y:.050491478211062576},{x:-.3568760124999997,y:.0475443111489735},{x:-.35936554999999964,y:.04441804716802203},{x:-.3618550874999996,y:.04111661189869628},{x:-.36434462499999964,y:.03764501096072756},{x:-.36683416249999967,y:.03400929910178016},{x:-.3693236999999996,y:.030216542867918673},{x:-.3718132374999996,y:.02627477703600152},{x:-.3743027749999996,y:.022192955076609917},{x:-.37679231249999956,y:.017980893952924324},{x:-.3792818499999996,y:.013649213595881985},{x:-.3817713874999995,y:.00920927142877125},{x:-.38426092499999953,y:.004673092344940191},{x:-.38675046249999956,y:5329457033053514e-20},{x:-.38923999999999953,y:-.004636988132081328},{x:-.39172953749999956,y:-.009384187436300498},{x:-.3942190749999995,y:-.014174384106555197},{x:-.3967086124999995,y:-.01899339381401404},{x:-.3991981499999995,y:-.023826854587889912}],color:"primary",fill:!1},path8700:{type:"path",points:[{x:-.000872049999999458,y:-.02382615458789039},{x:-.0033615874999994412,y:-.01899269131401453},{x:-.0058511249999994245,y:-.014173679106555696},{x:-.008340662499999407,y:-.009383479936300985},{x:-.010830199999999391,y:-.004636278132081827},{x:-.013319737499999373,y:5400707033003174e-20},{x:-.015809274999999356,y:.004673807344939683},{x:-.018298812499999338,y:.009209988928770731},{x:-.020788349999999324,y:.013649933595881476},{x:-.023277887499999306,y:.017981616452923805},{x:-.02576742499999929,y:.022193680076609393},{x:-.02825696249999927,y:.026275504536001},{x:-.030746499999999254,y:.030217272867918137},{x:-.03323603749999924,y:.034010031601779636},{x:-.03572557499999922,y:.03764574596072702},{x:-.038215112499999204,y:.04111734939869574},{x:-.04070464999999919,y:.04441878716802149},{x:-.04319418749999917,y:.04754505364897295},{x:-.045683724999999155,y:.05049222321106203},{x:-.048173262499999134,y:.05325747441586117},{x:-.05066279999999912,y:.055839107412109526},{x:-.053152337499999106,y:.05823655441586117},{x:-.055641874999999084,y:.06045038321106201},{x:-.05813141249999907,y:.06248229364897292},{x:-.06062094999999905,y:.06433510716802145},{x:-.06311048749999904,y:.0660127493986957},{x:-.06560002499999902,y:.06752022596072697},{x:-.068089562499999,y:.06886359160177957},{x:-.07057909999999898,y:.07004991286791806},{x:-.07306863749999896,y:.07108722453600091},{x:-.07555817499999895,y:.0719844800766093},{x:-.07804771249999894,y:.07275149645292371},{x:-.08053724999999892,y:.07339889359588138},{x:-.0830267874999989,y:.07393802892877062},{x:-.08551632499999888,y:.07438092734493956},{x:-.08800586249999887,y:.07474020707032991},{x:-.09049539999999885,y:.07502900186791804},{x:-.09298493749999884,y:.07526088006369888},{x:-.09547447499999881,y:.07544976089344414},{x:-.0979640124999988,y:.0756098286859853},{x:-.10045354999999878,y:.07575544541210943},{x:-.1029430899999988,y:.0756098286859853},{x:-.1054326299999988,y:.07544976089344414},{x:-.10792216999999882,y:.07526088006369887},{x:-.11041170999999883,y:.07502900186791804},{x:-.11290124999999884,y:.0747402070703299},{x:-.11539078999999886,y:.07438092734493956},{x:-.11788032999999885,y:.07393802892877062},{x:-.1203698699999989,y:.07339889359588138},{x:-.12285940999999889,y:.07275149645292371},{x:-.1253489499999989,y:.0719844800766093},{x:-.12783848999999892,y:.07108722453600091},{x:-.13032802999999893,y:.07004991286791806},{x:-.13281756999999894,y:.06886359160177957},{x:-.13530710999999895,y:.06752022596072697},{x:-.13779664999999897,y:.0660127493986957},{x:-.14028618999999898,y:.06433510716802145},{x:-.142775729999999,y:.06248229364897291},{x:-.145265269999999,y:.06045038321106202},{x:-.14775480999999901,y:.05823655441586117},{x:-.15024434999999903,y:.055839107412109526},{x:-.15273388999999904,y:.05325747441586117},{x:-.15522342999999905,y:.05049222321106202},{x:-.15771296999999906,y:.047545053648972956},{x:-.16020250999999908,y:.04441878716802149},{x:-.1626920499999991,y:.04111734939869574},{x:-.1651815899999991,y:.03764574596072702},{x:-.16767112999999914,y:.034010031601779636},{x:-.1701606699999991,y:.03021727286791814},{x:-.17265020999999914,y:.026275504536001},{x:-.17513974999999915,y:.022193680076609396},{x:-.17762928999999916,y:.017981616452923805},{x:-.1801188299999992,y:.013649933595881474},{x:-.18260836999999916,y:.00920998892877074},{x:-.1850979099999992,y:.0046738073449396865},{x:-.1875874499999992,y:5400707033003521e-20},{x:-.19007698999999922,y:-.004636278132081827},{x:-.19256652999999926,y:-.009383479936300985},{x:-.19505606999999922,y:-.01417367910655569},{x:-.19754560999999926,y:-.018992691314014522},{x:-.20003514999999927,y:-.02382615458789039}],color:"primary",fill:!1},path8702:{type:"path",points:[{x:.19829105000000036,y:-.02382615458789039},{x:.19580151000000035,y:-.01899269131401453},{x:.1933119700000003,y:-.014173679106555696},{x:.19082243000000035,y:-.009383479936300985},{x:.1883328900000003,y:-.004636278132081827},{x:.1858433500000003,y:5400707033003174e-20},{x:.18335381000000028,y:.004673807344939683},{x:.18086427000000024,y:.009209988928770731},{x:.1783747300000003,y:.013649933595881476},{x:.17588519000000025,y:.017981616452923805},{x:.17339565000000023,y:.022193680076609393},{x:.17090611000000022,y:.026275504536001},{x:.16841657000000018,y:.030217272867918137},{x:.16592703000000023,y:.034010031601779636},{x:.16343749000000019,y:.03764574596072702},{x:.16094795000000017,y:.04111734939869574},{x:.15845841000000016,y:.04441878716802149},{x:.15596887000000015,y:.04754505364897295},{x:.15347933000000014,y:.05049222321106203},{x:.15098979000000012,y:.05325747441586117},{x:.1485002500000001,y:.055839107412109526},{x:.1460107100000001,y:.05823655441586117},{x:.1435211700000001,y:.06045038321106201},{x:.14103163000000007,y:.06248229364897292},{x:.13854209000000006,y:.06433510716802145},{x:.13605255000000005,y:.0660127493986957},{x:.13356301000000004,y:.06752022596072697},{x:.13107347000000003,y:.06886359160177957},{x:.12858393,y:.07004991286791806},{x:.12609439,y:.07108722453600091},{x:.12360484999999999,y:.0719844800766093},{x:.12111530999999998,y:.07275149645292371},{x:.11862576999999996,y:.07339889359588138},{x:.11613622999999995,y:.07393802892877062},{x:.11364668999999994,y:.07438092734493956},{x:.11115714999999993,y:.07474020707032991},{x:.10866760999999991,y:.07502900186791804},{x:.1061780699999999,y:.07526088006369888},{x:.10368852999999989,y:.07544976089344414},{x:.10119898999999988,y:.0756098286859853},{x:.09870944999999987,y:.07575544541210943},{x:.09621991249999988,y:.0756098286859853},{x:.0937303749999999,y:.07544976089344414},{x:.09124083749999992,y:.07526088006369887},{x:.08875129999999994,y:.07502900186791804},{x:.08626176249999995,y:.0747402070703299},{x:.08377222499999996,y:.07438092734493956},{x:.08128268749999998,y:.07393802892877062},{x:.07879315,y:.07339889359588138},{x:.07630361250000002,y:.07275149645292371},{x:.07381407500000003,y:.0719844800766093},{x:.07132453750000005,y:.07108722453600091},{x:.06883500000000006,y:.07004991286791806},{x:.06634546250000009,y:.06886359160177957},{x:.0638559250000001,y:.06752022596072697},{x:.06136638750000012,y:.0660127493986957},{x:.05887685000000013,y:.06433510716802145},{x:.05638731250000015,y:.06248229364897291},{x:.053897775000000175,y:.06045038321106202},{x:.05140823750000019,y:.05823655441586117},{x:.048918700000000204,y:.055839107412109526},{x:.04642916250000022,y:.05325747441586117},{x:.04393962500000023,y:.05049222321106202},{x:.04145008750000026,y:.047545053648972956},{x:.038960550000000274,y:.04441878716802149},{x:.03647101250000029,y:.04111734939869574},{x:.0339814750000003,y:.03764574596072702},{x:.03149193750000032,y:.034010031601779636},{x:.02900240000000034,y:.03021727286791814},{x:.02651286250000036,y:.026275504536001},{x:.024023325000000373,y:.022193680076609396},{x:.021533787500000387,y:.017981616452923805},{x:.019044250000000405,y:.013649933595881474},{x:.016554712500000426,y:.00920998892877074},{x:.014065175000000442,y:.0046738073449396865},{x:.011575637500000457,y:5400707033003521e-20},{x:.009086100000000473,y:-.004636278132081827},{x:.006596562500000487,y:-.009383479936300985},{x:.004107025000000513,y:-.01417367910655569},{x:.0016174875000005274,y:-.018992691314014522},{x:-.000872049999999458,y:-.02382615458789039}],color:"primary",fill:!1},path8704:{type:"path",points:[{x:.39745405000000034,y:-.02382615458789039},{x:.3949645125000003,y:-.01899269131401453},{x:.39247497500000034,y:-.014173679106555696},{x:.3899854375000004,y:-.009383479936300985},{x:.38749590000000045,y:-.004636278132081827},{x:.3850063625000004,y:5400707033003174e-20},{x:.3825168250000004,y:.004673807344939683},{x:.3800272875000004,y:.009209988928770731},{x:.3775377500000005,y:.013649933595881476},{x:.37504821250000053,y:.017981616452923805},{x:.3725586750000005,y:.022193680076609393},{x:.3700691375000005,y:.026275504536001},{x:.3675796000000005,y:.030217272867918137},{x:.3650900625000006,y:.034010031601779636},{x:.3626005250000006,y:.03764574596072702},{x:.3601109875000006,y:.04111734939869574},{x:.35762145000000056,y:.04441878716802149},{x:.3551319125000006,y:.04754505364897295},{x:.3526423750000007,y:.05049222321106203},{x:.3501528375000007,y:.05325747441586117},{x:.3476633000000007,y:.055839107412109526},{x:.34517376250000065,y:.05823655441586117},{x:.34268422500000073,y:.06045038321106201},{x:.3401946875000007,y:.06248229364897292},{x:.3377051500000008,y:.06433510716802145},{x:.33521561250000076,y:.0660127493986957},{x:.33272607500000073,y:.06752022596072697},{x:.3302365375000008,y:.06886359160177957},{x:.3277470000000008,y:.07004991286791806},{x:.3252574625000008,y:.07108722453600091},{x:.32276792500000084,y:.0719844800766093},{x:.32027838750000087,y:.07275149645292371},{x:.3177888500000009,y:.07339889359588138},{x:.3152993125000009,y:.07393802892877062},{x:.3128097750000009,y:.07438092734493956},{x:.31032023750000093,y:.07474020707032991},{x:.30783070000000096,y:.07502900186791804},{x:.305341162500001,y:.07526088006369888},{x:.30285162500000096,y:.07544976089344414},{x:.300362087500001,y:.0756098286859853},{x:.297872550000001,y:.07575544541210943},{x:.29538301000000095,y:.0756098286859853},{x:.292893470000001,y:.07544976089344414},{x:.290403930000001,y:.07526088006369887},{x:.287914390000001,y:.07502900186791804},{x:.28542485000000095,y:.0747402070703299},{x:.2829353100000009,y:.07438092734493956},{x:.2804457700000009,y:.07393802892877062},{x:.2779562300000009,y:.07339889359588138},{x:.2754666900000009,y:.07275149645292371},{x:.2729771500000009,y:.0719844800766093},{x:.2704876100000009,y:.07108722453600091},{x:.26799807000000087,y:.07004991286791806},{x:.26550853000000085,y:.06886359160177957},{x:.26301899000000084,y:.06752022596072697},{x:.26052945000000083,y:.0660127493986957},{x:.2580399100000008,y:.06433510716802145},{x:.2555503700000008,y:.06248229364897291},{x:.2530608300000008,y:.06045038321106202},{x:.2505712900000008,y:.05823655441586117},{x:.24808175000000077,y:.055839107412109526},{x:.24559221000000075,y:.05325747441586117},{x:.24310267000000074,y:.05049222321106202},{x:.24061313000000073,y:.047545053648972956},{x:.23812359000000072,y:.04441878716802149},{x:.2356340500000007,y:.04111734939869574},{x:.2331445100000007,y:.03764574596072702},{x:.23065497000000068,y:.034010031601779636},{x:.22816543000000067,y:.03021727286791814},{x:.22567589000000066,y:.026275504536001},{x:.22318635000000064,y:.022193680076609396},{x:.22069681000000063,y:.017981616452923805},{x:.21820727000000062,y:.013649933595881474},{x:.2157177300000006,y:.00920998892877074},{x:.2132281900000006,y:.0046738073449396865},{x:.21073865000000058,y:5400707033003521e-20},{x:.20824911000000057,y:-.004636278132081827},{x:.20575957000000056,y:-.009383479936300985},{x:.20327003000000055,y:-.01417367910655569},{x:.20078049000000053,y:-.018992691314014522},{x:.19829095000000052,y:-.02382615458789039}],color:"primary",fill:!1},path8706:{type:"path",points:[{x:-.4023286499999996,y:-.022544054587890106},{x:-.5293590499999994,y:-.022544054587890106}],color:"primary",fill:!1},"path8706-5":{type:"path",points:[{x:.5261604500000003,y:-.027111054587890093},{x:.39913004999999946,y:-.027111054587890093}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0040821499999992295,y:.22997364541210996},bottom1:{type:"text",text:"{VAL}",x:-.004252755294839927,y:-.22997364541210996}},refblocks:{left1:{x:-.5504428500000003,y:-.021272154587890446},right1:{x:.5504428500000005,y:-.026521254587889898}},bounds:{width:1.1572025820000007,height:.4599472908242199,centerX:11102230246251565e-32,centerY:0},circles:{}},{paths:pyn,texts:tQe,bounds:uj,refblocks:nQe,circles:hyn}=dyn,ude=Wm({primitives:[...Object.values(pyn),...Object.values(hyn),{...tQe.top1,anchor:"middle_bottom"},{...tQe.bottom1,anchor:"middle_top"}],ports:[{...nQe.left1,labels:["1"]},{...nQe.right1,labels:["2"]}],size:{width:uj.width,height:uj.height},center:{x:uj.centerX,y:uj.centerY}}),rQe=Pl(ude,"up"),myn=e9n(rQe),yyn=hfe(ude),iQe={paths:{path11:{type:"path",points:[{x:-.5274831500000006,y:-.05991764999999982},{x:-.14891374999999996,y:-.06254064999999964}],color:"primary",fill:!1},path40:{type:"path",points:[{x:.13221874999999983,y:-.048856449999999496},{x:-.13236425000000063,y:-.18114814999999918}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.13236425000000063,y:.08343525000000018},{x:.13221874999999983,y:-.048856449999999496}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.13236425000000063,y:-.18114814999999984},{x:-.13236425000000063,y:.08343525000000018}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.13221874999999983,y:.08343525000000018},{x:.13221874999999983,y:-.18114814999999984}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.13582535000000018,y:-.04942524999999942},{x:.533952450000001,y:-.059917649999999156}],color:"primary",fill:!1},"path25-0-9-8":{type:"path",points:[{x:-.02944535000000048,y:.39378525000000053},{x:-.05325954999999993,y:.4660362500000006},{x:-.07725114999999949,y:.39386225000000086}],color:"primary",fill:!0},"path78-6-5-5":{type:"path",points:[{x:-.05361965000000035,y:.27387525000000035},{x:-.053592050000000446,y:.2865022500000003},{x:-.05330205000000077,y:.41436425000000066},{x:-.05311205000000019,y:.4152642500000008}],color:"primary",fill:!1},"path25-0-9-8-2":{type:"path",points:[{x:.06865195000000024,y:.39378525000000053},{x:.044837750000000565,y:.4660362500000006},{x:.02084615000000123,y:.39386225000000086}],color:"primary",fill:!0},"path78-6-5-5-7":{type:"path",points:[{x:.044477650000000146,y:.27387525000000035},{x:.044505250000000274,y:.2865022500000003},{x:.04479524999999995,y:.41436425000000066},{x:.04498525000000053,y:.4152642500000008}],color:"primary",fill:!1},"path43-1":{type:"path",points:[{x:.03124844999999965,y:.05895145000000013},{x:.03124844999999965,y:-.16452955000000036}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:.25206924999999947,y:.3769550499999994},bottom1:{type:"text",text:"{VAL}",x:-.006614550000000552,y:-.4660362500000004}},refblocks:{left1:{x:-.54139845,y:-.060770450000000364},right1:{x:.5413984499999995,y:-.0597740500000008}},bounds:{minX:-.569556891,maxX:.5695568909999995,minY:-.4660362500000004,maxY:.4660362500000006,width:1.1391137819999995,height:.932072500000001,centerX:-2220446049250313e-31,centerY:11102230246251565e-32},circles:{path1:{type:"circle",x:-.0037626500000003116,y:-.05278935000000051,radius:.28854213,color:"primary",fill:!1}}};iQe.bounds.width+=.2;var aQe=cd(iQe).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),oQe=Pl(aQe),vyn=oQe.primitives.filter(n=>n.type==="text"),sQe=vyn.find(n=>n.text==="{VAL}");sQe.x=-.52,sQe.anchor="middle_right";var gyn=oQe,_yn={paths:{path45:{type:"path",points:[{x:.13585750000000063,y:-.003696399999999045},{x:-.12872579999999934,y:-.13598810000000228}],color:"primary",fill:!1},"path1-8":{type:"path",points:[{x:.12763670000000094,y:-.003920199999999596},{x:.5265564000000009,y:-.003920199999999596}],color:"primary",fill:!1},path46:{type:"path",points:[{x:-.12872579999999934,y:.12859530000000063},{x:.13585750000000063,y:-.003696399999999045}],color:"primary",fill:!1},path47:{type:"path",points:[{x:-.12872579999999934,y:-.13598810000000228},{x:-.12872579999999934,y:.12859530000000063}],color:"primary",fill:!1},path48:{type:"path",points:[{x:.13585750000000063,y:.12859530000000063},{x:.13585750000000063,y:-.13598810000000228}],color:"primary",fill:!1},path49:{type:"path",points:[{x:-.13076959999999938,y:-.003696399999999045},{x:-.5256007999999994,y:-.003696399999999045}],color:"primary",fill:!1},path25:{type:"path",points:[{x:-.1557438999999996,y:.28545279999999806},{x:-.2530861999999994,y:.3023319999999998},{x:-.21878339999999952,y:.20956920000000068}],color:"primary",fill:!0},path78:{type:"path",points:[{x:-.08000449999999937,y:.16590799999999817},{x:-.09202799999999911,y:.1748410000000007},{x:-.2137844999999996,y:.26529680000000155},{x:-.2144144999999993,y:.2662468000000011}],color:"primary",fill:!1},"path25-0":{type:"path",points:[{x:.021722400000000697,y:.30658939999999646},{x:-.07561989999999952,y:.3234685999999982},{x:-.04131709999999922,y:.23070579999999907}],color:"primary",fill:!0},"path78-6":{type:"path",points:[{x:.09746180000000093,y:.18704459999999656},{x:.08543830000000074,y:.19597759999999909},{x:-.0363181999999993,y:.28643339999999995},{x:-.03694819999999943,y:.2873833999999995}],color:"primary",fill:!1}},texts:{bottom1:{type:"text",text:"{VAL}",x:-.009561699999999451,y:-.3234685999999982},right1:{type:"text",text:"{REF}",x:.31464070000000044,y:.22386570000000106}},refblocks:{left1:{x:-.5362092999999997,y:-.004432900000001183},right1:{x:.5362093000000003,y:-.004886400000003732}},bounds:{width:1.128735482,height:.6469371999999964,centerX:33306690738754696e-32,centerY:0},circles:{}},{paths:xyn,texts:lQe,bounds:fj,refblocks:cQe,circles:byn}=_yn,dj=Wm({primitives:[...Object.values(xyn),...Object.values(byn),{...lQe.bottom1,anchor:"middle_top"},{...lQe.right1,anchor:"middle_bottom"}],ports:[{...cQe.left1,labels:["1"]},{...cQe.right1,labels:["2"]}],size:{width:fj.width,height:fj.height},center:{x:fj.centerX,y:fj.centerY}}),Syn=Pl(dj,"down"),wyn=hfe(dj),fde=Pl(dj,"up"),Eyn={...fde,primitives:fde.primitives.map(n=>n.type==="path"&&(n.points.length===3||n.points.length===4)?{...n,points:n.points.map(e=>({x:e.x,y:-e.y+2*fde.center.y}))}:n)},Tyn=Eyn,Myn={paths:{path11:{type:"path",points:[{x:-.5053201665812097,y:-.010839730805804138},{x:-.1829962316128657,y:-.010839730805804138}],color:"primary",fill:!1},"path11-2":{type:"path",points:[{x:-.1674747072814866,y:-.11471502212593476},{x:-.1674747072814866,y:.07736981415388478}],color:"primary",fill:!1},"path11-5":{type:"path",points:[{x:-.1674747072814866,y:-.11632056223474518},{x:.16018133830019532,y:-.11632056223474518}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:-.1674747072814866,y:.07736981415388478},{x:.16018133830019532,y:.07736981415388478}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.17205869804197382,y:-.010839950577224311},{x:.5116721586832798,y:-.010839950577224311}],color:"primary",fill:!1},"path11-2-1":{type:"path",points:[{x:.16064490317338742,y:-.11622177498145403},{x:.16064490317338742,y:.07727135655772521}],color:"primary",fill:!1},"path25-0-9":{type:"path",points:[{x:-.40391896081308554,y:-.2111951150487743},{x:-.32538818309991635,y:-.1776462385858042},{x:-.33843942905204627,y:-.26928059146906413}],color:"primary",fill:!0},"path78-6-5":{type:"path",points:[{x:-.4470989190253618,y:-.3351265263866847},{x:-.4385525777085817,y:-.32468848279378437},{x:-.3520048317368336,y:-.21897414423109507},{x:-.3516268465799328,y:-.21798517284109487}],color:"primary",fill:!1},"path25-0-9-0":{type:"path",points:[{x:-.30220674110432255,y:-.3403193953841548},{x:-.22367596339115314,y:-.30677051892118534},{x:-.23672720934328306,y:-.3984048718044453}],color:"primary",fill:!0},"path78-6-5-9":{type:"path",points:[{x:-.3453866993165988,y:-.464250806722065},{x:-.3368403579998187,y:-.45381276312916397},{x:-.2502926120280704,y:-.34809842456647466},{x:-.24991462687116983,y:-.34710945317647446}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.1679477702432366,y:-.40859918889256375},bottom1:{type:"text",text:"{VAL}",x:-.006410773639930811,y:.464250806722065}},refblocks:{left1:{x:-.5247194309452994,y:-.009902515585214156},right1:{x:.5247194309452992,y:-.010997416799653603}},bounds:{width:1.1040207733749288,height:.6228499956146287,centerX:-11102230246251565e-32,centerY:-.022174191085249373},circles:{path1:{type:"circle",x:-.003646732950281173,y:-.018672603986024328,radius:.2796529289238723,color:"primary",fill:!1}}},{paths:Cyn,texts:uQe,bounds:pj,refblocks:fQe,circles:Ryn}=Myn,dQe=Wm({primitives:[...Object.values(Cyn),...Object.values(Ryn),{...uQe.top1,anchor:"middle_left",x:0},{...uQe.bottom1,anchor:"middle_left",x:0}],ports:[{...fQe.left1,labels:["1"]},{...fQe.right1,labels:["2"]}],size:{width:pj.width,height:pj.height},center:{x:pj.centerX,y:pj.centerY}}),pQe=Pl(dQe),hQe=pQe.primitives.filter(n=>n.type==="text"),dde=hQe.find(n=>n.text==="{VAL}");dde.x=-.35,dde.y=0,dde.anchor="middle_right";var pde=hQe.find(n=>n.text==="{REF}");pde.y=0,pde.x=.35,pde.anchor="middle_left";var Ayn=pQe,Pyn={paths:{path208:{type:"path",points:[{x:.3843021704999998,y:.13154093999999894},{x:.5165938705000004,y:-.13304206000000107}],color:"primary",fill:!1},path209:{type:"path",points:[{x:.25201047050000014,y:-.13304206000000107},{x:.3843021704999998,y:.13154093999999894}],color:"primary",fill:!1},path210:{type:"path",points:[{x:.5165938705000004,y:-.13304206000000107},{x:.25201047050000014,y:-.13304206000000107}],color:"primary",fill:!1},path211:{type:"path",points:[{x:.25201047050000014,y:.13154093999999894},{x:.5165938705000004,y:.13154093999999894}],color:"primary",fill:!1},path212:{type:"path",points:[{x:.11971887050000074,y:-.39762406000000006},{x:.3843021704999998,y:-.39762406000000006}],color:"primary",fill:!1},path213:{type:"path",points:[{x:.3843021704999998,y:.39612494},{x:.11971887050000074,y:.39612494}],color:"primary",fill:!1},path214:{type:"path",points:[{x:.11971887050000074,y:.5284169399999996},{x:.11971887050000074,y:.18445994}],color:"primary",fill:!1},path215:{type:"path",points:[{x:.11971887050000074,y:-.5299150600000004},{x:.11971887050000074,y:-.0007480600000011606}],color:"primary",fill:!1},path216:{type:"path",points:[{x:.3843021704999998,y:-.39762469000000067},{x:.3843021704999998,y:.3961256399999993}],color:"primary",fill:!1},path217:{type:"path",points:[{x:-.1448644295000001,y:.2638359399999999},{x:-.1448644295000001,y:-.26533006000000015}],color:"primary",fill:!1},path218:{type:"path",points:[{x:-.22423942949999898,y:-.2653310599999994},{x:-.22423942949999898,y:.26383493999999885}],color:"primary",fill:!1},path219:{type:"path",points:[{x:-.5417394294999998,y:-.26533006000000015},{x:-.22423942949999898,y:-.2653320600000004}],color:"primary",fill:!1},path220:{type:"path",points:[{x:-.1448644295000001,y:-.18595506000000128},{x:.11971897050000013,y:-.18595506000000128}],color:"primary",fill:!1},path221:{type:"path",points:[{x:-.1448644295000001,y:.18446093999999924},{x:.11971897050000013,y:.18446093999999924}],color:"primary",fill:!1},path222:{type:"path",points:[{x:-.06548942950000036,y:-.0007480600000011606},{x:.11971887050000074,y:-.0007480600000011606}],color:"primary",fill:!1}},texts:{right1:{type:"text",text:"{VAL}",x:.5715500704999998,y:.02044358999999929},right2:{type:"text",text:"{REF}",x:.5701646705000005,y:.2085436499999993}},refblocks:{top1:{x:.12018067049999992,y:.5432738300000004},bottom1:{x:.11982247050000083,y:-.5432738300000004},left1:{x:-.5433916295000003,y:-.2663988600000007}},bounds:{width:1.1431001410000001,height:1.1428645420000008,centerX:-2220446049250313e-31,centerY:0}},{paths:Nyn,texts:mQe,bounds:hj,refblocks:hde}=Pyn,yQe=Wm({primitives:[...Object.values(Nyn),{...mQe.right1,anchor:"middle_left"},{...mQe.right2,anchor:"middle_left"}],ports:[{...hde.top1,labels:["1"]},{...hde.bottom1,labels:["2"]},{...hde.left1,labels:["3"]}],size:{width:hj.width+.4,height:hj.height},center:{x:hj.centerX+.2,y:hj.centerY}}),mde=Pl(yQe),vQe=mde.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),yde=mde.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");vQe.anchor="middle_top",yde.anchor="middle_top",vQe.x=yde.x,yde.y+=.15;var Dyn=mde,Lyn={paths:{"path12-1-8-6-9":{type:"path",points:[{x:.005962250000000502,y:.06921149999999976},{x:.005962250000000502,y:-.005086499999999106}],color:"primary",fill:!1},"path12-1-5-6":{type:"path",points:[{x:-.48740705000000073,y:-.09299450000000142},{x:-.17310075000000058,y:-.09299450000000142}],color:"primary",fill:!1},"path12-1-8-0":{type:"path",points:[{x:-.16008695000000017,y:-.010660500000000184},{x:.1719709499999995,y:-.010660500000000184}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:.1954987499999996,y:-.09260549999999945},{x:.4881436499999996,y:-.09260549999999945}],color:"primary",fill:!1},path2:{type:"path",points:[{x:-.09950044999999985,y:.05839450000000035},{x:-.09950104999999976,y:.06197449999999982},{x:-.09932044999999956,y:.06550449999999941},{x:-.09896044999999987,y:.0690104999999992},{x:-.09860045000000017,y:.07250049999999852},{x:-.09806045000000019,y:.07593049999999835},{x:-.09735344999999995,y:.07929949999999941},{x:-.09663345000000056,y:.08265950000000011},{x:-.09578045000000035,y:.08599949999999978},{x:-.09475245000000054,y:.08924949999999932},{x:-.09379245000000047,y:.09255949999999835},{x:-.09254545000000025,y:.09567949999999925},{x:-.09120844999999989,y:.09877950000000091},{x:-.08986644999999971,y:.10186950000000117},{x:-.08839545000000015,y:.10492949999999901},{x:-.08675845000000049,y:.10783949999999898},{x:-.08506245000000057,y:.11069950000000084},{x:-.08334244999999996,y:.11360950000000081},{x:-.08146945000000017,y:.11638949999999859},{x:-.0795824500000002,y:.11916949999999993},{x:-.07752845000000086,y:.12180949999999946},{x:-.07546944999999994,y:.12442949999999975},{x:-.07325945000000011,y:.12693950000000065},{x:-.07104145000000006,y:.129449499999998},{x:-.06867544999999975,y:.13182950000000027},{x:-.06628845000000005,y:.1341695000000005},{x:-.06379544999999975,y:.1364194999999988},{x:-.06114145000000004,y:.13848950000000038},{x:-.05848745000000033,y:.1405694999999998},{x:-.05584345000000024,y:.14261950000000034},{x:-.05306845000000049,y:.14449950000000022},{x:-.05029345000000074,y:.14639950000000113},{x:-.04738844999999969,y:.14811950000000174},{x:-.04437445000000029,y:.14969949999999876},{x:-.04134744999999995,y:.1513194999999996},{x:-.038316449999999946,y:.15275949999999838},{x:-.03515645000000056,y:.15407949999999992},{x:-.03204444999999989,y:.15536950000000083},{x:-.028770450000000558,y:.15655950000000018},{x:-.025468450000000864,y:.15757949999999887},{x:-.02213745000000067,y:.15863950000000138},{x:-.018790450000000014,y:.15942949999999811},{x:-.01536325000000005,y:.16012949999999826},{x:-.011980249999999693,y:.16082950000000018},{x:-.008442250000000762,y:.16141949999999916},{x:-.004890650000000107,y:.1617494999999991},{x:-.0013406500000003874,y:.16204949999999663},{x:.002252350000000014,y:.16214949999999817},{x:.005893849999999645,y:.16214949999999817},{x:.009534849999998762,y:.16214949999999817},{x:.013136849999999534,y:.16204949999999663},{x:.016683149999999536,y:.1617494999999991},{x:.020231149999998976,y:.1614494999999998},{x:.023727149999999142,y:.16104949999999896},{x:.02715474999999934,y:.16012949999999826},{x:.03057874999999921,y:.15952949999999966},{x:.03395574999999962,y:.15867949999999986},{x:.03725995000000015,y:.15758950000000027},{x:.0405679499999998,y:.15652949999999954},{x:.04379994999999948,y:.15541949999999893},{x:.04695294999999966,y:.15409950000000094},{x:.050101949999999285,y:.15280950000000004},{x:.053191949999999544,y:.1513194999999996},{x:.05617794999999948,y:.1497395000000008},{x:.05916694999999983,y:.14811950000000174},{x:.06206694999999929,y:.14639950000000113},{x:.06487294999999982,y:.1445595000000015},{x:.06767095000000012,y:.14269950000000264},{x:.07038294999999994,y:.14069950000000198},{x:.07299194999999958,y:.1385795000000023},{x:.07560095000000011,y:.13645950000000262},{x:.07809294999999938,y:.13420950000000254},{x:.08047994999999997,y:.13187950000000193},{x:.08287894999999956,y:.1295395000000017},{x:.08515495000000062,y:.12706950000000106},{x:.08729294999999926,y:.12451950000000167},{x:.08944594999999911,y:.12192950000000202},{x:.0914679499999993,y:.11930950000000173},{x:.09337295000000001,y:.1165295000000004},{x:.0971669499999992,y:.11101949999999938},{x:.10043494999999947,y:.10512450000000229},{x:.10311494999999926,y:.09890950000000132},{x:.10444094999999987,y:.09581950000000106},{x:.10564094999999973,y:.09262950000000103},{x:.10667494999999949,y:.08935950000000226},{x:.10769994999999977,y:.08610950000000273},{x:.1085699499999997,y:.08279950000000369},{x:.10927795000000007,y:.07942950000000337},{x:.10999794999999946,y:.07605950000000128},{x:.11051994999999959,y:.07262950000000146},{x:.11088394999999984,y:.06913950000000213},{x:.11124394999999954,y:.0656495000000028},{x:.11142394999999983,y:.062099500000002195},{x:.11142394999999983,y:.05854350000000075},{x:.10483595000000001,y:.05853049999999982},{x:.0982479500000002,y:.058516500000001415},{x:.09164495000000006,y:.058518500000001694},{x:.08505695000000024,y:.05850850000000207},{x:.078453950000001,y:.058509500000001324},{x:.07186595000000029,y:.058496500000000395},{x:.06526295000000104,y:.05849750000000142},{x:.058674950000001225,y:.058485499999999746},{x:.05208695000000052,y:.058473499999999845},{x:.04548395000000127,y:.058475500000000125},{x:.038895950000001456,y:.05846150000000172},{x:.03230795000000075,y:.058448499999999015},{x:.025704950000001503,y:.058453499999998826},{x:.019101950000001366,y:.05845449999999808},{x:.01251395000000155,y:.05844149999999715},{x:.005925950000001734,y:.058427499999998744},{x:-.0006560499999990199,y:.05842149999999968},{x:-.007240049999999165,y:.05841449999999959},{x:-.01382404999999931,y:.05840850000000053},{x:-.020406049999999176,y:.05840250000000147},{x:-.02699004999999932,y:.058394500000002125},{x:-.03357404999999947,y:.05838950000000409},{x:-.04015604999999933,y:.05838350000000503},{x:-.04674004999999948,y:.05837450000000466},{x:-.05332205000000023,y:.058368500000005596},{x:-.05990605000000038,y:.058360500000006255},{x:-.06649005000000052,y:.058355500000006444},{x:-.07307205000000039,y:.05834950000000738},{x:-.07965605000000053,y:.05834150000000804},{x:-.08624005000000068,y:.05833550000000898},{x:-.09282205000000143,y:.05833050000001094}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:.01254745000000046,y:.26612850000000243},bottom1:{type:"text",text:"{VAL}",x:-.16130964999999975,y:-.2661284999999989}},refblocks:{left1:{x:-.4717985499999999,y:-.09296750000000031},right1:{x:.4717985499999999,y:-.09299249999999937}},bounds:{width:.9999139819999998,height:.5322570000000013,centerX:0,centerY:17763568394002505e-31},circles:{}},{paths:Oyn,texts:gQe,bounds:mj,refblocks:_Qe,circles:zyn}=Lyn,xQe=Wm({primitives:[...Object.values(Oyn),...Object.values(zyn),{...gQe.top1,anchor:"middle_bottom",x:0},{...gQe.bottom1,anchor:"middle_top",x:0}],ports:[{..._Qe.left1,labels:["1"]},{..._Qe.right1,labels:["2"]}],size:{width:mj.width,height:mj.height},center:{x:mj.centerX+.006,y:mj.centerY+.06}}),vde=Pl(xQe),vP=vde.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),yj=vde.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");vP.anchor="middle_left",yj.anchor="middle_right",vP.x=vP.x-.03,vP.y=vP.y,yj.x=yj.x,yj.y=0;var Uyn=vde,kyn={paths:{path11:{type:"path",points:[{x:-.39274354450000026,y:-.10329954999999957},{x:.05111245549999932,y:-.1059225499999994}],color:"primary",fill:!1},path40:{type:"path",points:[{x:.09373835550000087,y:.18559775000000034},{x:.09280835550000122,y:-.18255174999999935}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:.30382435550000064,y:.53233025},{x:.3032243555000005,y:.10600584999999985}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.3108281555000003,y:-.5323308500000001},{x:.31142815550000025,y:-.005876249999999805}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.09383795549999951,y:.10788365000000044},{x:.31104975549999936,y:.10659565000000004}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:.09383795549999951,y:-.10232114999999986},{x:.31104975549999936,y:-.10360915000000026}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.27419885550000034,y:-.04077644999999963},{x:.27419885550000034,y:.030615650000000327},{x:.2024438555000001,y:-.004662050000000084},{x:.27419885550000034,y:-.04077644999999963}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:.09383795549999951,y:-.004018049999999551},{x:.31104975549999936,y:-.005306049999999729}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:.05171245550000081,y:.16715385000000005},{x:.05111245550000065,y:-.10592255000000006}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.13197254449999907,y:.36092494999999936},bottom1:{type:"text",text:"{VAL}",x:.05891105550000031,y:-.42489435000000064}},refblocks:{top1:{x:.30397715549999993,y:.5519248499999992},bottom1:{x:.31067575550000126,y:-.5519248499999994},left1:{x:-.41859744450000025,y:-.10250625000000024}},bounds:{width:.8935117710000002,height:1.1601665819999987,centerX:-8326672684688674e-32,centerY:-5551115123125783e-32},circles:{path1:{type:"circle",x:.15821375550000005,y:.003454549999999612,radius:.28854213,color:"primary",fill:!1}}},{paths:Iyn,texts:bQe,bounds:vj,refblocks:gde,circles:Fyn}=kyn,SQe=Wm({primitives:[...Object.values(Iyn),...Object.values(Fyn),{...bQe.top1,anchor:"middle_right",x:0},{...bQe.bottom1,anchor:"middle_right",x:0}],ports:[{...gde.top1,labels:["1","drain"]},{...gde.bottom1,labels:["2","source"]},{...gde.left1,labels:["3","gate"]}],size:{width:vj.width,height:vj.height},center:{x:vj.centerX,y:vj.centerY}}),wQe=Pl(SQe),EQe=wQe.primitives.filter(n=>n.type==="text"),_de=EQe.find(n=>n.text==="{VAL}");_de.x=-.35,_de.y=0,_de.anchor="middle_right";var xde=EQe.find(n=>n.text==="{REF}");xde.y=0,xde.x=.35,xde.anchor="middle_left";var Byn=wQe,jyn={paths:{path11:{type:"path",points:[{x:-.39274354450000026,y:-.10329954999999957},{x:.05111245549999932,y:-.1059225499999994}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:.30382435550000064,y:.53233025},{x:.3032243555000005,y:.10600584999999985}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.3108281555000003,y:-.5323308500000001},{x:.31142815550000025,y:-.005876249999999805}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.09383795549999951,y:.10788365000000044},{x:.31104975549999936,y:.10659565000000004}],color:"primary",fill:!1},"path2-8-3-7":{type:"path",points:[{x:.09448295549999952,y:.14677165000000048},{x:.09319295549999951,y:.06899565000000041}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:.09383795549999951,y:-.10232114999999986},{x:.31104975549999936,y:-.10360915000000026}],color:"primary",fill:!1},"path2-8-3":{type:"path",points:[{x:.09440455549999993,y:-.07703174999999951},{x:.09311455549999992,y:-.15480774999999958}],color:"primary",fill:!1},"path2-8-3-2":{type:"path",points:[{x:.09448295549999952,y:.03486995000000048},{x:.09319295549999951,y:-.042906049999999585}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.2741991554999996,y:-.040776550000000134},{x:.2741991554999996,y:.030615549999999825},{x:.2024441554999994,y:-.004662350000000037},{x:.2741991554999996,y:-.040776550000000134}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:.09383795549999951,y:-.004018049999999551},{x:.31104975549999936,y:-.005306049999999729}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:.05171245550000081,y:.10847375000000059},{x:.05111245550000065,y:-.1059225499999994}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.13197254449999907,y:.36092494999999936},bottom1:{type:"text",text:"{VAL}",x:.05891105550000031,y:-.42489435000000064}},refblocks:{top1:{x:.30397715549999993,y:.5519248499999992},bottom1:{x:.31067575550000126,y:-.5519248499999994},left1:{x:-.41859744450000025,y:-.10250625000000024}},bounds:{width:.8935117710000002,height:1.1601665819999987,centerX:-8326672684688674e-32,centerY:-5551115123125783e-32},circles:{path1:{type:"circle",x:.15821375550000005,y:.003454549999999612,radius:.28854213,color:"primary",fill:!1}}},{paths:Hyn,texts:TQe,bounds:gj,refblocks:bde,circles:Vyn}=jyn,MQe=Wm({primitives:[...Object.values(Hyn),...Object.values(Vyn),{...TQe.top1,anchor:"middle_right",x:0},{...TQe.bottom1,anchor:"middle_right",x:0}],ports:[{...bde.top1,labels:["1","drain"]},{...bde.bottom1,labels:["2","source"]},{...bde.left1,labels:["3","gate"]}],size:{width:gj.width,height:gj.height},center:{x:gj.centerX,y:gj.centerY}}),CQe=Pl(MQe),RQe=CQe.primitives.filter(n=>n.type==="text"),Sde=RQe.find(n=>n.text==="{VAL}");Sde.x=-.35,Sde.y=0,Sde.anchor="middle_right";var wde=RQe.find(n=>n.text==="{REF}");wde.y=0,wde.x=.35,wde.anchor="middle_left";var $yn=CQe,Gyn={paths:{path11:{type:"path",points:[{x:-.38509374449999945,y:-.00367374999999992},{x:.05876225550000025,y:-.00629674999999974}],color:"primary",fill:!1},path40:{type:"path",points:[{x:.07415065550000066,y:.18559775000000034},{x:.07322065550000101,y:-.18255174999999935}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:.28423665550000043,y:.53233025},{x:.2836366555000003,y:.10600584999999985}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.2912404555000001,y:-.5298821500000002},{x:.29184045550000004,y:-.10355795000000012}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.07425025549999931,y:.10788365000000044},{x:.29146205549999915,y:.10659565000000004}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:.07425025549999931,y:-.10232114999999986},{x:.29146205549999915,y:-.10360915000000026}],color:"primary",fill:!1},path15:{type:"path",points:[{x:-.0829488445000004,y:.06153284999999986},{x:-.0829488445000004,y:-.06535114999999969},{x:.005945155500000077,y:-.0026521499999998532},{x:-.0829488445000004,y:.06153284999999986}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.15156024449999927,y:.36092494999999936},bottom1:{type:"text",text:"{VAL}",x:.0393233555000001,y:-.42489435000000064}},refblocks:{top1:{x:.2843894554999997,y:.5519248499999992},bottom1:{x:.29108805550000105,y:-.5519248499999994},left1:{x:-.3990097444999998,y:-.004526550000000462}},bounds:{width:.8543363709999996,height:1.1601665819999987,centerX:27755575615628914e-33,centerY:-5551115123125783e-32},circles:{path1:{type:"circle",x:.13862605549999985,y:.003454549999999612,radius:.28854213,color:"primary",fill:!1}}},{paths:qyn,texts:AQe,bounds:_j,refblocks:Ede,circles:Yyn}=Gyn,PQe=Wm({primitives:[...Object.values(qyn),...Object.values(Yyn),{...AQe.top1,anchor:"middle_right",x:0},{...AQe.bottom1,anchor:"middle_right",x:0}],ports:[{...Ede.top1,labels:["1","drain"]},{...Ede.bottom1,labels:["2","source"]},{...Ede.left1,labels:["3","gate"]}],size:{width:_j.width,height:_j.height},center:{x:_j.centerX,y:_j.centerY}}),NQe=Pl(PQe),DQe=NQe.primitives.filter(n=>n.type==="text"),Tde=DQe.find(n=>n.text==="{VAL}");Tde.x=-.35,Tde.y=0,Tde.anchor="middle_right";var Mde=DQe.find(n=>n.text==="{REF}");Mde.y=0,Mde.x=.35,Mde.anchor="middle_left";var Xyn=NQe,Cde={paths:{path11:{type:"path",points:[{x:-.3850939444999988,y:-.0036735999999999436},{x:.0587620555000008,y:-.0062965999999997635}],color:"primary",fill:!1},"path40-0":{type:"path",points:[{x:.07400475550000118,y:.2689528999999997},{x:.07335475550000092,y:-.2789230000000007}],color:"primary",fill:!1},"path40-0-5":{type:"path",points:[{x:.2754149555000005,y:.24180210000000013},{x:.07955815550000045,y:.10822479999999968}],color:"primary",fill:!1},"path40-0-5-0":{type:"path",points:[{x:.2868554555000009,y:-.24134789999999984},{x:.09194705550000082,y:-.10807689999999992}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.2851204555,y:.25311099999999964},{x:.2860204555000001,y:.5377640999999995}],color:"primary",fill:!1},"path12-1-5-3":{type:"path",points:[{x:.2851204555,y:-.5376890000000012},{x:.2860204555000001,y:-.25303590000000065}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.1882816555000013,y:-.10097660000000008},{x:.11555775550000158,y:-.20483720000000027},{x:.22425775550000182,y:-.20446720000000007},{x:.1882816555000013,y:-.10097660000000008}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.07802354449999971,y:.3596647999999991},bottom1:{type:"text",text:"{VAL}",x:-.0679100444999996,y:-.4129789000000006}},refblocks:{top1:{x:.28556045550000064,y:.5519250999999994},bottom1:{x:.285560455500002,y:-.5519250999999992},left1:{x:-.3990097444999998,y:-.004526300000000871}},bounds:{minX:-.4271681854999998,maxX:.4271681855000001,minY:-.5800835409999991,maxY:.5800835409999994,width:.8543363709999998,height:1.1601670819999985,centerX:13877787807814457e-32,centerY:11102230246251565e-32},circles:{"path1-0":{type:"circle",x:.13862605550000007,y:.003454799999999203,radius:.28854213,color:"primary",fill:!1}}},{paths:LSn,texts:OSn,bounds:zSn,refblocks:USn,circles:kSn}=Cde,LQe=cd(Cde).changeTextAnchor("{VAL}","middle_right").labelPort("left1",["3"]).labelPort("top1",["2"]).labelPort("bottom1",["1"]).changeTextAnchor("{REF}","middle_right").build(),Wyn=Pl(LQe),Zyn=Wyn.primitives.filter(n=>n.type==="text"),Qyn=Zyn.find(n=>n.text==="{REF}");Qyn.anchor="middle_left";var Kyn=cd(Cde).rotateRightFacingSymbol("down").changeTextAnchor("{VAL}","middle_right").labelPort("left1",["3"]).labelPort("top1",["2"]).labelPort("bottom1",["1"]).changeTextAnchor("{REF}","middle_left").build(),Jyn={paths:{path40:{type:"path",points:[{x:.14458890000000002,y:.0390362999999998},{x:-.3199943999999995,y:-.21132800000000015}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.3199943999999995,y:.31132800000000016},{x:.14458890000000002,y:.0390362999999998}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.3199943999999995,y:-.21132800000000015},{x:-.3199943999999995,y:.31132800000000016}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.3199943999999995,y:.1790362999999998},{x:-.58168694,y:.1790362999999998}],color:"primary",fill:!1},path45:{type:"path",points:[{x:-.3199943999999995,y:-.0890362999999998},{x:-.58168694,y:-.0890362999999998}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.4233797000000002,y:.03895110000000024},{x:.1496715999999998,y:.03895110000000024}],color:"primary",fill:!1},"rect1577-3":{type:"path",points:[{x:-.19898460000000012,y:.1790362999999998},{x:-.26995180000000035,y:.1790362999999998}],color:"primary",fill:!0},"rect1577-4":{type:"path",points:[{x:-.19898460000000012,y:-.0890362999999998},{x:-.26995180000000035,y:-.0890362999999998}],color:"primary",fill:!0},"rect1577-4-7":{type:"path",points:[{x:-.23480170000000036,y:-.05337805000000034},{x:-.23480170000000036,y:-.12434525000000014}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999996715,y:.4188453},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999977319,y:-.29994529999999997}},refblocks:{left1:{x:-.56868694,y:.1790362999999998},left2:{x:-.56868694,y:-.0890362999999998},right1:{x:.4291470999999999,y:.03889609999999988}},bounds:{minX:-.5473055410000001,maxX:.5473055409999998,minY:-.37884529999999994,maxY:.26884529999999995,width:1.094611082,height:.2976905999999999,centerX:-11102230246251565e-32,centerY:.05499999999999999},circles:{}},xj=cd(Jyn).labelPort("left1",["1","inp1"]).labelPort("left2",["2","inp2"]).labelPort("right1",["3","out"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),evn=Pl(xj,"down"),tvn=Pl(xj,"left"),nvn=Pl(xj,"up"),rvn={paths:{path40:{type:"path",points:[{x:.14458890000000002,y:.0390362999999998},{x:-.3199943999999995,y:-.21132800000000015}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.3199943999999995,y:.31132800000000016},{x:.14458890000000002,y:.0390362999999998}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.3199943999999995,y:-.21132800000000015},{x:-.3199943999999995,y:.31132800000000016}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.3199943999999995,y:.1790362999999998},{x:-.58168694,y:.1790362999999998}],color:"primary",fill:!1},path45:{type:"path",points:[{x:-.3199943999999995,y:-.0890362999999998},{x:-.58168694,y:-.0890362999999998}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.4233797000000002,y:.03895110000000024},{x:.1496715999999998,y:.03895110000000024}],color:"primary",fill:!1},"path44-1":{type:"path",points:[{x:-.09945180000000035,y:.43895110000000026},{x:-.09945180000000035,y:.1790362999999998}],color:"primary",fill:!1},"path44-2":{type:"path",points:[{x:-.09345180000000035,y:-.3389511000000002},{x:-.09345180000000035,y:-.0890362999999998}],color:"primary",fill:!1},"rect1577-3":{type:"path",points:[{x:-.19898460000000012,y:.1790362999999998},{x:-.26995180000000035,y:.1790362999999998}],color:"primary",fill:!0},"rect1577-4":{type:"path",points:[{x:-.19898460000000012,y:-.0890362999999998},{x:-.26995180000000035,y:-.0890362999999998}],color:"primary",fill:!0},"rect1577-4-7":{type:"path",points:[{x:-.23485180000000036,y:.14405005000000035},{x:-.23485180000000036,y:.2150405000000014}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:.2502509999999967,y:.31884529999999994},bottom1:{type:"text",text:"{VAL}",x:.2502509999999967,y:-.23599529999999996}},refblocks:{left1:{x:-.56868694,y:.1790362999999998},left2:{x:-.56868694,y:-.0890362999999998},right1:{x:.4291470999999999,y:.03889609999999988},top2:{x:-.09945180000000035,y:.43895110000000026},bottom1:{x:-.09345180000000035,y:-.3389511000000002}},bounds:{minX:-.5473055410000001,maxX:.5473055409999998,minY:-.37884529999999994,maxY:.26884529999999995,width:1.094611082,height:.2976905999999999,centerX:-11102230246251565e-32,centerY:.05499999999999999},circles:{}},bj=cd(rvn).labelPort("left1",["1","inp1"]).labelPort("left2",["2","inp2"]).labelPort("right1",["3","out"]).labelPort("top2",["4","V+"]).labelPort("bottom1",["5","V-"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),ivn=Pl(bj,"down"),avn=Pl(bj,"left"),ovn=Pl(bj,"up"),svn={paths:{path11:{type:"path",points:[{x:-.39274354450000026,y:-.10329954999999957},{x:.05111245549999932,y:-.1059225499999994}],color:"primary",fill:!1},path40:{type:"path",points:[{x:.09373835550000087,y:.18559775000000034},{x:.09280835550000122,y:-.18255174999999935}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:.30382435550000064,y:.53233025},{x:.3032243555000005,y:.10600584999999985}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.3108281555000003,y:-.5323308500000001},{x:.31142815550000025,y:-.005876249999999805}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.09383795549999951,y:.10788365000000044},{x:.31104975549999936,y:.10659565000000004}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:.09383795549999951,y:-.10232114999999986},{x:.31104975549999936,y:-.10360915000000026}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.20244405549999955,y:.03061555000000049},{x:.20244405549999955,y:-.04077654999999947},{x:.2741990554999998,y:-.0054987499999992195},{x:.20244405549999955,y:.03061555000000049}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:.09383795549999951,y:-.004018049999999551},{x:.31104975549999936,y:-.005306049999999729}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:.05171245550000081,y:.16715385000000005},{x:.05111245550000065,y:-.10592255000000006}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.13197254449999907,y:.36092494999999936},bottom1:{type:"text",text:"{VAL}",x:.05891105550000031,y:-.42489435000000064}},refblocks:{top1:{x:.30397715549999993,y:.5519248499999992},bottom1:{x:.31067575550000126,y:-.5519248499999994},left1:{x:-.41859744450000025,y:-.10250625000000024}},bounds:{width:.8935117710000002,height:1.1601665819999987,centerX:-8326672684688674e-32,centerY:-5551115123125783e-32},circles:{path1:{type:"circle",x:.15821375550000005,y:.003454549999999612,radius:.28854213,color:"primary",fill:!1}}},{paths:lvn,texts:OQe,bounds:Sj,refblocks:Rde,circles:cvn}=svn,zQe=Wm({primitives:[...Object.values(lvn),...Object.values(cvn),{...OQe.top1,anchor:"middle_right",x:0},{...OQe.bottom1,anchor:"middle_right",x:0}],ports:[{...Rde.top1,labels:["1","drain"]},{...Rde.bottom1,labels:["2","source"]},{...Rde.left1,labels:["3","gate"]}],size:{width:Sj.width,height:Sj.height},center:{x:Sj.centerX,y:Sj.centerY}}),UQe=Pl(zQe),kQe=UQe.primitives.filter(n=>n.type==="text"),Ade=kQe.find(n=>n.text==="{VAL}");Ade.x=-.35,Ade.y=0,Ade.anchor="middle_right";var Pde=kQe.find(n=>n.text==="{REF}");Pde.y=0,Pde.x=.35,Pde.anchor="middle_left";var uvn=UQe,fvn={paths:{path11:{type:"path",points:[{x:-.39274354450000026,y:-.10329954999999957},{x:.05111245549999932,y:-.1059225499999994}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:.30382435550000064,y:.53233025},{x:.3032243555000005,y:.10600584999999985}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.3108281555000003,y:-.5323308500000001},{x:.31142815550000025,y:-.005876249999999805}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.09383795549999951,y:.10788365000000044},{x:.31104975549999936,y:.10659565000000004}],color:"primary",fill:!1},"path2-8-3-7":{type:"path",points:[{x:.09448295549999952,y:.14677165000000048},{x:.09319295549999951,y:.06899565000000041}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:.09383795549999951,y:-.10232114999999986},{x:.31104975549999936,y:-.10360915000000026}],color:"primary",fill:!1},"path2-8-3":{type:"path",points:[{x:.09440455549999993,y:-.07703174999999951},{x:.09311455549999992,y:-.15480774999999958}],color:"primary",fill:!1},"path2-8-3-2":{type:"path",points:[{x:.09448295549999952,y:.03486995000000048},{x:.09319295549999951,y:-.042906049999999585}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.20244405549999955,y:.03061555000000049},{x:.20244405549999955,y:-.04077654999999947},{x:.2741990554999998,y:-.0054987499999992195},{x:.20244405549999955,y:.03061555000000049}],color:"primary",fill:!0},"path2-0":{type:"path",points:[{x:.09383795549999951,y:-.004018049999999551},{x:.31104975549999936,y:-.005306049999999729}],color:"primary",fill:!1},"path12-1-0":{type:"path",points:[{x:.05171245550000081,y:.10847375000000059},{x:.05111245550000065,y:-.1059225499999994}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.13197254449999907,y:.36092494999999936},bottom1:{type:"text",text:"{VAL}",x:.05891105550000031,y:-.42489435000000064}},refblocks:{top1:{x:.30397715549999993,y:.5519248499999992},bottom1:{x:.31067575550000126,y:-.5519248499999994},left1:{x:-.41859744450000025,y:-.10250625000000024}},bounds:{width:.8935117710000002,height:1.1601665819999987,centerX:-8326672684688674e-32,centerY:-5551115123125783e-32},circles:{path1:{type:"circle",x:.15821375550000005,y:.003454549999999612,radius:.28854213,color:"primary",fill:!1}}},{paths:dvn,texts:IQe,bounds:wj,refblocks:Nde,circles:pvn}=fvn,FQe=Wm({primitives:[...Object.values(dvn),...Object.values(pvn),{...IQe.top1,anchor:"middle_right",x:0},{...IQe.bottom1,anchor:"middle_right",x:0}],ports:[{...Nde.top1,labels:["1","drain"]},{...Nde.bottom1,labels:["2","source"]},{...Nde.left1,labels:["3","gate"]}],size:{width:wj.width,height:wj.height},center:{x:wj.centerX,y:wj.centerY}}),BQe=Pl(FQe),jQe=BQe.primitives.filter(n=>n.type==="text"),Dde=jQe.find(n=>n.text==="{VAL}");Dde.x=-.35,Dde.y=0,Dde.anchor="middle_right";var Lde=jQe.find(n=>n.text==="{REF}");Lde.y=0,Lde.x=.35,Lde.anchor="middle_left";var hvn=BQe,mvn={paths:{path11:{type:"path",points:[{x:-.5274831500000005,y:-.012413549999999773},{x:-.14891374999999973,y:-.015036549999999593}],color:"primary",fill:!1},path40:{type:"path",points:[{x:.13221874999999983,y:-.001352349999999447},{x:-.1323642500000004,y:-.13364404999999913}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.1323642500000004,y:.13093935000000023},{x:.13221874999999983,y:-.001352349999999447}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.1323642500000004,y:-.1336440499999998},{x:-.1323642500000004,y:.13093935000000023}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.13221874999999983,y:.13093935000000023},{x:.13221874999999983,y:-.1336440499999998}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.1358253500000004,y:-.001921149999999372},{x:.533952450000001,y:-.012413549999999107}],color:"primary",fill:!1},"path25-0":{type:"path",points:[{x:.19839785000000076,y:.37576625000000075},{x:.16262485000000027,y:.28367475000000053},{x:.26033484999999956,y:.2989800500000006}],color:"primary",fill:!0},"path78-6":{type:"path",points:[{x:.3305468500000004,y:.4264014500000006},{x:.31941585000000017,y:.4163797500000006},{x:.20669285000000048,y:.3148875500000008},{x:.20564285000000115,y:.31448755000000084}],color:"primary",fill:!1},"path25-0-9":{type:"path",points:[{x:.34573984999999974,y:.3493283500000002},{x:.30996684999999946,y:.25723684999999996},{x:.40767644999999963,y:.27254215000000004}],color:"primary",fill:!0},"path78-6-5":{type:"path",points:[{x:.47788845000000046,y:.39996355000000006},{x:.46675745000000024,y:.38994185000000003},{x:.35403445000000033,y:.2884496500000002},{x:.352984450000001,y:.2880496500000005}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.10246254999999982,y:.34693914999999986},bottom1:{type:"text",text:"{VAL}",x:.0012544500000004621,y:-.4264014500000004}},refblocks:{left1:{x:-.5413984499999998,y:-.013266350000000315},right1:{x:.54139845,y:-.012269950000000529}},bounds:{minX:-.5695568909999997,maxX:.569556891,minY:-.4264014500000004,maxY:.4264014500000006,width:1.1391137819999997,height:.852802900000001,centerX:11102230246251565e-32,centerY:11102230246251565e-32},circles:{path1:{type:"circle",x:-.0037626500000000895,y:-.005285250000000241,radius:.28854213,color:"primary",fill:!1}}},HQe=cd(mvn).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),VQe=Pl(HQe),yvn=VQe.primitives.filter(n=>n.type==="text"),$Qe=yvn.find(n=>n.text==="{REF}");$Qe.y=0,$Qe.anchor="middle_left";var vvn=VQe,gvn={paths:{path11:{type:"path",points:[{x:-.38509374449999945,y:-.00367374999999992},{x:.05876225550000025,y:-.00629674999999974}],color:"primary",fill:!1},path40:{type:"path",points:[{x:.07415065550000066,y:.18559775000000034},{x:.07322065550000101,y:-.18255174999999935}],color:"primary",fill:!1},"path12-1":{type:"path",points:[{x:.28423665550000043,y:.53233025},{x:.2836366555000003,y:.10600584999999985}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.2912404555000001,y:-.5298821500000002},{x:.29184045550000004,y:-.10355795000000012}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.07425025549999931,y:.10788365000000044},{x:.29146205549999915,y:.10659565000000004}],color:"primary",fill:!1},"path2-5":{type:"path",points:[{x:.07425025549999931,y:-.10232114999999986},{x:.29146205549999915,y:-.10360915000000026}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.005945155500000077,y:-.06535114999999969},{x:.005945155500000077,y:.06153284999999986},{x:-.0829488445000004,y:-.001166149999999977},{x:.005945155500000077,y:-.06535114999999969}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.15156024449999927,y:.36092494999999936},bottom1:{type:"text",text:"{VAL}",x:.0393233555000001,y:-.42489435000000064}},refblocks:{top1:{x:.2843894554999997,y:.5519248499999992},bottom1:{x:.29108805550000105,y:-.5519248499999994},left1:{x:-.3990097444999998,y:-.004526550000000462}},bounds:{width:.8543363709999996,height:1.1601665819999987,centerX:27755575615628914e-33,centerY:-5551115123125783e-32},circles:{path1:{type:"circle",x:.13862605549999985,y:.003454549999999612,radius:.28854213,color:"primary",fill:!1}}},{paths:_vn,texts:GQe,bounds:Ej,refblocks:Ode,circles:xvn}=gvn,qQe=Wm({primitives:[...Object.values(_vn),...Object.values(xvn),{...GQe.top1,anchor:"middle_right",x:0},{...GQe.bottom1,anchor:"middle_right"}],ports:[{...Ode.top1,labels:["1","drain"]},{...Ode.bottom1,labels:["2","source"]},{...Ode.left1,labels:["3","gate"]}],size:{width:Ej.width,height:Ej.height},center:{x:Ej.centerX,y:Ej.centerY}}),YQe=Pl(qQe),XQe=YQe.primitives.filter(n=>n.type==="text"),zde=XQe.find(n=>n.text==="{VAL}");zde.x=-.35,zde.y=0,zde.anchor="middle_right";var Ude=XQe.find(n=>n.text==="{REF}");Ude.y=0,Ude.x=.35,Ude.anchor="middle_left";var bvn=YQe,WQe={paths:{path11:{type:"path",points:[{x:-.3850939444999988,y:-.0036735999999999436},{x:.0587620555000008,y:-.0062965999999997635}],color:"primary",fill:!1},"path40-0":{type:"path",points:[{x:.07400475550000118,y:.2689528999999997},{x:.07335475550000092,y:-.2789230000000007}],color:"primary",fill:!1},"path40-0-5":{type:"path",points:[{x:.2754149555000005,y:.24180210000000013},{x:.07955815550000045,y:.10822479999999968}],color:"primary",fill:!1},"path40-0-5-0":{type:"path",points:[{x:.2868554555000009,y:-.24134789999999984},{x:.09194705550000082,y:-.10807689999999992}],color:"primary",fill:!1},"path12-1-5":{type:"path",points:[{x:.2851204555,y:.25311099999999964},{x:.2860204555000001,y:.5377640999999995}],color:"primary",fill:!1},"path12-1-5-3":{type:"path",points:[{x:.2851204555,y:-.5376890000000012},{x:.2860204555000001,y:-.25303590000000065}],color:"primary",fill:!1},path15:{type:"path",points:[{x:.15155145550000038,y:-.2268796000000004},{x:.2242753555000001,y:-.12301900000000021},{x:.11557535549999942,y:-.12338900000000042},{x:.15155145550000038,y:-.2268796000000004}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.08351674449999891,y:.37335419999999897},bottom1:{type:"text",text:"{VAL}",x:-.0679100444999996,y:-.4129789000000006}},refblocks:{top1:{x:.28556045550000064,y:.5519250999999994},bottom1:{x:.285560455500002,y:-.5519250999999992},left1:{x:-.3990097444999998,y:-.004526300000000871}},bounds:{minX:-.4271681854999998,maxX:.4271681855000001,minY:-.5800835409999991,maxY:.5800835409999994,width:.8543363709999998,height:1.1601670819999985,centerX:13877787807814457e-32,centerY:11102230246251565e-32},circles:{"path1-0":{type:"circle",x:.13862605550000007,y:.003454799999999203,radius:.28854213,color:"primary",fill:!1}}},ZQe=cd(WQe).changeTextAnchor("{VAL}","middle_right").labelPort("left1",["3"]).labelPort("bottom1",["2"]).labelPort("top1",["1"]).changeTextAnchor("{REF}","middle_right").build(),Svn=Pl(ZQe),wvn=Svn.primitives.filter(n=>n.type==="text"),Evn=wvn.find(n=>n.text==="{REF}");Evn.anchor="middle_left";var Tvn=cd(WQe).rotateRightFacingSymbol("down").changeTextAnchor("{VAL}","middle_right").labelPort("left1",["3"]).labelPort("bottom1",["2"]).labelPort("top1",["1"]).changeTextAnchor("{REF}","middle_left").build(),Mvn={paths:{path40:{type:"path",points:[{x:-.19250837381256392,y:.32749349347032286},{x:-.25568957329611974,y:.13794979950157282}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.38205206778131373,y:.26431229398676837},{x:-.19250837381256392,y:.32749349347032286}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.2556895732961204,y:.13794979950157416},{x:-.38205206778131373,y:.26431229398676837}],color:"primary",fill:!1},path43:{type:"path",points:[{x:-.2556896210551609,y:.39067474071292196},{x:-.12932712656996737,y:.26431224622772653}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.3199237641156438,y:.2000781031672434},{x:-.5084145145074668,y:.011587352775420667}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:-.011560829633404435,y:.5083596562436202},{x:-.19004023433272543,y:.3298802515442989}],color:"primary",fill:!1},"path40-4":{type:"path",points:[{x:-.19250813152967883,y:-.3220463011874377},{x:-.38205182549842887,y:-.2588651017038819}],color:"primary",fill:!1},"path41-1":{type:"path",points:[{x:-.2556893310132333,y:-.13250260721868767},{x:-.19250813152967883,y:-.3220463011874377}],color:"primary",fill:!1},"path42-7":{type:"path",points:[{x:-.38205182549842753,y:-.258865101703881},{x:-.2556893310132333,y:-.13250260721868767}],color:"primary",fill:!1},"path43-1":{type:"path",points:[{x:-.12932688428707984,y:-.2588650539448407},{x:-.25568937877227516,y:-.38522754843003404}],color:"primary",fill:!1},"path44-8":{type:"path",points:[{x:-.3199235218327583,y:-.19463091088435758},{x:-.508414272224581,y:-.006140160492534852}],color:"primary",fill:!1},"path44-0-7":{type:"path",points:[{x:-.011641968756381349,y:-.5029938453665972},{x:-.1901213734557028,y:-.3245144406672762}],color:"primary",fill:!1},"path40-4-0":{type:"path",points:[{x:.322578868470321,y:.19315369881256328},{x:.13303517450157099,y:.2563348982961191}],color:"primary",fill:!1},"path41-1-2":{type:"path",points:[{x:.2593976689867663,y:.3826973927813131},{x:.322578868470321,y:.19315369881256328}],color:"primary",fill:!1},"path42-7-1":{type:"path",points:[{x:.13303517450157232,y:.2563348982961198},{x:.2593976689867663,y:.3826973927813131}],color:"primary",fill:!1},"path43-1-8":{type:"path",points:[{x:.38576011571292,y:.2563349460551603},{x:.2593976212277247,y:.12997245156996673}],color:"primary",fill:!1},"path44-8-7":{type:"path",points:[{x:.19516347816724133,y:.3205690891156432},{x:.006672727775418608,y:.509059839507466}],color:"primary",fill:!1},"path44-0-7-1":{type:"path",points:[{x:.5034450312436185,y:.012206154633403798},{x:.32496562654429706,y:.19068555933272457}],color:"primary",fill:!1},"path40-4-8":{type:"path",points:[{x:.3220220261874358,y:-.19326390652967795},{x:.25884082670387976,y:-.382807600498428}],color:"primary",fill:!1},"path41-1-4":{type:"path",points:[{x:.13247833221868577,y:-.25644510601323245},{x:.3220220261874358,y:-.19326390652967795}],color:"primary",fill:!1},"path42-7-0":{type:"path",points:[{x:.2588408267038793,y:-.38280760049842666},{x:.13247833221868577,y:-.25644510601323245}],color:"primary",fill:!1},"path43-1-0":{type:"path",points:[{x:.2588407789448386,y:-.13008265928707896},{x:.38520327343003213,y:-.2564451537722743}],color:"primary",fill:!1},"path44-8-9":{type:"path",points:[{x:.19460663588435567,y:-.3206792968327574},{x:.0061158854925329464,y:-.5091700472245801}],color:"primary",fill:!1},"path44-0-7-3":{type:"path",points:[{x:.5029695703665951,y:-.012397743756380697},{x:.3244901656672745,y:-.19087714845570192}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.2872803000000015,y:.4564494249999992},bottom1:{type:"text",text:"{VAL}",x:-.2872803000000015,y:-.4960514750000007}},refblocks:{left1:{x:-.5191472999999998,y:.0005123250000014234},right1:{x:.5191473000000002,y:-.0005123749999977889}},bounds:{width:1.094611482,height:1.0946118820000001,centerX:2220446049250313e-31,centerY:-5551115123125783e-32}},{paths:Cvn,texts:QQe,bounds:Tj,refblocks:KQe}=Mvn,JQe=Wm({primitives:[...Object.values(Cvn),{...QQe.bottom1,y:.35,anchor:"middle_top"},{...QQe.top1,anchor:"middle_left"}],ports:[{...KQe.left1,labels:["1"]},{...KQe.right1,labels:["2"]}],size:{width:Tj.width+.05,height:Tj.height},center:{x:Tj.centerX,y:Tj.centerY}}),Rvn=Pl(JQe),Avn=Rvn,Pvn={paths:{path18:{type:"path",points:[{x:-.53224045,y:-.0008545000000008685},{x:-.26765715000000023,y:-.0008545000000008685}],color:"primary",fill:!1},path19:{type:"path",points:[{x:.2615098499999995,y:-.0008545000000008685},{x:.5260934499999994,y:-.0008545000000008685}],color:"primary",fill:!1},path20:{type:"path",points:[{x:-.0030722500000006647,y:.1314371999999988},{x:.2615107499999998,y:.1314371999999988},{x:.2615107499999998,y:-.13314619999999877},{x:-.26765624999999993,y:-.13314619999999877},{x:-.26765624999999993,y:.1314371999999988},{x:-.0030722499999988884,y:.1314371999999988}],color:"primary",fill:!1},path23:{type:"path",points:[{x:.2782993499999993,y:-.2822274},{x:.17598844999999885,y:-.25486950000000164},{x:.25094144999999823,y:-.1799165000000027}],color:"primary",fill:!0},path24:{type:"path",points:[{x:.2882692499999995,y:-.2921307000000013},{x:.25467554999999953,y:-.16634940000000142},{x:.16229264999999948,y:-.25853690000000284}],color:"primary",fill:!0},path26:{type:"path",points:[{x:-.2985911500000009,y:.2921307000000013},{x:.22988164999999938,y:-.2328032000000011}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:.055041669999999154,y:.2009376800000009},bottom1:{type:"text",text:"{VAL}",x:-.10019643000000089,y:-.27857531999999985}},refblocks:{left1:{x:-.5346914500000006,y:-.0013439000000019519},right1:{x:.5346914500000004,y:-.001956599999999753}},bounds:{width:1.125699782000001,height:.5842614000000026,centerX:-11102230246251565e-32,centerY:0}},{paths:Nvn,texts:eKe,bounds:Mj,refblocks:tKe}=Pvn,nKe=Wm({primitives:[...Object.values(Nvn),{...eKe.bottom1,anchor:"middle_top"},{...eKe.top1,anchor:"middle_bottom"}],ports:[{...tKe.left1,labels:["1"]},{...tKe.right1,labels:["2"]}],size:{width:Mj.width,height:Mj.height},center:{x:Mj.centerX,y:Mj.centerY}}),rKe=Pl(nKe),iKe=rKe.primitives.filter(n=>n.type==="text"),Dvn=iKe.find(n=>n.text==="{VAL}");Dvn.anchor="middle_right";var Lvn=iKe.find(n=>n.text==="{REF}");Lvn.anchor="middle_left";var Ovn=rKe,zvn={paths:{path1:{type:"path",points:[{x:-.4,y:0},{x:-.3,y:0}],color:"primary",fill:!1},"path1-2-1":{type:"path",points:[{x:-.3,y:0},{x:-.25,y:.1},{x:-.15,y:-.1},{x:-.05,y:.1},{x:.05,y:-.1},{x:.15,y:.1},{x:.25,y:-.1},{x:.3,y:0}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.3,y:0},{x:.4,y:0}],color:"primary",fill:!1},path3:{type:"path",points:[{x:0,y:-.17},{x:0,y:-.4}],color:"primary",fill:!1},path15:{type:"path",points:[{x:0,y:-.12},{x:.05,y:-.2},{x:-.05,y:-.2},{x:0,y:-.12}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:.3,y:.25},bottom1:{type:"text",text:"{VAL}",x:.3,y:-.25}},refblocks:{left:{x:-.42,y:0},right:{x:.42,y:0},bottom:{x:0,y:-.4}},bounds:{minX:-.42,maxX:.42,minY:-.2,maxY:.2,width:.84,height:.4,centerX:0,centerY:0},circles:{}},Cj=cd(zvn).labelPort("left",["1"]).labelPort("right",["3"]).labelPort("bottom",["2"]).changeTextAnchor("{REF}","middle_bottom").changeTextAnchor("{VAL}","middle_top").build(),Uvn=Pl(Cj,"down"),kvn=Pl(Cj,"left"),Ivn=Pl(Cj,"up"),Fvn={paths:{path11:{type:"path",points:[{x:-.5274831500000005,y:.02812460000000061},{x:-.30105415000000013,y:.02812460000000061}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2932119499999999,y:.02812460000000061},{x:.5339524499999997,y:.02812460000000061}],color:"primary",fill:!1}},refblocks:{left1:{x:-.5413984499999998,y:.027271800000000068},right1:{x:.54139845,y:.028268199999999855}},bounds:{width:1.1391137819999997,height:.7903522000000003,centerX:11102230246251565e-32,centerY:11102230246251565e-32},circles:{path1:{type:"circle",x:-.0037626500000000895,y:.03525290000000014,radius:.28854213,color:"primary",fill:!1}}},{paths:Bvn,bounds:Rj,refblocks:aKe,circles:jvn}=Fvn,oKe=Wm({primitives:[...Object.values(Bvn),...Object.values(jvn),{type:"text",text:"{REF}",x:-.15,y:-.42330070000000064,anchor:"middle_top"},{type:"text",text:"{VAL}",x:-.15,y:.42330070000000064,anchor:"middle_bottom"},{type:"text",text:"COS φ",x:0,y:.014279000000000375,anchor:"center"}],ports:[{...aKe.left1,labels:["1"]},{...aKe.right1,labels:["2"]}],size:{width:Rj.width,height:Rj.height},center:{x:Rj.centerX,y:Rj.centerY}}),sKe=Pl(oKe),kde=sKe.primitives.filter(n=>n.type==="text"),Ide=kde.find(n=>n.text==="{REF}"),Fde=kde.find(n=>n.text==="{VAL}"),Bde=kde.find(n=>n.text==="COS φ");Ide.x=.35,Ide.y=0,Ide.anchor="middle_left",Fde.anchor="middle_right",Fde.x=-.35,Fde.y=0,Bde.x=0,Bde.y=0,Bde.anchor="center";var Hvn=sKe,Vvn={paths:{"path12-1-8-6-9-9":{type:"path",points:[{x:.013196749999999646,y:.030446500000000043},{x:.013196749999999646,y:-.0859464999999986}],color:"primary",fill:!1},"path12-1-5-6-4":{type:"path",points:[{x:-.4867871500000014,y:-.0510704999999998},{x:-.17248085000000124,y:-.0510704999999998}],color:"primary",fill:!1},"path12-1-8-0-0":{type:"path",points:[{x:-.15916995000000078,y:-.0915204999999979},{x:.1810634499999999,y:-.0915204999999979}],color:"primary",fill:!1},"path12-1-0-1":{type:"path",points:[{x:.19611864999999984,y:-.05109549999999885},{x:.48876354999999894,y:-.05109549999999885}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:.007320949999999549,y:.22461850000000005},bottom1:{type:"text",text:"{VAL}",x:-.1606897500000004,y:-.22461849999999828}},refblocks:{left1:{x:-.47241845000000104,y:-.05104349999999869},right1:{x:.47241845000000016,y:-.051482499999998765}},bounds:{width:1.0011537820000012,height:.44923699999999833,centerX:-4440892098500626e-31,centerY:8881784197001252e-31},circles:{"circle-2":{type:"circle",x:-.14387115000000072,y:-.05130149999999922,radius:.023193523,color:"primary",fill:!1},circle:{type:"circle",x:.16803074999999978,y:-.05007949999999717,radius:.023193523,color:"primary",fill:!1}}},{paths:$vn,texts:lKe,bounds:Aj,refblocks:cKe,circles:Gvn}=Vvn,uKe=Wm({primitives:[...Object.values($vn),...Object.values(Gvn),{...lKe.top1,anchor:"middle_left"},{...lKe.bottom1,anchor:"middle_left"}],ports:[{...cKe.left1,labels:["1"]},{...cKe.right1,labels:["2"]}],size:{width:Aj.width,height:Aj.height},center:{x:Aj.centerX,y:Aj.centerY}}),qvn=Pl(uKe,"up"),Yvn={paths:{"path12-1-8-6-9-9":{type:"path",points:[{x:-.04575882,y:.08981650000000013},{x:-.04575882,y:.039523500000001495}],color:"primary",fill:!1},"path12-1-8-7-9-9":{type:"path",points:[{x:-.04575882,y:.08981650000000013},{x:.06765231,y:.08981650000000013}],color:"primary",fill:!1},"path12-1-8-6-9-10":{type:"path",points:[{x:.06765231,y:.08981650000000013},{x:.06765231,y:.039523500000001495}],color:"primary",fill:!1},"path12-1-5-6-4":{type:"path",points:[{x:-.4867871500000014,y:-.0510704999999998},{x:-.17248085000000124,y:-.0510704999999998}],color:"primary",fill:!1},"path12-1-8-0-0":{type:"path",points:[{x:-.15916995000000078,y:.03984950000000042},{x:.1810634499999999,y:.03984950000000042}],color:"primary",fill:!1},"path12-1-0-1":{type:"path",points:[{x:.19611864999999984,y:-.05109549999999885},{x:.48876354999999894,y:-.05109549999999885}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:.007320949999999549,y:.29461850000000006},bottom1:{type:"text",text:"{VAL}",x:-.1606897500000004,y:-.22461849999999828}},refblocks:{left1:{x:-.47241845000000104,y:-.05104349999999869},right1:{x:.47241845000000016,y:-.051482499999998765}},bounds:{width:1.0011537820000012,height:.44923699999999833,centerX:-4440892098500626e-31,centerY:8881784197001252e-31},circles:{"circle-2":{type:"circle",x:-.14387115000000072,y:-.05130149999999922,radius:.023193523,color:"primary",fill:!1},circle:{type:"circle",x:.16803074999999978,y:-.05007949999999717,radius:.023193523,color:"primary",fill:!1}}},{paths:Xvn,texts:fKe,bounds:Pj,refblocks:dKe,circles:Wvn}=Yvn,pKe=Wm({primitives:[...Object.values(Xvn),...Object.values(Wvn),{...fKe.top1,anchor:"middle_left"},{...fKe.bottom1,anchor:"middle_left"}],ports:[{...dKe.left1,labels:["1"]},{...dKe.right1,labels:["2"]}],size:{width:Pj.width,height:Pj.height},center:{x:Pj.centerX,y:Pj.centerY}}),Zvn=Pl(pKe,"up"),Qvn={paths:{path40:{type:"path",points:[{x:-.19250837381256392,y:-.32749349347032286},{x:-.25568957329611974,y:-.13794979950157282}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.38205206778131373,y:-.26431229398676837},{x:-.19250837381256392,y:-.32749349347032286}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.2556895732961204,y:-.13794979950157416},{x:-.38205206778131373,y:-.26431229398676837}],color:"primary",fill:!1},path43:{type:"path",points:[{x:-.2556896210551609,y:-.39067474071292196},{x:-.12932712656996737,y:-.26431224622772653}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.3199237641156438,y:-.2000781031672434},{x:-.5084145145074668,y:-.011587352775420667}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:-.011560829633404435,y:-.5083596562436202},{x:-.19004023433272543,y:-.3298802515442989}],color:"primary",fill:!1},"path40-4":{type:"path",points:[{x:-.19250813152967883,y:.3220463011874377},{x:-.38205182549842887,y:.2588651017038819}],color:"primary",fill:!1},"path41-1":{type:"path",points:[{x:-.2556893310132333,y:.13250260721868767},{x:-.19250813152967883,y:.3220463011874377}],color:"primary",fill:!1},"path42-7":{type:"path",points:[{x:-.38205182549842753,y:.258865101703881},{x:-.2556893310132333,y:.13250260721868767}],color:"primary",fill:!1},"path43-1":{type:"path",points:[{x:-.12932688428707984,y:.2588650539448407},{x:-.25568937877227516,y:.38522754843003404}],color:"primary",fill:!1},"path44-8":{type:"path",points:[{x:-.3199235218327583,y:.19463091088435758},{x:-.508414272224581,y:.006140160492534852}],color:"primary",fill:!1},"path44-0-7":{type:"path",points:[{x:-.011641968756381349,y:.5029938453665972},{x:-.1901213734557028,y:.3245144406672762}],color:"primary",fill:!1},"path40-4-0":{type:"path",points:[{x:.322578868470321,y:-.19315369881256328},{x:.13303517450157099,y:-.2563348982961191}],color:"primary",fill:!1},"path41-1-2":{type:"path",points:[{x:.2593976689867663,y:-.3826973927813131},{x:.322578868470321,y:-.19315369881256328}],color:"primary",fill:!1},"path42-7-1":{type:"path",points:[{x:.13303517450157232,y:-.2563348982961198},{x:.2593976689867663,y:-.3826973927813131}],color:"primary",fill:!1},"path43-1-8":{type:"path",points:[{x:.38576011571292,y:-.2563349460551603},{x:.2593976212277247,y:-.12997245156996673}],color:"primary",fill:!1},"path44-8-7":{type:"path",points:[{x:.19516347816724133,y:-.3205690891156432},{x:.006672727775418608,y:-.509059839507466}],color:"primary",fill:!1},"path44-0-7-1":{type:"path",points:[{x:.5034450312436185,y:-.012206154633403798},{x:.32496562654429706,y:-.19068555933272457}],color:"primary",fill:!1},"path40-4-8":{type:"path",points:[{x:.3220220261874358,y:.19326390652967795},{x:.25884082670387976,y:.382807600498428}],color:"primary",fill:!1},"path41-1-4":{type:"path",points:[{x:.13247833221868577,y:.25644510601323245},{x:.3220220261874358,y:.19326390652967795}],color:"primary",fill:!1},"path42-7-0":{type:"path",points:[{x:.2588408267038793,y:.38280760049842666},{x:.13247833221868577,y:.25644510601323245}],color:"primary",fill:!1},"path43-1-0":{type:"path",points:[{x:.2588407789448386,y:.13008265928707896},{x:.38520327343003213,y:.2564451537722743}],color:"primary",fill:!1},"path44-8-9":{type:"path",points:[{x:.19460663588435567,y:.3206792968327574},{x:.0061158854925329464,y:.5091700472245801}],color:"primary",fill:!1},"path44-0-7-3":{type:"path",points:[{x:.5029695703665951,y:.012397743756380697},{x:.3244901656672745,y:.19087714845570192}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.2872803000000015,y:-.4564494249999992},bottom1:{type:"text",text:"{VAL}",x:-.2872803000000015,y:.4960514750000007}},refblocks:{top1:{x:.0005126999999993664,y:-.5191475},bottom1:{x:-.0005123000000009093,y:.5191475000000001},left1:{x:-.5191472999999998,y:-.0005123250000014234},right1:{x:.5191473000000002,y:.0005123749999977889}},bounds:{width:1.094611482,height:1.1037553659999992,centerX:2220446049250313e-31,centerY:-.004571741999999546},circles:{}},{paths:Kvn,texts:hKe,bounds:Nj,refblocks:Dj,circles:Jvn}=Qvn,mKe=Wm({primitives:[...Object.values(Kvn),...Object.values(Jvn),{...hKe.top1,anchor:"middle_right"},{...hKe.bottom1,anchor:"middle_right"}],ports:[{...Dj.top1,labels:["1"]},{...Dj.bottom1,labels:["2"]},{...Dj.left1,labels:["3"]},{...Dj.right1,labels:["4"]}],size:{width:Nj.width,height:Nj.height},center:{x:Nj.centerX,y:Nj.centerY}}),jde=Pl(mKe),egn=jde.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),tgn=jde.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");egn.anchor="middle_left",tgn.anchor="middle_right";var ngn=jde,rgn={paths:{path27:{type:"path",points:[{x:.7635944500000007,y:-.2799544500000035},{x:.3138028500000005,y:-.2799544500000035}],color:"primary",fill:!1},path28:{type:"path",points:[{x:-.301017949999999,y:-.01524775000000389},{x:-.7508096499999994,y:-.01524775000000389}],color:"primary",fill:!1},path30:{type:"path",points:[{x:-.3010179499999994,y:.3480486499999973},{x:-.301017949999999,y:-.2798310500000021}],color:"primary",fill:!1},"path27-3":{type:"path",points:[{x:.7729788499999999,y:.3512451499999969},{x:.32318725000000015,y:.3512451499999969}],color:"primary",fill:!1},"path29-5":{type:"path",points:[{x:-.07279374999999932,y:-.27981925000000274},{x:-.2983350499999995,y:-.27981925000000274}],color:"primary",fill:!1},"path29-5-7":{type:"path",points:[{x:.33114835000000076,y:-.2798404500000018},{x:.10560705000000059,y:-.2798404500000018}],color:"primary",fill:!1},"path29-5-7-6":{type:"path",points:[{x:-.055820049999999455,y:-.1676584500000029},{x:-.055820049999999455,y:-.3931997500000026}],color:"primary",fill:!1},"path29-5-7-6-6":{type:"path",points:[{x:.09396265000000081,y:-.16768285000000382},{x:.09396265000000081,y:-.39322415000000355}],color:"primary",fill:!1},"path29-5-9":{type:"path",points:[{x:-.07296184999999955,y:.3513701499999957},{x:-.2985031499999997,y:.3513701499999957}],color:"primary",fill:!1},"path29-5-7-2":{type:"path",points:[{x:.33098025000000053,y:.35134894999999844},{x:.10543895000000036,y:.35134894999999844}],color:"primary",fill:!1},"path29-5-7-6-0":{type:"path",points:[{x:-.05598814999999968,y:.46353094999999733},{x:-.05598814999999968,y:.23798964999999583}],color:"primary",fill:!1},"path29-5-7-6-6-2":{type:"path",points:[{x:.09379455000000014,y:.4635065499999982},{x:.09379455000000014,y:.23796524999999846}],color:"primary",fill:!1},"path29-5-92":{type:"path",points:[{x:.3315317500000008,y:.12563884999999786},{x:.33153175000000035,y:.3511801499999976}],color:"primary",fill:!1},"path29-5-7-28":{type:"path",points:[{x:.3315105500000004,y:-.2783032500000022},{x:.3315105500000004,y:-.0527619500000025}],color:"primary",fill:!1},"path29-5-7-6-9":{type:"path",points:[{x:.44369255000000063,y:.10866514999999843},{x:.21815125000000046,y:.10866514999999843}],color:"primary",fill:!1},"path29-5-7-6-6-7":{type:"path",points:[{x:.4436681500000006,y:-.04111755000000272},{x:.21812685000000043,y:-.04111755000000272}],color:"primary",fill:!1},"path29-5-7-6-9-2":{type:"path",points:[{x:.44235445000000073,y:.07167004999999627},{x:.21681315000000057,y:.07167004999999627}],color:"primary",fill:!1},"path29-5-7-6-9-2-4":{type:"path",points:[{x:.4429695500000004,y:-.0025598500000008073},{x:.4430214500000007,y:.07134914999999609}],color:"primary",fill:!1},"path29-5-7-6-9-2-4-6":{type:"path",points:[{x:.21634305000000031,y:-.0035468500000046532},{x:.21639495000000064,y:.07036214999999935}],color:"primary",fill:!1},"path29-5-7-6-9-2-9":{type:"path",points:[{x:.4429537500000005,y:-.004130850000002795},{x:.21741245000000076,y:-.004130850000002795}],color:"primary",fill:!1}},refblocks:{left1:{x:-.7666234499999998,y:-.01615045000000137},right1:{x:.7572390499999999,y:-.28185235000000297},right2:{x:.7666234500000004,y:.3493472499999992}},bounds:{width:1.5895637820000001,height:1.0717002999999998,centerX:33306690738754696e-32,centerY:-17763568394002505e-31},circles:{}},{paths:ign,bounds:Lj,refblocks:Hde,circles:agn}=rgn,yKe=Wm({primitives:[...Object.values(ign),...Object.values(agn),{type:"text",text:"{REF}",x:.01596175000000022,y:-.5308501500000009,anchor:"middle_top"},{type:"text",text:"{VAL}",x:.013116750000000454,y:.5408501499999989,anchor:"middle_bottom"}],ports:[{...Hde.left1,labels:["1"]},{...Hde.right1,labels:["2"]},{...Hde.right2,labels:["3"]}],size:{width:Lj.width,height:Lj.height},center:{x:Lj.centerX,y:Lj.centerY}}),ogn=Pl(yKe),sgn={paths:{path40:{type:"path",points:[{x:.14458930000000048,y:.04403649999999937},{x:-.11999399999999905,y:-.0882552000000012}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.11999400000000038,y:.1763281999999997},{x:.14458929999999914,y:.04403649999999937}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.11999400000000038,y:-.0882552000000012},{x:-.11999400000000038,y:.17632819999999816}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.1435300000000006,y:.17844679999999968},{x:.14458899999999986,y:-.08825519999999965}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.12219870000000044,y:.04403649999999937},{x:-.5168690000000005,y:.04403649999999937}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.5233800999999991,y:.043951299999999804},{x:.14967199999999892,y:.043951299999999804}],color:"primary",fill:!1},"path43-7":{type:"path",points:[{x:.2075533999999999,y:.17973149999999904},{x:.14341080000000028,y:.17864949999999946}],color:"primary",fill:!1},"path43-7-9":{type:"path",points:[{x:.2093444999999996,y:.1301679},{x:.20797049999999984,y:.17950350000000048}],color:"primary",fill:!1},"path43-7-2":{type:"path",points:[{x:.07978989999999953,y:-.09023340000000024},{x:.14313979999999948,y:-.09001340000000013}],color:"primary",fill:!1},"path43-7-9-3":{type:"path",points:[{x:.07764390000000043,y:-.04104850000000004},{x:.0790179000000002,y:-.09038410000000074}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999994495,y:.27384530000000007},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999977319,y:-.27384530000000007}},refblocks:{left1:{x:-.5191471,y:.044920799999999206},right1:{x:.5191470999999999,y:.04389609999999999}},bounds:{minX:-.547305541,maxX:.5473055409999998,minY:-.27384530000000007,maxY:.27384530000000007,width:1.0946110819999997,height:.5476906000000001,centerX:-5551115123125783e-32,centerY:0},circles:{}},vKe=cd(sgn).labelPort("left1",["1","pos"]).labelPort("right1",["2","neg"]).changeTextAnchor("{VAL}","middle_top").changeTextAnchor("{REF}","middle_bottom").build(),Vde=Pl(vKe),lgn=Vde.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),cgn=Vde.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");lgn.anchor="middle_left",cgn.anchor="middle_right";var ugn=Vde,gKe={paths:{path11:{type:"path",points:[{x:-.49895505000000084,y:.04174485000000061},{x:-.177441850000001,y:.04174485000000061}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.18704774999999918,y:.04961415000000069},{x:.5063384499999999,y:.04961415000000069}],color:"primary",fill:!1},"path12-6":{type:"path",points:[{x:.18219425000000045,y:-.15200134999999904},{x:.1810882500000004,y:.2512156500000011}],color:"primary",fill:!1},"path12-2":{type:"path",points:[{x:.18646324999999986,y:.0047866500000004475},{x:.34602244999999954,y:-.13539324999999924}],color:"primary",fill:!1},"path12-2-9":{type:"path",points:[{x:.3463884499999992,y:-.14077354999999936},{x:.3447284499999994,y:-.3343437499999993}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-.17016305000000087,y:.2706752500000007},{x:-.17223005000000047,y:-.15200864999999908},{x:.180362149999999,y:.04760855000000097},{x:-.16624855000000038,y:.27180665000000137}],color:"primary",fill:!0}},texts:{top1:{type:"text",text:"{REF}",x:-.22312565000000006,y:.38273545},bottom1:{type:"text",text:"{VAL}",x:.11142554999999987,y:-.38273544999999976}},refblocks:{bottom1:{x:.3445824499999999,y:-.34953845000000006},left1:{x:-.5177904499999998,y:.04089205000000007},right1:{x:.5177904499999997,y:.049757749999999934}},bounds:{minX:-.5459488909999998,maxX:.5459488909999997,minY:-.38273544999999976,maxY:.38273545,width:1.0918977819999993,height:.7654708999999997,centerX:-5551115123125783e-32,centerY:11102230246251565e-32},circles:{}},{paths:ISn,texts:FSn,bounds:BSn,refblocks:jSn,circles:HSn}=gKe,_Ke=cd(gKe).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("bottom1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),xKe=Pl(_Ke),fgn=xKe.primitives.filter(n=>n.type==="text"),bKe=fgn.find(n=>n.text==="{REF}");bKe.y=0,bKe.anchor="middle_left";var dgn=xKe,pgn={paths:{path1:{type:"path",points:[{x:-.3543583500000005,y:.03204385000000087},{x:-.12792935000000005,y:.03204385000000087}],color:"primary",fill:!1},"path-1-3":{type:"path",points:[{x:-.0733669500000003,y:.0261987500000005},{x:.10908324999999996,y:-.029100155000000048}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.1043477500000003,y:-.0645130499999993},{x:.34508875000000017,y:-.0645130499999993}],color:"primary",fill:!1},path3:{type:"path",points:[{x:.12008575000000055,y:.17214665000000062},{x:.3608267500000004,y:.17214665000000062}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:.3716265000000006},bottom1:{type:"text",text:"{VAL}",x:0,y:-.3716264999999984}},refblocks:{left1:{x:-.3682737499999995,y:.03204385000000021},right1:{x:.3682737499999995,y:-.06451304999999996},right2:{x:.3682737499999995,y:.17214665000000062}},bounds:{minX:-.3964321909999995,maxX:.3964321909999995,minY:-.39716264999999984,maxY:.39716265000000006,width:.792864381999999,height:.7943252999999999,centerX:0,centerY:11102230246251565e-32},circles:{"circle-3":{type:"circle",x:.08200307499999998,y:-.06518,radius:.023193523,color:"primary",fill:!1},"circle-1":{type:"circle",x:-.09900307499999998,y:.02848,radius:.023193523,color:"primary",fill:!1},"circle-2":{type:"circle",x:.08200307499999998,y:.172848,radius:.023193523,color:"primary",fill:!1}}},Oj=cd(pgn).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right2",["2"]).labelPort("right1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),$de=Pl(Oj,"down"),Gde=$de.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),qde=$de.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Gde.anchor="middle_bottom",qde.anchor="middle_top",Gde.x=.44,Gde.y+=.28,qde.y-=.28,qde.x=.44;var hgn=$de,Yde=Pl(Oj,"left"),Xde=Yde.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Wde=Yde.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Xde.anchor="middle_bottom",Wde.anchor="middle_top",Xde.x=0,Xde.y+=.625,Wde.y-=.695,Wde.x=0;var mgn=Yde,Zde=Pl(Oj,"up"),Qde=Zde.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Kde=Zde.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Qde.anchor="middle_bottom",Kde.anchor="middle_top",Qde.x=.4,Qde.y+=.28,Kde.y-=.28,Kde.x=.4;var ygn=Zde,SKe={paths:{path1:{type:"path",points:[{x:-.3543583500000005,y:.03204385000000087},{x:-.12792935000000005,y:.03204385000000087}],color:"primary",fill:!1},"path-1-3":{type:"path",points:[{x:-.1133669500000003,y:.0321987500000005},{x:.11208324999999997,y:.14600155000000048}],color:"primary",fill:!1},path2:{type:"path",points:[{x:.1043477500000003,y:-.0645130499999993},{x:.34508875000000017,y:-.0645130499999993}],color:"primary",fill:!1},path3:{type:"path",points:[{x:.12008575000000055,y:.17214665000000062},{x:.3608267500000004,y:.17214665000000062}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.17853294999999947,y:.39716265000000006},bottom1:{type:"text",text:"{VAL}",x:-.011861250000000378,y:-.39716264999999984}},refblocks:{left1:{x:-.3682737499999995,y:.03204385000000021},right1:{x:.3682737499999995,y:-.06451304999999996},right2:{x:.3682737499999995,y:.17214665000000062}},bounds:{width:.792864381999999,height:.7943252999999999,centerX:0,centerY:11102230246251565e-32},circles:{}};SKe.bounds.width+=.2;var{paths:vgn,texts:wKe,bounds:zj,refblocks:Jde,circles:ggn}=SKe,EKe=Wm({primitives:[...Object.values(vgn),...Object.values(ggn),{...wKe.top1,anchor:"middle_bottom",x:-.01},{...wKe.bottom1,anchor:"middle_top",x:-.01}],ports:[{...Jde.left1,labels:["1"]},{...Jde.right1,labels:["3"]},{...Jde.right2,labels:["2"]}],size:{width:zj.width,height:zj.height},center:{x:zj.centerX,y:zj.centerY}}),TKe=Pl(EKe),MKe=TKe.primitives.filter(n=>n.type==="text"),epe=MKe.find(n=>n.text==="{VAL}");epe.anchor="middle_right",epe.x=-.3,epe.y=0;var tpe=MKe.find(n=>n.text==="{REF}");tpe.anchor="middle_left",tpe.x=.3,tpe.y=0;var _gn=TKe,Uj={paths:{path11:{type:"path",points:[{x:-.3622273500000006,y:-.0018583499999986763},{x:-.13579835000000018,y:-.0018583499999986763}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-.07410005000000046,y:-.0003888499999992217},{x:.11030783499999999,y:.04830055000000119}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.12795584999999932,y:-.0018583499999986763},{x:.3686967499999996,y:-.0018583499999986763}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:0,y:.31026835},bottom1:{type:"text",text:"{VAL}",x:0,y:-.28026835000000005}},refblocks:{left1:{x:-.12356015000000009,y:-.006648049999999239},left2:{x:-.37614274999999964,y:-.002711249999999721},right1:{x:.11531695000000042,y:-.006648049999999239},right2:{x:.37614274999999964,y:-.0017148499999992683}},bounds:{minX:-.4043011909999996,maxX:.4043011909999996,minY:-.25026835000000003,maxY:.25026835000000003,width:.8086023819999992,height:.5005367000000001,centerX:0,centerY:0},circles:{"circle-2":{type:"circle",x:.09900307499999998,y:.00148,radius:.023193523,color:"primary",fill:!1},"circle-1":{type:"circle",x:-.09900307499999998,y:.00148,radius:.023193523,color:"primary",fill:!1}}};delete Uj.refblocks.left1,delete Uj.refblocks.right1,Uj.bounds.width+=.2;var kj=cd(Uj).changeTextAnchor("{VAL}","middle_top").labelPort("left2",["1"]).labelPort("right2",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),npe=Pl(kj,"down"),rpe=npe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),ipe=npe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");rpe.anchor="middle_bottom",ipe.anchor="middle_top",rpe.x=.3,rpe.y+=.265,ipe.y-=.265,ipe.x=.3;var xgn=npe,ape=Pl(kj,"left"),ope=ape.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),spe=ape.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");ope.anchor="middle_bottom",spe.anchor="middle_top",ope.x=0,ope.y+=.57,spe.y-=.57,spe.x=0;var bgn=ape,lpe=Pl(kj,"up"),cpe=lpe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),upe=lpe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");cpe.anchor="middle_bottom",upe.anchor="middle_top",cpe.x=.3,cpe.y+=.265,upe.y-=.265,upe.x=.3;var Sgn=lpe,Ij={paths:{path11:{type:"path",points:[{x:-.3622273500000006,y:-.0018583499999986763},{x:-.13579835000000018,y:-.0018583499999986763}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-.12010005000000046,y:-.0033888499999992217},{x:.10307834999999987,y:.13630055000000119}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.12795584999999932,y:-.0018583499999986763},{x:.3686967499999996,y:-.0018583499999986763}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.03688484999999986,y:.25026835000000003},bottom1:{type:"text",text:"{VAL}",x:-.02235315000000071,y:-.25026835000000003}},refblocks:{left1:{x:-.12356015000000009,y:-.006648049999999239},left2:{x:-.37614274999999964,y:-.002711249999999721},right1:{x:.11531695000000042,y:-.006648049999999239},right2:{x:.37614274999999964,y:-.0017148499999992683}},bounds:{minX:-.4043011909999996,maxX:.4043011909999996,minY:-.25026835000000003,maxY:.25026835000000003,width:.8086023819999992,height:.5005367000000001,centerX:0,centerY:0},circles:{}};delete Ij.refblocks.left1,delete Ij.refblocks.right1,Ij.bounds.width+=.2;var CKe=cd(Ij).changeTextAnchor("{VAL}","middle_top").labelPort("left2",["1"]).labelPort("right2",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),RKe=Pl(CKe),AKe=RKe.primitives.filter(n=>n.type==="text"),fpe=AKe.find(n=>n.text==="{VAL}");fpe.anchor="middle_right",fpe.x=-.3,fpe.y=0;var dpe=AKe.find(n=>n.text==="{REF}");dpe.anchor="middle_left",dpe.x=.3,dpe.y=0;var wgn=RKe,PKe={paths:{path40:{type:"path",points:[{x:.14458890000000002,y:.04403629999999836},{x:-.1199943999999995,y:-.08825540000000132}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.1199943999999995,y:.1763280000000016},{x:.14458890000000002,y:.04403629999999836}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.1199943999999995,y:-.08825539999999776},{x:-.1199943999999995,y:.1763280000000016}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.14458890000000002,y:.1763280000000016},{x:.14458890000000002,y:-.08825539999999776}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.12219909999999956,y:.04403629999999836},{x:-.5168693999999996,y:.04403629999999836}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.5233797,y:.04395110000000102},{x:.14967160000000002,y:.04395110000000102}],color:"primary",fill:!1},"path43-5":{type:"path",points:[{x:.19156529999999972,y:-.0884020999999997},{x:.14591529999999908,y:-.08876210000000029}],color:"primary",fill:!1},"path43-5-2":{type:"path",points:[{x:.19233440000000046,y:-.1355493999999986},{x:.19197439999999988,y:-.08989940000000018}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999996715,y:.27384529999999785},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999999524,y:-.2738453000000014}},refblocks:{left1:{x:-.5191471000000001,y:.0449206999999987},right1:{x:.5191471000000001,y:.043896100000001326}},bounds:{minX:-.5473055410000001,maxX:.5473055410000001,minY:-.2738453000000014,maxY:.27384529999999785,width:1.0946110820000001,height:.5476905999999993,centerX:0,centerY:-17763568394002505e-31},circles:{}},{paths:VSn,texts:$Sn,bounds:GSn,refblocks:qSn,circles:YSn}=PKe,NKe=cd(PKe).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),Egn=Pl(NKe),Tgn={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"RPM",x:0,y:-.025}},refblocks:{left1:{x:-.5446330999999993,y:.000852800000000542},right1:{x:.5381638000000004,y:-.00014359999999924433}},bounds:{width:1.0614356000000003,height:1,centerX:5551115123125783e-32,centerY:0},circles:{path1:{type:"circle",x:-.006997299999999651,y:-.007128299999999532,radius:.28854213,color:"primary",fill:!1}}},{paths:Mgn,texts:Cgn,bounds:Fj,refblocks:DKe,circles:Rgn}=Tgn,ppe=Wm({primitives:[...Object.values(Mgn),...Object.values(Rgn),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"},{...Cgn.left1,y:.01,anchor:"center",fontSize:.2}],ports:[{...DKe.left1,labels:["1"]},{...DKe.right1,labels:["2"]}],size:{width:Fj.width,height:Fj.height},center:{x:Fj.centerX,y:Fj.centerY}}),{5:Agn,...Pgn}=ppe.primitives;function Ngn(n){return typeof n=="object"}var LKe=Pl({...ppe,primitives:Object.values(Pgn).filter(Ngn)}),Dgn={...LKe,primitives:[...LKe.primitives,Agn]},OKe={paths:{path11:{type:"path",points:[{x:-.5176700499999997,y:.041745050000000505},{x:-.10888805000000024,y:.041745050000000505}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.1031184499999993,y:.041745050000000505},{x:.5246894499999994,y:.041745050000000505}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-.09343985000000021,y:-.14620634999999882},{x:-.0930998500000002,y:.2583405500000009}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:.08519034999999908,y:-.14503384999999902},{x:.08553034999999909,y:.2595130500000007}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-.08315755000000014,y:.055934450000000524},{x:-.08415755000000047,y:-.14678124999999964},{x:.08653524999999984,y:-.05104664999999953},{x:-.08126175000000035,y:.05647715000000031}],color:"primary",fill:!0},"path11-0-9-0":{type:"path",points:[{x:.07661224999999927,y:.256654450000001},{x:.07761224999999983,y:.05393885000000109},{x:-.0930805500000007,y:.1496734500000012},{x:.07471644999999949,y:.25719715000000143}],color:"primary",fill:!0},"path12-2":{type:"path",points:[{x:.09001085000000009,y:-.05964874999999914},{x:.2707999499999998,y:-.1711147499999992}],color:"primary",fill:!1},"path12-2-9":{type:"path",points:[{x:.27291134999999955,y:-.17591894999999935},{x:.27124034999999935,y:-.30168314999999923}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:.0077081499999991365,y:.41683614999999996},bottom1:{type:"text",text:"{VAL}",x:-.03022294999999975,y:-.41683614999999996}},refblocks:{bottom1:{x:.27223905000000026,y:-.3087962499999999},left1:{x:-.54139845,y:.04089205000000051},right1:{x:.5413984499999995,y:.04188845000000008}},bounds:{minX:-.569556891,maxX:.5695568909999995,minY:-.41683614999999996,maxY:.41683614999999996,width:1.1391137819999995,height:.8336722999999999,centerX:-2220446049250313e-31,centerY:0},circles:{path1:{type:"circle",x:-.0037626500000003116,y:.048873150000000365,radius:.28854213,color:"primary",fill:!1}}},{paths:XSn,texts:WSn,bounds:ZSn,refblocks:QSn,circles:KSn}=OKe,zKe=cd(OKe).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).labelPort("bottom1",["3"]).changeTextAnchor("{REF}","middle_bottom").build(),UKe=Pl(zKe),kKe=UKe.primitives.filter(n=>n.type==="text"),Lgn=kKe.find(n=>n.text==="{REF}"),Ogn=kKe.find(n=>n.text==="{VAL}");Lgn.y=0,Ogn.y=0;var zgn=UKe,Ugn={paths:{path40:{type:"path",points:[{x:.14458890000000002,y:.04403629999999992},{x:-.1199943999999995,y:-.08825540000000043}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.1199943999999995,y:.17632800000000026},{x:.14458890000000002,y:.04403629999999992}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.1199943999999995,y:-.0882553999999991},{x:-.1199943999999995,y:.17632800000000026}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.14458890000000002,y:.17632800000000026},{x:.14458890000000002,y:-.0882553999999991}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.12219909999999956,y:.04403629999999992},{x:-.5168693999999996,y:.04403629999999992}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.5233797000000002,y:.043951100000000354},{x:.1496715999999998,y:.043951100000000354}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:.14339119999999994,y:.17681090000000044},{x:.07728679999999954,y:.17632089999999967}],color:"primary",fill:!1},"path43-8-8":{type:"path",points:[{x:.1446069000000001,y:-.08908179999999888},{x:.0785024999999997,y:-.08957179999999942}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999996715,y:.27384530000000007},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999977319,y:-.27384529999999985}},refblocks:{left1:{x:-.5191471000000001,y:.044920700000000924},right1:{x:.5191470999999999,y:.04389609999999999}},bounds:{width:1.094611082,height:.5476905999999999,centerX:-11102230246251565e-32,centerY:11102230246251565e-32},circles:{}},{paths:kgn,texts:IKe,bounds:Bj,refblocks:FKe,circles:Ign}=Ugn,BKe=Wm({primitives:[...Object.values(kgn),...Object.values(Ign),{...IKe.top1,anchor:"middle_bottom"},{...IKe.bottom1,anchor:"middle_top"}],ports:[{...FKe.left1,labels:["1"]},{...FKe.right1,labels:["2"]}],size:{width:Bj.width,height:Bj.height},center:{x:Bj.centerX,y:Bj.centerY}}),hpe=Pl(BKe),Fgn=hpe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),Bgn=hpe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");Fgn.anchor="middle_left",Bgn.anchor="middle_right";var jgn=hpe,Hgn={paths:{path11:{type:"path",points:[{x:-.3274461945,y:.20527883627037657},{x:-.021085194500000348,y:.007570136270376837}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2331163055000003,y:.1251673362703769},{x:.2320633055000001,y:.3759855362703768}],color:"primary",fill:!1},"path12-2":{type:"path",points:[{x:.23221610549999938,y:-.0818845637296235},{x:.2311631054999992,y:-.33270276372962315}],color:"primary",fill:!1},"path11-0":{type:"path",points:[{x:-.013263894499999873,y:-.1792007637296229},{x:-.012923894499999866,y:.2253461362703768}],color:"primary",fill:!1},"path11-0-3":{type:"path",points:[{x:.23222970550000066,y:.12047013627037662},{x:-.011307094499999115,y:.11996013627037683}],color:"primary",fill:!1},"path11-0-9":{type:"path",points:[{x:-.1124341944999998,y:.131359936270377},{x:-.16993279449999954,y:.039004036270377185},{x:-.05822649449999928,y:.03212003627037707},{x:-.11133889449999979,y:.13104553627037707}],color:"primary",fill:!0},"path11-0-3-8":{type:"path",points:[{x:.23230320549999983,y:-.08329316372962325},{x:-.011233594499999944,y:-.07900616372962332}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.19541139450000045,y:.389088136270376},bottom1:{type:"text",text:"{VAL}",x:-.031363394499999364,y:-.42359956372962415}},refblocks:{top1:{x:.2317438004035266,y:.3954411227296242},bottom1:{x:.2308431668082036,y:-.35215823360635445},left1:{x:-.34055979449999985,y:.21512343627037622}},bounds:{width:.7374364709999996,height:.8471991274592483,centerX:27755575615628914e-33,centerY:0},circles:{path1:{type:"circle",x:.08017610549999987,y:.006746336270376352,radius:.28854213,color:"primary",fill:!1}}},{paths:Vgn,texts:jKe,bounds:jj,refblocks:mpe,circles:$gn}=Hgn,HKe=Wm({primitives:[...Object.values(Vgn),...Object.values($gn),{...jKe.top1,anchor:"middle_left"},{...jKe.bottom1,anchor:"middle_right"}],ports:[{...mpe.top1,labels:["1"]},{...mpe.bottom1,labels:["2"]},{...mpe.left1,labels:["3"]}],size:{width:jj.width,height:jj.height},center:{x:jj.centerX,y:jj.centerY}}),VKe=Pl(HKe),$Ke=VKe.primitives.filter(n=>n.type==="text"),Ggn=$Ke.find(n=>n.text==="{REF}");Ggn.y=.1;var GKe=$Ke.find(n=>n.text==="{VAL}");GKe.y=.1,GKe.x=-.4;var qgn=VKe,Ygn={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.17652089999999898,y:-.36197569999999946},bottom1:{type:"text",text:"{VAL}",x:-.009849199999999891,y:.43234960000000044},left1:{type:"text",text:"Var",x:-.19436529999999896,y:.07249430000000023}},refblocks:{left1:{x:-.5446330999999993,y:.000852800000000542},right1:{x:.5381638000000004,y:-.00014359999999924433}},bounds:{width:1.0614356000000003,height:1,centerX:5551115123125783e-32,centerY:0},circles:{path1:{type:"circle",x:-.006997299999999651,y:-.007128299999999532,radius:.28854213,color:"primary",fill:!1}}},{paths:Xgn,texts:ype,bounds:Hj,refblocks:qKe,circles:Wgn}=Ygn,YKe=Wm({primitives:[...Object.values(Xgn),...Object.values(Wgn),{...ype.top1,x:0,y:-.3594553499999995,anchor:"middle_top"},{...ype.bottom1,x:0,y:.35,anchor:"middle_bottom"},{...ype.left1,x:-.02,y:.01,fontSize:.2,anchor:"center"}],ports:[{...qKe.left1,labels:["1"]},{...qKe.right1,labels:["2"]}],size:{width:Hj.width,height:Hj.height},center:{x:Hj.centerX,y:Hj.centerY}}),Zgn=Pl(YKe),Qgn={paths:{path40:{type:"path",points:[{x:.08342510000000014,y:.04403649999999937},{x:-.18115819999999938,y:-.0882552000000012}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.1811582000000007,y:.1763281999999997},{x:.08342509999999881,y:.04403649999999937}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.1811582000000007,y:-.0882552000000012},{x:-.1811582000000007,y:.17632819999999816}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.0949504999999995,y:.17485119999999976},{x:.09600949999999897,y:-.09185079999999957}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.1954338999999996,y:.04403649999999937},{x:-.5191807000000004,y:.04403649999999937}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.5253116,y:.043951299999999804},{x:.20527070000000047,y:.043951299999999804}],color:"primary",fill:!1},"path43-6":{type:"path",points:[{x:.1854899999999995,y:.1748848999999999},{x:.18654899999999874,y:-.09181709999999943}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999994495,y:.27384530000000007},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999977319,y:-.27384530000000007}},refblocks:{left1:{x:-.5191471,y:.044920799999999206},right1:{x:.5191470999999999,y:.04389609999999999}},bounds:{width:1.0946110819999997,height:.5476906000000001,centerX:-5551115123125783e-32,centerY:0},circles:{}},{paths:Kgn,texts:XKe,bounds:Vj,refblocks:WKe,circles:Jgn}=Qgn,ZKe=Wm({primitives:[...Object.values(Kgn),...Object.values(Jgn),{...XKe.top1,anchor:"middle_bottom"},{...XKe.bottom1,anchor:"middle_top"}],ports:[{...WKe.left1,labels:["1"]},{...WKe.right1,labels:["2"]}],size:{width:Vj.width,height:Vj.height},center:{x:Vj.centerX,y:Vj.centerY}}),vpe=Pl(ZKe),e_n=vpe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),t_n=vpe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");e_n.anchor="middle_left",t_n.anchor="middle_right";var n_n=vpe,r_n={paths:{path5:{type:"path",points:[{x:-.5245830500000004,y:.004659100000001359},{x:-.25999975000000086,y:.004659100000001359}],color:"primary",fill:!1},path6:{type:"path",points:[{x:.2691672500000002,y:.004659100000001359},{x:.5337505499999997,y:.004659100000001359}],color:"primary",fill:!1},path7:{type:"path",points:[{x:.2691672500000002,y:-.23346590000000056},{x:-.25999974999999953,y:.2427841000000015}],color:"primary",fill:!1},path8:{type:"path",points:[{x:.37500025000000026,y:-.23346590000000056},{x:.2691672500000002,y:-.23346590000000056}],color:"primary",fill:!1},path9:{type:"path",points:[{x:.004585150000000482,y:.13695090000000043},{x:.26916815000000094,y:.13695090000000043},{x:.26916815000000094,y:-.1276325000000007},{x:-.2599988499999988,y:-.1276325000000007},{x:-.2599988499999988,y:.13695090000000043},{x:.004585150000001814,y:.13695090000000043}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.05849044999999986,y:.25166549999999965},bottom1:{type:"text",text:"{VAL}",x:.008507150000000685,y:-.25166549999999965}},refblocks:{left1:{x:-.5392315500000002,y:.002969399999999567},right1:{x:.5392315500000002,y:.005339799999999784}},bounds:{width:1.1347799820000004,height:.5033309999999993,centerX:0,centerY:0}},{paths:i_n,texts:QKe,bounds:$j,refblocks:KKe}=r_n,JKe=Wm({primitives:[...Object.values(i_n),{...QKe.top1,anchor:"middle_left"},{...QKe.bottom1,anchor:"middle_right"}],ports:[{...KKe.left1,labels:["1","-"]},{...KKe.right1,labels:["2","+"]}],size:{width:$j.width,height:$j.height},center:{x:$j.centerX,y:$j.centerY}}),a_n=Pl(JKe),o_n={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"Var",x:0,y:-.025}},refblocks:{left1:{x:-.5446330999999993,y:.000852800000000542},right1:{x:.5381638000000004,y:-.00014359999999924433}},bounds:{width:1.0614356000000003,height:1,centerX:5551115123125783e-32,centerY:0},circles:{path1:{type:"circle",x:-.006997299999999651,y:-.007128299999999532,radius:.28854213,color:"primary",fill:!1}}},{paths:s_n,texts:l_n,bounds:Gj,refblocks:eJe,circles:c_n}=o_n,gpe=Wm({primitives:[...Object.values(s_n),...Object.values(c_n),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"},{...l_n.left1,anchor:"center",y:.02,fontSize:.2}],ports:[{...eJe.left1,labels:["1"]},{...eJe.right1,labels:["2"]}],size:{width:Gj.width,height:Gj.height},center:{x:Gj.centerX,y:Gj.centerY}}),{5:u_n,...f_n}=gpe.primitives;function d_n(n){return typeof n=="object"}var tJe=Pl({...gpe,primitives:Object.values(f_n).filter(d_n)}),p_n={...tJe,primitives:[...tJe.primitives,u_n]},nJe={paths:{path11:{type:"path",points:[{x:-.5274831500000005,y:.031252300000000455},{x:-.30105415000000013,y:.031252300000000455}],color:"primary",fill:!1},"path11-5-5":{type:"path",points:[{x:.09765764999999949,y:.1295162000000003},{x:-.0011297500000011507,y:-.061970899999999496},{x:-.10778645000000164,y:.1295162000000003}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2932119499999999,y:.031252300000000455},{x:.5339524499999997,y:.031252300000000455}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.021146249999999478,y:.4010973},bottom1:{type:"text",text:"{VAL}",x:-.00661455000000033,y:-.4010973}},refblocks:{left1:{x:-.5413984499999998,y:.030399499999999913},right1:{x:.54139845,y:.0313958999999997}},bounds:{minX:-.5695568909999997,maxX:.569556891,minY:-.4010973,maxY:.4010973,width:1.1391137819999997,height:.8021946,centerX:11102230246251565e-32,centerY:0},circles:{path1:{type:"circle",x:-.0037626500000000895,y:.03838059999999999,radius:.28854213,color:"primary",fill:!1}}},{paths:JSn,texts:e7n,bounds:t7n,circles:n7n,refblocks:r7n}=nJe,rJe=cd(nJe).changeTextAnchor("{VAL}","middle_top").labelPort("left1",["1"]).labelPort("right1",["2"]).changeTextAnchor("{REF}","middle_bottom").build(),h_n=Pl(rJe),m_n={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"Wh",x:0,y:-.025}},refblocks:{left1:{x:-.5446330999999993,y:.000852800000000542},right1:{x:.5381638000000004,y:-.00014359999999924433}},bounds:{width:1.0614356000000003,height:1,centerX:5551115123125783e-32,centerY:0},circles:{path1:{type:"circle",x:-.006997299999999651,y:-.007128299999999532,radius:.28854213,color:"primary",fill:!1}}},{paths:y_n,texts:v_n,bounds:qj,refblocks:iJe,circles:g_n}=m_n,_pe=Wm({primitives:[...Object.values(y_n),...Object.values(g_n),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"},{...v_n.left1,anchor:"center",y:.01,fontSize:.2}],ports:[{...iJe.left1,labels:["1"]},{...iJe.right1,labels:["2"]}],size:{width:qj.width,height:qj.height},center:{x:qj.centerX,y:qj.centerY}}),{5:__n,...x_n}=_pe.primitives;function b_n(n){return typeof n=="object"}var aJe=Pl({..._pe,primitives:Object.values(x_n).filter(b_n)}),S_n={...aJe,primitives:[...aJe.primitives,__n]},w_n={paths:{path11:{type:"path",points:[{x:-.5307178,y:0},{x:-.3042887999999997,y:0}],color:"primary",fill:!1},path12:{type:"path",points:[{x:.2899773000000003,y:0},{x:.5307178000000001,y:0}],color:"primary",fill:!1}},texts:{left1:{type:"text",text:"W",x:0,y:-.025}},refblocks:{left1:{x:-.5446330999999993,y:.000852800000000542},right1:{x:.5381638000000004,y:-.00014359999999924433}},bounds:{width:1.0614356000000003,height:1,centerX:5551115123125783e-32,centerY:0},circles:{path1:{type:"circle",x:-.006997299999999651,y:-.007128299999999532,radius:.28854213,color:"primary",fill:!1}}},{paths:E_n,texts:T_n,bounds:Yj,refblocks:oJe,circles:M_n}=w_n,xpe=Wm({primitives:[...Object.values(E_n),...Object.values(M_n),{type:"text",text:"{REF}",x:0,y:-.3594553499999995,anchor:"middle_top"},{type:"text",text:"{VAL}",x:0,y:.35,anchor:"middle_bottom"},{...T_n.left1,anchor:"center",y:.01,fontSize:.3}],ports:[{...oJe.left1,labels:["1"]},{...oJe.right1,labels:["2"]}],size:{width:Yj.width,height:Yj.height},center:{x:Yj.centerX,y:Yj.centerY}}),{5:C_n,...R_n}=xpe.primitives;function A_n(n){return typeof n=="object"}var sJe=Pl({...xpe,primitives:Object.values(R_n).filter(A_n)}),P_n={...sJe,primitives:[...sJe.primitives,C_n]},N_n={paths:{path40:{type:"path",points:[{x:.14458890000000002,y:.04403629999999992},{x:-.1199943999999995,y:-.08825540000000043}],color:"primary",fill:!1},path41:{type:"path",points:[{x:-.1199943999999995,y:.17632800000000026},{x:.14458890000000002,y:.04403629999999992}],color:"primary",fill:!1},path42:{type:"path",points:[{x:-.1199943999999995,y:-.0882553999999991},{x:-.1199943999999995,y:.17632800000000026}],color:"primary",fill:!1},path43:{type:"path",points:[{x:.14458890000000002,y:.17632800000000026},{x:.14458890000000002,y:-.0882553999999991}],color:"primary",fill:!1},path44:{type:"path",points:[{x:-.12219909999999956,y:.04403629999999992},{x:-.5168693999999996,y:.04403629999999992}],color:"primary",fill:!1},"path44-0":{type:"path",points:[{x:.5233797000000002,y:.043951100000000354},{x:.1496715999999998,y:.043951100000000354}],color:"primary",fill:!1},"path43-8":{type:"path",points:[{x:.14339119999999994,y:.17681090000000044},{x:.07728679999999954,y:.17632089999999967}],color:"primary",fill:!1}},texts:{top1:{type:"text",text:"{REF}",x:-.0050250999999996715,y:.27384530000000007},bottom1:{type:"text",text:"{VAL}",x:-.00011179999999977319,y:-.27384529999999985}},refblocks:{left1:{x:-.5191471000000001,y:.044920700000000924},right1:{x:.5191470999999999,y:.04389609999999999}},bounds:{width:1.094611082,height:.5476905999999999,centerX:-11102230246251565e-32,centerY:11102230246251565e-32},circles:{}},{paths:D_n,texts:lJe,bounds:Xj,refblocks:cJe,circles:L_n}=N_n,uJe=Wm({primitives:[...Object.values(D_n),...Object.values(L_n),{...lJe.top1,anchor:"middle_bottom"},{...lJe.bottom1,anchor:"middle_top"}],ports:[{...cJe.left1,labels:["1"]},{...cJe.right1,labels:["2"]}],size:{width:Xj.width,height:Xj.height},center:{x:Xj.centerX,y:Xj.centerY}}),bpe=Pl(uJe),O_n=bpe.primitives.find(n=>n.type==="text"&&n.text==="{REF}"),z_n=bpe.primitives.find(n=>n.type==="text"&&n.text==="{VAL}");O_n.anchor="middle_left",z_n.anchor="middle_right";var U_n=bpe,H4={ac_voltmeter_horz:hZe,ac_voltmeter_vert:n9n,avalanche_diode_horz:vZe,avalanche_diode_vert:s9n,battery_horz:xZe,battery_vert:f9n,boxresistor_down:m9n,boxresistor_left:g9n,boxresistor_right:b9n,boxresistor_up:E9n,capacitor_down:C9n,capacitor_left:R9n,capacitor_polarized_down:N9n,capacitor_polarized_left:D9n,capacitor_polarized_right:NZe,capacitor_polarized_up:z9n,capacitor_right:U9n,capacitor_up:F9n,constant_current_diode_horz:B9n,constant_current_diode_vert:j9n,crystal_4pin_horz:zZe,crystal_4pin_vert:V9n,crystal_horz:$9n,crystal_vert:G9n,darlington_pair_transistor_horz:q9n,darlington_pair_transistor_vert:Y9n,dc_ammeter_horz:vfe,dc_ammeter_vert:n1n,dc_voltmeter_horz:xfe,dc_voltmeter_vert:u1n,diac_horz:jZe,diac_vert:h1n,diode_down:y1n,diode_left:v1n,diode_right:nj,diode_up:g1n,dpdt_normally_closed_switch_down:x1n,dpdt_normally_closed_switch_left:b1n,dpdt_normally_closed_switch_right:rj,dpdt_normally_closed_switch_up:S1n,dpdt_switch_down:E1n,dpdt_switch_left:T1n,dpdt_switch_right:ij,dpdt_switch_up:M1n,dpst_normally_closed_switch_down:R1n,dpst_normally_closed_switch_left:A1n,dpst_normally_closed_switch_right:aj,dpst_normally_closed_switch_up:P1n,dpst_switch_down:D1n,dpst_switch_left:L1n,dpst_switch_right:oj,dpst_switch_up:O1n,filled_diode_horz:$Ze,filled_diode_vert:U1n,frequency_meter_horz:rde,frequency_meter_vert:$1n,fuse_horz:XZe,fuse_vert:X1n,ground_horz:WZe,ground_vert:eyn,gunn_diode_horz:tyn,gunn_diode_vert:nyn,icled_down:iyn,icled_left:ayn,icled_right:cj,icled_up:syn,igbt_transistor_horz:ZZe,igbt_transistor_vert:cyn,illuminated_push_button_normally_open_horz:KZe,illuminated_push_button_normally_open_vert:fyn,inductor_down:myn,inductor_left:yyn,inductor_right:ude,inductor_up:rQe,laser_diode_horz:aQe,laser_diode_vert:gyn,led_down:Syn,led_left:wyn,led_right:dj,led_up:Tyn,light_dependent_resistor_horz:dQe,light_dependent_resistor_vert:Ayn,mosfet_depletion_normally_on_horz:yQe,mosfet_depletion_normally_on_vert:Dyn,mushroom_head_normally_open_momentary_horz:xQe,mushroom_head_normally_open_momentary_vert:Uyn,n_channel_d_mosfet_transistor_horz:SQe,n_channel_d_mosfet_transistor_vert:Byn,n_channel_e_mosfet_transistor_horz:MQe,n_channel_e_mosfet_transistor_vert:$yn,njfet_transistor_horz:PQe,njfet_transistor_vert:Xyn,npn_bipolar_transistor_horz:LQe,npn_bipolar_transistor_vert:Kyn,opamp_no_power_down:evn,opamp_no_power_left:tvn,opamp_no_power_right:xj,opamp_no_power_up:nvn,opamp_with_power_down:ivn,opamp_with_power_left:avn,opamp_with_power_right:bj,opamp_with_power_up:ovn,p_channel_d_mosfet_transistor_horz:zQe,p_channel_d_mosfet_transistor_vert:uvn,p_channel_e_mosfet_transistor_horz:FQe,p_channel_e_mosfet_transistor_vert:hvn,photodiode_horz:HQe,photodiode_vert:vvn,pjfet_transistor_horz:qQe,pjfet_transistor_vert:bvn,pnp_bipolar_transistor_horz:ZQe,pnp_bipolar_transistor_vert:Tvn,potentiometer_horz:JQe,potentiometer_vert:Avn,potentiometer2_horz:nKe,potentiometer2_vert:Ovn,potentiometer3_down:Uvn,potentiometer3_left:kvn,potentiometer3_right:Cj,potentiometer3_up:Ivn,power_factor_meter_horz:oKe,power_factor_meter_vert:Hvn,push_button_normally_closed_momentary_horz:uKe,push_button_normally_closed_momentary_vert:qvn,push_button_normally_open_momentary_horz:pKe,push_button_normally_open_momentary_vert:Zvn,rectifier_diode_horz:mKe,rectifier_diode_vert:ngn,resonator_horz:yKe,resonator_vert:ogn,schottky_diode_horz:vKe,schottky_diode_vert:ugn,silicon_controlled_rectifier_horz:_Ke,silicon_controlled_rectifier_vert:dgn,spdt_normally_closed_switch_down:hgn,spdt_normally_closed_switch_left:mgn,spdt_normally_closed_switch_right:Oj,spdt_normally_closed_switch_up:ygn,SPDT_switch_horz:EKe,SPDT_switch_vert:_gn,spst_normally_closed_switch_down:xgn,spst_normally_closed_switch_left:bgn,spst_normally_closed_switch_right:kj,spst_normally_closed_switch_up:Sgn,SPST_switch_horz:CKe,SPST_switch_vert:wgn,step_recovery_diode_horz:NKe,step_recovery_diode_vert:Egn,tachometer_horz:ppe,tachometer_vert:Dgn,triac_horz:zKe,triac_vert:zgn,tunnel_diode_horz:BKe,tunnel_diode_vert:jgn,unijunction_transistor_horz:HKe,unijunction_transistor_vert:qgn,var_meter_horz:YKe,var_meter_vert:Zgn,varactor_diode_horz:ZKe,varactor_diode_vert:n_n,varistor_horz:JKe,varistor_vert:a_n,varmeter_horz:gpe,varmeter_vert:p_n,volt_meter_horz:rJe,volt_meter_vert:h_n,watt_hour_meter_horz:_pe,watt_hour_meter_vert:S_n,wattmeter_horz:xpe,wattmeter_vert:P_n,zener_diode_horz:uJe,zener_diode_vert:U_n};Object.fromEntries(Object.keys(H4).map(n=>[n,n]));var k_n=b.enum(["up","down","left","right"]);b.enum(["top-to-bottom","left-to-right","bottom-to-top","right-to-left"]);var _S=b.array(b.string().or(b.number())),fJe=b.object({x:yi,y:yi,z:yi}),I_n=b.object({x:b.union([b.number(),b.string()]),y:b.union([b.number(),b.string()]),z:b.union([b.number(),b.string()])}),Spe=b.object({rotationOffset:b.number().or(I_n).optional(),positionOffset:fJe.optional(),size:fJe.optional()}),F_n=Spe.extend({stlUrl:b.string()}),B_n=Spe.extend({objUrl:b.string(),mtlUrl:b.string().optional()}),j_n=Spe.extend({jscad:b.record(b.any())}),H_n=b.union([b.string(),F_n,B_n,j_n]),V_n=b.custom(n=>!0),kx=b.object({pcbX:yi.optional(),pcbY:yi.optional(),pcbRotation:d6.optional(),layer:S1.optional()}),Wj=b.object({pcbX:yi.optional(),pcbY:yi.optional(),pcbRotation:d6.optional(),schX:yi.optional(),schY:yi.optional(),schRotation:d6.optional(),layer:S1.optional(),footprint:V_n.optional()}),$_n=b.object({supplierPartNumbers:b.record(GWe,b.array(b.string())).optional()}),K5=Wj.merge($_n).extend({key:b.any().optional(),name:b.string(),cadModel:H_n.optional(),children:b.any().optional(),symbolName:b.string().optional()});yi.or(b.enum(["2x","3x","4x"]));var Zj=b.object({pins:b.array(b.union([b.number(),b.string()])),direction:b.union([b.literal("top-to-bottom"),b.literal("left-to-right"),b.literal("bottom-to-top"),b.literal("right-to-left")])}),wpe=b.object({leftSize:b.number().optional().describe("@deprecated, use leftPinCount"),topSize:b.number().optional().describe("@deprecated, use topPinCount"),rightSize:b.number().optional().describe("@deprecated, use rightPinCount"),bottomSize:b.number().optional().describe("@deprecated, use bottomPinCount"),leftPinCount:b.number().optional(),rightPinCount:b.number().optional(),topPinCount:b.number().optional(),bottomPinCount:b.number().optional(),leftSide:Zj.optional(),rightSide:Zj.optional(),topSide:Zj.optional(),bottomSide:Zj.optional()}),dJe=b.record(b.object({marginLeft:yi.optional(),marginRight:yi.optional(),marginTop:yi.optional(),marginBottom:yi.optional(),leftMargin:yi.optional(),rightMargin:yi.optional(),topMargin:yi.optional(),bottomMargin:yi.optional()})),pJe=b.object({x:yi,y:yi}),Epe=b.object({edit_event_id:b.string(),in_progress:b.boolean().optional(),created_at:b.number()}),G_n=Epe.extend({pcb_edit_event_type:b.literal("edit_component_location").describe("deprecated"),edit_event_type:b.literal("edit_pcb_component_location"),pcb_component_id:b.string(),original_center:b.object({x:b.number(),y:b.number()}),new_center:b.object({x:b.number(),y:b.number()})}),q_n=Epe.extend({pcb_edit_event_type:b.literal("edit_trace_hint").describe("deprecated"),edit_event_type:b.literal("edit_pcb_trace_hint").optional(),pcb_port_id:b.string(),pcb_trace_hint_id:b.string().optional(),route:b.array(b.object({x:b.number(),y:b.number(),via:b.boolean().optional()}))}),Y_n=Epe.extend({edit_event_type:b.literal("edit_schematic_component_location"),schematic_component_id:b.string(),original_center:b.object({x:b.number(),y:b.number()}),new_center:b.object({x:b.number(),y:b.number()})});b.union([G_n,q_n,Y_n]);var X_n=b.object({selector:b.string(),relative_to:b.string().optional().default("group_center").describe("Can be a selector or 'group_center'"),center:pv}),W_n=b.object({pcb_port_selector:b.string(),offsets:b.array(gS)}),Z_n=b.object({selector:b.string(),relative_to:b.string().optional().default("group_center").describe("Can be a selector or 'group_center'"),center:pv}),Q_n=b.object({pcb_placements:b.array(X_n).optional(),manual_trace_hints:b.array(W_n).optional(),schematic_placements:b.array(Z_n).optional()}),Tpe=b.object({layoutMode:b.enum(["grid","flex","none"]).optional(),position:b.enum(["absolute","relative"]).optional(),grid:b.boolean().optional(),gridCols:b.number().or(b.string()).optional(),gridRows:b.number().or(b.string()).optional(),gridTemplateRows:b.string().optional(),gridTemplateColumns:b.string().optional(),gridTemplate:b.string().optional(),gridGap:b.number().or(b.string()).optional(),flex:b.boolean().or(b.string()).optional(),flexDirection:b.enum(["row","column"]).optional(),alignItems:b.enum(["start","center","end","stretch"]).optional(),justifyContent:b.enum(["start","center","end","stretch"]).optional(),flexRow:b.boolean().optional(),flexColumn:b.boolean().optional(),gap:b.number().or(b.string()).optional()}),K_n=b.object({serverUrl:b.string().optional(),inputFormat:b.enum(["simplified","circuit-json"]).optional(),serverMode:b.enum(["job","solve-endpoint"]).optional(),serverCacheEnabled:b.boolean().optional(),cache:b.custom(n=>!0).optional(),groupMode:b.enum(["sequential-trace","subcircuit"]).optional(),algorithmFn:b.custom(n=>typeof n=="function"||n===void 0).optional(),local:b.boolean().optional()}),hJe=b.union([K_n,b.literal("sequential-trace"),b.literal("subcircuit"),b.literal("auto"),b.literal("auto-local"),b.literal("auto-cloud")]),mJe=Wj.extend({name:b.string().optional(),children:b.any().optional(),key:b.any().optional(),...Tpe.shape,pcbWidth:u1.optional(),pcbHeight:u1.optional(),schWidth:u1.optional(),schHeight:u1.optional(),pcbLayout:Tpe.optional(),schLayout:Tpe.optional()}),yJe=b.custom(n=>"findPart"in n),vJe=mJe.extend({layout:b.custom(n=>!0).optional(),manualEdits:Q_n.optional(),schAutoLayoutEnabled:b.boolean().optional(),schTraceAutoLabelEnabled:b.boolean().optional(),routingDisabled:b.boolean().optional(),defaultTraceWidth:u1.optional(),minTraceWidth:u1.optional(),partsEngine:yJe.optional(),pcbRouteCache:b.custom(n=>!0).optional(),autorouter:hJe.optional()}),J_n=vJe.extend({subcircuit:b.literal(!0)}),exn=b.discriminatedUnion("subcircuit",[mJe.extend({subcircuit:b.literal(!1).optional()}),J_n]),gJe=vJe.extend({width:yi.optional(),height:yi.optional(),outline:b.array(pJe).optional(),outlineOffsetX:yi.optional(),outlineOffsetY:yi.optional(),material:b.enum(["fr4","fr1"]).default("fr4")}),txn=b.string().or(b.array(b.string()).readonly()).or(b.array(b.string())),nxn=b.custom().pipe(b.record(b.string(),txn)),rxn=b.record(b.string(),b.string().or(b.array(b.string()).readonly()).or(b.array(b.string()))),_Je=K5.extend({manufacturerPartNumber:b.string().optional(),pinLabels:rxn.optional(),internallyConnectedPins:b.array(b.array(b.string())).optional(),externallyConnectedPins:b.array(b.array(b.string())).optional(),schPinArrangement:wpe.optional(),schPortArrangement:wpe.optional(),schPinStyle:dJe.optional(),schPinSpacing:yi.optional(),schWidth:yi.optional(),schHeight:yi.optional(),noSchematicRepresentation:b.boolean().optional(),connections:nxn.optional()}),ixn=K5.extend({manufacturerPartNumber:b.string().optional(),pinLabels:b.record(b.number().or(b.string()),b.string().or(b.array(b.string()))).optional(),schPinStyle:dJe.optional(),schPinSpacing:yi.optional(),schWidth:yi.optional(),schHeight:yi.optional(),schDirection:b.enum(["left","right"]).optional(),schPortArrangement:wpe.optional()}),Qj=b.custom().transform(n=>{if(n!==void 0)return yi.parse(n)}),axn=b.union([kx.omit({pcbRotation:!0,layer:!0}).extend({name:b.string().optional(),shape:b.literal("circle"),holeDiameter:yi,outerDiameter:yi,portHints:_S.optional()}),kx.omit({pcbRotation:!0,layer:!0}).extend({name:b.string().optional(),shape:b.literal("oval"),outerWidth:yi,outerHeight:yi,holeWidth:Qj,holeHeight:Qj,innerWidth:yi.optional().describe("DEPRECATED use holeWidth"),innerHeight:yi.optional().describe("DEPRECATED use holeHeight"),portHints:_S.optional()}),kx.omit({pcbRotation:!0,layer:!0}).extend({name:b.string().optional(),shape:b.literal("pill"),outerWidth:yi,outerHeight:yi,holeWidth:Qj,holeHeight:Qj,innerWidth:yi.optional().describe("DEPRECATED use holeWidth"),innerHeight:yi.optional().describe("DEPRECATED use holeHeight"),portHints:_S.optional()}),kx.omit({pcbRotation:!0,layer:!0}).extend({name:b.string().optional(),holeDiameter:yi,rectPadWidth:yi,rectPadHeight:yi,holeShape:b.literal("circle").optional(),padShape:b.literal("rect").optional(),shape:b.literal("circularHoleWithRectPad").optional(),portHints:_S.optional()}).refine(n=>n.shape==="circularHoleWithRectPad"?n.holeDiameter&&n.rectPadWidth&&n.rectPadHeight:!0,{message:"Missing required fields for circularHoleWithRectPad"})]).refine(n=>("innerWidth"in n&&n.innerWidth!==void 0&&(n.holeWidth??(n.holeWidth=n.innerWidth)),"innerHeight"in n&&n.innerHeight!==void 0&&(n.holeHeight??(n.holeHeight=n.innerHeight)),n)),oxn=b.string().or(b.array(b.string()).readonly()).or(b.array(b.string())),xJe=n=>b.record(b.enum(n),oxn),sxn=["pin1","pin2","pos","neg"],lxn=K5.extend({resistance:dP,pullupFor:b.string().optional(),pullupTo:b.string().optional(),pulldownFor:b.string().optional(),pulldownTo:b.string().optional(),connections:xJe(sxn).optional()}),cxn=K5.extend({maxResistance:dP,pinVariant:b.enum(["two_pin","three_pin"]).optional()}),uxn=K5.extend({frequency:ufe,loadCapacitance:pP,pinVariant:b.enum(["two_pin","four_pin"]).optional()}),fxn=K5.extend({frequency:ufe,loadCapacitance:pP,pinVariant:b.enum(["no_ground","ground_pin","two_ground_pins"]).optional()});gJe.extend({leftPinCount:b.number().optional(),rightPinCount:b.number().optional(),topPinCount:b.number().optional(),bottomPinCount:b.number().optional(),leftPins:b.array(b.string()).optional(),rightPins:b.array(b.string()).optional(),topPins:b.array(b.string()).optional(),bottomPins:b.array(b.string()).optional(),pinPitch:yi.optional(),innerHoles:b.boolean().optional()});var dxn=["pin1","pin2","pos","neg","anode","cathode"],pxn=K5.extend({capacitance:pP,maxVoltageRating:hP.optional(),schShowRatings:b.boolean().optional().default(!1),polarized:b.boolean().optional().default(!1),decouplingFor:b.string().optional(),decouplingTo:b.string().optional(),bypassFor:b.string().optional(),bypassTo:b.string().optional(),maxDecouplingTraceLength:b.number().optional(),connections:xJe(dxn).optional()});b.object({name:b.string()}),b.object({name:b.string().optional(),pcbOnly:b.boolean().optional(),schOnly:b.boolean().optional()});var hxn=b.object({pcb:b.literal(!0).optional(),xDist:yi,left:b.string(),right:b.string(),edgeToEdge:b.literal(!0).optional(),centerToCenter:b.literal(!0).optional()}),mxn=b.object({pcb:b.literal(!0).optional(),yDist:yi,top:b.string(),bottom:b.string(),edgeToEdge:b.literal(!0).optional(),centerToCenter:b.literal(!0).optional()}),yxn=b.object({pcb:b.literal(!0).optional(),sameY:b.literal(!0).optional(),for:b.array(b.string())}),vxn=b.object({pcb:b.literal(!0).optional(),sameX:b.literal(!0).optional(),for:b.array(b.string())}),gxn=b.union([hxn,mxn,yxn,vxn]),_xn=kx.omit({pcbRotation:!0}).extend({shape:b.literal("rect"),width:yi,height:yi,portHints:_S.optional()}),xxn=kx.omit({pcbRotation:!0}).extend({shape:b.literal("rotated_rect"),width:yi,height:yi,ccwRotation:b.number(),portHints:_S.optional()}),bxn=kx.omit({pcbRotation:!0}).extend({shape:b.literal("circle"),radius:yi,portHints:_S.optional()}),Sxn=kx.omit({pcbRotation:!0}).extend({shape:b.literal("pill"),width:yi,height:yi,radius:yi,portHints:_S.optional()}),wxn=b.union([bxn,_xn,xxn,Sxn]),Exn=kx.omit({pcbRotation:!0}).extend({shape:b.literal("rect"),width:yi,height:yi}),Txn=kx.omit({pcbRotation:!0}).extend({shape:b.literal("circle"),radius:yi});b.union([Txn,Exn]);var Mxn=kx.omit({pcbRotation:!0}).extend({name:b.string().optional(),diameter:yi.optional(),radius:yi.optional()}).transform(n=>({...n,diameter:n.diameter??2*n.radius,radius:n.radius??n.diameter/2})),Mpe=b.union([b.string(),b.custom(n=>!!n.getPortSelector)]),bJe=b.object({key:b.string().optional(),thickness:yi.optional(),schematicRouteHints:b.array(pJe).optional(),pcbRouteHints:b.array(gS).optional(),schDisplayLabel:b.string().optional(),maxLength:yi.optional()}),Cxn=b.union([bJe.extend({path:b.array(Mpe)}),bJe.extend({from:Mpe,to:Mpe})]),Rxn=b.object({originalLayer:S1.default("top").optional()}),Axn=b.number().or(b.string().endsWith("mAh")).transform(n=>{if(typeof n=="string"){const e=n.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return n}).describe("Battery capacity in mAh"),Pxn=K5.extend({capacity:Axn.optional()}),Nxn=K5.extend({pinCount:b.number(),pitch:yi.optional(),schFacingDirection:b.enum(["up","down","left","right"]).optional(),gender:b.enum(["male","female"]).optional().default("male"),showSilkscreenPinLabels:b.boolean().optional(),doubleRow:b.boolean().optional(),holeDiameter:yi.optional(),platedDiameter:yi.optional(),pinLabels:b.array(b.string()).optional(),facingDirection:b.enum(["left","right"]).optional()}),Dxn=b.object({net:b.string().optional(),schX:yi.optional(),schY:yi.optional(),schRotation:d6.optional(),anchorSide:b.enum(["left","up","right","down"]).optional()}),Lxn=_Je.extend({}),Oxn=K5.extend({type:b.enum(["npn","pnp","bjt","jfet","mosfet"])}),zxn=K5.extend({channelType:b.enum(["n","p"]),mosfetMode:b.enum(["enhancement","depletion"])}),Uxn=K5.extend({inductance:VWe}),kxn=b.enum(["anode","cathode","pin1","pin2","pos","neg"]),Ixn=b.string().or(b.array(b.string()).readonly()).or(b.array(b.string())),Fxn=b.record(kxn,Ixn),Bxn=K5.extend({connections:Fxn.optional()}),jxn=K5.extend({color:b.string().optional()}),Hxn=K5.extend({type:b.enum(["spst","spdt","dpst","dpdt"]).optional(),isNormallyClosed:b.boolean().optional().default(!1),spst:b.boolean().optional(),spdt:b.boolean().optional(),dpst:b.boolean().optional(),dpdt:b.boolean().optional()}).transform(n=>{const e={...n};switch(e.dpdt?e.type="dpdt":e.spst?e.type="spst":e.spdt?e.type="spdt":e.dpst&&(e.type="dpst"),e.type){case"spdt":e.spdt=!0;break;case"spst":e.spst=!0;break;case"dpst":e.dpst=!0;break;case"dpdt":e.dpdt=!0;break}return e}),Vxn=kx.extend({text:b.string(),anchorAlignment:b.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),font:b.enum(["tscircuit2024"]).optional(),fontSize:u1.optional(),color:b.string().optional()}),$xn=kx.omit({pcbX:!0,pcbY:!0,pcbRotation:!0}).extend({route:b.array(gS),strokeWidth:u1.optional(),color:b.string().optional()});b.object({layer:b.string().optional(),thickness:yi.optional(),route:b.array(gS)});var Gxn=Wj.extend({fromLayer:S1,toLayer:S1,holeDiameter:yi,outerDiameter:yi}),qxn=b.union([kx.omit({pcbRotation:!0}).extend({shape:b.literal("circle"),radius:yi}),kx.extend({shape:b.literal("rect"),width:yi,height:yi})]),Yxn=K5.extend({voltage:hP});b.object({schX:yi,schY:yi,width:yi,height:yi}),b.object({x1:yi,y1:yi,x2:yi,y2:yi}),b.object({schX:yi,schY:yi,text:b.string()}),b.object({points:b.array(pv),isFilled:b.boolean().optional().default(!1),fillColor:b.enum(["red","blue"]).optional()});var Xxn=kx.extend({text:b.string(),anchorAlignment:b.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),font:b.enum(["tscircuit2024"]).optional(),fontSize:u1.optional()}),Wxn=kx.omit({pcbX:!0,pcbY:!0,pcbRotation:!0}).extend({route:b.array(gS),strokeWidth:u1.optional()}),Zxn=kx.omit({pcbX:!0,pcbY:!0,pcbRotation:!0}).extend({strokeWidth:yi,x1:yi,y1:yi,x2:yi,y2:yi}),Qxn=kx.omit({pcbRotation:!0}).extend({isFilled:b.boolean().optional(),isOutline:b.boolean().optional(),strokeWidth:yi.optional(),width:yi,height:yi}),Kxn=kx.omit({pcbRotation:!0}).extend({isFilled:b.boolean().optional(),isOutline:b.boolean().optional(),strokeWidth:yi.optional(),radius:yi}),SJe=b.object({x:yi,y:yi,via:b.boolean().optional(),toLayer:S1.optional()}),Jxn=b.object({for:b.string().optional().describe("Selector for the port you're targeting, not required if you're inside a trace"),order:b.number().optional(),offset:gS.or(SJe).optional(),offsets:b.array(gS).or(b.array(SJe)).optional(),traceWidth:b.number().optional()});Wj.extend({name:b.string(),pinNumber:b.number().optional(),aliases:b.array(b.string()).optional(),direction:k_n}),b.object({partsEngine:yJe.optional(),autorouter:hJe.optional(),registryApiUrl:b.string().optional(),cloudAutorouterUrl:b.string().optional()});var e2n=(n,e)=>{const t={x:e.x-n.x,y:e.y-n.y},r=Math.sqrt(t.x**2+t.y**2);return{x:t.x/r,y:t.y/r}},t2n=n=>{switch(n){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}}};function wJe([n,e],[t,r],{lineThickness:i=0}={}){return i===0?EJe(n,e,t,r):n2n(n,e,t,r)<=i}function EJe(n,e,t,r){const i=Kj(n,e,t),a=Kj(n,e,r),o=Kj(t,r,n),s=Kj(t,r,e);return!!(i!==a&&o!==s||i===0&&Jj(n,t,e)||a===0&&Jj(n,r,e)||o===0&&Jj(t,n,r)||s===0&&Jj(t,e,r))}function Kj(n,e,t){const r=(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y);return r===0?0:r>0?1:2}function Jj(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function n2n(n,e,t,r){if(n.x===e.x&&n.y===e.y)return UT(n,t,r);if(t.x===r.x&&t.y===r.y)return UT(t,n,e);if(EJe(n,e,t,r))return 0;const i=[UT(n,t,r),UT(e,t,r),UT(t,n,e),UT(r,n,e)];return Math.min(...i)}function UT(n,e,t){const r=(t.x-e.x)**2+(t.y-e.y)**2;if(r===0)return gP(n,e);let i=((n.x-e.x)*(t.x-e.x)+(n.y-e.y)*(t.y-e.y))/r;i=Math.max(0,Math.min(1,i));const a={x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)};return gP(n,a)}function gP(n,e){const t=n.x-e.x,r=n.y-e.y;return Math.sqrt(t*t+r*r)}var r2n=Object.defineProperty,i2n=(n,e)=>{for(var t in e)r2n(n,t,{get:e[t],enumerable:!0})},TJe={};i2n(TJe,{Battery:()=>f5n,Board:()=>Y2n,Capacitor:()=>W2n,Chip:()=>qJe,Constraint:()=>n5n,Crystal:()=>_5n,Diode:()=>Z2n,FabricationNotePath:()=>r5n,FabricationNoteText:()=>i5n,Footprint:()=>w2n,Group:()=>zpe,Hole:()=>UJe,Inductor:()=>m5n,Jumper:()=>Q2n,Keepout:()=>Npe,Led:()=>K2n,Mosfet:()=>b5n,Net:()=>DJe,NetAlias:()=>o5n,NormalComponent:()=>d2,PinHeader:()=>d5n,PlatedHole:()=>zJe,Port:()=>p6,Potentiometer:()=>v5n,PowerSource:()=>J2n,PrimitiveComponent:()=>ix,PushButton:()=>g5n,Renderable:()=>MJe,Resistor:()=>e5n,Resonator:()=>h5n,SilkscreenCircle:()=>s5n,SilkscreenLine:()=>c5n,SilkscreenPath:()=>OJe,SilkscreenRect:()=>l5n,SilkscreenText:()=>kJe,SmtPad:()=>Ppe,Subcircuit:()=>a5n,Switch:()=>S5n,Trace:()=>uw,TraceHint:()=>$Je,Transistor:()=>x5n,Via:()=>u5n});var a2n=z1("tscircuit:renderable"),V4=["ReactSubtreesRender","InitializePortsFromChildren","CreateNetsFromProps","CreateTracesFromProps","CreateTraceHintsFromProps","SourceRender","SourceParentAttachment","PortMatching","OptimizeSelectorCache","SourceTraceRender","SourceAddConnectivityMapKey","SchematicComponentRender","SchematicPortRender","SchematicLayout","SchematicTraceRender","PcbComponentRender","PcbPrimitiveRender","PcbFootprintLayout","PcbPortRender","PcbPortAttachment","PcbLayout","PcbComponentSizeCalculation","PcbBoardAutoSize","PcbTraceRender","PcbTraceHintRender","PcbRouteNetIslands","PcbDesignRuleChecks","CadModelRender","PartsEngineRender"],o2n=0,MJe=class{constructor(n){Je(this,"renderPhaseStates");Je(this,"shouldBeRemoved",!1);Je(this,"children");Je(this,"isPcbPrimitive",!1);Je(this,"isSchematicPrimitive",!1);Je(this,"_renderId");Je(this,"_currentRenderPhase",null);Je(this,"_asyncEffects",[]);Je(this,"parent",null);this._renderId=`${o2n++}`,this.children=[],this.renderPhaseStates={};for(const e of V4)this.renderPhaseStates[e]={initialized:!1,dirty:!1}}_markDirty(n){var t;this.renderPhaseStates[n].dirty=!0;const e=V4.indexOf(n);for(let r=e+1;r<V4.length;r++)this.renderPhaseStates[V4[r]].dirty=!0;(t=this.parent)!=null&&t._markDirty&&this.parent._markDirty(n)}_queueAsyncEffect(n,e){const t={promise:e(),phase:this._currentRenderPhase,effectName:n,complete:!1};this._asyncEffects.push(t),"root"in this&&this.root&&this.root.emit("asyncEffect:start",{effectName:n,componentDisplayName:this.getString(),phase:t.phase}),t.promise.then(()=>{t.complete=!0,"root"in this&&this.root&&this.root.emit("asyncEffect:end",{effectName:n,componentDisplayName:this.getString(),phase:t.phase})}).catch(r=>{console.error(`Async effect error in ${t.phase} "${n}":
|
|
13424
13424
|
${r.stack}`),t.complete=!0,"root"in this&&this.root&&this.root.emit("asyncEffect:end",{effectName:n,componentDisplayName:this.getString(),phase:t.phase,error:r.toString()})})}_emitRenderLifecycleEvent(n,e){a2n(`${n}:${e} ${this.getString()}`);const t=`renderable:renderLifecycle:${n}:${e}`,r={renderId:this._renderId,componentDisplayName:this.getString(),type:t};"root"in this&&this.root&&(this.root.emit(t,r),this.root.emit("renderable:renderLifecycle:anyEvent",{...r,type:t}))}getString(){return this.constructor.name}_hasIncompleteAsyncEffects(){return this._asyncEffects.some(n=>!n.complete)}getCurrentRenderPhase(){return this._currentRenderPhase}getRenderGraph(){return{id:this._renderId,currentPhase:this._currentRenderPhase,renderPhaseStates:this.renderPhaseStates,shouldBeRemoved:this.shouldBeRemoved,children:this.children.map(n=>n.getRenderGraph())}}runRenderCycle(){for(const n of V4)this.runRenderPhaseForChildren(n),this.runRenderPhase(n)}runRenderPhase(n){var a,o,s;this._currentRenderPhase=n;const e=this.renderPhaseStates[n],t=e.initialized,r=e.dirty;if(!t&&this.shouldBeRemoved)return;if(this.shouldBeRemoved&&t){this._emitRenderLifecycleEvent(n,"start"),(a=this==null?void 0:this[`remove${n}`])==null||a.call(this),e.initialized=!1,e.dirty=!1,this._emitRenderLifecycleEvent(n,"end");return}const i=V4.indexOf(n)-1;if(i>=0){const l=V4[i];if(this._asyncEffects.filter(u=>u.phase===l).some(u=>!u.complete))return}if(this._emitRenderLifecycleEvent(n,"start"),t){r&&((o=this==null?void 0:this[`update${n}`])==null||o.call(this),e.dirty=!1),this._emitRenderLifecycleEvent(n,"end");return}e.dirty=!1,(s=this==null?void 0:this[`doInitial${n}`])==null||s.call(this),e.initialized=!0,this._emitRenderLifecycleEvent(n,"end")}runRenderPhaseForChildren(n){for(const e of this.children)e.runRenderPhaseForChildren(n),e.runRenderPhase(n)}renderError(n){throw typeof n=="string"?new Error(n):new Error(JSON.stringify(n,null,2))}},eH={},CJe=n=>{const e=Object.fromEntries(Object.entries(n).map(([t,r])=>[t.toLowerCase(),r]));Object.assign(eH,n),Object.assign(eH,e)};function s2n(n,e){const t=n;return t.__tsci={...e},n}var RJe={supportsMutation:!0,createInstance(n,e){const t=eH[n];if(!t)throw Object.keys(eH).length===0?new Error("No components registered in catalogue, did you forget to import lib/register-catalogue in your test file?"):new Error(`Unsupported component type (not registered in @tscircuit/core catalogue): "${n}" See CREATING_NEW_COMPONENTS.md`);return s2n(new t(e),{})},createTextInstance(){return{}},appendInitialChild(n,e){n.add(e)},appendChild(n,e){n.add(e)},appendChildToContainer(n,e){n.add(e)},finalizeInitialChildren(){return!1},prepareUpdate(){return null},shouldSetTextContent(){return!1},getRootHostContext(){return{}},getChildHostContext(){return{}},prepareForCommit(){return null},resetAfterCommit(){},commitMount(){},commitUpdate(){},removeChild(){},clearContainer(){},supportsPersistence:!1,getPublicInstance(n){return n},preparePortalMount(n){throw new Error("Function not implemented.")},scheduleTimeout(n,e){throw new Error("Function not implemented.")},cancelTimeout(n){throw new Error("Function not implemented.")},noTimeout:void 0,isPrimaryRenderer:!1,getInstanceFromNode(n){throw new Error("Function not implemented.")},beforeActiveInstanceBlur(){throw new Error("Function not implemented.")},afterActiveInstanceBlur(){throw new Error("Function not implemented.")},prepareScopeUpdate:(n,e)=>{throw new Error("Function not implemented.")},getInstanceFromScope:n=>{throw new Error("Function not implemented.")},detachDeletedInstance:n=>{throw new Error("Function not implemented.")},getCurrentEventPriority:()=>R8.DefaultEventPriority,getCurrentUpdatePriority:()=>R8.DefaultEventPriority,resolveUpdatePriority:()=>R8.DefaultEventPriority,setCurrentUpdatePriority:()=>{},maySuspendCommit:()=>!1,supportsHydration:!1},cw;Jd.version.startsWith("19.")?cw=LV(RJe):cw=UV(RJe);var l2n=n=>{const e={children:[],props:{name:"$root"},add(a){a.parent=this,this.children.push(a)},computePcbGlobalTransform(){return o9()}},t=[],r=cw.createContainer(e,0,null,!1,null,"tsci",a=>{console.log("Error in createContainer"),console.error(a),t.push(a)},null);if(Jd.version.startsWith("19.")?(cw.updateContainerSync(n,r,null,()=>{}),cw.flushSyncWork()):cw.updateContainer(n,r,null,()=>{}),t.length>0)throw t[0];const i=cw.getPublicRootInstance(r);return i||e.children[0]},_P=(n,e)=>{if(typeof n=="number")return n;if(n.startsWith("pin"))return Number(n.slice(3));if(!e)throw new Error(`No pin labels provided and pin number or label is not a number: "${n}"`);for(const t in e)if((Array.isArray(e[t])?e[t]:[e[t]]).includes(n))return Number(t.replace("pin",""));throw new Error(`No pin labels provided and pin number or label is not a number: "${n}"`)},c2n=(n,e)=>{if(!n)return;const t={},r={};for(const[i,a]of Object.entries(n)){const o=_P(i,e);r[o]={...r[o],...a}}for(const[i,a]of Object.entries(r)){const o=`pin${i}`;t[o]={bottom_margin:a.bottomMargin,left_margin:a.leftMargin,right_margin:a.rightMargin,top_margin:a.topMargin}}return t},u2n=n=>{if(n){if("leftSide"in n||"rightSide"in n||"topSide"in n||"bottomSide"in n)return{left_side:n.leftSide,right_side:n.rightSide,top_side:n.topSide,bottom_side:n.bottomSide};if("leftPinCount"in n||"rightPinCount"in n||"topPinCount"in n||"bottomPinCount"in n)return{left_size:n.leftPinCount,right_size:n.rightPinCount,top_size:n.topPinCount,bottom_size:n.bottomPinCount};if("leftSize"in n||"rightSize"in n||"topSize"in n||"bottomSize"in n)return{left_size:n.leftSize,right_size:n.rightSize,top_size:n.topSize,bottom_size:n.bottomSize}}},f2n=class extends Error{constructor(n,e,t){let r;const a=Object.keys(t).filter(o=>o!=="_errors").map(o=>t[o]._errors[0]?`${o} (${t[o]._errors[0]})`:`${o} (${JSON.stringify(t[o])})`).join(", ");"name"in e?r=`Invalid props for ${n} "${e.name}": ${a}`:"footprint"in e&&typeof e.footprint=="string"?r=`Invalid props for ${n} (unnamed ${e.footprint} component): ${a}`:r=`Invalid props for ${n} (unnamed): ${a}`,super(r),this.componentName=n,this.originalProps=e,this.formattedError=t}};function Cpe(n,e){const t=e.match(/^#(\w+)/);if(t)return n.props.id===t[1];const r=e.match(/^\.(\w+)/);if(r)return n.isMatchingNameOrAlias(r[1]);let[i,...a]=e.split(/(?=[#.[])/);return i==="pin"&&(i="port"),i&&i!=="*"&&n.lowercaseComponentName!==i.toLowerCase()?!1:a.every(o=>{if(o.startsWith("#"))return n.props.id===o.slice(1);if(o.startsWith("."))return n.isMatchingNameOrAlias(o.slice(1));const s=o.match(/\[(\w+)=['"]?(.+?)['"]?\]/);if(!s)return!0;const[,l,c]=s;return n.props[l].toString()===c})}var Rpe={isTag:n=>!0,getParent:n=>n.parent,getChildren:n=>n.children,getName:n=>n.lowercaseComponentName,getAttributeValue:(n,e)=>{var t;if(e==="class"&&"getNameAndAliases"in n)return n.getNameAndAliases().join(" ");if(e==="name"&&((t=n._parsedProps)!=null&&t.name))return n._parsedProps.name;if(n._parsedProps&&e in n._parsedProps){const r=n._parsedProps[e];return typeof r=="string"?r:r!=null?String(r):null}return null},hasAttrib:(n,e)=>{var t;return e==="class"?!!((t=n._parsedProps)!=null&&t.name):n._parsedProps&&e in n._parsedProps},getSiblings:n=>n.parent?n.parent.children:[],prevElementSibling:n=>{if(!n.parent)return null;const e=n.parent.children,t=e.indexOf(n);return t>0?e[t-1]:null},getText:()=>"",removeSubsets:n=>n.filter((e,t)=>!n.some((r,i)=>t!==i&&r!==e&&r.getDescendants().includes(e))),existsOne:(n,e)=>e.some(n),findAll:(n,e)=>{const t=[],r=i=>{n(i)&&t.push(i);for(const a of i.children)r(a)};for(const i of e)r(i);return t},findOne:(n,e)=>{for(const t of e){if(n(t))return t;const r=t.children;if(r.length>0){const i=Rpe.findOne(n,r);if(i)return i}}return null},equals:(n,e)=>n._renderId===e._renderId,isHovered:n=>!1,isVisited:n=>!1,isActive:n=>!1},d2n={...Rpe,getChildren:n=>n.children.filter(e=>!e.isSubcircuit)},AJe={...Rpe,getChildren:n=>n.children.filter(e=>e.isSubcircuit)},PJe=n=>n.replace(/ pin/g," port").replace(/ subcircuit\./g," group[isSubcircuit=true]").replace(/([^ ])\>([^ ])/g,"$1 > $2").trim(),Ape={adapter:d2n,cacheResults:!0},ix=class extends MJe{constructor(e){super(e);Je(this,"parent",null);Je(this,"children");Je(this,"childrenPendingRemoval");Je(this,"props");Je(this,"_parsedProps");Je(this,"externallyAddedAliases");Je(this,"isPrimitiveContainer",!1);Je(this,"source_group_id",null);Je(this,"source_component_id",null);Je(this,"schematic_component_id",null);Je(this,"pcb_component_id",null);Je(this,"cad_component_id",null);Je(this,"_cachedSelectAllQueries",new Map);Je(this,"_cachedSelectOneQueries",new Map);this.children=[],this.childrenPendingRemoval=[],this.props=e??{},this.externallyAddedAliases=[];const t=this.config.zodProps.safeParse(e??{});if(t.success)this._parsedProps=t.data;else throw new f2n(this.lowercaseComponentName,this.props,t.error.format())}get config(){return{componentName:"",zodProps:b.object({}).passthrough()}}get componentName(){return this.config.componentName}getInheritedProperty(e){var r;let t=this;for(;t;){if(t._parsedProps&&e in t._parsedProps)return t._parsedProps[e];t=t.parent}if((r=this.root)!=null&&r.platform&&e in this.root.platform)return this.root.platform[e]}get lowercaseComponentName(){return this.componentName.toLowerCase()}get isSubcircuit(){var e;return!!this.props.subcircuit||this.lowercaseComponentName==="group"&&((e=this==null?void 0:this.parent)==null?void 0:e.isRoot)}get isGroup(){return this.lowercaseComponentName==="group"}setProps(e){var i,a;const t=this.config.zodProps.parse({...this.props,...e}),r=this.props;this.props=t,this._parsedProps=this.config.zodProps.parse(e),this.onPropsChange({oldProps:r,newProps:t,changedProps:Object.keys(e)}),(a=(i=this.parent)==null?void 0:i.onChildChanged)==null||a.call(i,this)}computePcbPropsTransform(){const{_parsedProps:e}=this;return Rc(q0(e.pcbX??0,e.pcbY??0),Kx((e.pcbRotation??0)*Math.PI/180))}_computePcbGlobalTransformBeforeLayout(){var r,i,a;const{_parsedProps:e}=this,t=this.getSubcircuit()._getPcbManualPlacementForComponent(this);if(t&&this.props.pcbX===void 0&&this.props.pcbY===void 0)return Rc(((r=this.parent)==null?void 0:r._computePcbGlobalTransformBeforeLayout())??o9(),Rc(q0(t.x,t.y),Kx((e.pcbRotation??0)*Math.PI/180)));if(this.isPcbPrimitive){const o=this.getPrimitiveContainer();if(o){const s=o._parsedProps.layer==="bottom",l=o._getGlobalPcbPositionBeforeLayout();if(s)return Rc(q0(l.x,l.y),NS(),q0(-l.x,-l.y)),Rc(((i=this.parent)==null?void 0:i._computePcbGlobalTransformBeforeLayout())??o9(),NS(),this.computePcbPropsTransform())}}return Rc(((a=this.parent)==null?void 0:a._computePcbGlobalTransformBeforeLayout())??o9(),this.computePcbPropsTransform())}getPrimitiveContainer(){var e,t;return this.isPrimitiveContainer?this:((t=(e=this.parent)==null?void 0:e.getPrimitiveContainer)==null?void 0:t.call(e))??null}_getPcbCircuitJsonBounds(){return{center:{x:0,y:0},bounds:{left:0,top:0,right:0,bottom:0},width:0,height:0}}_getPcbPrimitiveFlippedHelpers(){const e=this.getPrimitiveContainer(),t=e?e._parsedProps.layer==="bottom":!1;return{isFlipped:t,maybeFlipLayer:i=>t?i==="top"?"bottom":"top":i}}_setPositionFromLayout(e){throw new Error(`_setPositionFromLayout not implemented for ${this.componentName}`)}computeSchematicPropsTransform(){const{_parsedProps:e}=this;return Rc(q0(e.schX??0,e.schY??0))}computeSchematicGlobalTransform(){var t,r;const e=this._getSchematicGlobalManualPlacementTransform(this);return e||Rc(((r=(t=this.parent)==null?void 0:t.computeSchematicGlobalTransform)==null?void 0:r.call(t))??o9(),this.computeSchematicPropsTransform())}_getSchematicSymbolName(){const{_parsedProps:e}=this,t=this.config.schematicSymbolName;let r=e.schRotation;if(r===void 0&&(r=0),r=r%360,r<0&&(r+=360),e.schRotation!==void 0&&r%90!==0)throw new Error(`Schematic rotation ${e.schRotation} is not supported for ${this.componentName}`);const i=`${t}_horz`,a=`${t}_vert`,o=`${t}_up`,s=`${t}_down`,l=`${t}_left`,c=`${t}_right`;if(c in H4&&r===0)return c;if(o in H4&&r===90)return o;if(l in H4&&r===180)return l;if(s in H4&&r===270)return s;if(i in H4&&(r===0||r===180))return i;if(a in H4&&(r===90||r===270))return a;if(t in H4)return t}_getSchematicSymbolNameOrThrow(){const e=this._getSchematicSymbolName();if(!e)throw new Error(`No schematic symbol found (given: "${this.config.schematicSymbolName}")`);return e}getSchematicSymbol(){const e=this._getSchematicSymbolName();return e?H4[e]??null:null}_getPcbManualPlacementForComponent(e){var a;if(!this.isSubcircuit)return null;const t=this.props.layout,r=this.props.manualEdits;if(!t&&!r)return null;const i=((a=t==null?void 0:t.manual_pcb_placement_config)==null?void 0:a.positions)||(r==null?void 0:r.pcb_placements);if(!i)return null;for(const o of i)if(t&&Cpe(e,o.selector)||e.props.name===o.selector)return gr(this._computePcbGlobalTransformBeforeLayout(),o.center);return null}_getSchematicManualPlacementForComponent(e){if(!this.isSubcircuit)return null;const t=this.props.manualEdits;if(!t)return null;const r=t.schematic_placements;if(!r)return null;for(const i of r)if(Cpe(e,i.selector)||e.props.name===i.selector)return gr(this.computeSchematicGlobalTransform(),i.center);return null}_getSchematicGlobalManualPlacementTransform(e){var r,i;const t=(r=this.getSubcircuit())==null?void 0:r._parsedProps.manualEdits;if(!t)return null;for(const a of t.schematic_placements??[])if((Cpe(e,a.selector)||e.props.name===a.selector)&&a.relative_to==="group_center")return Rc(((i=this.parent)==null?void 0:i._computePcbGlobalTransformBeforeLayout())??o9(),q0(a.center.x,a.center.y));return null}_getGlobalPcbPositionBeforeLayout(){return gr(this._computePcbGlobalTransformBeforeLayout(),{x:0,y:0})}_getGlobalSchematicPositionBeforeLayout(){return gr(this.computeSchematicGlobalTransform(),{x:0,y:0})}get root(){var e;return((e=this.parent)==null?void 0:e.root)??null}onAddToParent(e){this.parent=e}onPropsChange(e){}onChildChanged(e){var t,r;(r=(t=this.parent)==null?void 0:t.onChildChanged)==null||r.call(t,e)}add(e){if(!e.onAddToParent)throw new Error(`Invalid JSX Element: Expected a React component but received "${JSON.stringify(e)}"`);e.onAddToParent(this),e.parent=this,this.children.push(e)}addAll(e){for(const t of e)this.add(t)}remove(e){this.children=this.children.filter(t=>t!==e),this.childrenPendingRemoval.push(e),e.shouldBeRemoved=!0}getSubcircuitSelector(){const e=this._parsedProps.name,t=e?`${this.lowercaseComponentName}.${e}`:this.lowercaseComponentName;return!this.parent||this.parent.isSubcircuit?t:`${this.parent.getSubcircuitSelector()} > ${t}`}getFullPathSelector(){var i,a;const e=this._parsedProps.name,t=e?`${this.lowercaseComponentName}.${e}`:this.lowercaseComponentName,r=(a=(i=this.parent)==null?void 0:i.getFullPathSelector)==null?void 0:a.call(i);return r?`${r} > ${t}`:t}getNameAndAliases(){return[this._parsedProps.name,...this._parsedProps.portHints??[]].filter(Boolean)}isMatchingNameOrAlias(e){return this.getNameAndAliases().includes(e)}isMatchingAnyOf(e){return this.getNameAndAliases().some(t=>e.map(r=>r.toString()).includes(t))}getPcbSize(){throw new Error(`getPcbSize not implemented for ${this.componentName}`)}doesSelectorMatch(e){const t=[this.componentName,this.lowercaseComponentName],r=[this._parsedProps.name].filter(Boolean),i=e.trim().split(/\> /)[0],a=i[0];return i.length>1?!1:!!(e==="*"||e[0]==="#"&&e.slice(1)===this.props.id||e[0]==="."&&r.includes(e.slice(1))||/^[a-zA-Z0-9_]/.test(a)&&t.includes(a))}getSubcircuit(){var t,r;if(this.isSubcircuit)return this;const e=(r=(t=this.parent)==null?void 0:t.getSubcircuit)==null?void 0:r.call(t);if(!e)throw new Error("Component is not inside an opaque group (no board?)");return e}getGroup(){var e,t;return this.isGroup?this:((t=(e=this.parent)==null?void 0:e.getGroup)==null?void 0:t.call(e))??null}doInitialOptimizeSelectorCache(){var t;if(!this.isSubcircuit)return;const e=this.selectAll("port");for(const r of e){const i=(t=r.parent)==null?void 0:t.getNameAndAliases(),a=r.getNameAndAliases();if(i)for(const o of i)for(const s of a){const l=[`.${o} > .${s}`,`.${o} .${s}`];for(const c of l){const u=this._cachedSelectAllQueries.get(c);u?u.push(r):this._cachedSelectAllQueries.set(c,[r])}}}for(const[r,i]of this._cachedSelectAllQueries.entries())i.length===1&&this._cachedSelectOneQueries.set(r,i[0])}selectAll(e){if(this._cachedSelectAllQueries.has(e))return this._cachedSelectAllQueries.get(e);const t=PJe(e),r=Fw(t,this,Ape);if(r.length>0)return this._cachedSelectAllQueries.set(e,r),r;const[i,...a]=t.split(" "),o=A8(i,this,{adapter:AJe});if(!o)return[];const s=o.selectAll(a.join(" "));return this._cachedSelectAllQueries.set(e,s),s}selectOne(e,t){if(this._cachedSelectOneQueries.has(e))return this._cachedSelectOneQueries.get(e);const r=PJe(e);t!=null&&t.port&&(t.type="port");let i=null;if(t!=null&&t.type&&(i=Fw(r,this,Ape).find(c=>c.lowercaseComponentName===t.type)),i??(i=A8(r,this,Ape)),i)return this._cachedSelectOneQueries.set(e,i),i;const[a,...o]=r.split(" "),s=A8(a,this,{adapter:AJe});return s?(i=s.selectOne(o.join(" "),t),this._cachedSelectOneQueries.set(e,i),i):null}getAvailablePcbLayers(){var e,t;if(this.isPcbPrimitive){const{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers();return"layer"in this._parsedProps||this.componentName==="SmtPad"?[r(this._parsedProps.layer??"top")]:"layers"in this._parsedProps?this._parsedProps.layers:this.componentName==="PlatedHole"?((t=(e=this.root)==null?void 0:e._getBoard())==null?void 0:t.allLayers)??["top","bottom"]:[]}return[]}getDescendants(){const e=[];for(const t of this.children)e.push(t),e.push(...t.getDescendants());return e}getSelectableDescendants(){const e=[];for(const t of this.children)t.isSubcircuit?e.push(t):(e.push(t),e.push(...t.getSelectableDescendants()));return e}_getPinCount(){return 0}_getSchematicBoxDimensions(){return null}renderError(e){var t;if(typeof e=="string")return super.renderError(e);(t=this.root)==null||t.db.pcb_placement_error.insert(e)}getString(){var i,a;const{lowercaseComponentName:e,_parsedProps:t,parent:r}=this;return(t==null?void 0:t.pinNumber)!==void 0&&((i=r==null?void 0:r.props)!=null&&i.name)&&(t!=null&&t.name)?`<${e}#${this._renderId}(pin:${t.pinNumber} .${r==null?void 0:r.props.name}>.${t.name}) />`:(a=r==null?void 0:r.props)!=null&&a.name&&(t!=null&&t.name)?`<${e}#${this._renderId}(.${r==null?void 0:r.props.name}>.${t==null?void 0:t.name}) />`:t!=null&&t.from&&(t!=null&&t.to)?`<${e}#${this._renderId}(from:${t.from} to:${t==null?void 0:t.to}) />`:t!=null&&t.name?`<${e}#${this._renderId} name=".${t==null?void 0:t.name}" />`:t!=null&&t.portHints?`<${e}#${this._renderId}(${t.portHints.map(o=>`.${o}`).join(", ")}) />`:`<${e}#${this._renderId} />`}get[Symbol.toStringTag](){return this.getString()}[Symbol.for("nodejs.util.inspect.custom")](){return this.getString()}};function NJe(n){const e=[];for(let t=0;t<n.length-1;t++)e.push([n[t],n[t+1]]);return e}var p2n=b.object({name:b.string()}),DJe=class extends ix{constructor(){super(...arguments);Je(this,"source_net_id")}get config(){return{componentName:"Net",zodProps:p2n}}getPortSelector(){return`net.${this.props.name}`}doInitialSourceRender(){const{db:e}=this.root,{_parsedProps:t}=this,r=e.source_net.insert({name:t.name,member_source_group_ids:[]});this.source_net_id=r.source_net_id}doInitialSourceParentAttachment(){const e=this.getSubcircuit();if(!e)return;const{db:t}=this.root;t.source_net.update(this.source_net_id,{subcircuit_id:e.subcircuit_id})}getAllConnectedPorts(){const e=this.getSubcircuit().selectAll("port"),t=[];for(const r of e){const i=r._getDirectlyConnectedTraces();for(const a of i)if(a._isExplicitlyConnectedToNet(this)){t.push(r);break}}return t}_getAllDirectlyConnectedTraces(){const e=this.getSubcircuit().selectAll("trace"),t=[];for(const r of e)r._isExplicitlyConnectedToNet(this)&&t.push(r);return t}doInitialPcbRouteNetIslands(){var o;if((o=this.root)!=null&&o.pcbDisabled||this.getSubcircuit()._parsedProps.routingDisabled||this.getSubcircuit()._getAutorouterConfig().groupMode!=="sequential-trace")return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getAllDirectlyConnectedTraces().filter(s=>{var l;return(((l=s._portsRoutedOnPcb)==null?void 0:l.length)??0)>0}),i=[];for(const s of r){const l=s._portsRoutedOnPcb,c=i.find(u=>l.some(f=>u.ports.includes(f)));if(!c){i.push({ports:[...l],traces:[s]});continue}c.traces.push(s),c.ports.push(...l)}if(i.length===0)return;const a=NJe(i);for(const[s,l]of a){const c=s.ports.map(A=>A._getGlobalPcbPositionBeforeLayout()),u=l.ports.map(A=>A._getGlobalPcbPositionBeforeLayout());let f=1/0,p=[-1,-1];for(let A=0;A<c.length;A++){const z=c[A];for(let I=0;I<u.length;I++){const G=u[I],Y=Math.sqrt((z.x-G.x)**2+(z.y-G.y)**2);Y<f&&(f=Y,p=[A,I])}}const y=s.ports[p[0]],x=l.ports[p[1]],T=e.toArray().filter(A=>A.type==="pcb_smtpad"||A.type==="pcb_trace"||A.type==="pcb_plated_hole"||A.type==="pcb_hole"||A.type==="source_port"||A.type==="pcb_port"),{solution:w}=hq(T.concat([{type:"source_trace",source_trace_id:"__net_trace_tmp",connected_source_port_ids:[y.source_port_id,x.source_port_id]}])),S=w[0];if(!S){this.renderError({pcb_trace_error_id:"",pcb_trace_id:"__net_trace_tmp",pcb_component_ids:[y.pcb_component_id,x.pcb_component_id].filter(Boolean),pcb_port_ids:[y.pcb_port_id,x.pcb_port_id].filter(Boolean),type:"pcb_trace_error",error_type:"pcb_trace_error",message:`Failed to route net islands for "${this.getString()}"`,source_trace_id:"__net_trace_tmp"});return}e.pcb_trace.insert(S)}}renderError(e){var t;if(typeof e=="string")return super.renderError(e);(t=this.root)==null||t.db.pcb_trace_error.insert(e)}},LJe=(n,e)=>{for(const t of e)if(typeof t=="string"&&t.startsWith("net.")){const r=n.getSubcircuit();if(!r.selectOne(t)){const i=new DJe({name:t.split("net.")[1]});r.add(i)}}},Ppe=class extends ix{constructor(){super(...arguments);Je(this,"pcb_smtpad_id",null);Je(this,"matchedPort",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SmtPad",zodProps:wxn}}getPcbSize(){const{_parsedProps:e}=this;if(e.shape==="circle")return{width:e.radius*2,height:e.radius*2};if(e.shape==="rect")return{width:e.width,height:e.height};throw new Error(`getPcbSize for shape "${e.shape}" not implemented for ${this.componentName}`)}doInitialPortMatching(){var t;const e=(t=this.getPrimitiveContainer())==null?void 0:t.selectAll("port");if(this.props.portHints){for(const r of e)if(r.isMatchingAnyOf(this.props.portHints)){this.matchedPort=r,r.registerMatch(this);return}}}doInitialPcbPrimitiveRender(){var p,y,x,T,w,S,A,z,I,G;if((p=this.root)!=null&&p.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this;if(!t.portHints)return;const r=this.getPrimitiveContainer(),i=this.getSubcircuit(),a=this._getGlobalPcbPositionBeforeLayout();r==null||r._getGlobalPcbPositionBeforeLayout();const o=PS(this._computePcbGlobalTransformBeforeLayout()),s=Math.abs(o.rotation.angle*(180/Math.PI)-90)%180<.01,{maybeFlipLayer:l}=this._getPcbPrimitiveFlippedHelpers(),c=(r==null?void 0:r._parsedProps.pcbRotation)??0;let u=null;const f=((y=this.parent)==null?void 0:y.pcb_component_id)??((x=this.getPrimitiveContainer())==null?void 0:x.pcb_component_id);t.shape==="circle"?(u=e.pcb_smtpad.insert({pcb_component_id:f,pcb_port_id:(T=this.matchedPort)==null?void 0:T.pcb_port_id,layer:l(t.layer??"top"),shape:"circle",radius:t.radius,port_hints:t.portHints.map(Y=>Y.toString()),x:a.x,y:a.y,subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0}),e.pcb_solder_paste.insert({layer:u.layer,shape:"circle",radius:u.radius*.7,x:u.x,y:u.y,pcb_component_id:u.pcb_component_id,pcb_smtpad_id:u.pcb_smtpad_id,subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((w=this.getGroup())==null?void 0:w.pcb_group_id)??void 0})):t.shape==="rect"&&(u=c===0||s?e.pcb_smtpad.insert({pcb_component_id:f,pcb_port_id:(S=this.matchedPort)==null?void 0:S.pcb_port_id,layer:l(t.layer??"top"),shape:"rect",width:s?t.height:t.width,height:s?t.width:t.height,port_hints:t.portHints.map(Y=>Y.toString()),x:a.x,y:a.y,subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((A=this.getGroup())==null?void 0:A.pcb_group_id)??void 0}):e.pcb_smtpad.insert({pcb_component_id:f,layer:t.layer??"top",shape:"rotated_rect",width:t.width,height:t.height,x:a.x,y:a.y,ccw_rotation:c,port_hints:t.portHints.map(Y=>Y.toString()),subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((z=this.getGroup())==null?void 0:z.pcb_group_id)??void 0}),u.shape==="rect"&&e.pcb_solder_paste.insert({layer:u.layer,shape:"rect",width:u.width*.7,height:u.height*.7,x:u.x,y:u.y,pcb_component_id:u.pcb_component_id,pcb_smtpad_id:u.pcb_smtpad_id,subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((I=this.getGroup())==null?void 0:I.pcb_group_id)??void 0}),u.shape==="rotated_rect"&&e.pcb_solder_paste.insert({layer:u.layer,shape:"rotated_rect",width:u.width*.7,height:u.height*.7,x:u.x,y:u.y,ccw_rotation:c,pcb_component_id:u.pcb_component_id,pcb_smtpad_id:u.pcb_smtpad_id,subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((G=this.getGroup())==null?void 0:G.pcb_group_id)??void 0})),u&&(this.pcb_smtpad_id=u.pcb_smtpad_id)}doInitialPcbPortAttachment(){var t,r;if((t=this.root)!=null&&t.pcbDisabled)return;const{db:e}=this.root;e.pcb_smtpad.update(this.pcb_smtpad_id,{pcb_port_id:(r=this.matchedPort)==null?void 0:r.pcb_port_id})}_getPcbCircuitJsonBounds(){const{db:e}=this.root,t=e.pcb_smtpad.get(this.pcb_smtpad_id);if(t.shape==="rect")return{center:{x:t.x,y:t.y},bounds:{left:t.x-t.width/2,top:t.y+t.height/2,right:t.x+t.width/2,bottom:t.y-t.height/2},width:t.width,height:t.height};if(t.shape==="rotated_rect"){const r=t.ccw_rotation*Math.PI/180,i=Math.cos(r),a=Math.sin(r),o=t.width/2,s=t.height/2,l=Math.abs(o*i)+Math.abs(s*a),c=Math.abs(o*a)+Math.abs(s*i);return{center:{x:t.x,y:t.y},bounds:{left:t.x-l,right:t.x+l,top:t.y-c,bottom:t.y+c},width:l*2,height:c*2}}if(t.shape==="circle")return{center:{x:t.x,y:t.y},bounds:{left:t.x-t.radius,top:t.y-t.radius,right:t.x+t.radius,bottom:t.y+t.radius},width:t.radius*2,height:t.radius*2};throw new Error(`circuitJson bounds calculation not implemented for shape "${t.shape}"`)}_setPositionFromLayout(e){var i;const{db:t}=this.root;t.pcb_smtpad.update(this.pcb_smtpad_id,{x:e.x,y:e.y});const r=t.pcb_solder_paste.list().find(a=>a.pcb_smtpad_id===this.pcb_smtpad_id);t.pcb_solder_paste.update(r==null?void 0:r.pcb_solder_paste_id,{x:e.x,y:e.y}),(i=this.matchedPort)==null||i._setPositionFromLayout(e)}},OJe=class extends ix{constructor(){super(...arguments);Je(this,"pcb_silkscreen_path_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenPath",zodProps:Wxn}}doInitialPcbPrimitiveRender(){var l,c,u;if((l=this.root)!=null&&l.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers(),i=r(t.layer??"top");if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenPath. Must be "top" or "bottom".`);const a=this._computePcbGlobalTransformBeforeLayout(),o=this.getSubcircuit(),s=e.pcb_silkscreen_path.insert({pcb_component_id:(c=this.parent)==null?void 0:c.pcb_component_id,layer:i,route:t.route.map(f=>{const p=gr(a,{x:f.x,y:f.y});return{...f,x:p.x,y:p.y}}),stroke_width:t.strokeWidth??.1,subcircuit_id:(o==null?void 0:o.subcircuit_id)??void 0,pcb_group_id:((u=this.getGroup())==null?void 0:u.pcb_group_id)??void 0});this.pcb_silkscreen_path_id=s.pcb_silkscreen_path_id}getPcbSize(){const{_parsedProps:e}=this;if(!e.route||e.route.length===0)return{width:0,height:0};let t=1/0,r=-1/0,i=1/0,a=-1/0;for(const o of e.route)t=Math.min(t,o.x),r=Math.max(r,o.x),i=Math.min(i,o.y),a=Math.max(a,o.y);return{width:r-t,height:a-i}}},zJe=class extends ix{constructor(){super(...arguments);Je(this,"pcb_plated_hole_id",null);Je(this,"matchedPort",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"PlatedHole",zodProps:axn}}getAvailablePcbLayers(){return["top","inner1","inner2","bottom"]}getPcbSize(){const{_parsedProps:e}=this;if(e.shape==="circle")return{width:e.outerDiameter,height:e.outerDiameter};if(e.shape==="oval"||e.shape==="pill")return{width:e.outerWidth,height:e.outerHeight};throw new Error(`getPcbSize for shape "${e.shape}" not implemented for ${this.componentName}`)}_getPcbCircuitJsonBounds(){const{db:e}=this.root,t=e.pcb_plated_hole.get(this.pcb_plated_hole_id),r=this.getPcbSize();return{center:{x:t.x,y:t.y},bounds:{left:t.x-r.width/2,top:t.y+r.height/2,right:t.x+r.width/2,bottom:t.y-r.height/2},width:r.width,height:r.height}}_setPositionFromLayout(e){var r;const{db:t}=this.root;t.pcb_plated_hole.update(this.pcb_plated_hole_id,{x:e.x,y:e.y}),(r=this.matchedPort)==null||r._setPositionFromLayout(e)}doInitialPortMatching(){var t;const e=(t=this.getPrimitiveContainer())==null?void 0:t.selectAll("port");if(this.props.portHints){for(const r of e)if(r.isMatchingAnyOf(this.props.portHints)){this.matchedPort=r,r.registerMatch(this);return}}}doInitialPcbPrimitiveRender(){var o,s,l,c,u,f,p,y,x,T,w;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getGlobalPcbPositionBeforeLayout(),i=((s=this.parent)==null?void 0:s.pcb_component_id)??((l=this.getPrimitiveContainer())==null?void 0:l.pcb_component_id),a=this.getSubcircuit();if(t.shape==="circle"){const S=e.pcb_plated_hole.insert({pcb_component_id:i,pcb_port_id:(c=this.matchedPort)==null?void 0:c.pcb_port_id,outer_diameter:t.outerDiameter,hole_diameter:t.holeDiameter,shape:"circle",port_hints:this.getNameAndAliases(),x:r.x,y:r.y,layers:["top","bottom"],subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((u=this.getGroup())==null?void 0:u.pcb_group_id)??void 0});this.pcb_plated_hole_id=S.pcb_plated_hole_id,e.pcb_solder_paste.insert({layer:"top",shape:"circle",radius:t.outerDiameter/2,x:r.x,y:r.y,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((f=this.getGroup())==null?void 0:f.pcb_group_id)??void 0}),e.pcb_solder_paste.insert({layer:"bottom",shape:"circle",radius:t.outerDiameter/2,x:r.x,y:r.y,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((p=this.getGroup())==null?void 0:p.pcb_group_id)??void 0})}else if(t.shape==="pill"||t.shape==="oval"){const S=e.pcb_plated_hole.insert({pcb_component_id:i,pcb_port_id:(y=this.matchedPort)==null?void 0:y.pcb_port_id,outer_width:t.outerWidth,outer_height:t.outerHeight,hole_width:t.holeWidth,hole_height:t.holeHeight,shape:t.shape,port_hints:this.getNameAndAliases(),x:r.x,y:r.y,layers:["top","bottom"],subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((x=this.getGroup())==null?void 0:x.pcb_group_id)??void 0});this.pcb_plated_hole_id=S.pcb_plated_hole_id,e.pcb_solder_paste.insert({layer:"top",shape:t.shape,width:t.outerWidth,height:t.outerHeight,x:r.x,y:r.y,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((T=this.getGroup())==null?void 0:T.pcb_group_id)??void 0}),e.pcb_solder_paste.insert({layer:"bottom",shape:t.shape,width:t.outerWidth,height:t.outerHeight,x:r.x,y:r.y,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((w=this.getGroup())==null?void 0:w.pcb_group_id)??void 0})}}doInitialPcbPortAttachment(){var t,r;if((t=this.root)!=null&&t.pcbDisabled)return;const{db:e}=this.root;e.pcb_plated_hole.update(this.pcb_plated_hole_id,{pcb_port_id:(r=this.matchedPort)==null?void 0:r.pcb_port_id})}},Npe=class extends ix{constructor(){super(...arguments);Je(this,"pcb_keepout_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"Keepout",zodProps:qxn}}doInitialPcbPrimitiveRender(){var l,c,u;if((l=this.root)!=null&&l.pcbDisabled)return;const e=this.getSubcircuit(),{db:t}=this.root,{_parsedProps:r}=this,i=this._getGlobalPcbPositionBeforeLayout(),a=PS(this._computePcbGlobalTransformBeforeLayout()),o=Math.abs(a.rotation.angle*(180/Math.PI)-90)%180<.01;let s=null;r.shape==="circle"?s=t.pcb_keepout.insert({layers:["top"],shape:"circle",radius:r.radius,center:{x:i.x,y:i.y},subcircuit_id:(e==null?void 0:e.subcircuit_id)??void 0,pcb_group_id:((c=e==null?void 0:e.getGroup())==null?void 0:c.pcb_group_id)??void 0}):r.shape==="rect"&&(s=t.pcb_keepout.insert({layers:["top"],shape:"rect",...o?{width:r.height,height:r.width}:{width:r.width,height:r.height},center:{x:i.x,y:i.y},subcircuit_id:(e==null?void 0:e.subcircuit_id)??void 0,pcb_group_id:((u=e==null?void 0:e.getGroup())==null?void 0:u.pcb_group_id)??void 0})),s&&(this.pcb_keepout_id=s.pcb_keepout_id)}},UJe=class extends ix{constructor(){super(...arguments);Je(this,"pcb_hole_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"Hole",zodProps:Mxn}}getPcbSize(){const{_parsedProps:e}=this;return{width:e.diameter,height:e.diameter}}doInitialPcbPrimitiveRender(){var o,s;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this.getSubcircuit(),i=this._getGlobalPcbPositionBeforeLayout(),a=e.pcb_hole.insert({hole_shape:"circle",hole_diameter:t.diameter,x:i.x,y:i.y,subcircuit_id:(r==null?void 0:r.subcircuit_id)??void 0,pcb_group_id:((s=r==null?void 0:r.getGroup())==null?void 0:s.pcb_group_id)??void 0});this.pcb_hole_id=a.pcb_hole_id}_getPcbCircuitJsonBounds(){const{db:e}=this.root,t=e.pcb_hole.get(this.pcb_hole_id),r=this.getPcbSize();return{center:{x:t.x,y:t.y},bounds:{left:t.x-r.width/2,top:t.y-r.height/2,right:t.x+r.width/2,bottom:t.y+r.height/2},width:r.width,height:r.height}}_setPositionFromLayout(e){const{db:t}=this.root;t.pcb_hole.update(this.pcb_hole_id,{x:e.x,y:e.y})}},kJe=class extends ix{constructor(){super(...arguments);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenText",zodProps:Xxn}}doInitialPcbPrimitiveRender(){var s,l;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this.getPrimitiveContainer(),i=this._getGlobalPcbPositionBeforeLayout(),{maybeFlipLayer:a}=this._getPcbPrimitiveFlippedHelpers(),o=this.getSubcircuit();e.pcb_silkscreen_text.insert({anchor_alignment:t.anchorAlignment,anchor_position:{x:i.x,y:i.y},font:t.font??"tscircuit2024",font_size:t.fontSize??1,layer:a(t.layer??"top"),text:t.text??"",ccw_rotation:t.pcbRotation,pcb_component_id:r.pcb_component_id,subcircuit_id:(o==null?void 0:o.subcircuit_id)??void 0,pcb_group_id:((l=this.getGroup())==null?void 0:l.pcb_group_id)??void 0})}getPcbSize(){const{_parsedProps:e}=this,t=e.fontSize??1,i=(e.text??"").length*t,a=t;return{width:i*t,height:a*t}}},h2n=({componentName:n,componentRotation:e},t)=>{const r=[];for(const i of t)if(i.type==="pcb_smtpad"&&i.shape==="rect")r.push(new Ppe({pcbX:i.x,pcbY:i.y,layer:i.layer,shape:"rect",height:i.height,width:i.width,portHints:i.port_hints}));else if(i.type==="pcb_smtpad"&&i.shape==="circle")r.push(new Ppe({pcbX:i.x,pcbY:i.y,layer:i.layer,shape:"circle",radius:i.radius,portHints:i.port_hints}));else if(i.type==="pcb_silkscreen_path")r.push(new OJe({layer:i.layer,route:i.route,strokeWidth:i.stroke_width}));else if(i.type==="pcb_plated_hole"&&i.shape==="circle")i.shape==="circle"&&r.push(new zJe({pcbX:i.x,pcbY:i.y,shape:"circle",holeDiameter:i.hole_diameter,outerDiameter:i.outer_diameter,portHints:i.port_hints}));else if(i.type==="pcb_keepout"&&i.shape==="circle")r.push(new Npe({pcbX:i.center.x,pcbY:i.center.y,shape:"circle",radius:i.radius}));else if(i.type==="pcb_keepout"&&i.shape==="rect")r.push(new Npe({pcbX:i.center.x,pcbY:i.center.y,shape:"rect",width:i.width,height:i.height}));else if(i.type==="pcb_hole"&&i.hole_shape==="circle")r.push(new UJe({pcbX:i.x,pcbY:i.y,diameter:i.hole_diameter}));else if(i.type==="pcb_silkscreen_text"){let a=e?parseInt(e):0;const o=(a%360+360)%360;a=o>90&&o<=270?(o+180)%360:o,r.push(new kJe({anchorAlignment:"center",text:n,fontSize:i.font_size+.2,pcbX:isNaN(i.anchor_position.x)?0:i.anchor_position.x,pcbY:i.anchor_position.y,pcbRotation:a??0}))}return r};function IJe(n){let e=1/0,t=1/0,r=-1/0,i=-1/0;for(const s of n)if(s.isPcbPrimitive&&!s.componentName.startsWith("Silkscreen")){const{x:l,y:c}=s._getGlobalPcbPositionBeforeLayout(),{width:u,height:f}=s.getPcbSize();e=Math.min(e,l-u/2),t=Math.min(t,c-f/2),r=Math.max(r,l+u/2),i=Math.max(i,c+f/2)}else if(s.componentName==="Footprint"){const l=IJe(s.children);e=Math.min(e,l.minX),t=Math.min(t,l.minY),r=Math.max(r,l.maxX),i=Math.max(i,l.maxY)}let a=r-e,o=i-t;return a<0&&(a=0),o<0&&(o=0),{minX:e,minY:t,maxX:r,maxY:i,width:a,height:o}}function m2n(n,e){const t=e.x-n.x,r=e.y-n.y;return Math.abs(t)>Math.abs(r)?t>=0?"right":"left":r>=0?"up":"down"}var y2n=n=>{if(n.length<=1)return!0;const e=n.map(a=>{const o=a._getPcbCircuitJsonBounds();return{left:o.bounds.left,right:o.bounds.right,top:o.bounds.top,bottom:o.bounds.bottom}}),t=Array(e.length).fill(!1).map(()=>Array(e.length).fill(!1));for(let a=0;a<e.length;a++)for(let o=a+1;o<e.length;o++){const s=e[a],l=e[o];t[a][o]=t[o][a]=!(s.right<l.left||s.left>l.right||s.bottom>l.top||s.top<l.bottom)}const r=new Set,i=a=>{r.add(a);for(let o=0;o<e.length;o++)t[a][o]&&!r.has(o)&&i(o)};return i(0),r.size===e.length},v2n=n=>{if(n.length===0)throw new Error("Cannot get center of empty PCB primitives array");const e=n.map(i=>i._getPcbCircuitJsonBounds().center).filter(Boolean),t=e.reduce((i,a)=>i+a.x,0),r=e.reduce((i,a)=>i+a.y,0);return{x:t/e.length,y:r/e.length}},g2n=b.object({name:b.string().optional(),pinNumber:b.number().optional(),aliases:b.array(b.string()).optional()}),p6=class extends ix{constructor(e,t={}){if(!e.name&&e.pinNumber!==void 0&&(e.name=`pin${e.pinNumber}`),!e.name)throw new Error("Port must have a name or a pinNumber");super(e);Je(this,"source_port_id",null);Je(this,"pcb_port_id",null);Je(this,"schematic_port_id",null);Je(this,"schematicSymbolPortDef",null);Je(this,"matchedComponents");Je(this,"facingDirection",null);Je(this,"originDescription",null);t.originDescription&&(this.originDescription=t.originDescription),this.matchedComponents=[]}get config(){return{componentName:"Port",zodProps:g2n}}_getGlobalPcbPositionBeforeLayout(){const e=this.matchedComponents.find(r=>r.isPcbPrimitive),t=this.parent;if(t&&!t.props.footprint)throw new Error(`${t.componentName} "${t.props.name}" does not have a footprint. Add a footprint prop, e.g. <${t.componentName.toLowerCase()} footprint="..." />`);if(!e)throw new Error(`Port ${this} has no matching PCB primitives. This often means the footprint's pads lack matching port hints.`);return(e==null?void 0:e._getGlobalPcbPositionBeforeLayout())??{x:0,y:0}}_getPcbCircuitJsonBounds(){if(!this.pcb_port_id)return super._getPcbCircuitJsonBounds();const{db:e}=this.root,t=e.pcb_port.get(this.pcb_port_id);return{center:{x:t.x,y:t.y},bounds:{left:0,top:0,right:0,bottom:0},width:0,height:0}}_getGlobalPcbPositionAfterLayout(){return this._getPcbCircuitJsonBounds().center}_getPortsInternallyConnectedToThisPort(){const e=this.parent;if(!e||!e._getInternallyConnectedPins)return[];const t=e._getInternallyConnectedPins();for(const r of t)if(r.some(i=>i===this))return r;return[]}_hasSchematicPort(){var r,i;if((r=this.parent)==null?void 0:r.getSchematicSymbol())return!!(this.schematicSymbolPortDef||this._getPortsInternallyConnectedToThisPort().some(o=>o.schematicSymbolPortDef));const t=(i=this==null?void 0:this.parent)==null?void 0:i._getSchematicBoxDimensions();return!!(t&&this.props.pinNumber!==void 0&&t.getPortPositionByPinNumber(this.props.pinNumber))}_getGlobalSchematicPositionBeforeLayout(){var r,i,a;const e=(r=this.parent)==null?void 0:r.getSchematicSymbol();if(e){let o=this.schematicSymbolPortDef;if(!o&&(o=((i=this._getPortsInternallyConnectedToThisPort().find(l=>l.schematicSymbolPortDef))==null?void 0:i.schematicSymbolPortDef)??null,!o))throw new Error(`Couldn't find schematicSymbolPortDef for port ${this.getString()}, searched internally connected ports and none had a schematicSymbolPortDef. Why are we trying to get the schematic position of this port?`);const s=Rc(this.parent.computeSchematicGlobalTransform(),q0(-e.center.x,-e.center.y));return gr(s,o)}const t=(a=this==null?void 0:this.parent)==null?void 0:a._getSchematicBoxDimensions();if(t&&this.props.pinNumber!==void 0){const o=t.getPortPositionByPinNumber(this.props.pinNumber);if(!o)throw new Error(`Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`);return gr(this.parent.computeSchematicGlobalTransform(),o)}throw new Error(`Couldn't find position for schematic_port for port ${this.getString()}`)}_getGlobalSchematicPositionAfterLayout(){const{db:e}=this.root;if(!this.schematic_port_id)throw new Error(`Can't get schematic port position after layout for "${this.getString()}", no schematic_port_id`);const t=e.schematic_port.get(this.schematic_port_id);if(!t)throw new Error(`Schematic port not found when trying to get post-layout position: ${this.schematic_port_id}`);return t.center}registerMatch(e){this.matchedComponents.push(e)}getNameAndAliases(){const{_parsedProps:e}=this;return Array.from(new Set([...e.aliases??[],...e.name?[e.name]:[],...typeof e.pinNumber=="number"?[`pin${e.pinNumber}`,e.pinNumber.toString()]:[],...this.externallyAddedAliases??[]]))}isMatchingPort(e){return this.isMatchingAnyOf(e.getNameAndAliases())}getPortSelector(){var e;return`.${(e=this.parent)==null?void 0:e.props.name} > port.${this.props.name}`}getAvailablePcbLayers(){return Array.from(new Set(this.matchedComponents.flatMap(e=>e.getAvailablePcbLayers())))}_getDirectlyConnectedTraces(){return this.getSubcircuit().selectAll("trace").filter(r=>r._isExplicitlyConnectedToPort(this))}doInitialSourceRender(){var a,o;const{db:e}=this.root,{_parsedProps:t}=this,r=this.getNameAndAliases(),i=e.source_port.insert({name:t.name,pin_number:t.pinNumber,port_hints:r,source_component_id:(a=this.parent)==null?void 0:a.source_component_id,subcircuit_id:(o=this.getSubcircuit())==null?void 0:o.subcircuit_id});this.source_port_id=i.source_port_id}doInitialSourceParentAttachment(){var t,r,i,a,o;const{db:e}=this.root;if(!((t=this.parent)!=null&&t.source_component_id))throw new Error(`${this.getString()} has no parent source component (parent: ${(r=this.parent)==null?void 0:r.getString()})`);e.source_port.update(this.source_port_id,{source_component_id:(i=this.parent)==null?void 0:i.source_component_id,subcircuit_id:(a=this.getSubcircuit())==null?void 0:a.subcircuit_id}),this.source_component_id=(o=this.parent)==null?void 0:o.source_component_id}doInitialPcbPortRender(){var a,o,s,l,c;if((a=this.root)!=null&&a.pcbDisabled)return;const{db:e}=this.root,{matchedComponents:t}=this;if(!((o=this.parent)!=null&&o.pcb_component_id))throw new Error(`${this.getString()} has no parent pcb component, cannot render pcb_port (parent: ${(s=this.parent)==null?void 0:s.getString()})`);const r=t.filter(u=>u.isPcbPrimitive);if(r.length===0)return;let i=null;if(r.length===1&&(i=r[0]._getPcbCircuitJsonBounds().center),r.length>1){if(!y2n(r))throw new Error(`${this.getString()} has multiple non-overlapping pcb matches, unclear how to place pcb_port: ${r.map(u=>u.getString()).join(", ")}. (Note: tscircuit core does not currently allow you to specify internally connected pcb primitives with the same port hints, try giving them different port hints and specifying they are connected externally- or file an issue)`);i=v2n(r)}if(i){const u=this.getSubcircuit(),f=e.pcb_port.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layers:this.getAvailablePcbLayers(),subcircuit_id:(u==null?void 0:u.subcircuit_id)??void 0,pcb_group_id:((c=this.getGroup())==null?void 0:c.pcb_group_id)??void 0,...i,source_port_id:this.source_port_id});this.pcb_port_id=f.pcb_port_id}else{const u=r[0];throw new Error(`${u.getString()} does not have a center or _getGlobalPcbPositionBeforeLayout method (needed for pcb_port placement)`)}}doInitialSchematicPortRender(){var f;const{db:e}=this.root,{_parsedProps:t}=this,r=this.getPrimitiveContainer();if(!r||!this._hasSchematicPort())return;const i=r._getGlobalSchematicPositionBeforeLayout(),a=this._getGlobalSchematicPositionBeforeLayout();let o=null;const s=r._getSchematicBoxDimensions();s&&t.pinNumber!==void 0&&(o=s.getPortPositionByPinNumber(t.pinNumber)),this.getSubcircuit().props._schDebugObjectsEnabled&&e.schematic_debug_object.insert({shape:"rect",center:a,size:{width:.1,height:.1},label:"obstacle"}),o!=null&&o.side?this.facingDirection={left:"left",right:"right",top:"up",bottom:"down"}[o.side]:this.facingDirection=m2n(i,a);const l=e.source_port.get(this.source_port_id);let c;for(const p of(l==null?void 0:l.port_hints)??[])p.match(/^(pin)?\d+$/)||(c=p);const u=e.schematic_port.insert({schematic_component_id:(f=this.parent)==null?void 0:f.schematic_component_id,center:a,source_port_id:this.source_port_id,facing_direction:this.facingDirection,distance_from_component_edge:.4,side_of_component:o==null?void 0:o.side,pin_number:t.pinNumber,true_ccw_index:o==null?void 0:o.trueIndex,display_pin_label:c});this.schematic_port_id=u.schematic_port_id}_setPositionFromLayout(e){const{db:t}=this.root;this.pcb_port_id&&t.pcb_port.update(this.pcb_port_id,{x:e.x,y:e.y})}_hasMatchedPcbPrimitive(){return this.matchedComponents.some(e=>e.isPcbPrimitive)}},FJe=n=>{const e=n.find(t=>/^(pin)?\d+$/.test(t));return e?Number.parseInt(e.replace(/^pin/,"")):null};function xP(n,e){var a;const t=FJe(n);if(!t)return null;const i=[...n.filter(o=>o.toString()!==t.toString()&&o!==`pin${t}`),...((a=e==null?void 0:e.additionalAliases)==null?void 0:a[`pin${t}`])??[]];return new p6({pinNumber:t,aliases:i})}var _2n=n=>{for(const e of["leftSide","rightSide","topSide","bottomSide"])if(e in n&&typeof n[e]=="number")throw new Error(`A number was specified for "${e}", you probably meant to use "size" not "side"`);return"leftSide"in n||"rightSide"in n||"topSide"in n||"bottomSide"in n},x2n=n=>{var a,o,s,l;if(_2n(n))return{leftSize:((a=n.leftSide)==null?void 0:a.pins.length)??0,rightSize:((o=n.rightSide)==null?void 0:o.pins.length)??0,topSize:((s=n.topSide)==null?void 0:s.pins.length)??0,bottomSize:((l=n.bottomSide)==null?void 0:l.pins.length)??0};const{leftSize:e=0,rightSize:t=0,topSize:r=0,bottomSize:i=0}=n;return{leftSize:e,rightSize:t,topSize:r,bottomSize:i}};function BJe(n){return n.leftSide!==void 0}var b2n=n=>{var w,S,A,z,I,G,Y,Q;const e=n.portDistanceFromEdge??.4;let t=n.schPortArrangement?x2n(n.schPortArrangement):null;const r={left:0,right:0,top:0,bottom:0};let i=n.pinCount??null;if(i===null)if(t)i=t.leftSize+t.rightSize+t.topSize;else throw new Error("Could not determine pin count for the schematic box");if(i&&!t){const K=Math.floor(i/2);t={leftSize:i-K,rightSize:K,topSize:0,bottomSize:0}}t||(t={leftSize:0,rightSize:0,topSize:0,bottomSize:0});const a=({side:K,sideIndex:re,truePinIndex:J})=>{var Pe,we,Ce,Se;if(!n.schPortArrangement||!BJe(n.schPortArrangement))return J+1;const fe={left:"top-to-bottom",bottom:"left-to-right",right:"bottom-to-top",top:"right-to-left"}[K],me=((we=(Pe=n.schPortArrangement)==null?void 0:Pe[`${K}Side`])==null?void 0:we.direction)??fe,ve=(Se=(Ce=n.schPortArrangement)==null?void 0:Ce[`${K}Side`])==null?void 0:Se.pins;let Te=re;return me!==fe&&(Te=ve.length-re-1),_P(ve[Te],n.pinLabels)},o=[];let s=0,l=0;for(let K=0;K<t.leftSize;K++){const re=a({side:"left",sideIndex:K,truePinIndex:l}),J=((w=n.numericSchPinStyle)==null?void 0:w[`pin${re}`])??((S=n.numericSchPinStyle)==null?void 0:S[re]);J!=null&&J.topMargin&&(s+=J.topMargin),o.push({trueIndex:l,pinNumber:re,side:"left",distanceFromOrthogonalEdge:s}),J!=null&&J.bottomMargin&&(s+=J.bottomMargin),K===t.leftSize-1?r.left=s:s+=n.schPinSpacing,l++}s=0;for(let K=0;K<t.bottomSize;K++){const re=a({side:"bottom",sideIndex:K,truePinIndex:l}),J=((A=n.numericSchPinStyle)==null?void 0:A[`pin${re}`])??((z=n.numericSchPinStyle)==null?void 0:z[re]);J!=null&&J.leftMargin&&(s+=J.leftMargin),o.push({trueIndex:l,pinNumber:re,side:"bottom",distanceFromOrthogonalEdge:s}),J!=null&&J.rightMargin&&(s+=J.rightMargin),K===t.bottomSize-1?r.bottom=s:s+=n.schPinSpacing,l++}s=0;for(let K=0;K<t.rightSize;K++){const re=a({side:"right",sideIndex:K,truePinIndex:l}),J=((I=n.numericSchPinStyle)==null?void 0:I[`pin${re}`])??((G=n.numericSchPinStyle)==null?void 0:G[re]);J!=null&&J.bottomMargin&&(s+=J.bottomMargin),o.push({trueIndex:l,pinNumber:re,side:"right",distanceFromOrthogonalEdge:s}),J!=null&&J.topMargin&&(s+=J.topMargin),K===t.rightSize-1?r.right=s:s+=n.schPinSpacing,l++}s=0;for(let K=0;K<t.topSize;K++){const re=a({side:"top",sideIndex:K,truePinIndex:l}),J=((Y=n.numericSchPinStyle)==null?void 0:Y[`pin${re}`])??((Q=n.numericSchPinStyle)==null?void 0:Q[re]);J!=null&&J.rightMargin&&(s+=J.rightMargin),o.push({trueIndex:l,pinNumber:re,side:"top",distanceFromOrthogonalEdge:s}),J!=null&&J.leftMargin&&(s+=J.leftMargin),K===t.topSize-1?r.top=s:s+=n.schPinSpacing,l++}let c=n.schWidth;c||(c=Math.max(r.top+n.schPinSpacing*2,r.bottom+n.schPinSpacing*2));const u=n.pinLabels?Math.max(...Object.values(n.pinLabels).map(K=>K.length*.1)):0,f=u>0?1.1:0;c=Math.max(c,u+f);let p=n.schHeight;p||(p=Math.max(r.left+n.schPinSpacing*2,r.right+n.schPinSpacing*2));const y={left:{x:-c/2-e,y:r.left/2},bottom:{x:-r.bottom/2,y:-p/2-e},right:{x:c/2+e,y:-r.right/2},top:{x:r.top/2,y:p/2+e}},x={left:{x:0,y:-1},right:{x:0,y:1},top:{x:-1,y:0},bottom:{x:1,y:0}},T=o.map(K=>{const{distanceFromOrthogonalEdge:re,side:J}=K,fe=y[J],me=x[J];return{x:fe.x+re*me.x,y:fe.y+re*me.y,...K}});return{getPortPositionByPinNumber(K){const re=T.find(J=>J.pinNumber.toString()===K.toString());return re||null},getSize(){return{width:c,height:p}},getSizeIncludingPins(){return{width:c+(t.leftSize||t.rightSize?.4:0),height:p+(t.topSize||t.bottomSize?.4:0)}},pinCount:i}},S2n=z1("tscircuit:core:footprint"),w2n=class extends ix{get config(){return{componentName:"Footprint",zodProps:Rxn}}doInitialPcbFootprintLayout(){var f,p,y,x,T;if((f=this.root)!=null&&f.pcbDisabled)return;const n=this.children.filter(w=>w.componentName==="Constraint");if(n.length===0)return;const{isFlipped:e}=this._getPcbPrimitiveFlippedHelpers(),t=w=>e&&"left"in w&&"right"in w?{...w,left:w.right,right:w.left}:w,r=n.flatMap(w=>w._getAllReferencedComponents().componentsWithSelectors).map(({component:w,selector:S,componentSelector:A,edge:z})=>({component:w,selector:S,componentSelector:A,edge:z,bounds:w._getPcbCircuitJsonBounds()}));if(r.some(w=>w.edge))throw new Error("edge constraints not implemented yet for footprint layout, contributions welcome!");function i(w){return r.find(({selector:S})=>S===w)}const a=new bq,o={};function s(w){return w in o||(o[w]=new kM(w),a.addEditVariable(o[w],uy.weak)),o[w]}for(const{selector:w,bounds:S}of r){const A=s(`${w}_x`),z=s(`${w}_y`);a.suggestValue(A,S.center.x),a.suggestValue(z,S.center.y)}for(const w of n){const S=w._parsedProps;if("xDist"in S){const{xDist:A,left:z,right:I,edgeToEdge:G,centerToCenter:Y}=t(S),Q=s(`${z}_x`),K=s(`${I}_x`),re=(p=i(z))==null?void 0:p.bounds,J=(y=i(I))==null?void 0:y.bounds;if(Y){const fe=new U1(K,[-1,Q]);a.addConstraint(new Rx(fe,wg.Eq,S.xDist,uy.required))}else if(G){const fe=new U1(K,-J.width/2,[-1,Q],-re.width/2);a.addConstraint(new Rx(fe,wg.Eq,S.xDist,uy.required))}}else if("yDist"in S){const{yDist:A,top:z,bottom:I,edgeToEdge:G,centerToCenter:Y}=S,Q=s(`${z}_y`),K=s(`${I}_y`),re=(x=i(z))==null?void 0:x.bounds,J=(T=i(I))==null?void 0:T.bounds;if(Y){const fe=new U1(Q,[-1,K]);a.addConstraint(new Rx(fe,wg.Eq,S.yDist,uy.required))}else if(G){const fe=new U1(Q,re.height/2,[-1,K],-J.height/2);a.addConstraint(new Rx(fe,wg.Eq,S.yDist,uy.required))}}else if("sameY"in S){const{for:A}=S;if(A.length<2)continue;const z=A.map(G=>s(`${G}_y`)),I=new U1(...z.slice(1));a.addConstraint(new Rx(I,wg.Eq,z[0],uy.required))}else if("sameX"in S){const{for:A}=S;if(A.length<2)continue;const z=A.map(G=>s(`${G}_x`)),I=new U1(...z.slice(1));a.addConstraint(new Rx(I,wg.Eq,z[0],uy.required))}}a.updateVariables(),S2n.enabled&&(console.log("Solution to layout constraints:"),console.table(Object.entries(o).map(([w,S])=>({var:w,val:S.value()}))));const l={left:1/0,right:-1/0,top:-1/0,bottom:1/0};for(const{selector:w,bounds:{width:S,height:A}}of r){const z=s(`${w}_x`),I=s(`${w}_y`),G=z.value()-S/2,Y=z.value()+S/2,Q=I.value()+A/2,K=I.value()-A/2;l.left=Math.min(l.left,G),l.right=Math.max(l.right,Y),l.top=Math.max(l.top,Q),l.bottom=Math.min(l.bottom,K)}const c={x:-(l.right+l.left)/2,y:-(l.top+l.bottom)/2},u=this.getPrimitiveContainer()._getGlobalPcbPositionBeforeLayout();c.x+=u.x,c.y+=u.y;for(const{component:w,selector:S}of r){const A=s(`${S}_x`),z=s(`${S}_y`);w._setPositionFromLayout({x:A.value()+c.x,y:z.value()+c.y})}}},E2n=(n,e)=>{if(!n)return;const t={};for(const[r,i]of Object.entries(n)){const a=_P(r,e),o={leftMargin:i.marginLeft??i.leftMargin,rightMargin:i.marginRight??i.rightMargin,topMargin:i.marginTop??i.topMargin,bottomMargin:i.marginBottom??i.bottomMargin};t[`pin${a}`]={...t[`pin${a}`],...o}}return t},jJe=class{constructor({input:n}){Je(this,"input");this.input=n}solveAndMapToTraces(){const n=[];for(const e of this.input.connections){if(e.pointsToConnect.length!==2)continue;const[t,r]=e.pointsToConnect,i={type:"pcb_trace",pcb_trace_id:"",connection_name:e.name,route:[{route_type:"wire",x:t.x,y:t.y,layer:"top",width:.1},{route_type:"wire",x:r.x,y:r.y,layer:"top",width:.1}]};n.push(i)}return n}},T2n=n=>{const e=Math.min(...n.map(a=>a.center.x)),t=Math.max(...n.map(a=>a.center.x)),r=Math.min(...n.map(a=>a.center.y)),i=Math.max(...n.map(a=>a.center.y));return{minX:e,maxX:t,minY:r,maxY:i}},HJe=["top","bottom","inner1","inner2"],tH=(n,e=[])=>{var s;const t=[];if(e.length===0){const l=n[0].layers;for(const c of l)t.push(...tH(n.slice(1),[c]));return t}if(n.length===0)return[];const r=n[0],i=r.via||r.optional_via,a=e[e.length-1];if(n.length===1){const l=r;return l.layers&&i?l.layers.map(c=>({layer_path:[...e,c]})):(s=l.layers)!=null&&s.includes(a)?[{layer_path:[...e,a]}]:[]}if(!i)return r.layers&&!r.layers.includes(a)?[]:tH(n.slice(1),e.concat([a]));const o=(r.optional_via?HJe:HJe.filter(l=>l!==a)).filter(l=>{var c;return!r.layers||((c=r.layers)==null?void 0:c.includes(l))});for(const l of o)t.push(...tH(n.slice(1),e.concat(l)));return t};function VJe(n){const e={x:n.to.x-n.from.x,y:n.to.y-n.from.y},t=Math.abs(e.x),r=Math.abs(e.y);return t>r?e.x>0?"right":"left":e.y>0?"down":"up"}function kT(n,e){return Math.hypot(n.x-e.x,n.y-e.y)}var M2n=n=>{if(n.length===1)return n[0];if(n.some(l=>l.length===0))throw new Error("Cannot merge routes with zero length");const e=[],t=n[0][0],r=n[0][n[0].length-1],i=n[1][0],a=n[1][n[1].length-1],o=Math.min(kT(t,i),kT(t,a)),s=Math.min(kT(r,i),kT(r,a));o<s?e.push(...n[0].reverse()):e.push(...n[0]);for(let l=1;l<n.length;l++){const c=e[e.length-1],u=n[l],f=u[0],p=u[u.length-1],y=kT(c,f),x=kT(c,p);y<x?e.push(...u):e.push(...u.reverse())}for(let l=1;l<e.length-1;l++){const c=e[l-1],u=e[l];c.route_type==="wire"&&u.route_type==="wire"&&c.layer!==u.layer&&e.splice(l,0,{x:c.x,y:c.y,from_layer:c.layer,to_layer:u.layer,route_type:"via"})}return e},C2n=(n,e)=>{const t="_getGlobalPcbPositionBeforeLayout"in n?n._getGlobalPcbPositionBeforeLayout():n,r="_getGlobalPcbPositionBeforeLayout"in e?e._getGlobalPcbPositionBeforeLayout():e;return Math.sqrt((t.x-r.x)**2+(t.y-r.y)**2)};function R2n(n,e){if(e.length===0)throw new Error("No candidates given to getClosest method");let t=e[0],r=1/0;for(const i of e){const a=C2n(n,i);a<r&&(t=i,r=a)}return t}var A2n=(n,e)=>{let t=0;t+=n.length??0,t+=e.filter(r=>r.is_crossing).length;for(let r=1;r<e.length;r++){const i=e[r-1],a=e[r],o=Math.abs(i.from.x-i.to.x)<.01,s=Math.abs(a.from.x-a.to.x)<.01;o!==s&&t++}return t},Dpe=n=>({up:"bottom",down:"top",left:"right",right:"left"})[n]??null,Lpe=({firstEdge:n,firstEdgePort:e,firstDominantDirection:t,lastEdge:r,lastEdgePort:i,lastDominantDirection:a})=>{if(n&&e)return Lpe({lastEdge:{from:n.to,to:n.from},lastEdgePort:e,lastDominantDirection:t}).reverse().map(s=>({from:s.to,to:s.from}));let o=[];if(r&&i){const s={x:r.to.x,y:r.to.y};a==="left"||a==="right"?(s.x=i.position.x,o.push({from:r.to,to:{...s}}),o.push({from:s,to:{...i.position}})):(s.y=i.position.y,o.push({from:r.to,to:{...s}}),o.push({from:s,to:{...i.position}}))}return o=o.filter(s=>gP(s.from,s.to)>.01),o};function P2n(n){try{return[n(),null]}catch(e){return[null,e]}}function N2n(n){let e=0;for(let t=0;t<n.length;t++){const r=n[t];if(r.route_type==="wire"){const i=n[t+1];if(i){const a=i.x-r.x,o=i.y-r.y;e+=Math.sqrt(a*a+o*o)}}else r.route_type==="via"&&(e+=1.6)}return e}var D2n=n=>{var s,l;const e={left:{x:-.5,y:0},up:{x:.5,y:.5},right:{x:.5,y:0},down:{x:0,y:-.5}}[n.facingDirection],t=(s=n.parent)!=null&&s.config.shouldRenderAsSchematicBox?3:1,r=(l=n.parent)!=null&&l.config.shouldRenderAsSchematicBox&&(n.facingDirection==="left"||n.facingDirection==="right")?3:1,i=e.x,a=e.y,o=n.facingDirection==="up"?.5:0;return{schBoxVertOffset:t,schBoxHorzOffset:r,horzPortDirection:i,vertPortDirectionOffset:a,handleUp:o}},nH=({port:n,anchorPos:e,schDisplayLabel:t,source_trace_id:r},{db:i})=>{const a=D2n(n);i.schematic_net_label.insert({anchor_side:"top",center:{x:e.x+a.horzPortDirection*a.schBoxHorzOffset,y:e.y+a.vertPortDirectionOffset*a.schBoxVertOffset},source_net_id:n.source_port_id,text:t,anchor_position:{x:e.x+a.horzPortDirection*a.schBoxHorzOffset,y:e.y+a.vertPortDirectionOffset*a.schBoxVertOffset},symbol_name:"ground_horz"}),i.schematic_trace.insert({edges:[{from:{x:e.x,y:e.y},to:{x:e.x,y:e.y+a.handleUp*a.schBoxVertOffset}},{from:{x:e.x,y:e.y},to:{x:e.x+a.horzPortDirection*a.schBoxHorzOffset,y:e.y+a.vertPortDirectionOffset*a.schBoxVertOffset}}],junctions:[{x:e.x+a.horzPortDirection*a.schBoxHorzOffset,y:e.y+a.vertPortDirectionOffset*a.schBoxVertOffset}],source_trace_id:r})},Ope=({db:n,source_trace_id:e,sameNetOnly:t,differentNetOnly:r})=>{!t&&!r&&(r=!0);const i=n.source_trace.get(e),a=[];for(const o of n.schematic_trace.list()){if(o.source_trace_id===e)continue;const s=n.source_trace.get(o.source_trace_id),l=(s==null?void 0:s.subcircuit_connectivity_map_key)===i.subcircuit_connectivity_map_key;r&&l||t&&!l||a.push(o)}return a},L2n=({edges:n,otherEdges:e})=>{const t=[...n];for(let r=0;r<t.length;r++){if(r>2e3)throw new Error("Over 2000 iterations spent inside createSchematicTraceCrossingSegments, you have triggered an infinite loop, please report this!");const i=t[r],a=Math.abs(i.from.x-i.to.x)<.01?"vertical":i.from.y===i.to.y?"horizontal":"not-orthogonal";if(a==="not-orthogonal")continue;const o=[];for(const T of e){const w=T.from.x===T.to.x?"vertical":T.from.y===T.to.y?"horizontal":"not-orthogonal";if(w==="not-orthogonal"||a===w)continue;if(wJe([i.from,i.to],[T.from,T.to],{lineThickness:.01})){const A=a==="vertical"?i.from.x:T.from.x,z=a==="vertical"?T.from.y:i.from.y,I={x:A,y:z};o.push({otherEdge:T,crossingPoint:I,distanceFromEdgeFrom:gP(i.from,I)})}}if(o.length===0)continue;let s=o[0];for(const T of o)T.distanceFromEdgeFrom<s.distanceFromEdgeFrom&&(s=T);const l=s.crossingPoint,c=.075;if(l.x===i.from.x&&l.y===i.from.y)continue;const u=e2n(i.from,l),f={x:l.x-u.x*c/2,y:l.y-u.y*c/2},p={x:l.x+u.x*c/2,y:l.y+u.y*c/2},y=gP(p,i.to)<c,x=[{from:i.from,to:f},{from:f,to:p,is_crossing:!0},{from:p,to:i.to}];t.splice(r,1,...x),r+=x.length-2,y&&r++}return t},O2n=(n,e)=>{if(n.from.x===n.to.x&&e.from.x===e.to.x)return null;if(n.from.x===n.to.x){const u=n.from.x,f=(e.to.y-e.from.y)/(e.to.x-e.from.x),p=e.from.y-f*e.from.x,y=f*u+p;return u>=Math.min(e.from.x,e.to.x)&&u<=Math.max(e.from.x,e.to.x)&&y>=Math.min(e.from.y,e.to.y)&&y<=Math.max(e.from.y,e.to.y)?{x:u,y}:null}if(e.from.x===e.to.x){const u=e.from.x,f=(n.to.y-n.from.y)/(n.to.x-n.from.x),p=n.from.y-f*n.from.x,y=f*u+p;return u>=Math.min(n.from.x,n.to.x)&&u<=Math.max(n.from.x,n.to.x)&&y>=Math.min(n.from.y,n.to.y)&&y<=Math.max(n.from.y,n.to.y)?{x:u,y}:null}const t=(n.to.y-n.from.y)/(n.to.x-n.from.x),r=n.from.y-t*n.from.x,i=(e.to.y-e.from.y)/(e.to.x-e.from.x),a=e.from.y-i*e.from.x;if(t===i)return null;const o=(a-r)/(t-i),s=t*o+r,l=o>=Math.min(n.from.x,n.to.x)&&o<=Math.max(n.from.x,n.to.x)&&s>=Math.min(n.from.y,n.to.y)&&s<=Math.max(n.from.y,n.to.y),c=o>=Math.min(e.from.x,e.to.x)&&o<=Math.max(e.from.x,e.to.x)&&s>=Math.min(e.from.y,e.to.y)&&s<=Math.max(e.from.y,e.to.y);return l&&c?{x:o,y:s}:null},z2n=({edges:n,db:e,source_trace_id:t})=>{const r=Ope({db:e,source_trace_id:t,sameNetOnly:!0}).flatMap(i=>i.edges);for(const i of n)for(const a of r){const o=O2n(i,a);if(o)return`${o.x}${o.y}`,[{x:o.x,y:o.y}]}return[]},U2n=(n,{db:e})=>{const t=n.map(r=>{const i=e.source_port.get(r.source_port_id);if(!(i!=null&&i.source_component_id))return null;const a=e.source_component.get(i.source_component_id);return(a==null?void 0:a.ftype)==="simple_capacitor"?a.max_decoupling_trace_length:null}).filter(r=>r!==null);if(t.length!==0)return Math.min(...t)};function k2n(n){var a,o,s,l,c,u,f,p,y;let e=1/0,t=1/0,r=-1/0,i=-1/0;for(const x of n){let T,w,S,A;x.type==="schematic_component"?(T=(a=x.center)==null?void 0:a.x,w=(o=x.center)==null?void 0:o.y,S=(s=x.size)==null?void 0:s.width,A=(l=x.size)==null?void 0:l.height):x.type==="schematic_box"?(T=x.x,w=x.y,S=x.width,A=x.height):x.type==="schematic_port"?(T=(c=x.center)==null?void 0:c.x,w=(u=x.center)==null?void 0:u.y,S=.2,A=.2):x.type==="schematic_text"&&(T=(f=x.position)==null?void 0:f.x,w=(p=x.position)==null?void 0:p.y,S=(((y=x.text)==null?void 0:y.length)??0)*.1,A=.2),typeof T=="number"&&typeof w=="number"&&typeof S=="number"&&typeof A=="number"&&(e=Math.min(e,T-S/2),r=Math.max(r,T+S/2),t=Math.min(t,w-A/2),i=Math.max(i,w+A/2))}return{minX:e,maxX:r,minY:t,maxY:i}}function I2n(n,e={}){const{minX:t,maxX:r,minY:i,maxY:a}=n,o=e.padding??1;if(!isFinite(t)||!isFinite(r)||!isFinite(i)||!isFinite(a))return[];const s=t-o,l=r+o,c=a+o,u=i-o,f=.01;return[{type:"rect",layers:["top"],center:{x:(s+l)/2,y:c},width:l-s,height:f,connectedTo:[]},{type:"rect",layers:["top"],center:{x:(s+l)/2,y:u},width:l-s,height:f,connectedTo:[]},{type:"rect",layers:["top"],center:{x:s,y:(c+u)/2},width:f,height:c-u,connectedTo:[]},{type:"rect",layers:["top"],center:{x:l,y:(c+u)/2},width:f,height:c-u,connectedTo:[]}]}var F2n=n=>{var o;const e=n.root.db,t=n._findConnectedPorts().ports??[],r=new Set(t.map(s=>s.schematic_port_id)),i=[];for(const s of e.toArray()){if(s.type==="schematic_component"){const l=!!s.symbol_name,c=s.size.width>s.size.height?"horz":"vert";i.push({type:"rect",layers:["top"],center:s.center,width:s.size.width+(l&&c==="horz"?-.5:0),height:s.size.height+(l&&c==="vert"?-.5:0),connectedTo:[]})}if(s.type==="schematic_port"){if(r.has(s.schematic_port_id))continue;const l=s.facing_direction?t2n(s.facing_direction):{x:0,y:0};i.push({type:"rect",layers:["top"],center:{x:s.center.x-l.x*.1,y:s.center.y-l.y*.1},width:.1+Math.abs(l.x)*.3,height:.1+Math.abs(l.y)*.3,connectedTo:[]})}s.type==="schematic_text"&&i.push({type:"rect",layers:["top"],center:s.position,width:(((o=s.text)==null?void 0:o.length)??0)*.1,height:.2,connectedTo:[]}),s.type==="schematic_box"&&i.push({type:"rect",layers:["top"],center:{x:s.x,y:s.y},width:s.width,height:s.height,connectedTo:[]})}const a=k2n(e.toArray());return i.push(...I2n(a,{padding:1})),i};function B2n({ports:n,nets:e}){var t,r,i;if(n.length>=2)return`${(t=n[0])==null?void 0:t.selector} to ${(r=n[1])==null?void 0:r.selector}`;if(n.length===1&&e.length===1)return`${(i=n[0])==null?void 0:i.selector} to net.${e[0]._parsedProps.name}`}var j2n=({edges:n,db:e,source_trace_id:t})=>{e.source_trace.get(t);const r=Ope({db:e,source_trace_id:t,differentNetOnly:!0}).flatMap(a=>a.edges),i=a=>{const{from:o,to:s}=a;return o.x===s.x?"vertical":"horizontal"};for(const a of n){const o=i(a),s=()=>r.find(c=>i(c)===o&&wJe([a.from,a.to],[c.from,c.to],{lineThickness:.05}));let l=s();for(;l;)o==="horizontal"?(a.from.y+=.1,a.to.y+=.1):(a.from.x+=.1,a.to.x+=.1),l=s()}},H2n=(n,{db:e})=>{const t=e.pcb_board.list()[0];if(t.outline){const l=t.outline,c=(u,f)=>{let p=!1;for(let y=0,x=f.length-1;y<f.length;x=y++){const T=f[y].x,w=f[y].y,S=f[x].x,A=f[x].y;w>u.y!=A>u.y&&u.x<(S-T)*(u.y-w)/(A-w)+T&&(p=!p)}return p};return n.some(u=>!c(u,l))}const r=t.width,i=t.height,a=t.center.x,o=t.center.y;return n.some(l=>l.x<a-r/2||l.y<o-i/2||l.x>a+r/2||l.y>o+i/2)},rH=n=>({...n._getGlobalPcbPositionAfterLayout(),layers:n.getAvailablePcbLayers()}),uw=class extends ix{constructor(e){super(e);Je(this,"source_trace_id",null);Je(this,"pcb_trace_id",null);Je(this,"schematic_trace_id",null);Je(this,"_portsRoutedOnPcb");Je(this,"subcircuit_connectivity_map_key",null);Je(this,"_traceConnectionHash",null);this._portsRoutedOnPcb=[]}get config(){return{zodProps:Cxn,componentName:"Trace"}}_getTracePortOrNetSelectorListFromProps(){return"from"in this.props&&"to"in this.props?[typeof this.props.from=="string"?this.props.from:this.props.from.getPortSelector(),typeof this.props.to=="string"?this.props.to:this.props.to.getPortSelector()]:"path"in this.props?this.props.path.map(e=>typeof e=="string"?e:e.getPortSelector()):[]}getTracePortPathSelectors(){return this._getTracePortOrNetSelectorListFromProps().filter(e=>!e.includes("net."))}getTracePathNetSelectors(){return this._getTracePortOrNetSelectorListFromProps().filter(e=>e.includes("net."))}_findConnectedPorts(){const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r)throw new Error("Trace has no parent");const a=this.getTracePortPathSelectors().map(o=>({selector:o,port:this.getSubcircuit().selectOne(o,{type:"port"})??null}));for(const{selector:o,port:s}of a)if(!s){const l=o.replace(/(\> )?[^ ]+$/,""),c=this.getSubcircuit().selectOne(l);c?this.renderError(`Could not find port for selector "${o}" (did you forget to include the pin name?)
|
|
13425
|
-
searched component ${c.getString()}, which has ports: ${c.children.filter(u=>u.componentName==="Port").map(u=>`${u.getString()}(${u.getNameAndAliases().join(",")})`).join(" & ")}`):this.renderError(`Could not find port for selector "${o}"`)}return a.some(o=>!o.port)?{allPortsFound:!1}:{allPortsFound:!0,portsWithSelectors:a,ports:a.map(({port:o})=>o)}}_findConnectedNets(){const e=this.getTracePathNetSelectors().map(r=>({selector:r,net:this.getSubcircuit().selectOne(r,{type:"net"})})),t=e.filter(r=>!r.net);return t.length>0&&this.renderError(`Could not find net for selector "${t[0].selector}" inside ${this}`),{netsWithSelectors:e,nets:e.map(r=>r.net)}}_getAllTracesConnectedToSameNet(){const e=this.getSubcircuit().selectAll("trace"),t=this._findConnectedNets().nets,r=this._findConnectedPorts().ports??[];return e.filter(i=>{if(i===this)return!1;const a=i._findConnectedNets().nets,o=i._findConnectedPorts().ports??[];return a.some(s=>t.includes(s))||o.some(s=>r.includes(s))})}_isExplicitlyConnectedToPort(e){const{allPortsFound:t,portsWithSelectors:r}=this._findConnectedPorts();return t?r.map(a=>a.port).includes(e):!1}_isExplicitlyConnectedToNet(e){return this._findConnectedNets().nets.includes(e)}doInitialCreateNetsFromProps(){LJe(this,this.getTracePathNetSelectors())}_computeTraceConnectionHash(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();return!e||!t?null:[...t].sort((a,o)=>(a.pcb_port_id||"").localeCompare(o.pcb_port_id||"")).map(a=>a.pcb_port_id).join(",")}doInitialSourceTraceRender(){var f;const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r){this.renderError("Trace has no parent");return}const{allPortsFound:i,portsWithSelectors:a}=this._findConnectedPorts();if(!i)return;this._traceConnectionHash=this._computeTraceConnectionHash();const s=e.source_trace.list().find(p=>p.subcircuit_connectivity_map_key===this.subcircuit_connectivity_map_key&&p.connected_source_port_ids.sort().join(",")===this._traceConnectionHash);if(s){this.source_trace_id=s.source_trace_id;return}const l=this._findConnectedNets().nets,c=B2n({ports:a,nets:l}),u=e.source_trace.insert({connected_source_port_ids:a.map(p=>p.port.source_port_id),connected_source_net_ids:l.map(p=>p.source_net_id),subcircuit_id:(f=this.getSubcircuit())==null?void 0:f.subcircuit_id,max_length:U2n(a.map(p=>p.port),{db:e})??t.maxLength,display_name:c,min_trace_thickness:t.thickness});this.source_trace_id=u.source_trace_id}_insertErrorIfTraceIsOutsideBoard(e,t){const{db:r}=this.root;H2n(e,{db:r})&&r.pcb_trace_error.insert({error_type:"pcb_trace_error",source_trace_id:this.source_trace_id,message:`Trace ${this.getString()} routed outside the board boundaries.`,pcb_trace_id:this.pcb_trace_id,pcb_component_ids:[],pcb_port_ids:t.map(a=>a.pcb_port_id)})}doInitialPcbTraceRender(){var K,re,J,fe;if((K=this.root)!=null&&K.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t,parent:r}=this,i=this.getSubcircuit();if(!r)throw new Error("Trace has no parent");if(i._parsedProps.routingDisabled)return;const a=(re=i._parsedProps.pcbRouteCache)==null?void 0:re.pcbTraces;if(a){const me=e.pcb_trace.insert({route:a.flatMap(ve=>ve.route),source_trace_id:this.source_trace_id,subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((J=this.getGroup())==null?void 0:J.pcb_group_id)??void 0});this.pcb_trace_id=me.pcb_trace_id;return}if(!i._shouldUseTraceByTraceRouting())return;const{allPortsFound:o,ports:s}=this._findConnectedPorts();if(!o)return;const l=[];for(const me of s)me._hasMatchedPcbPrimitive()||l.push(me);if(l.length>0){e.pcb_trace_error.insert({error_type:"pcb_trace_error",source_trace_id:this.source_trace_id,message:`Some ports did not have a matching PCB primitive (e.g. a pad or plated hole), this can happen if a footprint is missing. As a result, ${this} wasn't routed. Missing ports: ${l.map(me=>me.getString()).join(", ")}`,pcb_trace_id:this.pcb_trace_id,pcb_component_ids:[],pcb_port_ids:l.map(me=>me.pcb_port_id).filter(Boolean)});return}const c=this._findConnectedNets().netsWithSelectors;if(s.length===0&&c.length===2){this.renderError("Trace connects two nets, we haven't implemented a way to route this yet");return}else if(s.length===1&&c.length===1){const me=s[0],Te=c[0].net.getAllConnectedPorts().filter(we=>we!==me);if(Te.length===0){console.log("Nothing to connect this port to, the net is empty. TODO should emit a warning!");return}const Pe=R2n(me,Te);s.push(Pe)}else if(s.length>1&&c.length>=1){this.renderError("Trace has more than one port and one or more nets, we don't currently support this type of complex trace routing");return}const u=s.flatMap(me=>me.matchedComponents.filter(ve=>ve.componentName==="TraceHint")),f=(this._parsedProps.pcbRouteHints??[]).concat(u.flatMap(me=>me.getPcbRouteHints()));if(s.length>2){this.renderError(`Trace has more than two ports (${s.map(me=>me.getString()).join(", ")}), routing between more than two ports for a single trace is not implemented`);return}if(this.getSubcircuit().selectAll("trace").filter(me=>me.renderPhaseStates.PcbTraceRender.initialized).some(me=>me._portsRoutedOnPcb.length===s.length&&me._portsRoutedOnPcb.every(ve=>s.includes(ve))))return;let x=[];f.length===0?x=[rH(s[0]),rH(s[1])]:x=[rH(s[0]),...f,rH(s[1])];const T=tH(x),w=zb(this.root.db.toArray()),[S,A]=P2n(()=>Vw(this.root.db.toArray()));if(A){this.renderError({type:"pcb_trace_error",error_type:"pcb_trace_error",pcb_trace_error_id:this.pcb_trace_id,message:`Error getting obstacles for autorouting: ${A.message}`,source_trace_id:this.source_trace_id,center:{x:0,y:0},pcb_port_ids:s.map(me=>me.pcb_port_id),pcb_trace_id:this.pcb_trace_id,pcb_component_ids:[]});return}for(const me of S)if(me.connectedTo.length>0){const Te=w.getNetConnectedToId(me.connectedTo[0]);Te&&me.connectedTo.push(Te)}let z=[];if(T.length===0)z=x;else{const me=T[0].layer_path;z=x.map((ve,Te)=>ve.via?{...ve,via_to_layer:me[Te]}:{...ve,layers:[me[Te]]})}z[0].pcb_port_id=s[0].pcb_port_id,z[z.length-1].pcb_port_id=s[1].pcb_port_id;const I=[];for(const[me,ve]of NJe(z)){const Te="via_to_layer"in me?me.via_to_layer:null,Pe=2,we="layers"in me&&me.layers.length===1?me.layers[0]:Te??"top",Ce="layers"in ve&&ve.layers.length===1?ve.layers[0]:Te??"top",Se="pcb_port_id"in me?me.pcb_port_id:null,ze="pcb_port_id"in ve?ve.pcb_port_id:null,Ue=this.getSubcircuit()._parsedProps.minTraceWidth??.16,Ie=new Hw({OBSTACLE_MARGIN:Ue*2,isRemovePathLoopsEnabled:!0,optimizeWithGoalBoxes:!!(Se&&ze),connMap:w,input:{obstacles:S,minTraceWidth:Ue,connections:[{name:this.source_trace_id,pointsToConnect:[{...me,layer:we,pcb_port_id:Se},{...ve,layer:Ce,pcb_port_id:ze}]}],layerCount:2,bounds:{minX:Math.min(me.x,ve.x)-Pe,maxX:Math.max(me.x,ve.x)+Pe,minY:Math.min(me.y,ve.y)-Pe,maxY:Math.max(me.y,ve.y)+Pe}}});let ke=null;try{ke=Ie.solveAndMapToTraces()}catch(gt){this.renderError({type:"pcb_trace_error",pcb_trace_error_id:this.source_trace_id,error_type:"pcb_trace_error",message:`error solving route: ${gt.message}`,source_trace_id:this.pcb_trace_id,center:{x:(me.x+ve.x)/2,y:(me.y+ve.y)/2},pcb_port_ids:s.map(wt=>wt.pcb_port_id),pcb_trace_id:this.pcb_trace_id,pcb_component_ids:s.map(wt=>wt.pcb_component_id)})}if(!ke)return;if(ke.length===0){this.renderError({type:"pcb_trace_error",error_type:"pcb_trace_error",pcb_trace_error_id:this.pcb_trace_id,message:`Could not find a route for ${this}`,source_trace_id:this.source_trace_id,center:{x:(me.x+ve.x)/2,y:(me.y+ve.y)/2},pcb_port_ids:s.map(gt=>gt.pcb_port_id),pcb_trace_id:this.pcb_trace_id,pcb_component_ids:s.map(gt=>gt.pcb_component_id)});return}const[ot]=ke;Te&&(ot.route=ot.route.map(gt=>(gt.route_type==="wire"&&!gt.layer&&(gt.layer=Te),gt))),Se&&ot.route[0].route_type==="wire"&&(ot.route[0].start_pcb_port_id=Se);const nt=ot.route[ot.route.length-1];ze&&nt.route_type==="wire"&&(nt.end_pcb_port_id=ze),I.push(ot.route)}const G=M2n(I),Y=N2n(G),Q=e.pcb_trace.insert({route:G,source_trace_id:this.source_trace_id,subcircuit_id:(fe=this.getSubcircuit())==null?void 0:fe.subcircuit_id,trace_length:Y});this._portsRoutedOnPcb=s,this.pcb_trace_id=Q.pcb_trace_id;for(const me of G)me.route_type==="via"&&e.pcb_via.insert({pcb_trace_id:Q.pcb_trace_id,x:me.x,y:me.y,hole_diameter:.3,outer_diameter:.6,layers:[me.from_layer,me.to_layer],from_layer:me.from_layer,to_layer:me.to_layer});this._insertErrorIfTraceIsOutsideBoard(G,s)}_doInitialSchematicTraceRenderWithDisplayLabel(){var I,G,Y,Q;if((I=this.root)!=null&&I.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r)throw new Error("Trace has no parent");const{allPortsFound:i,portsWithSelectors:a}=this._findConnectedPorts();if(!i)return;const o=a.map(({port:K})=>({port:K,position:K._getGlobalSchematicPositionAfterLayout(),schematic_port_id:K.schematic_port_id,facingDirection:K.facingDirection}));if(o.length<2)throw new Error("Expected at least two ports in portsWithPosition.");let s,l;const c=o[0].position,u=o[0].port;if("path"in this.props){if(this.props.path.length!==2)throw new Error("Invalid 'path': Must contain exactly two elements.");[s,l]=this.props.path}else{if(!("from"in this.props&&"to"in this.props))throw new Error("Missing 'from' or 'to' properties in props.");s=this.props.from,l=this.props.to}if(!u.source_port_id)throw new Error(`Missing source_port_id for the 'from' port (${s}).`);const f=o[1].position,p=o[1].port;if(!p.source_port_id)throw new Error(`Missing source_port_id for the 'to' port (${l}).`);const y=e.schematic_net_label.list().find(K=>K.source_net_id===u.source_port_id),x=e.schematic_net_label.list().find(K=>K.source_net_id===p.source_port_id),[T,w]=a.map(({port:K})=>K),A=((G=T.parent)==null?void 0:G.config.shouldRenderAsSchematicBox)?`${(Y=T==null?void 0:T.parent)==null?void 0:Y.props.name}_${T==null?void 0:T.props.name}`:`${(Q=w==null?void 0:w.parent)==null?void 0:Q.props.name}_${w==null?void 0:w.props.name}`,z=this.props.schDisplayLabel??A;if(y&&y.text!==z&&(y.text=`${z} / ${y.text}`),x&&(x==null?void 0:x.text)!==z&&(x.text=`${z} / ${x.text}`),z!=null&&z.toLocaleLowerCase().includes("gnd")||z!=null&&z.toLocaleLowerCase().includes("ground")){!y&&!x?(nH({port:u,anchorPos:c,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e}),nH({port:p,anchorPos:f,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e})):y?x||nH({port:p,anchorPos:f,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e}):nH({port:u,anchorPos:c,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e});return}x||e.schematic_net_label.insert({text:this.props.schDisplayLabel??A,source_net_id:p.source_port_id,anchor_position:f,center:f,anchor_side:Dpe(p.facingDirection)??"bottom"}),y||e.schematic_net_label.insert({text:this.props.schDisplayLabel??A,source_net_id:u.source_port_id,anchor_position:c,center:c,anchor_side:Dpe(u.facingDirection)??"bottom"})}_isSymbolToChipConnection(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();if(!e||t.length!==2)return!1;const[r,i]=t;if(!(r!=null&&r.parent)||!(i!=null&&i.parent))return!1;const a=r.parent.config.shouldRenderAsSchematicBox,o=i.parent.config.shouldRenderAsSchematicBox;return a&&!o||!a&&o}_isSymbolToSymbolConnection(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();if(!e||t.length!==2)return!1;const[r,i]=t;if(!(r!=null&&r.parent)||!(i!=null&&i.parent))return!1;const a=!r.parent.config.shouldRenderAsSchematicBox,o=!i.parent.config.shouldRenderAsSchematicBox;return a&&o}_isChipToChipConnection(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();if(!e||t.length!==2)return!1;const[r,i]=t;if(!(r!=null&&r.parent)||!(i!=null&&i.parent))return!1;const a=r.parent.config.shouldRenderAsSchematicBox,o=i.parent.config.shouldRenderAsSchematicBox;return a&&o}doInitialSchematicTraceRender(){var we,Ce;if((we=this.root)!=null&&we.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r)throw new Error("Trace has no parent");const{allPortsFound:i,portsWithSelectors:a}=this._findConnectedPorts(),{netsWithSelectors:o}=this._findConnectedNets();if(!i)return;const l=a.map(Se=>Se.port.schematic_port_id).sort().join(","),c=(Ce=this.root)==null?void 0:Ce._getBoard();if(c!=null&&c._connectedSchematicPortPairs&&c._connectedSchematicPortPairs.has(l))return;if(this.props.schDisplayLabel&&("from"in this.props&&"to"in this.props||"path"in this.props)){this._doInitialSchematicTraceRenderWithDisplayLabel();return}const u={name:this.source_trace_id,pointsToConnect:[]},f=F2n(this),p=a.map(({port:Se})=>({port:Se,position:Se._getGlobalSchematicPositionAfterLayout(),schematic_port_id:Se.schematic_port_id??void 0,facingDirection:Se.facingDirection}));if(p.length===1&&o.length===1){const Se=o[0].net,{port:ze,position:Ue}=p[0];e.schematic_net_label.insert({text:Se._parsedProps.name,source_net_id:Se.source_net_id,anchor_position:Ue,center:Ue,anchor_side:Dpe(ze.facingDirection)??"bottom"});return}if(p.length<2)return;u.pointsToConnect=p.map(({position:Se})=>({...Se,layer:"top"}));const x=T2n(f),T=2,w={minTraceWidth:.1,obstacles:f,connections:[u],bounds:{minX:x.minX-T,maxX:x.maxX+T,minY:x.minY-T,maxY:x.maxY+T},layerCount:1};let S=Hw,A=!1;this.getSubcircuit().props._schDirectLineRoutingEnabled&&(S=jJe,A=!0);let I=new S({input:w,MAX_ITERATIONS:100,OBSTACLE_MARGIN:.1,isRemovePathLoopsEnabled:!0,isShortenPathWithShortcutsEnabled:!0,marginsWithCosts:[{margin:1,enterCost:0,travelCostFactor:1},{margin:.3,enterCost:0,travelCostFactor:1},{margin:.2,enterCost:0,travelCostFactor:2},{margin:.1,enterCost:0,travelCostFactor:3}]}).solveAndMapToTraces();if(I.length===0){if(this._isSymbolToChipConnection()||this._isSymbolToSymbolConnection()||this._isChipToChipConnection()){this._doInitialSchematicTraceRenderWithDisplayLabel();return}I=new jJe({input:w}).solveAndMapToTraces(),A=!0}const[{route:G}]=I;let Y=[];for(let Se=0;Se<G.length-1;Se++)Y.push({from:G[Se],to:G[Se+1]});const Q=this.source_trace_id;let K=[];if(!A){j2n({edges:Y,db:e,source_trace_id:Q});const Se=Ope({db:e,source_trace_id:Q,differentNetOnly:!0}).flatMap(ze=>ze.edges);Y=L2n({edges:Y,otherEdges:Se}),K=z2n({edges:Y,db:e,source_trace_id:this.source_trace_id})}const re=Y[Y.length-1],J=p[p.length-1],fe=VJe(re);Y.push(...Lpe({lastEdge:re,lastEdgePort:J,lastDominantDirection:fe}));const me=Y[0],ve=p[0],Te=VJe(me);if(Y.unshift(...Lpe({firstEdge:me,firstEdgePort:ve,firstDominantDirection:Te})),!this.source_trace_id)throw new Error("Missing source_trace_id for schematic trace insertion.");if(this.getSubcircuit()._parsedProps.schTraceAutoLabelEnabled&&A2n(K,Y)>=5&&(this._isSymbolToChipConnection()||this._isSymbolToSymbolConnection()||this._isChipToChipConnection())){this._doInitialSchematicTraceRenderWithDisplayLabel();return}const Pe=e.schematic_trace.insert({source_trace_id:this.source_trace_id,edges:Y,junctions:K});this.schematic_trace_id=Pe.schematic_trace_id,c!=null&&c._connectedSchematicPortPairs&&c._connectedSchematicPortPairs.add(l)}},V2n=z1("tscircuit:core"),$2n=b.object({x:d6,y:d6,z:d6}),d2=class extends ix{constructor(e){super(e);Je(this,"reactSubtrees",[]);Je(this,"_impliedFootprint");Je(this,"isPrimitiveContainer",!0);Je(this,"_asyncSupplierPartNumbers");Je(this,"pcb_missing_footprint_error_id");this._addChildrenFromStringFootprint(),this.initPorts()}get defaultInternallyConnectedPinNames(){return[]}get internallyConnectedPinNames(){return this._parsedProps.internallyConnectedPins??this.defaultInternallyConnectedPinNames}initPorts(e={}){var o,s,l,c,u,f,p,y,x,T;if((o=this.root)!=null&&o.schematicDisabled)return;const{config:t}=this,r=[],i=this._getSchematicPortArrangement();if(i&&!this._parsedProps.pinLabels){for(const A in i){const z=i[A].pins;if(Array.isArray(z))for(const I of z){const G=_P(I,this._parsedProps.pinLabels);r.push(new p6({pinNumber:G,aliases:((s=e.additionalAliases)==null?void 0:s[`pin${G}`])??[]},{originDescription:`schPortArrangement:${A}`}))}}const w=["left","right","top","bottom"];let S=1;for(const A of w){const z=i[`${A}Size`];for(let I=0;I<z;I++)r.push(new p6({pinNumber:S++,aliases:((l=e.additionalAliases)==null?void 0:l[`pin${S}`])??[]},{originDescription:`schPortArrangement:${A}`}))}}const a=this._parsedProps.pinLabels;if(a)for(let[w,S]of Object.entries(a)){w=w.replace("pin","");let A=r.find(G=>G._parsedProps.pinNumber===Number(w));const z=Array.isArray(S)?S[0]:S,I=Array.isArray(S)?S.slice(1):[];A?(A.externallyAddedAliases.push(z,...I),A.props.name=z):(A=new p6({pinNumber:parseInt(w),name:z,aliases:[...I,...((c=e.additionalAliases)==null?void 0:c[`pin${parseInt(w)}`])??[]]},{originDescription:`pinLabels:pin${w}`}),r.push(A))}if(t.schematicSymbolName){const w=H4[this._getSchematicSymbolNameOrThrow()];if(!w)return;for(const S of w.ports){const A=FJe(S.labels);if(!A)continue;const z=r.find(I=>I._parsedProps.pinNumber===Number(A));if(z)z.schematicSymbolPortDef=S;else{const I=xP(S.labels.concat(((u=e.additionalAliases)==null?void 0:u[`pin${A}`])??[]));I&&(I.originDescription=`schematicSymbol:labels[0]:${S.labels[0]}`,I.schematicSymbolPortDef=S,r.push(I))}}this.addAll(r)}if(!this._getSchematicPortArrangement()){const w=this.getPortsFromFootprint(e);for(const S of w)r.some(A=>A.isMatchingAnyOf(S.getNameAndAliases()))||r.push(S)}for(let w=1;w<=(e.pinCount??this._getPinCount());w++){if(!i||r.find(A=>A._parsedProps.pinNumber===w))continue;let S=[...((f=i.leftSide)==null?void 0:f.pins)??[],...((p=i.rightSide)==null?void 0:p.pins)??[],...((y=i.topSide)==null?void 0:y.pins)??[],...((x=i.bottomSide)==null?void 0:x.pins)??[]].map(A=>_P(A,this._parsedProps.pinLabels));["leftSize","rightSize","topSize","bottomSize","leftPinCount","rightPinCount","topPinCount","bottomPinCount"].some(A=>A in i)&&(S=Array.from({length:this._getPinCount()},(A,z)=>z+1)),S.includes(w)&&r.push(new p6({pinNumber:w,aliases:((T=e.additionalAliases)==null?void 0:T[`pin${w}`])??[]},{originDescription:`notOtherwiseAddedButDeducedFromPinCount:${w}`}))}r.length>0&&this.addAll(r)}_getImpliedFootprintString(){return null}_addChildrenFromStringFootprint(){var i;const{name:e,pcbRotation:t}=this.props;let{footprint:r}=this.props;if(r??(r=(i=this._getImpliedFootprintString)==null?void 0:i.call(this)),!!r&&typeof r=="string"){const a=Ow.string(r).soup(),o=h2n({componentName:e,componentRotation:t},a);this.addAll(o)}}get portMap(){return new Proxy({},{get:(e,t)=>{const r=this.children.find(i=>i.componentName==="Port"&&i.isMatchingNameOrAlias(t));if(!r)throw new Error(`There was an issue finding the port "${t.toString()}" inside of a ${this.componentName} component with name: "${this.props.name}". This is a bug in @tscircuit/core`);return r}})}getInstanceForReactElement(e){for(const t of this.reactSubtrees)if(t.element===e)return t.component;return null}doInitialSourceRender(){const e=this.config.sourceFtype;if(!e)return;const{db:t}=this.root,{_parsedProps:r}=this,i=t.source_component.insert({ftype:e,name:r.name,manufacturer_part_number:r.manufacturerPartNumber??r.mfn,supplier_part_numbers:r.supplierPartNumbers});this.source_component_id=i.source_component_id}doInitialSchematicComponentRender(){var i,a,o;if((i=this.root)!=null&&i.schematicDisabled)return;const{db:e}=this.root,{schematicSymbolName:t}=this.config;t?this._doInitialSchematicComponentRenderWithSymbol():this._getSchematicBoxDimensions()&&this._doInitialSchematicComponentRenderWithSchematicBoxDimensions();const r=(a=this.getSubcircuit())==null?void 0:a._getSchematicManualPlacementForComponent(this);if(this.schematic_component_id&&(this.props.schX!==void 0||this.props.schY!==void 0)&&r){if(!this.schematic_component_id)return;const s=lZe.parse({type:"schematic_manual_edit_conflict_warning",schematic_manual_edit_conflict_warning_id:`schematic_manual_edit_conflict_${this.source_component_id}`,message:`${this.getString()} has both manual placement and prop coordinates. schX and schY will be used. Remove schX/schY or clear the manual placement.`,schematic_component_id:this.schematic_component_id,source_component_id:this.source_component_id,subcircuit_id:(o=this.getSubcircuit())==null?void 0:o.subcircuit_id});e.schematic_manual_edit_conflict_warning.insert(s)}}_getSchematicSymbolDisplayValue(){}_getInternallyConnectedPins(){if(this.internallyConnectedPinNames.length===0)return[];const e=[];for(const t of this.internallyConnectedPinNames){const r=[];for(const i of t)r.push(this.portMap[i]);e.push(r)}return e}_doInitialSchematicComponentRenderWithSymbol(){var o;if((o=this.root)!=null&&o.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getSchematicSymbolNameOrThrow(),i=H4[r],a=this._getGlobalSchematicPositionBeforeLayout();if(i){const s=e.schematic_component.insert({center:a,size:i.size,source_component_id:this.source_component_id,symbol_name:r,symbol_display_value:this._getSchematicSymbolDisplayValue()});this.schematic_component_id=s.schematic_component_id}}_doInitialSchematicComponentRenderWithSchematicBoxDimensions(){var f;if((f=this.root)!=null&&f.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getSchematicBoxDimensions(),i={};if(Array.isArray(t.pinLabels))t.pinLabels.forEach((p,y)=>{i[String(y+1)]=p});else for(const[p,y]of Object.entries(t.pinLabels??{}))i[p]=Array.isArray(y)?y[0]:y;const a=this._getGlobalSchematicPositionBeforeLayout(),o=this._getSchematicPortArrangement(),s=e.schematic_component.insert({center:a,rotation:t.schRotation??0,size:r.getSize(),port_arrangement:u2n(o),pin_spacing:t.schPinSpacing??.2,pin_styles:c2n(t.schPinStyle,t.pinLabels),port_labels:i,source_component_id:this.source_component_id}),l=(o==null?void 0:o.topSide)!==void 0||(o==null?void 0:o.bottomSide)!==void 0,c=r==null?void 0:r.getSize().width,u=r==null?void 0:r.getSize().height;e.schematic_text.insert({text:t.manufacturerPartNumber??"",schematic_component_id:s.schematic_component_id,anchor:"left",rotation:0,position:{x:l?a.x+(c??0)/2+.1:a.x-(c??0)/2,y:l?a.y+(u??0)/2+.35:a.y-(u??0)/2-.13},color:"#006464"}),e.schematic_text.insert({text:t.name??"",schematic_component_id:s.schematic_component_id,anchor:"left",rotation:0,position:{x:l?a.x+(c??0)/2+.1:a.x-(c??0)/2,y:l?a.y+(u??0)/2+.55:a.y+(u??0)/2+.13},color:"#006464"}),this.schematic_component_id=s.schematic_component_id}doInitialPcbComponentRender(){var o;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this.getSubcircuit(),i=e.pcb_component.insert({center:this._getGlobalPcbPositionBeforeLayout(),width:0,height:0,layer:t.layer??"top",rotation:t.pcbRotation??0,source_component_id:this.source_component_id,subcircuit_id:r.subcircuit_id??void 0});if(!t.footprint&&!this.isGroup){const s=e.pcb_missing_footprint_error.insert({message:`No footprint found for component: ${this.getString()}`,source_component_id:`${this.source_component_id}`,error_type:"pcb_missing_footprint_error"});this.pcb_missing_footprint_error_id=s.pcb_missing_footprint_error_id}this.pcb_component_id=i.pcb_component_id;const a=this.getSubcircuit()._getPcbManualPlacementForComponent(this);if((this.props.pcbX!==void 0||this.props.pcbY!==void 0)&&a){const s=dZe.parse({type:"pcb_manual_edit_conflict_warning",pcb_manual_edit_conflict_warning_id:`pcb_manual_edit_conflict_${this.source_component_id}`,message:`${this.getString()} has both manual placement and prop coordinates. pcbX and pcbY will be used. Remove pcbX/pcbY or clear the manual placement.`,pcb_component_id:this.pcb_component_id,source_component_id:this.source_component_id,subcircuit_id:r.subcircuit_id??void 0});e.pcb_manual_edit_conflict_warning.insert(s)}}doInitialPcbComponentSizeCalculation(){var a;if((a=this.root)!=null&&a.pcbDisabled||!this.pcb_component_id)return;const{db:e}=this.root,{_parsedProps:t}=this,r=IJe(this.children);if(r.width===0||r.height===0)return;const i={x:(r.minX+r.maxX)/2,y:(r.minY+r.maxY)/2};e.pcb_component.update(this.pcb_component_id,{center:i,width:r.width,height:r.height})}_renderReactSubtree(e){return{element:e,component:l2n(e)}}doInitialInitializePortsFromChildren(){this.initPorts()}doInitialReactSubtreesRender(){if(vt.isValidElement(this.props.footprint)){if(this.reactSubtrees.some(t=>t.element===this.props.footprint))return;const e=this._renderReactSubtree(this.props.footprint);this.reactSubtrees.push(e),this.add(e.component)}}_hasExistingPortExactly(e){return this.children.filter(r=>r.componentName==="Port").some(r=>{const i=e.getNameAndAliases(),a=r.getNameAndAliases();return i.length===a.length&&i.every(o=>a.includes(o))})}add(e){let t;if(vt.isValidElement(e)){const r=this._renderReactSubtree(e);this.reactSubtrees.push(r),t=r.component}else t=e;if(t.componentName==="Port"){if(this._hasExistingPortExactly(t))return;const i=this.children.filter(a=>a.componentName==="Port").find(a=>a.isMatchingAnyOf(t.getNameAndAliases()));i&&V2n(`Similar ports added. Port 1: ${i}, Port 2: ${t}`)}super.add(t)}getPortsFromFootprint(e){let{footprint:t}=this.props;if((!t||vt.isValidElement(t))&&(t=this.children.find(i=>i.componentName==="Footprint")),typeof t=="string"){const i=Ow.string(t).soup(),a=[];for(const o of i)if("port_hints"in o&&o.port_hints){const s=xP(o.port_hints,e);if(!s)continue;s.originDescription=`footprint:string:${t}:port_hints[0]:${o.port_hints[0]}`,a.push(s)}return a}if(!vt.isValidElement(t)&&t&&t.componentName==="Footprint"){const i=t;let a=1;const o=[];for(const s of i.children){if(!s.props.portHints)continue;let l=s.props.portHints;l.some(f=>f.startsWith("pin"))||(l=[...l,`pin${a}`]),a++;const u=xP(l);u&&(u.originDescription=`footprint:${t}`,o.push(u))}return o}const r=[];if(!t){for(const i of this.children)if(i.props.portHints&&i.isPcbPrimitive){const a=xP(i.props.portHints);a&&r.push(a)}}return r}getPortsFromSchematicSymbol(){var i;if((i=this.root)!=null&&i.schematicDisabled)return[];const{config:e}=this;if(!e.schematicSymbolName)return[];const t=H4[e.schematicSymbolName];if(!t)return[];const r=[];for(const a of t.ports){const o=xP(a.labels);o&&(o.schematicSymbolPortDef=a,r.push(o))}return r}doInitialCreateNetsFromProps(){this._createNetsFromProps(this._getNetsFromConnectionsProp())}_getNetsFromConnectionsProp(){const{_parsedProps:e}=this,t=[];if(e.connections)for(const[r,i]of Object.entries(e.connections)){const a=Array.isArray(i)?i:[i];for(const o of a)t.push(o)}return t}_createNetsFromProps(e){LJe(this,e)}_getPcbCircuitJsonBounds(){const{db:e}=this.root;if(!this.pcb_component_id)return super._getPcbCircuitJsonBounds();const t=e.pcb_component.get(this.pcb_component_id);return{center:{x:t.center.x,y:t.center.y},bounds:{left:t.center.x-t.width/2,top:t.center.y-t.height/2,right:t.center.x+t.width/2,bottom:t.center.y+t.height/2},width:t.width,height:t.height}}_getPinCountFromSchematicPortArrangement(){const e=this._getSchematicPortArrangement();if(!e)return 0;if(!BJe(e))return(e.leftSize??e.leftPinCount??0)+(e.rightSize??e.rightPinCount??0)+(e.topSize??e.topPinCount??0)+(e.bottomSize??e.bottomPinCount??0);const{leftSide:r,rightSide:i,topSide:a,bottomSide:o}=e;return Math.max(...(r==null?void 0:r.pins)??[],...(i==null?void 0:i.pins)??[],...(a==null?void 0:a.pins)??[],...(o==null?void 0:o.pins)??[])}_getPinCount(){return this._getSchematicPortArrangement()?this._getPinCountFromSchematicPortArrangement():this.getPortsFromFootprint().length}_getSchematicPortArrangement(){return this._parsedProps.schPinArrangement??this._parsedProps.schPortArrangement}_getSchematicBoxDimensions(){if(this.getSchematicSymbol()||!this.config.shouldRenderAsSchematicBox)return null;const{_parsedProps:e}=this,t=this._getPinCount(),r=e.schPinSpacing??.2;return b2n({schWidth:e.schWidth,schHeight:e.schHeight,schPinSpacing:r,numericSchPinStyle:E2n(e.schPinStyle,e.pinLabels),pinCount:t,schPortArrangement:this._getSchematicPortArrangement(),pinLabels:e.pinLabels})}doInitialCadModelRender(){var c;const{db:e}=this.root,{boardThickness:t=0}=((c=this.root)==null?void 0:c._getBoard())??{},r=this._parsedProps.cadModel;if(!this.pcb_component_id||!r&&!this.props.footprint)return;const i=this._getPcbCircuitJsonBounds(),a=e.pcb_component.get(this.pcb_component_id);if(typeof r=="string")throw new Error("String cadModel not yet implemented");const o=$2n.parse({x:0,y:0,z:typeof(r==null?void 0:r.rotationOffset)=="number"?r.rotationOffset:0,...typeof(r==null?void 0:r.rotationOffset)=="object"?r.rotationOffset??{}:{}}),s=$B.parse({x:0,y:0,z:0,...typeof(r==null?void 0:r.positionOffset)=="object"?r.positionOffset:{}}),l=this.props.layer==="bottom"?"bottom":"top";e.cad_component.insert({position:{x:i.center.x+s.x,y:i.center.y+s.y,z:(l==="bottom"?-t/2:t/2)+s.z},rotation:{x:o.x,y:(l==="top"?0:180)+o.y,z:((a==null?void 0:a.rotation)??0)+(l==="bottom"?180:0)+o.z},pcb_component_id:this.pcb_component_id,source_component_id:this.source_component_id,model_stl_url:"stlUrl"in(r??{})?this._addCachebustToModelUrl(r.stlUrl):void 0,model_obj_url:"objUrl"in(r??{})?this._addCachebustToModelUrl(r.objUrl):void 0,model_jscad:"jscad"in(r??{})?r.jscad:void 0,footprinter_string:typeof this.props.footprint=="string"&&!r?this.props.footprint:void 0})}_addCachebustToModelUrl(e){var r;if(!e||!e.includes("modelcdn.tscircuit.com"))return e;const t=((r=this.root)==null?void 0:r.getClientOrigin())??"";return`${e}${e.includes("?")?"&":"?"}cachebust_origin=${encodeURIComponent(t)}`}doInitialPartsEngineRender(){const e=this.getInheritedProperty("partsEngine");if(!e)return;const{db:t}=this.root,r=t.source_component.get(this.source_component_id);if(!r||r.supplier_part_numbers)return;let i;this.props.footprint&&typeof this.props.footprint=="string"&&(i=this.props.footprint);const a=e.findPart({sourceComponent:r,footprinterString:i});if(!(a instanceof Promise)){t.source_component.update(this.source_component_id,{supplier_part_numbers:a});return}this._queueAsyncEffect("get-supplier-part-numbers",async()=>{this._asyncSupplierPartNumbers=await a,this._markDirty("PartsEngineRender")})}updatePartsEngineRender(){const{db:e}=this.root,t=e.source_component.get(this.source_component_id);if(t&&!t.supplier_part_numbers&&this._asyncSupplierPartNumbers){e.source_component.update(this.source_component_id,{supplier_part_numbers:this._asyncSupplierPartNumbers});return}}doInitialCreateTracesFromProps(){this._createTracesFromConnectionsProp()}_createTracesFromConnectionsProp(){const{_parsedProps:e}=this;if(e.connections)for(const[t,r]of Object.entries(e.connections)){const i=Array.isArray(r)?r:[r];for(const a of i)this.add(new uw({from:`${this.getSubcircuitSelector()} > port.${t}`,to:a}))}}},G2n=class{constructor(n,e={}){Je(this,"input");Je(this,"isRouting",!1);Je(this,"solver");Je(this,"eventHandlers",{complete:[],error:[],progress:[]});Je(this,"cycleCount",0);Je(this,"stepDelay");Je(this,"timeoutId");this.input=n;const{capacityDepth:t,targetMinCapacity:r,stepDelay:i=0}=e;this.solver=new Uq(n,{capacityDepth:t,targetMinCapacity:r}),this.stepDelay=i}start(){this.isRouting||(this.isRouting=!0,this.cycleCount=0,this.runCycleAndQueueNextCycle())}runCycleAndQueueNextCycle(){var n;if(this.isRouting)try{if(this.solver.solved||this.solver.failed){this.solver.failed?this.emitEvent({type:"error",error:new Error(this.solver.error||"Routing failed")}):this.emitEvent({type:"complete",traces:this.solver.getOutputSimpleRouteJson().traces||[]}),this.isRouting=!1;return}const e=Date.now(),t=this.solver.iterations;for(;Date.now()-e<250&&!this.solver.failed&&!this.solver.solved;)this.solver.step();const r=(this.solver.iterations-t)/(Date.now()-e)*1e3;this.cycleCount++;const i=((n=this.solver)==null?void 0:n.preview())||void 0,a=this.solver.progress;this.emitEvent({type:"progress",steps:this.cycleCount,iterationsPerSecond:r,progress:a,phase:this.solver.getCurrentPhase(),debugGraphics:i}),this.stepDelay>0?this.timeoutId=setTimeout(()=>this.runCycleAndQueueNextCycle(),this.stepDelay):this.timeoutId=setTimeout(()=>this.runCycleAndQueueNextCycle(),0)}catch(e){this.emitEvent({type:"error",error:e instanceof Error?e:new Error(String(e))}),this.isRouting=!1}}stop(){this.isRouting&&(this.isRouting=!1,this.timeoutId!==void 0&&(clearTimeout(this.timeoutId),this.timeoutId=void 0))}on(n,e){n==="complete"?this.eventHandlers.complete.push(e):n==="error"?this.eventHandlers.error.push(e):n==="progress"&&this.eventHandlers.progress.push(e)}emitEvent(n){if(n.type==="complete")for(const e of this.eventHandlers.complete)e(n);else if(n.type==="error")for(const e of this.eventHandlers.error)e(n);else if(n.type==="progress")for(const e of this.eventHandlers.progress)e(n)}solveSync(){if(this.solver.solve(),this.solver.failed)throw new Error(this.solver.error||"Routing failed");return this.solver.getOutputSimpleRouteJson().traces||[]}},$Je=class extends ix{constructor(){super(...arguments);Je(this,"matchedPort",null)}get config(){return{componentName:"TraceHint",zodProps:Jxn}}doInitialPortMatching(){const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r)return;if(r.componentName==="Trace"){this.renderError(`Port inference inside trace is not yet supported (${this})`);return}if(!r)throw new Error("TraceHint has no parent");if(!t.for){this.renderError(`TraceHint has no for property (${this})`);return}const i=r.selectOne(t.for,{type:"port"});i||this.renderError(`${this} could not find port for selector "${t.for}"`),this.matchedPort=i,i.registerMatch(this)}getPcbRouteHints(){const{_parsedProps:e}=this,t=e.offset?[e.offset]:e.offsets;if(!t)return[];const r=this._computePcbGlobalTransformBeforeLayout();return t.map(i=>({...gr(r,i),via:i.via,to_layer:i.to_layer,trace_width:i.trace_width}))}doInitialPcbTraceHintRender(){var r,i,a;if((r=this.root)!=null&&r.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this;e.pcb_trace_hint.insert({pcb_component_id:(i=this.matchedPort)==null?void 0:i.pcb_component_id,pcb_port_id:(a=this.matchedPort)==null?void 0:a.pcb_port_id,route:this.getPcbRouteHints()})}},q2n=(n,e)=>{const t=n.source_group.list(),r=[],i=a=>{const o=t.filter(s=>s.parent_subcircuit_id===a);for(const s of o)s.subcircuit_id&&(r.push(s.subcircuit_id),i(s.subcircuit_id))};return i(e),r},GJe=({db:n,circuitJson:e,subcircuit_id:t,minTraceWidth:r=.1})=>{if(!n&&e&&(n=P8(e)),!n)throw new Error("db or circuitJson is required");const i=t?new Set([t]):null;if(t){const x=q2n(n,t);for(const T of x)i.add(T)}const a=(e??n.toArray()).filter(x=>!t||"subcircuit_id"in x&&i.has(x.subcircuit_id)),o=n.pcb_board.list()[0];n=P8(a);const s=zb(a),l=Vw([...n.pcb_component.list(),...n.pcb_smtpad.list(),...n.pcb_plated_hole.list(),...n.pcb_hole.list(),...n.pcb_via.list()].filter(x=>!t||(i==null?void 0:i.has(x.subcircuit_id))),s);for(const x of l){const T=x.connectedTo.flatMap(w=>s.getIdsConnectedToNet(w));x.connectedTo.push(...T)}const c=l.flatMap(x=>[{x:x.center.x-x.width/2,y:x.center.y-x.height/2},{x:x.center.x+x.width/2,y:x.center.y+x.height/2}]);let u;o?u={minX:o.center.x-o.width/2,maxX:o.center.x+o.width/2,minY:o.center.y-o.height/2,maxY:o.center.y+o.height/2}:u={minX:Math.min(...c.map(x=>x.x))-1,maxX:Math.max(...c.map(x=>x.x))+1,minY:Math.min(...c.map(x=>x.y))-1,maxY:Math.max(...c.map(x=>x.y))+1};const f=n.source_trace.list().map(x=>{const T=x.connected_source_port_ids.map(w=>{const S=n.source_port.get(w),A=n.pcb_port.getWhere({source_port_id:w});return{...S,...A}});return T.length<2?null:{name:x.source_trace_id??s.getNetConnectedToId(x.source_trace_id)??"",source_trace_id:x.source_trace_id,pointsToConnect:T.map(w=>{var S;return{x:w.x,y:w.y,layer:((S=w.layers)==null?void 0:S[0])??"top"}})}}).filter(x=>x!==null),p=n.source_net.list().filter(x=>!t||(i==null?void 0:i.has(x.subcircuit_id))),y=[];for(const x of p){const T=n.source_trace.list().filter(w=>{var S;return(S=w.connected_source_net_ids)==null?void 0:S.includes(x.source_net_id)});y.push({name:x.source_net_id??s.getNetConnectedToId(x.source_net_id),pointsToConnect:T.flatMap(w=>n.pcb_port.list().filter(A=>w.connected_source_port_ids.includes(A.source_port_id)).map(A=>{var z;return{x:A.x,y:A.y,layer:((z=A.layers)==null?void 0:z[0])??"top",pcb_port_id:A.pcb_port_id}}))})}return{simpleRouteJson:{bounds:u,obstacles:l,connections:[...f,...y],layerCount:2,minTraceWidth:r},connMap:s}},zpe=class extends d2{constructor(){super(...arguments);Je(this,"pcb_group_id",null);Je(this,"subcircuit_id",null);Je(this,"_hasStartedAsyncAutorouting",!1);Je(this,"_asyncAutoroutingResult",null)}get config(){return{zodProps:exn,componentName:"Group"}}doInitialSourceRender(){const{db:e}=this.root,t=e.source_group.insert({name:this._parsedProps.name,is_subcircuit:this.isSubcircuit});this.subcircuit_id=`subcircuit_${t.source_group_id}`,this.source_group_id=t.source_group_id,e.source_group.update(t.source_group_id,{subcircuit_id:this.subcircuit_id})}doInitialSourceParentAttachment(){var r,i,a;const{db:e}=this.root;if(!this.isSubcircuit)return;const t=(a=(i=(r=this.parent)==null?void 0:r.getSubcircuit)==null?void 0:i.call(r))==null?void 0:a.subcircuit_id;t&&e.source_group.update(this.source_group_id,{parent_subcircuit_id:t})}doInitialPcbComponentRender(){var i;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=e.pcb_group.insert({is_subcircuit:this.isSubcircuit,subcircuit_id:this.subcircuit_id,name:this._parsedProps.name,center:this._getGlobalPcbPositionBeforeLayout(),width:0,height:0,pcb_component_ids:[],source_group_id:this.source_group_id});this.pcb_group_id=r.pcb_group_id}doInitialCreateTraceHintsFromProps(){var a;const{_parsedProps:e}=this,{db:t}=this.root,r=e;if(!this.isSubcircuit)return;const i=(a=r.layout)==null?void 0:a.manual_trace_hints;if(i)for(const o of i)this.add(new $Je({for:o.pcb_port_selector,offsets:o.offsets}))}doInitialSourceAddConnectivityMapKey(){if(!this.isSubcircuit)return;const{db:e}=this.root,t=this.selectAll("trace"),r=new jw({});r.addConnections(t.map(i=>{const a=e.source_trace.get(i.source_trace_id);return a?[a.source_trace_id,...a.connected_source_port_ids,...a.connected_source_net_ids]:null}).filter(i=>i!==null));for(const i of t){if(!i.source_trace_id)continue;const a=r.getNetConnectedToId(i.source_trace_id);if(!a)continue;const{name:o}=this._parsedProps;i.subcircuit_connectivity_map_key=`${o??`unnamedsubcircuit${this._renderId}`}_${a}`,e.source_trace.update(i.source_trace_id,{subcircuit_connectivity_map_key:i.subcircuit_connectivity_map_key})}}_areChildSubcircuitsRouted(){const e=this.selectAll("group").filter(t=>t.isSubcircuit);for(const t of e)if(t._shouldRouteAsync()&&!t._asyncAutoroutingResult)return!1;return!0}_shouldRouteAsync(){const e=this._getAutorouterConfig();return e.groupMode==="sequential-trace"?!1:!!(e.local&&e.groupMode==="subcircuit"||!e.local)}_hasTracesToRoute(){const e=z1("tscircuit:core:_hasTracesToRoute"),t=this.selectAll("trace");return e(`[${this.getString()}] has ${t.length} traces to route`),t.length>0}async _runEffectMakeHttpAutoroutingRequest(){var c,u,f,p;const{db:e}=this.root,t=z1("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");this._parsedProps;const r=this._getAutorouterConfig(),i=r.serverUrl,a=r.serverMode,o=(y,x)=>{var T;return t("fetching",y),x.headers&&(x.headers["Tscircuit-Core-Version"]=(T=this.root)==null?void 0:T.getCoreVersion()),fetch(y,x)},s=this.root.db.toArray().filter(y=>y.type.startsWith("source_")||y.type.startsWith("pcb_"));if(a==="solve-endpoint"){if(((c=this.props.autorouter)==null?void 0:c.inputFormat)==="simplified"){const{autorouting_result:x}=await o(`${i}/autorouting/solve`,{method:"POST",body:JSON.stringify({input_simple_route_json:GJe({db:e,minTraceWidth:((u=this.props.autorouter)==null?void 0:u.minTraceWidth)??.15,subcircuit_id:this.subcircuit_id}).simpleRouteJson,subcircuit_id:this.subcircuit_id}),headers:{"Content-Type":"application/json"}}).then(T=>T.json());this._asyncAutoroutingResult=x,this._markDirty("PcbTraceRender");return}const{autorouting_result:y}=await o(`${i}/autorouting/solve`,{method:"POST",body:JSON.stringify({input_circuit_json:s,subcircuit_id:this.subcircuit_id}),headers:{"Content-Type":"application/json"}}).then(x=>x.json());this._asyncAutoroutingResult=y,this._markDirty("PcbTraceRender");return}const{autorouting_job:l}=await o(`${i}/autorouting/jobs/create`,{method:"POST",body:JSON.stringify({input_circuit_json:s,provider:"freerouting",autostart:!0,display_name:(f=this.root)==null?void 0:f.name,subcircuit_id:this.subcircuit_id,server_cache_enabled:r.serverCacheEnabled}),headers:{"Content-Type":"application/json"}}).then(y=>y.json());for(;;){const{autorouting_job:y}=await o(`${i}/autorouting/jobs/get`,{method:"POST",body:JSON.stringify({autorouting_job_id:l.autorouting_job_id}),headers:{"Content-Type":"application/json"}}).then(x=>x.json());if(y.is_finished){const{autorouting_job_output:x}=await o(`${i}/autorouting/jobs/get_output`,{method:"POST",body:JSON.stringify({autorouting_job_id:l.autorouting_job_id}),headers:{"Content-Type":"application/json"}}).then(T=>T.json());this._asyncAutoroutingResult={output_pcb_traces:x.output_pcb_traces},this._markDirty("PcbTraceRender");break}if(y.has_error)throw e.pcb_autorouting_error.insert({pcb_error_id:l.autorouting_job_id,message:((p=y.error)==null?void 0:p.message)??JSON.stringify(y.error)}),new Error(`Autorouting job failed: ${JSON.stringify(y.error)}`);await new Promise(x=>setTimeout(x,100))}}async _runLocalAutorouting(){var s,l,c,u,f;const{db:e}=this.root;this._parsedProps;const t=z1("tscircuit:core:_runLocalAutorouting");t(`[${this.getString()}] starting local autorouting`);const r=this._getAutorouterConfig(),{simpleRouteJson:i}=GJe({db:e,minTraceWidth:((s=this.props.autorouter)==null?void 0:s.minTraceWidth)??.15,subcircuit_id:this.subcircuit_id});(l=this.root)==null||l.emit("autorouting:start",{subcircuit_id:this.subcircuit_id,componentDisplayName:this.getString(),simpleRouteJson:i});let a;r.algorithmFn?a=await r.algorithmFn(i):a=new G2n(i,{capacityDepth:(c=this.props.autorouter)==null?void 0:c.capacityDepth,targetMinCapacity:(u=this.props.autorouter)==null?void 0:u.targetMinCapacity});const o=new Promise((p,y)=>{a.on("complete",x=>{t(`[${this.getString()}] local autorouting complete`),p(x.traces)}),a.on("error",x=>{t(`[${this.getString()}] local autorouting error: ${x.error.message}`),y(x.error)})});a.on("progress",p=>{var y;(y=this.root)==null||y.emit("autorouting:progress",{subcircuit_id:this.subcircuit_id,componentDisplayName:this.getString(),...p})}),a.start();try{const p=await o;this._asyncAutoroutingResult={output_pcb_traces:p},this._markDirty("PcbTraceRender")}catch(p){const{db:y}=this.root;throw y.pcb_autorouting_error.insert({pcb_error_id:`pcb_autorouter_error_subcircuit_${this.subcircuit_id}`,message:p instanceof Error?p.message:String(p)}),(f=this.root)==null||f.emit("autorouting:error",{subcircuit_id:this.subcircuit_id,componentDisplayName:this.getString(),error:{message:p instanceof Error?p.message:String(p)},simpleRouteJson:i}),p}finally{a.stop()}}_startAsyncAutorouting(){this._hasStartedAsyncAutorouting||(this._hasStartedAsyncAutorouting=!0,this._getAutorouterConfig().local?this._queueAsyncEffect("capacity-mesh-autorouting",async()=>this._runLocalAutorouting()):this._queueAsyncEffect("make-http-autorouting-request",async()=>this._runEffectMakeHttpAutoroutingRequest()))}doInitialPcbTraceRender(){var t;const e=z1("tscircuit:core:doInitialPcbTraceRender");if(this.isSubcircuit&&!((t=this.root)!=null&&t.pcbDisabled)&&!this.getInheritedProperty("routingDisabled")&&!this._shouldUseTraceByTraceRouting()){if(!this._areChildSubcircuitsRouted()){e(`[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`);return}e(`[${this.getString()}] no child subcircuits to wait for, initiating async routing`),this._hasTracesToRoute()&&this._startAsyncAutorouting()}}updatePcbTraceRender(){var r;const e=z1("tscircuit:core:updatePcbTraceRender");if(e(`[${this.getString()}] updating...`),!this.isSubcircuit)return;if(this._shouldRouteAsync()&&this._hasTracesToRoute()&&!this._hasStartedAsyncAutorouting){this._areChildSubcircuitsRouted()&&(e(`[${this.getString()}] child subcircuits are now routed, starting async autorouting`),this._startAsyncAutorouting());return}if(!this._asyncAutoroutingResult||this._shouldUseTraceByTraceRouting())return;const{db:t}=this.root;if(this._asyncAutoroutingResult.output_simple_route_json){e(`[${this.getString()}] updating PCB traces from simple route json (${(r=this._asyncAutoroutingResult.output_simple_route_json.traces)==null?void 0:r.length} traces)`),this._updatePcbTraceRenderFromSimpleRouteJson();return}if(this._asyncAutoroutingResult.output_pcb_traces){e(`[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`),this._updatePcbTraceRenderFromPcbTraces();return}}_updatePcbTraceRenderFromSimpleRouteJson(){const{db:e}=this.root,{traces:t}=this._asyncAutoroutingResult.output_simple_route_json;if(t)for(const r of t)e.pcb_trace.insert({subcircuit_id:this.subcircuit_id,route:r.route})}_updatePcbTraceRenderFromPcbTraces(){const{output_pcb_traces:e}=this._asyncAutoroutingResult;if(!e)return;const{db:t}=this.root;for(const r of e)if(r.type==="pcb_trace"){if(r.subcircuit_id=this.subcircuit_id,r.connection_name){const i=r.connection_name;r.source_trace_id=i}t.pcb_trace.insert(r)}for(const r of e)if(r.type!=="pcb_via"&&r.type==="pcb_trace")for(const i of r.route)i.route_type==="via"&&t.pcb_via.insert({pcb_trace_id:r.pcb_trace_id,x:i.x,y:i.y,hole_diameter:.3,outer_diameter:.6,layers:[i.from_layer,i.to_layer],from_layer:i.from_layer,to_layer:i.to_layer})}doInitialSchematicLayout(){if(!this.isSubcircuit||!this._parsedProps.schAutoLayoutEnabled)return;const{db:t}=this.root,r=this.getDescendants(),i=[];for(const s of r)if("schematic_component_id"in s){const l=t.schematic_component.get(s.schematic_component_id);if(l){const c=t.schematic_port.list().filter(u=>u.schematic_component_id===l.schematic_component_id);i.push(...c)}}const a=wq(t.toArray()),o=Eq(a);Sq(t.toArray(),o)}_getAutorouterConfig(){const e={serverUrl:"https://registry-api.tscircuit.com",serverMode:"job",serverCacheEnabled:!0},t=this._parsedProps.autorouter??this.getInheritedProperty("autorouter");return typeof t=="object"?{local:!(t.serverUrl||t.serverMode||t.serverCacheEnabled),...e,...t}:t==="auto-local"?{local:!0,groupMode:"subcircuit"}:t==="sequential-trace"?{local:!0,groupMode:"sequential-trace"}:t==="subcircuit"?{local:!0,groupMode:"subcircuit"}:t==="auto-cloud"?{local:!1,groupMode:"subcircuit",serverUrl:e.serverUrl,serverMode:e.serverMode,serverCacheEnabled:!0}:{local:!0,groupMode:"subcircuit"}}_shouldUseTraceByTraceRouting(){return this._getAutorouterConfig().groupMode==="sequential-trace"}doInitialPcbDesignRuleChecks(){var t;if((t=this.root)!=null&&t.pcbDisabled||this.getInheritedProperty("routingDisabled"))return;const{db:e}=this.root;if(this.isSubcircuit){const r=new Map;for(const i of this.children)if(!i.isSubcircuit&&i._parsedProps.name){const a=r.get(i._parsedProps.name)||[];a.push(i),r.set(i._parsedProps.name,a)}for(const[i,a]of r.entries())a.length>1&&e.pcb_trace_error.insert({error_type:"pcb_trace_error",message:`Multiple components found with name "${i}" in subcircuit "${this._parsedProps.name||"unnamed"}". Component names must be unique within a subcircuit.`,source_trace_id:"",pcb_trace_id:"",pcb_component_ids:a.map(o=>o.pcb_component_id).filter(Boolean),pcb_port_ids:[]})}}},Y2n=class extends zpe{constructor(){super(...arguments);Je(this,"pcb_board_id",null);Je(this,"_drcChecksComplete",!1);Je(this,"_connectedSchematicPortPairs",new Set)}get isSubcircuit(){return!0}get config(){return{componentName:"Board",zodProps:gJe}}get boardThickness(){const{_parsedProps:e}=this;return 1.4}get allLayers(){return["top","bottom","inner1","inner2"]}doInitialPcbBoardAutoSize(){var y;if((y=this.root)!=null&&y.pcbDisabled||!this.pcb_board_id)return;const{db:e}=this.root,{_parsedProps:t}=this;if(t.width&&t.height)return;let r=1/0,i=1/0,a=-1/0,o=-1/0;const s=e.pcb_component.list();let l=!1;for(const x of s){const{width:T,height:w,center:S}=x;T===0||w===0||(l=!0,r=Math.min(r,S.x-T/2),i=Math.min(i,S.y-w/2),a=Math.max(a,S.x+T/2),o=Math.max(o,S.y+w/2))}const c=2,u=l?a-r+c*2:0,f=l?o-i+c*2:0,p={x:l?(r+a)/2+(t.outlineOffsetX??0):t.outlineOffsetX??0,y:l?(i+o)/2+(t.outlineOffsetY??0):t.outlineOffsetY??0};e.pcb_board.update(this.pcb_board_id,{width:u,height:f,center:p})}doInitialPcbComponentRender(){var o,s;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this;let r=t.width??0,i=t.height??0;if(t.outline){const l=t.outline.map(x=>x.x),c=t.outline.map(x=>x.y),u=Math.min(...l),f=Math.max(...l),p=Math.min(...c),y=Math.max(...c);r=f-u,i=y-p}const a=e.pcb_board.insert({center:{x:(t.pcbX??0)+(t.outlineOffsetX??0),y:(t.pcbY??0)+(t.outlineOffsetY??0)},thickness:this.boardThickness,num_layers:this.allLayers.length,width:r,height:i,outline:(s=t.outline)==null?void 0:s.map(l=>({x:l.x+(t.outlineOffsetX??0),y:l.y+(t.outlineOffsetY??0)})),material:t.material});this.pcb_board_id=a.pcb_board_id}removePcbComponentRender(){const{db:e}=this.root;this.pcb_board_id&&(e.pcb_board.delete(this.pcb_board_id),this.pcb_board_id=null)}_computePcbGlobalTransformBeforeLayout(){return o9()}doInitialPcbDesignRuleChecks(){var e;(e=this.root)!=null&&e.pcbDisabled||this.getInheritedProperty("routingDisabled")||super.doInitialPcbDesignRuleChecks()}updatePcbDesignRuleChecks(){var r;if((r=this.root)!=null&&r.pcbDisabled||this.getInheritedProperty("routingDisabled"))return;const{db:e}=this.root;if(!this._areChildSubcircuitsRouted()||this._drcChecksComplete)return;this._drcChecksComplete=!0;const t=Hq(e.toArray());for(const i of t)e.pcb_trace_error.insert(i)}},X2n=new Proxy({},{get:(n,e)=>e}),bP=X2n,W2n=class extends d2{get config(){return{componentName:"Capacitor",schematicSymbolName:this.props.polarized?"capacitor_polarized":this.props.symbolName??"capacitor",zodProps:pxn,sourceFtype:bP.simple_capacitor}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}_getSchematicSymbolDisplayValue(){const n=`${R4(this._parsedProps.capacitance)}F`;return this._parsedProps.schShowRatings&&this._parsedProps.maxVoltageRating?`${n}/${R4(this._parsedProps.maxVoltageRating)}V`:n}doInitialCreateNetsFromProps(){this._createNetsFromProps([this.props.decouplingFor,this.props.decouplingTo,...this._getNetsFromConnectionsProp()])}doInitialCreateTracesFromProps(){this.props.decouplingFor&&this.props.decouplingTo&&(this.add(new uw({from:`${this.getSubcircuitSelector()} > port.1`,to:this.props.decouplingFor})),this.add(new uw({from:`${this.getSubcircuitSelector()} > port.2`,to:this.props.decouplingTo}))),this._createTracesFromConnectionsProp()}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_capacitor",name:e.name,manufacturer_part_number:e.manufacturerPartNumber??e.mfn,supplier_part_numbers:e.supplierPartNumbers,capacitance:e.capacitance,max_voltage_rating:e.maxVoltageRating,max_decoupling_trace_length:e.maxDecouplingTraceLength,display_capacitance:this._getSchematicSymbolDisplayValue()});this.source_component_id=t.source_component_id}},qJe=class extends d2{constructor(){super(...arguments);Je(this,"schematicBoxDimensions",null)}get config(){return{componentName:"Chip",zodProps:_Je,shouldRenderAsSchematicBox:!0}}doInitialSchematicComponentRender(){const{_parsedProps:e}=this;(e==null?void 0:e.noSchematicRepresentation)!==!0&&super.doInitialSchematicComponentRender()}doInitialSourceRender(){const{db:e}=this.root,{_parsedProps:t}=this,r=e.source_component.insert({ftype:"simple_chip",name:t.name,manufacturer_part_number:t.manufacturerPartNumber,supplier_part_numbers:t.supplierPartNumbers});this.source_component_id=r.source_component_id}doInitialPcbComponentRender(){var i;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=e.pcb_component.insert({center:{x:t.pcbX??0,y:t.pcbY??0},width:2,height:3,layer:t.layer??"top",rotation:t.pcbRotation??0,source_component_id:this.source_component_id,subcircuit_id:this.getSubcircuit().subcircuit_id??void 0});this.pcb_component_id=r.pcb_component_id}doInitialCreateTracesFromProps(){const{_parsedProps:e}=this;if(e.externallyConnectedPins)for(const[t,r]of e.externallyConnectedPins)this.add(new uw({from:`${this.getSubcircuitSelector()} > port.${t}`,to:`${this.getSubcircuitSelector()} > port.${r}`}));this._createTracesFromConnectionsProp()}},Z2n=class extends d2{constructor(){super(...arguments);Je(this,"pos",this.portMap.pin1);Je(this,"anode",this.portMap.pin1);Je(this,"neg",this.portMap.pin2);Je(this,"cathode",this.portMap.pin2)}get config(){return{schematicSymbolName:this.props.symbolName??"diode",componentName:"Diode",zodProps:Bxn,sourceFtype:"simple_diode"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}},Q2n=class extends d2{constructor(){super(...arguments);Je(this,"schematicDimensions",null)}get config(){return{componentName:"Jumper",zodProps:ixn,shouldRenderAsSchematicBox:!0}}doInitialSourceRender(){const{db:e}=this.root,{_parsedProps:t}=this,r=e.source_component.insert({ftype:"simple_chip",name:t.name,manufacturer_part_number:t.manufacturerPartNumber,supplier_part_numbers:t.supplierPartNumbers});this.source_component_id=r.source_component_id}doInitialPcbComponentRender(){var i;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=e.pcb_component.insert({center:{x:t.pcbX??0,y:t.pcbY??0},width:2,height:3,layer:t.layer??"top",rotation:t.pcbRotation??0,source_component_id:this.source_component_id,subcircuit_id:this.getSubcircuit().subcircuit_id??void 0});this.pcb_component_id=r.pcb_component_id}},K2n=class extends d2{constructor(){super(...arguments);Je(this,"pos",this.portMap.pin1);Je(this,"anode",this.portMap.pin1);Je(this,"neg",this.portMap.pin2);Je(this,"cathode",this.portMap.pin2)}get config(){return{componentName:"Led",schematicSymbolName:this.props.symbolName??"led",zodProps:jxn,sourceFtype:"simple_diode"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}},J2n=class extends d2{constructor(){super(...arguments);Je(this,"pos",this.portMap.pin1);Je(this,"positive",this.portMap.pin1);Je(this,"neg",this.portMap.pin2);Je(this,"negative",this.portMap.pin2)}get config(){return{schematicSymbolName:this.props.symbolName??"power_factor_meter_horz",componentName:"PowerSource",zodProps:Yxn,sourceFtype:"simple_power_source"}}initPorts(){this.add(new p6({name:"pin1",pinNumber:1,aliases:["positive","pos"]})),this.add(new p6({name:"pin2",pinNumber:2,aliases:["negative","neg"]}))}},e5n=class extends d2{get config(){return{componentName:"Resistor",schematicSymbolName:this.props.symbolName??"boxresistor",zodProps:lxn,sourceFtype:"simple_resistor"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}_getSchematicSymbolDisplayValue(){return`${R4(this._parsedProps.resistance)}Ω`}doInitialCreateNetsFromProps(){this._createNetsFromProps([this.props.pullupFor,this.props.pullupTo,...this._getNetsFromConnectionsProp()])}doInitialCreateTracesFromProps(){this.props.pullupFor&&this.props.pullupTo&&(this.add(new uw({from:`${this.getSubcircuitSelector()} > port.1`,to:this.props.pullupFor})),this.add(new uw({from:`${this.getSubcircuitSelector()} > port.2`,to:this.props.pullupTo}))),this._createTracesFromConnectionsProp()}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_resistor",name:e.name,manufacturer_part_number:e.manufacturerPartNumber??e.mfn,supplier_part_numbers:e.supplierPartNumbers,resistance:e.resistance,display_resistance:this._getSchematicSymbolDisplayValue()});this.source_component_id=t.source_component_id}},t5n=["leftedge","rightedge","topedge","bottomedge","center"],n5n=class extends ix{get config(){return{componentName:"Constraint",zodProps:gxn}}constructor(n){if(super(n),("xdist"in n||"ydist"in n)&&!("edgeToEdge"in n)&&!("centerToCenter"in n))throw new Error(`edgeToEdge, centerToCenter must be set for xDist or yDist for ${this}`);if("for"in n&&n.for.length<2)throw new Error(`"for" must have at least two selectors for ${this}`)}_getAllReferencedComponents(){const n=[],e=this.getPrimitiveContainer();function t(r){const i=r.split(" ").pop(),a=t5n.includes(i)?i:void 0,o=a?r.replace(` ${a}`,""):r,s=e.selectOne(o,{pcbPrimitive:!0});s&&n.push({selector:r,component:s,componentSelector:o,edge:a})}for(const r of["left","right","top","bottom"])r in this._parsedProps&&t(this._parsedProps[r]);if("for"in this._parsedProps)for(const r of this._parsedProps.for)t(r);return{componentsWithSelectors:n}}},r5n=class extends ix{constructor(){super(...arguments);Je(this,"fabrication_note_path_id",null)}get config(){return{componentName:"FabricationNotePath",zodProps:$xn}}doInitialPcbPrimitiveRender(){var s,l;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,t=this.getSubcircuit(),{_parsedProps:r}=this,i=r.layer??"top";if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenPath. Must be "top" or "bottom".`);const a=this._computePcbGlobalTransformBeforeLayout(),o=e.pcb_fabrication_note_path.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,color:r.color,route:r.route.map(c=>{const u=gr(a,{x:c.x,y:c.y});return{...c,x:u.x,y:u.y}}),stroke_width:r.strokeWidth??.1,subcircuit_id:(t==null?void 0:t.subcircuit_id)??void 0});this.fabrication_note_path_id=o.pcb_fabrication_note_path_id}},i5n=class extends ix{get config(){return{componentName:"FabricationNoteText",zodProps:Vxn}}doInitialPcbPrimitiveRender(){var i,a;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:n}=this.root,{_parsedProps:e}=this,t=this.getPrimitiveContainer(),r=this.getSubcircuit();n.pcb_fabrication_note_text.insert({anchor_alignment:e.anchorAlignment,anchor_position:{x:e.pcbX??0,y:e.pcbY??0},font:e.font??"tscircuit2024",font_size:e.fontSize??1,layer:"top",color:e.color,text:e.text??"",pcb_component_id:t.pcb_component_id,subcircuit_id:(r==null?void 0:r.subcircuit_id)??void 0,pcb_group_id:((a=this.getGroup())==null?void 0:a.pcb_group_id)??void 0})}},a5n=class extends zpe{constructor(n){super({...n,subcircuit:!0})}},o5n=class extends ix{constructor(){super(...arguments);Je(this,"source_net_alias_id")}get config(){return{componentName:"NetAlias",zodProps:Dxn}}doInitialSchematicComponentRender(){var a;if((a=this.root)!=null&&a.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r={x:t.schX??0,y:t.schY??0},i=e.schematic_net_label.insert({text:t.net,source_net_id:t.net,anchor_position:r,center:r,anchor_side:"bottom"});this.source_net_alias_id=i.source_net_id}},s5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_silkscreen_circle_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenCircle",zodProps:Kxn}}doInitialPcbPrimitiveRender(){var s,l,c;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers(),i=r(t.layer??"top");if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenCircle. Must be "top" or "bottom".`);this._computePcbGlobalTransformBeforeLayout();const a=this.getSubcircuit(),o=e.pcb_silkscreen_circle.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,center:{x:t.pcbX??0,y:t.pcbY??0},radius:t.radius,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((c=this.getGroup())==null?void 0:c.pcb_group_id)??void 0,stroke_width:t.strokeWidth??.1});this.pcb_silkscreen_circle_id=o.pcb_silkscreen_circle_id}getPcbSize(){const{_parsedProps:e}=this,t=e.radius*2;return{width:t,height:t}}},l5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_silkscreen_rect_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenRect",zodProps:Qxn}}doInitialPcbPrimitiveRender(){var s,l,c;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers(),i=r(t.layer??"top");if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenRect. Must be "top" or "bottom".`);const a=this.getSubcircuit(),o=e.pcb_silkscreen_rect.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,center:{x:t.pcbX??0,y:t.pcbY??0},width:t.width,height:t.height,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((c=this==null?void 0:this.getGroup())==null?void 0:c.pcb_group_id)??void 0,stroke_width:t.strokeWidth??.1});this.pcb_silkscreen_rect_id=o.pcb_silkscreen_rect_id}getPcbSize(){const{_parsedProps:e}=this;return{width:e.width,height:e.height}}},c5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_silkscreen_line_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenLine",zodProps:Zxn}}doInitialPcbPrimitiveRender(){var s,l,c;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers(),i=r(t.layer??"top");if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenLine. Must be "top" or "bottom".`);const a=this.getSubcircuit(),o=e.pcb_silkscreen_line.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke_width:t.strokeWidth??.1,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((c=a==null?void 0:a.getGroup())==null?void 0:c.pcb_group_id)??void 0});this.pcb_silkscreen_line_id=o.pcb_silkscreen_line_id}getPcbSize(){const{_parsedProps:e}=this,t=Math.abs(e.x2-e.x1),r=Math.abs(e.y2-e.y1);return{width:t,height:r}}},u5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_via_id",null);Je(this,"matchedPort",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"Via",zodProps:Gxn}}getAvailablePcbLayers(){return["top","inner1","inner2","bottom"]}getPcbSize(){const{_parsedProps:e}=this;return{width:e.outerDiameter,height:e.outerDiameter}}_getPcbCircuitJsonBounds(){const{db:e}=this.root,t=e.pcb_via.get(this.pcb_via_id),r=this.getPcbSize();return{center:{x:t.x,y:t.y},bounds:{left:t.x-r.width/2,top:t.y-r.height/2,right:t.x+r.width/2,bottom:t.y+r.height/2},width:r.width,height:r.height}}_setPositionFromLayout(e){const{db:t}=this.root;t.pcb_via.update(this.pcb_via_id,{x:e.x,y:e.y})}doInitialPcbPrimitiveRender(){var o,s;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getGlobalPcbPositionBeforeLayout(),i=this.getSubcircuit(),a=e.pcb_via.insert({x:r.x,y:r.y,hole_diameter:t.holeDiameter,outer_diameter:t.outerDiameter,layers:["bottom","top"],from_layer:t.fromLayer||"bottom",to_layer:t.toLayer||"top",subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((s=this.getGroup())==null?void 0:s.pcb_group_id)??void 0});this.pcb_via_id=a.pcb_via_id}},f5n=class extends d2{get config(){return{componentName:"Battery",schematicSymbolName:this.props.symbolName??"battery",zodProps:Pxn,sourceFtype:"simple_power_source"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:"simple_power_source",capacity:e.capacity,supplier_part_numbers:e.supplierPartNumbers});this.source_component_id=t.source_component_id}},d5n=class extends d2{get config(){return{componentName:"PinHeader",zodProps:Nxn,shouldRenderAsSchematicBox:!0}}_getImpliedFootprintString(){var i;const n=this._parsedProps.pinCount??((i=this._parsedProps.pinLabels)==null?void 0:i.length)??0,e=this._parsedProps.holeDiameter,t=this._parsedProps.platedDiameter,r=this._parsedProps.pitch;return n>0&&r?!e&&!t?`pinrow${n}_p${r}`:`pinrow${n}_p${r}_id${e}_od${t}`:null}initPorts(){var e,t;const n=this._parsedProps.pinCount??((e=this._parsedProps.pinLabels)==null?void 0:e.length)??1;for(let r=1;r<=n;r++)this.add(new p6({name:`pin${r}`,pinNumber:r,aliases:[(t=this._parsedProps.pinLabels)==null?void 0:t[r-1]].filter(Boolean)}))}_getSchematicPortArrangement(){const n=this._parsedProps.pinCount??1,e=this._parsedProps.facingDirection??"right";return{leftSize:e==="left"?n:0,rightSize:e==="right"?n:0}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_pin_header",name:e.name,supplier_part_numbers:e.supplierPartNumbers,pin_count:e.pinCount,gender:e.gender});this.source_component_id=t.source_component_id}};function p5n(n){switch(n){case"two_ground_pins":return"crystal_4pin";case"ground_pin":return"resonator";case"no_ground":return"crystal";default:return"crystal"}}var h5n=class extends d2{get config(){return{componentName:"Resonator",schematicSymbolName:this.props.symbolName??p5n(this.props.pinVariant),zodProps:fxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_resonator",name:e.name,frequency:e.frequency,load_capacitance:e.loadCapacitance,supplier_part_numbers:e.supplierPartNumbers,pin_variant:e.pinVariant||"no_ground"});this.source_component_id=t.source_component_id}},m5n=class extends d2{get config(){return{componentName:"Inductor",schematicSymbolName:this.props.symbolName??"inductor",zodProps:Uxn,sourceFtype:bP.simple_inductor}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:bP.simple_inductor,inductance:e.inductance,supplier_part_numbers:e.supplierPartNumbers});this.source_component_id=t.source_component_id}};function y5n(n){switch(n){case"three_pin":return"potentiometer3";case"two_pin":return"potentiometer2";default:return"potentiometer2"}}var v5n=class extends d2{get config(){return{componentName:"Potentiometer",schematicSymbolName:this.props.symbolName??y5n(this.props.pinVariant),zodProps:cxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_potentiometer",name:e.name,max_resistance:e.maxResistance,pin_variant:e.pinVariant||"two_pin"});this.source_component_id=t.source_component_id}},g5n=class extends d2{get config(){return{componentName:"PushButton",schematicSymbolName:this.props.symbolName??"push_button_normally_open_momentary",zodProps:Lxn,sourceFtype:bP.simple_push_button}}get defaultInternallyConnectedPinNames(){return[["pin1","pin4"],["pin2","pin3"]]}initPorts(){super.initPorts({pinCount:4,additionalAliases:{pin1:["side1"],pin3:["side2"]}})}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:bP.simple_push_button,supplier_part_numbers:e.supplierPartNumbers});this.source_component_id=t.source_component_id}},_5n=class extends d2{get config(){return{schematicSymbolName:this.props.symbolName??(this.props.pinVariant==="four_pin"?"crystal_4pin":"crystal"),componentName:"Crystal",zodProps:uxn,sourceFtype:"simple_crystal"}}initPorts(){const n=this.props.pinVariant==="four_pin"?{pin1:["left1","1"],pin2:["top1","2","gnd1"],pin3:["right1","3"],pin4:["bottom1","4","gnd2"]}:{pin1:["pos","left"],pin2:["neg","right"]};super.initPorts({additionalAliases:n})}_getSchematicSymbolDisplayValue(){return`${R4(this._parsedProps.frequency)}Hz`}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:"simple_crystal",frequency:e.frequency,load_capacitance:e.loadCapacitance,pin_variant:e.pinVariant||"two_pin"});this.source_component_id=t.source_component_id}},x5n=class extends d2{constructor(){super(...arguments);Je(this,"emitter",this.portMap.pin1);Je(this,"collector",this.portMap.pin2);Je(this,"base",this.portMap.pin3)}get config(){return{componentName:"Transistor",schematicSymbolName:this.props.type==="npn"?"npn_bipolar_transistor":"pnp_bipolar_transistor",zodProps:Oxn,sourceFtype:"simple_transistor",shouldRenderAsSchematicBox:!1}}initPorts(){super.initPorts({pinCount:3,additionalAliases:{pin1:["emitter","e"],pin2:["collector","c"],pin3:["base","b"]}})}doInitialSourceRender(){const{db:e}=this.root,{_parsedProps:t}=this,r=e.source_component.insert({ftype:"simple_transistor",name:t.name,transistor_type:t.type});this.source_component_id=r.source_component_id}},b5n=class extends d2{get config(){const n=this.props.mosfetMode==="depletion"?"d":"e";return{componentName:"Mosfet",schematicSymbolName:`${this.props.channelType}_channel_${n}_mosfet_transistor`,zodProps:zxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_mosfet",name:e.name,mosfet_mode:e.mosfetMode,channel_type:e.channelType});this.source_component_id=t.source_component_id}},S5n=class extends d2{_getSwitchType(){const{spst:n,spdt:e,dpst:t,dpdt:r,type:i}=this._parsedProps??{};return r?"dpdt":n?"spst":e?"spdt":t?"dpst":i??"spst"}get config(){const n=this._getSwitchType(),{isNormallyClosed:e}=this._parsedProps??{};return{componentName:"Switch",schematicSymbolName:{spst:e?"spst_normally_closed_switch":"SPST_switch",spdt:e?"spdt_normally_closed_switch":"SPDT_switch",dpst:e?"dpst_normally_closed_switch":"dpst_switch",dpdt:e?"dpdt_normally_closed_switch":"dpdt_switch"}[n]??"SPST_switch",zodProps:Hxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_switch",name:e.name,switch_type:e.type,is_normally_closed:e.isNormallyClosed??!1});this.source_component_id=t.source_component_id}};new Proxy({},{get:(n,e)=>{const t=(...r)=>(r[0],new Proxy({},{get:(i,a)=>`.${e} > .${a}`}));return new Proxy(t,{get:(r,i)=>e==="net"?`net.${i}`:e==="subcircuit"?new Proxy({},{get:(a,o)=>new Proxy({},{get:(s,l)=>`subcircuit.${i} > .${o} > .${l}`})}):`.${e} > .${i}`,apply:(r,i,a)=>new Proxy({},{get:(o,s)=>{const l=`.${e} > .${s}`;return e.startsWith("U")?l:new Proxy(new String(l),{get:(c,u)=>typeof u=="symbol"||u==="toString"?()=>l:`.${e} > .${s} > .${u}`})}})})}}),CJe(TJe),CJe({Bug:qJe});const YJe=n=>`hsl(${V4.indexOf(n)*137.5%360}, 70%, 50%)`,w5n=({phaseTimings:n})=>{if(!n)return null;const e=Object.values(n).reduce((t,r)=>t+r,0);return ut.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[ut.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:V4.map(t=>{const r=n[t]||0,i=r/e*100;return ut.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:YJe(t)},children:ut.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",r.toFixed(1),"ms"]})},t)})}),ut.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},E5n=({renderLog:n})=>{const[e,t]=vt.useState("chronological");if(!n)return ut.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const r=Object.entries((n==null?void 0:n.phaseTimings)??{});e==="chronological"?r.sort((a,o)=>V4.indexOf(a[0])-V4.indexOf(o[0])):r.sort((a,o)=>o[1]-a[1]);const i=r.reduce((a,[o,s])=>a+s,0);return ut.jsxs("div",{className:"rf-bg-white",children:[ut.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[ut.jsx("div",{children:"Render Logs"}),ut.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[ut.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),ut.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[ut.jsx("option",{value:"chronological",children:"Phase Order"}),ut.jsx("option",{value:"longest",children:"Duration"})]})]})]}),ut.jsx(w5n,{phaseTimings:n.phaseTimings}),ut.jsxs("table",{className:"rf-w-full rf-text-xs",children:[ut.jsx("thead",{children:ut.jsxs("tr",{children:[ut.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),ut.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),ut.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),ut.jsx("tbody",{children:r.map(([a,o])=>ut.jsxs("tr",{children:[ut.jsx("td",{className:"rf-p-2",children:V4.indexOf(a)}),ut.jsx("td",{className:"rf-p-2",children:a}),ut.jsx("td",{className:"rf-p-2",children:ut.jsx("div",{className:"rf-w-8",children:ut.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:YJe(a),width:`${o/i*100}%`}})})}),ut.jsx("td",{className:"rf-p-2",children:ut.jsxs("div",{className:"rf-flex w-full",children:[ut.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),ut.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/i*100).toFixed(1),"%"]})]})})]},a))})]})]})},T5n="0.0.428",M5n=["assembly","bom","circuit_json","errors","render_log"],C5n=({code:n,onRunClicked:e=void 0,errorMessage:t,circuitJson:r,autoroutingGraphics:i,showRightHeaderContent:a=!0,showCodeTab:o=!1,codeTabContent:s,showJsonTab:l=!0,showRenderLogTab:c=!0,onActiveTabChange:u,renderLog:f,showImportAndFormatButtons:p=!0,className:y,headerClassName:x,leftHeaderContent:T,readOnly:w,isStreaming:S,autoroutingLog:A,onReportAutoroutingLog:z,isRunningCode:I,hasCodeChangedSinceLastRun:G,onEditEvent:Y,editEvents:Q,defaultActiveTab:K,autoRotate3dViewerDisabled:re,showSchematicDebugGrid:J=!1,showToggleFullScreen:fe=!0,defaultToFullScreen:me=!1})=>{var Ue;Dhn();const ve=vt.useMemo(()=>r?r.filter(Ie=>Ie&&"error_type"in Ie):null,[r]),[Te,Pe]=vt.useState(K??"pcb"),[we,Ce]=vt.useState(me),Se=vt.useCallback(Ie=>{Pe(Ie),u==null||u(Ie)},[u]),ze=()=>{Ce(!we)};return vt.useEffect(()=>{t&&Se("errors")},[t]),vt.useEffect(()=>{(Te==="code"||Te==="errors")&&r&&!t&&Se(K??"pcb")},[r]),ut.jsx("div",{className:rg("flex flex-col relative rf-overflow-x-hidden",y),children:ut.jsx("div",{className:rg("rf-md:sticky rf-md:top-2",we&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-bg-white"),children:ut.jsxs(eit,{value:Te,onValueChange:Se,className:"rf-flex-grow rf-flex rf-flex-col",children:[ut.jsxs("div",{className:rg("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",x),children:[T,T&&ut.jsx("div",{className:"rf-flex-grow"}),!T&&I&&ut.jsx(KUe,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!T&&ut.jsx("div",{className:"rf-flex-grow"}),f&&f.progress!==1&&ut.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[f.lastRenderEvent&&ut.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:(Ue=f.lastRenderEvent)==null?void 0:Ue.type.split("renderable:renderLifecycle:")[1].split(":")[0]}),ut.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:ut.jsx(KUe,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),ut.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((f.progress??0)*100).toFixed(1),"%"]})]}),a&&ut.jsxs(Hme,{children:[o&&ut.jsx(Ew,{value:"code",children:"Code"}),ut.jsxs(Ew,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&ut.jsx("span",{className:rg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",G?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),ut.jsxs(Ew,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&ut.jsx("span",{className:rg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",G?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),ut.jsxs(Ew,{value:"cad",children:[r&&ut.jsx("span",{className:rg("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",G?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Te)&&ut.jsx(Ew,{value:Te,children:jme(Te)}),ut.jsxs(lFe,{children:[ut.jsx(cFe,{asChild:!0,children:ut.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[ut.jsx(rGt,{className:"rf-w-4 rf-h-4"}),(ve&&ve.length>0||t)&&ut.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),ut.jsxs($oe,{className:"rf-*:text-xs",children:[M5n.map(Ie=>ut.jsxs(Hk,{onSelect:()=>Se(Ie),children:[Te!==Ie&&ut.jsx(QUe,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Te===Ie&&ut.jsx(WUe,{className:"rf-w-3 rf-h-3"}),ut.jsx("div",{className:"rf-pr-2",children:jme(Ie)}),Ie==="errors"&&(ve&&ve.length>0||t)&&ut.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:ve==null?void 0:ve.length})]},Ie)),ut.jsx(Hk,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:ut.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",T5n.split(".").map((Ie,ke)=>ke===2?parseInt(Ie)+1:Ie).join(".")]})})]})]})]}),fe&&ut.jsx(iS,{onClick:ze,variant:"ghost",children:we?ut.jsx(oGt,{size:16}):ut.jsx(iGt,{size:16})})]}),o&&ut.jsx(Ab,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:ut.jsx("div",{className:"rf-h-full",children:s})}),ut.jsx(Ab,{value:"pcb",children:ut.jsx("div",{className:rg("rf-overflow-hidden",we?"rf-h-[calc(100vh-52px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallbackRender:({error:Ie})=>ut.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ut.jsxs("div",{className:"rf-p-4",children:[ut.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),ut.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:r?ut.jsx(Phn,{focusOnHover:!1,circuitJson:r,debugGraphics:i,containerClassName:rg("rf-h-full rf-w-full",we?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ie=>{Y&&Ie.forEach(ke=>Y(ke))}}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"assembly",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallback:ut.jsx("div",{children:"Error loading Assembly"}),children:r?ut.jsx(Utn,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"schematic",children:ut.jsx("div",{className:rg("rf-overflow-auto rf-bg-white",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallbackRender:({error:Ie})=>ut.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ut.jsxs("div",{className:"rf-p-4",children:[ut.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),ut.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:r?ut.jsx(Ltn,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ie=>{Y==null||Y(Ie)},debugGrid:J,colorOverrides:{schematic:{background:"transparent"}}}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"cad",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{FallbackComponent:V$t,children:r?ut.jsx(j$t,{soup:r,autoRotateDisabled:re}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"bom",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallbackRender:({error:Ie})=>ut.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ut.jsxs("div",{className:"rf-p-4",children:[ut.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),ut.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:r?ut.jsx(jtn,{circuitJson:r}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"circuit_json",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallback:ut.jsx("div",{children:"Error loading JSON viewer"}),children:r?ut.jsx(Ftn,{elements:r}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"errors",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:Array.isArray(ve)&&ve.length>0||t?ut.jsx(rWt,{code:n,circuitJsonErrors:ve,errorMessage:t,autoroutingLog:A,onReportAutoroutingLog:z}):ut.jsx(J7,{onRunClicked:e})})}),c&&ut.jsx(Ab,{value:"render_log",children:ut.jsx(E5n,{renderLog:f})})]})})})};lme.createRoot(document.getElementById("root")).render(ut.jsx(C5n,{defaultActiveTab:"cad",autoRotate3dViewerDisabled:!0,showRightHeaderContent:!1,circuitJson:window.CIRCUIT_JSON||{},...window.CIRCUIT_JSON_PREVIEW_PROPS||{}}))});
|
|
13425
|
+
searched component ${c.getString()}, which has ports: ${c.children.filter(u=>u.componentName==="Port").map(u=>`${u.getString()}(${u.getNameAndAliases().join(",")})`).join(" & ")}`):this.renderError(`Could not find port for selector "${o}"`)}return a.some(o=>!o.port)?{allPortsFound:!1}:{allPortsFound:!0,portsWithSelectors:a,ports:a.map(({port:o})=>o)}}_findConnectedNets(){const e=this.getTracePathNetSelectors().map(r=>({selector:r,net:this.getSubcircuit().selectOne(r,{type:"net"})})),t=e.filter(r=>!r.net);return t.length>0&&this.renderError(`Could not find net for selector "${t[0].selector}" inside ${this}`),{netsWithSelectors:e,nets:e.map(r=>r.net)}}_getAllTracesConnectedToSameNet(){const e=this.getSubcircuit().selectAll("trace"),t=this._findConnectedNets().nets,r=this._findConnectedPorts().ports??[];return e.filter(i=>{if(i===this)return!1;const a=i._findConnectedNets().nets,o=i._findConnectedPorts().ports??[];return a.some(s=>t.includes(s))||o.some(s=>r.includes(s))})}_isExplicitlyConnectedToPort(e){const{allPortsFound:t,portsWithSelectors:r}=this._findConnectedPorts();return t?r.map(a=>a.port).includes(e):!1}_isExplicitlyConnectedToNet(e){return this._findConnectedNets().nets.includes(e)}doInitialCreateNetsFromProps(){LJe(this,this.getTracePathNetSelectors())}_computeTraceConnectionHash(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();return!e||!t?null:[...t].sort((a,o)=>(a.pcb_port_id||"").localeCompare(o.pcb_port_id||"")).map(a=>a.pcb_port_id).join(",")}doInitialSourceTraceRender(){var f;const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r){this.renderError("Trace has no parent");return}const{allPortsFound:i,portsWithSelectors:a}=this._findConnectedPorts();if(!i)return;this._traceConnectionHash=this._computeTraceConnectionHash();const s=e.source_trace.list().find(p=>p.subcircuit_connectivity_map_key===this.subcircuit_connectivity_map_key&&p.connected_source_port_ids.sort().join(",")===this._traceConnectionHash);if(s){this.source_trace_id=s.source_trace_id;return}const l=this._findConnectedNets().nets,c=B2n({ports:a,nets:l}),u=e.source_trace.insert({connected_source_port_ids:a.map(p=>p.port.source_port_id),connected_source_net_ids:l.map(p=>p.source_net_id),subcircuit_id:(f=this.getSubcircuit())==null?void 0:f.subcircuit_id,max_length:U2n(a.map(p=>p.port),{db:e})??t.maxLength,display_name:c,min_trace_thickness:t.thickness});this.source_trace_id=u.source_trace_id}_insertErrorIfTraceIsOutsideBoard(e,t){const{db:r}=this.root;H2n(e,{db:r})&&r.pcb_trace_error.insert({error_type:"pcb_trace_error",source_trace_id:this.source_trace_id,message:`Trace ${this.getString()} routed outside the board boundaries.`,pcb_trace_id:this.pcb_trace_id,pcb_component_ids:[],pcb_port_ids:t.map(a=>a.pcb_port_id)})}doInitialPcbTraceRender(){var K,re,J,fe;if((K=this.root)!=null&&K.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t,parent:r}=this,i=this.getSubcircuit();if(!r)throw new Error("Trace has no parent");if(i._parsedProps.routingDisabled)return;const a=(re=i._parsedProps.pcbRouteCache)==null?void 0:re.pcbTraces;if(a){const me=e.pcb_trace.insert({route:a.flatMap(ve=>ve.route),source_trace_id:this.source_trace_id,subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((J=this.getGroup())==null?void 0:J.pcb_group_id)??void 0});this.pcb_trace_id=me.pcb_trace_id;return}if(!i._shouldUseTraceByTraceRouting())return;const{allPortsFound:o,ports:s}=this._findConnectedPorts();if(!o)return;const l=[];for(const me of s)me._hasMatchedPcbPrimitive()||l.push(me);if(l.length>0){e.pcb_trace_error.insert({error_type:"pcb_trace_error",source_trace_id:this.source_trace_id,message:`Some ports did not have a matching PCB primitive (e.g. a pad or plated hole), this can happen if a footprint is missing. As a result, ${this} wasn't routed. Missing ports: ${l.map(me=>me.getString()).join(", ")}`,pcb_trace_id:this.pcb_trace_id,pcb_component_ids:[],pcb_port_ids:l.map(me=>me.pcb_port_id).filter(Boolean)});return}const c=this._findConnectedNets().netsWithSelectors;if(s.length===0&&c.length===2){this.renderError("Trace connects two nets, we haven't implemented a way to route this yet");return}else if(s.length===1&&c.length===1){const me=s[0],Te=c[0].net.getAllConnectedPorts().filter(we=>we!==me);if(Te.length===0){console.log("Nothing to connect this port to, the net is empty. TODO should emit a warning!");return}const Pe=R2n(me,Te);s.push(Pe)}else if(s.length>1&&c.length>=1){this.renderError("Trace has more than one port and one or more nets, we don't currently support this type of complex trace routing");return}const u=s.flatMap(me=>me.matchedComponents.filter(ve=>ve.componentName==="TraceHint")),f=(this._parsedProps.pcbRouteHints??[]).concat(u.flatMap(me=>me.getPcbRouteHints()));if(s.length>2){this.renderError(`Trace has more than two ports (${s.map(me=>me.getString()).join(", ")}), routing between more than two ports for a single trace is not implemented`);return}if(this.getSubcircuit().selectAll("trace").filter(me=>me.renderPhaseStates.PcbTraceRender.initialized).some(me=>me._portsRoutedOnPcb.length===s.length&&me._portsRoutedOnPcb.every(ve=>s.includes(ve))))return;let x=[];f.length===0?x=[rH(s[0]),rH(s[1])]:x=[rH(s[0]),...f,rH(s[1])];const T=tH(x),w=zb(this.root.db.toArray()),[S,A]=P2n(()=>Vw(this.root.db.toArray()));if(A){this.renderError({type:"pcb_trace_error",error_type:"pcb_trace_error",pcb_trace_error_id:this.pcb_trace_id,message:`Error getting obstacles for autorouting: ${A.message}`,source_trace_id:this.source_trace_id,center:{x:0,y:0},pcb_port_ids:s.map(me=>me.pcb_port_id),pcb_trace_id:this.pcb_trace_id,pcb_component_ids:[]});return}for(const me of S)if(me.connectedTo.length>0){const Te=w.getNetConnectedToId(me.connectedTo[0]);Te&&me.connectedTo.push(Te)}let z=[];if(T.length===0)z=x;else{const me=T[0].layer_path;z=x.map((ve,Te)=>ve.via?{...ve,via_to_layer:me[Te]}:{...ve,layers:[me[Te]]})}z[0].pcb_port_id=s[0].pcb_port_id,z[z.length-1].pcb_port_id=s[1].pcb_port_id;const I=[];for(const[me,ve]of NJe(z)){const Te="via_to_layer"in me?me.via_to_layer:null,Pe=2,we="layers"in me&&me.layers.length===1?me.layers[0]:Te??"top",Ce="layers"in ve&&ve.layers.length===1?ve.layers[0]:Te??"top",Se="pcb_port_id"in me?me.pcb_port_id:null,ze="pcb_port_id"in ve?ve.pcb_port_id:null,Ue=this.getSubcircuit()._parsedProps.minTraceWidth??.16,Ie=new Hw({OBSTACLE_MARGIN:Ue*2,isRemovePathLoopsEnabled:!0,optimizeWithGoalBoxes:!!(Se&&ze),connMap:w,input:{obstacles:S,minTraceWidth:Ue,connections:[{name:this.source_trace_id,pointsToConnect:[{...me,layer:we,pcb_port_id:Se},{...ve,layer:Ce,pcb_port_id:ze}]}],layerCount:2,bounds:{minX:Math.min(me.x,ve.x)-Pe,maxX:Math.max(me.x,ve.x)+Pe,minY:Math.min(me.y,ve.y)-Pe,maxY:Math.max(me.y,ve.y)+Pe}}});let ke=null;try{ke=Ie.solveAndMapToTraces()}catch(gt){this.renderError({type:"pcb_trace_error",pcb_trace_error_id:this.source_trace_id,error_type:"pcb_trace_error",message:`error solving route: ${gt.message}`,source_trace_id:this.pcb_trace_id,center:{x:(me.x+ve.x)/2,y:(me.y+ve.y)/2},pcb_port_ids:s.map(wt=>wt.pcb_port_id),pcb_trace_id:this.pcb_trace_id,pcb_component_ids:s.map(wt=>wt.pcb_component_id)})}if(!ke)return;if(ke.length===0){this.renderError({type:"pcb_trace_error",error_type:"pcb_trace_error",pcb_trace_error_id:this.pcb_trace_id,message:`Could not find a route for ${this}`,source_trace_id:this.source_trace_id,center:{x:(me.x+ve.x)/2,y:(me.y+ve.y)/2},pcb_port_ids:s.map(gt=>gt.pcb_port_id),pcb_trace_id:this.pcb_trace_id,pcb_component_ids:s.map(gt=>gt.pcb_component_id)});return}const[ot]=ke;Te&&(ot.route=ot.route.map(gt=>(gt.route_type==="wire"&&!gt.layer&&(gt.layer=Te),gt))),Se&&ot.route[0].route_type==="wire"&&(ot.route[0].start_pcb_port_id=Se);const nt=ot.route[ot.route.length-1];ze&&nt.route_type==="wire"&&(nt.end_pcb_port_id=ze),I.push(ot.route)}const G=M2n(I),Y=N2n(G),Q=e.pcb_trace.insert({route:G,source_trace_id:this.source_trace_id,subcircuit_id:(fe=this.getSubcircuit())==null?void 0:fe.subcircuit_id,trace_length:Y});this._portsRoutedOnPcb=s,this.pcb_trace_id=Q.pcb_trace_id;for(const me of G)me.route_type==="via"&&e.pcb_via.insert({pcb_trace_id:Q.pcb_trace_id,x:me.x,y:me.y,hole_diameter:.3,outer_diameter:.6,layers:[me.from_layer,me.to_layer],from_layer:me.from_layer,to_layer:me.to_layer});this._insertErrorIfTraceIsOutsideBoard(G,s)}_doInitialSchematicTraceRenderWithDisplayLabel(){var I,G,Y,Q;if((I=this.root)!=null&&I.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r)throw new Error("Trace has no parent");const{allPortsFound:i,portsWithSelectors:a}=this._findConnectedPorts();if(!i)return;const o=a.map(({port:K})=>({port:K,position:K._getGlobalSchematicPositionAfterLayout(),schematic_port_id:K.schematic_port_id,facingDirection:K.facingDirection}));if(o.length<2)throw new Error("Expected at least two ports in portsWithPosition.");let s,l;const c=o[0].position,u=o[0].port;if("path"in this.props){if(this.props.path.length!==2)throw new Error("Invalid 'path': Must contain exactly two elements.");[s,l]=this.props.path}else{if(!("from"in this.props&&"to"in this.props))throw new Error("Missing 'from' or 'to' properties in props.");s=this.props.from,l=this.props.to}if(!u.source_port_id)throw new Error(`Missing source_port_id for the 'from' port (${s}).`);const f=o[1].position,p=o[1].port;if(!p.source_port_id)throw new Error(`Missing source_port_id for the 'to' port (${l}).`);const y=e.schematic_net_label.list().find(K=>K.source_net_id===u.source_port_id),x=e.schematic_net_label.list().find(K=>K.source_net_id===p.source_port_id),[T,w]=a.map(({port:K})=>K),A=((G=T.parent)==null?void 0:G.config.shouldRenderAsSchematicBox)?`${(Y=T==null?void 0:T.parent)==null?void 0:Y.props.name}_${T==null?void 0:T.props.name}`:`${(Q=w==null?void 0:w.parent)==null?void 0:Q.props.name}_${w==null?void 0:w.props.name}`,z=this.props.schDisplayLabel??A;if(y&&y.text!==z&&(y.text=`${z} / ${y.text}`),x&&(x==null?void 0:x.text)!==z&&(x.text=`${z} / ${x.text}`),z!=null&&z.toLocaleLowerCase().includes("gnd")||z!=null&&z.toLocaleLowerCase().includes("ground")){!y&&!x?(nH({port:u,anchorPos:c,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e}),nH({port:p,anchorPos:f,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e})):y?x||nH({port:p,anchorPos:f,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e}):nH({port:u,anchorPos:c,schDisplayLabel:this.props.schDisplayLabel,source_trace_id:this.source_trace_id},{db:e});return}x||e.schematic_net_label.insert({text:this.props.schDisplayLabel??A,source_net_id:p.source_port_id,anchor_position:f,center:f,anchor_side:Dpe(p.facingDirection)??"bottom"}),y||e.schematic_net_label.insert({text:this.props.schDisplayLabel??A,source_net_id:u.source_port_id,anchor_position:c,center:c,anchor_side:Dpe(u.facingDirection)??"bottom"})}_isSymbolToChipConnection(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();if(!e||t.length!==2)return!1;const[r,i]=t;if(!(r!=null&&r.parent)||!(i!=null&&i.parent))return!1;const a=r.parent.config.shouldRenderAsSchematicBox,o=i.parent.config.shouldRenderAsSchematicBox;return a&&!o||!a&&o}_isSymbolToSymbolConnection(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();if(!e||t.length!==2)return!1;const[r,i]=t;if(!(r!=null&&r.parent)||!(i!=null&&i.parent))return!1;const a=!r.parent.config.shouldRenderAsSchematicBox,o=!i.parent.config.shouldRenderAsSchematicBox;return a&&o}_isChipToChipConnection(){const{allPortsFound:e,ports:t}=this._findConnectedPorts();if(!e||t.length!==2)return!1;const[r,i]=t;if(!(r!=null&&r.parent)||!(i!=null&&i.parent))return!1;const a=r.parent.config.shouldRenderAsSchematicBox,o=i.parent.config.shouldRenderAsSchematicBox;return a&&o}doInitialSchematicTraceRender(){var we,Ce;if((we=this.root)!=null&&we.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r)throw new Error("Trace has no parent");const{allPortsFound:i,portsWithSelectors:a}=this._findConnectedPorts(),{netsWithSelectors:o}=this._findConnectedNets();if(!i)return;const l=a.map(Se=>Se.port.schematic_port_id).sort().join(","),c=(Ce=this.root)==null?void 0:Ce._getBoard();if(c!=null&&c._connectedSchematicPortPairs&&c._connectedSchematicPortPairs.has(l))return;if(this.props.schDisplayLabel&&("from"in this.props&&"to"in this.props||"path"in this.props)){this._doInitialSchematicTraceRenderWithDisplayLabel();return}const u={name:this.source_trace_id,pointsToConnect:[]},f=F2n(this),p=a.map(({port:Se})=>({port:Se,position:Se._getGlobalSchematicPositionAfterLayout(),schematic_port_id:Se.schematic_port_id??void 0,facingDirection:Se.facingDirection}));if(p.length===1&&o.length===1){const Se=o[0].net,{port:ze,position:Ue}=p[0];e.schematic_net_label.insert({text:Se._parsedProps.name,source_net_id:Se.source_net_id,anchor_position:Ue,center:Ue,anchor_side:Dpe(ze.facingDirection)??"bottom"});return}if(p.length<2)return;u.pointsToConnect=p.map(({position:Se})=>({...Se,layer:"top"}));const x=T2n(f),T=2,w={minTraceWidth:.1,obstacles:f,connections:[u],bounds:{minX:x.minX-T,maxX:x.maxX+T,minY:x.minY-T,maxY:x.maxY+T},layerCount:1};let S=Hw,A=!1;this.getSubcircuit().props._schDirectLineRoutingEnabled&&(S=jJe,A=!0);let I=new S({input:w,MAX_ITERATIONS:100,OBSTACLE_MARGIN:.1,isRemovePathLoopsEnabled:!0,isShortenPathWithShortcutsEnabled:!0,marginsWithCosts:[{margin:1,enterCost:0,travelCostFactor:1},{margin:.3,enterCost:0,travelCostFactor:1},{margin:.2,enterCost:0,travelCostFactor:2},{margin:.1,enterCost:0,travelCostFactor:3}]}).solveAndMapToTraces();if(I.length===0){if(this._isSymbolToChipConnection()||this._isSymbolToSymbolConnection()||this._isChipToChipConnection()){this._doInitialSchematicTraceRenderWithDisplayLabel();return}I=new jJe({input:w}).solveAndMapToTraces(),A=!0}const[{route:G}]=I;let Y=[];for(let Se=0;Se<G.length-1;Se++)Y.push({from:G[Se],to:G[Se+1]});const Q=this.source_trace_id;let K=[];if(!A){j2n({edges:Y,db:e,source_trace_id:Q});const Se=Ope({db:e,source_trace_id:Q,differentNetOnly:!0}).flatMap(ze=>ze.edges);Y=L2n({edges:Y,otherEdges:Se}),K=z2n({edges:Y,db:e,source_trace_id:this.source_trace_id})}const re=Y[Y.length-1],J=p[p.length-1],fe=VJe(re);Y.push(...Lpe({lastEdge:re,lastEdgePort:J,lastDominantDirection:fe}));const me=Y[0],ve=p[0],Te=VJe(me);if(Y.unshift(...Lpe({firstEdge:me,firstEdgePort:ve,firstDominantDirection:Te})),!this.source_trace_id)throw new Error("Missing source_trace_id for schematic trace insertion.");if(this.getSubcircuit()._parsedProps.schTraceAutoLabelEnabled&&A2n(K,Y)>=5&&(this._isSymbolToChipConnection()||this._isSymbolToSymbolConnection()||this._isChipToChipConnection())){this._doInitialSchematicTraceRenderWithDisplayLabel();return}const Pe=e.schematic_trace.insert({source_trace_id:this.source_trace_id,edges:Y,junctions:K});this.schematic_trace_id=Pe.schematic_trace_id,c!=null&&c._connectedSchematicPortPairs&&c._connectedSchematicPortPairs.add(l)}},V2n=z1("tscircuit:core"),$2n=b.object({x:d6,y:d6,z:d6}),d2=class extends ix{constructor(e){super(e);Je(this,"reactSubtrees",[]);Je(this,"_impliedFootprint");Je(this,"isPrimitiveContainer",!0);Je(this,"_asyncSupplierPartNumbers");Je(this,"pcb_missing_footprint_error_id");this._addChildrenFromStringFootprint(),this.initPorts()}get defaultInternallyConnectedPinNames(){return[]}get internallyConnectedPinNames(){return this._parsedProps.internallyConnectedPins??this.defaultInternallyConnectedPinNames}initPorts(e={}){var o,s,l,c,u,f,p,y,x,T;if((o=this.root)!=null&&o.schematicDisabled)return;const{config:t}=this,r=[],i=this._getSchematicPortArrangement();if(i&&!this._parsedProps.pinLabels){for(const A in i){const z=i[A].pins;if(Array.isArray(z))for(const I of z){const G=_P(I,this._parsedProps.pinLabels);r.push(new p6({pinNumber:G,aliases:((s=e.additionalAliases)==null?void 0:s[`pin${G}`])??[]},{originDescription:`schPortArrangement:${A}`}))}}const w=["left","right","top","bottom"];let S=1;for(const A of w){const z=i[`${A}Size`];for(let I=0;I<z;I++)r.push(new p6({pinNumber:S++,aliases:((l=e.additionalAliases)==null?void 0:l[`pin${S}`])??[]},{originDescription:`schPortArrangement:${A}`}))}}const a=this._parsedProps.pinLabels;if(a)for(let[w,S]of Object.entries(a)){w=w.replace("pin","");let A=r.find(G=>G._parsedProps.pinNumber===Number(w));const z=Array.isArray(S)?S[0]:S,I=Array.isArray(S)?S.slice(1):[];A?(A.externallyAddedAliases.push(z,...I),A.props.name=z):(A=new p6({pinNumber:parseInt(w),name:z,aliases:[...I,...((c=e.additionalAliases)==null?void 0:c[`pin${parseInt(w)}`])??[]]},{originDescription:`pinLabels:pin${w}`}),r.push(A))}if(t.schematicSymbolName){const w=H4[this._getSchematicSymbolNameOrThrow()];if(!w)return;for(const S of w.ports){const A=FJe(S.labels);if(!A)continue;const z=r.find(I=>I._parsedProps.pinNumber===Number(A));if(z)z.schematicSymbolPortDef=S;else{const I=xP(S.labels.concat(((u=e.additionalAliases)==null?void 0:u[`pin${A}`])??[]));I&&(I.originDescription=`schematicSymbol:labels[0]:${S.labels[0]}`,I.schematicSymbolPortDef=S,r.push(I))}}this.addAll(r)}if(!this._getSchematicPortArrangement()){const w=this.getPortsFromFootprint(e);for(const S of w)r.some(A=>A.isMatchingAnyOf(S.getNameAndAliases()))||r.push(S)}for(let w=1;w<=(e.pinCount??this._getPinCount());w++){if(!i||r.find(A=>A._parsedProps.pinNumber===w))continue;let S=[...((f=i.leftSide)==null?void 0:f.pins)??[],...((p=i.rightSide)==null?void 0:p.pins)??[],...((y=i.topSide)==null?void 0:y.pins)??[],...((x=i.bottomSide)==null?void 0:x.pins)??[]].map(A=>_P(A,this._parsedProps.pinLabels));["leftSize","rightSize","topSize","bottomSize","leftPinCount","rightPinCount","topPinCount","bottomPinCount"].some(A=>A in i)&&(S=Array.from({length:this._getPinCount()},(A,z)=>z+1)),S.includes(w)&&r.push(new p6({pinNumber:w,aliases:((T=e.additionalAliases)==null?void 0:T[`pin${w}`])??[]},{originDescription:`notOtherwiseAddedButDeducedFromPinCount:${w}`}))}r.length>0&&this.addAll(r)}_getImpliedFootprintString(){return null}_addChildrenFromStringFootprint(){var i;const{name:e,pcbRotation:t}=this.props;let{footprint:r}=this.props;if(r??(r=(i=this._getImpliedFootprintString)==null?void 0:i.call(this)),!!r&&typeof r=="string"){const a=Ow.string(r).soup(),o=h2n({componentName:e,componentRotation:t},a);this.addAll(o)}}get portMap(){return new Proxy({},{get:(e,t)=>{const r=this.children.find(i=>i.componentName==="Port"&&i.isMatchingNameOrAlias(t));if(!r)throw new Error(`There was an issue finding the port "${t.toString()}" inside of a ${this.componentName} component with name: "${this.props.name}". This is a bug in @tscircuit/core`);return r}})}getInstanceForReactElement(e){for(const t of this.reactSubtrees)if(t.element===e)return t.component;return null}doInitialSourceRender(){const e=this.config.sourceFtype;if(!e)return;const{db:t}=this.root,{_parsedProps:r}=this,i=t.source_component.insert({ftype:e,name:r.name,manufacturer_part_number:r.manufacturerPartNumber??r.mfn,supplier_part_numbers:r.supplierPartNumbers});this.source_component_id=i.source_component_id}doInitialSchematicComponentRender(){var i,a,o;if((i=this.root)!=null&&i.schematicDisabled)return;const{db:e}=this.root,{schematicSymbolName:t}=this.config;t?this._doInitialSchematicComponentRenderWithSymbol():this._getSchematicBoxDimensions()&&this._doInitialSchematicComponentRenderWithSchematicBoxDimensions();const r=(a=this.getSubcircuit())==null?void 0:a._getSchematicManualPlacementForComponent(this);if(this.schematic_component_id&&(this.props.schX!==void 0||this.props.schY!==void 0)&&r){if(!this.schematic_component_id)return;const s=lZe.parse({type:"schematic_manual_edit_conflict_warning",schematic_manual_edit_conflict_warning_id:`schematic_manual_edit_conflict_${this.source_component_id}`,message:`${this.getString()} has both manual placement and prop coordinates. schX and schY will be used. Remove schX/schY or clear the manual placement.`,schematic_component_id:this.schematic_component_id,source_component_id:this.source_component_id,subcircuit_id:(o=this.getSubcircuit())==null?void 0:o.subcircuit_id});e.schematic_manual_edit_conflict_warning.insert(s)}}_getSchematicSymbolDisplayValue(){}_getInternallyConnectedPins(){if(this.internallyConnectedPinNames.length===0)return[];const e=[];for(const t of this.internallyConnectedPinNames){const r=[];for(const i of t)r.push(this.portMap[i]);e.push(r)}return e}_doInitialSchematicComponentRenderWithSymbol(){var o;if((o=this.root)!=null&&o.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getSchematicSymbolNameOrThrow(),i=H4[r],a=this._getGlobalSchematicPositionBeforeLayout();if(i){const s=e.schematic_component.insert({center:a,size:i.size,source_component_id:this.source_component_id,symbol_name:r,symbol_display_value:this._getSchematicSymbolDisplayValue()});this.schematic_component_id=s.schematic_component_id}}_doInitialSchematicComponentRenderWithSchematicBoxDimensions(){var f;if((f=this.root)!=null&&f.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getSchematicBoxDimensions(),i={};if(Array.isArray(t.pinLabels))t.pinLabels.forEach((p,y)=>{i[String(y+1)]=p});else for(const[p,y]of Object.entries(t.pinLabels??{}))i[p]=Array.isArray(y)?y[0]:y;const a=this._getGlobalSchematicPositionBeforeLayout(),o=this._getSchematicPortArrangement(),s=e.schematic_component.insert({center:a,rotation:t.schRotation??0,size:r.getSize(),port_arrangement:u2n(o),pin_spacing:t.schPinSpacing??.2,pin_styles:c2n(t.schPinStyle,t.pinLabels),port_labels:i,source_component_id:this.source_component_id}),l=(o==null?void 0:o.topSide)!==void 0||(o==null?void 0:o.bottomSide)!==void 0,c=r==null?void 0:r.getSize().width,u=r==null?void 0:r.getSize().height;e.schematic_text.insert({text:t.manufacturerPartNumber??"",schematic_component_id:s.schematic_component_id,anchor:"left",rotation:0,position:{x:l?a.x+(c??0)/2+.1:a.x-(c??0)/2,y:l?a.y+(u??0)/2+.35:a.y-(u??0)/2-.13},color:"#006464"}),e.schematic_text.insert({text:t.name??"",schematic_component_id:s.schematic_component_id,anchor:"left",rotation:0,position:{x:l?a.x+(c??0)/2+.1:a.x-(c??0)/2,y:l?a.y+(u??0)/2+.55:a.y+(u??0)/2+.13},color:"#006464"}),this.schematic_component_id=s.schematic_component_id}doInitialPcbComponentRender(){var o;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this.getSubcircuit(),i=e.pcb_component.insert({center:this._getGlobalPcbPositionBeforeLayout(),width:0,height:0,layer:t.layer??"top",rotation:t.pcbRotation??0,source_component_id:this.source_component_id,subcircuit_id:r.subcircuit_id??void 0});if(!t.footprint&&!this.isGroup){const s=e.pcb_missing_footprint_error.insert({message:`No footprint found for component: ${this.getString()}`,source_component_id:`${this.source_component_id}`,error_type:"pcb_missing_footprint_error"});this.pcb_missing_footprint_error_id=s.pcb_missing_footprint_error_id}this.pcb_component_id=i.pcb_component_id;const a=this.getSubcircuit()._getPcbManualPlacementForComponent(this);if((this.props.pcbX!==void 0||this.props.pcbY!==void 0)&&a){const s=dZe.parse({type:"pcb_manual_edit_conflict_warning",pcb_manual_edit_conflict_warning_id:`pcb_manual_edit_conflict_${this.source_component_id}`,message:`${this.getString()} has both manual placement and prop coordinates. pcbX and pcbY will be used. Remove pcbX/pcbY or clear the manual placement.`,pcb_component_id:this.pcb_component_id,source_component_id:this.source_component_id,subcircuit_id:r.subcircuit_id??void 0});e.pcb_manual_edit_conflict_warning.insert(s)}}doInitialPcbComponentSizeCalculation(){var a;if((a=this.root)!=null&&a.pcbDisabled||!this.pcb_component_id)return;const{db:e}=this.root,{_parsedProps:t}=this,r=IJe(this.children);if(r.width===0||r.height===0)return;const i={x:(r.minX+r.maxX)/2,y:(r.minY+r.maxY)/2};e.pcb_component.update(this.pcb_component_id,{center:i,width:r.width,height:r.height})}_renderReactSubtree(e){return{element:e,component:l2n(e)}}doInitialInitializePortsFromChildren(){this.initPorts()}doInitialReactSubtreesRender(){if(vt.isValidElement(this.props.footprint)){if(this.reactSubtrees.some(t=>t.element===this.props.footprint))return;const e=this._renderReactSubtree(this.props.footprint);this.reactSubtrees.push(e),this.add(e.component)}}_hasExistingPortExactly(e){return this.children.filter(r=>r.componentName==="Port").some(r=>{const i=e.getNameAndAliases(),a=r.getNameAndAliases();return i.length===a.length&&i.every(o=>a.includes(o))})}add(e){let t;if(vt.isValidElement(e)){const r=this._renderReactSubtree(e);this.reactSubtrees.push(r),t=r.component}else t=e;if(t.componentName==="Port"){if(this._hasExistingPortExactly(t))return;const i=this.children.filter(a=>a.componentName==="Port").find(a=>a.isMatchingAnyOf(t.getNameAndAliases()));i&&V2n(`Similar ports added. Port 1: ${i}, Port 2: ${t}`)}super.add(t)}getPortsFromFootprint(e){let{footprint:t}=this.props;if((!t||vt.isValidElement(t))&&(t=this.children.find(i=>i.componentName==="Footprint")),typeof t=="string"){const i=Ow.string(t).soup(),a=[];for(const o of i)if("port_hints"in o&&o.port_hints){const s=xP(o.port_hints,e);if(!s)continue;s.originDescription=`footprint:string:${t}:port_hints[0]:${o.port_hints[0]}`,a.push(s)}return a}if(!vt.isValidElement(t)&&t&&t.componentName==="Footprint"){const i=t;let a=1;const o=[];for(const s of i.children){if(!s.props.portHints)continue;let l=s.props.portHints;l.some(f=>f.startsWith("pin"))||(l=[...l,`pin${a}`]),a++;const u=xP(l);u&&(u.originDescription=`footprint:${t}`,o.push(u))}return o}const r=[];if(!t){for(const i of this.children)if(i.props.portHints&&i.isPcbPrimitive){const a=xP(i.props.portHints);a&&r.push(a)}}return r}getPortsFromSchematicSymbol(){var i;if((i=this.root)!=null&&i.schematicDisabled)return[];const{config:e}=this;if(!e.schematicSymbolName)return[];const t=H4[e.schematicSymbolName];if(!t)return[];const r=[];for(const a of t.ports){const o=xP(a.labels);o&&(o.schematicSymbolPortDef=a,r.push(o))}return r}doInitialCreateNetsFromProps(){this._createNetsFromProps(this._getNetsFromConnectionsProp())}_getNetsFromConnectionsProp(){const{_parsedProps:e}=this,t=[];if(e.connections)for(const[r,i]of Object.entries(e.connections)){const a=Array.isArray(i)?i:[i];for(const o of a)t.push(o)}return t}_createNetsFromProps(e){LJe(this,e)}_getPcbCircuitJsonBounds(){const{db:e}=this.root;if(!this.pcb_component_id)return super._getPcbCircuitJsonBounds();const t=e.pcb_component.get(this.pcb_component_id);return{center:{x:t.center.x,y:t.center.y},bounds:{left:t.center.x-t.width/2,top:t.center.y-t.height/2,right:t.center.x+t.width/2,bottom:t.center.y+t.height/2},width:t.width,height:t.height}}_getPinCountFromSchematicPortArrangement(){const e=this._getSchematicPortArrangement();if(!e)return 0;if(!BJe(e))return(e.leftSize??e.leftPinCount??0)+(e.rightSize??e.rightPinCount??0)+(e.topSize??e.topPinCount??0)+(e.bottomSize??e.bottomPinCount??0);const{leftSide:r,rightSide:i,topSide:a,bottomSide:o}=e;return Math.max(...(r==null?void 0:r.pins)??[],...(i==null?void 0:i.pins)??[],...(a==null?void 0:a.pins)??[],...(o==null?void 0:o.pins)??[])}_getPinCount(){return this._getSchematicPortArrangement()?this._getPinCountFromSchematicPortArrangement():this.getPortsFromFootprint().length}_getSchematicPortArrangement(){return this._parsedProps.schPinArrangement??this._parsedProps.schPortArrangement}_getSchematicBoxDimensions(){if(this.getSchematicSymbol()||!this.config.shouldRenderAsSchematicBox)return null;const{_parsedProps:e}=this,t=this._getPinCount(),r=e.schPinSpacing??.2;return b2n({schWidth:e.schWidth,schHeight:e.schHeight,schPinSpacing:r,numericSchPinStyle:E2n(e.schPinStyle,e.pinLabels),pinCount:t,schPortArrangement:this._getSchematicPortArrangement(),pinLabels:e.pinLabels})}doInitialCadModelRender(){var c;const{db:e}=this.root,{boardThickness:t=0}=((c=this.root)==null?void 0:c._getBoard())??{},r=this._parsedProps.cadModel;if(!this.pcb_component_id||!r&&!this.props.footprint)return;const i=this._getPcbCircuitJsonBounds(),a=e.pcb_component.get(this.pcb_component_id);if(typeof r=="string")throw new Error("String cadModel not yet implemented");const o=$2n.parse({x:0,y:0,z:typeof(r==null?void 0:r.rotationOffset)=="number"?r.rotationOffset:0,...typeof(r==null?void 0:r.rotationOffset)=="object"?r.rotationOffset??{}:{}}),s=$B.parse({x:0,y:0,z:0,...typeof(r==null?void 0:r.positionOffset)=="object"?r.positionOffset:{}}),l=this.props.layer==="bottom"?"bottom":"top";e.cad_component.insert({position:{x:i.center.x+s.x,y:i.center.y+s.y,z:(l==="bottom"?-t/2:t/2)+s.z},rotation:{x:o.x,y:(l==="top"?0:180)+o.y,z:((a==null?void 0:a.rotation)??0)+(l==="bottom"?180:0)+o.z},pcb_component_id:this.pcb_component_id,source_component_id:this.source_component_id,model_stl_url:"stlUrl"in(r??{})?this._addCachebustToModelUrl(r.stlUrl):void 0,model_obj_url:"objUrl"in(r??{})?this._addCachebustToModelUrl(r.objUrl):void 0,model_jscad:"jscad"in(r??{})?r.jscad:void 0,footprinter_string:typeof this.props.footprint=="string"&&!r?this.props.footprint:void 0})}_addCachebustToModelUrl(e){var r;if(!e||!e.includes("modelcdn.tscircuit.com"))return e;const t=((r=this.root)==null?void 0:r.getClientOrigin())??"";return`${e}${e.includes("?")?"&":"?"}cachebust_origin=${encodeURIComponent(t)}`}doInitialPartsEngineRender(){const e=this.getInheritedProperty("partsEngine");if(!e)return;const{db:t}=this.root,r=t.source_component.get(this.source_component_id);if(!r||r.supplier_part_numbers)return;let i;this.props.footprint&&typeof this.props.footprint=="string"&&(i=this.props.footprint);const a=e.findPart({sourceComponent:r,footprinterString:i});if(!(a instanceof Promise)){t.source_component.update(this.source_component_id,{supplier_part_numbers:a});return}this._queueAsyncEffect("get-supplier-part-numbers",async()=>{this._asyncSupplierPartNumbers=await a,this._markDirty("PartsEngineRender")})}updatePartsEngineRender(){const{db:e}=this.root,t=e.source_component.get(this.source_component_id);if(t&&!t.supplier_part_numbers&&this._asyncSupplierPartNumbers){e.source_component.update(this.source_component_id,{supplier_part_numbers:this._asyncSupplierPartNumbers});return}}doInitialCreateTracesFromProps(){this._createTracesFromConnectionsProp()}_createTracesFromConnectionsProp(){const{_parsedProps:e}=this;if(e.connections)for(const[t,r]of Object.entries(e.connections)){const i=Array.isArray(r)?r:[r];for(const a of i)this.add(new uw({from:`${this.getSubcircuitSelector()} > port.${t}`,to:a}))}}},G2n=class{constructor(n,e={}){Je(this,"input");Je(this,"isRouting",!1);Je(this,"solver");Je(this,"eventHandlers",{complete:[],error:[],progress:[]});Je(this,"cycleCount",0);Je(this,"stepDelay");Je(this,"timeoutId");this.input=n;const{capacityDepth:t,targetMinCapacity:r,stepDelay:i=0}=e;this.solver=new Uq(n,{capacityDepth:t,targetMinCapacity:r}),this.stepDelay=i}start(){this.isRouting||(this.isRouting=!0,this.cycleCount=0,this.runCycleAndQueueNextCycle())}runCycleAndQueueNextCycle(){var n;if(this.isRouting)try{if(this.solver.solved||this.solver.failed){this.solver.failed?this.emitEvent({type:"error",error:new Error(this.solver.error||"Routing failed")}):this.emitEvent({type:"complete",traces:this.solver.getOutputSimpleRouteJson().traces||[]}),this.isRouting=!1;return}const e=Date.now(),t=this.solver.iterations;for(;Date.now()-e<250&&!this.solver.failed&&!this.solver.solved;)this.solver.step();const r=(this.solver.iterations-t)/(Date.now()-e)*1e3;this.cycleCount++;const i=((n=this.solver)==null?void 0:n.preview())||void 0,a=this.solver.progress;this.emitEvent({type:"progress",steps:this.cycleCount,iterationsPerSecond:r,progress:a,phase:this.solver.getCurrentPhase(),debugGraphics:i}),this.stepDelay>0?this.timeoutId=setTimeout(()=>this.runCycleAndQueueNextCycle(),this.stepDelay):this.timeoutId=setTimeout(()=>this.runCycleAndQueueNextCycle(),0)}catch(e){this.emitEvent({type:"error",error:e instanceof Error?e:new Error(String(e))}),this.isRouting=!1}}stop(){this.isRouting&&(this.isRouting=!1,this.timeoutId!==void 0&&(clearTimeout(this.timeoutId),this.timeoutId=void 0))}on(n,e){n==="complete"?this.eventHandlers.complete.push(e):n==="error"?this.eventHandlers.error.push(e):n==="progress"&&this.eventHandlers.progress.push(e)}emitEvent(n){if(n.type==="complete")for(const e of this.eventHandlers.complete)e(n);else if(n.type==="error")for(const e of this.eventHandlers.error)e(n);else if(n.type==="progress")for(const e of this.eventHandlers.progress)e(n)}solveSync(){if(this.solver.solve(),this.solver.failed)throw new Error(this.solver.error||"Routing failed");return this.solver.getOutputSimpleRouteJson().traces||[]}},$Je=class extends ix{constructor(){super(...arguments);Je(this,"matchedPort",null)}get config(){return{componentName:"TraceHint",zodProps:Jxn}}doInitialPortMatching(){const{db:e}=this.root,{_parsedProps:t,parent:r}=this;if(!r)return;if(r.componentName==="Trace"){this.renderError(`Port inference inside trace is not yet supported (${this})`);return}if(!r)throw new Error("TraceHint has no parent");if(!t.for){this.renderError(`TraceHint has no for property (${this})`);return}const i=r.selectOne(t.for,{type:"port"});i||this.renderError(`${this} could not find port for selector "${t.for}"`),this.matchedPort=i,i.registerMatch(this)}getPcbRouteHints(){const{_parsedProps:e}=this,t=e.offset?[e.offset]:e.offsets;if(!t)return[];const r=this._computePcbGlobalTransformBeforeLayout();return t.map(i=>({...gr(r,i),via:i.via,to_layer:i.to_layer,trace_width:i.trace_width}))}doInitialPcbTraceHintRender(){var r,i,a;if((r=this.root)!=null&&r.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this;e.pcb_trace_hint.insert({pcb_component_id:(i=this.matchedPort)==null?void 0:i.pcb_component_id,pcb_port_id:(a=this.matchedPort)==null?void 0:a.pcb_port_id,route:this.getPcbRouteHints()})}},q2n=(n,e)=>{const t=n.source_group.list(),r=[],i=a=>{const o=t.filter(s=>s.parent_subcircuit_id===a);for(const s of o)s.subcircuit_id&&(r.push(s.subcircuit_id),i(s.subcircuit_id))};return i(e),r},GJe=({db:n,circuitJson:e,subcircuit_id:t,minTraceWidth:r=.1})=>{if(!n&&e&&(n=P8(e)),!n)throw new Error("db or circuitJson is required");const i=t?new Set([t]):null;if(t){const x=q2n(n,t);for(const T of x)i.add(T)}const a=(e??n.toArray()).filter(x=>!t||"subcircuit_id"in x&&i.has(x.subcircuit_id)),o=n.pcb_board.list()[0];n=P8(a);const s=zb(a),l=Vw([...n.pcb_component.list(),...n.pcb_smtpad.list(),...n.pcb_plated_hole.list(),...n.pcb_hole.list(),...n.pcb_via.list()].filter(x=>!t||(i==null?void 0:i.has(x.subcircuit_id))),s);for(const x of l){const T=x.connectedTo.flatMap(w=>s.getIdsConnectedToNet(w));x.connectedTo.push(...T)}const c=l.flatMap(x=>[{x:x.center.x-x.width/2,y:x.center.y-x.height/2},{x:x.center.x+x.width/2,y:x.center.y+x.height/2}]);let u;o?u={minX:o.center.x-o.width/2,maxX:o.center.x+o.width/2,minY:o.center.y-o.height/2,maxY:o.center.y+o.height/2}:u={minX:Math.min(...c.map(x=>x.x))-1,maxX:Math.max(...c.map(x=>x.x))+1,minY:Math.min(...c.map(x=>x.y))-1,maxY:Math.max(...c.map(x=>x.y))+1};const f=n.source_trace.list().map(x=>{const T=x.connected_source_port_ids.map(w=>{const S=n.source_port.get(w),A=n.pcb_port.getWhere({source_port_id:w});return{...S,...A}});return T.length<2?null:{name:x.source_trace_id??s.getNetConnectedToId(x.source_trace_id)??"",source_trace_id:x.source_trace_id,pointsToConnect:T.map(w=>{var S;return{x:w.x,y:w.y,layer:((S=w.layers)==null?void 0:S[0])??"top"}})}}).filter(x=>x!==null),p=n.source_net.list().filter(x=>!t||(i==null?void 0:i.has(x.subcircuit_id))),y=[];for(const x of p){const T=n.source_trace.list().filter(w=>{var S;return(S=w.connected_source_net_ids)==null?void 0:S.includes(x.source_net_id)});y.push({name:x.source_net_id??s.getNetConnectedToId(x.source_net_id),pointsToConnect:T.flatMap(w=>n.pcb_port.list().filter(A=>w.connected_source_port_ids.includes(A.source_port_id)).map(A=>{var z;return{x:A.x,y:A.y,layer:((z=A.layers)==null?void 0:z[0])??"top",pcb_port_id:A.pcb_port_id}}))})}return{simpleRouteJson:{bounds:u,obstacles:l,connections:[...f,...y],layerCount:2,minTraceWidth:r},connMap:s}},zpe=class extends d2{constructor(){super(...arguments);Je(this,"pcb_group_id",null);Je(this,"subcircuit_id",null);Je(this,"_hasStartedAsyncAutorouting",!1);Je(this,"_asyncAutoroutingResult",null)}get config(){return{zodProps:exn,componentName:"Group"}}doInitialSourceRender(){const{db:e}=this.root,t=e.source_group.insert({name:this._parsedProps.name,is_subcircuit:this.isSubcircuit});this.subcircuit_id=`subcircuit_${t.source_group_id}`,this.source_group_id=t.source_group_id,e.source_group.update(t.source_group_id,{subcircuit_id:this.subcircuit_id})}doInitialSourceParentAttachment(){var r,i,a;const{db:e}=this.root;if(!this.isSubcircuit)return;const t=(a=(i=(r=this.parent)==null?void 0:r.getSubcircuit)==null?void 0:i.call(r))==null?void 0:a.subcircuit_id;t&&e.source_group.update(this.source_group_id,{parent_subcircuit_id:t})}doInitialPcbComponentRender(){var i;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=e.pcb_group.insert({is_subcircuit:this.isSubcircuit,subcircuit_id:this.subcircuit_id,name:this._parsedProps.name,center:this._getGlobalPcbPositionBeforeLayout(),width:0,height:0,pcb_component_ids:[],source_group_id:this.source_group_id});this.pcb_group_id=r.pcb_group_id}doInitialCreateTraceHintsFromProps(){var a;const{_parsedProps:e}=this,{db:t}=this.root,r=e;if(!this.isSubcircuit)return;const i=(a=r.layout)==null?void 0:a.manual_trace_hints;if(i)for(const o of i)this.add(new $Je({for:o.pcb_port_selector,offsets:o.offsets}))}doInitialSourceAddConnectivityMapKey(){if(!this.isSubcircuit)return;const{db:e}=this.root,t=this.selectAll("trace"),r=new jw({});r.addConnections(t.map(i=>{const a=e.source_trace.get(i.source_trace_id);return a?[a.source_trace_id,...a.connected_source_port_ids,...a.connected_source_net_ids]:null}).filter(i=>i!==null));for(const i of t){if(!i.source_trace_id)continue;const a=r.getNetConnectedToId(i.source_trace_id);if(!a)continue;const{name:o}=this._parsedProps;i.subcircuit_connectivity_map_key=`${o??`unnamedsubcircuit${this._renderId}`}_${a}`,e.source_trace.update(i.source_trace_id,{subcircuit_connectivity_map_key:i.subcircuit_connectivity_map_key})}}_areChildSubcircuitsRouted(){const e=this.selectAll("group").filter(t=>t.isSubcircuit);for(const t of e)if(t._shouldRouteAsync()&&!t._asyncAutoroutingResult)return!1;return!0}_shouldRouteAsync(){const e=this._getAutorouterConfig();return e.groupMode==="sequential-trace"?!1:!!(e.local&&e.groupMode==="subcircuit"||!e.local)}_hasTracesToRoute(){const e=z1("tscircuit:core:_hasTracesToRoute"),t=this.selectAll("trace");return e(`[${this.getString()}] has ${t.length} traces to route`),t.length>0}async _runEffectMakeHttpAutoroutingRequest(){var c,u,f,p;const{db:e}=this.root,t=z1("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");this._parsedProps;const r=this._getAutorouterConfig(),i=r.serverUrl,a=r.serverMode,o=(y,x)=>{var T;return t("fetching",y),x.headers&&(x.headers["Tscircuit-Core-Version"]=(T=this.root)==null?void 0:T.getCoreVersion()),fetch(y,x)},s=this.root.db.toArray().filter(y=>y.type.startsWith("source_")||y.type.startsWith("pcb_"));if(a==="solve-endpoint"){if(((c=this.props.autorouter)==null?void 0:c.inputFormat)==="simplified"){const{autorouting_result:x}=await o(`${i}/autorouting/solve`,{method:"POST",body:JSON.stringify({input_simple_route_json:GJe({db:e,minTraceWidth:((u=this.props.autorouter)==null?void 0:u.minTraceWidth)??.15,subcircuit_id:this.subcircuit_id}).simpleRouteJson,subcircuit_id:this.subcircuit_id}),headers:{"Content-Type":"application/json"}}).then(T=>T.json());this._asyncAutoroutingResult=x,this._markDirty("PcbTraceRender");return}const{autorouting_result:y}=await o(`${i}/autorouting/solve`,{method:"POST",body:JSON.stringify({input_circuit_json:s,subcircuit_id:this.subcircuit_id}),headers:{"Content-Type":"application/json"}}).then(x=>x.json());this._asyncAutoroutingResult=y,this._markDirty("PcbTraceRender");return}const{autorouting_job:l}=await o(`${i}/autorouting/jobs/create`,{method:"POST",body:JSON.stringify({input_circuit_json:s,provider:"freerouting",autostart:!0,display_name:(f=this.root)==null?void 0:f.name,subcircuit_id:this.subcircuit_id,server_cache_enabled:r.serverCacheEnabled}),headers:{"Content-Type":"application/json"}}).then(y=>y.json());for(;;){const{autorouting_job:y}=await o(`${i}/autorouting/jobs/get`,{method:"POST",body:JSON.stringify({autorouting_job_id:l.autorouting_job_id}),headers:{"Content-Type":"application/json"}}).then(x=>x.json());if(y.is_finished){const{autorouting_job_output:x}=await o(`${i}/autorouting/jobs/get_output`,{method:"POST",body:JSON.stringify({autorouting_job_id:l.autorouting_job_id}),headers:{"Content-Type":"application/json"}}).then(T=>T.json());this._asyncAutoroutingResult={output_pcb_traces:x.output_pcb_traces},this._markDirty("PcbTraceRender");break}if(y.has_error)throw e.pcb_autorouting_error.insert({pcb_error_id:l.autorouting_job_id,message:((p=y.error)==null?void 0:p.message)??JSON.stringify(y.error)}),new Error(`Autorouting job failed: ${JSON.stringify(y.error)}`);await new Promise(x=>setTimeout(x,100))}}async _runLocalAutorouting(){var s,l,c,u,f;const{db:e}=this.root;this._parsedProps;const t=z1("tscircuit:core:_runLocalAutorouting");t(`[${this.getString()}] starting local autorouting`);const r=this._getAutorouterConfig(),{simpleRouteJson:i}=GJe({db:e,minTraceWidth:((s=this.props.autorouter)==null?void 0:s.minTraceWidth)??.15,subcircuit_id:this.subcircuit_id});(l=this.root)==null||l.emit("autorouting:start",{subcircuit_id:this.subcircuit_id,componentDisplayName:this.getString(),simpleRouteJson:i});let a;r.algorithmFn?a=await r.algorithmFn(i):a=new G2n(i,{capacityDepth:(c=this.props.autorouter)==null?void 0:c.capacityDepth,targetMinCapacity:(u=this.props.autorouter)==null?void 0:u.targetMinCapacity});const o=new Promise((p,y)=>{a.on("complete",x=>{t(`[${this.getString()}] local autorouting complete`),p(x.traces)}),a.on("error",x=>{t(`[${this.getString()}] local autorouting error: ${x.error.message}`),y(x.error)})});a.on("progress",p=>{var y;(y=this.root)==null||y.emit("autorouting:progress",{subcircuit_id:this.subcircuit_id,componentDisplayName:this.getString(),...p})}),a.start();try{const p=await o;this._asyncAutoroutingResult={output_pcb_traces:p},this._markDirty("PcbTraceRender")}catch(p){const{db:y}=this.root;throw y.pcb_autorouting_error.insert({pcb_error_id:`pcb_autorouter_error_subcircuit_${this.subcircuit_id}`,message:p instanceof Error?p.message:String(p)}),(f=this.root)==null||f.emit("autorouting:error",{subcircuit_id:this.subcircuit_id,componentDisplayName:this.getString(),error:{message:p instanceof Error?p.message:String(p)},simpleRouteJson:i}),p}finally{a.stop()}}_startAsyncAutorouting(){this._hasStartedAsyncAutorouting||(this._hasStartedAsyncAutorouting=!0,this._getAutorouterConfig().local?this._queueAsyncEffect("capacity-mesh-autorouting",async()=>this._runLocalAutorouting()):this._queueAsyncEffect("make-http-autorouting-request",async()=>this._runEffectMakeHttpAutoroutingRequest()))}doInitialPcbTraceRender(){var t;const e=z1("tscircuit:core:doInitialPcbTraceRender");if(this.isSubcircuit&&!((t=this.root)!=null&&t.pcbDisabled)&&!this.getInheritedProperty("routingDisabled")&&!this._shouldUseTraceByTraceRouting()){if(!this._areChildSubcircuitsRouted()){e(`[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`);return}e(`[${this.getString()}] no child subcircuits to wait for, initiating async routing`),this._hasTracesToRoute()&&this._startAsyncAutorouting()}}updatePcbTraceRender(){var r;const e=z1("tscircuit:core:updatePcbTraceRender");if(e(`[${this.getString()}] updating...`),!this.isSubcircuit)return;if(this._shouldRouteAsync()&&this._hasTracesToRoute()&&!this._hasStartedAsyncAutorouting){this._areChildSubcircuitsRouted()&&(e(`[${this.getString()}] child subcircuits are now routed, starting async autorouting`),this._startAsyncAutorouting());return}if(!this._asyncAutoroutingResult||this._shouldUseTraceByTraceRouting())return;const{db:t}=this.root;if(this._asyncAutoroutingResult.output_simple_route_json){e(`[${this.getString()}] updating PCB traces from simple route json (${(r=this._asyncAutoroutingResult.output_simple_route_json.traces)==null?void 0:r.length} traces)`),this._updatePcbTraceRenderFromSimpleRouteJson();return}if(this._asyncAutoroutingResult.output_pcb_traces){e(`[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`),this._updatePcbTraceRenderFromPcbTraces();return}}_updatePcbTraceRenderFromSimpleRouteJson(){const{db:e}=this.root,{traces:t}=this._asyncAutoroutingResult.output_simple_route_json;if(t)for(const r of t)e.pcb_trace.insert({subcircuit_id:this.subcircuit_id,route:r.route})}_updatePcbTraceRenderFromPcbTraces(){const{output_pcb_traces:e}=this._asyncAutoroutingResult;if(!e)return;const{db:t}=this.root;for(const r of e)if(r.type==="pcb_trace"){if(r.subcircuit_id=this.subcircuit_id,r.connection_name){const i=r.connection_name;r.source_trace_id=i}t.pcb_trace.insert(r)}for(const r of e)if(r.type!=="pcb_via"&&r.type==="pcb_trace")for(const i of r.route)i.route_type==="via"&&t.pcb_via.insert({pcb_trace_id:r.pcb_trace_id,x:i.x,y:i.y,hole_diameter:.3,outer_diameter:.6,layers:[i.from_layer,i.to_layer],from_layer:i.from_layer,to_layer:i.to_layer})}doInitialSchematicLayout(){if(!this.isSubcircuit||!this._parsedProps.schAutoLayoutEnabled)return;const{db:t}=this.root,r=this.getDescendants(),i=[];for(const s of r)if("schematic_component_id"in s){const l=t.schematic_component.get(s.schematic_component_id);if(l){const c=t.schematic_port.list().filter(u=>u.schematic_component_id===l.schematic_component_id);i.push(...c)}}const a=wq(t.toArray()),o=Eq(a);Sq(t.toArray(),o)}_getAutorouterConfig(){const e={serverUrl:"https://registry-api.tscircuit.com",serverMode:"job",serverCacheEnabled:!0},t=this._parsedProps.autorouter??this.getInheritedProperty("autorouter");return typeof t=="object"?{local:!(t.serverUrl||t.serverMode||t.serverCacheEnabled),...e,...t}:t==="auto-local"?{local:!0,groupMode:"subcircuit"}:t==="sequential-trace"?{local:!0,groupMode:"sequential-trace"}:t==="subcircuit"?{local:!0,groupMode:"subcircuit"}:t==="auto-cloud"?{local:!1,groupMode:"subcircuit",serverUrl:e.serverUrl,serverMode:e.serverMode,serverCacheEnabled:!0}:{local:!0,groupMode:"subcircuit"}}_shouldUseTraceByTraceRouting(){return this._getAutorouterConfig().groupMode==="sequential-trace"}doInitialPcbDesignRuleChecks(){var t;if((t=this.root)!=null&&t.pcbDisabled||this.getInheritedProperty("routingDisabled"))return;const{db:e}=this.root;if(this.isSubcircuit){const r=new Map;for(const i of this.children)if(!i.isSubcircuit&&i._parsedProps.name){const a=r.get(i._parsedProps.name)||[];a.push(i),r.set(i._parsedProps.name,a)}for(const[i,a]of r.entries())a.length>1&&e.pcb_trace_error.insert({error_type:"pcb_trace_error",message:`Multiple components found with name "${i}" in subcircuit "${this._parsedProps.name||"unnamed"}". Component names must be unique within a subcircuit.`,source_trace_id:"",pcb_trace_id:"",pcb_component_ids:a.map(o=>o.pcb_component_id).filter(Boolean),pcb_port_ids:[]})}}},Y2n=class extends zpe{constructor(){super(...arguments);Je(this,"pcb_board_id",null);Je(this,"_drcChecksComplete",!1);Je(this,"_connectedSchematicPortPairs",new Set)}get isSubcircuit(){return!0}get config(){return{componentName:"Board",zodProps:gJe}}get boardThickness(){const{_parsedProps:e}=this;return 1.4}get allLayers(){return["top","bottom","inner1","inner2"]}doInitialPcbBoardAutoSize(){var y;if((y=this.root)!=null&&y.pcbDisabled||!this.pcb_board_id)return;const{db:e}=this.root,{_parsedProps:t}=this;if(t.width&&t.height)return;let r=1/0,i=1/0,a=-1/0,o=-1/0;const s=e.pcb_component.list();let l=!1;for(const x of s){const{width:T,height:w,center:S}=x;T===0||w===0||(l=!0,r=Math.min(r,S.x-T/2),i=Math.min(i,S.y-w/2),a=Math.max(a,S.x+T/2),o=Math.max(o,S.y+w/2))}const c=2,u=l?a-r+c*2:0,f=l?o-i+c*2:0,p={x:l?(r+a)/2+(t.outlineOffsetX??0):t.outlineOffsetX??0,y:l?(i+o)/2+(t.outlineOffsetY??0):t.outlineOffsetY??0};e.pcb_board.update(this.pcb_board_id,{width:u,height:f,center:p})}doInitialPcbComponentRender(){var o,s;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this;let r=t.width??0,i=t.height??0;if(t.outline){const l=t.outline.map(x=>x.x),c=t.outline.map(x=>x.y),u=Math.min(...l),f=Math.max(...l),p=Math.min(...c),y=Math.max(...c);r=f-u,i=y-p}const a=e.pcb_board.insert({center:{x:(t.pcbX??0)+(t.outlineOffsetX??0),y:(t.pcbY??0)+(t.outlineOffsetY??0)},thickness:this.boardThickness,num_layers:this.allLayers.length,width:r,height:i,outline:(s=t.outline)==null?void 0:s.map(l=>({x:l.x+(t.outlineOffsetX??0),y:l.y+(t.outlineOffsetY??0)})),material:t.material});this.pcb_board_id=a.pcb_board_id}removePcbComponentRender(){const{db:e}=this.root;this.pcb_board_id&&(e.pcb_board.delete(this.pcb_board_id),this.pcb_board_id=null)}_computePcbGlobalTransformBeforeLayout(){return o9()}doInitialPcbDesignRuleChecks(){var e;(e=this.root)!=null&&e.pcbDisabled||this.getInheritedProperty("routingDisabled")||super.doInitialPcbDesignRuleChecks()}updatePcbDesignRuleChecks(){var r;if((r=this.root)!=null&&r.pcbDisabled||this.getInheritedProperty("routingDisabled"))return;const{db:e}=this.root;if(!this._areChildSubcircuitsRouted()||this._drcChecksComplete)return;this._drcChecksComplete=!0;const t=Hq(e.toArray());for(const i of t)e.pcb_trace_error.insert(i)}},X2n=new Proxy({},{get:(n,e)=>e}),bP=X2n,W2n=class extends d2{get config(){return{componentName:"Capacitor",schematicSymbolName:this.props.polarized?"capacitor_polarized":this.props.symbolName??"capacitor",zodProps:pxn,sourceFtype:bP.simple_capacitor}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}_getSchematicSymbolDisplayValue(){const n=`${R4(this._parsedProps.capacitance)}F`;return this._parsedProps.schShowRatings&&this._parsedProps.maxVoltageRating?`${n}/${R4(this._parsedProps.maxVoltageRating)}V`:n}doInitialCreateNetsFromProps(){this._createNetsFromProps([this.props.decouplingFor,this.props.decouplingTo,...this._getNetsFromConnectionsProp()])}doInitialCreateTracesFromProps(){this.props.decouplingFor&&this.props.decouplingTo&&(this.add(new uw({from:`${this.getSubcircuitSelector()} > port.1`,to:this.props.decouplingFor})),this.add(new uw({from:`${this.getSubcircuitSelector()} > port.2`,to:this.props.decouplingTo}))),this._createTracesFromConnectionsProp()}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_capacitor",name:e.name,manufacturer_part_number:e.manufacturerPartNumber??e.mfn,supplier_part_numbers:e.supplierPartNumbers,capacitance:e.capacitance,max_voltage_rating:e.maxVoltageRating,max_decoupling_trace_length:e.maxDecouplingTraceLength,display_capacitance:this._getSchematicSymbolDisplayValue()});this.source_component_id=t.source_component_id}},qJe=class extends d2{constructor(){super(...arguments);Je(this,"schematicBoxDimensions",null)}get config(){return{componentName:"Chip",zodProps:_Je,shouldRenderAsSchematicBox:!0}}doInitialSchematicComponentRender(){const{_parsedProps:e}=this;(e==null?void 0:e.noSchematicRepresentation)!==!0&&super.doInitialSchematicComponentRender()}doInitialSourceRender(){const{db:e}=this.root,{_parsedProps:t}=this,r=e.source_component.insert({ftype:"simple_chip",name:t.name,manufacturer_part_number:t.manufacturerPartNumber,supplier_part_numbers:t.supplierPartNumbers});this.source_component_id=r.source_component_id}doInitialPcbComponentRender(){var i;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=e.pcb_component.insert({center:{x:t.pcbX??0,y:t.pcbY??0},width:2,height:3,layer:t.layer??"top",rotation:t.pcbRotation??0,source_component_id:this.source_component_id,subcircuit_id:this.getSubcircuit().subcircuit_id??void 0});this.pcb_component_id=r.pcb_component_id}doInitialCreateTracesFromProps(){const{_parsedProps:e}=this;if(e.externallyConnectedPins)for(const[t,r]of e.externallyConnectedPins)this.add(new uw({from:`${this.getSubcircuitSelector()} > port.${t}`,to:`${this.getSubcircuitSelector()} > port.${r}`}));this._createTracesFromConnectionsProp()}},Z2n=class extends d2{constructor(){super(...arguments);Je(this,"pos",this.portMap.pin1);Je(this,"anode",this.portMap.pin1);Je(this,"neg",this.portMap.pin2);Je(this,"cathode",this.portMap.pin2)}get config(){return{schematicSymbolName:this.props.symbolName??"diode",componentName:"Diode",zodProps:Bxn,sourceFtype:"simple_diode"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}},Q2n=class extends d2{constructor(){super(...arguments);Je(this,"schematicDimensions",null)}get config(){return{componentName:"Jumper",zodProps:ixn,shouldRenderAsSchematicBox:!0}}doInitialSourceRender(){const{db:e}=this.root,{_parsedProps:t}=this,r=e.source_component.insert({ftype:"simple_chip",name:t.name,manufacturer_part_number:t.manufacturerPartNumber,supplier_part_numbers:t.supplierPartNumbers});this.source_component_id=r.source_component_id}doInitialPcbComponentRender(){var i;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=e.pcb_component.insert({center:{x:t.pcbX??0,y:t.pcbY??0},width:2,height:3,layer:t.layer??"top",rotation:t.pcbRotation??0,source_component_id:this.source_component_id,subcircuit_id:this.getSubcircuit().subcircuit_id??void 0});this.pcb_component_id=r.pcb_component_id}},K2n=class extends d2{constructor(){super(...arguments);Je(this,"pos",this.portMap.pin1);Je(this,"anode",this.portMap.pin1);Je(this,"neg",this.portMap.pin2);Je(this,"cathode",this.portMap.pin2)}get config(){return{componentName:"Led",schematicSymbolName:this.props.symbolName??"led",zodProps:jxn,sourceFtype:"simple_diode"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}},J2n=class extends d2{constructor(){super(...arguments);Je(this,"pos",this.portMap.pin1);Je(this,"positive",this.portMap.pin1);Je(this,"neg",this.portMap.pin2);Je(this,"negative",this.portMap.pin2)}get config(){return{schematicSymbolName:this.props.symbolName??"power_factor_meter_horz",componentName:"PowerSource",zodProps:Yxn,sourceFtype:"simple_power_source"}}initPorts(){this.add(new p6({name:"pin1",pinNumber:1,aliases:["positive","pos"]})),this.add(new p6({name:"pin2",pinNumber:2,aliases:["negative","neg"]}))}},e5n=class extends d2{get config(){return{componentName:"Resistor",schematicSymbolName:this.props.symbolName??"boxresistor",zodProps:lxn,sourceFtype:"simple_resistor"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}_getSchematicSymbolDisplayValue(){return`${R4(this._parsedProps.resistance)}Ω`}doInitialCreateNetsFromProps(){this._createNetsFromProps([this.props.pullupFor,this.props.pullupTo,...this._getNetsFromConnectionsProp()])}doInitialCreateTracesFromProps(){this.props.pullupFor&&this.props.pullupTo&&(this.add(new uw({from:`${this.getSubcircuitSelector()} > port.1`,to:this.props.pullupFor})),this.add(new uw({from:`${this.getSubcircuitSelector()} > port.2`,to:this.props.pullupTo}))),this._createTracesFromConnectionsProp()}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_resistor",name:e.name,manufacturer_part_number:e.manufacturerPartNumber??e.mfn,supplier_part_numbers:e.supplierPartNumbers,resistance:e.resistance,display_resistance:this._getSchematicSymbolDisplayValue()});this.source_component_id=t.source_component_id}},t5n=["leftedge","rightedge","topedge","bottomedge","center"],n5n=class extends ix{get config(){return{componentName:"Constraint",zodProps:gxn}}constructor(n){if(super(n),("xdist"in n||"ydist"in n)&&!("edgeToEdge"in n)&&!("centerToCenter"in n))throw new Error(`edgeToEdge, centerToCenter must be set for xDist or yDist for ${this}`);if("for"in n&&n.for.length<2)throw new Error(`"for" must have at least two selectors for ${this}`)}_getAllReferencedComponents(){const n=[],e=this.getPrimitiveContainer();function t(r){const i=r.split(" ").pop(),a=t5n.includes(i)?i:void 0,o=a?r.replace(` ${a}`,""):r,s=e.selectOne(o,{pcbPrimitive:!0});s&&n.push({selector:r,component:s,componentSelector:o,edge:a})}for(const r of["left","right","top","bottom"])r in this._parsedProps&&t(this._parsedProps[r]);if("for"in this._parsedProps)for(const r of this._parsedProps.for)t(r);return{componentsWithSelectors:n}}},r5n=class extends ix{constructor(){super(...arguments);Je(this,"fabrication_note_path_id",null)}get config(){return{componentName:"FabricationNotePath",zodProps:$xn}}doInitialPcbPrimitiveRender(){var s,l;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,t=this.getSubcircuit(),{_parsedProps:r}=this,i=r.layer??"top";if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenPath. Must be "top" or "bottom".`);const a=this._computePcbGlobalTransformBeforeLayout(),o=e.pcb_fabrication_note_path.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,color:r.color,route:r.route.map(c=>{const u=gr(a,{x:c.x,y:c.y});return{...c,x:u.x,y:u.y}}),stroke_width:r.strokeWidth??.1,subcircuit_id:(t==null?void 0:t.subcircuit_id)??void 0});this.fabrication_note_path_id=o.pcb_fabrication_note_path_id}},i5n=class extends ix{get config(){return{componentName:"FabricationNoteText",zodProps:Vxn}}doInitialPcbPrimitiveRender(){var i,a;if((i=this.root)!=null&&i.pcbDisabled)return;const{db:n}=this.root,{_parsedProps:e}=this,t=this.getPrimitiveContainer(),r=this.getSubcircuit();n.pcb_fabrication_note_text.insert({anchor_alignment:e.anchorAlignment,anchor_position:{x:e.pcbX??0,y:e.pcbY??0},font:e.font??"tscircuit2024",font_size:e.fontSize??1,layer:"top",color:e.color,text:e.text??"",pcb_component_id:t.pcb_component_id,subcircuit_id:(r==null?void 0:r.subcircuit_id)??void 0,pcb_group_id:((a=this.getGroup())==null?void 0:a.pcb_group_id)??void 0})}},a5n=class extends zpe{constructor(n){super({...n,subcircuit:!0})}},o5n=class extends ix{constructor(){super(...arguments);Je(this,"source_net_alias_id")}get config(){return{componentName:"NetAlias",zodProps:Dxn}}doInitialSchematicComponentRender(){var a;if((a=this.root)!=null&&a.schematicDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r={x:t.schX??0,y:t.schY??0},i=e.schematic_net_label.insert({text:t.net,source_net_id:t.net,anchor_position:r,center:r,anchor_side:"bottom"});this.source_net_alias_id=i.source_net_id}},s5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_silkscreen_circle_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenCircle",zodProps:Kxn}}doInitialPcbPrimitiveRender(){var s,l,c;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers(),i=r(t.layer??"top");if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenCircle. Must be "top" or "bottom".`);this._computePcbGlobalTransformBeforeLayout();const a=this.getSubcircuit(),o=e.pcb_silkscreen_circle.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,center:{x:t.pcbX??0,y:t.pcbY??0},radius:t.radius,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((c=this.getGroup())==null?void 0:c.pcb_group_id)??void 0,stroke_width:t.strokeWidth??.1});this.pcb_silkscreen_circle_id=o.pcb_silkscreen_circle_id}getPcbSize(){const{_parsedProps:e}=this,t=e.radius*2;return{width:t,height:t}}},l5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_silkscreen_rect_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenRect",zodProps:Qxn}}doInitialPcbPrimitiveRender(){var s,l,c;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers(),i=r(t.layer??"top");if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenRect. Must be "top" or "bottom".`);const a=this.getSubcircuit(),o=e.pcb_silkscreen_rect.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,center:{x:t.pcbX??0,y:t.pcbY??0},width:t.width,height:t.height,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((c=this==null?void 0:this.getGroup())==null?void 0:c.pcb_group_id)??void 0,stroke_width:t.strokeWidth??.1});this.pcb_silkscreen_rect_id=o.pcb_silkscreen_rect_id}getPcbSize(){const{_parsedProps:e}=this;return{width:e.width,height:e.height}}},c5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_silkscreen_line_id",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"SilkscreenLine",zodProps:Zxn}}doInitialPcbPrimitiveRender(){var s,l,c;if((s=this.root)!=null&&s.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,{maybeFlipLayer:r}=this._getPcbPrimitiveFlippedHelpers(),i=r(t.layer??"top");if(i!=="top"&&i!=="bottom")throw new Error(`Invalid layer "${i}" for SilkscreenLine. Must be "top" or "bottom".`);const a=this.getSubcircuit(),o=e.pcb_silkscreen_line.insert({pcb_component_id:(l=this.parent)==null?void 0:l.pcb_component_id,layer:i,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke_width:t.strokeWidth??.1,subcircuit_id:(a==null?void 0:a.subcircuit_id)??void 0,pcb_group_id:((c=a==null?void 0:a.getGroup())==null?void 0:c.pcb_group_id)??void 0});this.pcb_silkscreen_line_id=o.pcb_silkscreen_line_id}getPcbSize(){const{_parsedProps:e}=this,t=Math.abs(e.x2-e.x1),r=Math.abs(e.y2-e.y1);return{width:t,height:r}}},u5n=class extends ix{constructor(){super(...arguments);Je(this,"pcb_via_id",null);Je(this,"matchedPort",null);Je(this,"isPcbPrimitive",!0)}get config(){return{componentName:"Via",zodProps:Gxn}}getAvailablePcbLayers(){return["top","inner1","inner2","bottom"]}getPcbSize(){const{_parsedProps:e}=this;return{width:e.outerDiameter,height:e.outerDiameter}}_getPcbCircuitJsonBounds(){const{db:e}=this.root,t=e.pcb_via.get(this.pcb_via_id),r=this.getPcbSize();return{center:{x:t.x,y:t.y},bounds:{left:t.x-r.width/2,top:t.y-r.height/2,right:t.x+r.width/2,bottom:t.y+r.height/2},width:r.width,height:r.height}}_setPositionFromLayout(e){const{db:t}=this.root;t.pcb_via.update(this.pcb_via_id,{x:e.x,y:e.y})}doInitialPcbPrimitiveRender(){var o,s;if((o=this.root)!=null&&o.pcbDisabled)return;const{db:e}=this.root,{_parsedProps:t}=this,r=this._getGlobalPcbPositionBeforeLayout(),i=this.getSubcircuit(),a=e.pcb_via.insert({x:r.x,y:r.y,hole_diameter:t.holeDiameter,outer_diameter:t.outerDiameter,layers:["bottom","top"],from_layer:t.fromLayer||"bottom",to_layer:t.toLayer||"top",subcircuit_id:(i==null?void 0:i.subcircuit_id)??void 0,pcb_group_id:((s=this.getGroup())==null?void 0:s.pcb_group_id)??void 0});this.pcb_via_id=a.pcb_via_id}},f5n=class extends d2{get config(){return{componentName:"Battery",schematicSymbolName:this.props.symbolName??"battery",zodProps:Pxn,sourceFtype:"simple_power_source"}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:"simple_power_source",capacity:e.capacity,supplier_part_numbers:e.supplierPartNumbers});this.source_component_id=t.source_component_id}},d5n=class extends d2{get config(){return{componentName:"PinHeader",zodProps:Nxn,shouldRenderAsSchematicBox:!0}}_getImpliedFootprintString(){var i;const n=this._parsedProps.pinCount??((i=this._parsedProps.pinLabels)==null?void 0:i.length)??0,e=this._parsedProps.holeDiameter,t=this._parsedProps.platedDiameter,r=this._parsedProps.pitch;return n>0&&r?!e&&!t?`pinrow${n}_p${r}`:`pinrow${n}_p${r}_id${e}_od${t}`:null}initPorts(){var e,t;const n=this._parsedProps.pinCount??((e=this._parsedProps.pinLabels)==null?void 0:e.length)??1;for(let r=1;r<=n;r++)this.add(new p6({name:`pin${r}`,pinNumber:r,aliases:[(t=this._parsedProps.pinLabels)==null?void 0:t[r-1]].filter(Boolean)}))}_getSchematicPortArrangement(){const n=this._parsedProps.pinCount??1,e=this._parsedProps.facingDirection??"right";return{leftSize:e==="left"?n:0,rightSize:e==="right"?n:0}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_pin_header",name:e.name,supplier_part_numbers:e.supplierPartNumbers,pin_count:e.pinCount,gender:e.gender});this.source_component_id=t.source_component_id}};function p5n(n){switch(n){case"two_ground_pins":return"crystal_4pin";case"ground_pin":return"resonator";case"no_ground":return"crystal";default:return"crystal"}}var h5n=class extends d2{get config(){return{componentName:"Resonator",schematicSymbolName:this.props.symbolName??p5n(this.props.pinVariant),zodProps:fxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_resonator",name:e.name,frequency:e.frequency,load_capacitance:e.loadCapacitance,supplier_part_numbers:e.supplierPartNumbers,pin_variant:e.pinVariant||"no_ground"});this.source_component_id=t.source_component_id}},m5n=class extends d2{get config(){return{componentName:"Inductor",schematicSymbolName:this.props.symbolName??"inductor",zodProps:Uxn,sourceFtype:bP.simple_inductor}}initPorts(){super.initPorts({additionalAliases:{pin1:["anode","pos","left"],pin2:["cathode","neg","right"]}})}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:bP.simple_inductor,inductance:e.inductance,supplier_part_numbers:e.supplierPartNumbers});this.source_component_id=t.source_component_id}};function y5n(n){switch(n){case"three_pin":return"potentiometer3";case"two_pin":return"potentiometer2";default:return"potentiometer2"}}var v5n=class extends d2{get config(){return{componentName:"Potentiometer",schematicSymbolName:this.props.symbolName??y5n(this.props.pinVariant),zodProps:cxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_potentiometer",name:e.name,max_resistance:e.maxResistance,pin_variant:e.pinVariant||"two_pin"});this.source_component_id=t.source_component_id}},g5n=class extends d2{get config(){return{componentName:"PushButton",schematicSymbolName:this.props.symbolName??"push_button_normally_open_momentary",zodProps:Lxn,sourceFtype:bP.simple_push_button}}get defaultInternallyConnectedPinNames(){return[["pin1","pin4"],["pin2","pin3"]]}initPorts(){super.initPorts({pinCount:4,additionalAliases:{pin1:["side1"],pin3:["side2"]}})}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:bP.simple_push_button,supplier_part_numbers:e.supplierPartNumbers});this.source_component_id=t.source_component_id}},_5n=class extends d2{get config(){return{schematicSymbolName:this.props.symbolName??(this.props.pinVariant==="four_pin"?"crystal_4pin":"crystal"),componentName:"Crystal",zodProps:uxn,sourceFtype:"simple_crystal"}}initPorts(){const n=this.props.pinVariant==="four_pin"?{pin1:["left1","1"],pin2:["top1","2","gnd1"],pin3:["right1","3"],pin4:["bottom1","4","gnd2"]}:{pin1:["pos","left"],pin2:["neg","right"]};super.initPorts({additionalAliases:n})}_getSchematicSymbolDisplayValue(){return`${R4(this._parsedProps.frequency)}Hz`}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({name:e.name,ftype:"simple_crystal",frequency:e.frequency,load_capacitance:e.loadCapacitance,pin_variant:e.pinVariant||"two_pin"});this.source_component_id=t.source_component_id}},x5n=class extends d2{constructor(){super(...arguments);Je(this,"emitter",this.portMap.pin1);Je(this,"collector",this.portMap.pin2);Je(this,"base",this.portMap.pin3)}get config(){return{componentName:"Transistor",schematicSymbolName:this.props.type==="npn"?"npn_bipolar_transistor":"pnp_bipolar_transistor",zodProps:Oxn,sourceFtype:"simple_transistor",shouldRenderAsSchematicBox:!1}}initPorts(){super.initPorts({pinCount:3,additionalAliases:{pin1:["emitter","e"],pin2:["collector","c"],pin3:["base","b"]}})}doInitialSourceRender(){const{db:e}=this.root,{_parsedProps:t}=this,r=e.source_component.insert({ftype:"simple_transistor",name:t.name,transistor_type:t.type});this.source_component_id=r.source_component_id}},b5n=class extends d2{get config(){const n=this.props.mosfetMode==="depletion"?"d":"e";return{componentName:"Mosfet",schematicSymbolName:`${this.props.channelType}_channel_${n}_mosfet_transistor`,zodProps:zxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_mosfet",name:e.name,mosfet_mode:e.mosfetMode,channel_type:e.channelType});this.source_component_id=t.source_component_id}},S5n=class extends d2{_getSwitchType(){const{spst:n,spdt:e,dpst:t,dpdt:r,type:i}=this._parsedProps??{};return r?"dpdt":n?"spst":e?"spdt":t?"dpst":i??"spst"}get config(){const n=this._getSwitchType(),{isNormallyClosed:e}=this._parsedProps??{};return{componentName:"Switch",schematicSymbolName:{spst:e?"spst_normally_closed_switch":"SPST_switch",spdt:e?"spdt_normally_closed_switch":"SPDT_switch",dpst:e?"dpst_normally_closed_switch":"dpst_switch",dpdt:e?"dpdt_normally_closed_switch":"dpdt_switch"}[n]??"SPST_switch",zodProps:Hxn,shouldRenderAsSchematicBox:!1}}doInitialSourceRender(){const{db:n}=this.root,{_parsedProps:e}=this,t=n.source_component.insert({ftype:"simple_switch",name:e.name,switch_type:e.type,is_normally_closed:e.isNormallyClosed??!1});this.source_component_id=t.source_component_id}};new Proxy({},{get:(n,e)=>{const t=(...r)=>(r[0],new Proxy({},{get:(i,a)=>`.${e} > .${a}`}));return new Proxy(t,{get:(r,i)=>e==="net"?`net.${i}`:e==="subcircuit"?new Proxy({},{get:(a,o)=>new Proxy({},{get:(s,l)=>`subcircuit.${i} > .${o} > .${l}`})}):`.${e} > .${i}`,apply:(r,i,a)=>new Proxy({},{get:(o,s)=>{const l=`.${e} > .${s}`;return e.startsWith("U")?l:new Proxy(new String(l),{get:(c,u)=>typeof u=="symbol"||u==="toString"?()=>l:`.${e} > .${s} > .${u}`})}})})}}),CJe(TJe),CJe({Bug:qJe});const YJe=n=>`hsl(${V4.indexOf(n)*137.5%360}, 70%, 50%)`,w5n=({phaseTimings:n})=>{if(!n)return null;const e=Object.values(n).reduce((t,r)=>t+r,0);return ut.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[ut.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:V4.map(t=>{const r=n[t]||0,i=r/e*100;return ut.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:YJe(t)},children:ut.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",r.toFixed(1),"ms"]})},t)})}),ut.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},E5n=({renderLog:n})=>{const[e,t]=vt.useState("chronological");if(!n)return ut.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const r=Object.entries((n==null?void 0:n.phaseTimings)??{});e==="chronological"?r.sort((a,o)=>V4.indexOf(a[0])-V4.indexOf(o[0])):r.sort((a,o)=>o[1]-a[1]);const i=r.reduce((a,[o,s])=>a+s,0);return ut.jsxs("div",{className:"rf-bg-white",children:[ut.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[ut.jsx("div",{children:"Render Logs"}),ut.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[ut.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),ut.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[ut.jsx("option",{value:"chronological",children:"Phase Order"}),ut.jsx("option",{value:"longest",children:"Duration"})]})]})]}),ut.jsx(w5n,{phaseTimings:n.phaseTimings}),ut.jsxs("table",{className:"rf-w-full rf-text-xs",children:[ut.jsx("thead",{children:ut.jsxs("tr",{children:[ut.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),ut.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),ut.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),ut.jsx("tbody",{children:r.map(([a,o])=>ut.jsxs("tr",{children:[ut.jsx("td",{className:"rf-p-2",children:V4.indexOf(a)}),ut.jsx("td",{className:"rf-p-2",children:a}),ut.jsx("td",{className:"rf-p-2",children:ut.jsx("div",{className:"rf-w-8",children:ut.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:YJe(a),width:`${o/i*100}%`}})})}),ut.jsx("td",{className:"rf-p-2",children:ut.jsxs("div",{className:"rf-flex w-full",children:[ut.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),ut.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/i*100).toFixed(1),"%"]})]})})]},a))})]})]})},T5n="0.0.429",M5n=["assembly","bom","circuit_json","errors","render_log"],C5n=({code:n,onRunClicked:e=void 0,errorMessage:t,circuitJson:r,autoroutingGraphics:i,showRightHeaderContent:a=!0,showCodeTab:o=!1,codeTabContent:s,showJsonTab:l=!0,showRenderLogTab:c=!0,onActiveTabChange:u,renderLog:f,showImportAndFormatButtons:p=!0,className:y,headerClassName:x,leftHeaderContent:T,readOnly:w,isStreaming:S,autoroutingLog:A,onReportAutoroutingLog:z,isRunningCode:I,hasCodeChangedSinceLastRun:G,onEditEvent:Y,editEvents:Q,defaultActiveTab:K,autoRotate3dViewerDisabled:re,showSchematicDebugGrid:J=!1,showToggleFullScreen:fe=!0,defaultToFullScreen:me=!1})=>{var Ue;Dhn();const ve=vt.useMemo(()=>r?r.filter(Ie=>Ie&&"error_type"in Ie):null,[r]),[Te,Pe]=vt.useState(K??"pcb"),[we,Ce]=vt.useState(me),Se=vt.useCallback(Ie=>{Pe(Ie),u==null||u(Ie)},[u]),ze=()=>{Ce(!we)};return vt.useEffect(()=>{t&&Se("errors")},[t]),vt.useEffect(()=>{(Te==="code"||Te==="errors")&&r&&!t&&Se(K??"pcb")},[r]),ut.jsx("div",{className:rg("flex flex-col relative rf-overflow-x-hidden",y),children:ut.jsx("div",{className:rg("rf-md:sticky rf-md:top-2",we&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-bg-white"),children:ut.jsxs(eit,{value:Te,onValueChange:Se,className:"rf-flex-grow rf-flex rf-flex-col",children:[ut.jsxs("div",{className:rg("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",x),children:[T,T&&ut.jsx("div",{className:"rf-flex-grow"}),!T&&I&&ut.jsx(KUe,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!T&&ut.jsx("div",{className:"rf-flex-grow"}),f&&f.progress!==1&&ut.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[f.lastRenderEvent&&ut.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:(Ue=f.lastRenderEvent)==null?void 0:Ue.type.split("renderable:renderLifecycle:")[1].split(":")[0]}),ut.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:ut.jsx(KUe,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),ut.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((f.progress??0)*100).toFixed(1),"%"]})]}),a&&ut.jsxs(Hme,{children:[o&&ut.jsx(Ew,{value:"code",children:"Code"}),ut.jsxs(Ew,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&ut.jsx("span",{className:rg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",G?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),ut.jsxs(Ew,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&ut.jsx("span",{className:rg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",G?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),ut.jsxs(Ew,{value:"cad",children:[r&&ut.jsx("span",{className:rg("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",G?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Te)&&ut.jsx(Ew,{value:Te,children:jme(Te)}),ut.jsxs(lFe,{children:[ut.jsx(cFe,{asChild:!0,children:ut.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[ut.jsx(rGt,{className:"rf-w-4 rf-h-4"}),(ve&&ve.length>0||t)&&ut.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),ut.jsxs($oe,{className:"rf-*:text-xs",children:[M5n.map(Ie=>ut.jsxs(Hk,{onSelect:()=>Se(Ie),children:[Te!==Ie&&ut.jsx(QUe,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Te===Ie&&ut.jsx(WUe,{className:"rf-w-3 rf-h-3"}),ut.jsx("div",{className:"rf-pr-2",children:jme(Ie)}),Ie==="errors"&&(ve&&ve.length>0||t)&&ut.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:ve==null?void 0:ve.length})]},Ie)),ut.jsx(Hk,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:ut.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",T5n.split(".").map((Ie,ke)=>ke===2?parseInt(Ie)+1:Ie).join(".")]})})]})]})]}),fe&&ut.jsx(iS,{onClick:ze,variant:"ghost",children:we?ut.jsx(oGt,{size:16}):ut.jsx(iGt,{size:16})})]}),o&&ut.jsx(Ab,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:ut.jsx("div",{className:"rf-h-full",children:s})}),ut.jsx(Ab,{value:"pcb",children:ut.jsx("div",{className:rg("rf-overflow-hidden",we?"rf-h-[calc(100vh-52px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallbackRender:({error:Ie})=>ut.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ut.jsxs("div",{className:"rf-p-4",children:[ut.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),ut.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:r?ut.jsx(Phn,{focusOnHover:!1,circuitJson:r,debugGraphics:i,containerClassName:rg("rf-h-full rf-w-full",we?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ie=>{Y&&Ie.forEach(ke=>Y(ke))}}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"assembly",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallback:ut.jsx("div",{children:"Error loading Assembly"}),children:r?ut.jsx(Utn,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"schematic",children:ut.jsx("div",{className:rg("rf-overflow-auto rf-bg-white",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallbackRender:({error:Ie})=>ut.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ut.jsxs("div",{className:"rf-p-4",children:[ut.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),ut.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:r?ut.jsx(Ltn,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ie=>{Y==null||Y(Ie)},debugGrid:J,colorOverrides:{schematic:{background:"transparent"}}}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"cad",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{FallbackComponent:V$t,children:r?ut.jsx(j$t,{soup:r,autoRotateDisabled:re}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"bom",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallbackRender:({error:Ie})=>ut.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ut.jsxs("div",{className:"rf-p-4",children:[ut.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),ut.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:r?ut.jsx(jtn,{circuitJson:r}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"circuit_json",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ut.jsx(uT,{fallback:ut.jsx("div",{children:"Error loading JSON viewer"}),children:r?ut.jsx(Ftn,{elements:r}):ut.jsx(J7,{onRunClicked:e})})})}),ut.jsx(Ab,{value:"errors",children:ut.jsx("div",{className:rg("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:Array.isArray(ve)&&ve.length>0||t?ut.jsx(rWt,{code:n,circuitJsonErrors:ve,errorMessage:t,autoroutingLog:A,onReportAutoroutingLog:z}):ut.jsx(J7,{onRunClicked:e})})}),c&&ut.jsx(Ab,{value:"render_log",children:ut.jsx(E5n,{renderLog:f})})]})})})};lme.createRoot(document.getElementById("root")).render(ut.jsx(C5n,{defaultActiveTab:"cad",autoRotate3dViewerDisabled:!0,showRightHeaderContent:!1,circuitJson:window.CIRCUIT_JSON||{},...window.CIRCUIT_JSON_PREVIEW_PROPS||{}}))});
|