@tscircuit/runframe 0.0.1741 → 0.0.1743

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.
@@ -5378,7 +5378,7 @@ svg { font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; }
5378
5378
  50% { opacity: 0.2; }
5379
5379
  100% { opacity: 0.6; }
5380
5380
  }
5381
- `,n.appendChild(u)}})}};o();const s=new MutationObserver(o);return s.observe(n,{childList:!0,subtree:!1,characterData:!1}),()=>{s.disconnect()}},[e,t,A,i])},fct=["#8B0000","#2F4F4F","#191970","#006400","#FF4500","#800080","#2E8B57","#B8860B","#C71585","#008B8B"],LVe=e=>{const{svgDivRef:A,circuitJson:t,circuitJsonKey:i,showGroups:n}=e;AA.useEffect(()=>{if(A.current&&A.current.querySelectorAll(".schematic-group-overlay").forEach(r=>r.remove()),!A.current||!n||!t||t.length===0)return;const o=setTimeout(()=>{if(!A.current)return;const s=A.current.querySelector("svg");if(!s)return;s.querySelectorAll(".schematic-group-overlay").forEach(a=>a.remove());try{const a=qE(t).source_group?.list().filter(u=>!u.is_subcircuit)||[],g=qE(t).schematic_component?.list()||[],c=new Map;a.forEach(u=>{const d=u;if(d.parent_source_group_id){const f=c.get(d.parent_source_group_id)||[];f.push(u.source_group_id),c.set(d.parent_source_group_id,f)}});const I=u=>{const d=[],f=c.get(u)||[];for(const m of f)d.push(m),d.push(...I(m));return d},l=u=>{const d=a.find(f=>f.source_group_id===u);return d?.parent_source_group_id?1+l(d.parent_source_group_id):0},B=a.length>0&&a.some(u=>u.name&&u.name.trim()!=="");let C=[];if(B){const u=new Map;for(const d of g){const f=qE(t).source_component.get(d.source_component_id);f?.source_group_id&&(u.has(f.source_group_id)||u.set(f.source_group_id,[]),u.get(f.source_group_id).push(d))}a.forEach((d,f)=>{let m=u.get(d.source_group_id)||[];const w=I(d.source_group_id);for(const D of w){const S=u.get(D)||[];m=[...m,...S]}if(m.length>0){const D=l(d.source_group_id),S=I(d.source_group_id).length>0;if(d.name?.startsWith("unnamed_board"))return;C.push({id:d.source_group_id,name:d.name||`Group ${f+1}`,components:m,color:fct[f%fct.length],depthLevel:D,hasChildren:S,sourceGroupId:d.source_group_id})}})}const Q=s.viewBox.baseVal,h=s.getBoundingClientRect(),E=Math.min(h.width/Q.width,h.height/Q.height)||1;C.sort((u,d)=>u.depthLevel-d.depthLevel),C.forEach(u=>{if(u.components.length===0)return;const d=UVe(u.components,s);if(!d)return;const f=Math.max(8,Math.min(25,15/Math.max(E,.3))),m=u.hasChildren?f*.6:0,w=f+m,D=Math.max(1,2/Math.max(E,.5)),S=u.depthLevel===0?D:D*.7,_=Math.max(4,8/Math.max(E,.5)),b=u.hasChildren?1.3:1,R=_*b,F=R*.5,H=document.createElementNS("http://www.w3.org/2000/svg","rect");H.setAttribute("class","schematic-group-overlay"),H.setAttribute("x",(d.minX-w).toString()),H.setAttribute("y",(d.minY-w).toString()),H.setAttribute("width",(d.maxX-d.minX+w*2).toString()),H.setAttribute("height",(d.maxY-d.minY+w*2).toString()),H.setAttribute("fill","none"),H.setAttribute("stroke",u.color),H.setAttribute("stroke-width",S.toString()),H.setAttribute("stroke-dasharray",`${R},${F}`),H.setAttribute("opacity","0.8"),H.setAttribute("rx","0"),H.setAttribute("ry","0");const Y=Math.max(6,Math.min(20,14/Math.max(E,.2))),J=u.depthLevel===0||u.depthLevel===1?0:u.depthLevel*.2,O=Y*(1-J),W=Math.max(1,O*.2),z=u.name,tA=document.createElementNS("http://www.w3.org/2000/svg","text");tA.setAttribute("font-size",O.toString()),tA.setAttribute("font-family","Arial, sans-serif"),tA.textContent=z,s.appendChild(tA);const aA=tA.getBBox();s.removeChild(tA);const eA=aA.width+W*2,oA=O+W*2,rA=d.minX-w,lA=d.minY-w-oA,pA=document.createElementNS("http://www.w3.org/2000/svg","rect");pA.setAttribute("class","schematic-group-overlay"),pA.setAttribute("x",rA.toString()),pA.setAttribute("y",(lA-oA).toString()),pA.setAttribute("width",eA.toString()),pA.setAttribute("height",oA.toString()),pA.setAttribute("fill","transparent"),pA.setAttribute("rx","0"),pA.setAttribute("ry","0");const vA=document.createElementNS("http://www.w3.org/2000/svg","text");vA.setAttribute("class","schematic-group-overlay"),vA.setAttribute("x",(rA+W).toString()),vA.setAttribute("y",(lA+oA-W).toString()),vA.setAttribute("fill",u.color),vA.setAttribute("font-size",O.toString()),vA.setAttribute("font-family","Arial, sans-serif"),vA.setAttribute("font-weight",u.depthLevel===0?"600":"500"),vA.setAttribute("stroke",u.color),vA.setAttribute("stroke-width",Math.max(.2,O*.02).toString()),vA.textContent=z,s.appendChild(H),s.appendChild(pA),s.appendChild(vA)})}catch(a){console.error("Error creating group overlays:",a)}},10);return()=>clearTimeout(o)},[A,i,n])};function UVe(e,A){let t=1/0,i=1/0,n=-1/0,o=-1/0;for(const r of e){let a=A.querySelector(`g[data-schematic-component-id="${r.schematic_component_id}"]`);if(a||(a=A.querySelector(`[data-schematic-component-id="${r.schematic_component_id}"]`)),a){const g=a.getBBox();t=Math.min(t,g.x),i=Math.min(i,g.y),n=Math.max(n,g.x+g.width),o=Math.max(o,g.y+g.height)}}return t===1/0?null:{minX:t,minY:i,maxX:n,maxY:o}}var HVe=Dc("schematic-viewer"),YVe=()=>{Dc.enable("schematic-viewer*")},JVe=HVe,yct=e=>{const[A,t]=AA.useState(0),[i,n]=AA.useState(0);return AA.useEffect(()=>{if(!e.current)return;const o=()=>{const r=e.current?.getBoundingClientRect();t(r?.width||0),n(r?.height||0)};o();const s=new ResizeObserver(o);return s.observe(e.current),window.addEventListener("resize",o),()=>{s.disconnect(),window.removeEventListener("resize",o)}},[]),{containerWidth:A,containerHeight:i}},TVe=JVe.extend("useComponentDragging"),PVe=({onEditEvent:e,editEvents:A=[],circuitJson:t,cancelDrag:i,svgToScreenProjection:n,realToSvgProjection:o,enabled:s=!1,snapToGrid:r=!1})=>{const[a,g]=AA.useState(null),c=tn(o,n),I=AA.useRef(null),l=AA.useRef(null),B=AA.useRef(new Map);AA.useEffect(()=>{A.forEach(D=>{"edit_event_type"in D&&D.edit_event_type==="edit_schematic_component_location"&&!D.in_progress&&B.current.set(D.schematic_component_id,{...D.new_center})})},[A]);const C=AA.useCallback((D,S,_)=>{if(!s)return!1;const b=_.closest('[data-circuit-json-type="schematic_component"]');if(!b)return!1;const R=b.getAttribute("data-schematic-component-id");if(!R)return!1;i&&i();const F=qE(t).schematic_component.get(R);if(!F)return!1;I.current={x:D,y:S};let H;const Y=B.current.get(R);if(Y)H={...Y};else{const O=pct({editEvents:A,schematic_component_id:R});H={x:F.center.x+O.x,y:F.center.y+O.y},B.current.set(R,{...H})}const J={edit_event_id:Math.random().toString(36).substr(2,9),edit_event_type:"edit_schematic_component_location",schematic_component_id:R,original_center:H,new_center:{...H},in_progress:!0,created_at:Date.now(),_element:b};return l.current=J,g(J),!0},[i,s,t,A]),Q=AA.useCallback(D=>{C(D.clientX,D.clientY,D.target)},[C]),h=AA.useCallback(D=>{if(D.touches.length!==1)return;const S=D.touches[0];C(S.clientX,S.clientY,D.target)&&D.preventDefault()},[C]),E=AA.useCallback((D,S)=>{if(!l.current||!I.current)return;const _={x:D-I.current.x,y:S-I.current.y},b={x:_.x/c.a,y:_.y/c.d};let R={x:l.current.original_center.x+b.x,y:l.current.original_center.y+b.y};if(r){const H=Y=>Math.round(Y*10)/10;R={x:H(R.x),y:H(R.y)}}const F={...l.current,new_center:R};l.current=F,g(F)},[c,r]),u=AA.useCallback(D=>E(D.clientX,D.clientY),[E]),d=AA.useCallback(D=>{if(D.touches.length!==1||!l.current)return;D.preventDefault();const S=D.touches[0];E(S.clientX,S.clientY)},[E]),f=AA.useCallback(()=>{if(!l.current)return;const D={...l.current,in_progress:!1};B.current.set(D.schematic_component_id,{...D.new_center}),TVe("endDrag calling onEditEvent with new edit event",{newEditEvent:D}),e&&e(D),l.current=null,I.current=null,g(null)},[e]),m=AA.useCallback(()=>f(),[f]),w=AA.useCallback(()=>f(),[f]);return AA.useEffect(()=>(window.addEventListener("mousemove",u),window.addEventListener("mouseup",m),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("touchend",w),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",m),window.removeEventListener("touchmove",d),window.removeEventListener("touchend",w)}),[u,m,d,w]),{handleMouseDown:Q,handleTouchStart:h,isDragging:!!l.current,activeEditEvent:a}},sS={schematicEditIcon:50,schematicGridIcon:49,spiceSimulationIcon:50,viewMenuIcon:48,viewMenu:55,viewMenuBackdrop:54,clickToInteractOverlay:100,schematicComponentHoverOutline:47,schematicPortHoverOutline:48},KVe=({onClick:e,active:A})=>{const t=i=>{i.preventDefault(),e()};return Z.jsx("div",{onClick:t,onTouchEnd:t,title:A?"Disable edit mode":"Enable edit mode",style:{position:"absolute",top:"16px",right:"64px",backgroundColor:A?"#4CAF50":"#fff",color:A?"#fff":"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.schematicEditIcon},children:Z.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Z.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),Z.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})},qVe=({onClick:e,active:A})=>{const t=i=>{i.preventDefault(),e()};return Z.jsx("div",{onClick:t,onTouchEnd:t,title:A?"Hide grid":"Show grid",style:{position:"absolute",top:"56px",right:"64px",backgroundColor:A?"#4CAF50":"#fff",color:A?"#fff":"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.schematicGridIcon},children:Z.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Z.jsx("path",{d:"M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"})})})},OVe=({onClick:e,active:A})=>{const t=i=>{i.preventDefault(),e()};return Z.jsx("div",{onClick:t,onTouchEnd:t,title:A?"Hide view menu":"Show view menu",style:{position:"absolute",top:"16px",right:"16px",backgroundColor:A?"#4CAF50":"#fff",color:A?"#fff":"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.viewMenuIcon},children:Z.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Z.jsx("circle",{cx:"12",cy:"12",r:"1"}),Z.jsx("circle",{cx:"12",cy:"5",r:"1"}),Z.jsx("circle",{cx:"12",cy:"19",r:"1"})]})})},WVe={version:"2.0.57"},ZVe=({circuitJson:e,circuitJsonKey:A,isVisible:t,onClose:i,showGroups:n,onToggleGroups:o,showGrid:s,onToggleGrid:r})=>{const a=AA.useMemo(()=>{if(!e||e.length===0)return!1;try{if((qE(e).source_group?.list()||[]).length>0)return!0;const c=qE(e).schematic_component?.list()||[];if(c.length>1){const I=new Set;for(const l of c){const B=qE(e).source_component.get(l.source_component_id);B?.ftype&&I.add(B.ftype)}return I.size>1}return!1}catch(g){return console.error("Error checking for groups:",g),!1}},[A]);return t?Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{onClick:i,onTouchEnd:g=>{g.preventDefault(),i()},style:{position:"absolute",inset:0,backgroundColor:"transparent",zIndex:sS.viewMenuBackdrop}}),Z.jsxs("div",{style:{position:"absolute",top:"56px",right:"16px",backgroundColor:"#ffffff",color:"#000000",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",minWidth:"200px",zIndex:sS.viewMenu},children:[Z.jsxs("div",{onClick:()=>{a&&o(!n)},onTouchEnd:g=>{g.preventDefault(),a&&o(!n)},style:{padding:"8px 12px",cursor:a?"pointer":"not-allowed",opacity:a?1:.5,fontSize:"13px",color:"#000000",fontFamily:"sans-serif",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:g=>{a&&(g.currentTarget.style.backgroundColor="#f0f0f0")},onMouseLeave:g=>{a&&(g.currentTarget.style.backgroundColor="transparent")},children:[Z.jsx("div",{style:{width:"16px",height:"16px",border:"2px solid #000",borderRadius:"2px",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:"bold"},children:n&&"✓"}),"View Schematic Groups"]}),!a&&Z.jsx("div",{style:{padding:"8px 12px",fontSize:"11px",color:"#666",fontStyle:"italic"},children:"No groups found in this schematic"}),Z.jsxs("div",{onClick:()=>r(!s),onTouchEnd:g=>{g.preventDefault(),r(!s)},style:{padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#000000",fontFamily:"sans-serif",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#f0f0f0"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent"},children:[Z.jsx("div",{style:{width:"16px",height:"16px",border:"2px solid #000",borderRadius:"2px",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:"bold"},children:s&&"✓"}),"Show Grid"]}),Z.jsxs("div",{style:{padding:"4px 8px",fontSize:"12px",color:"#999",borderTop:"1px solid #eee",textAlign:"center"},children:["v",String(WVe?.version)]})]})]}):null},VVe=()=>Z.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Z.jsx("path",{d:"M3 12h2.5l2.5-9 4 18 4-9h5.5"})}),jVe=({onClick:e})=>Z.jsx("div",{onClick:e,title:"Run SPICE simulation",style:{position:"absolute",top:"16px",right:"112px",backgroundColor:"#fff",color:"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.spiceSimulationIcon},children:Z.jsx(VVe,{})});Aj.register(yVe,DVe,eVe,tVe,cVe,uVe,aVe);var nj=["#8884d8","#82ca9d","#ffc658","#ff7300","#387908"],mct=e=>{if(e===0)return"0s";const A=Math.abs(e);let t="s",i=1;return A<1e-12?(t="fs",i=1e15):A<1e-9?(t="ps",i=1e12):A<1e-6?(t="ns",i=1e9):A<.001?(t="us",i=1e6):A<1&&(t="ms",i=1e3),`${parseFloat((e*i).toPrecision(3))}${t}`},zVe=({plotData:e,nodes:A,isLoading:t,error:i,hasRun:n})=>{const o=AA.useMemo(()=>{const a=A.some(c=>c.toLowerCase().startsWith("v(")),g=A.some(c=>c.toLowerCase().startsWith("i("));return a&&g?"Value":a?"Voltage (V)":g?"Current (A)":"Value"},[A]);if(t)return Z.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:"Running simulation..."});if(!n)return Z.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:'Click "Run" to start the simulation.'});if(i)return Z.jsxs("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"red"},children:["Error: ",i]});if(e.length===0)return Z.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:"No data to plot. Check simulation output or SPICE netlist."});const s={datasets:A.map((a,g)=>({label:a,data:e.map(c=>({x:Number(c.name),y:c[a]})),borderColor:nj[g%nj.length],backgroundColor:nj[g%nj.length],fill:!1,tension:.1}))},r={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{font:{family:"sans-serif"}}},title:{display:!1},tooltip:{callbacks:{title:a=>{if(a.length>0){const g=a[0];return mct(g.parsed.x)}return""}}}},scales:{x:{type:"linear",title:{display:!0,text:"Time",font:{family:"sans-serif"}},ticks:{callback:a=>mct(a),font:{family:"sans-serif"}}},y:{title:{display:!0,text:o,font:{family:"sans-serif"}},ticks:{font:{family:"sans-serif"}}}}};return Z.jsx("div",{style:{position:"relative",height:"300px",width:"100%"},children:Z.jsx(GVe,{options:r,data:s})})},XVe=({spiceString:e,onClose:A,plotData:t,nodes:i,isLoading:n,error:o,simOptions:s,onSimOptionsChange:r,hasRun:a})=>{const[g,c]=AA.useState(String(s.startTime)),[I,l]=AA.useState(String(s.duration));AA.useEffect(()=>{c(String(s.startTime)),l(String(s.duration))},[s.startTime,s.duration]);const B=()=>{r({...s,startTime:Number(g),duration:Number(I)})},C=i.filter(Q=>{const h=Q.toLowerCase().startsWith("v("),E=Q.toLowerCase().startsWith("i(");return!!(s.showVoltage&&h||s.showCurrent&&E)});return Z.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1002,fontFamily:"sans-serif"},children:Z.jsxs("div",{style:{backgroundColor:"white",padding:"24px",borderRadius:"12px",width:"90%",maxWidth:"900px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)"},children:[Z.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",borderBottom:"1px solid #eee",paddingBottom:"16px"},children:[Z.jsx("h2",{style:{margin:0,fontSize:"22px",fontWeight:600,color:"#333"},children:"SPICE Simulation"}),Z.jsx("button",{onClick:A,style:{background:"none",border:"none",fontSize:"28px",cursor:"pointer",color:"#888",padding:0,lineHeight:1},children:"×"})]}),Z.jsx("div",{children:Z.jsx(zVe,{plotData:t,nodes:C,isLoading:n,error:o,hasRun:a})}),Z.jsxs("div",{style:{marginTop:"16px",padding:"12px",backgroundColor:"#f7f7f7",borderRadius:"6px",display:"flex",flexWrap:"wrap",gap:"24px",alignItems:"center",fontSize:"14px"},children:[Z.jsxs("div",{style:{display:"flex",gap:"16px"},children:[Z.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[Z.jsx("input",{type:"checkbox",checked:s.showVoltage,onChange:Q=>r({...s,showVoltage:Q.target.checked})}),"Voltage"]}),Z.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[Z.jsx("input",{type:"checkbox",checked:s.showCurrent,onChange:Q=>r({...s,showCurrent:Q.target.checked})}),"Current"]})]}),Z.jsxs("div",{style:{display:"flex",gap:"16px",alignItems:"center"},children:[Z.jsx("label",{htmlFor:"startTime",children:"Start Time (ms):"}),Z.jsx("input",{id:"startTime",type:"number",value:g,onChange:Q=>c(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),Z.jsx("label",{htmlFor:"duration",children:"Duration (ms):"}),Z.jsx("input",{id:"duration",type:"number",value:I,onChange:Q=>l(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),Z.jsx("button",{onClick:B,style:{padding:"4px 12px",borderRadius:"4px",border:"1px solid #ccc",backgroundColor:"#f0f0f0",cursor:"pointer"},children:a?"Rerun":"Run"})]})]}),Z.jsxs("div",{style:{marginTop:"24px"},children:[Z.jsx("h3",{style:{marginTop:0,marginBottom:"12px",fontSize:"18px",fontWeight:600,color:"#333"},children:"SPICE Netlist"}),Z.jsx("pre",{style:{backgroundColor:"#fafafa",padding:"16px",borderRadius:"6px",maxHeight:"150px",overflowY:"auto",border:"1px solid #eee",color:"#333",fontSize:"13px",fontFamily:"monospace"},children:e})]})]})})},$Ve="dmFyIGU9bnVsbCxzPWFzeW5jKCk9Pihhd2FpdCBpbXBvcnQoImh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vZWVjaXJjdWl0LWVuZ2luZUAxLjUuMi8rZXNtIikpLlNpbXVsYXRpb24sYz1hc3luYygpPT57aWYoZSYmZS5pc0luaXRpYWxpemVkKCkpcmV0dXJuO2xldCBpPWF3YWl0IHMoKTtlPW5ldyBpLGF3YWl0IGUuc3RhcnQoKX07c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+e3RyeXtpZihhd2FpdCBjKCksIWUpdGhyb3cgbmV3IEVycm9yKCJTaW11bGF0aW9uIG5vdCBpbml0aWFsaXplZCIpO2xldCB0PWkuZGF0YS5zcGljZVN0cmluZyxhPXQubWF0Y2goL3dyZGF0YVxzKyhcUyspXHMrKC4qKS9pKTtpZihhKXtsZXQgbz1gLnByb2JlICR7YVsyXS50cmltKCkuc3BsaXQoL1xzKy8pLmpvaW4oIiAiKX1gO3Q9dC5yZXBsYWNlKC93cmRhdGEuKi9pLG8pfWVsc2UgaWYoIXQubWF0Y2goL1wucHJvYmUvaSkpdGhyb3cgdC5tYXRjaCgvcGxvdFxzKyguKikvaSk/bmV3IEVycm9yKCJUaGUgJ3Bsb3QnIGNvbW1hbmQgaXMgbm90IHN1cHBvcnRlZCBmb3IgZGF0YSBleHRyYWN0aW9uLiBQbGVhc2UgdXNlICd3cmRhdGEgPGZpbGVuYW1lPiA8dmFyMT4gLi4uJyBvciAnLnByb2JlIDx2YXIxPiAuLi4nIGluc3RlYWQuIik6bmV3IEVycm9yKCJObyAnLnByb2JlJyBvciAnd3JkYXRhJyBjb21tYW5kIGZvdW5kIGluIFNQSUNFIGZpbGUuIFVzZSAnd3JkYXRhIDxmaWxlbmFtZT4gPHZhcjE+IC4uLicgdG8gc3BlY2lmeSBvdXRwdXQuIik7ZS5zZXROZXRMaXN0KHQpO2xldCBuPWF3YWl0IGUucnVuU2ltKCk7c2VsZi5wb3N0TWVzc2FnZSh7dHlwZToicmVzdWx0IixyZXN1bHQ6bn0pfWNhdGNoKHQpe3NlbGYucG9zdE1lc3NhZ2Uoe3R5cGU6ImVycm9yIixlcnJvcjp0Lm1lc3NhZ2V9KX19Owo=",oj=null,A9e=()=>{if(typeof window>"u")return null;if(oj)return oj;try{const e=new Blob([atob($Ve)],{type:"application/javascript"});return oj=URL.createObjectURL(e),oj}catch(e){return console.error("Failed to create blob URL for worker",e),null}},t9e=e=>{const A={};if(e.dataType==="real")e.data.forEach(r=>{A[r.name]=r.values});else if(e.dataType==="complex")e.data.forEach(r=>{A[r.name]=r.values.map(a=>a.real)});else throw new Error("Unsupported data type in simulation result");const t=Object.keys(A).find(r=>r.toLowerCase()==="time"||r.toLowerCase()==="frequency");if(!t)throw new Error("No time or frequency data in simulation result");const i=A[t],n=Object.keys(A).filter(r=>r!==t),o=n;return{plotData:i.map((r,a)=>{const g={name:r.toExponential(2)};return n.forEach(c=>{g[c]=A[c][a]}),g}),nodes:o}},e9e=e=>{const[A,t]=AA.useState([]),[i,n]=AA.useState([]),[o,s]=AA.useState(!0),[r,a]=AA.useState(null);return AA.useEffect(()=>{if(!e){s(!1),t([]),n([]),a(null);return}s(!0),a(null),t([]),n([]);const g=A9e();if(!g){a("Could not create SPICE simulation worker."),s(!1);return}const c=new Worker(g,{type:"module"});return c.onmessage=I=>{if(I.data.type==="result")try{const{plotData:l,nodes:B}=t9e(I.data.result);t(l),n(B)}catch(l){a(l.message||"Failed to parse simulation result"),console.error(l)}else I.data.type==="error"&&a(I.data.error);s(!1)},c.onerror=I=>{a(I.message),s(!1)},c.postMessage({spiceString:e}),()=>{c.terminate()}},[e]),{plotData:A,nodes:i,isLoading:o,error:r}},jfA=e=>{if(e===0)return"0";const A=Math.abs(e),t=i=>i.toPrecision(4);return A>=1?t(e):A>=.001?`${t(e*1e3)}m`:A>=1e-6?`${t(e*1e6)}u`:A>=1e-9?`${t(e*1e9)}n`:A>=1e-12?`${t(e*1e12)}p`:A>=1e-15?`${t(e*1e15)}f`:e.toExponential(3)},i9e=(e,A)=>{const i=A5A(e).toSpiceString(),o=i.split(`
5381
+ `,n.appendChild(u)}})}};o();const s=new MutationObserver(o);return s.observe(n,{childList:!0,subtree:!1,characterData:!1}),()=>{s.disconnect()}},[e,t,A,i])},fct=["#8B0000","#2F4F4F","#191970","#006400","#FF4500","#800080","#2E8B57","#B8860B","#C71585","#008B8B"],LVe=e=>{const{svgDivRef:A,circuitJson:t,circuitJsonKey:i,showGroups:n}=e;AA.useEffect(()=>{if(A.current&&A.current.querySelectorAll(".schematic-group-overlay").forEach(r=>r.remove()),!A.current||!n||!t||t.length===0)return;const o=setTimeout(()=>{if(!A.current)return;const s=A.current.querySelector("svg");if(!s)return;s.querySelectorAll(".schematic-group-overlay").forEach(a=>a.remove());try{const a=qE(t).source_group?.list().filter(u=>!u.is_subcircuit)||[],g=qE(t).schematic_component?.list()||[],c=new Map;a.forEach(u=>{const d=u;if(d.parent_source_group_id){const f=c.get(d.parent_source_group_id)||[];f.push(u.source_group_id),c.set(d.parent_source_group_id,f)}});const I=u=>{const d=[],f=c.get(u)||[];for(const m of f)d.push(m),d.push(...I(m));return d},l=u=>{const d=a.find(f=>f.source_group_id===u);return d?.parent_source_group_id?1+l(d.parent_source_group_id):0},B=a.length>0&&a.some(u=>u.name&&u.name.trim()!=="");let C=[];if(B){const u=new Map;for(const d of g){const f=qE(t).source_component.get(d.source_component_id);f?.source_group_id&&(u.has(f.source_group_id)||u.set(f.source_group_id,[]),u.get(f.source_group_id).push(d))}a.forEach((d,f)=>{let m=u.get(d.source_group_id)||[];const w=I(d.source_group_id);for(const D of w){const S=u.get(D)||[];m=[...m,...S]}if(m.length>0){const D=l(d.source_group_id),S=I(d.source_group_id).length>0;if(d.name?.startsWith("unnamed_board"))return;C.push({id:d.source_group_id,name:d.name||`Group ${f+1}`,components:m,color:fct[f%fct.length],depthLevel:D,hasChildren:S,sourceGroupId:d.source_group_id})}})}const Q=s.viewBox.baseVal,h=s.getBoundingClientRect(),E=Math.min(h.width/Q.width,h.height/Q.height)||1;C.sort((u,d)=>u.depthLevel-d.depthLevel),C.forEach(u=>{if(u.components.length===0)return;const d=UVe(u.components,s);if(!d)return;const f=Math.max(8,Math.min(25,15/Math.max(E,.3))),m=u.hasChildren?f*.6:0,w=f+m,D=Math.max(1,2/Math.max(E,.5)),S=u.depthLevel===0?D:D*.7,_=Math.max(4,8/Math.max(E,.5)),b=u.hasChildren?1.3:1,R=_*b,F=R*.5,H=document.createElementNS("http://www.w3.org/2000/svg","rect");H.setAttribute("class","schematic-group-overlay"),H.setAttribute("x",(d.minX-w).toString()),H.setAttribute("y",(d.minY-w).toString()),H.setAttribute("width",(d.maxX-d.minX+w*2).toString()),H.setAttribute("height",(d.maxY-d.minY+w*2).toString()),H.setAttribute("fill","none"),H.setAttribute("stroke",u.color),H.setAttribute("stroke-width",S.toString()),H.setAttribute("stroke-dasharray",`${R},${F}`),H.setAttribute("opacity","0.8"),H.setAttribute("rx","0"),H.setAttribute("ry","0");const Y=Math.max(6,Math.min(20,14/Math.max(E,.2))),J=u.depthLevel===0||u.depthLevel===1?0:u.depthLevel*.2,O=Y*(1-J),W=Math.max(1,O*.2),z=u.name,tA=document.createElementNS("http://www.w3.org/2000/svg","text");tA.setAttribute("font-size",O.toString()),tA.setAttribute("font-family","Arial, sans-serif"),tA.textContent=z,s.appendChild(tA);const aA=tA.getBBox();s.removeChild(tA);const eA=aA.width+W*2,oA=O+W*2,rA=d.minX-w,lA=d.minY-w-oA,pA=document.createElementNS("http://www.w3.org/2000/svg","rect");pA.setAttribute("class","schematic-group-overlay"),pA.setAttribute("x",rA.toString()),pA.setAttribute("y",(lA-oA).toString()),pA.setAttribute("width",eA.toString()),pA.setAttribute("height",oA.toString()),pA.setAttribute("fill","transparent"),pA.setAttribute("rx","0"),pA.setAttribute("ry","0");const vA=document.createElementNS("http://www.w3.org/2000/svg","text");vA.setAttribute("class","schematic-group-overlay"),vA.setAttribute("x",(rA+W).toString()),vA.setAttribute("y",(lA+oA-W).toString()),vA.setAttribute("fill",u.color),vA.setAttribute("font-size",O.toString()),vA.setAttribute("font-family","Arial, sans-serif"),vA.setAttribute("font-weight",u.depthLevel===0?"600":"500"),vA.setAttribute("stroke",u.color),vA.setAttribute("stroke-width",Math.max(.2,O*.02).toString()),vA.textContent=z,s.appendChild(H),s.appendChild(pA),s.appendChild(vA)})}catch(a){console.error("Error creating group overlays:",a)}},10);return()=>clearTimeout(o)},[A,i,n])};function UVe(e,A){let t=1/0,i=1/0,n=-1/0,o=-1/0;for(const r of e){let a=A.querySelector(`g[data-schematic-component-id="${r.schematic_component_id}"]`);if(a||(a=A.querySelector(`[data-schematic-component-id="${r.schematic_component_id}"]`)),a){const g=a.getBBox();t=Math.min(t,g.x),i=Math.min(i,g.y),n=Math.max(n,g.x+g.width),o=Math.max(o,g.y+g.height)}}return t===1/0?null:{minX:t,minY:i,maxX:n,maxY:o}}var HVe=Dc("schematic-viewer"),YVe=()=>{Dc.enable("schematic-viewer*")},JVe=HVe,yct=e=>{const[A,t]=AA.useState(0),[i,n]=AA.useState(0);return AA.useEffect(()=>{if(!e.current)return;const o=()=>{const r=e.current?.getBoundingClientRect();t(r?.width||0),n(r?.height||0)};o();const s=new ResizeObserver(o);return s.observe(e.current),window.addEventListener("resize",o),()=>{s.disconnect(),window.removeEventListener("resize",o)}},[]),{containerWidth:A,containerHeight:i}},TVe=JVe.extend("useComponentDragging"),PVe=({onEditEvent:e,editEvents:A=[],circuitJson:t,cancelDrag:i,svgToScreenProjection:n,realToSvgProjection:o,enabled:s=!1,snapToGrid:r=!1})=>{const[a,g]=AA.useState(null),c=tn(o,n),I=AA.useRef(null),l=AA.useRef(null),B=AA.useRef(new Map);AA.useEffect(()=>{A.forEach(D=>{"edit_event_type"in D&&D.edit_event_type==="edit_schematic_component_location"&&!D.in_progress&&B.current.set(D.schematic_component_id,{...D.new_center})})},[A]);const C=AA.useCallback((D,S,_)=>{if(!s)return!1;const b=_.closest('[data-circuit-json-type="schematic_component"]');if(!b)return!1;const R=b.getAttribute("data-schematic-component-id");if(!R)return!1;i&&i();const F=qE(t).schematic_component.get(R);if(!F)return!1;I.current={x:D,y:S};let H;const Y=B.current.get(R);if(Y)H={...Y};else{const O=pct({editEvents:A,schematic_component_id:R});H={x:F.center.x+O.x,y:F.center.y+O.y},B.current.set(R,{...H})}const J={edit_event_id:Math.random().toString(36).substr(2,9),edit_event_type:"edit_schematic_component_location",schematic_component_id:R,original_center:H,new_center:{...H},in_progress:!0,created_at:Date.now(),_element:b};return l.current=J,g(J),!0},[i,s,t,A]),Q=AA.useCallback(D=>{C(D.clientX,D.clientY,D.target)},[C]),h=AA.useCallback(D=>{if(D.touches.length!==1)return;const S=D.touches[0];C(S.clientX,S.clientY,D.target)&&D.preventDefault()},[C]),E=AA.useCallback((D,S)=>{if(!l.current||!I.current)return;const _={x:D-I.current.x,y:S-I.current.y},b={x:_.x/c.a,y:_.y/c.d};let R={x:l.current.original_center.x+b.x,y:l.current.original_center.y+b.y};if(r){const H=Y=>Math.round(Y*10)/10;R={x:H(R.x),y:H(R.y)}}const F={...l.current,new_center:R};l.current=F,g(F)},[c,r]),u=AA.useCallback(D=>E(D.clientX,D.clientY),[E]),d=AA.useCallback(D=>{if(D.touches.length!==1||!l.current)return;D.preventDefault();const S=D.touches[0];E(S.clientX,S.clientY)},[E]),f=AA.useCallback(()=>{if(!l.current)return;const D={...l.current,in_progress:!1};B.current.set(D.schematic_component_id,{...D.new_center}),TVe("endDrag calling onEditEvent with new edit event",{newEditEvent:D}),e&&e(D),l.current=null,I.current=null,g(null)},[e]),m=AA.useCallback(()=>f(),[f]),w=AA.useCallback(()=>f(),[f]);return AA.useEffect(()=>(window.addEventListener("mousemove",u),window.addEventListener("mouseup",m),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("touchend",w),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",m),window.removeEventListener("touchmove",d),window.removeEventListener("touchend",w)}),[u,m,d,w]),{handleMouseDown:Q,handleTouchStart:h,isDragging:!!l.current,activeEditEvent:a}},sS={schematicEditIcon:50,schematicGridIcon:49,spiceSimulationIcon:50,viewMenuIcon:48,viewMenu:55,viewMenuBackdrop:54,clickToInteractOverlay:100,schematicComponentHoverOutline:47,schematicPortHoverOutline:48},KVe=({onClick:e,active:A})=>{const t=i=>{i.preventDefault(),e()};return Z.jsx("div",{onClick:t,onTouchEnd:t,title:A?"Disable edit mode":"Enable edit mode",style:{position:"absolute",top:"16px",right:"64px",backgroundColor:A?"#4CAF50":"#fff",color:A?"#fff":"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.schematicEditIcon},children:Z.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Z.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),Z.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})},qVe=({onClick:e,active:A})=>{const t=i=>{i.preventDefault(),e()};return Z.jsx("div",{onClick:t,onTouchEnd:t,title:A?"Hide grid":"Show grid",style:{position:"absolute",top:"56px",right:"64px",backgroundColor:A?"#4CAF50":"#fff",color:A?"#fff":"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.schematicGridIcon},children:Z.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Z.jsx("path",{d:"M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"})})})},OVe=({onClick:e,active:A})=>{const t=i=>{i.preventDefault(),e()};return Z.jsx("div",{onClick:t,onTouchEnd:t,title:A?"Hide view menu":"Show view menu",style:{position:"absolute",top:"16px",right:"16px",backgroundColor:A?"#4CAF50":"#fff",color:A?"#fff":"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.viewMenuIcon},children:Z.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Z.jsx("circle",{cx:"12",cy:"12",r:"1"}),Z.jsx("circle",{cx:"12",cy:"5",r:"1"}),Z.jsx("circle",{cx:"12",cy:"19",r:"1"})]})})},WVe={version:"2.0.58"},ZVe=({circuitJson:e,circuitJsonKey:A,isVisible:t,onClose:i,showGroups:n,onToggleGroups:o,showGrid:s,onToggleGrid:r})=>{const a=AA.useMemo(()=>{if(!e||e.length===0)return!1;try{if((qE(e).source_group?.list()||[]).length>0)return!0;const c=qE(e).schematic_component?.list()||[];if(c.length>1){const I=new Set;for(const l of c){const B=qE(e).source_component.get(l.source_component_id);B?.ftype&&I.add(B.ftype)}return I.size>1}return!1}catch(g){return console.error("Error checking for groups:",g),!1}},[A]);return t?Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{onClick:i,onTouchEnd:g=>{g.preventDefault(),i()},style:{position:"absolute",inset:0,backgroundColor:"transparent",zIndex:sS.viewMenuBackdrop}}),Z.jsxs("div",{style:{position:"absolute",top:"56px",right:"16px",backgroundColor:"#ffffff",color:"#000000",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",minWidth:"200px",zIndex:sS.viewMenu},children:[Z.jsxs("div",{onClick:()=>{a&&o(!n)},onTouchEnd:g=>{g.preventDefault(),a&&o(!n)},style:{padding:"8px 12px",cursor:a?"pointer":"not-allowed",opacity:a?1:.5,fontSize:"13px",color:"#000000",fontFamily:"sans-serif",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:g=>{a&&(g.currentTarget.style.backgroundColor="#f0f0f0")},onMouseLeave:g=>{a&&(g.currentTarget.style.backgroundColor="transparent")},children:[Z.jsx("div",{style:{width:"16px",height:"16px",border:"2px solid #000",borderRadius:"2px",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:"bold"},children:n&&"✓"}),"View Schematic Groups"]}),!a&&Z.jsx("div",{style:{padding:"8px 12px",fontSize:"11px",color:"#666",fontStyle:"italic"},children:"No groups found in this schematic"}),Z.jsxs("div",{onClick:()=>r(!s),onTouchEnd:g=>{g.preventDefault(),r(!s)},style:{padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#000000",fontFamily:"sans-serif",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#f0f0f0"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent"},children:[Z.jsx("div",{style:{width:"16px",height:"16px",border:"2px solid #000",borderRadius:"2px",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:"bold"},children:s&&"✓"}),"Show Grid"]}),Z.jsxs("div",{style:{padding:"4px 8px",fontSize:"12px",color:"#999",borderTop:"1px solid #eee",textAlign:"center"},children:["v",String(WVe?.version)]})]})]}):null},VVe=()=>Z.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Z.jsx("path",{d:"M3 12h2.5l2.5-9 4 18 4-9h5.5"})}),jVe=({onClick:e})=>Z.jsx("div",{onClick:e,title:"Run SPICE simulation",style:{position:"absolute",top:"16px",right:"112px",backgroundColor:"#fff",color:"#000",padding:"8px",borderRadius:"4px",cursor:"pointer",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",gap:"4px",zIndex:sS.spiceSimulationIcon},children:Z.jsx(VVe,{})});Aj.register(yVe,DVe,eVe,tVe,cVe,uVe,aVe);var nj=["#8884d8","#82ca9d","#ffc658","#ff7300","#387908"],mct=e=>{if(e===0)return"0s";const A=Math.abs(e);let t="s",i=1;return A<1e-12?(t="fs",i=1e15):A<1e-9?(t="ps",i=1e12):A<1e-6?(t="ns",i=1e9):A<.001?(t="us",i=1e6):A<1&&(t="ms",i=1e3),`${parseFloat((e*i).toPrecision(3))}${t}`},zVe=({plotData:e,nodes:A,isLoading:t,error:i,hasRun:n})=>{const o=AA.useMemo(()=>{const a=A.some(c=>c.toLowerCase().startsWith("v(")),g=A.some(c=>c.toLowerCase().startsWith("i("));return a&&g?"Value":a?"Voltage (V)":g?"Current (A)":"Value"},[A]);if(t)return Z.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:"Running simulation..."});if(!n)return Z.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:'Click "Run" to start the simulation.'});if(i)return Z.jsxs("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"red"},children:["Error: ",i]});if(e.length===0)return Z.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:"No data to plot. Check simulation output or SPICE netlist."});const s={datasets:A.map((a,g)=>({label:a,data:e.map(c=>({x:Number(c.name),y:c[a]})),borderColor:nj[g%nj.length],backgroundColor:nj[g%nj.length],fill:!1,tension:.1}))},r={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{font:{family:"sans-serif"}}},title:{display:!1},tooltip:{callbacks:{title:a=>{if(a.length>0){const g=a[0];return mct(g.parsed.x)}return""}}}},scales:{x:{type:"linear",title:{display:!0,text:"Time",font:{family:"sans-serif"}},ticks:{callback:a=>mct(a),font:{family:"sans-serif"}}},y:{title:{display:!0,text:o,font:{family:"sans-serif"}},ticks:{font:{family:"sans-serif"}}}}};return Z.jsx("div",{style:{position:"relative",height:"300px",width:"100%"},children:Z.jsx(GVe,{options:r,data:s})})},XVe=({spiceString:e,onClose:A,plotData:t,nodes:i,isLoading:n,error:o,simOptions:s,onSimOptionsChange:r,hasRun:a})=>{const[g,c]=AA.useState(String(s.startTime)),[I,l]=AA.useState(String(s.duration));AA.useEffect(()=>{c(String(s.startTime)),l(String(s.duration))},[s.startTime,s.duration]);const B=()=>{r({...s,startTime:Number(g),duration:Number(I)})},C=i.filter(Q=>{const h=Q.toLowerCase().startsWith("v("),E=Q.toLowerCase().startsWith("i(");return!!(s.showVoltage&&h||s.showCurrent&&E)});return Z.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1002,fontFamily:"sans-serif"},children:Z.jsxs("div",{style:{backgroundColor:"white",padding:"24px",borderRadius:"12px",width:"90%",maxWidth:"900px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)"},children:[Z.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",borderBottom:"1px solid #eee",paddingBottom:"16px"},children:[Z.jsx("h2",{style:{margin:0,fontSize:"22px",fontWeight:600,color:"#333"},children:"SPICE Simulation"}),Z.jsx("button",{onClick:A,style:{background:"none",border:"none",fontSize:"28px",cursor:"pointer",color:"#888",padding:0,lineHeight:1},children:"×"})]}),Z.jsx("div",{children:Z.jsx(zVe,{plotData:t,nodes:C,isLoading:n,error:o,hasRun:a})}),Z.jsxs("div",{style:{marginTop:"16px",padding:"12px",backgroundColor:"#f7f7f7",borderRadius:"6px",display:"flex",flexWrap:"wrap",gap:"24px",alignItems:"center",fontSize:"14px"},children:[Z.jsxs("div",{style:{display:"flex",gap:"16px"},children:[Z.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[Z.jsx("input",{type:"checkbox",checked:s.showVoltage,onChange:Q=>r({...s,showVoltage:Q.target.checked})}),"Voltage"]}),Z.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[Z.jsx("input",{type:"checkbox",checked:s.showCurrent,onChange:Q=>r({...s,showCurrent:Q.target.checked})}),"Current"]})]}),Z.jsxs("div",{style:{display:"flex",gap:"16px",alignItems:"center"},children:[Z.jsx("label",{htmlFor:"startTime",children:"Start Time (ms):"}),Z.jsx("input",{id:"startTime",type:"number",value:g,onChange:Q=>c(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),Z.jsx("label",{htmlFor:"duration",children:"Duration (ms):"}),Z.jsx("input",{id:"duration",type:"number",value:I,onChange:Q=>l(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),Z.jsx("button",{onClick:B,style:{padding:"4px 12px",borderRadius:"4px",border:"1px solid #ccc",backgroundColor:"#f0f0f0",cursor:"pointer"},children:a?"Rerun":"Run"})]})]}),Z.jsxs("div",{style:{marginTop:"24px"},children:[Z.jsx("h3",{style:{marginTop:0,marginBottom:"12px",fontSize:"18px",fontWeight:600,color:"#333"},children:"SPICE Netlist"}),Z.jsx("pre",{style:{backgroundColor:"#fafafa",padding:"16px",borderRadius:"6px",maxHeight:"150px",overflowY:"auto",border:"1px solid #eee",color:"#333",fontSize:"13px",fontFamily:"monospace"},children:e})]})]})})},$Ve="dmFyIGU9bnVsbCxzPWFzeW5jKCk9Pihhd2FpdCBpbXBvcnQoImh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vZWVjaXJjdWl0LWVuZ2luZUAxLjUuMi8rZXNtIikpLlNpbXVsYXRpb24sYz1hc3luYygpPT57aWYoZSYmZS5pc0luaXRpYWxpemVkKCkpcmV0dXJuO2xldCBpPWF3YWl0IHMoKTtlPW5ldyBpLGF3YWl0IGUuc3RhcnQoKX07c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+e3RyeXtpZihhd2FpdCBjKCksIWUpdGhyb3cgbmV3IEVycm9yKCJTaW11bGF0aW9uIG5vdCBpbml0aWFsaXplZCIpO2xldCB0PWkuZGF0YS5zcGljZVN0cmluZyxhPXQubWF0Y2goL3dyZGF0YVxzKyhcUyspXHMrKC4qKS9pKTtpZihhKXtsZXQgbz1gLnByb2JlICR7YVsyXS50cmltKCkuc3BsaXQoL1xzKy8pLmpvaW4oIiAiKX1gO3Q9dC5yZXBsYWNlKC93cmRhdGEuKi9pLG8pfWVsc2UgaWYoIXQubWF0Y2goL1wucHJvYmUvaSkpdGhyb3cgdC5tYXRjaCgvcGxvdFxzKyguKikvaSk/bmV3IEVycm9yKCJUaGUgJ3Bsb3QnIGNvbW1hbmQgaXMgbm90IHN1cHBvcnRlZCBmb3IgZGF0YSBleHRyYWN0aW9uLiBQbGVhc2UgdXNlICd3cmRhdGEgPGZpbGVuYW1lPiA8dmFyMT4gLi4uJyBvciAnLnByb2JlIDx2YXIxPiAuLi4nIGluc3RlYWQuIik6bmV3IEVycm9yKCJObyAnLnByb2JlJyBvciAnd3JkYXRhJyBjb21tYW5kIGZvdW5kIGluIFNQSUNFIGZpbGUuIFVzZSAnd3JkYXRhIDxmaWxlbmFtZT4gPHZhcjE+IC4uLicgdG8gc3BlY2lmeSBvdXRwdXQuIik7ZS5zZXROZXRMaXN0KHQpO2xldCBuPWF3YWl0IGUucnVuU2ltKCk7c2VsZi5wb3N0TWVzc2FnZSh7dHlwZToicmVzdWx0IixyZXN1bHQ6bn0pfWNhdGNoKHQpe3NlbGYucG9zdE1lc3NhZ2Uoe3R5cGU6ImVycm9yIixlcnJvcjp0Lm1lc3NhZ2V9KX19Owo=",oj=null,A9e=()=>{if(typeof window>"u")return null;if(oj)return oj;try{const e=new Blob([atob($Ve)],{type:"application/javascript"});return oj=URL.createObjectURL(e),oj}catch(e){return console.error("Failed to create blob URL for worker",e),null}},t9e=e=>{const A={};if(e.dataType==="real")e.data.forEach(r=>{A[r.name]=r.values});else if(e.dataType==="complex")e.data.forEach(r=>{A[r.name]=r.values.map(a=>a.real)});else throw new Error("Unsupported data type in simulation result");const t=Object.keys(A).find(r=>r.toLowerCase()==="time"||r.toLowerCase()==="frequency");if(!t)throw new Error("No time or frequency data in simulation result");const i=A[t],n=Object.keys(A).filter(r=>r!==t),o=n;return{plotData:i.map((r,a)=>{const g={name:r.toExponential(2)};return n.forEach(c=>{g[c]=A[c][a]}),g}),nodes:o}},e9e=e=>{const[A,t]=AA.useState([]),[i,n]=AA.useState([]),[o,s]=AA.useState(!0),[r,a]=AA.useState(null);return AA.useEffect(()=>{if(!e){s(!1),t([]),n([]),a(null);return}s(!0),a(null),t([]),n([]);const g=A9e();if(!g){a("Could not create SPICE simulation worker."),s(!1);return}const c=new Worker(g,{type:"module"});return c.onmessage=I=>{if(I.data.type==="result")try{const{plotData:l,nodes:B}=t9e(I.data.result);t(l),n(B)}catch(l){a(l.message||"Failed to parse simulation result"),console.error(l)}else I.data.type==="error"&&a(I.data.error);s(!1)},c.onerror=I=>{a(I.message),s(!1)},c.postMessage({spiceString:e}),()=>{c.terminate()}},[e]),{plotData:A,nodes:i,isLoading:o,error:r}},jfA=e=>{if(e===0)return"0";const A=Math.abs(e),t=i=>i.toPrecision(4);return A>=1?t(e):A>=.001?`${t(e*1e3)}m`:A>=1e-6?`${t(e*1e6)}u`:A>=1e-9?`${t(e*1e9)}n`:A>=1e-12?`${t(e*1e12)}p`:A>=1e-15?`${t(e*1e15)}f`:e.toExponential(3)},i9e=(e,A)=>{const i=A5A(e).toSpiceString(),o=i.split(`
5382
5382
  `).filter(b=>b.trim()!=="").filter(b=>!b.startsWith("*")&&!b.startsWith(".")&&b.trim()!==""),s=new Set,r=new Set,a=new Set;for(const b of o){const R=b.trim().split(/\s+/);if(R.length<3)continue;const F=R[0],H=F[0].toUpperCase();let Y=[];if(["R","C","L","V","I","D"].includes(H))Y=R.slice(1,3),H==="V"&&a.add(F);else if(H==="Q"&&R.length>=4)Y=R.slice(1,4);else if(H==="M"&&R.length>=5)Y=R.slice(1,5);else if(H==="X")Y=R.slice(1,-1);else continue;Y.forEach(J=>s.add(J)),H==="C"&&Y.forEach(J=>r.add(J))}s.delete("0"),r.delete("0");const g=Array.from(r).map(b=>`.ic V(${b})=0`),c=[],I=Array.from(s).map(b=>`V(${b})`);c.push(...I);const l=Array.from(a).map(b=>`I(${b})`);c.push(...l);const B=c.length>0?`.probe ${c.join(" ")}`:"",C=A?.startTime??0,Q=A?.duration??20,h=C*.001,E=Q*.001,u=h+E,d=E/50,f=`.tran ${jfA(d)} ${jfA(u)} ${jfA(h)} UIC`,m=".end",w=i.split(`
5383
5383
  `);let D=-1;for(let b=w.length-1;b>=0;b--)if(w[b].trim().toLowerCase().startsWith(m)){D=b;break}const S=[...g,B,f].filter(Boolean);let _;if(D!==-1){const b=w.slice(0,D),R=w.slice(D);_=[...b,...S,...R]}else _=[...w,...S,m];return _.join(`
5384
5384
  `)},n9e=(e,A)=>{if(typeof window>"u")return A;try{const t=localStorage.getItem(e);return t!==null?JSON.parse(t):A}catch{return A}},o9e=(e,A)=>{if(!(typeof window>"u"))try{localStorage.setItem(e,JSON.stringify(A))}catch{}},zfA=AA.createContext(null),s9e=5,r9e=(e,A)=>!e&&!A?!0:!e||!A?!1:e.minX===A.minX&&e.maxX===A.maxX&&e.minY===A.minY&&e.maxY===A.maxY,a9e=({children:e})=>{if(AA.useContext(zfA))return Z.jsx(Z.Fragment,{children:e});const t=AA.useRef({pointer:null,boundingBoxes:new Map,hoveringIds:new Set,subscribers:new Set,mouseDownPosition:null}),i=AA.useCallback(()=>{for(const I of t.current.subscribers)I()},[]),n=AA.useCallback(()=>{const I=t.current.pointer,l=new Set;if(I)for(const[C,Q]of t.current.boundingBoxes){const h=Q.bounds;h&&I.x>=h.minX&&I.x<=h.maxX&&I.y>=h.minY&&I.y<=h.maxY&&l.add(C)}const B=t.current.hoveringIds;l.size===B.size&&[...l].every(C=>B.has(C))||(t.current.hoveringIds=l,i())},[i]),o=AA.useCallback((I,l)=>{t.current.boundingBoxes.set(I,l),n()},[n]),s=AA.useCallback((I,l)=>{const B=t.current.boundingBoxes.get(I);B&&r9e(B.bounds,l.bounds)&&B.onClick===l.onClick||(t.current.boundingBoxes.set(I,l),n())},[n]),r=AA.useCallback(I=>{t.current.boundingBoxes.delete(I)&&n()},[n]),a=AA.useCallback(I=>(t.current.subscribers.add(I),()=>{t.current.subscribers.delete(I)}),[]),g=AA.useCallback(I=>t.current.hoveringIds.has(I),[]);AA.useEffect(()=>{const I=Q=>{const{clientX:h,clientY:E}=Q,u=t.current.pointer;u&&u.x===h&&u.y===E||(t.current.pointer={x:h,y:E},n())},l=()=>{t.current.pointer!==null&&(t.current.pointer=null,t.current.mouseDownPosition=null,n())},B=Q=>{t.current.mouseDownPosition={x:Q.clientX,y:Q.clientY}},C=Q=>{const{clientX:h,clientY:E}=Q,u=t.current.mouseDownPosition;if(u&&Math.sqrt(Math.pow(h-u.x,2)+Math.pow(E-u.y,2))>s9e){t.current.mouseDownPosition=null;return}t.current.mouseDownPosition=null;for(const d of t.current.boundingBoxes.values()){const f=d.bounds;f&&h>=f.minX&&h<=f.maxX&&E>=f.minY&&E<=f.maxY&&d.onClick?.(Q)}};return window.addEventListener("pointermove",I,{passive:!0}),window.addEventListener("pointerdown",I,{passive:!0}),window.addEventListener("pointerup",I,{passive:!0}),window.addEventListener("pointerleave",l),window.addEventListener("pointercancel",l),window.addEventListener("blur",l),window.addEventListener("mousedown",B,{passive:!0}),window.addEventListener("click",C,{passive:!0}),()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerdown",I),window.removeEventListener("pointerup",I),window.removeEventListener("pointerleave",l),window.removeEventListener("pointercancel",l),window.removeEventListener("blur",l),window.removeEventListener("mousedown",B),window.removeEventListener("click",C)}},[n]);const c=AA.useMemo(()=>({registerBoundingBox:o,updateBoundingBox:s,unregisterBoundingBox:r,subscribe:a,isHovering:g}),[o,s,r,a,g]);return Z.jsx(zfA.Provider,{value:c,children:e})},wct=e=>{const A=AA.useContext(zfA);if(!A)throw new Error("useMouseEventsOverBoundingBox must be used within a MouseTracker");const t=AA.useId(),i=AA.useRef(e);i.current=e;const n=AA.useMemo(()=>s=>{i.current.onClick?.(s)},[]);return AA.useEffect(()=>(A.registerBoundingBox(t,{bounds:i.current.bounds,onClick:i.current.onClick?n:void 0}),()=>{A.unregisterBoundingBox(t)}),[A,n,t]),AA.useEffect(()=>{A.updateBoundingBox(t,{bounds:i.current.bounds,onClick:i.current.onClick?n:void 0})},[A,n,t,e.bounds?.minX,e.bounds?.maxX,e.bounds?.minY,e.bounds?.maxY,e.onClick]),{hovering:AA.useSyncExternalStore(A.subscribe,()=>A.isHovering(t),()=>!1)}},g9e=(e,A)=>!e&&!A?!0:!e||!A?!1:Math.abs(e.bounds.minX-A.bounds.minX)<.5&&Math.abs(e.bounds.maxX-A.bounds.maxX)<.5&&Math.abs(e.bounds.minY-A.bounds.minY)<.5&&Math.abs(e.bounds.maxY-A.bounds.maxY)<.5&&Math.abs(e.rect.left-A.rect.left)<.5&&Math.abs(e.rect.top-A.rect.top)<.5&&Math.abs(e.rect.width-A.rect.width)<.5&&Math.abs(e.rect.height-A.rect.height)<.5,c9e=({componentId:e,svgDivRef:A,containerRef:t,onComponentClick:i,onHoverChange:n,showOutline:o,circuitJsonKey:s})=>{const[r,a]=AA.useState(null),g=AA.useRef(null),c=AA.useCallback(()=>{g.current=null;const h=A.current,E=t.current;if(!h||!E){a(w=>w&&null);return}const u=h.querySelector(`[data-schematic-component-id="${e}"]`);if(!u){a(w=>w&&null);return}const d=u.getBoundingClientRect(),f=E.getBoundingClientRect(),m={bounds:{minX:d.left,maxX:d.right,minY:d.top,maxY:d.bottom},rect:{left:d.left-f.left,top:d.top-f.top,width:d.width,height:d.height}};a(w=>g9e(w,m)?w:m)},[e,t,A]),I=AA.useCallback(()=>{g.current===null&&(g.current=window.requestAnimationFrame(c))},[c]);AA.useEffect(()=>{I()},[I,s]),AA.useEffect(()=>{I();const h=A.current,E=t.current;if(!h||!E)return;const u=typeof ResizeObserver<"u"?new ResizeObserver(()=>{I()}):null;u?.observe(E),u?.observe(h);const d=typeof MutationObserver<"u"?new MutationObserver(()=>{I()}):null;return d?.observe(h,{attributes:!0,attributeFilter:["style","transform"],subtree:!0,childList:!0}),window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{u?.disconnect(),d?.disconnect(),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I),g.current!==null&&(cancelAnimationFrame(g.current),g.current=null)}},[I,A,t]);const l=AA.useCallback(h=>{i&&i(e,h)},[e,i]),B=r?.bounds??null,{hovering:C}=wct({bounds:B,onClick:i?l:void 0});if(AA.useEffect(()=>{n&&n(e,C)},[C,e,n]),!r||!C||!o)return null;const Q=r.rect;return Z.jsx("div",{style:{position:"absolute",left:Q.left,top:Q.top,width:Q.width,height:Q.height,border:"1.5px solid rgba(51, 153, 255, 0.9)",pointerEvents:"none",zIndex:sS.schematicComponentHoverOutline}})},I9e=(e,A)=>!e&&!A?!0:!e||!A?!1:Math.abs(e.bounds.minX-A.bounds.minX)<.5&&Math.abs(e.bounds.maxX-A.bounds.maxX)<.5&&Math.abs(e.bounds.minY-A.bounds.minY)<.5&&Math.abs(e.bounds.maxY-A.bounds.maxY)<.5&&Math.abs(e.rect.left-A.rect.left)<.5&&Math.abs(e.rect.top-A.rect.top)<.5&&Math.abs(e.rect.width-A.rect.width)<.5&&Math.abs(e.rect.height-A.rect.height)<.5,l9e=({portId:e,portLabel:A,svgDivRef:t,containerRef:i,onPortClick:n,onHoverChange:o,showOutline:s,circuitJsonKey:r})=>{const[a,g]=AA.useState(null),c=AA.useRef(null),I=AA.useCallback(()=>{c.current=null;const E=t.current,u=i.current;if(!E||!u){g(S=>S&&null);return}const d=E.querySelector(`[data-schematic-port-id="${e}"]`);if(!d){g(S=>S&&null);return}const f=d.getBoundingClientRect(),m=u.getBoundingClientRect(),w=4,D={bounds:{minX:f.left-w,maxX:f.right+w,minY:f.top-w,maxY:f.bottom+w},rect:{left:f.left-m.left-w,top:f.top-m.top-w,width:f.width+w*2,height:f.height+w*2}};g(S=>I9e(S,D)?S:D)},[e,i,t]),l=AA.useCallback(()=>{c.current===null&&(c.current=window.requestAnimationFrame(I))},[I]);AA.useEffect(()=>{l()},[l,r]),AA.useEffect(()=>{l();const E=t.current,u=i.current;if(!E||!u)return;const d=typeof ResizeObserver<"u"?new ResizeObserver(()=>{l()}):null;d?.observe(u),d?.observe(E);const f=typeof MutationObserver<"u"?new MutationObserver(()=>{l()}):null;return f?.observe(E,{attributes:!0,attributeFilter:["style","transform"],subtree:!0,childList:!0}),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{d?.disconnect(),f?.disconnect(),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l),c.current!==null&&(cancelAnimationFrame(c.current),c.current=null)}},[l,t,i]);const B=AA.useCallback(E=>{n&&n(e,E)},[e,n]),C=a?.bounds??null,{hovering:Q}=wct({bounds:C,onClick:n?B:void 0});if(AA.useEffect(()=>{o&&o(e,Q)},[Q,e,o]),!a||!s)return null;const h=a.rect;return Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{style:{position:"absolute",left:h.left,top:h.top,width:h.width,height:h.height,border:Q?"1.5px solid rgba(255, 153, 51, 0.9)":"1.5px solid rgba(255, 153, 51, 0.3)",backgroundColor:Q?"rgba(255, 153, 51, 0.15)":"rgba(255, 153, 51, 0.05)",borderRadius:"50%",pointerEvents:"none",zIndex:sS.schematicPortHoverOutline,transition:"border-color 0.15s, background-color 0.15s"}}),Q&&A&&Z.jsx("div",{style:{position:"absolute",left:h.left+h.width/2,top:h.top-24,transform:"translateX(-50%)",backgroundColor:"rgba(0, 0, 0, 0.85)",color:"white",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"nowrap",pointerEvents:"none",zIndex:sS.schematicPortHoverOutline+1},children:A})]})},B9e=({circuitJson:e,containerStyle:A,editEvents:t=[],onEditEvent:i,defaultEditMode:n=!1,debugGrid:o=!1,editingEnabled:s=!1,debug:r=!1,clickToInteractEnabled:a=!1,colorOverrides:g,spiceSimulationEnabled:c=!1,disableGroups:I=!1,onSchematicComponentClicked:l,showSchematicPorts:B=!1,onSchematicPortClicked:C})=>{r&&YVe();const[Q,h]=AA.useState(!1),[E,u]=AA.useState({showVoltage:!0,showCurrent:!1,startTime:0,duration:20}),d=QA=>`${QA?.length||0}_${QA?.editCount||0}`,f=AA.useMemo(()=>d(e),[e]),m=AA.useMemo(()=>{if(!c)return null;try{return i9e(e,E)}catch(QA){return console.error("Failed to generate SPICE string",QA),null}},[f,c,E.startTime,E.duration]),[w,D]=AA.useState(!1);AA.useEffect(()=>{D(!1)},[f]);const{plotData:S,nodes:_,isLoading:b,error:R}=e9e(w?m:null),[F,H]=AA.useState(n),[Y,J]=AA.useState(!0),[O,W]=AA.useState(!1),z=o||O,[tA,aA]=AA.useState(!a),[eA,oA]=AA.useState(!1),[rA,lA]=AA.useState(()=>I?!1:n9e("schematic_viewer_show_groups",!1)),[pA,vA]=AA.useState(!1),MA=AA.useRef(new Set),YA=AA.useCallback((QA,ot)=>{ot?MA.current.add(QA):MA.current.delete(QA),vA(MA.current.size>0)},[]),[EA,xA]=AA.useState(!1),dA=AA.useRef(new Set),WA=AA.useCallback((QA,ot)=>{ot?dA.current.add(QA):dA.current.delete(QA),xA(dA.current.size>0)},[]),jA=AA.useRef(null),It=AA.useRef(null),mA=AA.useMemo(()=>{try{return qE(e).schematic_component?.list()?.map(QA=>QA.schematic_component_id)??[]}catch(QA){return console.error("Failed to derive schematic component ids",QA),[]}},[f,e]),gt=AA.useMemo(()=>{if(!B)return[];try{return(qE(e).schematic_port?.list()??[]).map(ot=>{const Bt=qE(e).source_port.get(ot.source_port_id),Lt=(Bt?.source_component_id?qE(e).source_component.get(Bt.source_component_id):null)?.name??"?",Tt=ot.display_pin_label??Bt?.pin_number??Bt?.name??"?";return{portId:ot.source_port_id,label:`${Lt}.${Tt}`}})}catch(QA){return console.error("Failed to derive schematic port info",QA),[]}},[f,e,B]),VA=QA=>{const ot=QA.touches[0];It.current={x:ot.clientX,y:ot.clientY}},JA=QA=>{const ot=QA.changedTouches[0],Bt=It.current;if(!Bt)return;const yt=Math.abs(ot.clientX-Bt.x),Lt=Math.abs(ot.clientY-Bt.y);yt<10&&Lt<10&&(QA.preventDefault(),aA(!0)),It.current=null},[OA,_A]=AA.useState([]),DA=AA.useRef(e);AA.useEffect(()=>{const QA=d(e),ot=d(DA.current);QA!==ot&&(_A([]),DA.current=e)},[e]);const{ref:NA,cancelDrag:FA,transform:KA}=PJ({onSetTransform(QA){jA.current&&(jA.current.style.transform=Ap(QA))},enabled:tA&&!Q}),{containerWidth:ZA,containerHeight:nt}=yct(NA),SA=AA.useMemo(()=>!ZA||!nt?"":k9(e,{width:ZA,height:nt||720,grid:z?{cellSize:1,labelCells:!0}:void 0,colorOverrides:g}),[f,ZA,nt,z]),CA=AA.useMemo(()=>SA.match(/<svg[^>]*style="[^"]*background-color:\s*([^;\"]+)/i)?.[1]??"transparent",[SA]),hA=AA.useMemo(()=>{if(!SA)return ba();const QA=SA.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return F4(QA)}catch(ot){return console.error(ot),ba()}},[SA]),TA=QA=>{_A(ot=>[...ot,QA]),i&&i(QA)},rt=AA.useMemo(()=>[...t,...OA],[t,OA]),{handleMouseDown:Qt,handleTouchStart:mt,isDragging:_t,activeEditEvent:kt}=PVe({onEditEvent:TA,cancelDrag:FA,realToSvgProjection:hA,svgToScreenProjection:KA,circuitJson:e,editEvents:rt,enabled:F&&tA&&!Q,snapToGrid:Y});RVe({svgDivRef:jA,editEvents:rt,realToSvgProjection:hA,svgToScreenProjection:KA,activeEditEvent:kt}),NVe({svgDivRef:jA,circuitJson:e,activeEditEvent:kt,editEvents:rt}),LVe({svgDivRef:jA,circuitJson:e,circuitJsonKey:f,showGroups:rA&&!I});const Pt=AA.useRef(mt);AA.useEffect(()=>{Pt.current=mt},[mt]);const le=AA.useMemo(()=>Z.jsx("div",{ref:jA,style:{pointerEvents:a?tA?"auto":"none":"auto",transformOrigin:"0 0"},className:l?"schematic-component-clickable":void 0,onTouchStart:QA=>{F&&tA&&!Q&&Pt.current(QA)},dangerouslySetInnerHTML:{__html:SA}}),[SA,tA,a,F,Q]);return Z.jsxs(a9e,{children:[l&&Z.jsx("style",{children:".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }"}),C&&Z.jsx("style",{children:"[data-schematic-port-id]:hover { cursor: pointer !important; }"}),Z.jsxs("div",{ref:NA,style:{position:"relative",backgroundColor:CA,overflow:"hidden",cursor:Q?"auto":_t?"grabbing":a&&!tA||pA&&l||EA&&C?"pointer":"grab",minHeight:"300px",...A},onWheelCapture:QA=>{Q&&QA.stopPropagation()},onMouseDown:QA=>{if(a&&!tA){QA.preventDefault(),QA.stopPropagation();return}Qt(QA)},onMouseDownCapture:QA=>{if(a&&!tA){QA.preventDefault(),QA.stopPropagation();return}},onTouchStart:QA=>{Q||VA(QA)},onTouchEnd:QA=>{Q||JA(QA)},children:[!tA&&a&&Z.jsx("div",{onClick:QA=>{QA.preventDefault(),QA.stopPropagation(),aA(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:sS.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"all",touchAction:"pan-x pan-y pinch-zoom"},children:Z.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",fontFamily:"sans-serif",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})}),Z.jsx(OVe,{active:eA,onClick:()=>oA(!eA)}),s&&Z.jsx(KVe,{active:F,onClick:()=>H(!F)}),s&&F&&Z.jsx(qVe,{active:Y,onClick:()=>J(!Y)}),Z.jsx(ZVe,{circuitJson:e,circuitJsonKey:f,isVisible:eA,onClose:()=>oA(!1),showGroups:rA,onToggleGroups:QA=>{I||(lA(QA),o9e("schematic_viewer_show_groups",QA))},showGrid:z,onToggleGrid:W}),c&&Z.jsx(jVe,{onClick:()=>h(!0)}),Q&&Z.jsx(XVe,{spiceString:m,onClose:()=>h(!1),plotData:S,nodes:_,isLoading:b,error:R,simOptions:E,onSimOptionsChange:QA=>{D(!0),u(QA)},hasRun:w}),l&&mA.map(QA=>Z.jsx(c9e,{componentId:QA,svgDivRef:jA,containerRef:NA,showOutline:!0,circuitJsonKey:f,onHoverChange:YA,onComponentClick:(ot,Bt)=>{l?.({schematicComponentId:ot,event:Bt})}},QA)),le,B&&gt.map(({portId:QA,label:ot})=>Z.jsx(l9e,{portId:QA,portLabel:ot,svgDivRef:jA,containerRef:NA,showOutline:!0,circuitJsonKey:f,onHoverChange:WA,onPortClick:C?(Bt,yt)=>{C?.({schematicPortId:Bt,event:yt})}:void 0},QA))]})]})},C9e=({circuitJson:e,containerStyle:A,colorOverrides:t,width:i,height:n,className:o})=>{const[s,r]=AA.useState(null),[a,g]=AA.useState(!0),[c,I]=AA.useState(null),[l,B]=AA.useState(null),C=AA.useRef(null),Q=AA.useRef(null),{containerWidth:h,containerHeight:E}=yct(C),[u,d]=AA.useState(!1),{ref:f}=PJ({onSetTransform(H){Q.current&&(Q.current.style.transform=Ap(H))}}),m=i||h||1e3,w=n||E||600;AA.useEffect(()=>{g(!0),I(null),r(e),g(!1)},[e]);const D=AA.useMemo(()=>s&&s.find(Y=>Y.type==="simulation_experiment")?.simulation_experiment_id||null,[s]),S=AA.useMemo(()=>s?s.filter(H=>H.type==="simulation_transient_voltage_graph").map(H=>H.simulation_transient_voltage_graph_id):[],[s]),_=AA.useMemo(()=>{if(!s||!m||!w||!D)return"";try{return Cat({circuitJson:s,simulation_experiment_id:D,simulation_transient_voltage_graph_ids:S,width:m,height:w,schematicOptions:{colorOverrides:t}})}catch(H){return console.error("Failed to generate fallback schematic SVG:",H),""}},[s,m,w,t,D,S]);AA.useEffect(()=>{if(!_){B(null);return}try{const H=new Blob([_],{type:"image/svg+xml"}),Y=URL.createObjectURL(H);return B(Y),()=>{URL.revokeObjectURL(Y)}}catch(H){console.error("Failed to create SVG object URL:",H),B(null)}},[_]);const b=AA.useMemo(()=>_?_.match(/<svg[^>]*style="[^"]*background-color:\s*([^;\"]+)/i)?.[1]??"transparent":"transparent",[_]),R=H=>{d(!0)},F=H=>{d(!0)};return AA.useEffect(()=>{const H=()=>{d(!1)},Y=()=>{d(!1)};return window.addEventListener("mouseup",H),window.addEventListener("touchend",Y),()=>{window.removeEventListener("mouseup",H),window.removeEventListener("touchend",Y)}},[]),a?Z.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#666",...A},className:o,children:"Loading circuit..."}):c?Z.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#fef2f2",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#dc2626",...A},className:o,children:Z.jsxs("div",{style:{textAlign:"center",padding:"20px"},children:[Z.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:"Circuit Conversion Error"}),Z.jsx("div",{style:{fontSize:"14px"},children:c})]})}):_?Z.jsx("div",{ref:H=>{C.current=H,f.current=H},style:{position:"relative",backgroundColor:b,overflow:"hidden",minHeight:"300px",cursor:u?"grabbing":"grab",...A},className:o,onMouseDown:R,onTouchStart:F,children:l?Z.jsx("img",{ref:Q,src:l,alt:"Circuit Simulation",style:{transformOrigin:"0 0",width:"100%",height:"100%",display:"block",objectFit:"contain"}}):Z.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"300px",color:"#666",fontFamily:"sans-serif"},children:"Failed to render SVG"})}):Z.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:"#f8fafc",minHeight:"300px",fontFamily:"sans-serif",gap:"12px",...A},className:o,children:[Z.jsx("div",{style:{fontSize:"16px",color:"#475569",fontWeight:500},children:"No Simulation Found"}),Z.jsxs("div",{style:{fontSize:"14px",color:"#64748b"},children:["Use"," ",Z.jsx("code",{style:{backgroundColor:"#e2e8f0",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace",fontSize:"13px"},children:"<analogsimulation />"})," ","to create simulations"]})]})},Dct=e=>{const[A,t]=AA.useState(0),[i,n]=AA.useState(0);return AA.useEffect(()=>{if(!e.current)return;const o=()=>{const r=e.current?.getBoundingClientRect();t(r?.width||0),n(r?.height||0)};o();const s=new ResizeObserver(o);return s.observe(e.current),window.addEventListener("resize",o),()=>{s.disconnect(),window.removeEventListener("resize",o)}},[]),{containerWidth:A,containerHeight:i}};Dc("assembly-viewer");var Sct=()=>{Dc.enable("assembly-viewer*")},Q9e=({circuitJson:e,containerStyle:A,debugGrid:t=!1,debug:i=!1})=>{i&&Sct();const n=AA.useRef(null),{ref:o}=PJ({onSetTransform(c){n.current&&(n.current.style.transform=Ap(c))}}),{containerWidth:s,containerHeight:r}=Dct(o),a=AA.useMemo(()=>!s||!r?"":Krt(e,{width:s,height:r||720}),[e,s,r]);AA.useMemo(()=>{if(!a)return ba();const c=a.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return F4(c)}catch(I){return console.error(I),ba()}},[a]);const g=AA.useMemo(()=>Z.jsx("div",{ref:n,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:a}}),[a]);return Z.jsx("div",{ref:o,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...A},children:g})},h9e=({circuitJson:e,containerStyle:A,debugGrid:t=!1,debug:i=!1})=>{i&&Sct();const n=AA.useRef(null),{ref:o}=PJ({onSetTransform(c){n.current&&(n.current.style.transform=Ap(c))}}),{containerWidth:s,containerHeight:r}=Dct(o),a=AA.useMemo(()=>!s||!r?"":lfA(e,{width:s,height:r||720}),[e,s,r]);AA.useMemo(()=>{if(!a)return ba();const c=a.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return F4(c)}catch(I){return console.error(I),ba()}},[a]);const g=AA.useMemo(()=>Z.jsx("div",{ref:n,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:a}}),[a]);return Z.jsx("div",{ref:o,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...A},children:g})};const bct=["Initialize a tscircuit project using [tsci init](https://github.com/tscircuit/cli) before adding components.","Define reusable modules with cached routes using [<subcircuit />](https://docs.tscircuit.com/elements/subcircuit)","Run `tsci dev` on the command line to preview your boards before export",'Use units like mm or mils consistently across your designs (e.g. pcbX="10mm")',"Quickly set footprints with the [footprint prop](https://docs.tscircuit.com/footprints/footprinter-strings)","Check out the guide on [ordering prototypes](https://docs.tscircuit.com/building-electronics/ordering-prototypes)","Use [net labels](https://docs.tscircuit.com/elements/net) and [group elements](https://docs.tscircuit.com/elements/group) to organize complex schematics.","You can manually drag components on the PCB and Schematic using [manual edits](https://docs.tscircuit.com/guides/manual-edits)","Every tscircuit module can export to [Circuit JSON](https://github.com/tscircuit/circuit-json), Gerbers, Pick'n'Place CSV files, Bill of Materials CSV and more","You can import components from [JLCPCB](https://docs.tscircuit.com/guides/importing-modules-and-chips/importing-from-jlcpcb) or [KiCad](https://docs.tscircuit.com/guides/importing-modules-and-chips/importing-from-kicad)","Any module you push to the [registry](https://tscircuit.com/trending) will have [simple image urls](https://docs.tscircuit.com/web-apis/image-generation-api) you can use display images on a website","The default [Parts Engine](https://docs.tscircuit.com/guides/platform-configuration) will automatically find parts from common vendors for your BOM",'[Pin selectors](https://docs.tscircuit.com/guides/using-sel-references) are similar to CSS selectors, ".R1 > .pin1" means "connect to the first pin of the component R1"',"You can use the [sel](https://docs.tscircuit.com/guides/using-sel-references) object to select pins in a type-safe way","Publish modules via the [registry](https://tscircuit.com/trending) for working with a team or sharing your work","[Explore tutorials](https://docs.tscircuit.com/category/tutorials) for real-world circuit design examples.","Upload your Circuit JSON to [circuitjson.com](https://circuitjson.com) for a quick preview.","You can display Circuit JSON in 3D, PCB or Schematic mode with the [<CircuitJsonPreview />](https://docs.tscircuit.com/guides/running-tscircuit/displaying-circuit-json-on-a-webpage#react-display-all-available-previews-with-circuitjsonpreview-) React component","Use a [<group />](https://docs.tscircuit.com/elements/group) element to move multiple components at once in a schematic or PCB layout.","Check out the [GitHub Discussions page](https://github.com/tscircuit/tscircuit/discussions) to upvote features","You can customize the autorouter using the [autorouter prop](https://docs.tscircuit.com/elements/board#setting-the-autorouter)","Use the [<constraint />](https://docs.tscircuit.com/footprints/constraint) element to enforce geometric relationships in PCB designs.","When working on component placement and circuit design, autorouting can slow down your iteration cycle. Use [routingDisabled](https://docs.tscircuit.com/elements/board#disabling-routing-with-routingdisabled) on the <board /> element to disable autorouting temporarily.","Join the [Discord server](https://tscircuit.com/join) to discuss issues and get help directly from the community."],E9e=(()=>{let e=bct[Math.floor(Math.random()*bct.length)];return e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(new RegExp('(?<!href=")(?<!\\()(?<!\\]\\()(https?:\\/\\/[^\\s\\)\\]]+)',"g"),(A,t)=>`<a class="rf-text-blue-500 rf-underline" href="${A}" target="_blank">${A}</a>`),e=e.replace(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/g,'<a class="rf-text-blue-500 rf-underline" href="$2" target="_blank">$1</a>'),e})(),Wb=({onRunClicked:e})=>Z.jsxs("div",{className:"rf-flex rf-flex-col rf-items-center rf-justify-center rf-h-full rf-bg-gray-50 rf-text-gray-500 rf-p-4",children:[Z.jsx(oTe,{className:"rf-size-14 rf-mb-4"}),Z.jsxs("p",{className:"rf-text-md rf-break-words rf-max-w-xl rf-text-center",children:["Tip: ",Z.jsx("span",{dangerouslySetInnerHTML:{__html:E9e}})]}),e&&Z.jsxs(oI,{className:"rf-mt-4 rf-bg-blue-600 rf-hover:bg-blue-500",onClick:e,children:["Run Code",Z.jsx(gTe,{className:"rf-w-3 rf-h-3 rf-ml-2"})]})]}),sj=({text:e,onClick:A})=>Z.jsx("span",{className:"rf-cursor-pointer rf-underline rf-text-blue-600 rf-mx-2",onClick:A,children:e}),rj=e=>Z.jsxs("div",{className:"rf-leading-5",children:[Z.jsx("div",{className:"rf-py-2 rf-font-bold",children:e.column.name}),Z.jsx("div",{children:e.field?.()??Z.jsx("input",{type:"text",className:"rf-border rf-rounded rf-p-1 rf-w-full",onChange:A=>{e.onTextChange?.(A.target.value)}})})]}),u9e=({open:e,children:A,title:t,onClose:i})=>e?Z.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-justify-center rf-items-center rf-z-50",onClick:i,children:Z.jsxs("div",{className:"rf-bg-white rf-p-5 rf-rounded-lg rf-relative rf-w-11/12 rf-max-w-2xl",onClick:n=>{n.preventDefault(),n.stopPropagation()},children:[Z.jsx("h2",{className:"rf-mt-0 rf-text-md rf-pb-4",children:t}),Z.jsx("button",{type:"button",className:"rf-absolute rf-top-2 rf-right-4 rf-text-2xl rf-font-bold",onClick:i,children:"×"}),A]})}):null,d9e=({elements:e})=>{const[A,t]=AA.useState({open:!1}),[i,n]=AA.useReducer((c,I)=>({...c,...I}),{}),o=[...new Set(e.map(c=>c.type))],s=e.map(c=>{const I=c[`${c.type}_id`],l=Object.fromEntries(Object.entries(c).filter(([C])=>!(C===`${c.type}_id`||!C.endsWith("_id")))),B=Object.fromEntries(Object.entries(c).filter(([C])=>!C.endsWith("_id")));return{primary_id:I,other_ids:l,...B,_og_elm:c}}),r=s.map(c=>{let I="";const l=B=>{const C=Object.keys(B.other_ids).find(E=>E.startsWith("source_"));if(!C)return`.${B.name}`;const Q=C.slice(0,-3),h=s.find(E=>E.type===Q&&E.primary_id===B.other_ids[C]);return h?"name"in h?`${l(h)} > .${B.name}`:`#${h.primary_id} > .${B.name}`:`??? > .${B.name}`};return"name"in c&&(I=l(c)),{...c,selector_path:I}}),a=[{key:"primary_id",name:"primary_id",renderCell:c=>Z.jsxs("div",{className:"rf-flex rf-items-center",children:[Z.jsx(sj,{text:c.primary_id,onClick:()=>n({focused_id:c.primary_id,id_search:void 0,selector_search:void 0})}),Z.jsx("span",{className:"rf-flex-grow"}),Z.jsx(sj,{text:"(JSON)",onClick:()=>t({open:!0,element:c._og_elm,title:c.primary_id})})]}),renderHeaderCell:c=>Z.jsx(rj,{column:c,onTextChange:I=>n({id_search:I}),field:i.focused_id?()=>Z.jsxs("div",{children:["Focus:"," ",Z.jsx("span",{className:"rf-underline",children:i.focused_id}),Z.jsx(sj,{text:"(unfocus)",onClick:()=>n({focused_id:void 0})})]}):void 0})},{key:"type",name:"type",renderHeaderCell:c=>Z.jsx(rj,{column:c,field:()=>Z.jsxs("select",{onChange:I=>n({component_type_filter:I.target.value}),className:"rf-border rf-rounded rf-p-1 rf-w-full",children:[Z.jsx("option",{value:"any",children:"any"},"any"),Z.jsx("option",{value:"source",children:"source"},"source"),Z.jsx("option",{value:"source/pcb",children:"source/pcb"},"source/pcb"),Z.jsx("option",{value:"source/schematic",children:"source/schematic"},"source/schematic"),o.map(I=>Z.jsx("option",{value:I,children:I},I))]})})},{key:"name",name:"name",renderHeaderCell:c=>Z.jsx(rj,{column:c,onTextChange:I=>n({name_search:I})})},{key:"selector_path",name:"selector_path",renderHeaderCell:c=>Z.jsx(rj,{column:c,onTextChange:I=>n({selector_search:I})})},{key:"other_ids",name:"other_ids",renderCell:c=>Z.jsx("div",{className:"rf-space-x-2",children:Object.entries(c.other_ids).map(([I,l])=>Z.jsx(sj,{text:l,onClick:()=>n({focused_id:l})},l))})}],g=r.filter(c=>i.name_search?c.name?.toLowerCase()?.includes(i.name_search.toLowerCase()):!0).filter(c=>!i.component_type_filter||i.component_type_filter==="any"?!0:i.component_type_filter==="source"?c.type.startsWith("source_"):i.component_type_filter==="source/pcb"?c.type.startsWith("source_")||c.type.startsWith("pcb_"):i.component_type_filter==="source/schematic"?c.type.startsWith("source_")||c.type.startsWith("schematic_"):c.type?.includes(i.component_type_filter)).filter(c=>i.selector_search?i.selector_search.split(" ").filter(l=>l.length>0).every(l=>c.selector_path?.includes(l)):!0).filter(c=>i.id_search?c.primary_id?.includes(i.id_search):!0).filter(c=>!!(!i.focused_id||c.primary_id===i.focused_id||Object.values(c.other_ids).includes(i.focused_id)));return Z.jsxs("div",{className:"rf-font-mono rf-text-xs rf-bg-white",children:[Z.jsx("div",{className:"rf-overflow-x-auto",children:Z.jsxs("table",{className:"rf-table-auto rf-w-full rf-text-left",children:[Z.jsx("thead",{children:Z.jsx("tr",{children:a.map(c=>Z.jsx("th",{className:"rf-px-4 rf-py-2 rf-border-b",children:c.renderHeaderCell?c.renderHeaderCell(c):c.name},c.key))})}),Z.jsx("tbody",{children:g.map((c,I)=>Z.jsx("tr",{className:"rf-hover:bg-gray-100",children:a.map(l=>Z.jsx("td",{className:"rf-px-4 rf-py-2 rf-border-b",children:l.renderCell?l.renderCell(c):c[l.key]},l.key))},I))})]})}),Z.jsx(u9e,{open:A.open,onClose:()=>t({open:!1}),title:A.open?A.title:"",children:Z.jsx("div",{className:"rf-bg-gray-800 rf-p-3 rf-text-white rf-rounded",children:Z.jsx("pre",{className:"rf-whitespace-pre-wrap",children:A.open?JSON.stringify(A.element,null,2):""})})})]})},p9e=(e,A)=>e==="jlcpcb"?Z.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${A}`,children:A}):A,f9e=({circuitJson:e})=>{const A=e.filter(i=>i.type==="source_component"),t=new Set;for(const i of A)if(i.supplier_part_numbers)for(const n of Object.keys(i.supplier_part_numbers))t.add(n);return Z.jsx("div",{className:"rf-overflow-x-auto",children:Z.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[Z.jsx("thead",{children:Z.jsxs("tr",{className:"rf-border-b",children:[Z.jsx("th",{className:"rf-p-2",children:"Name"}),Array.from(t).map(i=>Z.jsx("th",{className:"rf-p-2 rf-capitalize",children:i},i))]})}),Z.jsx("tbody",{children:A.map(i=>Z.jsxs("tr",{className:"rf-border-b",children:[Z.jsx("td",{className:"rf-p-2",children:i.name}),Array.from(t).map(n=>Z.jsx("td",{className:"rf-p-2",children:p9e(n,i.supplier_part_numbers?.[n]?.[0]||"")},n))]},i.source_component_id))})]})})},XfA=AA.forwardRef(({className:e,type:A,...t},i)=>Z.jsx("input",{type:A,className:bo("rf-flex rf-h-9 rf-w-full rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-px-3 rf-py-1 rf-text-sm rf-shadow-sm rf-transition-colors file:rf-border-0 file:rf-bg-transparent file:rf-text-sm file:rf-font-medium placeholder:rf-text-zinc-500 focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-placeholder-zinc-400 dark:focus-visible:rf-ring-zinc-300",e),ref:i,...t}));XfA.displayName="Input";var xct={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:{fs:1e-12,ps:1e-9,ns:1e-6,us:.001,µs:.001,ms:1,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}}},$fA=new Set;for(const[e,A]of Object.entries(xct)){$fA.add(e);for(const t of Object.keys(A.variants))$fA.add(t)}function y9e(e){for(const[A,t]of Object.entries(xct))if(e in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[e]};return{baseUnit:e,conversionFactor:1}}var _ct={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};function vw(e){if(e==null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof e=="string"&&e.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(e),parsedUnit:null,unitOfValue:null};if(typeof e=="number")return{value:e,parsedUnit:null,unitOfValue:null};if(typeof e=="object"&&"x"in e&&"y"in e){const{parsedUnit:r,unitOfValue:a}=vw(e.x),g=vw(e.x),c=vw(e.y);return g.value===null||c.value===null?{parsedUnit:null,unitOfValue:null,value:null}:{parsedUnit:r,unitOfValue:a,value:{x:g.value,y:c.value}}}const t=e.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!t)throw new Error(`Could not determine unit: "${e}"`);const i=t.split("").reverse().join(""),n=e.slice(0,-i.length);if(i in _ct&&!$fA.has(i)){const r=_ct[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(n)*r}}const{baseUnit:o,conversionFactor:s}=y9e(i);return{parsedUnit:i,unitOfValue:o,value:s*Number.parseFloat(n)}}var aj=L().or(qA()).transform(e=>vw(e).value),A0A=L().or(qA()).transform(e=>vw(e).value).transform(e=>Number.parseFloat(e.toPrecision(12))),kct=L().or(qA()).transform(e=>vw(e).value),Zb=L().or(qA()).transform(e=>vw(e).value),rn=L().or(qA()).transform(e=>vw(e).value),dM=L().or(qA()).transform(e=>vw(e).value),Ee=rn,A1=L().or(qA()).transform(e=>vw(e).value),cT=L().or(qA()).transform(e=>vw(e).value),m9e=cT,pM=cT,vct=L().datetime(),gC=L().or(qA()).transform(e=>typeof e=="number"?e:e.endsWith("deg")?Number.parseFloat(e.split("deg")[0]):e.endsWith("rad")?Number.parseFloat(e.split("rad")[0])*180/Math.PI:Number.parseFloat(e)),Fct=qA().or(L().endsWith("mAh")).transform(e=>{if(typeof e=="string"){const A=e.replace("mAh",""),t=Number.parseFloat(A);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return e}).describe("Battery capacity in mAh"),Bn=et({x:Ee,y:Ee}),w9e=Bn,Vb=et({x:Ee,y:Ee,z:Ee}),D9e=Vb,t0A=et({width:qA(),height:qA()}),S9e=e=>{const A="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:e},()=>A[Math.floor(Math.random()*A.length)]).join("")},We=e=>L().optional().default(()=>`${e}_${S9e(10)}`),jb=Xt(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),b9e=Xt(["top_silkscreen","bottom_silkscreen","top_copper","bottom_copper","top_soldermask","bottom_soldermask","top_fabrication_note","bottom_fabrication_note","top_user_note","bottom_user_note","top_courtyard","bottom_courtyard","inner1_copper","inner2_copper","inner3_copper","inner4_copper","inner5_copper","inner6_copper","edge_cuts","drill"]),Mct=et({project_relative_path:L(),url:L(),mimetype:L()}),gj=Bn.extend({rotation:gC.optional()}),e0A=et({size:Bn.optional(),thickness:Ee.optional()}),Gct=et({font:e0A.optional()}),IT=et({value:L(),at:gj.optional(),layer:L().optional(),uuid:L().optional(),hide:PA().optional(),effects:Gct.optional()}),Rct=et({Reference:IT.optional(),Value:IT.optional(),Datasheet:IT.optional(),Description:IT.optional()}),Nct=et({through_hole:PA().optional(),smd:PA().optional(),exclude_from_pos_files:PA().optional(),exclude_from_bom:PA().optional()}),Lct=et({name:L(),type:L(),shape:L().optional(),at:gj.optional(),size:Bn.optional(),drill:Ee.optional(),layers:St(L()).optional(),removeUnusedLayers:PA().optional(),uuid:L().optional()}),Uct=et({path:L(),offset:Vb.optional(),scale:Vb.optional(),rotate:Vb.optional()}),Hct=et({footprintName:L().optional(),version:Ge([qA(),L()]).optional(),generator:L().optional(),generatorVersion:Ge([qA(),L()]).optional(),layer:L().optional(),properties:Rct.optional(),attributes:Nct.optional(),pads:St(Lct).optional(),embeddedFonts:PA().optional(),model:Uct.optional()}),Yct=et({hide:PA().optional()}),Jct=et({offset:Ee.optional(),hide:PA().optional()}),Tct=et({font:e0A.optional(),justify:Ge([L(),St(L())]).optional(),hide:PA().optional()}),kk=et({value:L(),id:Ge([qA(),L()]).optional(),at:gj.optional(),effects:Tct.optional()}),Pct=et({Reference:kk.optional(),Value:kk.optional(),Footprint:kk.optional(),Datasheet:kk.optional(),Description:kk.optional(),ki_keywords:kk.optional(),ki_fp_filters:kk.optional()}),Kct=et({symbolName:L().optional(),extends:L().optional(),pinNumbers:Yct.optional(),pinNames:Jct.optional(),excludeFromSim:PA().optional(),inBom:PA().optional(),onBoard:PA().optional(),properties:Pct.optional(),embeddedFonts:PA().optional()}),tc=et({error_type:L(),message:L(),is_fatal:PA().optional()}),qct=Xt(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),bc=et({type:bA("source_component"),ftype:L().optional(),source_component_id:L(),name:L(),manufacturer_part_number:L().optional(),supplier_part_numbers:Sa(qct,St(L())).optional(),display_value:L().optional(),display_name:L().optional(),are_pins_interchangeable:PA().optional(),internally_connected_source_port_ids:St(St(L())).optional(),source_group_id:L().optional(),subcircuit_id:L().optional()}),i0A=bc.extend({ftype:bA("simple_capacitor"),capacitance:A0A,max_voltage_rating:Zb.optional(),display_capacitance:L().optional(),max_decoupling_trace_length:Ee.optional()}),n0A=bc.extend({ftype:bA("simple_resistor"),resistance:aj,display_resistance:L().optional()}),cj=bc.extend({ftype:bA("simple_diode")}),Oct=bc.extend({ftype:bA("simple_fiducial")}),o0A=cj.extend({ftype:bA("simple_led"),color:L().optional(),wavelength:L().optional()}),Wct=bc.extend({ftype:bA("simple_ground")}),s0A=bc.extend({ftype:bA("simple_chip")}),r0A=bc.extend({ftype:bA("simple_power_source"),voltage:Zb}),Zct=bc.extend({ftype:bA("simple_current_source"),current:A1,frequency:dM.optional(),peak_to_peak_current:A1.optional(),wave_shape:Xt(["sine","square","triangle","sawtooth","dc"]).optional().default("dc"),phase:qA().optional(),duty_cycle:qA().min(0).max(1).optional()}),Vct=et({must_be_connected:PA().optional(),provides_power:PA().optional(),requires_power:PA().optional(),provides_ground:PA().optional(),requires_ground:PA().optional(),provides_voltage:Ge([L(),qA()]).optional(),requires_voltage:Ge([L(),qA()]).optional(),do_not_connect:PA().optional(),include_in_board_pinout:PA().optional(),can_use_internal_pullup:PA().optional(),is_using_internal_pullup:PA().optional(),needs_external_pullup:PA().optional(),can_use_internal_pulldown:PA().optional(),is_using_internal_pulldown:PA().optional(),needs_external_pulldown:PA().optional(),can_use_open_drain:PA().optional(),is_using_open_drain:PA().optional(),can_use_push_pull:PA().optional(),is_using_push_pull:PA().optional(),should_have_decoupling_capacitor:PA().optional(),recommended_decoupling_capacitor_capacitance:Ge([L(),qA()]).optional(),is_configured_for_i2c_sda:PA().optional(),is_configured_for_i2c_scl:PA().optional(),is_configured_for_spi_mosi:PA().optional(),is_configured_for_spi_miso:PA().optional(),is_configured_for_spi_sck:PA().optional(),is_configured_for_spi_cs:PA().optional(),is_configured_for_uart_tx:PA().optional(),is_configured_for_uart_rx:PA().optional(),supports_i2c_sda:PA().optional(),supports_i2c_scl:PA().optional(),supports_spi_mosi:PA().optional(),supports_spi_miso:PA().optional(),supports_spi_sck:PA().optional(),supports_spi_cs:PA().optional(),supports_uart_tx:PA().optional(),supports_uart_rx:PA().optional()}),x9e=bc.extend({ftype:bA("simple_fuse"),current_rating_amps:qA().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:qA().describe("Voltage rating in volts, e.g. ±5V would be 5")}),a0A=bc.extend({ftype:bA("simple_battery"),capacity:Fct}),g0A=bc.extend({ftype:bA("simple_inductor"),inductance:kct,max_current_rating:qA().optional()}),c0A=bc.extend({ftype:bA("simple_push_button")}),I0A=bc.extend({ftype:bA("simple_potentiometer"),max_resistance:aj,display_max_resistance:L().optional()}),jct=bc.extend({ftype:bA("simple_crystal"),frequency:qA().describe("Frequency in Hz"),load_capacitance:qA().optional().describe("Load capacitance in pF"),pin_variant:Xt(["two_pin","four_pin"]).optional()}),l0A=bc.extend({ftype:bA("simple_pin_header"),pin_count:qA(),gender:Xt(["male","female"]).optional().default("male")}),zct=bc.extend({ftype:bA("simple_connector"),standard:Xt(["usb_c","m2"]).optional()}),B0A=bc.extend({ftype:bA("simple_pinout")}),C0A=bc.extend({ftype:bA("simple_resonator"),load_capacitance:A0A,equivalent_series_resistance:aj.optional(),frequency:dM}),Q0A=bc.extend({ftype:bA("simple_transistor"),transistor_type:Xt(["npn","pnp"])}),h0A=bc.extend({ftype:bA("simple_test_point"),footprint_variant:Xt(["pad","through_hole"]).optional(),pad_shape:Xt(["rect","circle"]).optional(),pad_diameter:Ge([qA(),L()]).optional(),hole_diameter:Ge([qA(),L()]).optional(),width:Ge([qA(),L()]).optional(),height:Ge([qA(),L()]).optional()}),E0A=bc.extend({ftype:bA("simple_mosfet"),channel_type:Xt(["n","p"]),mosfet_mode:Xt(["enhancement","depletion"])}),u0A=bc.extend({ftype:bA("simple_op_amp")}),d0A=bc.extend({ftype:bA("simple_switch")}),p0A=et({type:bA("source_project_metadata"),name:L().optional(),software_used_string:L().optional(),project_url:L().optional(),created_at:vct.optional()}),Xct=tc.extend({type:bA("source_missing_property_error"),source_missing_property_error_id:We("source_missing_property_error"),source_component_id:L(),property_name:L(),subcircuit_id:L().optional(),error_type:bA("source_missing_property_error").default("source_missing_property_error")}).describe("The source code is missing a property"),$ct=tc.extend({type:bA("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:We("source_failed_to_create_component_error"),error_type:bA("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:L().optional(),subcircuit_id:L().optional(),parent_source_component_id:L().optional(),pcb_center:et({x:qA().optional(),y:qA().optional()}).optional(),schematic_center:et({x:qA().optional(),y:qA().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),f0A=tc.extend({type:bA("source_invalid_component_property_error"),source_invalid_component_property_error_id:We("source_invalid_component_property_error"),source_component_id:L(),property_name:L(),property_value:w4().optional(),expected_format:L().optional(),subcircuit_id:L().optional(),error_type:bA("source_invalid_component_property_error").default("source_invalid_component_property_error")}).describe("The source component property is invalid"),y0A=tc.extend({type:bA("source_trace_not_connected_error"),source_trace_not_connected_error_id:We("source_trace_not_connected_error"),error_type:bA("source_trace_not_connected_error").default("source_trace_not_connected_error"),subcircuit_id:L().optional(),source_group_id:L().optional(),source_trace_id:L().optional(),connected_source_port_ids:St(L()).optional(),selectors_not_found:St(L()).optional()}).describe("Occurs when a source trace selector does not match any ports"),AIt=et({type:bA("source_property_ignored_warning"),source_property_ignored_warning_id:We("source_property_ignored_warning"),source_component_id:L(),property_name:L(),subcircuit_id:L().optional(),error_type:bA("source_property_ignored_warning").default("source_property_ignored_warning"),message:L()}).describe("The source property was ignored"),m0A=et({type:bA("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:We("source_pin_missing_trace_warning"),warning_type:bA("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:L(),source_component_id:L(),source_port_id:L(),subcircuit_id:L().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),tIt=bc.extend({ftype:bA("simple_voltage_probe")}),eIt=bc.extend({ftype:bA("interconnect")}),w0A=tc.extend({type:bA("source_i2c_misconfigured_error"),source_i2c_misconfigured_error_id:We("source_i2c_misconfigured_error"),error_type:bA("source_i2c_misconfigured_error").default("source_i2c_misconfigured_error"),source_port_ids:St(L())}).describe("Error emitted when incompatible I2C pins (e.g. SDA and SCL) are connected to the same net"),iIt=bc.extend({ftype:bA("simple_voltage_source"),voltage:Zb,frequency:dM.optional(),peak_to_peak_voltage:Zb.optional(),wave_shape:Xt(["sinewave","square","triangle","sawtooth"]).optional(),phase:gC.optional(),duty_cycle:qA().optional().describe("Duty cycle as a fraction (0 to 1)")}),nIt=Ge([n0A,i0A,cj,Oct,o0A,Wct,s0A,r0A,Zct,a0A,g0A,c0A,I0A,jct,l0A,zct,B0A,C0A,d0A,Q0A,h0A,E0A,u0A,x9e,tIt,eIt,iIt,p0A,Xct,f0A,$ct,y0A,AIt,m0A,w0A]),oIt=et({type:bA("source_port"),pin_number:qA().optional(),port_hints:St(L()).optional(),name:L(),source_port_id:L(),source_component_id:L().optional(),source_group_id:L().optional(),most_frequently_referenced_by_name:L().optional(),subcircuit_id:L().optional(),subcircuit_connectivity_map_key:L().optional()}).merge(Vct),sIt=et({type:bA("source_component_internal_connection"),source_component_internal_connection_id:L(),source_component_id:L(),source_port_ids:St(L()),subcircuit_id:L().optional()}),rIt=et({type:bA("source_trace"),source_trace_id:L(),connected_source_port_ids:St(L()),connected_source_net_ids:St(L()),subcircuit_id:L().optional(),subcircuit_connectivity_map_key:L().optional(),max_length:qA().optional(),min_trace_thickness:qA().optional(),display_name:L().optional()}),aIt=et({type:bA("source_group"),source_group_id:L(),subcircuit_id:L().optional(),parent_subcircuit_id:L().optional(),parent_source_group_id:L().optional(),is_subcircuit:PA().optional(),show_as_schematic_box:PA().optional(),name:L().optional(),was_automatically_named:PA().optional()}),gIt=et({type:bA("source_net"),source_net_id:L(),name:L(),member_source_group_ids:St(L()),is_power:PA().optional(),is_ground:PA().optional(),is_digital_signal:PA().optional(),is_analog_signal:PA().optional(),is_positive_voltage_source:PA().optional(),trace_width:qA().optional(),subcircuit_id:L().optional(),subcircuit_connectivity_map_key:L().optional()}),cIt=et({type:bA("source_board"),source_board_id:L(),source_group_id:L(),title:L().optional()}).describe("Defines a board in the source domain"),IIt=tc.extend({type:bA("source_ambiguous_port_reference"),source_ambiguous_port_reference_id:We("source_ambiguous_port_reference"),error_type:bA("source_ambiguous_port_reference").default("source_ambiguous_port_reference"),source_port_id:L().optional(),source_component_id:L().optional()}).describe("Error emitted when a port hint matches multiple non-overlapping pads, making the port reference ambiguous"),lIt=et({type:bA("source_pcb_ground_plane"),source_pcb_ground_plane_id:L(),source_group_id:L(),source_net_id:L(),subcircuit_id:L().optional()}).describe("Defines a ground plane in the source domain"),BIt=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],D0A=Xt(BIt),Hr=D0A.or(et({name:D0A})).transform(e=>typeof e=="string"?e:e.name),fm=Xt(["top","bottom"]),CIt=et({type:bA("source_manually_placed_via"),source_manually_placed_via_id:L(),source_group_id:L(),source_net_id:L(),subcircuit_id:L().optional(),source_trace_id:L().optional()}).describe("Defines a via that is manually placed in the source domain"),QIt=et({type:bA("source_no_power_pin_defined_warning"),source_no_power_pin_defined_warning_id:We("source_no_power_pin_defined_warning"),warning_type:bA("source_no_power_pin_defined_warning").default("source_no_power_pin_defined_warning"),message:L(),source_component_id:L(),source_port_ids:St(L()),subcircuit_id:L().optional()}).describe("Warning emitted when a chip has no source ports with requires_power=true"),hIt=et({type:bA("source_no_ground_pin_defined_warning"),source_no_ground_pin_defined_warning_id:We("source_no_ground_pin_defined_warning"),warning_type:bA("source_no_ground_pin_defined_warning").default("source_no_ground_pin_defined_warning"),message:L(),source_component_id:L(),source_port_ids:St(L()),subcircuit_id:L().optional()}).describe("Warning emitted when a chip has no source ports marked as ground pins"),EIt=et({type:bA("source_component_pins_underspecified_warning"),source_component_pins_underspecified_warning_id:We("source_component_pins_underspecified_warning"),warning_type:bA("source_component_pins_underspecified_warning").default("source_component_pins_underspecified_warning"),message:L(),source_component_id:L(),source_port_ids:St(L()),subcircuit_id:L().optional()}).describe("Warning emitted when all ports on a source component are underspecified"),uIt=tc.extend({type:bA("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:We("source_pin_must_be_connected_error"),error_type:bA("source_pin_must_be_connected_error").default("source_pin_must_be_connected_error"),source_component_id:L(),source_port_id:L(),subcircuit_id:L().optional()}).describe("Error emitted when a pin with mustBeConnected attribute is not connected to any trace"),dIt=tc.extend({type:bA("unknown_error_finding_part"),unknown_error_finding_part_id:We("unknown_error_finding_part"),error_type:bA("unknown_error_finding_part").default("unknown_error_finding_part"),source_component_id:L().optional(),subcircuit_id:L().optional()}).describe("Error emitted when an unexpected error occurs while finding a part"),pIt=et({type:bA("schematic_box"),schematic_component_id:L().optional(),schematic_symbol_id:L().optional(),width:Ee,height:Ee,is_dashed:PA().default(!1),x:Ee,y:Ee,subcircuit_id:L().optional()}).describe("Draws a box on the schematic"),fIt=et({type:bA("schematic_path"),schematic_path_id:We("schematic_path"),schematic_component_id:L().optional(),schematic_symbol_id:L().optional(),fill_color:L().optional(),is_filled:PA().optional(),stroke_width:Ee.nullable().optional(),stroke_color:L().optional(),points:St(Bn),subcircuit_id:L().optional()}),yIt=Sa(et({left_margin:rn.optional(),right_margin:rn.optional(),top_margin:rn.optional(),bottom_margin:rn.optional()})),mIt=et({left_size:qA(),right_size:qA(),top_size:qA().optional(),bottom_size:qA().optional()}),wIt=et({left_side:et({pins:St(qA()),direction:Xt(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:et({pins:St(qA()),direction:Xt(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:et({pins:St(qA()),direction:Xt(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:et({pins:St(qA()),direction:Xt(["left-to-right","right-to-left"]).optional()}).optional()}),DIt=Ge([mIt,wIt]),SIt=et({type:bA("schematic_component"),size:t0A,center:Bn,source_component_id:L().optional(),schematic_component_id:L(),schematic_symbol_id:L().optional(),pin_spacing:rn.optional(),pin_styles:yIt.optional(),box_width:rn.optional(),symbol_name:L().optional(),port_arrangement:DIt.optional(),port_labels:Sa(L()).optional(),symbol_display_value:L().optional(),subcircuit_id:L().optional(),schematic_group_id:L().optional(),is_schematic_group:PA().optional(),source_group_id:L().optional(),is_box_with_pins:PA().optional().default(!0)}),_9e=et({kicad_symbol:Kct.optional()}).catchall(w4()),bIt=et({type:bA("schematic_symbol"),schematic_symbol_id:L(),name:L().optional(),metadata:_9e.optional()}).describe("Defines a named schematic symbol that can be referenced by components."),xIt=et({type:bA("schematic_line"),schematic_line_id:We("schematic_line"),schematic_component_id:L().optional(),schematic_symbol_id:L().optional(),x1:Ee,y1:Ee,x2:Ee,y2:Ee,stroke_width:Ee.nullable().optional(),color:L().default("#000000"),is_dashed:PA().default(!1),subcircuit_id:L().optional()}).describe("Draws a styled line on the schematic"),_It=et({type:bA("schematic_rect"),schematic_rect_id:We("schematic_rect"),schematic_component_id:L().optional(),schematic_symbol_id:L().optional(),center:Bn,width:Ee,height:Ee,rotation:gC.default(0),stroke_width:Ee.nullable().optional(),color:L().default("#000000"),is_filled:PA().default(!1),fill_color:L().optional(),is_dashed:PA().default(!1),subcircuit_id:L().optional()}).describe("Draws a styled rectangle on the schematic"),kIt=et({type:bA("schematic_circle"),schematic_circle_id:We("schematic_circle"),schematic_component_id:L().optional(),schematic_symbol_id:L().optional(),center:Bn,radius:Ee,stroke_width:Ee.nullable().optional(),color:L().default("#000000"),is_filled:PA().default(!1),fill_color:L().optional(),is_dashed:PA().default(!1),subcircuit_id:L().optional()}).describe("Draws a styled circle on the schematic"),vIt=et({type:bA("schematic_arc"),schematic_arc_id:We("schematic_arc"),schematic_component_id:L().optional(),schematic_symbol_id:L().optional(),center:Bn,radius:Ee,start_angle_degrees:gC,end_angle_degrees:gC,direction:Xt(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:Ee.nullable().optional(),color:L().default("#000000"),is_dashed:PA().default(!1),subcircuit_id:L().optional()}).describe("Draws a styled arc on the schematic"),FIt=et({type:bA("schematic_trace"),schematic_trace_id:L(),source_trace_id:L().optional(),junctions:St(et({x:qA(),y:qA()})),edges:St(et({from:et({x:qA(),y:qA()}),to:et({x:qA(),y:qA()}),is_crossing:PA().optional(),from_schematic_port_id:L().optional(),to_schematic_port_id:L().optional()})),subcircuit_id:L().optional(),subcircuit_connectivity_map_key:L().optional()}),k9e=Xt(["center","left","right","top","bottom"]),MIt=et({type:bA("schematic_text"),schematic_component_id:L().optional(),schematic_symbol_id:L().optional(),schematic_text_id:L(),text:L(),font_size:qA().default(.18),position:et({x:Ee,y:Ee}),rotation:qA().default(0),anchor:Ge([k9e.describe("legacy"),jb]).default("center"),color:L().default("#000000"),subcircuit_id:L().optional()}),GIt=et({type:bA("schematic_port"),schematic_port_id:L(),source_port_id:L(),schematic_component_id:L().optional(),center:Bn,facing_direction:Xt(["up","down","left","right"]).optional(),distance_from_component_edge:qA().optional(),side_of_component:Xt(["top","bottom","left","right"]).optional(),true_ccw_index:qA().optional(),pin_number:qA().optional(),display_pin_label:L().optional(),subcircuit_id:L().optional(),is_connected:PA().optional(),has_input_arrow:PA().optional(),has_output_arrow:PA().optional(),is_drawn_with_inversion_circle:PA().optional()}).describe("Defines a port on a schematic component"),RIt=et({type:bA("schematic_net_label"),schematic_net_label_id:We("schematic_net_label"),schematic_trace_id:L().optional(),source_trace_id:L().optional(),source_net_id:L(),center:Bn,anchor_position:Bn.optional(),anchor_side:Xt(["top","bottom","left","right"]),text:L(),symbol_name:L().optional(),is_movable:PA().optional(),subcircuit_id:L().optional()}),NIt=tc.extend({type:bA("schematic_error"),schematic_error_id:L(),error_type:bA("schematic_port_not_found").default("schematic_port_not_found"),subcircuit_id:L().optional()}).describe("Defines a schematic error on the schematic"),LIt=tc.extend({type:bA("schematic_layout_error"),schematic_layout_error_id:We("schematic_layout_error"),error_type:bA("schematic_layout_error").default("schematic_layout_error"),source_group_id:L(),schematic_group_id:L(),subcircuit_id:L().optional()}).describe("Error emitted when schematic layout fails for a group"),Ij=et({type:bA("schematic_debug_object"),label:L().optional(),subcircuit_id:L().optional()}),UIt=Ij.extend({shape:bA("rect"),center:Bn,size:t0A}),HIt=Ij.extend({shape:bA("line"),start:Bn,end:Bn}),YIt=Ij.extend({shape:bA("point"),center:Bn}),JIt=df("shape",[UIt,HIt,YIt]),TIt=et({type:bA("schematic_voltage_probe"),schematic_voltage_probe_id:L(),source_component_id:L().optional(),name:L().optional(),position:Bn,schematic_trace_id:L(),voltage:Zb.optional(),subcircuit_id:L().optional(),color:L().optional(),label_alignment:jb.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),PIt=et({type:bA("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:We("schematic_manual_edit_conflict_warning"),warning_type:bA("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:L(),schematic_component_id:L(),schematic_group_id:L().optional(),subcircuit_id:L().optional(),source_component_id:L()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),KIt=et({type:bA("schematic_group"),schematic_group_id:We("schematic_group"),source_group_id:L(),is_subcircuit:PA().optional(),subcircuit_id:L().optional(),width:rn,height:rn,center:Bn,schematic_component_ids:St(L()),show_as_schematic_box:PA().optional(),name:L().optional(),description:L().optional()}).describe("Defines a group of components on the schematic"),qIt=et({type:bA("schematic_table"),schematic_table_id:We("schematic_table"),anchor_position:Bn,column_widths:St(Ee),row_heights:St(Ee),cell_padding:Ee.optional(),border_width:Ee.optional(),subcircuit_id:L().optional(),schematic_component_id:L().optional(),anchor:jb.optional()}).describe("Defines a table on the schematic"),OIt=et({type:bA("schematic_table_cell"),schematic_table_cell_id:We("schematic_table_cell"),schematic_table_id:L(),start_row_index:qA(),end_row_index:qA(),start_column_index:qA(),end_column_index:qA(),text:L().optional(),center:Bn,width:Ee,height:Ee,horizontal_align:Xt(["left","center","right"]).optional(),vertical_align:Xt(["top","middle","bottom"]).optional(),font_size:Ee.optional(),subcircuit_id:L().optional()}).describe("Defines a cell within a schematic_table"),WIt=et({type:bA("schematic_sheet"),schematic_sheet_id:We("schematic_sheet"),name:L().optional(),subcircuit_id:L().optional()}).describe("Defines a schematic sheet or page that components can be placed on"),ZIt=et({x:Ee,y:Ee,bulge:qA().optional()}),S0A=et({vertices:St(ZIt)}),VIt=et({outer_ring:S0A,inner_rings:St(S0A).default([])}),jIt=et({x:Ee,y:Ee,via:PA().optional(),via_to_layer:Hr.optional()}),v9e=St(jIt),zIt=et({x:Ee,y:Ee,via:PA().optional(),to_layer:Hr.optional(),trace_width:Ee.optional()}),XIt=et({type:bA("pcb_component"),pcb_component_id:We("pcb_component"),source_component_id:L(),center:Bn,layer:Hr,rotation:gC,display_offset_x:L().optional().describe("How to display the x offset for this part, usually corresponding with how the user specified it"),display_offset_y:L().optional().describe("How to display the y offset for this part, usually corresponding with how the user specified it"),width:rn,height:rn,do_not_place:PA().optional(),is_allowed_to_be_off_board:PA().optional(),subcircuit_id:L().optional(),pcb_group_id:L().optional(),position_mode:Xt(["packed","relative_to_group_anchor","relative_to_another_component","none"]).optional(),anchor_position:Bn.optional(),anchor_alignment:jb.optional(),positioned_relative_to_pcb_group_id:L().optional(),positioned_relative_to_pcb_board_id:L().optional(),cable_insertion_center:Bn.optional(),metadata:et({kicad_footprint:Hct.optional()}).optional(),obstructs_within_bounds:PA().default(!0).describe("Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath")}).describe("Defines a component on the PCB"),$It=et({type:bA("pcb_hole"),pcb_hole_id:We("pcb_hole"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),pcb_component_id:L().optional(),hole_shape:bA("circle"),hole_diameter:qA(),x:Ee,y:Ee,is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),F9e=$It.describe("Defines a circular hole on the PCB"),Alt=et({type:bA("pcb_hole"),pcb_hole_id:We("pcb_hole"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),pcb_component_id:L().optional(),hole_shape:bA("rect"),hole_width:qA(),hole_height:qA(),x:Ee,y:Ee,is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),M9e=Alt.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),tlt=et({type:bA("pcb_hole"),pcb_hole_id:We("pcb_hole"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),pcb_component_id:L().optional(),hole_shape:Xt(["circle","square"]),hole_diameter:qA(),x:Ee,y:Ee,is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),G9e=tlt.describe("Defines a circular or square hole on the PCB"),elt=et({type:bA("pcb_hole"),pcb_hole_id:We("pcb_hole"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),pcb_component_id:L().optional(),hole_shape:bA("oval"),hole_width:qA(),hole_height:qA(),x:Ee,y:Ee,is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),R9e=elt.describe("Defines an oval hole on the PCB"),ilt=et({type:bA("pcb_hole"),pcb_hole_id:We("pcb_hole"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),pcb_component_id:L().optional(),hole_shape:bA("pill"),hole_width:qA(),hole_height:qA(),x:Ee,y:Ee,is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),N9e=ilt.describe("Defines a pill-shaped hole on the PCB"),nlt=et({type:bA("pcb_hole"),pcb_hole_id:We("pcb_hole"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),pcb_component_id:L().optional(),hole_shape:bA("rotated_pill"),hole_width:qA(),hole_height:qA(),x:Ee,y:Ee,ccw_rotation:gC,is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),L9e=nlt.describe("Defines a rotated pill-shaped hole on the PCB"),olt=tlt.or(elt).or(ilt).or(nlt).or($It).or(Alt),U9e=et({type:bA("pcb_plated_hole"),shape:bA("circle"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),outer_diameter:qA(),hole_diameter:qA(),is_covered_with_solder_mask:PA().optional(),x:Ee,y:Ee,layers:St(Hr),port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),pcb_plated_hole_id:We("pcb_plated_hole"),soldermask_margin:qA().optional()}),H9e=et({type:bA("pcb_plated_hole"),shape:Xt(["oval","pill"]),pcb_group_id:L().optional(),subcircuit_id:L().optional(),outer_width:qA(),outer_height:qA(),hole_width:qA(),hole_height:qA(),is_covered_with_solder_mask:PA().optional(),x:Ee,y:Ee,ccw_rotation:gC,layers:St(Hr),port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),pcb_plated_hole_id:We("pcb_plated_hole"),soldermask_margin:qA().optional()}),Y9e=et({type:bA("pcb_plated_hole"),shape:bA("circular_hole_with_rect_pad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),hole_shape:bA("circle"),pad_shape:bA("rect"),hole_diameter:qA(),rect_pad_width:qA(),rect_pad_height:qA(),rect_border_radius:qA().optional(),hole_offset_x:Ee.default(0),hole_offset_y:Ee.default(0),is_covered_with_solder_mask:PA().optional(),x:Ee,y:Ee,layers:St(Hr),port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),pcb_plated_hole_id:We("pcb_plated_hole"),soldermask_margin:qA().optional(),rect_ccw_rotation:gC.optional()}),J9e=et({type:bA("pcb_plated_hole"),shape:bA("pill_hole_with_rect_pad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),hole_shape:bA("pill"),pad_shape:bA("rect"),hole_width:qA(),hole_height:qA(),rect_pad_width:qA(),rect_pad_height:qA(),rect_border_radius:qA().optional(),hole_offset_x:Ee.default(0),hole_offset_y:Ee.default(0),is_covered_with_solder_mask:PA().optional(),x:Ee,y:Ee,layers:St(Hr),port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),pcb_plated_hole_id:We("pcb_plated_hole"),soldermask_margin:qA().optional()}),T9e=et({type:bA("pcb_plated_hole"),shape:bA("rotated_pill_hole_with_rect_pad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),hole_shape:bA("rotated_pill"),pad_shape:bA("rect"),hole_width:qA(),hole_height:qA(),hole_ccw_rotation:gC,rect_pad_width:qA(),rect_pad_height:qA(),rect_border_radius:qA().optional(),rect_ccw_rotation:gC,hole_offset_x:Ee.default(0),hole_offset_y:Ee.default(0),is_covered_with_solder_mask:PA().optional(),x:Ee,y:Ee,layers:St(Hr),port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),pcb_plated_hole_id:We("pcb_plated_hole"),soldermask_margin:qA().optional()}),P9e=et({type:bA("pcb_plated_hole"),shape:bA("hole_with_polygon_pad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),hole_shape:Xt(["circle","oval","pill","rotated_pill"]),hole_diameter:qA().optional(),hole_width:qA().optional(),hole_height:qA().optional(),pad_outline:St(et({x:Ee,y:Ee})).min(3),hole_offset_x:Ee.default(0),hole_offset_y:Ee.default(0),is_covered_with_solder_mask:PA().optional(),x:Ee,y:Ee,layers:St(Hr),port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),pcb_plated_hole_id:We("pcb_plated_hole"),soldermask_margin:qA().optional(),ccw_rotation:gC.optional()}),slt=Ge([U9e,H9e,Y9e,J9e,T9e,P9e]),rlt=et({type:bA("pcb_port"),pcb_port_id:We("pcb_port"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),source_port_id:L(),pcb_component_id:L().optional(),x:Ee,y:Ee,layers:St(Hr),is_board_pinout:PA().optional()}).describe("Defines a port on the PCB"),K9e=et({type:bA("pcb_smtpad"),shape:bA("circle"),pcb_smtpad_id:We("pcb_smtpad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,radius:qA(),layer:Hr,port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),q9e=et({type:bA("pcb_smtpad"),shape:bA("rect"),pcb_smtpad_id:We("pcb_smtpad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),rect_border_radius:qA().optional(),corner_radius:qA().optional(),layer:Hr,port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional(),soldermask_margin_left:qA().optional(),soldermask_margin_top:qA().optional(),soldermask_margin_right:qA().optional(),soldermask_margin_bottom:qA().optional()}),O9e=et({type:bA("pcb_smtpad"),shape:bA("rotated_rect"),pcb_smtpad_id:We("pcb_smtpad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),rect_border_radius:qA().optional(),corner_radius:qA().optional(),ccw_rotation:gC,layer:Hr,port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional(),soldermask_margin_left:qA().optional(),soldermask_margin_top:qA().optional(),soldermask_margin_right:qA().optional(),soldermask_margin_bottom:qA().optional()}),alt=et({type:bA("pcb_smtpad"),shape:bA("pill"),pcb_smtpad_id:We("pcb_smtpad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),radius:qA(),layer:Hr,port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),W9e=et({type:bA("pcb_smtpad"),shape:bA("rotated_pill"),pcb_smtpad_id:We("pcb_smtpad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),radius:qA(),ccw_rotation:gC,layer:Hr,port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),Z9e=et({type:bA("pcb_smtpad"),shape:bA("polygon"),pcb_smtpad_id:We("pcb_smtpad"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),points:St(Bn),layer:Hr,port_hints:St(L()).optional(),pcb_component_id:L().optional(),pcb_port_id:L().optional(),is_covered_with_solder_mask:PA().optional(),soldermask_margin:qA().optional()}),glt=df("shape",[K9e,q9e,O9e,W9e,alt,Z9e]).describe("Defines an SMT pad on the PCB"),V9e=et({type:bA("pcb_solder_paste"),shape:bA("circle"),pcb_solder_paste_id:We("pcb_solder_paste"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,radius:qA(),layer:Hr,pcb_component_id:L().optional(),pcb_smtpad_id:L().optional()}),j9e=et({type:bA("pcb_solder_paste"),shape:bA("rect"),pcb_solder_paste_id:We("pcb_solder_paste"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),layer:Hr,pcb_component_id:L().optional(),pcb_smtpad_id:L().optional()}),z9e=et({type:bA("pcb_solder_paste"),shape:bA("pill"),pcb_solder_paste_id:We("pcb_solder_paste"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),radius:qA(),layer:Hr,pcb_component_id:L().optional(),pcb_smtpad_id:L().optional()}),X9e=et({type:bA("pcb_solder_paste"),shape:bA("rotated_rect"),pcb_solder_paste_id:We("pcb_solder_paste"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),ccw_rotation:Ee,layer:Hr,pcb_component_id:L().optional(),pcb_smtpad_id:L().optional()}),$9e=et({type:bA("pcb_solder_paste"),shape:bA("oval"),pcb_solder_paste_id:We("pcb_solder_paste"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),x:Ee,y:Ee,width:qA(),height:qA(),layer:Hr,pcb_component_id:L().optional(),pcb_smtpad_id:L().optional()}),clt=Ge([V9e,j9e,z9e,X9e,$9e]).describe("Defines solderpaste on the PCB"),Ilt=et({type:bA("pcb_text"),pcb_text_id:We("pcb_text"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),text:L(),center:Bn,layer:Hr,width:rn,height:rn,lines:qA(),align:Xt(["bottom-left"])}).describe("Defines text on the PCB"),llt=et({route_type:bA("wire"),x:Ee,y:Ee,width:Ee,copper_pour_id:L().optional(),is_inside_copper_pour:PA().optional(),start_pcb_port_id:L().optional(),end_pcb_port_id:L().optional(),layer:Hr}),Blt=et({route_type:bA("via"),x:Ee,y:Ee,copper_pour_id:L().optional(),is_inside_copper_pour:PA().optional(),hole_diameter:Ee.optional(),outer_diameter:Ee.optional(),from_layer:L(),to_layer:L()}),Clt=Ge([llt,Blt]),Qlt=et({type:bA("pcb_trace"),source_trace_id:L().optional(),pcb_component_id:L().optional(),pcb_trace_id:We("pcb_trace"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),route_thickness_mode:Xt(["constant","interpolated"]).default("constant").optional(),route_order_index:qA().optional(),should_round_corners:PA().optional(),trace_length:qA().optional(),highlight_color:L().optional(),route:St(Clt)}).describe("Defines a trace on the PCB"),hlt=tc.extend({type:bA("pcb_trace_error"),pcb_trace_error_id:We("pcb_trace_error"),error_type:bA("pcb_trace_error").default("pcb_trace_error"),center:Bn.optional(),pcb_trace_id:L(),source_trace_id:L(),pcb_component_ids:St(L()),pcb_port_ids:St(L()),subcircuit_id:L().optional()}).describe("Defines a trace error on the PCB"),Elt=tc.extend({type:bA("pcb_trace_missing_error"),pcb_trace_missing_error_id:We("pcb_trace_missing_error"),error_type:bA("pcb_trace_missing_error").default("pcb_trace_missing_error"),center:Bn.optional(),source_trace_id:L(),pcb_component_ids:St(L()),pcb_port_ids:St(L()),subcircuit_id:L().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),ult=tc.extend({type:bA("pcb_port_not_matched_error"),pcb_error_id:We("pcb_error"),error_type:bA("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),pcb_component_ids:St(L()),subcircuit_id:L().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),dlt=tc.extend({type:bA("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:We("pcb_port_not_connected_error"),error_type:bA("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),pcb_port_ids:St(L()),pcb_component_ids:St(L()),subcircuit_id:L().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),plt=et({type:bA("pcb_net"),pcb_net_id:We("pcb_net"),source_net_id:L().optional(),highlight_color:L().optional()}).describe("Defines a net on the PCB"),flt=et({type:bA("pcb_via"),pcb_via_id:We("pcb_via"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),subcircuit_connectivity_map_key:L().optional(),x:Ee,y:Ee,outer_diameter:Ee.default("0.6mm"),hole_diameter:Ee.default("0.25mm"),from_layer:Hr.optional(),to_layer:Hr.optional(),layers:St(Hr),pcb_trace_id:L().optional(),net_is_assignable:PA().optional(),net_assigned:PA().optional(),is_tented:PA().optional()}).describe("Defines a via on the PCB"),ylt=et({type:bA("pcb_board"),pcb_board_id:We("pcb_board"),pcb_panel_id:L().optional(),carrier_pcb_board_id:L().optional(),is_subcircuit:PA().optional(),subcircuit_id:L().optional(),is_mounted_to_carrier_board:PA().optional(),width:rn.optional(),height:rn.optional(),center:Bn,display_offset_x:L().optional().describe("How to display the x offset for this board, usually corresponding with how the user specified it"),display_offset_y:L().optional().describe("How to display the y offset for this board, usually corresponding with how the user specified it"),thickness:rn.optional().default(1.4),num_layers:qA().optional().default(4),outline:St(Bn).optional(),shape:Xt(["rect","polygon"]).optional(),material:Xt(["fr4","fr1"]).default("fr4"),anchor_position:Bn.optional(),anchor_alignment:jb.optional(),position_mode:Xt(["relative_to_panel_anchor","none"]).optional()}).describe("Defines the board outline of the PCB"),mlt=et({type:bA("pcb_panel"),pcb_panel_id:We("pcb_panel"),width:rn,height:rn,center:Bn,covered_with_solder_mask:PA().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards"),wlt=tc.extend({type:bA("pcb_placement_error"),pcb_placement_error_id:We("pcb_placement_error"),error_type:bA("pcb_placement_error").default("pcb_placement_error"),subcircuit_id:L().optional()}).describe("Defines a placement error on the PCB"),Dlt=tc.extend({type:bA("pcb_panelization_placement_error"),pcb_panelization_placement_error_id:We("pcb_panelization_placement_error"),error_type:bA("pcb_panelization_placement_error").default("pcb_panelization_placement_error"),pcb_panel_id:L().optional(),pcb_board_id:L().optional(),subcircuit_id:L().optional()}).describe("Defines a panelization placement error on the PCB"),Slt=et({type:bA("pcb_trace_hint"),pcb_trace_hint_id:We("pcb_trace_hint"),pcb_port_id:L(),pcb_component_id:L(),route:St(zIt),subcircuit_id:L().optional()}).describe("A hint that can be used during generation of a PCB trace"),blt=et({type:bA("pcb_silkscreen_line"),pcb_silkscreen_line_id:We("pcb_silkscreen_line"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),stroke_width:Ee.default("0.1mm"),x1:Ee,y1:Ee,x2:Ee,y2:Ee,layer:fm}).describe("Defines a silkscreen line on the PCB"),xlt=et({type:bA("pcb_silkscreen_path"),pcb_silkscreen_path_id:We("pcb_silkscreen_path"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),layer:fm,route:St(Bn),stroke_width:rn}).describe("Defines a silkscreen path on the PCB"),_lt=et({type:bA("pcb_silkscreen_text"),pcb_silkscreen_text_id:We("pcb_silkscreen_text"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),font:bA("tscircuit2024").default("tscircuit2024"),font_size:Ee.default("0.2mm"),pcb_component_id:L(),text:L(),is_knockout:PA().default(!1).optional(),knockout_padding:et({left:rn,top:rn,bottom:rn,right:rn}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:qA().optional(),layer:Hr,is_mirrored:PA().default(!1).optional(),anchor_position:Bn.default({x:0,y:0}),anchor_alignment:jb.default("center")}).describe("Defines silkscreen text on the PCB"),klt=et({type:bA("pcb_copper_text"),pcb_copper_text_id:We("pcb_copper_text"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),font:bA("tscircuit2024").default("tscircuit2024"),font_size:Ee.default("0.2mm"),pcb_component_id:L(),text:L(),is_knockout:PA().default(!1).optional(),knockout_padding:et({left:rn,top:rn,bottom:rn,right:rn}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:qA().optional(),layer:Hr,is_mirrored:PA().default(!1).optional(),anchor_position:Bn.default({x:0,y:0}),anchor_alignment:jb.default("center")}).describe("Defines copper text on the PCB"),vlt=et({type:bA("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:We("pcb_silkscreen_rect"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,width:rn,height:rn,layer:Hr,stroke_width:rn.default("1mm"),corner_radius:rn.optional(),is_filled:PA().default(!0).optional(),has_stroke:PA().optional(),is_stroke_dashed:PA().optional(),ccw_rotation:qA().optional()}).describe("Defines a silkscreen rect on the PCB"),Flt=et({type:bA("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:We("pcb_silkscreen_circle"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,radius:rn,layer:fm,stroke_width:rn.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),Mlt=et({type:bA("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:We("pcb_silkscreen_oval"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,radius_x:Ee,radius_y:Ee,layer:fm,ccw_rotation:gC.optional()}).describe("Defines a silkscreen oval on the PCB"),Glt=et({type:bA("pcb_silkscreen_pill"),pcb_silkscreen_pill_id:We("pcb_silkscreen_pill"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,width:rn,height:rn,layer:Hr,ccw_rotation:qA().optional()}).describe("Defines a silkscreen pill on the PCB"),Rlt=et({type:bA("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:We("pcb_fabrication_note_text"),subcircuit_id:L().optional(),pcb_group_id:L().optional(),font:bA("tscircuit2024").default("tscircuit2024"),font_size:Ee.default("1mm"),pcb_component_id:L(),text:L(),layer:fm,anchor_position:Bn.default({x:0,y:0}),anchor_alignment:Xt(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:L().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),Nlt=et({type:bA("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:We("pcb_fabrication_note_path"),pcb_component_id:L(),subcircuit_id:L().optional(),layer:Hr,route:St(Bn),stroke_width:rn,color:L().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),Llt=et({type:bA("pcb_fabrication_note_rect"),pcb_fabrication_note_rect_id:We("pcb_fabrication_note_rect"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,width:rn,height:rn,layer:fm,stroke_width:rn.default("0.1mm"),corner_radius:rn.optional(),is_filled:PA().optional(),has_stroke:PA().optional(),is_stroke_dashed:PA().optional(),color:L().optional()}).describe("Defines a fabrication note rectangle on the PCB"),Ult=et({type:bA("pcb_fabrication_note_dimension"),pcb_fabrication_note_dimension_id:We("pcb_fabrication_note_dimension"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),layer:fm,from:Bn,to:Bn,text:L().optional(),text_ccw_rotation:qA().optional(),offset:rn.optional(),offset_distance:rn.optional(),offset_direction:et({x:qA(),y:qA()}).optional(),font:bA("tscircuit2024").default("tscircuit2024"),font_size:rn.default("1mm"),color:L().optional(),arrow_size:rn.default("1mm")}).describe("Defines a measurement annotation within PCB fabrication notes"),Hlt=et({type:bA("pcb_note_text"),pcb_note_text_id:We("pcb_note_text"),pcb_component_id:L().optional(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),name:L().optional(),font:bA("tscircuit2024").default("tscircuit2024"),font_size:Ee.default("1mm"),text:L().optional(),anchor_position:Bn.default({x:0,y:0}),anchor_alignment:Xt(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:L().optional()}).describe("Defines a documentation note in text on the PCB"),Ylt=et({type:bA("pcb_note_rect"),pcb_note_rect_id:We("pcb_note_rect"),pcb_component_id:L().optional(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),name:L().optional(),text:L().optional(),center:Bn,width:rn,height:rn,stroke_width:rn.default("0.1mm"),corner_radius:rn.optional(),is_filled:PA().optional(),has_stroke:PA().optional(),is_stroke_dashed:PA().optional(),color:L().optional()}).describe("Defines a rectangular documentation note on the PCB"),Jlt=et({type:bA("pcb_note_path"),pcb_note_path_id:We("pcb_note_path"),pcb_component_id:L().optional(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),name:L().optional(),text:L().optional(),route:St(Bn),stroke_width:rn.default("0.1mm"),color:L().optional()}).describe("Defines a polyline documentation note on the PCB"),Tlt=et({type:bA("pcb_note_line"),pcb_note_line_id:We("pcb_note_line"),pcb_component_id:L().optional(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),name:L().optional(),text:L().optional(),x1:Ee,y1:Ee,x2:Ee,y2:Ee,stroke_width:Ee.default("0.1mm"),color:L().optional(),is_dashed:PA().optional()}).describe("Defines a straight documentation note line on the PCB"),Plt=et({type:bA("pcb_note_dimension"),pcb_note_dimension_id:We("pcb_note_dimension"),pcb_component_id:L().optional(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),name:L().optional(),from:Bn,to:Bn,text:L().optional(),text_ccw_rotation:qA().optional(),offset_distance:rn.optional(),offset_direction:et({x:qA(),y:qA()}).optional(),font:bA("tscircuit2024").default("tscircuit2024"),font_size:rn.default("1mm"),color:L().optional(),arrow_size:rn.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes"),Klt=tc.extend({type:bA("pcb_footprint_overlap_error"),pcb_error_id:We("pcb_error"),error_type:bA("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),pcb_smtpad_ids:St(L()).optional(),pcb_plated_hole_ids:St(L()).optional(),pcb_hole_ids:St(L()).optional(),pcb_keepout_ids:St(L()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),qlt=tc.extend({type:bA("pcb_courtyard_overlap_error"),pcb_error_id:We("pcb_error"),error_type:bA("pcb_courtyard_overlap_error").default("pcb_courtyard_overlap_error"),pcb_component_ids:PLt([L(),L()])}).describe("Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another"),Olt=et({type:bA("pcb_keepout"),shape:bA("rect"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,width:Ee,height:Ee,pcb_keepout_id:L(),layers:St(L()),description:L().optional()}).or(et({type:bA("pcb_keepout"),shape:bA("circle"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,radius:Ee,pcb_keepout_id:L(),layers:St(L()),description:L().optional()})),lj=et({type:bA("pcb_cutout"),pcb_cutout_id:We("pcb_cutout"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),pcb_board_id:L().optional(),pcb_panel_id:L().optional()}),Wlt=lj.extend({shape:bA("rect"),center:Bn,width:rn,height:rn,rotation:gC.optional(),corner_radius:rn.optional()}),Zlt=lj.extend({shape:bA("circle"),center:Bn,radius:rn}),Vlt=lj.extend({shape:bA("polygon"),points:St(Bn)}),jlt=lj.extend({shape:bA("path"),route:St(Bn),slot_width:rn,slot_length:rn.optional(),space_between_slots:rn.optional(),slot_corner_radius:rn.optional()}),zlt=df("shape",[Wlt,Zlt,Vlt,jlt]).describe("Defines a cutout on the PCB, removing board material."),Xlt=tc.extend({type:bA("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:We("pcb_missing_footprint_error"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),error_type:bA("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:L()}).describe("Defines a missing footprint error on the PCB"),$lt=tc.extend({type:bA("external_footprint_load_error"),external_footprint_load_error_id:We("external_footprint_load_error"),pcb_component_id:L(),source_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),footprinter_string:L().optional(),error_type:bA("external_footprint_load_error").default("external_footprint_load_error")}).describe("Defines an error when an external footprint fails to load"),ABt=tc.extend({type:bA("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:We("circuit_json_footprint_load_error"),pcb_component_id:L(),source_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),error_type:bA("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),circuit_json:St(AI()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),tBt=et({type:bA("pcb_group"),pcb_group_id:We("pcb_group"),source_group_id:L(),is_subcircuit:PA().optional(),subcircuit_id:L().optional(),width:rn.optional(),height:rn.optional(),center:Bn,display_offset_x:L().optional().describe("How to display the x offset for this group, usually corresponding with how the user specified it"),display_offset_y:L().optional().describe("How to display the y offset for this group, usually corresponding with how the user specified it"),outline:St(Bn).optional(),anchor_position:Bn.optional(),anchor_alignment:jb.default("center"),position_mode:Xt(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:L().optional(),positioned_relative_to_pcb_board_id:L().optional(),pcb_component_ids:St(L()),child_layout_mode:Xt(["packed","none"]).optional(),name:L().optional(),description:L().optional(),layout_mode:L().optional(),autorouter_configuration:et({trace_clearance:rn}).optional(),autorouter_used_string:L().optional()}).describe("Defines a group of components on the PCB"),eBt=tc.extend({type:bA("pcb_autorouting_error"),pcb_error_id:We("pcb_autorouting_error"),error_type:bA("pcb_autorouting_error").default("pcb_autorouting_error"),subcircuit_id:L().optional()}).describe("The autorouting has failed to route a portion of the board"),iBt=et({type:bA("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:We("pcb_manual_edit_conflict_warning"),warning_type:bA("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:L(),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),source_component_id:L()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),nBt=Xt(["x-","x+","y+","y-"]),oBt=et({type:bA("pcb_connector_not_in_accessible_orientation_warning"),pcb_connector_not_in_accessible_orientation_warning_id:We("pcb_connector_not_in_accessible_orientation_warning"),warning_type:bA("pcb_connector_not_in_accessible_orientation_warning").default("pcb_connector_not_in_accessible_orientation_warning"),message:L(),pcb_component_id:L(),source_component_id:L().optional(),pcb_board_id:L().optional(),facing_direction:nBt,recommended_facing_direction:nBt,subcircuit_id:L().optional()}).describe("Warning emitted when a connector PCB component is facing inward toward the board and should be reoriented to an outward-facing direction"),sBt=et({type:bA("pcb_breakout_point"),pcb_breakout_point_id:We("pcb_breakout_point"),pcb_group_id:L(),subcircuit_id:L().optional(),source_trace_id:L().optional(),source_port_id:L().optional(),source_net_id:L().optional(),x:Ee,y:Ee}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),rBt=et({type:bA("pcb_ground_plane"),pcb_ground_plane_id:We("pcb_ground_plane"),source_pcb_ground_plane_id:L(),source_net_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional()}).describe("Defines a ground plane on the PCB"),aBt=et({type:bA("pcb_ground_plane_region"),pcb_ground_plane_region_id:We("pcb_ground_plane_region"),pcb_ground_plane_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),layer:Hr,points:St(Bn)}).describe("Defines a polygon region of a ground plane"),gBt=et({type:bA("pcb_thermal_spoke"),pcb_thermal_spoke_id:We("pcb_thermal_spoke"),pcb_ground_plane_id:L(),shape:L(),spoke_count:qA(),spoke_thickness:Ee,spoke_inner_diameter:Ee,spoke_outer_diameter:Ee,pcb_plated_hole_id:L().optional(),subcircuit_id:L().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),b0A=et({type:bA("pcb_copper_pour"),pcb_copper_pour_id:We("pcb_copper_pour"),pcb_group_id:L().optional(),subcircuit_id:L().optional(),layer:Hr,source_net_id:L().optional(),covered_with_solder_mask:PA().optional().default(!0)}),cBt=b0A.extend({shape:bA("rect"),center:Bn,width:rn,height:rn,rotation:gC.optional()}),IBt=b0A.extend({shape:bA("brep"),brep_shape:VIt}),lBt=b0A.extend({shape:bA("polygon"),points:St(Bn)}),BBt=df("shape",[cBt,IBt,lBt]).describe("Defines a copper pour on the PCB."),CBt=tc.extend({type:bA("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:We("pcb_component_outside_board_error"),error_type:bA("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),pcb_component_id:L(),pcb_board_id:L(),component_center:Bn,component_bounds:et({min_x:qA(),max_x:qA(),min_y:qA(),max_y:qA()}),subcircuit_id:L().optional(),source_component_id:L().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),QBt=tc.extend({type:bA("pcb_component_not_on_board_edge_error"),pcb_component_not_on_board_edge_error_id:We("pcb_component_not_on_board_edge_error"),error_type:bA("pcb_component_not_on_board_edge_error").default("pcb_component_not_on_board_edge_error"),pcb_component_id:L(),pcb_board_id:L(),component_center:Bn,pad_to_nearest_board_edge_distance:qA(),source_component_id:L().optional(),subcircuit_id:L().optional()}).describe("Error emitted when a component that must be placed on the board edge is centered away from the edge"),hBt=tc.extend({type:bA("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:We("pcb_component_invalid_layer_error"),error_type:bA("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),pcb_component_id:L().optional(),source_component_id:L(),layer:Hr,subcircuit_id:L().optional()}).describe("Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)"),EBt=tc.extend({type:bA("pcb_via_clearance_error"),pcb_error_id:We("pcb_error"),error_type:bA("pcb_via_clearance_error").default("pcb_via_clearance_error"),pcb_via_ids:St(L()).min(2),minimum_clearance:Ee.optional(),actual_clearance:Ee.optional(),pcb_center:et({x:qA().optional(),y:qA().optional()}).optional(),subcircuit_id:L().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),uBt=et({type:bA("pcb_courtyard_rect"),pcb_courtyard_rect_id:We("pcb_courtyard_rect"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,width:rn,height:rn,layer:fm,ccw_rotation:gC.optional(),color:L().optional()}).describe("Defines a courtyard rectangle on the PCB"),dBt=et({type:bA("pcb_courtyard_outline"),pcb_courtyard_outline_id:We("pcb_courtyard_outline"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),layer:fm,outline:St(Bn).min(2)}).describe("Defines a courtyard outline on the PCB"),pBt=et({type:bA("pcb_courtyard_polygon"),pcb_courtyard_polygon_id:We("pcb_courtyard_polygon"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),layer:fm,points:St(Bn).min(3),color:L().optional()}).describe("Defines a courtyard polygon on the PCB"),fBt=et({type:bA("pcb_courtyard_circle"),pcb_courtyard_circle_id:We("pcb_courtyard_circle"),pcb_component_id:L(),pcb_group_id:L().optional(),subcircuit_id:L().optional(),center:Bn,radius:rn,layer:fm,color:L().optional()}).describe("Defines a courtyard circle on the PCB"),Aje=["obj","stl","3mf","gltf","glb","step","wrl"],yBt=["x+","x-","y+","y-","z+","z-"],tje={obj:"z+",stl:"z+","3mf":"z+",gltf:"y+",glb:"y+",step:"z+",wrl:"y+"},mBt=et({type:bA("cad_component"),cad_component_id:L(),pcb_component_id:L(),source_component_id:L(),position:Vb,rotation:Vb.optional(),size:Vb.optional(),layer:Hr.optional(),subcircuit_id:L().optional(),footprinter_string:L().optional(),model_obj_url:L().optional(),model_stl_url:L().optional(),model_3mf_url:L().optional(),model_gltf_url:L().optional(),model_glb_url:L().optional(),model_step_url:L().optional(),model_wrl_url:L().optional(),model_asset:Mct.optional(),model_unit_to_mm_scale_factor:qA().optional(),model_board_normal_direction:Xt(yBt).optional().describe(`The direction in the model's coordinate space that is considered "up" or "coming out of the board surface"`),model_origin_position:Vb.optional(),model_origin_alignment:Xt(["unknown","center","center_of_component_on_board_surface","bottom_center_of_component"]).optional(),model_object_fit:Xt(["contain_within_bounds","fill_bounds"]).optional().default("contain_within_bounds"),model_jscad:AI().optional(),show_as_translucent_model:PA().optional(),anchor_alignment:Xt(["center","center_of_component_on_board_surface"]).optional().default("center")}).describe("Defines a component on the PCB"),x0A=Xt(["sinewave","square","triangle","sawtooth"]),eje=Ge([L(),qA()]).transform(e=>typeof e=="string"?e.endsWith("%")?parseFloat(e.slice(0,-1))/100:parseFloat(e):e).pipe(qA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),wBt=et({type:bA("simulation_voltage_source"),simulation_voltage_source_id:We("simulation_voltage_source"),is_dc_source:bA(!0).optional().default(!0),positive_source_port_id:L().optional(),negative_source_port_id:L().optional(),positive_source_net_id:L().optional(),negative_source_net_id:L().optional(),voltage:Zb}).describe("Defines a DC voltage source for simulation"),DBt=et({type:bA("simulation_voltage_source"),simulation_voltage_source_id:We("simulation_voltage_source"),is_dc_source:bA(!1),terminal1_source_port_id:L().optional(),terminal2_source_port_id:L().optional(),terminal1_source_net_id:L().optional(),terminal2_source_net_id:L().optional(),voltage:Zb.optional(),frequency:dM.optional(),peak_to_peak_voltage:Zb.optional(),wave_shape:x0A.optional(),phase:gC.optional(),duty_cycle:eje.optional()}).describe("Defines an AC voltage source for simulation"),SBt=Ge([wBt,DBt]).describe("Defines a voltage source for simulation"),ije=Ge([L(),qA()]).transform(e=>typeof e=="string"?e.endsWith("%")?parseFloat(e.slice(0,-1))/100:parseFloat(e):e).pipe(qA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),bBt=et({type:bA("simulation_current_source"),simulation_current_source_id:We("simulation_current_source"),is_dc_source:bA(!0).optional().default(!0),positive_source_port_id:L().optional(),negative_source_port_id:L().optional(),positive_source_net_id:L().optional(),negative_source_net_id:L().optional(),current:A1}).describe("Defines a DC current source for simulation"),xBt=et({type:bA("simulation_current_source"),simulation_current_source_id:We("simulation_current_source"),is_dc_source:bA(!1),terminal1_source_port_id:L().optional(),terminal2_source_port_id:L().optional(),terminal1_source_net_id:L().optional(),terminal2_source_net_id:L().optional(),current:A1.optional(),frequency:dM.optional(),peak_to_peak_current:A1.optional(),wave_shape:x0A.optional(),phase:gC.optional(),duty_cycle:ije.optional()}).describe("Defines an AC current source for simulation"),_Bt=Ge([bBt,xBt]).describe("Defines a current source for simulation"),kBt=Ge([bA("spice_dc_sweep"),bA("spice_dc_operating_point"),bA("spice_transient_analysis"),bA("spice_ac_analysis")]),vBt=et({type:bA("simulation_experiment"),simulation_experiment_id:We("simulation_experiment"),name:L(),experiment_type:kBt,time_per_step:cT.optional(),start_time_ms:pM.optional(),end_time_ms:pM.optional()}).describe("Defines a simulation experiment configuration"),FBt=et({type:bA("simulation_transient_voltage_graph"),simulation_transient_voltage_graph_id:We("simulation_transient_voltage_graph"),simulation_experiment_id:L(),timestamps_ms:St(qA()).optional(),voltage_levels:St(qA()),source_component_id:L().optional(),subcircuit_connectivity_map_key:L().optional(),time_per_step:cT,start_time_ms:pM,end_time_ms:pM,name:L().optional(),color:L().optional()}).describe("Stores voltage measurements over time for a simulation"),MBt=et({type:bA("simulation_switch"),simulation_switch_id:We("simulation_switch"),source_component_id:L().optional(),closes_at:pM.optional(),opens_at:pM.optional(),starts_closed:PA().optional(),switching_frequency:dM.optional()}).describe("Defines a switch for simulation timing control"),GBt=et({type:bA("simulation_voltage_probe"),simulation_voltage_probe_id:We("simulation_voltage_probe"),source_component_id:L().optional(),name:L().optional(),signal_input_source_port_id:L().optional(),signal_input_source_net_id:L().optional(),reference_input_source_port_id:L().optional(),reference_input_source_net_id:L().optional(),subcircuit_id:L().optional(),color:L().optional()}).describe("Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.").superRefine((e,A)=>{if(e.reference_input_source_port_id||e.reference_input_source_net_id){const i=!!e.signal_input_source_port_id||!!e.reference_input_source_port_id,n=!!e.signal_input_source_net_id||!!e.reference_input_source_net_id;i&&n?A.addIssue({code:ze.custom,message:"Cannot mix port and net connections in a differential probe."}):i?(!e.signal_input_source_port_id||!e.reference_input_source_port_id)&&A.addIssue({code:ze.custom,message:"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."}):n&&(!e.signal_input_source_net_id||!e.reference_input_source_net_id)&&A.addIssue({code:ze.custom,message:"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."})}else!!e.signal_input_source_port_id==!!e.signal_input_source_net_id&&A.addIssue({code:ze.custom,message:"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."})}),RBt=tc.extend({type:bA("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:We("simulation_unknown_experiment_error"),error_type:bA("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),simulation_experiment_id:L().optional(),subcircuit_id:L().optional()}).describe("An unknown error occurred during the simulation experiment."),NBt=et({type:bA("simulation_op_amp"),simulation_op_amp_id:We("simulation_op_amp"),source_component_id:L().optional(),inverting_input_source_port_id:L(),non_inverting_input_source_port_id:L(),output_source_port_id:L(),positive_supply_source_port_id:L(),negative_supply_source_port_id:L()}).describe("Defines a simple ideal operational amplifier for simulation"),LBt=Ge([rIt,oIt,sIt,nIt,gIt,aIt,s0A,i0A,cj,o0A,n0A,r0A,a0A,g0A,l0A,B0A,C0A,d0A,Q0A,h0A,E0A,u0A,I0A,c0A,lIt,CIt,cIt,p0A,f0A,y0A,m0A,QIt,hIt,EIt,uIt,dIt,w0A,IIt,XIt,olt,Xlt,$lt,ABt,iBt,oBt,slt,Olt,rlt,plt,Ilt,Qlt,flt,glt,clt,ylt,mlt,tBt,Slt,blt,xlt,_lt,Glt,klt,vlt,Flt,Mlt,hlt,Elt,wlt,Dlt,ult,dlt,EBt,Nlt,Rlt,Llt,Ult,Hlt,Ylt,Jlt,Tlt,Plt,eBt,Klt,qlt,sBt,zlt,rBt,aBt,gBt,BBt,CBt,QBt,hBt,uBt,dBt,pBt,fBt,pIt,MIt,xIt,_It,kIt,vIt,SIt,bIt,GIt,FIt,fIt,NIt,LIt,RIt,JIt,TIt,PIt,KIt,WIt,qIt,OIt,mBt,SBt,_Bt,vBt,FBt,MBt,GBt,RBt,NBt]),Bj=LBt;const _0A=Object.freeze(Object.defineProperty({__proto__:null,all_layers:BIt,any_circuit_element:LBt,any_soup_element:Bj,any_source_component:nIt,asset:Mct,base_circuit_json_error:tc,battery_capacity:Fct,brep_shape:VIt,cadModelDefaultDirectionMap:tje,cad_component:mBt,cad_model_axis_directions:yBt,cad_model_formats:Aje,capacitance:A0A,circuit_json_footprint_load_error:ABt,current:A1,distance:Ee,duration_ms:cT,experiment_type:kBt,external_footprint_load_error:$lt,frequency:dM,getZodPrefixedIdWithDefault:We,inductance:kct,kicadAt:gj,kicadEffects:Gct,kicadFont:e0A,kicadFootprintAttributes:Nct,kicadFootprintMetadata:Hct,kicadFootprintModel:Uct,kicadFootprintPad:Lct,kicadFootprintProperties:Rct,kicadProperty:IT,kicadSymbolEffects:Tct,kicadSymbolMetadata:Kct,kicadSymbolPinNames:Jct,kicadSymbolPinNumbers:Yct,kicadSymbolProperties:Pct,kicadSymbolProperty:kk,layer_ref:Hr,layer_string:D0A,length:rn,ms:pM,ninePointAnchor:jb,pcbRenderLayer:b9e,pcb_autorouting_error:eBt,pcb_board:ylt,pcb_breakout_point:sBt,pcb_component:XIt,pcb_component_invalid_layer_error:hBt,pcb_component_not_on_board_edge_error:QBt,pcb_component_outside_board_error:CBt,pcb_connector_not_in_accessible_orientation_warning:oBt,pcb_copper_pour:BBt,pcb_copper_pour_brep:IBt,pcb_copper_pour_polygon:lBt,pcb_copper_pour_rect:cBt,pcb_copper_text:klt,pcb_courtyard_circle:fBt,pcb_courtyard_outline:dBt,pcb_courtyard_overlap_error:qlt,pcb_courtyard_polygon:pBt,pcb_courtyard_rect:uBt,pcb_cutout:zlt,pcb_cutout_circle:Zlt,pcb_cutout_path:jlt,pcb_cutout_polygon:Vlt,pcb_cutout_rect:Wlt,pcb_fabrication_note_dimension:Ult,pcb_fabrication_note_path:Nlt,pcb_fabrication_note_rect:Llt,pcb_fabrication_note_text:Rlt,pcb_footprint_overlap_error:Klt,pcb_ground_plane:rBt,pcb_ground_plane_region:aBt,pcb_group:tBt,pcb_hole:olt,pcb_hole_circle_or_square_shape:G9e,pcb_hole_circle_shape:F9e,pcb_hole_oval_shape:R9e,pcb_hole_pill_shape:N9e,pcb_hole_rect_shape:M9e,pcb_hole_rotated_pill_shape:L9e,pcb_keepout:Olt,pcb_manual_edit_conflict_warning:iBt,pcb_missing_footprint_error:Xlt,pcb_net:plt,pcb_note_dimension:Plt,pcb_note_line:Tlt,pcb_note_path:Jlt,pcb_note_rect:Ylt,pcb_note_text:Hlt,pcb_panel:mlt,pcb_panelization_placement_error:Dlt,pcb_placement_error:wlt,pcb_plated_hole:slt,pcb_port:rlt,pcb_port_not_connected_error:dlt,pcb_port_not_matched_error:ult,pcb_route_hint:jIt,pcb_route_hints:v9e,pcb_silkscreen_circle:Flt,pcb_silkscreen_line:blt,pcb_silkscreen_oval:Mlt,pcb_silkscreen_path:xlt,pcb_silkscreen_pill:Glt,pcb_silkscreen_rect:vlt,pcb_silkscreen_text:_lt,pcb_smtpad:glt,pcb_smtpad_pill:alt,pcb_solder_paste:clt,pcb_text:Ilt,pcb_thermal_spoke:gBt,pcb_trace:Qlt,pcb_trace_error:hlt,pcb_trace_hint:Slt,pcb_trace_missing_error:Elt,pcb_trace_route_point:Clt,pcb_trace_route_point_via:Blt,pcb_trace_route_point_wire:llt,pcb_via:flt,pcb_via_clearance_error:EBt,point:Bn,point3:Vb,point_with_bulge:ZIt,port_arrangement:DIt,position:w9e,position3:D9e,resistance:aj,ring:S0A,rotation:gC,route_hint_point:zIt,schematic_arc:vIt,schematic_box:pIt,schematic_circle:kIt,schematic_component:SIt,schematic_component_port_arrangement_by_sides:wIt,schematic_component_port_arrangement_by_size:mIt,schematic_debug_line:HIt,schematic_debug_object:JIt,schematic_debug_object_base:Ij,schematic_debug_point:YIt,schematic_debug_rect:UIt,schematic_error:NIt,schematic_group:KIt,schematic_layout_error:LIt,schematic_line:xIt,schematic_manual_edit_conflict_warning:PIt,schematic_net_label:RIt,schematic_path:fIt,schematic_pin_styles:yIt,schematic_port:GIt,schematic_rect:_It,schematic_sheet:WIt,schematic_symbol:bIt,schematic_table:qIt,schematic_table_cell:OIt,schematic_text:MIt,schematic_trace:FIt,schematic_voltage_probe:TIt,simulation_ac_current_source:xBt,simulation_ac_voltage_source:DBt,simulation_current_source:_Bt,simulation_dc_current_source:bBt,simulation_dc_voltage_source:wBt,simulation_experiment:vBt,simulation_op_amp:NBt,simulation_switch:MBt,simulation_transient_voltage_graph:FBt,simulation_unknown_experiment_error:RBt,simulation_voltage_probe:GBt,simulation_voltage_source:SBt,size:t0A,source_ambiguous_port_reference:IIt,source_board:cIt,source_component_base:bc,source_component_internal_connection:sIt,source_component_pins_underspecified_warning:EIt,source_failed_to_create_component_error:$ct,source_group:aIt,source_i2c_misconfigured_error:w0A,source_interconnect:eIt,source_invalid_component_property_error:f0A,source_manually_placed_via:CIt,source_missing_property_error:Xct,source_net:gIt,source_no_ground_pin_defined_warning:hIt,source_no_power_pin_defined_warning:QIt,source_pcb_ground_plane:lIt,source_pin_attributes:Vct,source_pin_missing_trace_warning:m0A,source_pin_must_be_connected_error:uIt,source_port:oIt,source_project_metadata:p0A,source_property_ignored_warning:AIt,source_simple_battery:a0A,source_simple_capacitor:i0A,source_simple_chip:s0A,source_simple_connector:zct,source_simple_crystal:jct,source_simple_current_source:Zct,source_simple_diode:cj,source_simple_fiducial:Oct,source_simple_ground:Wct,source_simple_inductor:g0A,source_simple_led:o0A,source_simple_mosfet:E0A,source_simple_op_amp:u0A,source_simple_pin_header:l0A,source_simple_pinout:B0A,source_simple_potentiometer:I0A,source_simple_power_source:r0A,source_simple_push_button:c0A,source_simple_resistor:n0A,source_simple_resonator:C0A,source_simple_switch:d0A,source_simple_test_point:h0A,source_simple_transistor:Q0A,source_simple_voltage_probe:tIt,source_simple_voltage_source:iIt,source_trace:rIt,source_trace_not_connected_error:y0A,supplier_name:qct,time:m9e,timestamp:vct,unknown_error_finding_part:dIt,visible_layer:fm,voltage:Zb,wave_shape:x0A},Symbol.toStringTag,{value:"Module"})),nje={},UBt=e=>{let A;const t=new Set,i=(c,I)=>{const l=typeof c=="function"?c(A):c;if(!Object.is(l,A)){const B=A;A=I??(typeof l!="object"||l===null)?l:Object.assign({},A,l),t.forEach(C=>C(A,B))}},n=()=>A,a={setState:i,getState:n,getInitialState:()=>g,subscribe:c=>(t.add(c),()=>t.delete(c)),destroy:()=>{(nje?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},g=A=e(i,n,a);return a},HBt=e=>e?UBt(e):UBt;var Cj={exports:{}},k0A={},Qj={exports:{}},v0A={};var YBt;function oje(){if(YBt)return v0A;YBt=1;var e=x0();function A(I,l){return I===l&&(I!==0||1/I===1/l)||I!==I&&l!==l}var t=typeof Object.is=="function"?Object.is:A,i=e.useState,n=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function r(I,l){var B=l(),C=i({inst:{value:B,getSnapshot:l}}),Q=C[0].inst,h=C[1];return o(function(){Q.value=B,Q.getSnapshot=l,a(Q)&&h({inst:Q})},[I,B,l]),n(function(){return a(Q)&&h({inst:Q}),I(function(){a(Q)&&h({inst:Q})})},[I]),s(B),B}function a(I){var l=I.getSnapshot;I=I.value;try{var B=l();return!t(I,B)}catch{return!0}}function g(I,l){return l()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:r;return v0A.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:c,v0A}var F0A={},JBt;function sje(){if(JBt)return F0A;JBt=1;var e={env:{}};return e.env.NODE_ENV!=="production"&&(function(){function A(C,Q){return C===Q&&(C!==0||1/C===1/Q)||C!==C&&Q!==Q}function t(C,Q){I||o.startTransition===void 0||(I=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=Q();if(!l){var E=Q();s(h,E)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}E=r({inst:{value:h,getSnapshot:Q}});var u=E[0].inst,d=E[1];return g(function(){u.value=h,u.getSnapshot=Q,i(u)&&d({inst:u})},[C,h,Q]),a(function(){return i(u)&&d({inst:u}),C(function(){i(u)&&d({inst:u})})},[C]),c(h),h}function i(C){var Q=C.getSnapshot;C=C.value;try{var h=Q();return!s(C,h)}catch{return!0}}function n(C,Q){return Q()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=x0(),s=typeof Object.is=="function"?Object.is:A,r=o.useState,a=o.useEffect,g=o.useLayoutEffect,c=o.useDebugValue,I=!1,l=!1,B=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;F0A.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:B,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),F0A}var TBt;function PBt(){if(TBt)return Qj.exports;TBt=1;var e={env:{}};return e.env.NODE_ENV==="production"?Qj.exports=oje():Qj.exports=sje(),Qj.exports}var KBt;function rje(){if(KBt)return k0A;KBt=1;var e=x0(),A=PBt();function t(g,c){return g===c&&(g!==0||1/g===1/c)||g!==g&&c!==c}var i=typeof Object.is=="function"?Object.is:t,n=A.useSyncExternalStore,o=e.useRef,s=e.useEffect,r=e.useMemo,a=e.useDebugValue;return k0A.useSyncExternalStoreWithSelector=function(g,c,I,l,B){var C=o(null);if(C.current===null){var Q={hasValue:!1,value:null};C.current=Q}else Q=C.current;C=r(function(){function E(w){if(!u){if(u=!0,d=w,w=l(w),B!==void 0&&Q.hasValue){var D=Q.value;if(B(D,w))return f=D}return f=w}if(D=f,i(d,w))return D;var S=l(w);return B!==void 0&&B(D,S)?(d=w,D):(d=w,f=S)}var u=!1,d,f,m=I===void 0?null:I;return[function(){return E(c())},m===null?void 0:function(){return E(m())}]},[c,I,l,B]);var h=n(g,C[0],C[1]);return s(function(){Q.hasValue=!0,Q.value=h},[h]),a(h),h},k0A}var M0A={},qBt;function aje(){if(qBt)return M0A;qBt=1;var e={env:{}};return e.env.NODE_ENV!=="production"&&(function(){function A(c,I){return c===I&&(c!==0||1/c===1/I)||c!==c&&I!==I}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=x0(),i=PBt(),n=typeof Object.is=="function"?Object.is:A,o=i.useSyncExternalStore,s=t.useRef,r=t.useEffect,a=t.useMemo,g=t.useDebugValue;M0A.useSyncExternalStoreWithSelector=function(c,I,l,B,C){var Q=s(null);if(Q.current===null){var h={hasValue:!1,value:null};Q.current=h}else h=Q.current;Q=a(function(){function u(D){if(!d){if(d=!0,f=D,D=B(D),C!==void 0&&h.hasValue){var S=h.value;if(C(S,D))return m=S}return m=D}if(S=m,n(f,D))return S;var _=B(D);return C!==void 0&&C(S,_)?(f=D,S):(f=D,m=_)}var d=!1,f,m,w=l===void 0?null:l;return[function(){return u(I())},w===null?void 0:function(){return u(w())}]},[I,l,B,C]);var E=o(c,Q[0],Q[1]);return r(function(){h.hasValue=!0,h.value=E},[E]),g(E),E},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),M0A}var OBt;function gje(){if(OBt)return Cj.exports;OBt=1;var e={env:{}};return e.env.NODE_ENV==="production"?Cj.exports=rje():Cj.exports=aje(),Cj.exports}var cje=gje();const Ije=b0(cje),WBt={},{useDebugValue:lje}=Qn,{useSyncExternalStoreWithSelector:Bje}=Ije;let ZBt=!1;const Cje=e=>e;function VBt(e,A=Cje,t){(WBt?"production":void 0)!=="production"&&t&&!ZBt&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),ZBt=!0);const i=Bje(e.subscribe,e.getState,e.getServerState||e.getInitialState,A,t);return lje(i),i}const Qje=e=>{(WBt?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const A=typeof e=="function"?HBt(e):e,t=(i,n)=>VBt(A,i,n);return Object.assign(t,A),t},jBt=e=>Qje,lT=e=>typeof e=="number"&&!isNaN(e),fM=e=>typeof e=="string",X0=e=>typeof e=="function",hj=e=>fM(e)||X0(e)?e:null,G0A=e=>AA.isValidElement(e)||fM(e)||X0(e)||lT(e);function hje(e,A,t){t===void 0&&(t=300);const{scrollHeight:i,style:n}=e;requestAnimationFrame(()=>{n.minHeight="initial",n.height=i+"px",n.transition=`all ${t}ms`,requestAnimationFrame(()=>{n.height="0",n.padding="0",n.margin="0",setTimeout(A,t)})})}function Ej(e){let{enter:A,exit:t,appendPosition:i=!1,collapse:n=!0,collapseDuration:o=300}=e;return function(s){let{children:r,position:a,preventExitTransition:g,done:c,nodeRef:I,isIn:l,playToast:B}=s;const C=i?`${A}--${a}`:A,Q=i?`${t}--${a}`:t,h=AA.useRef(0);return AA.useLayoutEffect(()=>{const E=I.current,u=C.split(" "),d=f=>{f.target===I.current&&(B(),E.removeEventListener("animationend",d),E.removeEventListener("animationcancel",d),h.current===0&&f.type!=="animationcancel"&&E.classList.remove(...u))};E.classList.add(...u),E.addEventListener("animationend",d),E.addEventListener("animationcancel",d)},[]),AA.useEffect(()=>{const E=I.current,u=()=>{E.removeEventListener("animationend",u),n?hje(E,c,o):c()};l||(g?u():(h.current=1,E.className+=` ${Q}`,E.addEventListener("animationend",u)))},[l]),Qn.createElement(Qn.Fragment,null,r)}}function zBt(e,A){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:A}:{}}const op=new Map;let BT=[];const R0A=new Set,Eje=e=>R0A.forEach(A=>A(e)),XBt=()=>op.size>0;function $Bt(e,A){var t;if(A)return!((t=op.get(A))==null||!t.isToastActive(e));let i=!1;return op.forEach(n=>{n.isToastActive(e)&&(i=!0)}),i}function ACt(e,A){G0A(e)&&(XBt()||BT.push({content:e,options:A}),op.forEach(t=>{t.buildToast(e,A)}))}function tCt(e,A){op.forEach(t=>{A!=null&&A!=null&&A.containerId?A?.containerId===t.id&&t.toggle(e,A?.id):t.toggle(e,A?.id)})}function uje(e){const{subscribe:A,getSnapshot:t,setProps:i}=AA.useRef((function(o){const s=o.containerId||1;return{subscribe(r){const a=(function(c,I,l){let B=1,C=0,Q=[],h=[],E=[],u=I;const d=new Map,f=new Set,m=()=>{E=Array.from(d.values()),f.forEach(S=>S())},w=S=>{h=S==null?[]:h.filter(_=>_!==S),m()},D=S=>{const{toastId:_,onOpen:b,updateId:R,children:F}=S.props,H=R==null;S.staleId&&d.delete(S.staleId),d.set(_,S),h=[...h,S.props.toastId].filter(Y=>Y!==S.staleId),m(),l(zBt(S,H?"added":"updated")),H&&X0(b)&&b(AA.isValidElement(F)&&F.props)};return{id:c,props:u,observe:S=>(f.add(S),()=>f.delete(S)),toggle:(S,_)=>{d.forEach(b=>{_!=null&&_!==b.props.toastId||X0(b.toggle)&&b.toggle(S)})},removeToast:w,toasts:d,clearQueue:()=>{C-=Q.length,Q=[]},buildToast:(S,_)=>{if((oA=>{let{containerId:rA,toastId:lA,updateId:pA}=oA;const vA=rA?rA!==c:c!==1,MA=d.has(lA)&&pA==null;return vA||MA})(_))return;const{toastId:b,updateId:R,data:F,staleId:H,delay:Y}=_,J=()=>{w(b)},O=R==null;O&&C++;const W={...u,style:u.toastStyle,key:B++,...Object.fromEntries(Object.entries(_).filter(oA=>{let[rA,lA]=oA;return lA!=null})),toastId:b,updateId:R,data:F,closeToast:J,isIn:!1,className:hj(_.className||u.toastClassName),bodyClassName:hj(_.bodyClassName||u.bodyClassName),progressClassName:hj(_.progressClassName||u.progressClassName),autoClose:!_.isLoading&&(z=_.autoClose,tA=u.autoClose,z===!1||lT(z)&&z>0?z:tA),deleteToast(){const oA=d.get(b),{onClose:rA,children:lA}=oA.props;X0(rA)&&rA(AA.isValidElement(lA)&&lA.props),l(zBt(oA,"removed")),d.delete(b),C--,C<0&&(C=0),Q.length>0?D(Q.shift()):m()}};var z,tA;W.closeButton=u.closeButton,_.closeButton===!1||G0A(_.closeButton)?W.closeButton=_.closeButton:_.closeButton===!0&&(W.closeButton=!G0A(u.closeButton)||u.closeButton);let aA=S;AA.isValidElement(S)&&!fM(S.type)?aA=AA.cloneElement(S,{closeToast:J,toastProps:W,data:F}):X0(S)&&(aA=S({closeToast:J,toastProps:W,data:F}));const eA={content:aA,props:W,staleId:H};u.limit&&u.limit>0&&C>u.limit&&O?Q.push(eA):lT(Y)?setTimeout(()=>{D(eA)},Y):D(eA)},setProps(S){u=S},setToggle:(S,_)=>{d.get(S).toggle=_},isToastActive:S=>h.some(_=>_===S),getSnapshot:()=>E}})(s,o,Eje);op.set(s,a);const g=a.observe(r);return BT.forEach(c=>ACt(c.content,c.options)),BT=[],()=>{g(),op.delete(s)}},setProps(r){var a;(a=op.get(s))==null||a.setProps(r)},getSnapshot(){var r;return(r=op.get(s))==null?void 0:r.getSnapshot()}}})(e)).current;i(e);const n=AA.useSyncExternalStore(A,t,t);return{getToastToRender:function(o){if(!n)return[];const s=new Map;return e.newestOnTop&&n.reverse(),n.forEach(r=>{const{position:a}=r.props;s.has(a)||s.set(a,[]),s.get(a).push(r)}),Array.from(s,r=>o(r[0],r[1]))},isToastActive:$Bt,count:n?.length}}function dje(e){const[A,t]=AA.useState(!1),[i,n]=AA.useState(!1),o=AA.useRef(null),s=AA.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:r,pauseOnHover:a,closeToast:g,onClick:c,closeOnClick:I}=e;var l,B;function C(){t(!0)}function Q(){t(!1)}function h(d){const f=o.current;s.canDrag&&f&&(s.didMove=!0,A&&Q(),s.delta=e.draggableDirection==="x"?d.clientX-s.start:d.clientY-s.start,s.start!==d.clientX&&(s.canCloseOnClick=!1),f.style.transform=`translate3d(${e.draggableDirection==="x"?`${s.delta}px, var(--y)`:`0, calc(${s.delta}px + var(--y))`},0)`,f.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function E(){document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",E);const d=o.current;if(s.canDrag&&s.didMove&&d){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return n(!0),e.closeToast(),void e.collapseAll();d.style.transition="transform 0.2s, opacity 0.2s",d.style.removeProperty("transform"),d.style.removeProperty("opacity")}}(B=op.get((l={id:e.toastId,containerId:e.containerId,fn:t}).containerId||1))==null||B.setToggle(l.id,l.fn),AA.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||Q(),window.addEventListener("focus",C),window.addEventListener("blur",Q),()=>{window.removeEventListener("focus",C),window.removeEventListener("blur",Q)}},[e.pauseOnFocusLoss]);const u={onPointerDown:function(d){if(e.draggable===!0||e.draggable===d.pointerType){s.didMove=!1,document.addEventListener("pointermove",h),document.addEventListener("pointerup",E);const f=o.current;s.canCloseOnClick=!0,s.canDrag=!0,f.style.transition="none",e.draggableDirection==="x"?(s.start=d.clientX,s.removalDistance=f.offsetWidth*(e.draggablePercent/100)):(s.start=d.clientY,s.removalDistance=f.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(d){const{top:f,bottom:m,left:w,right:D}=o.current.getBoundingClientRect();d.nativeEvent.type!=="touchend"&&e.pauseOnHover&&d.clientX>=w&&d.clientX<=D&&d.clientY>=f&&d.clientY<=m?Q():C()}};return r&&a&&(u.onMouseEnter=Q,e.stacked||(u.onMouseLeave=C)),I&&(u.onClick=d=>{c&&c(d),s.canCloseOnClick&&g()}),{playToast:C,pauseToast:Q,isRunning:A,preventExitTransition:i,toastRef:o,eventHandlers:u}}function pje(e){let{delay:A,isRunning:t,closeToast:i,type:n="default",hide:o,className:s,style:r,controlledProgress:a,progress:g,rtl:c,isIn:I,theme:l}=e;const B=o||a&&g===0,C={...r,animationDuration:`${A}ms`,animationPlayState:t?"running":"paused"};a&&(C.transform=`scaleX(${g})`);const Q=Wm("Toastify__progress-bar",a?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${l}`,`Toastify__progress-bar--${n}`,{"Toastify__progress-bar--rtl":c}),h=X0(s)?s({rtl:c,type:n,defaultClassName:Q}):Wm(Q,s),E={[a&&g>=1?"onTransitionEnd":"onAnimationEnd"]:a&&g<1?null:()=>{I&&i()}};return Qn.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":B},Qn.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${l} Toastify__progress-bar--${n}`}),Qn.createElement("div",{role:"progressbar","aria-hidden":B?"true":"false","aria-label":"notification timer",className:h,style:C,...E}))}let fje=1;const eCt=()=>""+fje++;function yje(e){return e&&(fM(e.toastId)||lT(e.toastId))?e.toastId:eCt()}function CT(e,A){return ACt(e,A),A.toastId}function uj(e,A){return{...A,type:A&&A.type||e,toastId:yje(A)}}function dj(e){return(A,t)=>CT(A,uj(e,t))}function ec(e,A){return CT(e,uj("default",A))}ec.loading=(e,A)=>CT(e,uj("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...A})),ec.promise=function(e,A,t){let i,{pending:n,error:o,success:s}=A;n&&(i=fM(n)?ec.loading(n,t):ec.loading(n.render,{...t,...n}));const r={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},a=(c,I,l)=>{if(I==null)return void ec.dismiss(i);const B={type:c,...r,...t,data:l},C=fM(I)?{render:I}:I;return i?ec.update(i,{...B,...C}):ec(C.render,{...B,...C}),l},g=X0(e)?e():e;return g.then(c=>a("success",s,c)).catch(c=>a("error",o,c)),g},ec.success=dj("success"),ec.info=dj("info"),ec.error=dj("error"),ec.warning=dj("warning"),ec.warn=ec.warning,ec.dark=(e,A)=>CT(e,uj("default",{theme:"dark",...A})),ec.dismiss=function(e){(function(A){var t;if(XBt()){if(A==null||fM(t=A)||lT(t))op.forEach(i=>{i.removeToast(A)});else if(A&&("containerId"in A||"id"in A)){const i=op.get(A.containerId);i?i.removeToast(A.id):op.forEach(n=>{n.removeToast(A.id)})}}else BT=BT.filter(i=>A!=null&&i.options.toastId!==A)})(e)},ec.clearWaitingQueue=function(e){e===void 0&&(e={}),op.forEach(A=>{!A.props.limit||e.containerId&&A.id!==e.containerId||A.clearQueue()})},ec.isActive=$Bt,ec.update=function(e,A){A===void 0&&(A={});const t=((i,n)=>{var o;let{containerId:s}=n;return(o=op.get(s||1))==null?void 0:o.toasts.get(i)})(e,A);if(t){const{props:i,content:n}=t,o={delay:100,...i,...A,toastId:A.toastId||e,updateId:eCt()};o.toastId!==e&&(o.staleId=e);const s=o.render||n;delete o.render,CT(s,o)}},ec.done=e=>{ec.update(e,{progress:1})},ec.onChange=function(e){return R0A.add(e),()=>{R0A.delete(e)}},ec.play=e=>tCt(!0,e),ec.pause=e=>tCt(!1,e);const mje=typeof window<"u"?AA.useLayoutEffect:AA.useEffect,pj=e=>{let{theme:A,type:t,isLoading:i,...n}=e;return Qn.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:A==="colored"?"currentColor":`var(--toastify-icon-color-${t})`,...n})},N0A={info:function(e){return Qn.createElement(pj,{...e},Qn.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return Qn.createElement(pj,{...e},Qn.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return Qn.createElement(pj,{...e},Qn.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return Qn.createElement(pj,{...e},Qn.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return Qn.createElement("div",{className:"Toastify__spinner"})}},wje=e=>{const{isRunning:A,preventExitTransition:t,toastRef:i,eventHandlers:n,playToast:o}=dje(e),{closeButton:s,children:r,autoClose:a,onClick:g,type:c,hideProgressBar:I,closeToast:l,transition:B,position:C,className:Q,style:h,bodyClassName:E,bodyStyle:u,progressClassName:d,progressStyle:f,updateId:m,role:w,progress:D,rtl:S,toastId:_,deleteToast:b,isIn:R,isLoading:F,closeOnClick:H,theme:Y}=e,J=Wm("Toastify__toast",`Toastify__toast-theme--${Y}`,`Toastify__toast--${c}`,{"Toastify__toast--rtl":S},{"Toastify__toast--close-on-click":H}),O=X0(Q)?Q({rtl:S,position:C,type:c,defaultClassName:J}):Wm(J,Q),W=(function(eA){let{theme:oA,type:rA,isLoading:lA,icon:pA}=eA,vA=null;const MA={theme:oA,type:rA};return pA===!1||(X0(pA)?vA=pA({...MA,isLoading:lA}):AA.isValidElement(pA)?vA=AA.cloneElement(pA,MA):lA?vA=N0A.spinner():(YA=>YA in N0A)(rA)&&(vA=N0A[rA](MA))),vA})(e),z=!!D||!a,tA={closeToast:l,type:c,theme:Y};let aA=null;return s===!1||(aA=X0(s)?s(tA):AA.isValidElement(s)?AA.cloneElement(s,tA):(function(eA){let{closeToast:oA,theme:rA,ariaLabel:lA="close"}=eA;return Qn.createElement("button",{className:`Toastify__close-button Toastify__close-button--${rA}`,type:"button",onClick:pA=>{pA.stopPropagation(),oA(pA)},"aria-label":lA},Qn.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},Qn.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))})(tA)),Qn.createElement(B,{isIn:R,done:b,position:C,preventExitTransition:t,nodeRef:i,playToast:o},Qn.createElement("div",{id:_,onClick:g,"data-in":R,className:O,...n,style:h,ref:i},Qn.createElement("div",{...R&&{role:w},className:X0(E)?E({type:c}):Wm("Toastify__toast-body",E),style:u},W!=null&&Qn.createElement("div",{className:Wm("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!F})},W),Qn.createElement("div",null,r)),aA,Qn.createElement(pje,{...m&&!z?{key:`pb-${m}`}:{},rtl:S,theme:Y,delay:a,isRunning:A,isIn:R,closeToast:l,hide:I,type:c,style:f,className:d,controlledProgress:z,progress:D||0})))},fj=function(e,A){return A===void 0&&(A=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:A}},Dje=Ej(fj("bounce",!0));Ej(fj("slide",!0)),Ej(fj("zoom")),Ej(fj("flip"));const Sje={position:"top-right",transition:Dje,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function bje(e){let A={...Sje,...e};const t=e.stacked,[i,n]=AA.useState(!0),o=AA.useRef(null),{getToastToRender:s,isToastActive:r,count:a}=uje(A),{className:g,style:c,rtl:I,containerId:l}=A;function B(Q){const h=Wm("Toastify__toast-container",`Toastify__toast-container--${Q}`,{"Toastify__toast-container--rtl":I});return X0(g)?g({position:Q,rtl:I,defaultClassName:h}):Wm(h,hj(g))}function C(){t&&(n(!0),ec.play())}return mje(()=>{if(t){var Q;const h=o.current.querySelectorAll('[data-in="true"]'),E=12,u=(Q=A.position)==null?void 0:Q.includes("top");let d=0,f=0;Array.from(h).reverse().forEach((m,w)=>{const D=m;D.classList.add("Toastify__toast--stacked"),w>0&&(D.dataset.collapsed=`${i}`),D.dataset.pos||(D.dataset.pos=u?"top":"bot");const S=d*(i?.2:1)+(i?0:E*w);D.style.setProperty("--y",`${u?S:-1*S}px`),D.style.setProperty("--g",`${E}`),D.style.setProperty("--s",""+(1-(i?f:0))),d+=D.offsetHeight,f+=.025})}},[i,a,t]),Qn.createElement("div",{ref:o,className:"Toastify",id:l,onMouseEnter:()=>{t&&(n(!1),ec.pause())},onMouseLeave:C},s((Q,h)=>{const E=h.length?{...c}:{...c,pointerEvents:"none"};return Qn.createElement("div",{className:B(Q),style:E,key:`container-${Q}`},h.map(u=>{let{content:d,props:f}=u;return Qn.createElement(wje,{...f,stacked:t,collapseAll:C,isIn:r(f.toastId,f.containerId),style:f.style,key:`toast-${f.key}`},d)}))}))}function xje(){var e=':root{--toastify-color-light:#fff;--toastify-color-dark:#121212;--toastify-color-info:#3498db;--toastify-color-success:#07bc0c;--toastify-color-warning:#f1c40f;--toastify-color-error:#e74c3c;--toastify-color-transparent:hsla(0,0%,100%,.7);--toastify-icon-color-info:var(--toastify-color-info);--toastify-icon-color-success:var(--toastify-color-success);--toastify-icon-color-warning:var(--toastify-color-warning);--toastify-icon-color-error:var(--toastify-color-error);--toastify-toast-width:320px;--toastify-toast-offset:16px;--toastify-toast-top:max(var(--toastify-toast-offset),env(safe-area-inset-top));--toastify-toast-right:max(var(--toastify-toast-offset),env(safe-area-inset-right));--toastify-toast-left:max(var(--toastify-toast-offset),env(safe-area-inset-left));--toastify-toast-bottom:max(var(--toastify-toast-offset),env(safe-area-inset-bottom));--toastify-toast-background:#fff;--toastify-toast-min-height:64px;--toastify-toast-max-height:800px;--toastify-toast-bd-radius:6px;--toastify-font-family:sans-serif;--toastify-z-index:9999;--toastify-text-color-light:#757575;--toastify-text-color-dark:#fff;--toastify-text-color-info:#fff;--toastify-text-color-success:#fff;--toastify-text-color-warning:#fff;--toastify-text-color-error:#fff;--toastify-spinner-color:#616161;--toastify-spinner-color-empty-area:#e0e0e0;--toastify-color-progress-light:linear-gradient(90deg,#4cd964,#5ac8fa,#007aff,#34aadc,#5856d6,#ff2d55);--toastify-color-progress-dark:#bb86fc;--toastify-color-progress-info:var(--toastify-color-info);--toastify-color-progress-success:var(--toastify-color-success);--toastify-color-progress-warning:var(--toastify-color-warning);--toastify-color-progress-error:var(--toastify-color-error);--toastify-color-progress-bgo:0.2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translateZ(var(--toastify-z-index));position:fixed;padding:4px;width:var(--toastify-toast-width);box-sizing:border-box;color:#fff}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translateX(-50%)}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right)}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translateX(-50%)}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right)}@media only screen and (max-width:480px){.Toastify__toast-container{width:100vw;padding:0;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-center,.Toastify__toast-container--top-left,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translateX(0)}.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translateX(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:auto}}.Toastify__toast{--y:0;position:relative;-ms-touch-action:none;touch-action:none;min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:8px;border-radius:var(--toastify-toast-bd-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);cursor:default;direction:ltr;z-index:0;overflow:hidden}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__close-button,.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-body{margin:auto 0;-ms-flex:1 1 auto;flex:1 1 auto;padding:6px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.Toastify__toast-body>div:last-child{word-break:break-word;-ms-flex:1;flex:1}.Toastify__toast-icon{-webkit-margin-end:10px;margin-inline-end:10px;width:20px;-ms-flex-negative:0;flex-shrink:0;display:-ms-flexbox;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}@media only screen and (max-width:480px){.Toastify__toast{margin-bottom:0;border-radius:0}}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--colored.Toastify__toast--default,.Toastify__toast-theme--light{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;-ms-flex-item-align:start;align-self:flex-start;z-index:1}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:focus,.Toastify__close-button:hover{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:var(--toastify-z-index);opacity:.7;transform-origin:left;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:auto;transform-origin:right;border-bottom-left-radius:0;border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp{position:absolute;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--bottom-left,.Toastify__bounce-enter--top-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--bottom-right,.Toastify__bounce-enter--top-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--bottom-left,.Toastify__bounce-exit--top-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--bottom-right,.Toastify__bounce-exit--top-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--bottom-left,.Toastify__slide-enter--top-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--bottom-right,.Toastify__slide-enter--top-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--bottom-left,.Toastify__slide-exit--top-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-right,.Toastify__slide-exit--top-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}',A=document.createElement("style");A.innerText=e,document.head.appendChild(A)}var L0A={exports:{}},U0A,iCt;function nCt(){return iCt||(iCt=1,U0A={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),U0A}var H0A={exports:{}},Y0A,oCt;function _je(){return oCt||(oCt=1,Y0A=function(A){return!A||typeof A=="string"?!1:A instanceof Array||Array.isArray(A)||A.length>=0&&(A.splice instanceof Function||Object.getOwnPropertyDescriptor(A,A.length-1)&&A.constructor.name!=="String")}),Y0A}var sCt;function kje(){if(sCt)return H0A.exports;sCt=1;var e=_je(),A=Array.prototype.concat,t=Array.prototype.slice,i=H0A.exports=function(o){for(var s=[],r=0,a=o.length;r<a;r++){var g=o[r];e(g)?s=A.call(s,t.call(g)):s.push(g)}return s};return i.wrap=function(n){return function(){return n(i(arguments))}},H0A.exports}var rCt;function vje(){if(rCt)return L0A.exports;rCt=1;var e=nCt(),A=kje(),t=Object.hasOwnProperty,i=Object.create(null);for(var n in e)t.call(e,n)&&(i[e[n]]=n);var o=L0A.exports={to:{},get:{}};o.get=function(a){var g=a.substring(0,3).toLowerCase(),c,I;switch(g){case"hsl":c=o.get.hsl(a),I="hsl";break;case"hwb":c=o.get.hwb(a),I="hwb";break;default:c=o.get.rgb(a),I="rgb";break}return c?{model:I,value:c}:null},o.get.rgb=function(a){if(!a)return null;var g=/^#([a-f0-9]{3,4})$/i,c=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,I=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,l=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,B=/^(\w+)$/,C=[0,0,0,1],Q,h,E;if(Q=a.match(c)){for(E=Q[2],Q=Q[1],h=0;h<3;h++){var u=h*2;C[h]=parseInt(Q.slice(u,u+2),16)}E&&(C[3]=parseInt(E,16)/255)}else if(Q=a.match(g)){for(Q=Q[1],E=Q[3],h=0;h<3;h++)C[h]=parseInt(Q[h]+Q[h],16);E&&(C[3]=parseInt(E+E,16)/255)}else if(Q=a.match(I)){for(h=0;h<3;h++)C[h]=parseInt(Q[h+1],0);Q[4]&&(Q[5]?C[3]=parseFloat(Q[4])*.01:C[3]=parseFloat(Q[4]))}else if(Q=a.match(l)){for(h=0;h<3;h++)C[h]=Math.round(parseFloat(Q[h+1])*2.55);Q[4]&&(Q[5]?C[3]=parseFloat(Q[4])*.01:C[3]=parseFloat(Q[4]))}else return(Q=a.match(B))?Q[1]==="transparent"?[0,0,0,0]:t.call(e,Q[1])?(C=e[Q[1]],C[3]=1,C):null:null;for(h=0;h<3;h++)C[h]=s(C[h],0,255);return C[3]=s(C[3],0,1),C},o.get.hsl=function(a){if(!a)return null;var g=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,c=a.match(g);if(c){var I=parseFloat(c[4]),l=(parseFloat(c[1])%360+360)%360,B=s(parseFloat(c[2]),0,100),C=s(parseFloat(c[3]),0,100),Q=s(isNaN(I)?1:I,0,1);return[l,B,C,Q]}return null},o.get.hwb=function(a){if(!a)return null;var g=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,c=a.match(g);if(c){var I=parseFloat(c[4]),l=(parseFloat(c[1])%360+360)%360,B=s(parseFloat(c[2]),0,100),C=s(parseFloat(c[3]),0,100),Q=s(isNaN(I)?1:I,0,1);return[l,B,C,Q]}return null},o.to.hex=function(){var a=A(arguments);return"#"+r(a[0])+r(a[1])+r(a[2])+(a[3]<1?r(Math.round(a[3]*255)):"")},o.to.rgb=function(){var a=A(arguments);return a.length<4||a[3]===1?"rgb("+Math.round(a[0])+", "+Math.round(a[1])+", "+Math.round(a[2])+")":"rgba("+Math.round(a[0])+", "+Math.round(a[1])+", "+Math.round(a[2])+", "+a[3]+")"},o.to.rgb.percent=function(){var a=A(arguments),g=Math.round(a[0]/255*100),c=Math.round(a[1]/255*100),I=Math.round(a[2]/255*100);return a.length<4||a[3]===1?"rgb("+g+"%, "+c+"%, "+I+"%)":"rgba("+g+"%, "+c+"%, "+I+"%, "+a[3]+")"},o.to.hsl=function(){var a=A(arguments);return a.length<4||a[3]===1?"hsl("+a[0]+", "+a[1]+"%, "+a[2]+"%)":"hsla("+a[0]+", "+a[1]+"%, "+a[2]+"%, "+a[3]+")"},o.to.hwb=function(){var a=A(arguments),g="";return a.length>=4&&a[3]!==1&&(g=", "+a[3]),"hwb("+a[0]+", "+a[1]+"%, "+a[2]+"%"+g+")"},o.to.keyword=function(a){return i[a.slice(0,3)]};function s(a,g,c){return Math.min(Math.max(g,a),c)}function r(a){var g=Math.round(a).toString(16).toUpperCase();return g.length<2?"0"+g:g}return L0A.exports}var J0A,aCt;function gCt(){if(aCt)return J0A;aCt=1;const e=nCt(),A={};for(const n of Object.keys(e))A[e[n]]=n;const t={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};J0A=t;for(const n of Object.keys(t)){if(!("channels"in t[n]))throw new Error("missing channels property: "+n);if(!("labels"in t[n]))throw new Error("missing channel labels property: "+n);if(t[n].labels.length!==t[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:o,labels:s}=t[n];delete t[n].channels,delete t[n].labels,Object.defineProperty(t[n],"channels",{value:o}),Object.defineProperty(t[n],"labels",{value:s})}t.rgb.hsl=function(n){const o=n[0]/255,s=n[1]/255,r=n[2]/255,a=Math.min(o,s,r),g=Math.max(o,s,r),c=g-a;let I,l;g===a?I=0:o===g?I=(s-r)/c:s===g?I=2+(r-o)/c:r===g&&(I=4+(o-s)/c),I=Math.min(I*60,360),I<0&&(I+=360);const B=(a+g)/2;return g===a?l=0:B<=.5?l=c/(g+a):l=c/(2-g-a),[I,l*100,B*100]},t.rgb.hsv=function(n){let o,s,r,a,g;const c=n[0]/255,I=n[1]/255,l=n[2]/255,B=Math.max(c,I,l),C=B-Math.min(c,I,l),Q=function(h){return(B-h)/6/C+1/2};return C===0?(a=0,g=0):(g=C/B,o=Q(c),s=Q(I),r=Q(l),c===B?a=r-s:I===B?a=1/3+o-r:l===B&&(a=2/3+s-o),a<0?a+=1:a>1&&(a-=1)),[a*360,g*100,B*100]},t.rgb.hwb=function(n){const o=n[0],s=n[1];let r=n[2];const a=t.rgb.hsl(n)[0],g=1/255*Math.min(o,Math.min(s,r));return r=1-1/255*Math.max(o,Math.max(s,r)),[a,g*100,r*100]},t.rgb.cmyk=function(n){const o=n[0]/255,s=n[1]/255,r=n[2]/255,a=Math.min(1-o,1-s,1-r),g=(1-o-a)/(1-a)||0,c=(1-s-a)/(1-a)||0,I=(1-r-a)/(1-a)||0;return[g*100,c*100,I*100,a*100]};function i(n,o){return(n[0]-o[0])**2+(n[1]-o[1])**2+(n[2]-o[2])**2}return t.rgb.keyword=function(n){const o=A[n];if(o)return o;let s=1/0,r;for(const a of Object.keys(e)){const g=e[a],c=i(n,g);c<s&&(s=c,r=a)}return r},t.keyword.rgb=function(n){return e[n]},t.rgb.xyz=function(n){let o=n[0]/255,s=n[1]/255,r=n[2]/255;o=o>.04045?((o+.055)/1.055)**2.4:o/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const a=o*.4124+s*.3576+r*.1805,g=o*.2126+s*.7152+r*.0722,c=o*.0193+s*.1192+r*.9505;return[a*100,g*100,c*100]},t.rgb.lab=function(n){const o=t.rgb.xyz(n);let s=o[0],r=o[1],a=o[2];s/=95.047,r/=100,a/=108.883,s=s>.008856?s**(1/3):7.787*s+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;const g=116*r-16,c=500*(s-r),I=200*(r-a);return[g,c,I]},t.hsl.rgb=function(n){const o=n[0]/360,s=n[1]/100,r=n[2]/100;let a,g,c;if(s===0)return c=r*255,[c,c,c];r<.5?a=r*(1+s):a=r+s-r*s;const I=2*r-a,l=[0,0,0];for(let B=0;B<3;B++)g=o+1/3*-(B-1),g<0&&g++,g>1&&g--,6*g<1?c=I+(a-I)*6*g:2*g<1?c=a:3*g<2?c=I+(a-I)*(2/3-g)*6:c=I,l[B]=c*255;return l},t.hsl.hsv=function(n){const o=n[0];let s=n[1]/100,r=n[2]/100,a=s;const g=Math.max(r,.01);r*=2,s*=r<=1?r:2-r,a*=g<=1?g:2-g;const c=(r+s)/2,I=r===0?2*a/(g+a):2*s/(r+s);return[o,I*100,c*100]},t.hsv.rgb=function(n){const o=n[0]/60,s=n[1]/100;let r=n[2]/100;const a=Math.floor(o)%6,g=o-Math.floor(o),c=255*r*(1-s),I=255*r*(1-s*g),l=255*r*(1-s*(1-g));switch(r*=255,a){case 0:return[r,l,c];case 1:return[I,r,c];case 2:return[c,r,l];case 3:return[c,I,r];case 4:return[l,c,r];case 5:return[r,c,I]}},t.hsv.hsl=function(n){const o=n[0],s=n[1]/100,r=n[2]/100,a=Math.max(r,.01);let g,c;c=(2-s)*r;const I=(2-s)*a;return g=s*a,g/=I<=1?I:2-I,g=g||0,c/=2,[o,g*100,c*100]},t.hwb.rgb=function(n){const o=n[0]/360;let s=n[1]/100,r=n[2]/100;const a=s+r;let g;a>1&&(s/=a,r/=a);const c=Math.floor(6*o),I=1-r;g=6*o-c,(c&1)!==0&&(g=1-g);const l=s+g*(I-s);let B,C,Q;switch(c){default:case 6:case 0:B=I,C=l,Q=s;break;case 1:B=l,C=I,Q=s;break;case 2:B=s,C=I,Q=l;break;case 3:B=s,C=l,Q=I;break;case 4:B=l,C=s,Q=I;break;case 5:B=I,C=s,Q=l;break}return[B*255,C*255,Q*255]},t.cmyk.rgb=function(n){const o=n[0]/100,s=n[1]/100,r=n[2]/100,a=n[3]/100,g=1-Math.min(1,o*(1-a)+a),c=1-Math.min(1,s*(1-a)+a),I=1-Math.min(1,r*(1-a)+a);return[g*255,c*255,I*255]},t.xyz.rgb=function(n){const o=n[0]/100,s=n[1]/100,r=n[2]/100;let a,g,c;return a=o*3.2406+s*-1.5372+r*-.4986,g=o*-.9689+s*1.8758+r*.0415,c=o*.0557+s*-.204+r*1.057,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,g=g>.0031308?1.055*g**(1/2.4)-.055:g*12.92,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,a=Math.min(Math.max(0,a),1),g=Math.min(Math.max(0,g),1),c=Math.min(Math.max(0,c),1),[a*255,g*255,c*255]},t.xyz.lab=function(n){let o=n[0],s=n[1],r=n[2];o/=95.047,s/=100,r/=108.883,o=o>.008856?o**(1/3):7.787*o+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;const a=116*s-16,g=500*(o-s),c=200*(s-r);return[a,g,c]},t.lab.xyz=function(n){const o=n[0],s=n[1],r=n[2];let a,g,c;g=(o+16)/116,a=s/500+g,c=g-r/200;const I=g**3,l=a**3,B=c**3;return g=I>.008856?I:(g-16/116)/7.787,a=l>.008856?l:(a-16/116)/7.787,c=B>.008856?B:(c-16/116)/7.787,a*=95.047,g*=100,c*=108.883,[a,g,c]},t.lab.lch=function(n){const o=n[0],s=n[1],r=n[2];let a;a=Math.atan2(r,s)*360/2/Math.PI,a<0&&(a+=360);const c=Math.sqrt(s*s+r*r);return[o,c,a]},t.lch.lab=function(n){const o=n[0],s=n[1],a=n[2]/360*2*Math.PI,g=s*Math.cos(a),c=s*Math.sin(a);return[o,g,c]},t.rgb.ansi16=function(n,o=null){const[s,r,a]=n;let g=o===null?t.rgb.hsv(n)[2]:o;if(g=Math.round(g/50),g===0)return 30;let c=30+(Math.round(a/255)<<2|Math.round(r/255)<<1|Math.round(s/255));return g===2&&(c+=60),c},t.hsv.ansi16=function(n){return t.rgb.ansi16(t.hsv.rgb(n),n[2])},t.rgb.ansi256=function(n){const o=n[0],s=n[1],r=n[2];return o===s&&s===r?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(s/255*5)+Math.round(r/255*5)},t.ansi16.rgb=function(n){let o=n%10;if(o===0||o===7)return n>50&&(o+=3.5),o=o/10.5*255,[o,o,o];const s=(~~(n>50)+1)*.5,r=(o&1)*s*255,a=(o>>1&1)*s*255,g=(o>>2&1)*s*255;return[r,a,g]},t.ansi256.rgb=function(n){if(n>=232){const g=(n-232)*10+8;return[g,g,g]}n-=16;let o;const s=Math.floor(n/36)/5*255,r=Math.floor((o=n%36)/6)/5*255,a=o%6/5*255;return[s,r,a]},t.rgb.hex=function(n){const s=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(s.length)+s},t.hex.rgb=function(n){const o=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!o)return[0,0,0];let s=o[0];o[0].length===3&&(s=s.split("").map(I=>I+I).join(""));const r=parseInt(s,16),a=r>>16&255,g=r>>8&255,c=r&255;return[a,g,c]},t.rgb.hcg=function(n){const o=n[0]/255,s=n[1]/255,r=n[2]/255,a=Math.max(Math.max(o,s),r),g=Math.min(Math.min(o,s),r),c=a-g;let I,l;return c<1?I=g/(1-c):I=0,c<=0?l=0:a===o?l=(s-r)/c%6:a===s?l=2+(r-o)/c:l=4+(o-s)/c,l/=6,l%=1,[l*360,c*100,I*100]},t.hsl.hcg=function(n){const o=n[1]/100,s=n[2]/100,r=s<.5?2*o*s:2*o*(1-s);let a=0;return r<1&&(a=(s-.5*r)/(1-r)),[n[0],r*100,a*100]},t.hsv.hcg=function(n){const o=n[1]/100,s=n[2]/100,r=o*s;let a=0;return r<1&&(a=(s-r)/(1-r)),[n[0],r*100,a*100]},t.hcg.rgb=function(n){const o=n[0]/360,s=n[1]/100,r=n[2]/100;if(s===0)return[r*255,r*255,r*255];const a=[0,0,0],g=o%1*6,c=g%1,I=1-c;let l=0;switch(Math.floor(g)){case 0:a[0]=1,a[1]=c,a[2]=0;break;case 1:a[0]=I,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=c;break;case 3:a[0]=0,a[1]=I,a[2]=1;break;case 4:a[0]=c,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=I}return l=(1-s)*r,[(s*a[0]+l)*255,(s*a[1]+l)*255,(s*a[2]+l)*255]},t.hcg.hsv=function(n){const o=n[1]/100,s=n[2]/100,r=o+s*(1-o);let a=0;return r>0&&(a=o/r),[n[0],a*100,r*100]},t.hcg.hsl=function(n){const o=n[1]/100,r=n[2]/100*(1-o)+.5*o;let a=0;return r>0&&r<.5?a=o/(2*r):r>=.5&&r<1&&(a=o/(2*(1-r))),[n[0],a*100,r*100]},t.hcg.hwb=function(n){const o=n[1]/100,s=n[2]/100,r=o+s*(1-o);return[n[0],(r-o)*100,(1-r)*100]},t.hwb.hcg=function(n){const o=n[1]/100,r=1-n[2]/100,a=r-o;let g=0;return a<1&&(g=(r-a)/(1-a)),[n[0],a*100,g*100]},t.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]},t.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]},t.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]},t.gray.hsl=function(n){return[0,0,n[0]]},t.gray.hsv=t.gray.hsl,t.gray.hwb=function(n){return[0,100,n[0]]},t.gray.cmyk=function(n){return[0,0,0,n[0]]},t.gray.lab=function(n){return[n[0],0,0]},t.gray.hex=function(n){const o=Math.round(n[0]/100*255)&255,r=((o<<16)+(o<<8)+o).toString(16).toUpperCase();return"000000".substring(r.length)+r},t.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]},J0A}var T0A,cCt;function Fje(){if(cCt)return T0A;cCt=1;const e=gCt();function A(){const o={},s=Object.keys(e);for(let r=s.length,a=0;a<r;a++)o[s[a]]={distance:-1,parent:null};return o}function t(o){const s=A(),r=[o];for(s[o].distance=0;r.length;){const a=r.pop(),g=Object.keys(e[a]);for(let c=g.length,I=0;I<c;I++){const l=g[I],B=s[l];B.distance===-1&&(B.distance=s[a].distance+1,B.parent=a,r.unshift(l))}}return s}function i(o,s){return function(r){return s(o(r))}}function n(o,s){const r=[s[o].parent,o];let a=e[s[o].parent][o],g=s[o].parent;for(;s[g].parent;)r.unshift(s[g].parent),a=i(e[s[g].parent][g],a),g=s[g].parent;return a.conversion=r,a}return T0A=function(o){const s=t(o),r={},a=Object.keys(s);for(let g=a.length,c=0;c<g;c++){const I=a[c];s[I].parent!==null&&(r[I]=n(I,s))}return r},T0A}var P0A,ICt;function Mje(){if(ICt)return P0A;ICt=1;const e=gCt(),A=Fje(),t={},i=Object.keys(e);function n(s){const r=function(...a){const g=a[0];return g==null?g:(g.length>1&&(a=g),s(a))};return"conversion"in s&&(r.conversion=s.conversion),r}function o(s){const r=function(...a){const g=a[0];if(g==null)return g;g.length>1&&(a=g);const c=s(a);if(typeof c=="object")for(let I=c.length,l=0;l<I;l++)c[l]=Math.round(c[l]);return c};return"conversion"in s&&(r.conversion=s.conversion),r}return i.forEach(s=>{t[s]={},Object.defineProperty(t[s],"channels",{value:e[s].channels}),Object.defineProperty(t[s],"labels",{value:e[s].labels});const r=A(s);Object.keys(r).forEach(g=>{const c=r[g];t[s][g]=o(c),t[s][g].raw=n(c)})}),P0A=t,P0A}var K0A,lCt;function Gje(){if(lCt)return K0A;lCt=1;const e=vje(),A=Mje(),t=["keyword","gray","hex"],i={};for(const l of Object.keys(A))i[[...A[l].labels].sort().join("")]=l;const n={};function o(l,B){if(!(this instanceof o))return new o(l,B);if(B&&B in t&&(B=null),B&&!(B in A))throw new Error("Unknown model: "+B);let C,Q;if(l==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(l instanceof o)this.model=l.model,this.color=[...l.color],this.valpha=l.valpha;else if(typeof l=="string"){const h=e.get(l);if(h===null)throw new Error("Unable to parse color from string: "+l);this.model=h.model,Q=A[this.model].channels,this.color=h.value.slice(0,Q),this.valpha=typeof h.value[Q]=="number"?h.value[Q]:1}else if(l.length>0){this.model=B||"rgb",Q=A[this.model].channels;const h=Array.prototype.slice.call(l,0,Q);this.color=I(h,Q),this.valpha=typeof l[Q]=="number"?l[Q]:1}else if(typeof l=="number")this.model="rgb",this.color=[l>>16&255,l>>8&255,l&255],this.valpha=1;else{this.valpha=1;const h=Object.keys(l);"alpha"in l&&(h.splice(h.indexOf("alpha"),1),this.valpha=typeof l.alpha=="number"?l.alpha:0);const E=h.sort().join("");if(!(E in i))throw new Error("Unable to parse color from object: "+JSON.stringify(l));this.model=i[E];const{labels:u}=A[this.model],d=[];for(C=0;C<u.length;C++)d.push(l[u[C]]);this.color=I(d)}if(n[this.model])for(Q=A[this.model].channels,C=0;C<Q;C++){const h=n[this.model][C];h&&(this.color[C]=h(this.color[C]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}o.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(l){let B=this.model in e.to?this:this.rgb();B=B.round(typeof l=="number"?l:1);const C=B.valpha===1?B.color:[...B.color,this.valpha];return e.to[B.model](C)},percentString(l){const B=this.rgb().round(typeof l=="number"?l:1),C=B.valpha===1?B.color:[...B.color,this.valpha];return e.to.rgb.percent(C)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const l={},{channels:B}=A[this.model],{labels:C}=A[this.model];for(let Q=0;Q<B;Q++)l[C[Q]]=this.color[Q];return this.valpha!==1&&(l.alpha=this.valpha),l},unitArray(){const l=this.rgb().color;return l[0]/=255,l[1]/=255,l[2]/=255,this.valpha!==1&&l.push(this.valpha),l},unitObject(){const l=this.rgb().object();return l.r/=255,l.g/=255,l.b/=255,this.valpha!==1&&(l.alpha=this.valpha),l},round(l){return l=Math.max(l||0,0),new o([...this.color.map(r(l)),this.valpha],this.model)},alpha(l){return l!==void 0?new o([...this.color,Math.max(0,Math.min(1,l))],this.model):this.valpha},red:a("rgb",0,g(255)),green:a("rgb",1,g(255)),blue:a("rgb",2,g(255)),hue:a(["hsl","hsv","hsl","hwb","hcg"],0,l=>(l%360+360)%360),saturationl:a("hsl",1,g(100)),lightness:a("hsl",2,g(100)),saturationv:a("hsv",1,g(100)),value:a("hsv",2,g(100)),chroma:a("hcg",1,g(100)),gray:a("hcg",2,g(100)),white:a("hwb",1,g(100)),wblack:a("hwb",2,g(100)),cyan:a("cmyk",0,g(100)),magenta:a("cmyk",1,g(100)),yellow:a("cmyk",2,g(100)),black:a("cmyk",3,g(100)),x:a("xyz",0,g(95.047)),y:a("xyz",1,g(100)),z:a("xyz",2,g(108.833)),l:a("lab",0,g(100)),a:a("lab",1),b:a("lab",2),keyword(l){return l!==void 0?new o(l):A[this.model].keyword(this.color)},hex(l){return l!==void 0?new o(l):e.to.hex(this.rgb().round().color)},hexa(l){if(l!==void 0)return new o(l);const B=this.rgb().round().color;let C=Math.round(this.valpha*255).toString(16).toUpperCase();return C.length===1&&(C="0"+C),e.to.hex(B)+C},rgbNumber(){const l=this.rgb().color;return(l[0]&255)<<16|(l[1]&255)<<8|l[2]&255},luminosity(){const l=this.rgb().color,B=[];for(const[C,Q]of l.entries()){const h=Q/255;B[C]=h<=.04045?h/12.92:((h+.055)/1.055)**2.4}return .2126*B[0]+.7152*B[1]+.0722*B[2]},contrast(l){const B=this.luminosity(),C=l.luminosity();return B>C?(B+.05)/(C+.05):(C+.05)/(B+.05)},level(l){const B=this.contrast(l);return B>=7?"AAA":B>=4.5?"AA":""},isDark(){const l=this.rgb().color;return(l[0]*2126+l[1]*7152+l[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const l=this.rgb();for(let B=0;B<3;B++)l.color[B]=255-l.color[B];return l},lighten(l){const B=this.hsl();return B.color[2]+=B.color[2]*l,B},darken(l){const B=this.hsl();return B.color[2]-=B.color[2]*l,B},saturate(l){const B=this.hsl();return B.color[1]+=B.color[1]*l,B},desaturate(l){const B=this.hsl();return B.color[1]-=B.color[1]*l,B},whiten(l){const B=this.hwb();return B.color[1]+=B.color[1]*l,B},blacken(l){const B=this.hwb();return B.color[2]+=B.color[2]*l,B},grayscale(){const l=this.rgb().color,B=l[0]*.3+l[1]*.59+l[2]*.11;return o.rgb(B,B,B)},fade(l){return this.alpha(this.valpha-this.valpha*l)},opaquer(l){return this.alpha(this.valpha+this.valpha*l)},rotate(l){const B=this.hsl();let C=B.color[0];return C=(C+l)%360,C=C<0?360+C:C,B.color[0]=C,B},mix(l,B){if(!l||!l.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof l);const C=l.rgb(),Q=this.rgb(),h=B===void 0?.5:B,E=2*h-1,u=C.alpha()-Q.alpha(),d=((E*u===-1?E:(E+u)/(1+E*u))+1)/2,f=1-d;return o.rgb(d*C.red()+f*Q.red(),d*C.green()+f*Q.green(),d*C.blue()+f*Q.blue(),C.alpha()*h+Q.alpha()*(1-h))}};for(const l of Object.keys(A)){if(t.includes(l))continue;const{channels:B}=A[l];o.prototype[l]=function(...C){return this.model===l?new o(this):C.length>0?new o(C,l):new o([...c(A[this.model][l].raw(this.color)),this.valpha],l)},o[l]=function(...C){let Q=C[0];return typeof Q=="number"&&(Q=I(C,B)),new o(Q,l)}}function s(l,B){return Number(l.toFixed(B))}function r(l){return function(B){return s(B,l)}}function a(l,B,C){l=Array.isArray(l)?l:[l];for(const Q of l)(n[Q]||(n[Q]=[]))[B]=C;return l=l[0],function(Q){let h;return Q!==void 0?(C&&(Q=C(Q)),h=this[l](),h.color[B]=Q,h):(h=this[l]().color[B],C&&(h=C(h)),h)}}function g(l){return function(B){return Math.max(0,Math.min(l,B))}}function c(l){return Array.isArray(l)?l:[l]}function I(l,B){for(let C=0;C<B;C++)typeof l[C]!="number"&&(l[C]=0);return l}return K0A=o,K0A}var Rje=Gje();const Ha=b0(Rje);function ai(e,A){return Array.isArray(A)?[e.a*A[0]+e.c*A[1]+e.e,e.b*A[0]+e.d*A[1]+e.f]:{x:e.a*A.x+e.c*A.y+e.e,y:e.b*A.x+e.d*A.y+e.f}}function Nje(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function QT(e){return typeof e>"u"}function vk(e,A=0){return{a:1,c:0,e,b:0,d:1,f:A}}function yj(...e){e=Array.isArray(e[0])?e[0]:e;const A=(t,i)=>({a:t.a*i.a+t.c*i.b,c:t.a*i.c+t.c*i.d,e:t.a*i.e+t.c*i.f+t.e,b:t.b*i.a+t.d*i.b,d:t.b*i.c+t.d*i.d,f:t.b*i.e+t.d*i.f+t.f});switch(e.length){case 0:throw new Error("no matrices provided");case 1:return e[0];case 2:return A(e[0],e[1]);default:{const[t,i,...n]=e,o=A(t,i);return yj(o,...n)}}}function q0A(...e){return yj(...e)}const{cos:Lje,sin:Uje}=Math;function BCt(e,A,t){const i=Lje(e),n=Uje(e),o={a:i,c:-n,e:0,b:n,d:i,f:0};return QT(A)||QT(t)?o:yj([vk(A,t),o,vk(-A,-t)])}function Hje(e,A=void 0,t=void 0,i=void 0){QT(A)&&(A=e);const n={a:e,c:0,e:0,b:0,d:A,f:0};return QT(t)||QT(i)?n:yj([vk(t,i),n,vk(-t,-i)])}function mj(e){const{ctx:A,points:t,fill:i,stroke:n,strokeWidth:o=1,minStrokePx:s,realToCanvasMat:r,closePath:a=!1}=e;if(t.length<2)return;A.beginPath();const g=t.map(B=>ai(r,[B.x,B.y])),c=g[0];if(!c)return;const[I,l]=c;A.moveTo(I,l);for(let B=1;B<g.length;B++){const C=g[B];if(!C)continue;const[Q,h]=C;A.lineTo(Q,h)}if(a&&A.closePath(),i&&(A.fillStyle=i,A.fill()),n){const B=o*Math.abs(r.a),C=s===void 0?B:Math.max(B,s);A.strokeStyle=n,A.lineWidth=C,A.stroke()}}function AQ(e){const{ctx:A,center:t,width:i,height:n,fill:o,realToCanvasMat:s,borderRadius:r=0,ccwRotationDegrees:a=0,stroke:g,strokeWidth:c,isStrokeDashed:I=!1}=e,[l,B]=ai(s,[t.x,t.y]),C=i*Math.abs(s.a),Q=n*Math.abs(s.a),h=r*Math.abs(s.a),E=c?c*Math.abs(s.a):void 0;if(A.save(),A.translate(l,B),a!==0&&A.rotate(-a*(Math.PI/180)),A.beginPath(),h>0){const u=-C/2,d=-Q/2,f=Math.min(h,C/2,Q/2);A.moveTo(u+f,d),A.lineTo(u+C-f,d),A.arcTo(u+C,d,u+C,d+f,f),A.lineTo(u+C,d+Q-f),A.arcTo(u+C,d+Q,u+C-f,d+Q,f),A.lineTo(u+f,d+Q),A.arcTo(u,d+Q,u,d+Q-f,f),A.lineTo(u,d+f),A.arcTo(u,d,u+f,d,f)}else A.rect(-C/2,-Q/2,C,Q);o&&(A.fillStyle=o,A.fill()),g&&E&&(I?A.setLineDash([E*3,E*2]):A.setLineDash([]),A.strokeStyle=g,A.lineWidth=E,A.stroke()),A.restore()}function Yje(e){const{ctx:A,board:t,realToCanvasMat:i,colorMap:n,drawBoardMaterial:o,minBoardOutlineStrokePx:s}=e,{width:r,height:a,center:g,outline:c}=t;if(c&&Array.isArray(c)&&c.length>=3){o&&mj({ctx:A,points:c.map(I=>({x:I.x,y:I.y})),fill:n.substrate,realToCanvasMat:i,closePath:!0}),mj({ctx:A,points:c.map(I=>({x:I.x,y:I.y})),stroke:n.boardOutline,strokeWidth:.1,realToCanvasMat:i,closePath:!0,minStrokePx:s});return}if(r!==void 0&&a!==void 0&&g){o&&AQ({ctx:A,center:g,width:r,height:a,fill:n.substrate,realToCanvasMat:i});const I=r/2,l=a/2,B=[{x:g.x-I,y:g.y-l},{x:g.x+I,y:g.y-l},{x:g.x+I,y:g.y+l},{x:g.x-I,y:g.y+l}];mj({ctx:A,points:B,stroke:n.boardOutline,strokeWidth:.1,realToCanvasMat:i,closePath:!0,minStrokePx:s})}}function Fk(e){const{ctx:A,points:t,fill:i,realToCanvasMat:n}=e;if(t.length<3)return;A.beginPath();const o=t.map(g=>ai(n,[g.x,g.y])),s=o[0];if(!s)return;const[r,a]=s;A.moveTo(r,a);for(let g=1;g<o.length;g++){const c=o[g];if(!c)continue;const[I,l]=c;A.lineTo(I,l)}A.closePath(),A.fillStyle=i,A.fill()}function Jje(e,A){return A.copper[e]??A.copper.top}function Tje(e){return e==="top"||e==="bottom"?.5:1}function Pje(e,A,t,i,n){if(Math.abs(n)<1e-10)return null;const o=t-e,s=i-A,r=Math.hypot(o,s);if(r<1e-10)return null;const a=Math.abs(n)*(r/2),g=r/2,c=(a*a+g*g)/(2*a),I=c-a,l=(e+t)/2,B=(A+i)/2,C=-s/r,Q=o/r,h=n>0?-1:1,E=l+h*C*I,u=B+h*Q*I;return{centerX:E,centerY:u,radius:c}}function O0A(e,A,t,i,n,o,s){if(Math.abs(o)<1e-10){const[f,m]=ai(s,[i,n]);e.lineTo(f,m);return}const r=Pje(A,t,i,n,o);if(!r){const[f,m]=ai(s,[i,n]);e.lineTo(f,m);return}const[a,g]=ai(s,[A,t]),[c,I]=ai(s,[i,n]),[l,B]=ai(s,[r.centerX,r.centerY]),C=Math.hypot(a-l,g-B),Q=Math.atan2(g-B,a-l),h=Math.atan2(I-B,c-l),u=s.a*s.d-s.b*s.c<0,d=o>0?!u:u;e.arc(l,B,C,Q,h,d)}function CCt(e,A,t){if(A.vertices.length<2)return;if(A.vertices.length===2){const s=A.vertices[0],r=A.vertices[1];if(s&&r&&Math.abs((s.bulge??0)-1)<1e-10&&Math.abs((r.bulge??0)-1)<1e-10){const[a,g]=ai(t,[s.x,s.y]);e.moveTo(a,g),O0A(e,s.x,s.y,r.x,r.y,1,t),O0A(e,r.x,r.y,s.x,s.y,1,t);return}}const i=A.vertices[0];if(!i)return;const[n,o]=ai(t,[i.x,i.y]);e.moveTo(n,o);for(let s=0;s<A.vertices.length;s++){const r=A.vertices[s],a=(s+1)%A.vertices.length,g=A.vertices[a];if(!r||!g)continue;const c=r.bulge??0;if(Math.abs(c)<1e-10){const[I,l]=ai(t,[g.x,g.y]);e.lineTo(I,l)}else O0A(e,r.x,r.y,g.x,g.y,c,t)}}function Kje(e){const{ctx:A,pour:t,realToCanvasMat:i,colorMap:n}=e,o=Jje(t.layer,n),s=Tje(t.layer);if(A.save(),A.globalAlpha=s,t.shape==="rect"){const[r,a]=ai(i,[t.center.x,t.center.y]),g=t.width*Math.abs(i.a),c=t.height*Math.abs(i.a);A.translate(r,a),t.rotation&&A.rotate(-t.rotation*(Math.PI/180)),A.beginPath(),A.rect(-g/2,-c/2,g,c),A.fillStyle=o,A.fill(),A.restore();return}if(t.shape==="polygon"){if(t.points&&t.points.length>=3){const r=t.points.map(I=>ai(i,[I.x,I.y])),a=r[0];if(!a){A.restore();return}A.beginPath();const[g,c]=a;A.moveTo(g,c);for(let I=1;I<r.length;I++){const l=r[I];if(!l)continue;const[B,C]=l;A.lineTo(B,C)}A.closePath(),A.fillStyle=o,A.fill()}A.restore();return}if(t.shape==="brep"){if(A.beginPath(),CCt(A,t.brep_shape.outer_ring,i),t.brep_shape.inner_rings)for(const r of t.brep_shape.inner_rings)CCt(A,r,i);A.fillStyle=o,A.fill("evenodd"),A.restore();return}A.restore()}var qje=e=>_$A[e]??(e===" "?id.spaceWidthRatio:id.glyphWidthRatio);function QCt(e,A,t){const i=qje(e),n=A?id.letterSpacingRatio:0,o=A?k$A[e]?.[A]??0:0;return t*(i+n+o)}function W0A(e,A){const t=A*id.glyphWidthRatio,i=A*id.letterSpacingRatio,n=A*id.spaceWidthRatio,o=A*id.strokeWidthRatio,s=A*id.lineHeightRatio,r=e.replace(/\\n/g,`
@@ -5685,7 +5685,7 @@ test("${g} should solve problem correctly", () => {
5685
5685
  // Add more specific assertions based on expected output
5686
5686
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5687
5687
  })
5688
- `,I=new Blob([c],{type:"text/plain"}),l=URL.createObjectURL(I),B=document.createElement("a");B.href=l,B.download=`${g}.test.ts`,B.click(),URL.revokeObjectURL(l)}catch(a){alert(`Error generating test.ts for ${e.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return Z.jsxs("div",{className:`relative ${A}`,ref:n,children:[Z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!t),title:`Download options for ${e.constructor.name}`,children:e.constructor.name}),t&&Z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},zQt=e=>e.activeSubSolver?[e,...zQt(e.activeSubSolver)]:[e],Qti=({solver:e})=>{const A=zQt(e);return Z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((t,i)=>Z.jsxs("div",{className:"flex items-center",children:[i>0&&Z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),Z.jsx(Cti,{solver:t})]},t.constructor.name))})},hti=({solver:e,triggerRender:A,animationSpeed:t=25,onSolverStarted:i,onSolverCompleted:n})=>{const[o,s]=AA.useReducer(Q=>!Q,!1),r=AA.useRef(void 0),a=()=>{!e.solved&&!e.failed&&(e.step(),A())},g=()=>{!e.solved&&!e.failed&&(i&&i(e),e.solve(),A(),n&&n(e))},c=()=>{o?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(e.solved||e.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),n&&e.solved&&n(e);return}e.step(),A()},t))},I=()=>{const Q=e;if(Q.getCurrentPhase&&!e.solved&&!e.failed){const h=Q.getCurrentPhase();for(;Q.getCurrentPhase()===h&&!e.solved&&!e.failed;)e.step();A()}},l=()=>{if(e.solved||e.failed||o)return;const Q=window.prompt("Step until which iteration?",`${e.iterations}`);if(Q===null)return;const h=Number(Q);if(!Number.isFinite(h)){window.alert("Please enter a valid number for the iteration");return}for(;e.iterations<h&&!e.solved&&!e.failed;)e.step();A(),e.solved&&n&&n(e)};AA.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),AA.useEffect(()=>{(e.solved||e.failed)&&o&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[e.solved,e.failed,o]);const B=e.getCurrentPhase!==void 0,C=B?e.getCurrentPhase():null;return Z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[Z.jsx("div",{className:"flex items-center",children:Z.jsx(Qti,{solver:e})}),Z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[Z.jsx("button",{onClick:a,disabled:e.solved||e.failed||o,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),Z.jsx("button",{onClick:g,disabled:e.solved||e.failed||o,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),Z.jsx("button",{onClick:c,disabled:e.solved||e.failed,className:`px-3 py-1 rounded text-white text-sm ${o?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:o?"Stop":"Animate"}),Z.jsx("button",{onClick:l,disabled:e.solved||e.failed||o,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),B&&Z.jsx("button",{onClick:I,disabled:e.solved||e.failed||o,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),Z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",e.iterations]}),e.timeToSolve!==void 0&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(e.timeToSolve/1e3).toFixed(3),"s"]}),C&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",Z.jsx("span",{className:"font-medium",children:C})]}),e.solved&&Z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),e.failed&&Z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),e.error&&Z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",e.error]})]})},Eti=(e,A,t)=>{const i=e.currentPipelineStepIndex;return A<i?"Completed":A===i&&e.activeSubSolver?e.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},uti=(e,A)=>{const i=e.pipelineDef[A].solverName,n=Eti(e,A),o=e[i],s=e.firstIterationOfPhase?.[i]??null,r=e.iterations;let a=0;if(n==="Completed"){const l=e.pipelineDef[A+1],B=l?e.firstIterationOfPhase?.[l.solverName]:void 0;B!==void 0&&s!==null?a=B-s:s!==null&&(a=r-s)}else n==="In Progress"&&s!==null&&(a=r-s);const g=e.timeSpentOnPhase?.[i]??0;let c=0;n==="Completed"?c=1:n==="In Progress"&&o&&(c=o.progress??0);const I=o?.stats??null;return{index:A,name:i,status:n,firstIteration:s,iterations:a,progress:c,timeSpent:g,stats:I&&Object.keys(I).length>0?I:null,solverInstance:o??null}},dti=({status:e})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return Z.jsx("span",{className:`font-medium ${A[e]}`,children:e})},pti=({progress:e})=>{if(e===0)return null;const A=Math.round(e*100);return Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:Z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),Z.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},fti=e=>Object.entries(e).map(([A,t])=>`${A}: ${t}`).join(", "),yti=({stats:e})=>{if(!e||Object.keys(e).length===0)return Z.jsx("span",{children:"-"});const A=Object.entries(e),t=fti(e);return Z.jsxs("details",{className:"cursor-pointer",children:[Z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:t}),Z.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,n])=>Z.jsxs("div",{children:[i,": ",String(n)]},i))})]})},DyA=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(DyA);const A={};for(const[t,i]of Object.entries(e))t.startsWith("_")||(A[t]=DyA(i));return A},mti=(e,A)=>{try{if(typeof e.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const t=DyA(e.getConstructorParams()),i=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),o=document.createElement("a");o.href=n,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(n)}catch(t){alert(`Error downloading input for ${A}: ${t instanceof Error?t.message:String(t)}`)}},wti=({solver:e,onStepUntilPhase:A,onDownloadInput:t})=>{const i=e.pipelineDef.map((r,a)=>uti(e,a)),n=r=>{A?.(r)},o=r=>{r.solverInstance&&(t?t(r.solverInstance,r.name):mti(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return Z.jsxs("div",{className:"border-t border-gray-200",children:[Z.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:Z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),Z.jsx("div",{className:"overflow-x-auto",children:Z.jsxs("table",{className:"w-full text-sm",children:[Z.jsx("thead",{children:Z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),Z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",Z.jsx("sub",{children:"0"})]}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),Z.jsx("tbody",{children:i.map(r=>Z.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[Z.jsx("td",{className:"px-4 py-2",children:Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),Z.jsx("button",{onClick:()=>n(r.name),disabled:r.status==="Completed"||e.solved||e.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),Z.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(dti,{status:r.status})}),Z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(pti,{progress:r.progress})}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),Z.jsx("td",{className:"px-4 py-2 text-gray-500",children:Z.jsx(yti,{stats:r.stats})}),Z.jsx("td",{className:"px-4 py-2",children:r.solverInstance?Z.jsxs("button",{onClick:()=>o(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),Z.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},Dti=class extends Qn.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error("InteractiveGraphics render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Sti({graphics:e}){const A=e.points??[],t=e.lines??[],i=e.rects??[],n=e.circles??[],o=e.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const c=(h,E)=>{typeof h=="number"&&(h<s&&(s=h),h>a&&(a=h)),typeof E=="number"&&(E<r&&(r=E),E>g&&(g=E))};for(const h of A)c(h.x,h.y);for(const h of t){const E=h.points??[];for(const u of E)c(u.x,u.y)}for(const h of i){const E=h.x??0,u=h.y??0,d=h.width??0,f=h.height??0;c(E,u),c(E+d,u+f)}for(const h of n){const E=h.x??0,u=h.y??0,d=h.radius??1;c(E-d,u-d),c(E+d,u+d)}for(const h of o)c(h.x,h.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const I=10,l=s-I,B=r-I,C=Math.max(1,a-s+2*I),Q=Math.max(1,g-r+2*I);return Z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${l} ${B} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((h,E)=>Z.jsx("rect",{x:h.x??0,y:h.y??0,width:h.width??0,height:h.height??0,fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`rect-${E}`)),t.map((h,E)=>Z.jsx("polyline",{fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1,points:(h.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${E}`)),n.map((h,E)=>Z.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.fillColor??"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`circle-${E}`)),A.map((h,E)=>Z.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.color??"black"},`point-${E}`)),o.map((h,E)=>Z.jsx("text",{x:h.x??0,y:h.y??0,fontSize:h.fontSize??10,fill:h.color??"black",children:h.text??""},`text-${E}`))]})}var bti=({solver:e,animationSpeed:A=25,onSolverStarted:t,onSolverCompleted:i})=>{const[n,o]=AA.useReducer(c=>c+1,0),s=AA.useMemo(()=>{try{return e.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(c){return console.error("Visualization error:",c),{points:[],lines:[],rects:[],circles:[]}}},[e,n]),r=AA.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);AA.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const c=document.createElement("script");c.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(c)}},[]);const a=e.pipelineDef!==void 0,g=c=>{const I=e;if(!e.solved&&!e.failed){for(;!e.solved&&!e.failed&&I.currentPipelineStepIndex<=I.pipelineDef.findIndex(l=>l.solverName===c);)e.step();o()}};return Z.jsxs("div",{children:[Z.jsx(hti,{solver:e,triggerRender:o,animationSpeed:A,onSolverStarted:t,onSolverCompleted:i}),r?Z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):Z.jsx(Dti,{fallback:Z.jsx(Sti,{graphics:s}),children:Z.jsx(Bti,{graphics:s})}),a&&Z.jsx(wti,{solver:e,onStepUntilPhase:g})]})};const xti=()=>{AA.useEffect(()=>{const e="tailwind-cdn-script";if(document.getElementById(e)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const t=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),t)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},_ti=e=>e.toLowerCase().includes("pack")?nTe:e.toLowerCase().includes("rout")?cTe:VJe,kti=({solverEvents:e=[]})=>{const[A,t]=AA.useState(null);xti();const i=AA.useMemo(()=>{const r=new Map;for(const a of e){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[e]),n=AA.useMemo(()=>Array.from(i.keys()),[i]),o=A?i.get(A):null,s=AA.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const r=ZgA[o.solverName];if(!r)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ZgA).join(", ")}`,classFound:!1};try{const a=o.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[o]);return e.length===0?Z.jsx("div",{className:"rf-p-4",children:Z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:Z.jsxs("div",{className:"rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),Z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):Z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[Z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[Z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[n.length," ",n.length===1?"Solver":"Solvers"]}),n.map(r=>{const a=i.get(r),g=A===r;return Z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>t(r),children:(()=>{const c=_ti(a.solverName);return Z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[Z.jsx(c,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),Z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[Z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),Z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),Z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?s.instance?Z.jsx(jD,{fallback:Z.jsx("div",{className:"rf-p-4",children:Z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),Z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:Z.jsx(bti,{solver:s.instance})}):Z.jsxs("div",{className:"rf-p-4",children:[Z.jsxs("div",{className:"rf-mb-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),Z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),s.error&&Z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:Z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),Z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[Z.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:Z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),Z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:Z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):Z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:Z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},XQt=({errorMessage:e,errorStack:A,circuitJsonErrors:t})=>{AA.useEffect(()=>{if(e){const i=new Error(e);A&&(i.stack=A);try{lq.captureException(i)}catch{}}},[e,A]),AA.useEffect(()=>{if(t&&t.length>0)for(const i of t){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{lq.captureException(n,{error_type:i.type})}catch{}}},[t])},$Qt="0.0.1740",vti={version:$Qt},SyA={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},byA=new Map,$j=e=>{const A=byA.get(e);return A?Object.fromEntries(Object.entries(A.stores).map(([t,i])=>[t,i.getState()])):{}},Fti=(e,A,t)=>{if(e===void 0)return{type:"untracked",connection:A.connect(t)};const i=byA.get(t.name);if(i)return{type:"tracked",store:e,...i};const n={connection:A.connect(t),stores:{}};return byA.set(t.name,n),{type:"tracked",store:e,...n}},Aht=(e,A={})=>(t,i,n)=>{const{enabled:o,anonymousActionType:s,store:r,...a}=A;let g;try{g=(o??(SyA?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!g)return(SyA?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(t,i,n);const{connection:c,...I}=Fti(r,g,a);let l=!0;n.setState=(Q,h,E)=>{const u=t(Q,h);if(!l)return u;const d=E===void 0?{type:s||"anonymous"}:typeof E=="string"?{type:E}:E;return r===void 0?(c?.send(d,i()),u):(c?.send({...d,type:`${r}/${d.type}`},{...$j(a.name),[r]:n.getState()}),u)};const B=(...Q)=>{const h=l;l=!1,t(...Q),l=h},C=e(n.setState,i,n);if(I.type==="untracked"?c?.init(C):(I.stores[I.store]=n,c?.init(Object.fromEntries(Object.entries(I.stores).map(([Q,h])=>[Q,Q===I.store?C:h.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){let Q=!1;const h=n.dispatch;n.dispatch=(...E)=>{(SyA?"production":void 0)!=="production"&&E[0].type==="__setState"&&!Q&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),Q=!0),h(...E)}}return c.subscribe(Q=>{var h;switch(Q.type){case"ACTION":if(typeof Q.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return xyA(Q.payload,E=>{if(E.type==="__setState"){if(r===void 0){B(E.state);return}Object.keys(E.state).length!==1&&console.error(`
5688
+ `,I=new Blob([c],{type:"text/plain"}),l=URL.createObjectURL(I),B=document.createElement("a");B.href=l,B.download=`${g}.test.ts`,B.click(),URL.revokeObjectURL(l)}catch(a){alert(`Error generating test.ts for ${e.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return Z.jsxs("div",{className:`relative ${A}`,ref:n,children:[Z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!t),title:`Download options for ${e.constructor.name}`,children:e.constructor.name}),t&&Z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),Z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},zQt=e=>e.activeSubSolver?[e,...zQt(e.activeSubSolver)]:[e],Qti=({solver:e})=>{const A=zQt(e);return Z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((t,i)=>Z.jsxs("div",{className:"flex items-center",children:[i>0&&Z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),Z.jsx(Cti,{solver:t})]},t.constructor.name))})},hti=({solver:e,triggerRender:A,animationSpeed:t=25,onSolverStarted:i,onSolverCompleted:n})=>{const[o,s]=AA.useReducer(Q=>!Q,!1),r=AA.useRef(void 0),a=()=>{!e.solved&&!e.failed&&(e.step(),A())},g=()=>{!e.solved&&!e.failed&&(i&&i(e),e.solve(),A(),n&&n(e))},c=()=>{o?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(e.solved||e.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),n&&e.solved&&n(e);return}e.step(),A()},t))},I=()=>{const Q=e;if(Q.getCurrentPhase&&!e.solved&&!e.failed){const h=Q.getCurrentPhase();for(;Q.getCurrentPhase()===h&&!e.solved&&!e.failed;)e.step();A()}},l=()=>{if(e.solved||e.failed||o)return;const Q=window.prompt("Step until which iteration?",`${e.iterations}`);if(Q===null)return;const h=Number(Q);if(!Number.isFinite(h)){window.alert("Please enter a valid number for the iteration");return}for(;e.iterations<h&&!e.solved&&!e.failed;)e.step();A(),e.solved&&n&&n(e)};AA.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),AA.useEffect(()=>{(e.solved||e.failed)&&o&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[e.solved,e.failed,o]);const B=e.getCurrentPhase!==void 0,C=B?e.getCurrentPhase():null;return Z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[Z.jsx("div",{className:"flex items-center",children:Z.jsx(Qti,{solver:e})}),Z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[Z.jsx("button",{onClick:a,disabled:e.solved||e.failed||o,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),Z.jsx("button",{onClick:g,disabled:e.solved||e.failed||o,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),Z.jsx("button",{onClick:c,disabled:e.solved||e.failed,className:`px-3 py-1 rounded text-white text-sm ${o?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:o?"Stop":"Animate"}),Z.jsx("button",{onClick:l,disabled:e.solved||e.failed||o,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),B&&Z.jsx("button",{onClick:I,disabled:e.solved||e.failed||o,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),Z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",e.iterations]}),e.timeToSolve!==void 0&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(e.timeToSolve/1e3).toFixed(3),"s"]}),C&&Z.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",Z.jsx("span",{className:"font-medium",children:C})]}),e.solved&&Z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),e.failed&&Z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),e.error&&Z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",e.error]})]})},Eti=(e,A,t)=>{const i=e.currentPipelineStepIndex;return A<i?"Completed":A===i&&e.activeSubSolver?e.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},uti=(e,A)=>{const i=e.pipelineDef[A].solverName,n=Eti(e,A),o=e[i],s=e.firstIterationOfPhase?.[i]??null,r=e.iterations;let a=0;if(n==="Completed"){const l=e.pipelineDef[A+1],B=l?e.firstIterationOfPhase?.[l.solverName]:void 0;B!==void 0&&s!==null?a=B-s:s!==null&&(a=r-s)}else n==="In Progress"&&s!==null&&(a=r-s);const g=e.timeSpentOnPhase?.[i]??0;let c=0;n==="Completed"?c=1:n==="In Progress"&&o&&(c=o.progress??0);const I=o?.stats??null;return{index:A,name:i,status:n,firstIteration:s,iterations:a,progress:c,timeSpent:g,stats:I&&Object.keys(I).length>0?I:null,solverInstance:o??null}},dti=({status:e})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return Z.jsx("span",{className:`font-medium ${A[e]}`,children:e})},pti=({progress:e})=>{if(e===0)return null;const A=Math.round(e*100);return Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:Z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),Z.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},fti=e=>Object.entries(e).map(([A,t])=>`${A}: ${t}`).join(", "),yti=({stats:e})=>{if(!e||Object.keys(e).length===0)return Z.jsx("span",{children:"-"});const A=Object.entries(e),t=fti(e);return Z.jsxs("details",{className:"cursor-pointer",children:[Z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:t}),Z.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,n])=>Z.jsxs("div",{children:[i,": ",String(n)]},i))})]})},DyA=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(DyA);const A={};for(const[t,i]of Object.entries(e))t.startsWith("_")||(A[t]=DyA(i));return A},mti=(e,A)=>{try{if(typeof e.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const t=DyA(e.getConstructorParams()),i=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),o=document.createElement("a");o.href=n,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(n)}catch(t){alert(`Error downloading input for ${A}: ${t instanceof Error?t.message:String(t)}`)}},wti=({solver:e,onStepUntilPhase:A,onDownloadInput:t})=>{const i=e.pipelineDef.map((r,a)=>uti(e,a)),n=r=>{A?.(r)},o=r=>{r.solverInstance&&(t?t(r.solverInstance,r.name):mti(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return Z.jsxs("div",{className:"border-t border-gray-200",children:[Z.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:Z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),Z.jsx("div",{className:"overflow-x-auto",children:Z.jsxs("table",{className:"w-full text-sm",children:[Z.jsx("thead",{children:Z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),Z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",Z.jsx("sub",{children:"0"})]}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),Z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),Z.jsx("tbody",{children:i.map(r=>Z.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[Z.jsx("td",{className:"px-4 py-2",children:Z.jsxs("div",{className:"flex items-center gap-2",children:[Z.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),Z.jsx("button",{onClick:()=>n(r.name),disabled:r.status==="Completed"||e.solved||e.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),Z.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(dti,{status:r.status})}),Z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),Z.jsx("td",{className:"px-4 py-2",children:Z.jsx(pti,{progress:r.progress})}),Z.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),Z.jsx("td",{className:"px-4 py-2 text-gray-500",children:Z.jsx(yti,{stats:r.stats})}),Z.jsx("td",{className:"px-4 py-2",children:r.solverInstance?Z.jsxs("button",{onClick:()=>o(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[Z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:Z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),Z.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},Dti=class extends Qn.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error("InteractiveGraphics render error:",e)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Sti({graphics:e}){const A=e.points??[],t=e.lines??[],i=e.rects??[],n=e.circles??[],o=e.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const c=(h,E)=>{typeof h=="number"&&(h<s&&(s=h),h>a&&(a=h)),typeof E=="number"&&(E<r&&(r=E),E>g&&(g=E))};for(const h of A)c(h.x,h.y);for(const h of t){const E=h.points??[];for(const u of E)c(u.x,u.y)}for(const h of i){const E=h.x??0,u=h.y??0,d=h.width??0,f=h.height??0;c(E,u),c(E+d,u+f)}for(const h of n){const E=h.x??0,u=h.y??0,d=h.radius??1;c(E-d,u-d),c(E+d,u+d)}for(const h of o)c(h.x,h.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const I=10,l=s-I,B=r-I,C=Math.max(1,a-s+2*I),Q=Math.max(1,g-r+2*I);return Z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${l} ${B} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((h,E)=>Z.jsx("rect",{x:h.x??0,y:h.y??0,width:h.width??0,height:h.height??0,fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`rect-${E}`)),t.map((h,E)=>Z.jsx("polyline",{fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1,points:(h.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${E}`)),n.map((h,E)=>Z.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.fillColor??"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`circle-${E}`)),A.map((h,E)=>Z.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.color??"black"},`point-${E}`)),o.map((h,E)=>Z.jsx("text",{x:h.x??0,y:h.y??0,fontSize:h.fontSize??10,fill:h.color??"black",children:h.text??""},`text-${E}`))]})}var bti=({solver:e,animationSpeed:A=25,onSolverStarted:t,onSolverCompleted:i})=>{const[n,o]=AA.useReducer(c=>c+1,0),s=AA.useMemo(()=>{try{return e.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(c){return console.error("Visualization error:",c),{points:[],lines:[],rects:[],circles:[]}}},[e,n]),r=AA.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);AA.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const c=document.createElement("script");c.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(c)}},[]);const a=e.pipelineDef!==void 0,g=c=>{const I=e;if(!e.solved&&!e.failed){for(;!e.solved&&!e.failed&&I.currentPipelineStepIndex<=I.pipelineDef.findIndex(l=>l.solverName===c);)e.step();o()}};return Z.jsxs("div",{children:[Z.jsx(hti,{solver:e,triggerRender:o,animationSpeed:A,onSolverStarted:t,onSolverCompleted:i}),r?Z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):Z.jsx(Dti,{fallback:Z.jsx(Sti,{graphics:s}),children:Z.jsx(Bti,{graphics:s})}),a&&Z.jsx(wti,{solver:e,onStepUntilPhase:g})]})};const xti=()=>{AA.useEffect(()=>{const e="tailwind-cdn-script";if(document.getElementById(e)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const t=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),t)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},_ti=e=>e.toLowerCase().includes("pack")?nTe:e.toLowerCase().includes("rout")?cTe:VJe,kti=({solverEvents:e=[]})=>{const[A,t]=AA.useState(null);xti();const i=AA.useMemo(()=>{const r=new Map;for(const a of e){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[e]),n=AA.useMemo(()=>Array.from(i.keys()),[i]),o=A?i.get(A):null,s=AA.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const r=ZgA[o.solverName];if(!r)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ZgA).join(", ")}`,classFound:!1};try{const a=o.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[o]);return e.length===0?Z.jsx("div",{className:"rf-p-4",children:Z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:Z.jsxs("div",{className:"rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),Z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):Z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[Z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[Z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[n.length," ",n.length===1?"Solver":"Solvers"]}),n.map(r=>{const a=i.get(r),g=A===r;return Z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>t(r),children:(()=>{const c=_ti(a.solverName);return Z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[Z.jsx(c,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),Z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[Z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),Z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),Z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?s.instance?Z.jsx(jD,{fallback:Z.jsx("div",{className:"rf-p-4",children:Z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),Z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:Z.jsx(bti,{solver:s.instance})}):Z.jsxs("div",{className:"rf-p-4",children:[Z.jsxs("div",{className:"rf-mb-4",children:[Z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),Z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),s.error&&Z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:Z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),Z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[Z.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:Z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),Z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:Z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):Z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:Z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},XQt=({errorMessage:e,errorStack:A,circuitJsonErrors:t})=>{AA.useEffect(()=>{if(e){const i=new Error(e);A&&(i.stack=A);try{lq.captureException(i)}catch{}}},[e,A]),AA.useEffect(()=>{if(t&&t.length>0)for(const i of t){const n=new Error(i.message||"Circuit JSON Error");i.stack&&(n.stack=i.stack);try{lq.captureException(n,{error_type:i.type})}catch{}}},[t])},$Qt="0.0.1742",vti={version:$Qt},SyA={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},byA=new Map,$j=e=>{const A=byA.get(e);return A?Object.fromEntries(Object.entries(A.stores).map(([t,i])=>[t,i.getState()])):{}},Fti=(e,A,t)=>{if(e===void 0)return{type:"untracked",connection:A.connect(t)};const i=byA.get(t.name);if(i)return{type:"tracked",store:e,...i};const n={connection:A.connect(t),stores:{}};return byA.set(t.name,n),{type:"tracked",store:e,...n}},Aht=(e,A={})=>(t,i,n)=>{const{enabled:o,anonymousActionType:s,store:r,...a}=A;let g;try{g=(o??(SyA?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!g)return(SyA?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(t,i,n);const{connection:c,...I}=Fti(r,g,a);let l=!0;n.setState=(Q,h,E)=>{const u=t(Q,h);if(!l)return u;const d=E===void 0?{type:s||"anonymous"}:typeof E=="string"?{type:E}:E;return r===void 0?(c?.send(d,i()),u):(c?.send({...d,type:`${r}/${d.type}`},{...$j(a.name),[r]:n.getState()}),u)};const B=(...Q)=>{const h=l;l=!1,t(...Q),l=h},C=e(n.setState,i,n);if(I.type==="untracked"?c?.init(C):(I.stores[I.store]=n,c?.init(Object.fromEntries(Object.entries(I.stores).map(([Q,h])=>[Q,Q===I.store?C:h.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){let Q=!1;const h=n.dispatch;n.dispatch=(...E)=>{(SyA?"production":void 0)!=="production"&&E[0].type==="__setState"&&!Q&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),Q=!0),h(...E)}}return c.subscribe(Q=>{var h;switch(Q.type){case"ACTION":if(typeof Q.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return xyA(Q.payload,E=>{if(E.type==="__setState"){if(r===void 0){B(E.state);return}Object.keys(E.state).length!==1&&console.error(`
5689
5689
  [zustand devtools middleware] Unsupported __setState action format.
5690
5690
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
5691
5691
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }