tscircuit 0.0.1084-libonly → 0.0.1085-libonly

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.
@@ -5297,10 +5297,10 @@ svg { font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; }
5297
5297
  50% { opacity: 0.2; }
5298
5298
  100% { opacity: 0.6; }
5299
5299
  }
5300
- `,o.appendChild(u)}})}};n();const s=new MutationObserver(n);return s.observe(o,{childList:!0,subtree:!1,characterData:!1}),()=>{s.disconnect()}},[t,e,A,i])},MAe=["#8B0000","#2F4F4F","#191970","#006400","#FF4500","#800080","#2E8B57","#B8860B","#C71585","#008B8B"],l2t=t=>{const{svgDivRef:A,circuitJson:e,circuitJsonKey:i,showGroups:o}=t;z.useEffect(()=>{if(A.current&&A.current.querySelectorAll(".schematic-group-overlay").forEach(r=>r.remove()),!A.current||!o||!e||e.length===0)return;const n=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=Hp(e).source_group?.list().filter(u=>!u.is_subcircuit)||[],g=Hp(e).schematic_component?.list()||[],I=new Map;a.forEach(u=>{const d=u;if(d.parent_source_group_id){const f=I.get(d.parent_source_group_id)||[];f.push(u.source_group_id),I.set(d.parent_source_group_id,f)}});const c=u=>{const d=[],f=I.get(u)||[];for(const w of f)d.push(w),d.push(...c(w));return d},B=u=>{const d=a.find(f=>f.source_group_id===u);return d?.parent_source_group_id?1+B(d.parent_source_group_id):0},l=a.length>0&&a.some(u=>u.name&&u.name.trim()!=="");let C=[];if(l){const u=new Map;for(const d of g){const f=Hp(e).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 w=u.get(d.source_group_id)||[];const D=c(d.source_group_id);for(const S of D){const x=u.get(S)||[];w=[...w,...x]}if(w.length>0){const S=B(d.source_group_id),x=c(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:w,color:MAe[f%MAe.length],depthLevel:S,hasChildren:x,sourceGroupId:d.source_group_id})}})}const Q=s.viewBox.baseVal,E=s.getBoundingClientRect(),h=Math.min(E.width/Q.width,E.height/Q.height)||1;C.sort((u,d)=>u.depthLevel-d.depthLevel),C.forEach(u=>{if(u.components.length===0)return;const d=C2t(u.components,s);if(!d)return;const f=Math.max(8,Math.min(25,15/Math.max(h,.3))),w=u.hasChildren?f*.6:0,D=f+w,S=Math.max(1,2/Math.max(h,.5)),x=u.depthLevel===0?S:S*.7,F=Math.max(4,8/Math.max(h,.5)),k=u.hasChildren?1.3:1,U=F*k,N=U*.5,Y=document.createElementNS("http://www.w3.org/2000/svg","rect");Y.setAttribute("class","schematic-group-overlay"),Y.setAttribute("x",(d.minX-D).toString()),Y.setAttribute("y",(d.minY-D).toString()),Y.setAttribute("width",(d.maxX-d.minX+D*2).toString()),Y.setAttribute("height",(d.maxY-d.minY+D*2).toString()),Y.setAttribute("fill","none"),Y.setAttribute("stroke",u.color),Y.setAttribute("stroke-width",x.toString()),Y.setAttribute("stroke-dasharray",`${U},${N}`),Y.setAttribute("opacity","0.8"),Y.setAttribute("rx","0"),Y.setAttribute("ry","0");const K=Math.max(6,Math.min(20,14/Math.max(h,.2))),J=u.depthLevel===0||u.depthLevel===1?0:u.depthLevel*.2,W=K*(1-J),Z=Math.max(1,W*.2),AA=u.name,nA=document.createElementNS("http://www.w3.org/2000/svg","text");nA.setAttribute("font-size",W.toString()),nA.setAttribute("font-family","Arial, sans-serif"),nA.textContent=AA,s.appendChild(nA);const cA=nA.getBBox();s.removeChild(nA);const tA=cA.width+Z*2,iA=W+Z*2,rA=d.minX-D,CA=d.minY-D-iA,pA=document.createElementNS("http://www.w3.org/2000/svg","rect");pA.setAttribute("class","schematic-group-overlay"),pA.setAttribute("x",rA.toString()),pA.setAttribute("y",(CA-iA).toString()),pA.setAttribute("width",tA.toString()),pA.setAttribute("height",iA.toString()),pA.setAttribute("fill","transparent"),pA.setAttribute("rx","0"),pA.setAttribute("ry","0");const kA=document.createElementNS("http://www.w3.org/2000/svg","text");kA.setAttribute("class","schematic-group-overlay"),kA.setAttribute("x",(rA+Z).toString()),kA.setAttribute("y",(CA+iA-Z).toString()),kA.setAttribute("fill",u.color),kA.setAttribute("font-size",W.toString()),kA.setAttribute("font-family","Arial, sans-serif"),kA.setAttribute("font-weight",u.depthLevel===0?"600":"500"),kA.setAttribute("stroke",u.color),kA.setAttribute("stroke-width",Math.max(.2,W*.02).toString()),kA.textContent=AA,s.appendChild(Y),s.appendChild(pA),s.appendChild(kA)})}catch(a){console.error("Error creating group overlays:",a)}},10);return()=>clearTimeout(n)},[A,i,o])};function C2t(t,A){let e=1/0,i=1/0,o=-1/0,n=-1/0;for(const r of t){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();e=Math.min(e,g.x),i=Math.min(i,g.y),o=Math.max(o,g.x+g.width),n=Math.max(n,g.y+g.height)}}return e===1/0?null:{minX:e,minY:i,maxX:o,maxY:n}}var Q2t=Ba("schematic-viewer"),E2t=()=>{Ba.enable("schematic-viewer*")},h2t=Q2t,vAe=t=>{const[A,e]=z.useState(0),[i,o]=z.useState(0);return z.useEffect(()=>{if(!t.current)return;const n=()=>{const r=t.current?.getBoundingClientRect();e(r?.width||0),o(r?.height||0)};n();const s=new ResizeObserver(n);return s.observe(t.current),window.addEventListener("resize",n),()=>{s.disconnect(),window.removeEventListener("resize",n)}},[]),{containerWidth:A,containerHeight:i}},u2t=h2t.extend("useComponentDragging"),d2t=({onEditEvent:t,editEvents:A=[],circuitJson:e,cancelDrag:i,svgToScreenProjection:o,realToSvgProjection:n,enabled:s=!1,snapToGrid:r=!1})=>{const[a,g]=z.useState(null),I=Ti(n,o),c=z.useRef(null),B=z.useRef(null),l=z.useRef(new Map);z.useEffect(()=>{A.forEach(S=>{"edit_event_type"in S&&S.edit_event_type==="edit_schematic_component_location"&&!S.in_progress&&l.current.set(S.schematic_component_id,{...S.new_center})})},[A]);const C=z.useCallback((S,x,F)=>{if(!s)return!1;const k=F.closest('[data-circuit-json-type="schematic_component"]');if(!k)return!1;const U=k.getAttribute("data-schematic-component-id");if(!U)return!1;i&&i();const N=Hp(e).schematic_component.get(U);if(!N)return!1;c.current={x:S,y:x};let Y;const K=l.current.get(U);if(K)Y={...K};else{const W=NAe({editEvents:A,schematic_component_id:U});Y={x:N.center.x+W.x,y:N.center.y+W.y},l.current.set(U,{...Y})}const J={edit_event_id:Math.random().toString(36).substr(2,9),edit_event_type:"edit_schematic_component_location",schematic_component_id:U,original_center:Y,new_center:{...Y},in_progress:!0,created_at:Date.now(),_element:k};return B.current=J,g(J),!0},[i,s,e,A]),Q=z.useCallback(S=>{C(S.clientX,S.clientY,S.target)},[C]),E=z.useCallback(S=>{if(S.touches.length!==1)return;const x=S.touches[0];C(x.clientX,x.clientY,S.target)&&S.preventDefault()},[C]),h=z.useCallback((S,x)=>{if(!B.current||!c.current)return;const F={x:S-c.current.x,y:x-c.current.y},k={x:F.x/I.a,y:F.y/I.d};let U={x:B.current.original_center.x+k.x,y:B.current.original_center.y+k.y};if(r){const Y=K=>Math.round(K*10)/10;U={x:Y(U.x),y:Y(U.y)}}const N={...B.current,new_center:U};B.current=N,g(N)},[I,r]),u=z.useCallback(S=>h(S.clientX,S.clientY),[h]),d=z.useCallback(S=>{if(S.touches.length!==1||!B.current)return;S.preventDefault();const x=S.touches[0];h(x.clientX,x.clientY)},[h]),f=z.useCallback(()=>{if(!B.current)return;const S={...B.current,in_progress:!1};l.current.set(S.schematic_component_id,{...S.new_center}),u2t("endDrag calling onEditEvent with new edit event",{newEditEvent:S}),t&&t(S),B.current=null,c.current=null,g(null)},[t]),w=z.useCallback(()=>f(),[f]),D=z.useCallback(()=>f(),[f]);return z.useEffect(()=>(window.addEventListener("mousemove",u),window.addEventListener("mouseup",w),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("touchend",D),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",w),window.removeEventListener("touchmove",d),window.removeEventListener("touchend",D)}),[u,w,d,D]),{handleMouseDown:Q,handleTouchStart:E,isDragging:!!B.current,activeEditEvent:a}},Kx={schematicEditIcon:50,schematicGridIcon:49,spiceSimulationIcon:50,viewMenuIcon:48,viewMenu:55,viewMenuBackdrop:54,clickToInteractOverlay:100,schematicComponentHoverOutline:47},p2t=({onClick:t,active:A})=>{const e=i=>{i.preventDefault(),t()};return O.jsx("div",{onClick:e,onTouchEnd:e,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:Kx.schematicEditIcon},children:O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[O.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),O.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})},f2t=({onClick:t,active:A})=>{const e=i=>{i.preventDefault(),t()};return O.jsx("div",{onClick:e,onTouchEnd:e,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:Kx.schematicGridIcon},children:O.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:O.jsx("path",{d:"M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"})})})},y2t=({onClick:t,active:A})=>{const e=i=>{i.preventDefault(),t()};return O.jsx("div",{onClick:e,onTouchEnd:e,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:Kx.viewMenuIcon},children:O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[O.jsx("circle",{cx:"12",cy:"12",r:"1"}),O.jsx("circle",{cx:"12",cy:"5",r:"1"}),O.jsx("circle",{cx:"12",cy:"19",r:"1"})]})})},m2t={version:"2.0.49"},w2t=({circuitJson:t,circuitJsonKey:A,isVisible:e,onClose:i,showGroups:o,onToggleGroups:n})=>{const s=z.useMemo(()=>{if(!t||t.length===0)return!1;try{if((Hp(t).source_group?.list()||[]).length>0)return!0;const a=Hp(t).schematic_component?.list()||[];if(a.length>1){const g=new Set;for(const I of a){const c=Hp(t).source_component.get(I.source_component_id);c?.ftype&&g.add(c.ftype)}return g.size>1}return!1}catch(r){return console.error("Error checking for groups:",r),!1}},[A]);return e?O.jsxs(O.Fragment,{children:[O.jsx("div",{onClick:i,onTouchEnd:r=>{r.preventDefault(),i()},style:{position:"absolute",inset:0,backgroundColor:"transparent",zIndex:Kx.viewMenuBackdrop}}),O.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:Kx.viewMenu},children:[O.jsxs("div",{onClick:()=>{s&&n(!o)},onTouchEnd:r=>{r.preventDefault(),s&&n(!o)},style:{padding:"8px 12px",cursor:s?"pointer":"not-allowed",opacity:s?1:.5,fontSize:"13px",color:"#000000",fontFamily:"sans-serif",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:r=>{s&&(r.currentTarget.style.backgroundColor="#f0f0f0")},onMouseLeave:r=>{s&&(r.currentTarget.style.backgroundColor="transparent")},children:[O.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:o&&"✓"}),"View Schematic Groups"]}),!s&&O.jsx("div",{style:{padding:"8px 12px",fontSize:"11px",color:"#666",fontStyle:"italic"},children:"No groups found in this schematic"}),O.jsxs("div",{style:{padding:"4px 8px",fontSize:"12px",color:"#999",borderTop:"1px solid #eee",textAlign:"center"},children:["v",String(m2t?.version)]})]})]}):null},D2t=()=>O.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:O.jsx("path",{d:"M3 12h2.5l2.5-9 4 18 4-9h5.5"})}),S2t=({onClick:t})=>O.jsx("div",{onClick:t,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:Kx.spiceSimulationIcon},children:O.jsx(D2t,{})});IW.register(X1t,e2t,_1t,F1t,Y1t,Z1t,L1t);var CW=["#8884d8","#82ca9d","#ffc658","#ff7300","#387908"],UAe=t=>{if(t===0)return"0s";const A=Math.abs(t);let e="s",i=1;return A<1e-12?(e="fs",i=1e15):A<1e-9?(e="ps",i=1e12):A<1e-6?(e="ns",i=1e9):A<.001?(e="us",i=1e6):A<1&&(e="ms",i=1e3),`${parseFloat((t*i).toPrecision(3))}${e}`},b2t=({plotData:t,nodes:A,isLoading:e,error:i,hasRun:o})=>{const n=z.useMemo(()=>{const a=A.some(I=>I.toLowerCase().startsWith("v(")),g=A.some(I=>I.toLowerCase().startsWith("i("));return a&&g?"Value":a?"Voltage (V)":g?"Current (A)":"Value"},[A]);if(e)return O.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:"Running simulation..."});if(!o)return O.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:'Click "Run" to start the simulation.'});if(i)return O.jsxs("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"red"},children:["Error: ",i]});if(t.length===0)return O.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:t.map(I=>({x:Number(I.name),y:I[a]})),borderColor:CW[g%CW.length],backgroundColor:CW[g%CW.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 UAe(g.parsed.x)}return""}}}},scales:{x:{type:"linear",title:{display:!0,text:"Time",font:{family:"sans-serif"}},ticks:{callback:a=>UAe(a),font:{family:"sans-serif"}}},y:{title:{display:!0,text:n,font:{family:"sans-serif"}},ticks:{font:{family:"sans-serif"}}}}};return O.jsx("div",{style:{position:"relative",height:"300px",width:"100%"},children:O.jsx(I2t,{options:r,data:s})})},x2t=({spiceString:t,onClose:A,plotData:e,nodes:i,isLoading:o,error:n,simOptions:s,onSimOptionsChange:r,hasRun:a})=>{const[g,I]=z.useState(String(s.startTime)),[c,B]=z.useState(String(s.duration));z.useEffect(()=>{I(String(s.startTime)),B(String(s.duration))},[s.startTime,s.duration]);const l=()=>{r({...s,startTime:Number(g),duration:Number(c)})},C=i.filter(Q=>{const E=Q.toLowerCase().startsWith("v("),h=Q.toLowerCase().startsWith("i(");return!!(s.showVoltage&&E||s.showCurrent&&h)});return O.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:O.jsxs("div",{style:{backgroundColor:"white",padding:"24px",borderRadius:"12px",width:"90%",maxWidth:"900px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)"},children:[O.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",borderBottom:"1px solid #eee",paddingBottom:"16px"},children:[O.jsx("h2",{style:{margin:0,fontSize:"22px",fontWeight:600,color:"#333"},children:"SPICE Simulation"}),O.jsx("button",{onClick:A,style:{background:"none",border:"none",fontSize:"28px",cursor:"pointer",color:"#888",padding:0,lineHeight:1},children:"×"})]}),O.jsx("div",{children:O.jsx(b2t,{plotData:e,nodes:C,isLoading:o,error:n,hasRun:a})}),O.jsxs("div",{style:{marginTop:"16px",padding:"12px",backgroundColor:"#f7f7f7",borderRadius:"6px",display:"flex",flexWrap:"wrap",gap:"24px",alignItems:"center",fontSize:"14px"},children:[O.jsxs("div",{style:{display:"flex",gap:"16px"},children:[O.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[O.jsx("input",{type:"checkbox",checked:s.showVoltage,onChange:Q=>r({...s,showVoltage:Q.target.checked})}),"Voltage"]}),O.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[O.jsx("input",{type:"checkbox",checked:s.showCurrent,onChange:Q=>r({...s,showCurrent:Q.target.checked})}),"Current"]})]}),O.jsxs("div",{style:{display:"flex",gap:"16px",alignItems:"center"},children:[O.jsx("label",{htmlFor:"startTime",children:"Start Time (ms):"}),O.jsx("input",{id:"startTime",type:"number",value:g,onChange:Q=>I(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),O.jsx("label",{htmlFor:"duration",children:"Duration (ms):"}),O.jsx("input",{id:"duration",type:"number",value:c,onChange:Q=>B(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),O.jsx("button",{onClick:l,style:{padding:"4px 12px",borderRadius:"4px",border:"1px solid #ccc",backgroundColor:"#f0f0f0",cursor:"pointer"},children:a?"Rerun":"Run"})]})]}),O.jsxs("div",{style:{marginTop:"24px"},children:[O.jsx("h3",{style:{marginTop:0,marginBottom:"12px",fontSize:"18px",fontWeight:600,color:"#333"},children:"SPICE Netlist"}),O.jsx("pre",{style:{backgroundColor:"#fafafa",padding:"16px",borderRadius:"6px",maxHeight:"150px",overflowY:"auto",border:"1px solid #eee",color:"#333",fontSize:"13px",fontFamily:"monospace"},children:t})]})]})})},k2t="dmFyIGU9bnVsbCxzPWFzeW5jKCk9Pihhd2FpdCBpbXBvcnQoImh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vZWVjaXJjdWl0LWVuZ2luZUAxLjUuMi8rZXNtIikpLlNpbXVsYXRpb24sYz1hc3luYygpPT57aWYoZSYmZS5pc0luaXRpYWxpemVkKCkpcmV0dXJuO2xldCBpPWF3YWl0IHMoKTtlPW5ldyBpLGF3YWl0IGUuc3RhcnQoKX07c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+e3RyeXtpZihhd2FpdCBjKCksIWUpdGhyb3cgbmV3IEVycm9yKCJTaW11bGF0aW9uIG5vdCBpbml0aWFsaXplZCIpO2xldCB0PWkuZGF0YS5zcGljZVN0cmluZyxhPXQubWF0Y2goL3dyZGF0YVxzKyhcUyspXHMrKC4qKS9pKTtpZihhKXtsZXQgbz1gLnByb2JlICR7YVsyXS50cmltKCkuc3BsaXQoL1xzKy8pLmpvaW4oIiAiKX1gO3Q9dC5yZXBsYWNlKC93cmRhdGEuKi9pLG8pfWVsc2UgaWYoIXQubWF0Y2goL1wucHJvYmUvaSkpdGhyb3cgdC5tYXRjaCgvcGxvdFxzKyguKikvaSk/bmV3IEVycm9yKCJUaGUgJ3Bsb3QnIGNvbW1hbmQgaXMgbm90IHN1cHBvcnRlZCBmb3IgZGF0YSBleHRyYWN0aW9uLiBQbGVhc2UgdXNlICd3cmRhdGEgPGZpbGVuYW1lPiA8dmFyMT4gLi4uJyBvciAnLnByb2JlIDx2YXIxPiAuLi4nIGluc3RlYWQuIik6bmV3IEVycm9yKCJObyAnLnByb2JlJyBvciAnd3JkYXRhJyBjb21tYW5kIGZvdW5kIGluIFNQSUNFIGZpbGUuIFVzZSAnd3JkYXRhIDxmaWxlbmFtZT4gPHZhcjE+IC4uLicgdG8gc3BlY2lmeSBvdXRwdXQuIik7ZS5zZXROZXRMaXN0KHQpO2xldCBuPWF3YWl0IGUucnVuU2ltKCk7c2VsZi5wb3N0TWVzc2FnZSh7dHlwZToicmVzdWx0IixyZXN1bHQ6bn0pfWNhdGNoKHQpe3NlbGYucG9zdE1lc3NhZ2Uoe3R5cGU6ImVycm9yIixlcnJvcjp0Lm1lc3NhZ2V9KX19Owo=",QW=null,G2t=()=>{if(typeof window>"u")return null;if(QW)return QW;try{const t=new Blob([atob(k2t)],{type:"application/javascript"});return QW=URL.createObjectURL(t),QW}catch(t){return console.error("Failed to create blob URL for worker",t),null}},F2t=t=>{const A={};if(t.dataType==="real")t.data.forEach(r=>{A[r.name]=r.values});else if(t.dataType==="complex")t.data.forEach(r=>{A[r.name]=r.values.map(a=>a.real)});else throw new Error("Unsupported data type in simulation result");const e=Object.keys(A).find(r=>r.toLowerCase()==="time"||r.toLowerCase()==="frequency");if(!e)throw new Error("No time or frequency data in simulation result");const i=A[e],o=Object.keys(A).filter(r=>r!==e),n=o;return{plotData:i.map((r,a)=>{const g={name:r.toExponential(2)};return o.forEach(I=>{g[I]=A[I][a]}),g}),nodes:n}},_2t=t=>{const[A,e]=z.useState([]),[i,o]=z.useState([]),[n,s]=z.useState(!0),[r,a]=z.useState(null);return z.useEffect(()=>{if(!t){s(!1),e([]),o([]),a(null);return}s(!0),a(null),e([]),o([]);const g=G2t();if(!g){a("Could not create SPICE simulation worker."),s(!1);return}const I=new Worker(g,{type:"module"});return I.onmessage=c=>{if(c.data.type==="result")try{const{plotData:B,nodes:l}=F2t(c.data.result);e(B),o(l)}catch(B){a(B.message||"Failed to parse simulation result"),console.error(B)}else c.data.type==="error"&&a(c.data.error);s(!1)},I.onerror=c=>{a(c.message),s(!1)},I.postMessage({spiceString:t}),()=>{I.terminate()}},[t]),{plotData:A,nodes:i,isLoading:n,error:r}},pEA=t=>{if(t===0)return"0";const A=Math.abs(t),e=i=>i.toPrecision(4);return A>=1?e(t):A>=.001?`${e(t*1e3)}m`:A>=1e-6?`${e(t*1e6)}u`:A>=1e-9?`${e(t*1e9)}n`:A>=1e-12?`${e(t*1e12)}p`:A>=1e-15?`${e(t*1e15)}f`:t.toExponential(3)},R2t=(t,A)=>{const i=GMA(t).toSpiceString(),n=i.split(`
5300
+ `,o.appendChild(u)}})}};n();const s=new MutationObserver(n);return s.observe(o,{childList:!0,subtree:!1,characterData:!1}),()=>{s.disconnect()}},[t,e,A,i])},MAe=["#8B0000","#2F4F4F","#191970","#006400","#FF4500","#800080","#2E8B57","#B8860B","#C71585","#008B8B"],l2t=t=>{const{svgDivRef:A,circuitJson:e,circuitJsonKey:i,showGroups:o}=t;z.useEffect(()=>{if(A.current&&A.current.querySelectorAll(".schematic-group-overlay").forEach(r=>r.remove()),!A.current||!o||!e||e.length===0)return;const n=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=Hp(e).source_group?.list().filter(u=>!u.is_subcircuit)||[],g=Hp(e).schematic_component?.list()||[],I=new Map;a.forEach(u=>{const d=u;if(d.parent_source_group_id){const f=I.get(d.parent_source_group_id)||[];f.push(u.source_group_id),I.set(d.parent_source_group_id,f)}});const c=u=>{const d=[],f=I.get(u)||[];for(const w of f)d.push(w),d.push(...c(w));return d},B=u=>{const d=a.find(f=>f.source_group_id===u);return d?.parent_source_group_id?1+B(d.parent_source_group_id):0},l=a.length>0&&a.some(u=>u.name&&u.name.trim()!=="");let C=[];if(l){const u=new Map;for(const d of g){const f=Hp(e).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 w=u.get(d.source_group_id)||[];const D=c(d.source_group_id);for(const S of D){const x=u.get(S)||[];w=[...w,...x]}if(w.length>0){const S=B(d.source_group_id),x=c(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:w,color:MAe[f%MAe.length],depthLevel:S,hasChildren:x,sourceGroupId:d.source_group_id})}})}const Q=s.viewBox.baseVal,E=s.getBoundingClientRect(),h=Math.min(E.width/Q.width,E.height/Q.height)||1;C.sort((u,d)=>u.depthLevel-d.depthLevel),C.forEach(u=>{if(u.components.length===0)return;const d=C2t(u.components,s);if(!d)return;const f=Math.max(8,Math.min(25,15/Math.max(h,.3))),w=u.hasChildren?f*.6:0,D=f+w,S=Math.max(1,2/Math.max(h,.5)),x=u.depthLevel===0?S:S*.7,F=Math.max(4,8/Math.max(h,.5)),k=u.hasChildren?1.3:1,U=F*k,N=U*.5,Y=document.createElementNS("http://www.w3.org/2000/svg","rect");Y.setAttribute("class","schematic-group-overlay"),Y.setAttribute("x",(d.minX-D).toString()),Y.setAttribute("y",(d.minY-D).toString()),Y.setAttribute("width",(d.maxX-d.minX+D*2).toString()),Y.setAttribute("height",(d.maxY-d.minY+D*2).toString()),Y.setAttribute("fill","none"),Y.setAttribute("stroke",u.color),Y.setAttribute("stroke-width",x.toString()),Y.setAttribute("stroke-dasharray",`${U},${N}`),Y.setAttribute("opacity","0.8"),Y.setAttribute("rx","0"),Y.setAttribute("ry","0");const K=Math.max(6,Math.min(20,14/Math.max(h,.2))),J=u.depthLevel===0||u.depthLevel===1?0:u.depthLevel*.2,W=K*(1-J),Z=Math.max(1,W*.2),AA=u.name,nA=document.createElementNS("http://www.w3.org/2000/svg","text");nA.setAttribute("font-size",W.toString()),nA.setAttribute("font-family","Arial, sans-serif"),nA.textContent=AA,s.appendChild(nA);const cA=nA.getBBox();s.removeChild(nA);const tA=cA.width+Z*2,iA=W+Z*2,rA=d.minX-D,CA=d.minY-D-iA,pA=document.createElementNS("http://www.w3.org/2000/svg","rect");pA.setAttribute("class","schematic-group-overlay"),pA.setAttribute("x",rA.toString()),pA.setAttribute("y",(CA-iA).toString()),pA.setAttribute("width",tA.toString()),pA.setAttribute("height",iA.toString()),pA.setAttribute("fill","transparent"),pA.setAttribute("rx","0"),pA.setAttribute("ry","0");const kA=document.createElementNS("http://www.w3.org/2000/svg","text");kA.setAttribute("class","schematic-group-overlay"),kA.setAttribute("x",(rA+Z).toString()),kA.setAttribute("y",(CA+iA-Z).toString()),kA.setAttribute("fill",u.color),kA.setAttribute("font-size",W.toString()),kA.setAttribute("font-family","Arial, sans-serif"),kA.setAttribute("font-weight",u.depthLevel===0?"600":"500"),kA.setAttribute("stroke",u.color),kA.setAttribute("stroke-width",Math.max(.2,W*.02).toString()),kA.textContent=AA,s.appendChild(Y),s.appendChild(pA),s.appendChild(kA)})}catch(a){console.error("Error creating group overlays:",a)}},10);return()=>clearTimeout(n)},[A,i,o])};function C2t(t,A){let e=1/0,i=1/0,o=-1/0,n=-1/0;for(const r of t){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();e=Math.min(e,g.x),i=Math.min(i,g.y),o=Math.max(o,g.x+g.width),n=Math.max(n,g.y+g.height)}}return e===1/0?null:{minX:e,minY:i,maxX:o,maxY:n}}var Q2t=Ba("schematic-viewer"),E2t=()=>{Ba.enable("schematic-viewer*")},h2t=Q2t,vAe=t=>{const[A,e]=z.useState(0),[i,o]=z.useState(0);return z.useEffect(()=>{if(!t.current)return;const n=()=>{const r=t.current?.getBoundingClientRect();e(r?.width||0),o(r?.height||0)};n();const s=new ResizeObserver(n);return s.observe(t.current),window.addEventListener("resize",n),()=>{s.disconnect(),window.removeEventListener("resize",n)}},[]),{containerWidth:A,containerHeight:i}},u2t=h2t.extend("useComponentDragging"),d2t=({onEditEvent:t,editEvents:A=[],circuitJson:e,cancelDrag:i,svgToScreenProjection:o,realToSvgProjection:n,enabled:s=!1,snapToGrid:r=!1})=>{const[a,g]=z.useState(null),I=Ti(n,o),c=z.useRef(null),B=z.useRef(null),l=z.useRef(new Map);z.useEffect(()=>{A.forEach(S=>{"edit_event_type"in S&&S.edit_event_type==="edit_schematic_component_location"&&!S.in_progress&&l.current.set(S.schematic_component_id,{...S.new_center})})},[A]);const C=z.useCallback((S,x,F)=>{if(!s)return!1;const k=F.closest('[data-circuit-json-type="schematic_component"]');if(!k)return!1;const U=k.getAttribute("data-schematic-component-id");if(!U)return!1;i&&i();const N=Hp(e).schematic_component.get(U);if(!N)return!1;c.current={x:S,y:x};let Y;const K=l.current.get(U);if(K)Y={...K};else{const W=NAe({editEvents:A,schematic_component_id:U});Y={x:N.center.x+W.x,y:N.center.y+W.y},l.current.set(U,{...Y})}const J={edit_event_id:Math.random().toString(36).substr(2,9),edit_event_type:"edit_schematic_component_location",schematic_component_id:U,original_center:Y,new_center:{...Y},in_progress:!0,created_at:Date.now(),_element:k};return B.current=J,g(J),!0},[i,s,e,A]),Q=z.useCallback(S=>{C(S.clientX,S.clientY,S.target)},[C]),E=z.useCallback(S=>{if(S.touches.length!==1)return;const x=S.touches[0];C(x.clientX,x.clientY,S.target)&&S.preventDefault()},[C]),h=z.useCallback((S,x)=>{if(!B.current||!c.current)return;const F={x:S-c.current.x,y:x-c.current.y},k={x:F.x/I.a,y:F.y/I.d};let U={x:B.current.original_center.x+k.x,y:B.current.original_center.y+k.y};if(r){const Y=K=>Math.round(K*10)/10;U={x:Y(U.x),y:Y(U.y)}}const N={...B.current,new_center:U};B.current=N,g(N)},[I,r]),u=z.useCallback(S=>h(S.clientX,S.clientY),[h]),d=z.useCallback(S=>{if(S.touches.length!==1||!B.current)return;S.preventDefault();const x=S.touches[0];h(x.clientX,x.clientY)},[h]),f=z.useCallback(()=>{if(!B.current)return;const S={...B.current,in_progress:!1};l.current.set(S.schematic_component_id,{...S.new_center}),u2t("endDrag calling onEditEvent with new edit event",{newEditEvent:S}),t&&t(S),B.current=null,c.current=null,g(null)},[t]),w=z.useCallback(()=>f(),[f]),D=z.useCallback(()=>f(),[f]);return z.useEffect(()=>(window.addEventListener("mousemove",u),window.addEventListener("mouseup",w),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("touchend",D),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",w),window.removeEventListener("touchmove",d),window.removeEventListener("touchend",D)}),[u,w,d,D]),{handleMouseDown:Q,handleTouchStart:E,isDragging:!!B.current,activeEditEvent:a}},Kx={schematicEditIcon:50,schematicGridIcon:49,spiceSimulationIcon:50,viewMenuIcon:48,viewMenu:55,viewMenuBackdrop:54,clickToInteractOverlay:100,schematicComponentHoverOutline:47},p2t=({onClick:t,active:A})=>{const e=i=>{i.preventDefault(),t()};return O.jsx("div",{onClick:e,onTouchEnd:e,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:Kx.schematicEditIcon},children:O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[O.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),O.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})},f2t=({onClick:t,active:A})=>{const e=i=>{i.preventDefault(),t()};return O.jsx("div",{onClick:e,onTouchEnd:e,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:Kx.schematicGridIcon},children:O.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:O.jsx("path",{d:"M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"})})})},y2t=({onClick:t,active:A})=>{const e=i=>{i.preventDefault(),t()};return O.jsx("div",{onClick:e,onTouchEnd:e,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:Kx.viewMenuIcon},children:O.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[O.jsx("circle",{cx:"12",cy:"12",r:"1"}),O.jsx("circle",{cx:"12",cy:"5",r:"1"}),O.jsx("circle",{cx:"12",cy:"19",r:"1"})]})})},m2t={version:"2.0.50"},w2t=({circuitJson:t,circuitJsonKey:A,isVisible:e,onClose:i,showGroups:o,onToggleGroups:n})=>{const s=z.useMemo(()=>{if(!t||t.length===0)return!1;try{if((Hp(t).source_group?.list()||[]).length>0)return!0;const a=Hp(t).schematic_component?.list()||[];if(a.length>1){const g=new Set;for(const I of a){const c=Hp(t).source_component.get(I.source_component_id);c?.ftype&&g.add(c.ftype)}return g.size>1}return!1}catch(r){return console.error("Error checking for groups:",r),!1}},[A]);return e?O.jsxs(O.Fragment,{children:[O.jsx("div",{onClick:i,onTouchEnd:r=>{r.preventDefault(),i()},style:{position:"absolute",inset:0,backgroundColor:"transparent",zIndex:Kx.viewMenuBackdrop}}),O.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:Kx.viewMenu},children:[O.jsxs("div",{onClick:()=>{s&&n(!o)},onTouchEnd:r=>{r.preventDefault(),s&&n(!o)},style:{padding:"8px 12px",cursor:s?"pointer":"not-allowed",opacity:s?1:.5,fontSize:"13px",color:"#000000",fontFamily:"sans-serif",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:r=>{s&&(r.currentTarget.style.backgroundColor="#f0f0f0")},onMouseLeave:r=>{s&&(r.currentTarget.style.backgroundColor="transparent")},children:[O.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:o&&"✓"}),"View Schematic Groups"]}),!s&&O.jsx("div",{style:{padding:"8px 12px",fontSize:"11px",color:"#666",fontStyle:"italic"},children:"No groups found in this schematic"}),O.jsxs("div",{style:{padding:"4px 8px",fontSize:"12px",color:"#999",borderTop:"1px solid #eee",textAlign:"center"},children:["v",String(m2t?.version)]})]})]}):null},D2t=()=>O.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:O.jsx("path",{d:"M3 12h2.5l2.5-9 4 18 4-9h5.5"})}),S2t=({onClick:t})=>O.jsx("div",{onClick:t,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:Kx.spiceSimulationIcon},children:O.jsx(D2t,{})});IW.register(X1t,e2t,_1t,F1t,Y1t,Z1t,L1t);var CW=["#8884d8","#82ca9d","#ffc658","#ff7300","#387908"],UAe=t=>{if(t===0)return"0s";const A=Math.abs(t);let e="s",i=1;return A<1e-12?(e="fs",i=1e15):A<1e-9?(e="ps",i=1e12):A<1e-6?(e="ns",i=1e9):A<.001?(e="us",i=1e6):A<1&&(e="ms",i=1e3),`${parseFloat((t*i).toPrecision(3))}${e}`},b2t=({plotData:t,nodes:A,isLoading:e,error:i,hasRun:o})=>{const n=z.useMemo(()=>{const a=A.some(I=>I.toLowerCase().startsWith("v(")),g=A.some(I=>I.toLowerCase().startsWith("i("));return a&&g?"Value":a?"Voltage (V)":g?"Current (A)":"Value"},[A]);if(e)return O.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:"Running simulation..."});if(!o)return O.jsx("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:'Click "Run" to start the simulation.'});if(i)return O.jsxs("div",{style:{height:"300px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"red"},children:["Error: ",i]});if(t.length===0)return O.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:t.map(I=>({x:Number(I.name),y:I[a]})),borderColor:CW[g%CW.length],backgroundColor:CW[g%CW.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 UAe(g.parsed.x)}return""}}}},scales:{x:{type:"linear",title:{display:!0,text:"Time",font:{family:"sans-serif"}},ticks:{callback:a=>UAe(a),font:{family:"sans-serif"}}},y:{title:{display:!0,text:n,font:{family:"sans-serif"}},ticks:{font:{family:"sans-serif"}}}}};return O.jsx("div",{style:{position:"relative",height:"300px",width:"100%"},children:O.jsx(I2t,{options:r,data:s})})},x2t=({spiceString:t,onClose:A,plotData:e,nodes:i,isLoading:o,error:n,simOptions:s,onSimOptionsChange:r,hasRun:a})=>{const[g,I]=z.useState(String(s.startTime)),[c,B]=z.useState(String(s.duration));z.useEffect(()=>{I(String(s.startTime)),B(String(s.duration))},[s.startTime,s.duration]);const l=()=>{r({...s,startTime:Number(g),duration:Number(c)})},C=i.filter(Q=>{const E=Q.toLowerCase().startsWith("v("),h=Q.toLowerCase().startsWith("i(");return!!(s.showVoltage&&E||s.showCurrent&&h)});return O.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:O.jsxs("div",{style:{backgroundColor:"white",padding:"24px",borderRadius:"12px",width:"90%",maxWidth:"900px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)"},children:[O.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px",borderBottom:"1px solid #eee",paddingBottom:"16px"},children:[O.jsx("h2",{style:{margin:0,fontSize:"22px",fontWeight:600,color:"#333"},children:"SPICE Simulation"}),O.jsx("button",{onClick:A,style:{background:"none",border:"none",fontSize:"28px",cursor:"pointer",color:"#888",padding:0,lineHeight:1},children:"×"})]}),O.jsx("div",{children:O.jsx(b2t,{plotData:e,nodes:C,isLoading:o,error:n,hasRun:a})}),O.jsxs("div",{style:{marginTop:"16px",padding:"12px",backgroundColor:"#f7f7f7",borderRadius:"6px",display:"flex",flexWrap:"wrap",gap:"24px",alignItems:"center",fontSize:"14px"},children:[O.jsxs("div",{style:{display:"flex",gap:"16px"},children:[O.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[O.jsx("input",{type:"checkbox",checked:s.showVoltage,onChange:Q=>r({...s,showVoltage:Q.target.checked})}),"Voltage"]}),O.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[O.jsx("input",{type:"checkbox",checked:s.showCurrent,onChange:Q=>r({...s,showCurrent:Q.target.checked})}),"Current"]})]}),O.jsxs("div",{style:{display:"flex",gap:"16px",alignItems:"center"},children:[O.jsx("label",{htmlFor:"startTime",children:"Start Time (ms):"}),O.jsx("input",{id:"startTime",type:"number",value:g,onChange:Q=>I(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),O.jsx("label",{htmlFor:"duration",children:"Duration (ms):"}),O.jsx("input",{id:"duration",type:"number",value:c,onChange:Q=>B(Q.target.value),style:{width:"80px",padding:"4px 8px",borderRadius:"4px",border:"1px solid #ccc"}}),O.jsx("button",{onClick:l,style:{padding:"4px 12px",borderRadius:"4px",border:"1px solid #ccc",backgroundColor:"#f0f0f0",cursor:"pointer"},children:a?"Rerun":"Run"})]})]}),O.jsxs("div",{style:{marginTop:"24px"},children:[O.jsx("h3",{style:{marginTop:0,marginBottom:"12px",fontSize:"18px",fontWeight:600,color:"#333"},children:"SPICE Netlist"}),O.jsx("pre",{style:{backgroundColor:"#fafafa",padding:"16px",borderRadius:"6px",maxHeight:"150px",overflowY:"auto",border:"1px solid #eee",color:"#333",fontSize:"13px",fontFamily:"monospace"},children:t})]})]})})},k2t="dmFyIGU9bnVsbCxzPWFzeW5jKCk9Pihhd2FpdCBpbXBvcnQoImh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vZWVjaXJjdWl0LWVuZ2luZUAxLjUuMi8rZXNtIikpLlNpbXVsYXRpb24sYz1hc3luYygpPT57aWYoZSYmZS5pc0luaXRpYWxpemVkKCkpcmV0dXJuO2xldCBpPWF3YWl0IHMoKTtlPW5ldyBpLGF3YWl0IGUuc3RhcnQoKX07c2VsZi5vbm1lc3NhZ2U9YXN5bmMgaT0+e3RyeXtpZihhd2FpdCBjKCksIWUpdGhyb3cgbmV3IEVycm9yKCJTaW11bGF0aW9uIG5vdCBpbml0aWFsaXplZCIpO2xldCB0PWkuZGF0YS5zcGljZVN0cmluZyxhPXQubWF0Y2goL3dyZGF0YVxzKyhcUyspXHMrKC4qKS9pKTtpZihhKXtsZXQgbz1gLnByb2JlICR7YVsyXS50cmltKCkuc3BsaXQoL1xzKy8pLmpvaW4oIiAiKX1gO3Q9dC5yZXBsYWNlKC93cmRhdGEuKi9pLG8pfWVsc2UgaWYoIXQubWF0Y2goL1wucHJvYmUvaSkpdGhyb3cgdC5tYXRjaCgvcGxvdFxzKyguKikvaSk/bmV3IEVycm9yKCJUaGUgJ3Bsb3QnIGNvbW1hbmQgaXMgbm90IHN1cHBvcnRlZCBmb3IgZGF0YSBleHRyYWN0aW9uLiBQbGVhc2UgdXNlICd3cmRhdGEgPGZpbGVuYW1lPiA8dmFyMT4gLi4uJyBvciAnLnByb2JlIDx2YXIxPiAuLi4nIGluc3RlYWQuIik6bmV3IEVycm9yKCJObyAnLnByb2JlJyBvciAnd3JkYXRhJyBjb21tYW5kIGZvdW5kIGluIFNQSUNFIGZpbGUuIFVzZSAnd3JkYXRhIDxmaWxlbmFtZT4gPHZhcjE+IC4uLicgdG8gc3BlY2lmeSBvdXRwdXQuIik7ZS5zZXROZXRMaXN0KHQpO2xldCBuPWF3YWl0IGUucnVuU2ltKCk7c2VsZi5wb3N0TWVzc2FnZSh7dHlwZToicmVzdWx0IixyZXN1bHQ6bn0pfWNhdGNoKHQpe3NlbGYucG9zdE1lc3NhZ2Uoe3R5cGU6ImVycm9yIixlcnJvcjp0Lm1lc3NhZ2V9KX19Owo=",QW=null,G2t=()=>{if(typeof window>"u")return null;if(QW)return QW;try{const t=new Blob([atob(k2t)],{type:"application/javascript"});return QW=URL.createObjectURL(t),QW}catch(t){return console.error("Failed to create blob URL for worker",t),null}},F2t=t=>{const A={};if(t.dataType==="real")t.data.forEach(r=>{A[r.name]=r.values});else if(t.dataType==="complex")t.data.forEach(r=>{A[r.name]=r.values.map(a=>a.real)});else throw new Error("Unsupported data type in simulation result");const e=Object.keys(A).find(r=>r.toLowerCase()==="time"||r.toLowerCase()==="frequency");if(!e)throw new Error("No time or frequency data in simulation result");const i=A[e],o=Object.keys(A).filter(r=>r!==e),n=o;return{plotData:i.map((r,a)=>{const g={name:r.toExponential(2)};return o.forEach(I=>{g[I]=A[I][a]}),g}),nodes:n}},_2t=t=>{const[A,e]=z.useState([]),[i,o]=z.useState([]),[n,s]=z.useState(!0),[r,a]=z.useState(null);return z.useEffect(()=>{if(!t){s(!1),e([]),o([]),a(null);return}s(!0),a(null),e([]),o([]);const g=G2t();if(!g){a("Could not create SPICE simulation worker."),s(!1);return}const I=new Worker(g,{type:"module"});return I.onmessage=c=>{if(c.data.type==="result")try{const{plotData:B,nodes:l}=F2t(c.data.result);e(B),o(l)}catch(B){a(B.message||"Failed to parse simulation result"),console.error(B)}else c.data.type==="error"&&a(c.data.error);s(!1)},I.onerror=c=>{a(c.message),s(!1)},I.postMessage({spiceString:t}),()=>{I.terminate()}},[t]),{plotData:A,nodes:i,isLoading:n,error:r}},pEA=t=>{if(t===0)return"0";const A=Math.abs(t),e=i=>i.toPrecision(4);return A>=1?e(t):A>=.001?`${e(t*1e3)}m`:A>=1e-6?`${e(t*1e6)}u`:A>=1e-9?`${e(t*1e9)}n`:A>=1e-12?`${e(t*1e12)}p`:A>=1e-15?`${e(t*1e15)}f`:t.toExponential(3)},R2t=(t,A)=>{const i=GMA(t).toSpiceString(),n=i.split(`
5301
5301
  `).filter(k=>k.trim()!=="").filter(k=>!k.startsWith("*")&&!k.startsWith(".")&&k.trim()!==""),s=new Set,r=new Set,a=new Set;for(const k of n){const U=k.trim().split(/\s+/);if(U.length<3)continue;const N=U[0],Y=N[0].toUpperCase();let K=[];if(["R","C","L","V","I","D"].includes(Y))K=U.slice(1,3),Y==="V"&&a.add(N);else if(Y==="Q"&&U.length>=4)K=U.slice(1,4);else if(Y==="M"&&U.length>=5)K=U.slice(1,5);else if(Y==="X")K=U.slice(1,-1);else continue;K.forEach(J=>s.add(J)),Y==="C"&&K.forEach(J=>r.add(J))}s.delete("0"),r.delete("0");const g=Array.from(r).map(k=>`.ic V(${k})=0`),I=[],c=Array.from(s).map(k=>`V(${k})`);I.push(...c);const B=Array.from(a).map(k=>`I(${k})`);I.push(...B);const l=I.length>0?`.probe ${I.join(" ")}`:"",C=A?.startTime??0,Q=A?.duration??20,E=C*.001,h=Q*.001,u=E+h,d=h/50,f=`.tran ${pEA(d)} ${pEA(u)} ${pEA(E)} UIC`,w=".end",D=i.split(`
5302
5302
  `);let S=-1;for(let k=D.length-1;k>=0;k--)if(D[k].trim().toLowerCase().startsWith(w)){S=k;break}const x=[...g,l,f].filter(Boolean);let F;if(S!==-1){const k=D.slice(0,S),U=D.slice(S);F=[...k,...x,...U]}else F=[...D,...x,w];return F.join(`
5303
- `)},N2t=(t,A)=>{if(typeof window>"u")return A;try{const e=localStorage.getItem(t);return e!==null?JSON.parse(e):A}catch{return A}},M2t=(t,A)=>{if(!(typeof window>"u"))try{localStorage.setItem(t,JSON.stringify(A))}catch{}},fEA=z.createContext(null),v2t=5,U2t=(t,A)=>!t&&!A?!0:!t||!A?!1:t.minX===A.minX&&t.maxX===A.maxX&&t.minY===A.minY&&t.maxY===A.maxY,L2t=({children:t})=>{if(z.useContext(fEA))return O.jsx(O.Fragment,{children:t});const e=z.useRef({pointer:null,boundingBoxes:new Map,hoveringIds:new Set,subscribers:new Set,mouseDownPosition:null}),i=z.useCallback(()=>{for(const c of e.current.subscribers)c()},[]),o=z.useCallback(()=>{const c=e.current.pointer,B=new Set;if(c)for(const[C,Q]of e.current.boundingBoxes){const E=Q.bounds;E&&c.x>=E.minX&&c.x<=E.maxX&&c.y>=E.minY&&c.y<=E.maxY&&B.add(C)}const l=e.current.hoveringIds;B.size===l.size&&[...B].every(C=>l.has(C))||(e.current.hoveringIds=B,i())},[i]),n=z.useCallback((c,B)=>{e.current.boundingBoxes.set(c,B),o()},[o]),s=z.useCallback((c,B)=>{const l=e.current.boundingBoxes.get(c);l&&U2t(l.bounds,B.bounds)&&l.onClick===B.onClick||(e.current.boundingBoxes.set(c,B),o())},[o]),r=z.useCallback(c=>{e.current.boundingBoxes.delete(c)&&o()},[o]),a=z.useCallback(c=>(e.current.subscribers.add(c),()=>{e.current.subscribers.delete(c)}),[]),g=z.useCallback(c=>e.current.hoveringIds.has(c),[]);z.useEffect(()=>{const c=Q=>{const{clientX:E,clientY:h}=Q,u=e.current.pointer;u&&u.x===E&&u.y===h||(e.current.pointer={x:E,y:h},o())},B=()=>{e.current.pointer!==null&&(e.current.pointer=null,e.current.mouseDownPosition=null,o())},l=Q=>{e.current.mouseDownPosition={x:Q.clientX,y:Q.clientY}},C=Q=>{const{clientX:E,clientY:h}=Q,u=e.current.mouseDownPosition;if(u&&Math.sqrt(Math.pow(E-u.x,2)+Math.pow(h-u.y,2))>v2t){e.current.mouseDownPosition=null;return}e.current.mouseDownPosition=null;for(const d of e.current.boundingBoxes.values()){const f=d.bounds;f&&E>=f.minX&&E<=f.maxX&&h>=f.minY&&h<=f.maxY&&d.onClick?.(Q)}};return window.addEventListener("pointermove",c,{passive:!0}),window.addEventListener("pointerdown",c,{passive:!0}),window.addEventListener("pointerup",c,{passive:!0}),window.addEventListener("pointerleave",B),window.addEventListener("pointercancel",B),window.addEventListener("blur",B),window.addEventListener("mousedown",l,{passive:!0}),window.addEventListener("click",C,{passive:!0}),()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerdown",c),window.removeEventListener("pointerup",c),window.removeEventListener("pointerleave",B),window.removeEventListener("pointercancel",B),window.removeEventListener("blur",B),window.removeEventListener("mousedown",l),window.removeEventListener("click",C)}},[o]);const I=z.useMemo(()=>({registerBoundingBox:n,updateBoundingBox:s,unregisterBoundingBox:r,subscribe:a,isHovering:g}),[n,s,r,a,g]);return O.jsx(fEA.Provider,{value:I,children:t})},H2t=t=>{const A=z.useContext(fEA);if(!A)throw new Error("useMouseEventsOverBoundingBox must be used within a MouseTracker");const e=z.useId(),i=z.useRef(t);i.current=t;const o=z.useMemo(()=>s=>{i.current.onClick?.(s)},[]);return z.useEffect(()=>(A.registerBoundingBox(e,{bounds:i.current.bounds,onClick:i.current.onClick?o:void 0}),()=>{A.unregisterBoundingBox(e)}),[A,o,e]),z.useEffect(()=>{A.updateBoundingBox(e,{bounds:i.current.bounds,onClick:i.current.onClick?o:void 0})},[A,o,e,t.bounds?.minX,t.bounds?.maxX,t.bounds?.minY,t.bounds?.maxY,t.onClick]),{hovering:z.useSyncExternalStore(A.subscribe,()=>A.isHovering(e),()=>!1)}},Y2t=(t,A)=>!t&&!A?!0:!t||!A?!1:Math.abs(t.bounds.minX-A.bounds.minX)<.5&&Math.abs(t.bounds.maxX-A.bounds.maxX)<.5&&Math.abs(t.bounds.minY-A.bounds.minY)<.5&&Math.abs(t.bounds.maxY-A.bounds.maxY)<.5&&Math.abs(t.rect.left-A.rect.left)<.5&&Math.abs(t.rect.top-A.rect.top)<.5&&Math.abs(t.rect.width-A.rect.width)<.5&&Math.abs(t.rect.height-A.rect.height)<.5,J2t=({componentId:t,svgDivRef:A,containerRef:e,onComponentClick:i,onHoverChange:o,showOutline:n,circuitJsonKey:s})=>{const[r,a]=z.useState(null),g=z.useRef(null),I=z.useCallback(()=>{g.current=null;const E=A.current,h=e.current;if(!E||!h){a(D=>D&&null);return}const u=E.querySelector(`[data-schematic-component-id="${t}"]`);if(!u){a(D=>D&&null);return}const d=u.getBoundingClientRect(),f=h.getBoundingClientRect(),w={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(D=>Y2t(D,w)?D:w)},[t,e,A]),c=z.useCallback(()=>{g.current===null&&(g.current=window.requestAnimationFrame(I))},[I]);z.useEffect(()=>{c()},[c,s]),z.useEffect(()=>{c();const E=A.current,h=e.current;if(!E||!h)return;const u=typeof ResizeObserver<"u"?new ResizeObserver(()=>{c()}):null;u?.observe(h),u?.observe(E);const d=typeof MutationObserver<"u"?new MutationObserver(()=>{c()}):null;return d?.observe(E,{attributes:!0,attributeFilter:["style","transform"],subtree:!0,childList:!0}),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{u?.disconnect(),d?.disconnect(),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c),g.current!==null&&(cancelAnimationFrame(g.current),g.current=null)}},[c,A,e]);const B=z.useCallback(E=>{i&&i(t,E)},[t,i]),l=r?.bounds??null,{hovering:C}=H2t({bounds:l,onClick:i?B:void 0});if(z.useEffect(()=>{o&&o(t,C)},[C,t,o]),!r||!C||!n)return null;const Q=r.rect;return O.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:Kx.schematicComponentHoverOutline}})},T2t=({circuitJson:t,containerStyle:A,editEvents:e=[],onEditEvent:i,defaultEditMode:o=!1,debugGrid:n=!1,editingEnabled:s=!1,debug:r=!1,clickToInteractEnabled:a=!1,colorOverrides:g,spiceSimulationEnabled:I=!1,disableGroups:c=!1,onSchematicComponentClicked:B})=>{r&&E2t();const[l,C]=z.useState(!1),[Q,E]=z.useState({showVoltage:!0,showCurrent:!1,startTime:0,duration:20}),h=lA=>`${lA?.length||0}_${lA?.editCount||0}`,u=z.useMemo(()=>h(t),[t]),d=z.useMemo(()=>{if(!I)return null;try{return R2t(t,Q)}catch(lA){return console.error("Failed to generate SPICE string",lA),null}},[u,I,Q.startTime,Q.duration]),[f,w]=z.useState(!1);z.useEffect(()=>{w(!1)},[u]);const{plotData:D,nodes:S,isLoading:x,error:F}=_2t(f?d:null),[k,U]=z.useState(o),[N,Y]=z.useState(!0),[K,J]=z.useState(!a),[W,Z]=z.useState(!1),[AA,nA]=z.useState(()=>c?!1:N2t("schematic_viewer_show_groups",!1)),[cA,tA]=z.useState(!1),iA=z.useRef(new Set),rA=z.useCallback((lA,EA)=>{EA?iA.current.add(lA):iA.current.delete(lA),tA(iA.current.size>0)},[]),CA=z.useRef(null),pA=z.useRef(null),kA=z.useMemo(()=>{try{return Hp(t).schematic_component?.list()?.map(lA=>lA.schematic_component_id)??[]}catch(lA){return console.error("Failed to derive schematic component ids",lA),[]}},[u,t]),_A=lA=>{const EA=lA.touches[0];pA.current={x:EA.clientX,y:EA.clientY}},TA=lA=>{const EA=lA.changedTouches[0],JA=pA.current;if(!JA)return;const re=Math.abs(EA.clientX-JA.x),he=Math.abs(EA.clientY-JA.y);re<10&&he<10&&(lA.preventDefault(),J(!0)),pA.current=null},[gA,mA]=z.useState([]),dA=z.useRef(t);z.useEffect(()=>{const lA=h(t),EA=h(dA.current);lA!==EA&&(mA([]),dA.current=t)},[t]);const{ref:PA,cancelDrag:Ae,transform:ne}=zL({onSetTransform(lA){CA.current&&(CA.current.style.transform=rh(lA))},enabled:K&&!l}),{containerWidth:wA,containerHeight:OA}=vAe(PA),KA=z.useMemo(()=>!wA||!OA?"":Y8(t,{width:wA,height:OA||720,grid:n?{cellSize:1,labelCells:!0}:void 0,colorOverrides:g}),[u,wA,OA]),YA=z.useMemo(()=>KA.match(/<svg[^>]*style="[^"]*background-color:\s*([^;\"]+)/i)?.[1]??"transparent",[KA]),jA=z.useMemo(()=>{if(!KA)return ug();const lA=KA.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return hT(lA)}catch(EA){return console.error(EA),ug()}},[KA]),RA=lA=>{mA(EA=>[...EA,lA]),i&&i(lA)},bA=z.useMemo(()=>[...e,...gA],[e,gA]),{handleMouseDown:LA,handleTouchStart:FA,isDragging:qA,activeEditEvent:WA}=d2t({onEditEvent:RA,cancelDrag:Ae,realToSvgProjection:jA,svgToScreenProjection:ne,circuitJson:t,editEvents:bA,enabled:k&&K&&!l,snapToGrid:N});c2t({svgDivRef:CA,editEvents:bA,realToSvgProjection:jA,svgToScreenProjection:ne,activeEditEvent:WA}),B2t({svgDivRef:CA,circuitJson:t,activeEditEvent:WA,editEvents:bA}),l2t({svgDivRef:CA,circuitJson:t,circuitJsonKey:u,showGroups:AA&&!c});const ie=z.useRef(FA);z.useEffect(()=>{ie.current=FA},[FA]);const SA=z.useMemo(()=>O.jsx("div",{ref:CA,style:{pointerEvents:a?K?"auto":"none":"auto",transformOrigin:"0 0"},className:B?"schematic-component-clickable":void 0,onTouchStart:lA=>{k&&K&&!l&&ie.current(lA)},dangerouslySetInnerHTML:{__html:KA}}),[KA,K,a,k,l]);return O.jsxs(L2t,{children:[B&&O.jsx("style",{children:".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }"}),O.jsxs("div",{ref:PA,style:{position:"relative",backgroundColor:YA,overflow:"hidden",cursor:l?"auto":qA?"grabbing":a&&!K||cA&&B?"pointer":"grab",minHeight:"300px",...A},onWheelCapture:lA=>{l&&lA.stopPropagation()},onMouseDown:lA=>{if(a&&!K){lA.preventDefault(),lA.stopPropagation();return}LA(lA)},onMouseDownCapture:lA=>{if(a&&!K){lA.preventDefault(),lA.stopPropagation();return}},onTouchStart:lA=>{l||_A(lA)},onTouchEnd:lA=>{l||TA(lA)},children:[!K&&a&&O.jsx("div",{onClick:lA=>{lA.preventDefault(),lA.stopPropagation(),J(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Kx.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"all",touchAction:"pan-x pan-y pinch-zoom"},children:O.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"})}),O.jsx(y2t,{active:W,onClick:()=>Z(!W)}),s&&O.jsx(p2t,{active:k,onClick:()=>U(!k)}),s&&k&&O.jsx(f2t,{active:N,onClick:()=>Y(!N)}),O.jsx(w2t,{circuitJson:t,circuitJsonKey:u,isVisible:W,onClose:()=>Z(!1),showGroups:AA,onToggleGroups:lA=>{c||(nA(lA),M2t("schematic_viewer_show_groups",lA))}}),I&&O.jsx(S2t,{onClick:()=>C(!0)}),l&&O.jsx(x2t,{spiceString:d,onClose:()=>C(!1),plotData:D,nodes:S,isLoading:x,error:F,simOptions:Q,onSimOptionsChange:lA=>{w(!0),E(lA)},hasRun:f}),B&&kA.map(lA=>O.jsx(J2t,{componentId:lA,svgDivRef:CA,containerRef:PA,showOutline:!0,circuitJsonKey:u,onHoverChange:rA,onComponentClick:(EA,JA)=>{B?.({schematicComponentId:EA,event:JA})}},lA)),SA]})]})},K2t=({circuitJson:t,containerStyle:A,colorOverrides:e,width:i,height:o,className:n})=>{const[s,r]=z.useState(null),[a,g]=z.useState(!0),[I,c]=z.useState(null),[B,l]=z.useState(null),C=z.useRef(null),Q=z.useRef(null),{containerWidth:E,containerHeight:h}=vAe(C),[u,d]=z.useState(!1),{ref:f}=zL({onSetTransform(Y){Q.current&&(Q.current.style.transform=rh(Y))}}),w=i||E||1e3,D=o||h||600;z.useEffect(()=>{g(!0),c(null),r(t),g(!1)},[t]);const S=z.useMemo(()=>s&&s.find(K=>K.type==="simulation_experiment")?.simulation_experiment_id||null,[s]),x=z.useMemo(()=>s?s.filter(Y=>Y.type==="simulation_transient_voltage_graph").map(Y=>Y.simulation_transient_voltage_graph_id):[],[s]),F=z.useMemo(()=>{if(!s||!w||!D||!S)return"";try{return x7A({circuitJson:s,simulation_experiment_id:S,simulation_transient_voltage_graph_ids:x,width:w,height:D,schematicOptions:{colorOverrides:e}})}catch(Y){return console.error("Failed to generate fallback schematic SVG:",Y),""}},[s,w,D,e,S,x]);z.useEffect(()=>{if(!F){l(null);return}try{const Y=new Blob([F],{type:"image/svg+xml"}),K=URL.createObjectURL(Y);return l(K),()=>{URL.revokeObjectURL(K)}}catch(Y){console.error("Failed to create SVG object URL:",Y),l(null)}},[F]);const k=z.useMemo(()=>F?F.match(/<svg[^>]*style="[^"]*background-color:\s*([^;\"]+)/i)?.[1]??"transparent":"transparent",[F]),U=Y=>{d(!0)},N=Y=>{d(!0)};return z.useEffect(()=>{const Y=()=>{d(!1)},K=()=>{d(!1)};return window.addEventListener("mouseup",Y),window.addEventListener("touchend",K),()=>{window.removeEventListener("mouseup",Y),window.removeEventListener("touchend",K)}},[]),a?O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#666",...A},className:n,children:"Loading circuit..."}):I?O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#fef2f2",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#dc2626",...A},className:n,children:O.jsxs("div",{style:{textAlign:"center",padding:"20px"},children:[O.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:"Circuit Conversion Error"}),O.jsx("div",{style:{fontSize:"14px"},children:I})]})}):F?O.jsx("div",{ref:Y=>{C.current=Y,f.current=Y},style:{position:"relative",backgroundColor:k,overflow:"hidden",minHeight:"300px",cursor:u?"grabbing":"grab",...A},className:n,onMouseDown:U,onTouchStart:N,children:B?O.jsx("img",{ref:Q,src:B,alt:"Circuit Simulation",style:{transformOrigin:"0 0",width:"100%",height:"100%",display:"block",objectFit:"contain"}}):O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"300px",color:"#666",fontFamily:"sans-serif"},children:"Failed to render SVG"})}):O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#fef2f2",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#dc2626",...A},className:n,children:"Failed to generate simulation SVG"})},LAe=t=>{const[A,e]=z.useState(0),[i,o]=z.useState(0);return z.useEffect(()=>{if(!t.current)return;const n=()=>{const r=t.current?.getBoundingClientRect();e(r?.width||0),o(r?.height||0)};n();const s=new ResizeObserver(n);return s.observe(t.current),window.addEventListener("resize",n),()=>{s.disconnect(),window.removeEventListener("resize",n)}},[]),{containerWidth:A,containerHeight:i}};Ba("assembly-viewer");var HAe=()=>{Ba.enable("assembly-viewer*")},q2t=({circuitJson:t,containerStyle:A,debugGrid:e=!1,debug:i=!1})=>{i&&HAe();const o=z.useRef(null),{ref:n}=zL({onSetTransform(I){o.current&&(o.current.style.transform=rh(I))}}),{containerWidth:s,containerHeight:r}=LAe(n),a=z.useMemo(()=>!s||!r?"":o7A(t,{width:s,height:r||720}),[t,s,r]);z.useMemo(()=>{if(!a)return ug();const I=a.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return hT(I)}catch(c){return console.error(c),ug()}},[a]);const g=z.useMemo(()=>O.jsx("div",{ref:o,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:a}}),[a]);return O.jsx("div",{ref:n,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...A},children:g})},P2t=({circuitJson:t,containerStyle:A,debugGrid:e=!1,debug:i=!1})=>{i&&HAe();const o=z.useRef(null),{ref:n}=zL({onSetTransform(I){o.current&&(o.current.style.transform=rh(I))}}),{containerWidth:s,containerHeight:r}=LAe(n),a=z.useMemo(()=>!s||!r?"":vQA(t,{width:s,height:r||720}),[t,s,r]);z.useMemo(()=>{if(!a)return ug();const I=a.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return hT(I)}catch(c){return console.error(c),ug()}},[a]);const g=z.useMemo(()=>O.jsx("div",{ref:o,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:a}}),[a]);return O.jsx("div",{ref:n,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...A},children:g})};const YAe=["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."],O2t=(()=>{let t=YAe[Math.floor(Math.random()*YAe.length)];return t=t.replace(/</g,"&lt;"),t=t.replace(/>/g,"&gt;"),t=t.replace(new RegExp('(?<!href=")(?<!\\()(?<!\\]\\()(https?:\\/\\/[^\\s\\)\\]]+)',"g"),(A,e)=>`<a class="rf-text-blue-500 rf-underline" href="${A}" target="_blank">${A}</a>`),t=t.replace(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/g,'<a class="rf-text-blue-500 rf-underline" href="$2" target="_blank">$1</a>'),t})(),GS=({onRunClicked:t})=>O.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:[O.jsx(OSt,{className:"rf-size-14 rf-mb-4"}),O.jsxs("p",{className:"rf-text-md rf-break-words rf-max-w-xl rf-text-center",children:["Tip: ",O.jsx("span",{dangerouslySetInnerHTML:{__html:O2t}})]}),t&&O.jsxs(Ja,{className:"rf-mt-4 rf-bg-blue-600 rf-hover:bg-blue-500",onClick:t,children:["Run Code",O.jsx(_zA,{className:"rf-w-3 rf-h-3 rf-ml-2"})]})]}),EW=({text:t,onClick:A})=>O.jsx("span",{className:"rf-cursor-pointer rf-underline rf-text-blue-600 rf-mx-2",onClick:A,children:t}),hW=t=>O.jsxs("div",{className:"rf-leading-5",children:[O.jsx("div",{className:"rf-py-2 rf-font-bold",children:t.column.name}),O.jsx("div",{children:t.field?.()??O.jsx("input",{type:"text",className:"rf-border rf-rounded rf-p-1 rf-w-full",onChange:A=>{t.onTextChange?.(A.target.value)}})})]}),W2t=({open:t,children:A,title:e,onClose:i})=>t?O.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:O.jsxs("div",{className:"rf-bg-white rf-p-5 rf-rounded-lg rf-relative rf-w-11/12 rf-max-w-2xl",onClick:o=>{o.preventDefault(),o.stopPropagation()},children:[O.jsx("h2",{className:"rf-mt-0 rf-text-md rf-pb-4",children:e}),O.jsx("button",{type:"button",className:"rf-absolute rf-top-2 rf-right-4 rf-text-2xl rf-font-bold",onClick:i,children:"×"}),A]})}):null,Z2t=({elements:t})=>{const[A,e]=z.useState({open:!1}),[i,o]=z.useReducer((I,c)=>({...I,...c}),{}),n=[...new Set(t.map(I=>I.type))],s=t.map(I=>{const c=I[`${I.type}_id`],B=Object.fromEntries(Object.entries(I).filter(([C])=>!(C===`${I.type}_id`||!C.endsWith("_id")))),l=Object.fromEntries(Object.entries(I).filter(([C])=>!C.endsWith("_id")));return{primary_id:c,other_ids:B,...l,_og_elm:I}}),r=s.map(I=>{let c="";const B=l=>{const C=Object.keys(l.other_ids).find(h=>h.startsWith("source_"));if(!C)return`.${l.name}`;const Q=C.slice(0,-3),E=s.find(h=>h.type===Q&&h.primary_id===l.other_ids[C]);return E?"name"in E?`${B(E)} > .${l.name}`:`#${E.primary_id} > .${l.name}`:`??? > .${l.name}`};return"name"in I&&(c=B(I)),{...I,selector_path:c}}),a=[{key:"primary_id",name:"primary_id",renderCell:I=>O.jsxs("div",{className:"rf-flex rf-items-center",children:[O.jsx(EW,{text:I.primary_id,onClick:()=>o({focused_id:I.primary_id,id_search:void 0,selector_search:void 0})}),O.jsx("span",{className:"rf-flex-grow"}),O.jsx(EW,{text:"(JSON)",onClick:()=>e({open:!0,element:I._og_elm,title:I.primary_id})})]}),renderHeaderCell:I=>O.jsx(hW,{column:I,onTextChange:c=>o({id_search:c}),field:i.focused_id?()=>O.jsxs("div",{children:["Focus:"," ",O.jsx("span",{className:"rf-underline",children:i.focused_id}),O.jsx(EW,{text:"(unfocus)",onClick:()=>o({focused_id:void 0})})]}):void 0})},{key:"type",name:"type",renderHeaderCell:I=>O.jsx(hW,{column:I,field:()=>O.jsxs("select",{onChange:c=>o({component_type_filter:c.target.value}),className:"rf-border rf-rounded rf-p-1 rf-w-full",children:[O.jsx("option",{value:"any",children:"any"},"any"),O.jsx("option",{value:"source",children:"source"},"source"),O.jsx("option",{value:"source/pcb",children:"source/pcb"},"source/pcb"),O.jsx("option",{value:"source/schematic",children:"source/schematic"},"source/schematic"),n.map(c=>O.jsx("option",{value:c,children:c},c))]})})},{key:"name",name:"name",renderHeaderCell:I=>O.jsx(hW,{column:I,onTextChange:c=>o({name_search:c})})},{key:"selector_path",name:"selector_path",renderHeaderCell:I=>O.jsx(hW,{column:I,onTextChange:c=>o({selector_search:c})})},{key:"other_ids",name:"other_ids",renderCell:I=>O.jsx("div",{className:"rf-space-x-2",children:Object.entries(I.other_ids).map(([c,B])=>O.jsx(EW,{text:B,onClick:()=>o({focused_id:B})},B))})}],g=r.filter(I=>i.name_search?I.name?.toLowerCase()?.includes(i.name_search.toLowerCase()):!0).filter(I=>!i.component_type_filter||i.component_type_filter==="any"?!0:i.component_type_filter==="source"?I.type.startsWith("source_"):i.component_type_filter==="source/pcb"?I.type.startsWith("source_")||I.type.startsWith("pcb_"):i.component_type_filter==="source/schematic"?I.type.startsWith("source_")||I.type.startsWith("schematic_"):I.type?.includes(i.component_type_filter)).filter(I=>i.selector_search?i.selector_search.split(" ").filter(B=>B.length>0).every(B=>I.selector_path?.includes(B)):!0).filter(I=>i.id_search?I.primary_id?.includes(i.id_search):!0).filter(I=>!!(!i.focused_id||I.primary_id===i.focused_id||Object.values(I.other_ids).includes(i.focused_id)));return O.jsxs("div",{className:"rf-font-mono rf-text-xs rf-bg-white",children:[O.jsx("div",{className:"rf-overflow-x-auto",children:O.jsxs("table",{className:"rf-table-auto rf-w-full rf-text-left",children:[O.jsx("thead",{children:O.jsx("tr",{children:a.map(I=>O.jsx("th",{className:"rf-px-4 rf-py-2 rf-border-b",children:I.renderHeaderCell?I.renderHeaderCell(I):I.name},I.key))})}),O.jsx("tbody",{children:g.map((I,c)=>O.jsx("tr",{className:"rf-hover:bg-gray-100",children:a.map(B=>O.jsx("td",{className:"rf-px-4 rf-py-2 rf-border-b",children:B.renderCell?B.renderCell(I):I[B.key]},B.key))},c))})]})}),O.jsx(W2t,{open:A.open,onClose:()=>e({open:!1}),title:A.open?A.title:"",children:O.jsx("div",{className:"rf-bg-gray-800 rf-p-3 rf-text-white rf-rounded",children:O.jsx("pre",{className:"rf-whitespace-pre-wrap",children:A.open?JSON.stringify(A.element,null,2):""})})})]})},V2t=(t,A)=>t==="jlcpcb"?O.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${A}`,children:A}):A,j2t=({circuitJson:t})=>{const A=t.filter(i=>i.type==="source_component"),e=new Set;for(const i of A)if(i.supplier_part_numbers)for(const o of Object.keys(i.supplier_part_numbers))e.add(o);return O.jsx("div",{className:"rf-overflow-x-auto",children:O.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"rf-border-b",children:[O.jsx("th",{className:"rf-p-2",children:"Name"}),Array.from(e).map(i=>O.jsx("th",{className:"rf-p-2 rf-capitalize",children:i},i))]})}),O.jsx("tbody",{children:A.map(i=>O.jsxs("tr",{className:"rf-border-b",children:[O.jsx("td",{className:"rf-p-2",children:i.name}),Array.from(e).map(o=>O.jsx("td",{className:"rf-p-2",children:V2t(o,i.supplier_part_numbers?.[o]?.[0]||"")},o))]},i.source_component_id))})]})})},yEA=z.forwardRef(({className:t,type:A,...e},i)=>O.jsx("input",{type:A,className:Hi("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",t),ref:i,...e}));yEA.displayName="Input";var JAe={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}}},mEA=new Set;for(const[t,A]of Object.entries(JAe)){mEA.add(t);for(const e of Object.keys(A.variants))mEA.add(e)}function z2t(t){for(const[A,e]of Object.entries(JAe))if(t in e.variants)return{baseUnit:e.baseUnit,conversionFactor:e.variants[t]};return{baseUnit:t,conversionFactor:1}}var TAe={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 vm(t){if(t==null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof t=="string"&&t.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(t),parsedUnit:null,unitOfValue:null};if(typeof t=="number")return{value:t,parsedUnit:null,unitOfValue:null};if(typeof t=="object"&&"x"in t&&"y"in t){const{parsedUnit:r,unitOfValue:a}=vm(t.x),g=vm(t.x),I=vm(t.y);return g.value===null||I.value===null?{parsedUnit:null,unitOfValue:null,value:null}:{parsedUnit:r,unitOfValue:a,value:{x:g.value,y:I.value}}}const e=t.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!e)throw new Error(`Could not determine unit: "${t}"`);const i=e.split("").reverse().join(""),o=t.slice(0,-i.length);if(i in TAe&&!mEA.has(i)){const r=TAe[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(o)*r}}const{baseUnit:n,conversionFactor:s}=z2t(i);return{parsedUnit:i,unitOfValue:n,value:s*Number.parseFloat(o)}}var uW=v().or(MA()).transform(t=>vm(t).value),wEA=v().or(MA()).transform(t=>vm(t).value).transform(t=>Number.parseFloat(t.toPrecision(12))),KAe=v().or(MA()).transform(t=>vm(t).value),QF=v().or(MA()).transform(t=>vm(t).value),Pi=v().or(MA()).transform(t=>vm(t).value),uH=v().or(MA()).transform(t=>vm(t).value),ut=Pi,dW=v().or(MA()).transform(t=>vm(t).value),dH=v().or(MA()).transform(t=>vm(t).value),X2t=dH,EF=dH,qAe=v().datetime(),Gd=v().or(MA()).transform(t=>typeof t=="number"?t:t.endsWith("deg")?Number.parseFloat(t.split("deg")[0]):t.endsWith("rad")?Number.parseFloat(t.split("rad")[0])*180/Math.PI:Number.parseFloat(t)),PAe=MA().or(v().endsWith("mAh")).transform(t=>{if(typeof t=="string"){const A=t.replace("mAh",""),e=Number.parseFloat(A);if(Number.isNaN(e))throw new Error("Invalid capacity");return e}return t}).describe("Battery capacity in mAh"),bo=xA({x:ut,y:ut}),$2t=bo,pH=xA({x:ut,y:ut,z:ut}),AUt=pH,DEA=xA({width:MA(),height:MA()}),eUt=t=>{const A="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:t},()=>A[Math.floor(Math.random()*A.length)]).join("")},zt=t=>v().optional().default(()=>`${t}_${eUt(10)}`),qx=Ze(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),OAe=Ze(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),bB=xA({type:QA("source_component"),ftype:v().optional(),source_component_id:v(),name:v(),manufacturer_part_number:v().optional(),supplier_part_numbers:Aa(OAe,fe(v())).optional(),display_value:v().optional(),are_pins_interchangeable:te().optional(),internally_connected_source_port_ids:fe(fe(v())).optional(),source_group_id:v().optional(),subcircuit_id:v().optional()}),SEA=bB.extend({ftype:QA("simple_capacitor"),capacitance:wEA,max_voltage_rating:QF.optional(),display_capacitance:v().optional(),max_decoupling_trace_length:ut.optional()}),bEA=bB.extend({ftype:QA("simple_resistor"),resistance:uW,display_resistance:v().optional()}),pW=bB.extend({ftype:QA("simple_diode")}),WAe=bB.extend({ftype:QA("simple_fiducial")}),xEA=pW.extend({ftype:QA("simple_led"),color:v().optional(),wavelength:v().optional()}),ZAe=bB.extend({ftype:QA("simple_ground")}),kEA=bB.extend({ftype:QA("simple_chip")}),GEA=bB.extend({ftype:QA("simple_power_source"),voltage:QF}),tUt=bB.extend({ftype:QA("simple_fuse"),current_rating_amps:MA().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:MA().describe("Voltage rating in volts, e.g. ±5V would be 5")}),FEA=bB.extend({ftype:QA("simple_battery"),capacity:PAe}),_EA=bB.extend({ftype:QA("simple_inductor"),inductance:KAe,max_current_rating:MA().optional()}),REA=bB.extend({ftype:QA("simple_push_button")}),NEA=bB.extend({ftype:QA("simple_potentiometer"),max_resistance:uW}),VAe=bB.extend({ftype:QA("simple_crystal"),frequency:MA().describe("Frequency in Hz"),load_capacitance:MA().optional().describe("Load capacitance in pF")}),MEA=bB.extend({ftype:QA("simple_pin_header"),pin_count:MA(),gender:Ze(["male","female"]).optional().default("male")}),vEA=bB.extend({ftype:QA("simple_pinout")}),UEA=bB.extend({ftype:QA("simple_resonator"),load_capacitance:wEA,equivalent_series_resistance:uW.optional(),frequency:uH}),LEA=bB.extend({ftype:QA("simple_transistor"),transistor_type:Ze(["npn","pnp"])}),HEA=bB.extend({ftype:QA("simple_test_point"),footprint_variant:Ze(["pad","through_hole"]).optional(),pad_shape:Ze(["rect","circle"]).optional(),pad_diameter:Wt([MA(),v()]).optional(),hole_diameter:Wt([MA(),v()]).optional(),width:Wt([MA(),v()]).optional(),height:Wt([MA(),v()]).optional()}),YEA=bB.extend({ftype:QA("simple_mosfet"),channel_type:Ze(["n","p"]),mosfet_mode:Ze(["enhancement","depletion"])}),JEA=bB.extend({ftype:QA("simple_switch")}),TEA=xA({type:QA("source_project_metadata"),name:v().optional(),software_used_string:v().optional(),project_url:v().optional(),created_at:qAe.optional()}),jAe=xA({type:QA("source_missing_property_error"),source_missing_property_error_id:zt("source_missing_property_error"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_missing_property_error").default("source_missing_property_error"),message:v()}).describe("The source code is missing a property"),zAe=xA({type:QA("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:zt("source_failed_to_create_component_error"),error_type:QA("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:v().optional(),subcircuit_id:v().optional(),parent_source_component_id:v().optional(),message:v(),pcb_center:xA({x:MA().optional(),y:MA().optional()}).optional(),schematic_center:xA({x:MA().optional(),y:MA().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),KEA=xA({type:QA("source_trace_not_connected_error"),source_trace_not_connected_error_id:zt("source_trace_not_connected_error"),error_type:QA("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:v(),subcircuit_id:v().optional(),source_group_id:v().optional(),source_trace_id:v().optional(),connected_source_port_ids:fe(v()).optional(),selectors_not_found:fe(v()).optional()}).describe("Occurs when a source trace selector does not match any ports"),XAe=xA({type:QA("source_property_ignored_warning"),source_property_ignored_warning_id:zt("source_property_ignored_warning"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_property_ignored_warning").default("source_property_ignored_warning"),message:v()}).describe("The source property was ignored"),qEA=xA({type:QA("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:zt("source_pin_missing_trace_warning"),warning_type:QA("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),$Ae=bB.extend({ftype:QA("simple_voltage_probe")}),Aee=bB.extend({ftype:QA("interconnect")}),eee=Wt([bEA,SEA,pW,WAe,xEA,ZAe,kEA,GEA,FEA,_EA,REA,NEA,VAe,MEA,vEA,UEA,JEA,LEA,HEA,YEA,tUt,$Ae,Aee,TEA,jAe,zAe,KEA,XAe,qEA]),tee=xA({type:QA("source_port"),pin_number:MA().optional(),port_hints:fe(v()).optional(),name:v(),source_port_id:v(),source_component_id:v().optional(),source_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),must_be_connected:te().optional()}),iee=xA({type:QA("source_component_internal_connection"),source_component_internal_connection_id:v(),source_component_id:v(),source_port_ids:fe(v()),subcircuit_id:v().optional()}),oee=xA({type:QA("source_trace"),source_trace_id:v(),connected_source_port_ids:fe(v()),connected_source_net_ids:fe(v()),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),max_length:MA().optional(),min_trace_thickness:MA().optional(),display_name:v().optional()}),nee=xA({type:QA("source_group"),source_group_id:v(),subcircuit_id:v().optional(),parent_subcircuit_id:v().optional(),parent_source_group_id:v().optional(),is_subcircuit:te().optional(),show_as_schematic_box:te().optional(),name:v().optional(),was_automatically_named:te().optional()}),see=xA({type:QA("source_net"),source_net_id:v(),name:v(),member_source_group_ids:fe(v()),is_power:te().optional(),is_ground:te().optional(),is_digital_signal:te().optional(),is_analog_signal:te().optional(),is_positive_voltage_source:te().optional(),trace_width:MA().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),ree=xA({type:QA("source_board"),source_board_id:v(),source_group_id:v(),title:v().optional()}).describe("Defines a board in the source domain"),aee=xA({type:QA("source_pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional()}).describe("Defines a ground plane in the source domain"),gee=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],PEA=Ze(gee),xr=PEA.or(xA({name:PEA})).transform(t=>typeof t=="string"?t:t.name),Um=Ze(["top","bottom"]),Iee=xA({type:QA("source_manually_placed_via"),source_manually_placed_via_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional()}).describe("Defines a via that is manually placed in the source domain"),cee=xA({type:QA("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:zt("source_pin_must_be_connected_error"),error_type:QA("source_pin_must_be_connected_error").default("source_pin_must_be_connected_error"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when a pin with mustBeConnected attribute is not connected to any trace"),Bee=xA({type:QA("unknown_error_finding_part"),unknown_error_finding_part_id:zt("unknown_error_finding_part"),error_type:QA("unknown_error_finding_part").default("unknown_error_finding_part"),message:v(),source_component_id:v().optional(),subcircuit_id:v().optional()}).describe("Error emitted when an unexpected error occurs while finding a part"),lee=xA({type:QA("schematic_box"),schematic_component_id:v().optional(),width:ut,height:ut,is_dashed:te().default(!1),x:ut,y:ut,subcircuit_id:v().optional()}).describe("Draws a box on the schematic"),Cee=xA({type:QA("schematic_path"),schematic_component_id:v(),fill_color:Ze(["red","blue"]).optional(),is_filled:te().optional(),points:fe(bo),subcircuit_id:v().optional()}),Qee=Aa(xA({left_margin:Pi.optional(),right_margin:Pi.optional(),top_margin:Pi.optional(),bottom_margin:Pi.optional()})),Eee=xA({left_size:MA(),right_size:MA(),top_size:MA().optional(),bottom_size:MA().optional()}),hee=xA({left_side:xA({pins:fe(MA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:xA({pins:fe(MA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:xA({pins:fe(MA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:xA({pins:fe(MA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional()}),uee=Wt([Eee,hee]),dee=xA({type:QA("schematic_component"),size:DEA,center:bo,source_component_id:v().optional(),schematic_component_id:v(),pin_spacing:Pi.optional(),pin_styles:Qee.optional(),box_width:Pi.optional(),symbol_name:v().optional(),port_arrangement:uee.optional(),port_labels:Aa(v()).optional(),symbol_display_value:v().optional(),subcircuit_id:v().optional(),schematic_group_id:v().optional(),is_schematic_group:te().optional(),source_group_id:v().optional(),is_box_with_pins:te().optional().default(!0)}),pee=xA({type:QA("schematic_line"),schematic_line_id:zt("schematic_line"),schematic_component_id:v(),x1:ut,y1:ut,x2:ut,y2:ut,stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled line on the schematic"),fee=xA({type:QA("schematic_rect"),schematic_rect_id:zt("schematic_rect"),schematic_component_id:v(),center:bo,width:ut,height:ut,rotation:Gd.default(0),stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled rectangle on the schematic"),yee=xA({type:QA("schematic_circle"),schematic_circle_id:zt("schematic_circle"),schematic_component_id:v(),center:bo,radius:ut,stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled circle on the schematic"),mee=xA({type:QA("schematic_arc"),schematic_arc_id:zt("schematic_arc"),schematic_component_id:v(),center:bo,radius:ut,start_angle_degrees:Gd,end_angle_degrees:Gd,direction:Ze(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled arc on the schematic"),wee=xA({type:QA("schematic_trace"),schematic_trace_id:v(),source_trace_id:v().optional(),junctions:fe(xA({x:MA(),y:MA()})),edges:fe(xA({from:xA({x:MA(),y:MA()}),to:xA({x:MA(),y:MA()}),is_crossing:te().optional(),from_schematic_port_id:v().optional(),to_schematic_port_id:v().optional()})),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),iUt=Ze(["center","left","right","top","bottom"]),Dee=xA({type:QA("schematic_text"),schematic_component_id:v().optional(),schematic_text_id:v(),text:v(),font_size:MA().default(.18),position:xA({x:ut,y:ut}),rotation:MA().default(0),anchor:Wt([iUt.describe("legacy"),qx]).default("center"),color:v().default("#000000"),subcircuit_id:v().optional()}),See=xA({type:QA("schematic_port"),schematic_port_id:v(),source_port_id:v(),schematic_component_id:v().optional(),center:bo,facing_direction:Ze(["up","down","left","right"]).optional(),distance_from_component_edge:MA().optional(),side_of_component:Ze(["top","bottom","left","right"]).optional(),true_ccw_index:MA().optional(),pin_number:MA().optional(),display_pin_label:v().optional(),subcircuit_id:v().optional(),is_connected:te().optional(),has_input_arrow:te().optional(),has_output_arrow:te().optional()}).describe("Defines a port on a schematic component"),bee=xA({type:QA("schematic_net_label"),schematic_net_label_id:zt("schematic_net_label"),schematic_trace_id:v().optional(),source_trace_id:v().optional(),source_net_id:v(),center:bo,anchor_position:bo.optional(),anchor_side:Ze(["top","bottom","left","right"]),text:v(),symbol_name:v().optional(),is_movable:te().optional(),subcircuit_id:v().optional()}),xee=xA({type:QA("schematic_error"),schematic_error_id:v(),error_type:QA("schematic_port_not_found").default("schematic_port_not_found"),message:v(),subcircuit_id:v().optional()}).describe("Defines a schematic error on the schematic"),kee=xA({type:QA("schematic_layout_error"),schematic_layout_error_id:zt("schematic_layout_error"),error_type:QA("schematic_layout_error").default("schematic_layout_error"),message:v(),source_group_id:v(),schematic_group_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when schematic layout fails for a group"),fW=xA({type:QA("schematic_debug_object"),label:v().optional(),subcircuit_id:v().optional()}),Gee=fW.extend({shape:QA("rect"),center:bo,size:DEA}),Fee=fW.extend({shape:QA("line"),start:bo,end:bo}),_ee=fW.extend({shape:QA("point"),center:bo}),Ree=nE("shape",[Gee,Fee,_ee]),Nee=xA({type:QA("schematic_voltage_probe"),schematic_voltage_probe_id:v(),source_component_id:v().optional(),name:v().optional(),position:bo,schematic_trace_id:v(),voltage:QF.optional(),subcircuit_id:v().optional(),color:v().optional(),label_alignment:qx.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),Mee=xA({type:QA("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:zt("schematic_manual_edit_conflict_warning"),warning_type:QA("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:v(),schematic_component_id:v(),schematic_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),vee=xA({type:QA("schematic_group"),schematic_group_id:zt("schematic_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:Pi,height:Pi,center:bo,schematic_component_ids:fe(v()),show_as_schematic_box:te().optional(),name:v().optional(),description:v().optional()}).describe("Defines a group of components on the schematic"),Uee=xA({type:QA("schematic_table"),schematic_table_id:zt("schematic_table"),anchor_position:bo,column_widths:fe(ut),row_heights:fe(ut),cell_padding:ut.optional(),border_width:ut.optional(),subcircuit_id:v().optional(),schematic_component_id:v().optional(),anchor:qx.optional()}).describe("Defines a table on the schematic"),Lee=xA({type:QA("schematic_table_cell"),schematic_table_cell_id:zt("schematic_table_cell"),schematic_table_id:v(),start_row_index:MA(),end_row_index:MA(),start_column_index:MA(),end_column_index:MA(),text:v().optional(),center:bo,width:ut,height:ut,horizontal_align:Ze(["left","center","right"]).optional(),vertical_align:Ze(["top","middle","bottom"]).optional(),font_size:ut.optional(),subcircuit_id:v().optional()}).describe("Defines a cell within a schematic_table"),Hee=xA({type:QA("schematic_sheet"),schematic_sheet_id:zt("schematic_sheet"),name:v().optional(),subcircuit_id:v().optional()}).describe("Defines a schematic sheet or page that components can be placed on"),Yee=xA({x:ut,y:ut,bulge:MA().optional()}),OEA=xA({vertices:fe(Yee)}),Jee=xA({outer_ring:OEA,inner_rings:fe(OEA).default([])}),Tee=xA({x:ut,y:ut,via:te().optional(),via_to_layer:xr.optional()}),oUt=fe(Tee),Kee=xA({x:ut,y:ut,via:te().optional(),to_layer:xr.optional(),trace_width:ut.optional()}),qee=xA({type:QA("pcb_component"),pcb_component_id:zt("pcb_component"),source_component_id:v(),center:bo,layer:xr,rotation:Gd,display_offset_x:v().optional().describe("How to display the x offset for this part, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this part, usually corresponding with how the user specified it"),width:Pi,height:Pi,do_not_place:te().optional(),subcircuit_id:v().optional(),pcb_group_id:v().optional(),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),obstructs_within_bounds:te().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"),Pee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("circle"),hole_diameter:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),nUt=Pee.describe("Defines a circular hole on the PCB"),Oee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("rect"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),sUt=Oee.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),Wee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:Ze(["circle","square"]),hole_diameter:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),rUt=Wee.describe("Defines a circular or square hole on the PCB"),Zee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("oval"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),aUt=Zee.describe("Defines an oval hole on the PCB"),Vee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("pill"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),gUt=Vee.describe("Defines a pill-shaped hole on the PCB"),jee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("rotated_pill"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,ccw_rotation:Gd,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),IUt=jee.describe("Defines a rotated pill-shaped hole on the PCB"),zee=Wee.or(Zee).or(Vee).or(jee).or(Pee).or(Oee),cUt=xA({type:QA("pcb_plated_hole"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_diameter:MA(),hole_diameter:MA(),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),BUt=xA({type:QA("pcb_plated_hole"),shape:Ze(["oval","pill"]),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_width:MA(),outer_height:MA(),hole_width:MA(),hole_height:MA(),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,ccw_rotation:Gd,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),lUt=xA({type:QA("pcb_plated_hole"),shape:QA("circular_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("circle"),pad_shape:QA("rect"),hole_diameter:MA(),rect_pad_width:MA(),rect_pad_height:MA(),rect_border_radius:MA().optional(),hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),CUt=xA({type:QA("pcb_plated_hole"),shape:QA("pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("pill"),pad_shape:QA("rect"),hole_width:MA(),hole_height:MA(),rect_pad_width:MA(),rect_pad_height:MA(),rect_border_radius:MA().optional(),hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),QUt=xA({type:QA("pcb_plated_hole"),shape:QA("rotated_pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("rotated_pill"),pad_shape:QA("rect"),hole_width:MA(),hole_height:MA(),hole_ccw_rotation:Gd,rect_pad_width:MA(),rect_pad_height:MA(),rect_border_radius:MA().optional(),rect_ccw_rotation:Gd,hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),EUt=xA({type:QA("pcb_plated_hole"),shape:QA("hole_with_polygon_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:Ze(["circle","oval","pill","rotated_pill"]),hole_diameter:MA().optional(),hole_width:MA().optional(),hole_height:MA().optional(),pad_outline:fe(xA({x:ut,y:ut})).min(3),hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),Xee=Wt([cUt,BUt,lUt,CUt,QUt,EUt]),$ee=xA({type:QA("pcb_port"),pcb_port_id:zt("pcb_port"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_port_id:v(),pcb_component_id:v().optional(),x:ut,y:ut,layers:fe(xr),is_board_pinout:te().optional()}).describe("Defines a port on the PCB"),hUt=xA({type:QA("pcb_smtpad"),shape:QA("circle"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,radius:MA(),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),uUt=xA({type:QA("pcb_smtpad"),shape:QA("rect"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),rect_border_radius:MA().optional(),corner_radius:MA().optional(),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),dUt=xA({type:QA("pcb_smtpad"),shape:QA("rotated_rect"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),rect_border_radius:MA().optional(),corner_radius:MA().optional(),ccw_rotation:Gd,layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),Ate=xA({type:QA("pcb_smtpad"),shape:QA("pill"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),radius:MA(),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),pUt=xA({type:QA("pcb_smtpad"),shape:QA("rotated_pill"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),radius:MA(),ccw_rotation:Gd,layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),fUt=xA({type:QA("pcb_smtpad"),shape:QA("polygon"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),points:fe(bo),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),ete=nE("shape",[hUt,uUt,dUt,pUt,Ate,fUt]).describe("Defines an SMT pad on the PCB"),yUt=xA({type:QA("pcb_solder_paste"),shape:QA("circle"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,radius:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),mUt=xA({type:QA("pcb_solder_paste"),shape:QA("rect"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),wUt=xA({type:QA("pcb_solder_paste"),shape:QA("pill"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),radius:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),DUt=xA({type:QA("pcb_solder_paste"),shape:QA("rotated_rect"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),ccw_rotation:ut,layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),SUt=xA({type:QA("pcb_solder_paste"),shape:QA("oval"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),tte=Wt([yUt,mUt,wUt,DUt,SUt]).describe("Defines solderpaste on the PCB"),ite=xA({type:QA("pcb_text"),pcb_text_id:zt("pcb_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),text:v(),center:bo,layer:xr,width:Pi,height:Pi,lines:MA(),align:Ze(["bottom-left"])}).describe("Defines text on the PCB"),ote=xA({route_type:QA("wire"),x:ut,y:ut,width:ut,start_pcb_port_id:v().optional(),end_pcb_port_id:v().optional(),layer:xr}),nte=xA({route_type:QA("via"),x:ut,y:ut,hole_diameter:ut.optional(),outer_diameter:ut.optional(),from_layer:v(),to_layer:v()}),ste=Wt([ote,nte]),rte=xA({type:QA("pcb_trace"),source_trace_id:v().optional(),pcb_component_id:v().optional(),pcb_trace_id:zt("pcb_trace"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),route_thickness_mode:Ze(["constant","interpolated"]).default("constant").optional(),route_order_index:MA().optional(),should_round_corners:te().optional(),trace_length:MA().optional(),highlight_color:v().optional(),route:fe(ste)}).describe("Defines a trace on the PCB"),ate=xA({type:QA("pcb_trace_error"),pcb_trace_error_id:zt("pcb_trace_error"),error_type:QA("pcb_trace_error").default("pcb_trace_error"),message:v(),center:bo.optional(),pcb_trace_id:v(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB"),gte=xA({type:QA("pcb_trace_missing_error"),pcb_trace_missing_error_id:zt("pcb_trace_missing_error"),error_type:QA("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:v(),center:bo.optional(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),Ite=xA({type:QA("pcb_port_not_matched_error"),pcb_error_id:zt("pcb_error"),error_type:QA("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:v(),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),cte=xA({type:QA("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:zt("pcb_port_not_connected_error"),error_type:QA("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:v(),pcb_port_ids:fe(v()),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),Bte=xA({type:QA("pcb_net"),pcb_net_id:zt("pcb_net"),source_net_id:v().optional(),highlight_color:v().optional()}).describe("Defines a net on the PCB"),lte=xA({type:QA("pcb_via"),pcb_via_id:zt("pcb_via"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),x:ut,y:ut,outer_diameter:ut.default("0.6mm"),hole_diameter:ut.default("0.25mm"),from_layer:xr.optional(),to_layer:xr.optional(),layers:fe(xr),pcb_trace_id:v().optional(),net_is_assignable:te().optional(),net_assigned:te().optional(),is_tented:te().optional()}).describe("Defines a via on the PCB"),Cte=xA({type:QA("pcb_board"),pcb_board_id:zt("pcb_board"),pcb_panel_id:v().optional(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:Pi.optional(),height:Pi.optional(),center:bo,display_offset_x:v().optional().describe("How to display the x offset for this board, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this board, usually corresponding with how the user specified it"),thickness:Pi.optional().default(1.4),num_layers:MA().optional().default(4),outline:fe(bo).optional(),shape:Ze(["rect","polygon"]).optional(),material:Ze(["fr4","fr1"]).default("fr4"),anchor_position:bo.optional(),anchor_alignment:qx.optional(),position_mode:Ze(["relative_to_panel_anchor","none"]).optional()}).describe("Defines the board outline of the PCB"),Qte=xA({type:QA("pcb_panel"),pcb_panel_id:zt("pcb_panel"),width:Pi,height:Pi,center:bo,covered_with_solder_mask:te().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards"),Ete=xA({type:QA("pcb_placement_error"),pcb_placement_error_id:zt("pcb_placement_error"),error_type:QA("pcb_placement_error").default("pcb_placement_error"),message:v(),subcircuit_id:v().optional()}).describe("Defines a placement error on the PCB"),hte=xA({type:QA("pcb_trace_hint"),pcb_trace_hint_id:zt("pcb_trace_hint"),pcb_port_id:v(),pcb_component_id:v(),route:fe(Kee),subcircuit_id:v().optional()}).describe("A hint that can be used during generation of a PCB trace"),ute=xA({type:QA("pcb_silkscreen_line"),pcb_silkscreen_line_id:zt("pcb_silkscreen_line"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),stroke_width:ut.default("0.1mm"),x1:ut,y1:ut,x2:ut,y2:ut,layer:Um}).describe("Defines a silkscreen line on the PCB"),dte=xA({type:QA("pcb_silkscreen_path"),pcb_silkscreen_path_id:zt("pcb_silkscreen_path"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,route:fe(bo),stroke_width:Pi}).describe("Defines a silkscreen path on the PCB"),pte=xA({type:QA("pcb_silkscreen_text"),pcb_silkscreen_text_id:zt("pcb_silkscreen_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:Pi,top:Pi,bottom:Pi,right:Pi}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:MA().optional(),layer:xr,is_mirrored:te().default(!1).optional(),anchor_position:bo.default({x:0,y:0}),anchor_alignment:qx.default("center")}).describe("Defines silkscreen text on the PCB"),fte=xA({type:QA("pcb_copper_text"),pcb_copper_text_id:zt("pcb_copper_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:Pi,top:Pi,bottom:Pi,right:Pi}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:MA().optional(),layer:xr,is_mirrored:te().default(!1).optional(),anchor_position:bo.default({x:0,y:0}),anchor_alignment:qx.default("center")}).describe("Defines copper text on the PCB"),yte=xA({type:QA("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:zt("pcb_silkscreen_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:xr,stroke_width:Pi.default("1mm"),corner_radius:Pi.optional(),is_filled:te().default(!0).optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional()}).describe("Defines a silkscreen rect on the PCB"),mte=xA({type:QA("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:zt("pcb_silkscreen_circle"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,radius:Pi,layer:Um,stroke_width:Pi.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),wte=xA({type:QA("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:zt("pcb_silkscreen_oval"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,radius_x:ut,radius_y:ut,layer:Um}).describe("Defines a silkscreen oval on the PCB"),Dte=xA({type:QA("pcb_silkscreen_pill"),pcb_silkscreen_pill_id:zt("pcb_silkscreen_pill"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:xr}).describe("Defines a silkscreen pill on the PCB"),Ste=xA({type:QA("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:zt("pcb_fabrication_note_text"),subcircuit_id:v().optional(),pcb_group_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("1mm"),pcb_component_id:v(),text:v(),layer:Um,anchor_position:bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),bte=xA({type:QA("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:zt("pcb_fabrication_note_path"),pcb_component_id:v(),subcircuit_id:v().optional(),layer:xr,route:fe(bo),stroke_width:Pi,color:v().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),xte=xA({type:QA("pcb_fabrication_note_rect"),pcb_fabrication_note_rect_id:zt("pcb_fabrication_note_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:Um,stroke_width:Pi.default("0.1mm"),corner_radius:Pi.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a fabrication note rectangle on the PCB"),kte=xA({type:QA("pcb_fabrication_note_dimension"),pcb_fabrication_note_dimension_id:zt("pcb_fabrication_note_dimension"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,from:bo,to:bo,text:v().optional(),text_ccw_rotation:MA().optional(),offset:Pi.optional(),offset_distance:Pi.optional(),offset_direction:xA({x:MA(),y:MA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:Pi.default("1mm"),color:v().optional(),arrow_size:Pi.default("1mm")}).describe("Defines a measurement annotation within PCB fabrication notes"),Gte=xA({type:QA("pcb_note_text"),pcb_note_text_id:zt("pcb_note_text"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("1mm"),text:v().optional(),anchor_position:bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a documentation note in text on the PCB"),Fte=xA({type:QA("pcb_note_rect"),pcb_note_rect_id:zt("pcb_note_rect"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),center:bo,width:Pi,height:Pi,stroke_width:Pi.default("0.1mm"),corner_radius:Pi.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a rectangular documentation note on the PCB"),_te=xA({type:QA("pcb_note_path"),pcb_note_path_id:zt("pcb_note_path"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),route:fe(bo),stroke_width:Pi.default("0.1mm"),color:v().optional()}).describe("Defines a polyline documentation note on the PCB"),Rte=xA({type:QA("pcb_note_line"),pcb_note_line_id:zt("pcb_note_line"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),x1:ut,y1:ut,x2:ut,y2:ut,stroke_width:ut.default("0.1mm"),color:v().optional(),is_dashed:te().optional()}).describe("Defines a straight documentation note line on the PCB"),Nte=xA({type:QA("pcb_note_dimension"),pcb_note_dimension_id:zt("pcb_note_dimension"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),from:bo,to:bo,text:v().optional(),text_ccw_rotation:MA().optional(),offset_distance:Pi.optional(),offset_direction:xA({x:MA(),y:MA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:Pi.default("1mm"),color:v().optional(),arrow_size:Pi.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes"),Mte=xA({type:QA("pcb_footprint_overlap_error"),pcb_error_id:zt("pcb_error"),error_type:QA("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:v(),pcb_smtpad_ids:fe(v()).optional(),pcb_plated_hole_ids:fe(v()).optional(),pcb_hole_ids:fe(v()).optional(),pcb_keepout_ids:fe(v()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),vte=xA({type:QA("pcb_keepout"),shape:QA("rect"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:ut,height:ut,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()}).or(xA({type:QA("pcb_keepout"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,radius:ut,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()})),yW=xA({type:QA("pcb_cutout"),pcb_cutout_id:zt("pcb_cutout"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_board_id:v().optional(),pcb_panel_id:v().optional()}),Ute=yW.extend({shape:QA("rect"),center:bo,width:Pi,height:Pi,rotation:Gd.optional(),corner_radius:Pi.optional()}),Lte=yW.extend({shape:QA("circle"),center:bo,radius:Pi}),Hte=yW.extend({shape:QA("polygon"),points:fe(bo)}),Yte=yW.extend({shape:QA("path"),route:fe(bo),slot_width:Pi,slot_length:Pi.optional(),space_between_slots:Pi.optional(),slot_corner_radius:Pi.optional()}),Jte=nE("shape",[Ute,Lte,Hte,Yte]).describe("Defines a cutout on the PCB, removing board material."),Tte=xA({type:QA("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:zt("pcb_missing_footprint_error"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:v(),message:v()}).describe("Defines a missing footprint error on the PCB"),Kte=xA({type:QA("external_footprint_load_error"),external_footprint_load_error_id:zt("external_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),error_type:QA("external_footprint_load_error").default("external_footprint_load_error"),message:v()}).describe("Defines an error when an external footprint fails to load"),qte=xA({type:QA("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:zt("circuit_json_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),message:v(),circuit_json:fe(Kg()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),Pte=xA({type:QA("pcb_group"),pcb_group_id:zt("pcb_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:Pi.optional(),height:Pi.optional(),center:bo,display_offset_x:v().optional().describe("How to display the x offset for this group, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this group, usually corresponding with how the user specified it"),outline:fe(bo).optional(),anchor_position:bo.optional(),anchor_alignment:qx.default("center"),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),pcb_component_ids:fe(v()),child_layout_mode:Ze(["packed","none"]).optional(),name:v().optional(),description:v().optional(),layout_mode:v().optional(),autorouter_configuration:xA({trace_clearance:Pi}).optional(),autorouter_used_string:v().optional()}).describe("Defines a group of components on the PCB"),Ote=xA({type:QA("pcb_autorouting_error"),pcb_error_id:zt("pcb_autorouting_error"),error_type:QA("pcb_autorouting_error").default("pcb_autorouting_error"),message:v(),subcircuit_id:v().optional()}).describe("The autorouting has failed to route a portion of the board"),Wte=xA({type:QA("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:zt("pcb_manual_edit_conflict_warning"),warning_type:QA("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:v(),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),Zte=xA({type:QA("pcb_breakout_point"),pcb_breakout_point_id:zt("pcb_breakout_point"),pcb_group_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional(),source_port_id:v().optional(),source_net_id:v().optional(),x:ut,y:ut}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),Vte=xA({type:QA("pcb_ground_plane"),pcb_ground_plane_id:zt("pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_net_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional()}).describe("Defines a ground plane on the PCB"),jte=xA({type:QA("pcb_ground_plane_region"),pcb_ground_plane_region_id:zt("pcb_ground_plane_region"),pcb_ground_plane_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:xr,points:fe(bo)}).describe("Defines a polygon region of a ground plane"),zte=xA({type:QA("pcb_thermal_spoke"),pcb_thermal_spoke_id:zt("pcb_thermal_spoke"),pcb_ground_plane_id:v(),shape:v(),spoke_count:MA(),spoke_thickness:ut,spoke_inner_diameter:ut,spoke_outer_diameter:ut,pcb_plated_hole_id:v().optional(),subcircuit_id:v().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),WEA=xA({type:QA("pcb_copper_pour"),pcb_copper_pour_id:zt("pcb_copper_pour"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:xr,source_net_id:v().optional(),covered_with_solder_mask:te().optional().default(!0)}),Xte=WEA.extend({shape:QA("rect"),center:bo,width:Pi,height:Pi,rotation:Gd.optional()}),$te=WEA.extend({shape:QA("brep"),brep_shape:Jee}),Aie=WEA.extend({shape:QA("polygon"),points:fe(bo)}),eie=nE("shape",[Xte,$te,Aie]).describe("Defines a copper pour on the PCB."),tie=xA({type:QA("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:zt("pcb_component_outside_board_error"),error_type:QA("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),message:v(),pcb_component_id:v(),pcb_board_id:v(),component_center:bo,component_bounds:xA({min_x:MA(),max_x:MA(),min_y:MA(),max_y:MA()}),subcircuit_id:v().optional(),source_component_id:v().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),iie=xA({type:QA("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:zt("pcb_component_invalid_layer_error"),error_type:QA("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),message:v(),pcb_component_id:v().optional(),source_component_id:v(),layer:xr,subcircuit_id:v().optional()}).describe("Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)"),oie=xA({type:QA("pcb_via_clearance_error"),pcb_error_id:zt("pcb_error"),error_type:QA("pcb_via_clearance_error").default("pcb_via_clearance_error"),message:v(),pcb_via_ids:fe(v()).min(2),minimum_clearance:ut.optional(),actual_clearance:ut.optional(),pcb_center:xA({x:MA().optional(),y:MA().optional()}).optional(),subcircuit_id:v().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),nie=xA({type:QA("pcb_courtyard_rect"),pcb_courtyard_rect_id:zt("pcb_courtyard_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:Um,color:v().optional()}).describe("Defines a courtyard rectangle on the PCB"),sie=xA({type:QA("pcb_courtyard_outline"),pcb_courtyard_outline_id:zt("pcb_courtyard_outline"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,outline:fe(bo).min(2),stroke_width:Pi.default("0.1mm"),is_closed:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a courtyard outline on the PCB"),rie=xA({type:QA("pcb_courtyard_polygon"),pcb_courtyard_polygon_id:zt("pcb_courtyard_polygon"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,points:fe(bo).min(3),color:v().optional()}).describe("Defines a courtyard polygon on the PCB"),aie=xA({type:QA("cad_component"),cad_component_id:v(),pcb_component_id:v(),source_component_id:v(),position:pH,rotation:pH.optional(),size:pH.optional(),layer:xr.optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),model_obj_url:v().optional(),model_stl_url:v().optional(),model_3mf_url:v().optional(),model_gltf_url:v().optional(),model_glb_url:v().optional(),model_step_url:v().optional(),model_wrl_url:v().optional(),model_unit_to_mm_scale_factor:MA().optional(),model_jscad:Kg().optional(),show_as_translucent_model:te().optional()}).describe("Defines a component on the PCB"),ZEA=Ze(["sinewave","square","triangle","sawtooth"]),bUt=Wt([v(),MA()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(MA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),gie=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:zt("simulation_voltage_source"),is_dc_source:QA(!0).optional().default(!0),positive_source_port_id:v().optional(),negative_source_port_id:v().optional(),positive_source_net_id:v().optional(),negative_source_net_id:v().optional(),voltage:QF}).describe("Defines a DC voltage source for simulation"),Iie=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:zt("simulation_voltage_source"),is_dc_source:QA(!1),terminal1_source_port_id:v().optional(),terminal2_source_port_id:v().optional(),terminal1_source_net_id:v().optional(),terminal2_source_net_id:v().optional(),voltage:QF.optional(),frequency:uH.optional(),peak_to_peak_voltage:QF.optional(),wave_shape:ZEA.optional(),phase:Gd.optional(),duty_cycle:bUt.optional()}).describe("Defines an AC voltage source for simulation"),cie=Wt([gie,Iie]).describe("Defines a voltage source for simulation"),xUt=Wt([v(),MA()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(MA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),Bie=xA({type:QA("simulation_current_source"),simulation_current_source_id:zt("simulation_current_source"),is_dc_source:QA(!0).optional().default(!0),positive_source_port_id:v().optional(),negative_source_port_id:v().optional(),positive_source_net_id:v().optional(),negative_source_net_id:v().optional(),current:dW}).describe("Defines a DC current source for simulation"),lie=xA({type:QA("simulation_current_source"),simulation_current_source_id:zt("simulation_current_source"),is_dc_source:QA(!1),terminal1_source_port_id:v().optional(),terminal2_source_port_id:v().optional(),terminal1_source_net_id:v().optional(),terminal2_source_net_id:v().optional(),current:dW.optional(),frequency:uH.optional(),peak_to_peak_current:dW.optional(),wave_shape:ZEA.optional(),phase:Gd.optional(),duty_cycle:xUt.optional()}).describe("Defines an AC current source for simulation"),Cie=Wt([Bie,lie]).describe("Defines a current source for simulation"),Qie=Wt([QA("spice_dc_sweep"),QA("spice_dc_operating_point"),QA("spice_transient_analysis"),QA("spice_ac_analysis")]),Eie=xA({type:QA("simulation_experiment"),simulation_experiment_id:zt("simulation_experiment"),name:v(),experiment_type:Qie,time_per_step:dH.optional(),start_time_ms:EF.optional(),end_time_ms:EF.optional()}).describe("Defines a simulation experiment configuration"),hie=xA({type:QA("simulation_transient_voltage_graph"),simulation_transient_voltage_graph_id:zt("simulation_transient_voltage_graph"),simulation_experiment_id:v(),timestamps_ms:fe(MA()).optional(),voltage_levels:fe(MA()),source_component_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),time_per_step:dH,start_time_ms:EF,end_time_ms:EF,name:v().optional(),color:v().optional()}).describe("Stores voltage measurements over time for a simulation"),uie=xA({type:QA("simulation_switch"),simulation_switch_id:zt("simulation_switch"),source_component_id:v().optional(),closes_at:EF.optional(),opens_at:EF.optional(),starts_closed:te().optional(),switching_frequency:uH.optional()}).describe("Defines a switch for simulation timing control"),die=xA({type:QA("simulation_voltage_probe"),simulation_voltage_probe_id:zt("simulation_voltage_probe"),source_component_id:v().optional(),name:v().optional(),signal_input_source_port_id:v().optional(),signal_input_source_net_id:v().optional(),reference_input_source_port_id:v().optional(),reference_input_source_net_id:v().optional(),subcircuit_id:v().optional(),color:v().optional()}).describe("Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.").superRefine((t,A)=>{if(t.reference_input_source_port_id||t.reference_input_source_net_id){const i=!!t.signal_input_source_port_id||!!t.reference_input_source_port_id,o=!!t.signal_input_source_net_id||!!t.reference_input_source_net_id;i&&o?A.addIssue({code:Zt.custom,message:"Cannot mix port and net connections in a differential probe."}):i?(!t.signal_input_source_port_id||!t.reference_input_source_port_id)&&A.addIssue({code:Zt.custom,message:"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."}):o&&(!t.signal_input_source_net_id||!t.reference_input_source_net_id)&&A.addIssue({code:Zt.custom,message:"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."})}else!!t.signal_input_source_port_id==!!t.signal_input_source_net_id&&A.addIssue({code:Zt.custom,message:"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."})}),pie=xA({type:QA("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:zt("simulation_unknown_experiment_error"),error_type:QA("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),message:v(),simulation_experiment_id:v().optional(),subcircuit_id:v().optional()}).describe("An unknown error occurred during the simulation experiment."),fie=Wt([oee,tee,iee,eee,see,nee,kEA,SEA,pW,xEA,bEA,GEA,FEA,_EA,MEA,vEA,UEA,JEA,LEA,HEA,YEA,NEA,REA,aee,Iee,ree,TEA,KEA,qEA,cee,Bee,qee,zee,Tte,Kte,qte,Wte,Xee,vte,$ee,Bte,ite,rte,lte,ete,tte,Cte,Qte,Pte,hte,ute,dte,pte,Dte,fte,yte,mte,wte,ate,gte,Ete,Ite,cte,oie,bte,Ste,xte,kte,Gte,Fte,_te,Rte,Nte,Ote,Mte,Zte,Jte,Vte,jte,zte,eie,tie,iie,nie,sie,rie,lee,Dee,pee,fee,yee,mee,dee,See,wee,Cee,xee,kee,bee,Ree,Nee,Mee,vee,Hee,Uee,Lee,aie,cie,Cie,Eie,hie,uie,die,pie]),VEA=fie;const yie=Object.freeze(Object.defineProperty({__proto__:null,all_layers:gee,any_circuit_element:fie,any_soup_element:VEA,any_source_component:eee,battery_capacity:PAe,brep_shape:Jee,cad_component:aie,capacitance:wEA,circuit_json_footprint_load_error:qte,current:dW,distance:ut,duration_ms:dH,experiment_type:Qie,external_footprint_load_error:Kte,frequency:uH,getZodPrefixedIdWithDefault:zt,inductance:KAe,layer_ref:xr,layer_string:PEA,length:Pi,ms:EF,ninePointAnchor:qx,pcb_autorouting_error:Ote,pcb_board:Cte,pcb_breakout_point:Zte,pcb_component:qee,pcb_component_invalid_layer_error:iie,pcb_component_outside_board_error:tie,pcb_copper_pour:eie,pcb_copper_pour_brep:$te,pcb_copper_pour_polygon:Aie,pcb_copper_pour_rect:Xte,pcb_copper_text:fte,pcb_courtyard_outline:sie,pcb_courtyard_polygon:rie,pcb_courtyard_rect:nie,pcb_cutout:Jte,pcb_cutout_circle:Lte,pcb_cutout_path:Yte,pcb_cutout_polygon:Hte,pcb_cutout_rect:Ute,pcb_fabrication_note_dimension:kte,pcb_fabrication_note_path:bte,pcb_fabrication_note_rect:xte,pcb_fabrication_note_text:Ste,pcb_footprint_overlap_error:Mte,pcb_ground_plane:Vte,pcb_ground_plane_region:jte,pcb_group:Pte,pcb_hole:zee,pcb_hole_circle_or_square_shape:rUt,pcb_hole_circle_shape:nUt,pcb_hole_oval_shape:aUt,pcb_hole_pill_shape:gUt,pcb_hole_rect_shape:sUt,pcb_hole_rotated_pill_shape:IUt,pcb_keepout:vte,pcb_manual_edit_conflict_warning:Wte,pcb_missing_footprint_error:Tte,pcb_net:Bte,pcb_note_dimension:Nte,pcb_note_line:Rte,pcb_note_path:_te,pcb_note_rect:Fte,pcb_note_text:Gte,pcb_panel:Qte,pcb_placement_error:Ete,pcb_plated_hole:Xee,pcb_port:$ee,pcb_port_not_connected_error:cte,pcb_port_not_matched_error:Ite,pcb_route_hint:Tee,pcb_route_hints:oUt,pcb_silkscreen_circle:mte,pcb_silkscreen_line:ute,pcb_silkscreen_oval:wte,pcb_silkscreen_path:dte,pcb_silkscreen_pill:Dte,pcb_silkscreen_rect:yte,pcb_silkscreen_text:pte,pcb_smtpad:ete,pcb_smtpad_pill:Ate,pcb_solder_paste:tte,pcb_text:ite,pcb_thermal_spoke:zte,pcb_trace:rte,pcb_trace_error:ate,pcb_trace_hint:hte,pcb_trace_missing_error:gte,pcb_trace_route_point:ste,pcb_trace_route_point_via:nte,pcb_trace_route_point_wire:ote,pcb_via:lte,pcb_via_clearance_error:oie,point:bo,point3:pH,point_with_bulge:Yee,port_arrangement:uee,position:$2t,position3:AUt,resistance:uW,ring:OEA,rotation:Gd,route_hint_point:Kee,schematic_arc:mee,schematic_box:lee,schematic_circle:yee,schematic_component:dee,schematic_component_port_arrangement_by_sides:hee,schematic_component_port_arrangement_by_size:Eee,schematic_debug_line:Fee,schematic_debug_object:Ree,schematic_debug_object_base:fW,schematic_debug_point:_ee,schematic_debug_rect:Gee,schematic_error:xee,schematic_group:vee,schematic_layout_error:kee,schematic_line:pee,schematic_manual_edit_conflict_warning:Mee,schematic_net_label:bee,schematic_path:Cee,schematic_pin_styles:Qee,schematic_port:See,schematic_rect:fee,schematic_sheet:Hee,schematic_table:Uee,schematic_table_cell:Lee,schematic_text:Dee,schematic_trace:wee,schematic_voltage_probe:Nee,simulation_ac_current_source:lie,simulation_ac_voltage_source:Iie,simulation_current_source:Cie,simulation_dc_current_source:Bie,simulation_dc_voltage_source:gie,simulation_experiment:Eie,simulation_switch:uie,simulation_transient_voltage_graph:hie,simulation_unknown_experiment_error:pie,simulation_voltage_probe:die,simulation_voltage_source:cie,size:DEA,source_board:ree,source_component_base:bB,source_component_internal_connection:iee,source_failed_to_create_component_error:zAe,source_group:nee,source_interconnect:Aee,source_manually_placed_via:Iee,source_missing_property_error:jAe,source_net:see,source_pcb_ground_plane:aee,source_pin_missing_trace_warning:qEA,source_pin_must_be_connected_error:cee,source_port:tee,source_project_metadata:TEA,source_property_ignored_warning:XAe,source_simple_battery:FEA,source_simple_capacitor:SEA,source_simple_chip:kEA,source_simple_crystal:VAe,source_simple_diode:pW,source_simple_fiducial:WAe,source_simple_ground:ZAe,source_simple_inductor:_EA,source_simple_led:xEA,source_simple_mosfet:YEA,source_simple_pin_header:MEA,source_simple_pinout:vEA,source_simple_potentiometer:NEA,source_simple_power_source:GEA,source_simple_push_button:REA,source_simple_resistor:bEA,source_simple_resonator:UEA,source_simple_switch:JEA,source_simple_test_point:HEA,source_simple_transistor:LEA,source_simple_voltage_probe:$Ae,source_trace:oee,source_trace_not_connected_error:KEA,supplier_name:OAe,time:X2t,timestamp:qAe,unknown_error_finding_part:Bee,visible_layer:Um,voltage:QF,wave_shape:ZEA},Symbol.toStringTag,{value:"Module"})),fH=t=>typeof t=="number"&&!isNaN(t),hF=t=>typeof t=="string",B0=t=>typeof t=="function",mW=t=>hF(t)||B0(t)?t:null,jEA=t=>z.isValidElement(t)||hF(t)||B0(t)||fH(t);function kUt(t,A,e){e===void 0&&(e=300);const{scrollHeight:i,style:o}=t;requestAnimationFrame(()=>{o.minHeight="initial",o.height=i+"px",o.transition=`all ${e}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(A,e)})})}function wW(t){let{enter:A,exit:e,appendPosition:i=!1,collapse:o=!0,collapseDuration:n=300}=t;return function(s){let{children:r,position:a,preventExitTransition:g,done:I,nodeRef:c,isIn:B,playToast:l}=s;const C=i?`${A}--${a}`:A,Q=i?`${e}--${a}`:e,E=z.useRef(0);return z.useLayoutEffect(()=>{const h=c.current,u=C.split(" "),d=f=>{f.target===c.current&&(l(),h.removeEventListener("animationend",d),h.removeEventListener("animationcancel",d),E.current===0&&f.type!=="animationcancel"&&h.classList.remove(...u))};h.classList.add(...u),h.addEventListener("animationend",d),h.addEventListener("animationcancel",d)},[]),z.useEffect(()=>{const h=c.current,u=()=>{h.removeEventListener("animationend",u),o?kUt(h,I,n):I()};B||(g?u():(E.current=1,h.className+=` ${Q}`,h.addEventListener("animationend",u)))},[B]),to.createElement(to.Fragment,null,r)}}function mie(t,A){return t!=null?{content:t.content,containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,status:A}:{}}const Fd=new Map;let yH=[];const zEA=new Set,GUt=t=>zEA.forEach(A=>A(t)),wie=()=>Fd.size>0;function Die(t,A){var e;if(A)return!((e=Fd.get(A))==null||!e.isToastActive(t));let i=!1;return Fd.forEach(o=>{o.isToastActive(t)&&(i=!0)}),i}function Sie(t,A){jEA(t)&&(wie()||yH.push({content:t,options:A}),Fd.forEach(e=>{e.buildToast(t,A)}))}function bie(t,A){Fd.forEach(e=>{A!=null&&A!=null&&A.containerId?A?.containerId===e.id&&e.toggle(t,A?.id):e.toggle(t,A?.id)})}function FUt(t){const{subscribe:A,getSnapshot:e,setProps:i}=z.useRef((function(n){const s=n.containerId||1;return{subscribe(r){const a=(function(I,c,B){let l=1,C=0,Q=[],E=[],h=[],u=c;const d=new Map,f=new Set,w=()=>{h=Array.from(d.values()),f.forEach(x=>x())},D=x=>{E=x==null?[]:E.filter(F=>F!==x),w()},S=x=>{const{toastId:F,onOpen:k,updateId:U,children:N}=x.props,Y=U==null;x.staleId&&d.delete(x.staleId),d.set(F,x),E=[...E,x.props.toastId].filter(K=>K!==x.staleId),w(),B(mie(x,Y?"added":"updated")),Y&&B0(k)&&k(z.isValidElement(N)&&N.props)};return{id:I,props:u,observe:x=>(f.add(x),()=>f.delete(x)),toggle:(x,F)=>{d.forEach(k=>{F!=null&&F!==k.props.toastId||B0(k.toggle)&&k.toggle(x)})},removeToast:D,toasts:d,clearQueue:()=>{C-=Q.length,Q=[]},buildToast:(x,F)=>{if((iA=>{let{containerId:rA,toastId:CA,updateId:pA}=iA;const kA=rA?rA!==I:I!==1,_A=d.has(CA)&&pA==null;return kA||_A})(F))return;const{toastId:k,updateId:U,data:N,staleId:Y,delay:K}=F,J=()=>{D(k)},W=U==null;W&&C++;const Z={...u,style:u.toastStyle,key:l++,...Object.fromEntries(Object.entries(F).filter(iA=>{let[rA,CA]=iA;return CA!=null})),toastId:k,updateId:U,data:N,closeToast:J,isIn:!1,className:mW(F.className||u.toastClassName),bodyClassName:mW(F.bodyClassName||u.bodyClassName),progressClassName:mW(F.progressClassName||u.progressClassName),autoClose:!F.isLoading&&(AA=F.autoClose,nA=u.autoClose,AA===!1||fH(AA)&&AA>0?AA:nA),deleteToast(){const iA=d.get(k),{onClose:rA,children:CA}=iA.props;B0(rA)&&rA(z.isValidElement(CA)&&CA.props),B(mie(iA,"removed")),d.delete(k),C--,C<0&&(C=0),Q.length>0?S(Q.shift()):w()}};var AA,nA;Z.closeButton=u.closeButton,F.closeButton===!1||jEA(F.closeButton)?Z.closeButton=F.closeButton:F.closeButton===!0&&(Z.closeButton=!jEA(u.closeButton)||u.closeButton);let cA=x;z.isValidElement(x)&&!hF(x.type)?cA=z.cloneElement(x,{closeToast:J,toastProps:Z,data:N}):B0(x)&&(cA=x({closeToast:J,toastProps:Z,data:N}));const tA={content:cA,props:Z,staleId:Y};u.limit&&u.limit>0&&C>u.limit&&W?Q.push(tA):fH(K)?setTimeout(()=>{S(tA)},K):S(tA)},setProps(x){u=x},setToggle:(x,F)=>{d.get(x).toggle=F},isToastActive:x=>E.some(F=>F===x),getSnapshot:()=>h}})(s,n,GUt);Fd.set(s,a);const g=a.observe(r);return yH.forEach(I=>Sie(I.content,I.options)),yH=[],()=>{g(),Fd.delete(s)}},setProps(r){var a;(a=Fd.get(s))==null||a.setProps(r)},getSnapshot(){var r;return(r=Fd.get(s))==null?void 0:r.getSnapshot()}}})(t)).current;i(t);const o=z.useSyncExternalStore(A,e,e);return{getToastToRender:function(n){if(!o)return[];const s=new Map;return t.newestOnTop&&o.reverse(),o.forEach(r=>{const{position:a}=r.props;s.has(a)||s.set(a,[]),s.get(a).push(r)}),Array.from(s,r=>n(r[0],r[1]))},isToastActive:Die,count:o?.length}}function _Ut(t){const[A,e]=z.useState(!1),[i,o]=z.useState(!1),n=z.useRef(null),s=z.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:r,pauseOnHover:a,closeToast:g,onClick:I,closeOnClick:c}=t;var B,l;function C(){e(!0)}function Q(){e(!1)}function E(d){const f=n.current;s.canDrag&&f&&(s.didMove=!0,A&&Q(),s.delta=t.draggableDirection==="x"?d.clientX-s.start:d.clientY-s.start,s.start!==d.clientX&&(s.canCloseOnClick=!1),f.style.transform=`translate3d(${t.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 h(){document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",h);const d=n.current;if(s.canDrag&&s.didMove&&d){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return o(!0),t.closeToast(),void t.collapseAll();d.style.transition="transform 0.2s, opacity 0.2s",d.style.removeProperty("transform"),d.style.removeProperty("opacity")}}(l=Fd.get((B={id:t.toastId,containerId:t.containerId,fn:e}).containerId||1))==null||l.setToggle(B.id,B.fn),z.useEffect(()=>{if(t.pauseOnFocusLoss)return document.hasFocus()||Q(),window.addEventListener("focus",C),window.addEventListener("blur",Q),()=>{window.removeEventListener("focus",C),window.removeEventListener("blur",Q)}},[t.pauseOnFocusLoss]);const u={onPointerDown:function(d){if(t.draggable===!0||t.draggable===d.pointerType){s.didMove=!1,document.addEventListener("pointermove",E),document.addEventListener("pointerup",h);const f=n.current;s.canCloseOnClick=!0,s.canDrag=!0,f.style.transition="none",t.draggableDirection==="x"?(s.start=d.clientX,s.removalDistance=f.offsetWidth*(t.draggablePercent/100)):(s.start=d.clientY,s.removalDistance=f.offsetHeight*(t.draggablePercent===80?1.5*t.draggablePercent:t.draggablePercent)/100)}},onPointerUp:function(d){const{top:f,bottom:w,left:D,right:S}=n.current.getBoundingClientRect();d.nativeEvent.type!=="touchend"&&t.pauseOnHover&&d.clientX>=D&&d.clientX<=S&&d.clientY>=f&&d.clientY<=w?Q():C()}};return r&&a&&(u.onMouseEnter=Q,t.stacked||(u.onMouseLeave=C)),c&&(u.onClick=d=>{I&&I(d),s.canCloseOnClick&&g()}),{playToast:C,pauseToast:Q,isRunning:A,preventExitTransition:i,toastRef:n,eventHandlers:u}}function RUt(t){let{delay:A,isRunning:e,closeToast:i,type:o="default",hide:n,className:s,style:r,controlledProgress:a,progress:g,rtl:I,isIn:c,theme:B}=t;const l=n||a&&g===0,C={...r,animationDuration:`${A}ms`,animationPlayState:e?"running":"paused"};a&&(C.transform=`scaleX(${g})`);const Q=gm("Toastify__progress-bar",a?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${B}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":I}),E=B0(s)?s({rtl:I,type:o,defaultClassName:Q}):gm(Q,s),h={[a&&g>=1?"onTransitionEnd":"onAnimationEnd"]:a&&g<1?null:()=>{c&&i()}};return to.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":l},to.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${B} Toastify__progress-bar--${o}`}),to.createElement("div",{role:"progressbar","aria-hidden":l?"true":"false","aria-label":"notification timer",className:E,style:C,...h}))}let NUt=1;const xie=()=>""+NUt++;function MUt(t){return t&&(hF(t.toastId)||fH(t.toastId))?t.toastId:xie()}function mH(t,A){return Sie(t,A),A.toastId}function DW(t,A){return{...A,type:A&&A.type||t,toastId:MUt(A)}}function SW(t){return(A,e)=>mH(A,DW(t,e))}function jg(t,A){return mH(t,DW("default",A))}jg.loading=(t,A)=>mH(t,DW("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...A})),jg.promise=function(t,A,e){let i,{pending:o,error:n,success:s}=A;o&&(i=hF(o)?jg.loading(o,e):jg.loading(o.render,{...e,...o}));const r={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},a=(I,c,B)=>{if(c==null)return void jg.dismiss(i);const l={type:I,...r,...e,data:B},C=hF(c)?{render:c}:c;return i?jg.update(i,{...l,...C}):jg(C.render,{...l,...C}),B},g=B0(t)?t():t;return g.then(I=>a("success",s,I)).catch(I=>a("error",n,I)),g},jg.success=SW("success"),jg.info=SW("info"),jg.error=SW("error"),jg.warning=SW("warning"),jg.warn=jg.warning,jg.dark=(t,A)=>mH(t,DW("default",{theme:"dark",...A})),jg.dismiss=function(t){(function(A){var e;if(wie()){if(A==null||hF(e=A)||fH(e))Fd.forEach(i=>{i.removeToast(A)});else if(A&&("containerId"in A||"id"in A)){const i=Fd.get(A.containerId);i?i.removeToast(A.id):Fd.forEach(o=>{o.removeToast(A.id)})}}else yH=yH.filter(i=>A!=null&&i.options.toastId!==A)})(t)},jg.clearWaitingQueue=function(t){t===void 0&&(t={}),Fd.forEach(A=>{!A.props.limit||t.containerId&&A.id!==t.containerId||A.clearQueue()})},jg.isActive=Die,jg.update=function(t,A){A===void 0&&(A={});const e=((i,o)=>{var n;let{containerId:s}=o;return(n=Fd.get(s||1))==null?void 0:n.toasts.get(i)})(t,A);if(e){const{props:i,content:o}=e,n={delay:100,...i,...A,toastId:A.toastId||t,updateId:xie()};n.toastId!==t&&(n.staleId=t);const s=n.render||o;delete n.render,mH(s,n)}},jg.done=t=>{jg.update(t,{progress:1})},jg.onChange=function(t){return zEA.add(t),()=>{zEA.delete(t)}},jg.play=t=>bie(!0,t),jg.pause=t=>bie(!1,t);const vUt=typeof window<"u"?z.useLayoutEffect:z.useEffect,bW=t=>{let{theme:A,type:e,isLoading:i,...o}=t;return to.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:A==="colored"?"currentColor":`var(--toastify-icon-color-${e})`,...o})},XEA={info:function(t){return to.createElement(bW,{...t},to.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(t){return to.createElement(bW,{...t},to.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(t){return to.createElement(bW,{...t},to.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(t){return to.createElement(bW,{...t},to.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 to.createElement("div",{className:"Toastify__spinner"})}},UUt=t=>{const{isRunning:A,preventExitTransition:e,toastRef:i,eventHandlers:o,playToast:n}=_Ut(t),{closeButton:s,children:r,autoClose:a,onClick:g,type:I,hideProgressBar:c,closeToast:B,transition:l,position:C,className:Q,style:E,bodyClassName:h,bodyStyle:u,progressClassName:d,progressStyle:f,updateId:w,role:D,progress:S,rtl:x,toastId:F,deleteToast:k,isIn:U,isLoading:N,closeOnClick:Y,theme:K}=t,J=gm("Toastify__toast",`Toastify__toast-theme--${K}`,`Toastify__toast--${I}`,{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":Y}),W=B0(Q)?Q({rtl:x,position:C,type:I,defaultClassName:J}):gm(J,Q),Z=(function(tA){let{theme:iA,type:rA,isLoading:CA,icon:pA}=tA,kA=null;const _A={theme:iA,type:rA};return pA===!1||(B0(pA)?kA=pA({..._A,isLoading:CA}):z.isValidElement(pA)?kA=z.cloneElement(pA,_A):CA?kA=XEA.spinner():(TA=>TA in XEA)(rA)&&(kA=XEA[rA](_A))),kA})(t),AA=!!S||!a,nA={closeToast:B,type:I,theme:K};let cA=null;return s===!1||(cA=B0(s)?s(nA):z.isValidElement(s)?z.cloneElement(s,nA):(function(tA){let{closeToast:iA,theme:rA,ariaLabel:CA="close"}=tA;return to.createElement("button",{className:`Toastify__close-button Toastify__close-button--${rA}`,type:"button",onClick:pA=>{pA.stopPropagation(),iA(pA)},"aria-label":CA},to.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},to.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"})))})(nA)),to.createElement(l,{isIn:U,done:k,position:C,preventExitTransition:e,nodeRef:i,playToast:n},to.createElement("div",{id:F,onClick:g,"data-in":U,className:W,...o,style:E,ref:i},to.createElement("div",{...U&&{role:D},className:B0(h)?h({type:I}):gm("Toastify__toast-body",h),style:u},Z!=null&&to.createElement("div",{className:gm("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!N})},Z),to.createElement("div",null,r)),cA,to.createElement(RUt,{...w&&!AA?{key:`pb-${w}`}:{},rtl:x,theme:K,delay:a,isRunning:A,isIn:U,closeToast:B,hide:c,type:I,style:f,className:d,controlledProgress:AA,progress:S||0})))},xW=function(t,A){return A===void 0&&(A=!1),{enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:A}},LUt=wW(xW("bounce",!0));wW(xW("slide",!0)),wW(xW("zoom")),wW(xW("flip"));const HUt={position:"top-right",transition:LUt,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function YUt(t){let A={...HUt,...t};const e=t.stacked,[i,o]=z.useState(!0),n=z.useRef(null),{getToastToRender:s,isToastActive:r,count:a}=FUt(A),{className:g,style:I,rtl:c,containerId:B}=A;function l(Q){const E=gm("Toastify__toast-container",`Toastify__toast-container--${Q}`,{"Toastify__toast-container--rtl":c});return B0(g)?g({position:Q,rtl:c,defaultClassName:E}):gm(E,mW(g))}function C(){e&&(o(!0),jg.play())}return vUt(()=>{if(e){var Q;const E=n.current.querySelectorAll('[data-in="true"]'),h=12,u=(Q=A.position)==null?void 0:Q.includes("top");let d=0,f=0;Array.from(E).reverse().forEach((w,D)=>{const S=w;S.classList.add("Toastify__toast--stacked"),D>0&&(S.dataset.collapsed=`${i}`),S.dataset.pos||(S.dataset.pos=u?"top":"bot");const x=d*(i?.2:1)+(i?0:h*D);S.style.setProperty("--y",`${u?x:-1*x}px`),S.style.setProperty("--g",`${h}`),S.style.setProperty("--s",""+(1-(i?f:0))),d+=S.offsetHeight,f+=.025})}},[i,a,e]),to.createElement("div",{ref:n,className:"Toastify",id:B,onMouseEnter:()=>{e&&(o(!1),jg.pause())},onMouseLeave:C},s((Q,E)=>{const h=E.length?{...I}:{...I,pointerEvents:"none"};return to.createElement("div",{className:l(Q),style:h,key:`container-${Q}`},E.map(u=>{let{content:d,props:f}=u;return to.createElement(UUt,{...f,stacked:e,collapseAll:C,isIn:r(f.toastId,f.containerId),style:f.style,key:`toast-${f.key}`},d)}))}))}function JUt(){var t=':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=t,document.head.appendChild(A)}const TUt=Rde(xwe);var $EA,kie;function KUt(){if(kie)return $EA;kie=1;var t=Object.defineProperty,A=Object.getOwnPropertyDescriptor,e=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(E,h)=>{for(var u in h)t(E,u,{get:h[u],enumerable:!0})},n=(E,h,u,d)=>{if(h&&typeof h=="object"||typeof h=="function")for(let f of e(h))!i.call(E,f)&&f!==u&&t(E,f,{get:()=>h[f],enumerable:!(d=A(h,f))||d.enumerable});return E},s=E=>n(t({},"__esModule",{value:!0}),E),r={};o(r,{SuperGrid:()=>Q,toMMSI:()=>C,toMeterSI:()=>l}),$EA=s(r);var a=Of(),g=TUt,I=SmA(),c=(E,h,u)=>{const d=[];if(h<E)for(let f=E;f>=h;f-=Math.abs(u))d.push(f);else for(let f=E;f<=h;f+=Math.abs(u))d.push(f);return d};function B(E,h){return{x:Math.round(h.x/E)*E,y:Math.round(h.y/E)*E}}function l(E,h=1){return E<0?"-"+l(-E):E<1e-6?"0m":E>1e3?Math.floor(E/1e3)+"km":E>1&&h>1?Math.round(E)+"m":E>1&&h<=1?E.toFixed(Math.ceil(-Math.log10(h)))+"m":E<1&&h>=1/1e3?Math.round(E*1e3)+"mm":E<1&&h<1/1e3?(E*1e3).toFixed(Math.ceil(-Math.log10(h*1e3)))+"mm":""}function C(E,h=1){return l(E/1e3,h/1e3)}var Q=E=>{var h;const u=(0,a.useRef)(null),[d,f]=(0,a.useState)({x:0,y:0}),{majorColor:w="rgba(0,0,0,0.2)",minorColor:D="rgba(0,0,0,0.1)",textColor:S=(h=E.majorColor)!=null?h:"rgba(0,0,0,0.5)",width:x,height:F,screenSpaceCellSize:k=200,stringifyCoord:U=(J,W,Z)=>`${l(J,Z)}, ${l(W,Z)}`}=E,N=Math.ceil(x/k)+2,Y=Math.ceil(F/k)+2;(0,a.useEffect)(()=>{if(!u.current)return;const J=u.current.getContext("2d");if(!J)return;const W=k/10**Math.floor(Math.log10(E.transform.a)),Z=E.transform.d<0?-1:1,nA=k/10**Math.log10(E.transform.a)/W;function cA(mA,dA,PA){const Ae=mA;let ne,wA,OA;for(ne=dA.x;ne<=PA.x;ne+=Ae)wA=(0,g.applyToPoint)(E.transform,{x:ne,y:dA.y}),OA=(0,g.applyToPoint)(E.transform,{x:ne,y:PA.y}),J.beginPath(),J.moveTo(wA.x,wA.y),J.lineTo(OA.x,OA.y),J.stroke();const KA=c(dA.y,PA.y,Ae*Z);for(const YA of KA)wA=(0,g.applyToPoint)(E.transform,{x:dA.x,y:YA}),OA=(0,g.applyToPoint)(E.transform,{x:PA.x,y:YA}),J.beginPath(),J.moveTo(wA.x,wA.y),J.lineTo(OA.x,OA.y),J.stroke()}function tA(mA,dA,PA){const Ae=mA;let ne;for(ne=dA.x;ne<=PA.x;ne+=Ae)for(const wA of c(dA.y,PA.y,Ae*Z)){const OA=(0,g.applyToPoint)(E.transform,{x:ne,y:wA});J.fillStyle=S,J.font="12px sans-serif",J.fillText(U(ne,wA,mA),OA.x+2,OA.y-2)}}J.clearRect(0,0,x,F);const iA=(0,g.applyToPoint)((0,g.inverse)(E.transform),{x:0,y:0}),rA={x:Math.floor((iA.x-W)/W)*W,y:Math.floor((iA.y-W)/W+(Z==-1?2:0))*W},CA={x:rA.x+W*N,y:rA.y+W*Y*Z},kA=W*5,_A={x:Math.floor((iA.x-kA)/kA)*kA,y:Math.floor((iA.y-kA)/kA+(Z==-1?2:0))*kA},TA={x:_A.x+kA*N,y:_A.y+kA*Y*Z};J.globalAlpha=1,J.strokeStyle=w,cA(W,rA,CA),tA(kA,_A,TA),J.globalAlpha=1-nA,cA(kA/10,_A,TA),J.globalAlpha=1-nA,J.strokeStyle=D,cA(W/10,rA,CA),J.globalAlpha=Math.max(((1-nA)*10-5)/5,0),tA(kA/10,_A,TA),J.globalAlpha=1;const gA=(0,g.applyToPoint)(E.transform,d);J.font="12px sans-serif",J.fillStyle=S,J.fillText(U(d.x,d.y,W),gA.x+2,gA.y-2),J.strokeStyle=w,J.strokeRect(gA.x-5,gA.y-5,10,10)},[u,E.transform,d,x,F]);const K=J=>{if(!u.current)return;const W=k/10/10**Math.floor(Math.log10(E.transform.a)),Z=u.current.getBoundingClientRect(),AA=(0,g.applyToPoint)((0,g.inverse)(E.transform),{x:J.clientX-Z.left,y:J.clientY-Z.top}),nA=B(W,AA);f(nA)};return(0,I.jsx)("canvas",{onMouseUp:J=>{J.button===1&&K(J)},onDoubleClick:K,ref:u,width:E.width,height:E.height})};return $EA}var kW=KUt(),AhA={exports:{}},ehA,Gie;function Fie(){return Gie||(Gie=1,ehA={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]}),ehA}var thA={exports:{}},ihA,_ie;function qUt(){return _ie||(_ie=1,ihA=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")}),ihA}var Rie;function PUt(){if(Rie)return thA.exports;Rie=1;var t=qUt(),A=Array.prototype.concat,e=Array.prototype.slice,i=thA.exports=function(n){for(var s=[],r=0,a=n.length;r<a;r++){var g=n[r];t(g)?s=A.call(s,e.call(g)):s.push(g)}return s};return i.wrap=function(o){return function(){return o(i(arguments))}},thA.exports}var Nie;function OUt(){if(Nie)return AhA.exports;Nie=1;var t=Fie(),A=PUt(),e=Object.hasOwnProperty,i=Object.create(null);for(var o in t)e.call(t,o)&&(i[t[o]]=o);var n=AhA.exports={to:{},get:{}};n.get=function(a){var g=a.substring(0,3).toLowerCase(),I,c;switch(g){case"hsl":I=n.get.hsl(a),c="hsl";break;case"hwb":I=n.get.hwb(a),c="hwb";break;default:I=n.get.rgb(a),c="rgb";break}return I?{model:c,value:I}:null},n.get.rgb=function(a){if(!a)return null;var g=/^#([a-f0-9]{3,4})$/i,I=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,c=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,B=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,l=/^(\w+)$/,C=[0,0,0,1],Q,E,h;if(Q=a.match(I)){for(h=Q[2],Q=Q[1],E=0;E<3;E++){var u=E*2;C[E]=parseInt(Q.slice(u,u+2),16)}h&&(C[3]=parseInt(h,16)/255)}else if(Q=a.match(g)){for(Q=Q[1],h=Q[3],E=0;E<3;E++)C[E]=parseInt(Q[E]+Q[E],16);h&&(C[3]=parseInt(h+h,16)/255)}else if(Q=a.match(c)){for(E=0;E<3;E++)C[E]=parseInt(Q[E+1],0);Q[4]&&(Q[5]?C[3]=parseFloat(Q[4])*.01:C[3]=parseFloat(Q[4]))}else if(Q=a.match(B)){for(E=0;E<3;E++)C[E]=Math.round(parseFloat(Q[E+1])*2.55);Q[4]&&(Q[5]?C[3]=parseFloat(Q[4])*.01:C[3]=parseFloat(Q[4]))}else return(Q=a.match(l))?Q[1]==="transparent"?[0,0,0,0]:e.call(t,Q[1])?(C=t[Q[1]],C[3]=1,C):null:null;for(E=0;E<3;E++)C[E]=s(C[E],0,255);return C[3]=s(C[3],0,1),C},n.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*)?\)$/,I=a.match(g);if(I){var c=parseFloat(I[4]),B=(parseFloat(I[1])%360+360)%360,l=s(parseFloat(I[2]),0,100),C=s(parseFloat(I[3]),0,100),Q=s(isNaN(c)?1:c,0,1);return[B,l,C,Q]}return null},n.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*)?\)$/,I=a.match(g);if(I){var c=parseFloat(I[4]),B=(parseFloat(I[1])%360+360)%360,l=s(parseFloat(I[2]),0,100),C=s(parseFloat(I[3]),0,100),Q=s(isNaN(c)?1:c,0,1);return[B,l,C,Q]}return null},n.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)):"")},n.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]+")"},n.to.rgb.percent=function(){var a=A(arguments),g=Math.round(a[0]/255*100),I=Math.round(a[1]/255*100),c=Math.round(a[2]/255*100);return a.length<4||a[3]===1?"rgb("+g+"%, "+I+"%, "+c+"%)":"rgba("+g+"%, "+I+"%, "+c+"%, "+a[3]+")"},n.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]+")"},n.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+")"},n.to.keyword=function(a){return i[a.slice(0,3)]};function s(a,g,I){return Math.min(Math.max(g,a),I)}function r(a){var g=Math.round(a).toString(16).toUpperCase();return g.length<2?"0"+g:g}return AhA.exports}var ohA,Mie;function vie(){if(Mie)return ohA;Mie=1;const t=Fie(),A={};for(const o of Object.keys(t))A[t[o]]=o;const e={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"]}};ohA=e;for(const o of Object.keys(e)){if(!("channels"in e[o]))throw new Error("missing channels property: "+o);if(!("labels"in e[o]))throw new Error("missing channel labels property: "+o);if(e[o].labels.length!==e[o].channels)throw new Error("channel and label counts mismatch: "+o);const{channels:n,labels:s}=e[o];delete e[o].channels,delete e[o].labels,Object.defineProperty(e[o],"channels",{value:n}),Object.defineProperty(e[o],"labels",{value:s})}e.rgb.hsl=function(o){const n=o[0]/255,s=o[1]/255,r=o[2]/255,a=Math.min(n,s,r),g=Math.max(n,s,r),I=g-a;let c,B;g===a?c=0:n===g?c=(s-r)/I:s===g?c=2+(r-n)/I:r===g&&(c=4+(n-s)/I),c=Math.min(c*60,360),c<0&&(c+=360);const l=(a+g)/2;return g===a?B=0:l<=.5?B=I/(g+a):B=I/(2-g-a),[c,B*100,l*100]},e.rgb.hsv=function(o){let n,s,r,a,g;const I=o[0]/255,c=o[1]/255,B=o[2]/255,l=Math.max(I,c,B),C=l-Math.min(I,c,B),Q=function(E){return(l-E)/6/C+1/2};return C===0?(a=0,g=0):(g=C/l,n=Q(I),s=Q(c),r=Q(B),I===l?a=r-s:c===l?a=1/3+n-r:B===l&&(a=2/3+s-n),a<0?a+=1:a>1&&(a-=1)),[a*360,g*100,l*100]},e.rgb.hwb=function(o){const n=o[0],s=o[1];let r=o[2];const a=e.rgb.hsl(o)[0],g=1/255*Math.min(n,Math.min(s,r));return r=1-1/255*Math.max(n,Math.max(s,r)),[a,g*100,r*100]},e.rgb.cmyk=function(o){const n=o[0]/255,s=o[1]/255,r=o[2]/255,a=Math.min(1-n,1-s,1-r),g=(1-n-a)/(1-a)||0,I=(1-s-a)/(1-a)||0,c=(1-r-a)/(1-a)||0;return[g*100,I*100,c*100,a*100]};function i(o,n){return(o[0]-n[0])**2+(o[1]-n[1])**2+(o[2]-n[2])**2}return e.rgb.keyword=function(o){const n=A[o];if(n)return n;let s=1/0,r;for(const a of Object.keys(t)){const g=t[a],I=i(o,g);I<s&&(s=I,r=a)}return r},e.keyword.rgb=function(o){return t[o]},e.rgb.xyz=function(o){let n=o[0]/255,s=o[1]/255,r=o[2]/255;n=n>.04045?((n+.055)/1.055)**2.4:n/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=n*.4124+s*.3576+r*.1805,g=n*.2126+s*.7152+r*.0722,I=n*.0193+s*.1192+r*.9505;return[a*100,g*100,I*100]},e.rgb.lab=function(o){const n=e.rgb.xyz(o);let s=n[0],r=n[1],a=n[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,I=500*(s-r),c=200*(r-a);return[g,I,c]},e.hsl.rgb=function(o){const n=o[0]/360,s=o[1]/100,r=o[2]/100;let a,g,I;if(s===0)return I=r*255,[I,I,I];r<.5?a=r*(1+s):a=r+s-r*s;const c=2*r-a,B=[0,0,0];for(let l=0;l<3;l++)g=n+1/3*-(l-1),g<0&&g++,g>1&&g--,6*g<1?I=c+(a-c)*6*g:2*g<1?I=a:3*g<2?I=c+(a-c)*(2/3-g)*6:I=c,B[l]=I*255;return B},e.hsl.hsv=function(o){const n=o[0];let s=o[1]/100,r=o[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 I=(r+s)/2,c=r===0?2*a/(g+a):2*s/(r+s);return[n,c*100,I*100]},e.hsv.rgb=function(o){const n=o[0]/60,s=o[1]/100;let r=o[2]/100;const a=Math.floor(n)%6,g=n-Math.floor(n),I=255*r*(1-s),c=255*r*(1-s*g),B=255*r*(1-s*(1-g));switch(r*=255,a){case 0:return[r,B,I];case 1:return[c,r,I];case 2:return[I,r,B];case 3:return[I,c,r];case 4:return[B,I,r];case 5:return[r,I,c]}},e.hsv.hsl=function(o){const n=o[0],s=o[1]/100,r=o[2]/100,a=Math.max(r,.01);let g,I;I=(2-s)*r;const c=(2-s)*a;return g=s*a,g/=c<=1?c:2-c,g=g||0,I/=2,[n,g*100,I*100]},e.hwb.rgb=function(o){const n=o[0]/360;let s=o[1]/100,r=o[2]/100;const a=s+r;let g;a>1&&(s/=a,r/=a);const I=Math.floor(6*n),c=1-r;g=6*n-I,(I&1)!==0&&(g=1-g);const B=s+g*(c-s);let l,C,Q;switch(I){default:case 6:case 0:l=c,C=B,Q=s;break;case 1:l=B,C=c,Q=s;break;case 2:l=s,C=c,Q=B;break;case 3:l=s,C=B,Q=c;break;case 4:l=B,C=s,Q=c;break;case 5:l=c,C=s,Q=B;break}return[l*255,C*255,Q*255]},e.cmyk.rgb=function(o){const n=o[0]/100,s=o[1]/100,r=o[2]/100,a=o[3]/100,g=1-Math.min(1,n*(1-a)+a),I=1-Math.min(1,s*(1-a)+a),c=1-Math.min(1,r*(1-a)+a);return[g*255,I*255,c*255]},e.xyz.rgb=function(o){const n=o[0]/100,s=o[1]/100,r=o[2]/100;let a,g,I;return a=n*3.2406+s*-1.5372+r*-.4986,g=n*-.9689+s*1.8758+r*.0415,I=n*.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,I=I>.0031308?1.055*I**(1/2.4)-.055:I*12.92,a=Math.min(Math.max(0,a),1),g=Math.min(Math.max(0,g),1),I=Math.min(Math.max(0,I),1),[a*255,g*255,I*255]},e.xyz.lab=function(o){let n=o[0],s=o[1],r=o[2];n/=95.047,s/=100,r/=108.883,n=n>.008856?n**(1/3):7.787*n+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*(n-s),I=200*(s-r);return[a,g,I]},e.lab.xyz=function(o){const n=o[0],s=o[1],r=o[2];let a,g,I;g=(n+16)/116,a=s/500+g,I=g-r/200;const c=g**3,B=a**3,l=I**3;return g=c>.008856?c:(g-16/116)/7.787,a=B>.008856?B:(a-16/116)/7.787,I=l>.008856?l:(I-16/116)/7.787,a*=95.047,g*=100,I*=108.883,[a,g,I]},e.lab.lch=function(o){const n=o[0],s=o[1],r=o[2];let a;a=Math.atan2(r,s)*360/2/Math.PI,a<0&&(a+=360);const I=Math.sqrt(s*s+r*r);return[n,I,a]},e.lch.lab=function(o){const n=o[0],s=o[1],a=o[2]/360*2*Math.PI,g=s*Math.cos(a),I=s*Math.sin(a);return[n,g,I]},e.rgb.ansi16=function(o,n=null){const[s,r,a]=o;let g=n===null?e.rgb.hsv(o)[2]:n;if(g=Math.round(g/50),g===0)return 30;let I=30+(Math.round(a/255)<<2|Math.round(r/255)<<1|Math.round(s/255));return g===2&&(I+=60),I},e.hsv.ansi16=function(o){return e.rgb.ansi16(e.hsv.rgb(o),o[2])},e.rgb.ansi256=function(o){const n=o[0],s=o[1],r=o[2];return n===s&&s===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(s/255*5)+Math.round(r/255*5)},e.ansi16.rgb=function(o){let n=o%10;if(n===0||n===7)return o>50&&(n+=3.5),n=n/10.5*255,[n,n,n];const s=(~~(o>50)+1)*.5,r=(n&1)*s*255,a=(n>>1&1)*s*255,g=(n>>2&1)*s*255;return[r,a,g]},e.ansi256.rgb=function(o){if(o>=232){const g=(o-232)*10+8;return[g,g,g]}o-=16;let n;const s=Math.floor(o/36)/5*255,r=Math.floor((n=o%36)/6)/5*255,a=n%6/5*255;return[s,r,a]},e.rgb.hex=function(o){const s=(((Math.round(o[0])&255)<<16)+((Math.round(o[1])&255)<<8)+(Math.round(o[2])&255)).toString(16).toUpperCase();return"000000".substring(s.length)+s},e.hex.rgb=function(o){const n=o.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];let s=n[0];n[0].length===3&&(s=s.split("").map(c=>c+c).join(""));const r=parseInt(s,16),a=r>>16&255,g=r>>8&255,I=r&255;return[a,g,I]},e.rgb.hcg=function(o){const n=o[0]/255,s=o[1]/255,r=o[2]/255,a=Math.max(Math.max(n,s),r),g=Math.min(Math.min(n,s),r),I=a-g;let c,B;return I<1?c=g/(1-I):c=0,I<=0?B=0:a===n?B=(s-r)/I%6:a===s?B=2+(r-n)/I:B=4+(n-s)/I,B/=6,B%=1,[B*360,I*100,c*100]},e.hsl.hcg=function(o){const n=o[1]/100,s=o[2]/100,r=s<.5?2*n*s:2*n*(1-s);let a=0;return r<1&&(a=(s-.5*r)/(1-r)),[o[0],r*100,a*100]},e.hsv.hcg=function(o){const n=o[1]/100,s=o[2]/100,r=n*s;let a=0;return r<1&&(a=(s-r)/(1-r)),[o[0],r*100,a*100]},e.hcg.rgb=function(o){const n=o[0]/360,s=o[1]/100,r=o[2]/100;if(s===0)return[r*255,r*255,r*255];const a=[0,0,0],g=n%1*6,I=g%1,c=1-I;let B=0;switch(Math.floor(g)){case 0:a[0]=1,a[1]=I,a[2]=0;break;case 1:a[0]=c,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=I;break;case 3:a[0]=0,a[1]=c,a[2]=1;break;case 4:a[0]=I,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=c}return B=(1-s)*r,[(s*a[0]+B)*255,(s*a[1]+B)*255,(s*a[2]+B)*255]},e.hcg.hsv=function(o){const n=o[1]/100,s=o[2]/100,r=n+s*(1-n);let a=0;return r>0&&(a=n/r),[o[0],a*100,r*100]},e.hcg.hsl=function(o){const n=o[1]/100,r=o[2]/100*(1-n)+.5*n;let a=0;return r>0&&r<.5?a=n/(2*r):r>=.5&&r<1&&(a=n/(2*(1-r))),[o[0],a*100,r*100]},e.hcg.hwb=function(o){const n=o[1]/100,s=o[2]/100,r=n+s*(1-n);return[o[0],(r-n)*100,(1-r)*100]},e.hwb.hcg=function(o){const n=o[1]/100,r=1-o[2]/100,a=r-n;let g=0;return a<1&&(g=(r-a)/(1-a)),[o[0],a*100,g*100]},e.apple.rgb=function(o){return[o[0]/65535*255,o[1]/65535*255,o[2]/65535*255]},e.rgb.apple=function(o){return[o[0]/255*65535,o[1]/255*65535,o[2]/255*65535]},e.gray.rgb=function(o){return[o[0]/100*255,o[0]/100*255,o[0]/100*255]},e.gray.hsl=function(o){return[0,0,o[0]]},e.gray.hsv=e.gray.hsl,e.gray.hwb=function(o){return[0,100,o[0]]},e.gray.cmyk=function(o){return[0,0,0,o[0]]},e.gray.lab=function(o){return[o[0],0,0]},e.gray.hex=function(o){const n=Math.round(o[0]/100*255)&255,r=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(r.length)+r},e.rgb.gray=function(o){return[(o[0]+o[1]+o[2])/3/255*100]},ohA}var nhA,Uie;function WUt(){if(Uie)return nhA;Uie=1;const t=vie();function A(){const n={},s=Object.keys(t);for(let r=s.length,a=0;a<r;a++)n[s[a]]={distance:-1,parent:null};return n}function e(n){const s=A(),r=[n];for(s[n].distance=0;r.length;){const a=r.pop(),g=Object.keys(t[a]);for(let I=g.length,c=0;c<I;c++){const B=g[c],l=s[B];l.distance===-1&&(l.distance=s[a].distance+1,l.parent=a,r.unshift(B))}}return s}function i(n,s){return function(r){return s(n(r))}}function o(n,s){const r=[s[n].parent,n];let a=t[s[n].parent][n],g=s[n].parent;for(;s[g].parent;)r.unshift(s[g].parent),a=i(t[s[g].parent][g],a),g=s[g].parent;return a.conversion=r,a}return nhA=function(n){const s=e(n),r={},a=Object.keys(s);for(let g=a.length,I=0;I<g;I++){const c=a[I];s[c].parent!==null&&(r[c]=o(c,s))}return r},nhA}var shA,Lie;function ZUt(){if(Lie)return shA;Lie=1;const t=vie(),A=WUt(),e={},i=Object.keys(t);function o(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 n(s){const r=function(...a){const g=a[0];if(g==null)return g;g.length>1&&(a=g);const I=s(a);if(typeof I=="object")for(let c=I.length,B=0;B<c;B++)I[B]=Math.round(I[B]);return I};return"conversion"in s&&(r.conversion=s.conversion),r}return i.forEach(s=>{e[s]={},Object.defineProperty(e[s],"channels",{value:t[s].channels}),Object.defineProperty(e[s],"labels",{value:t[s].labels});const r=A(s);Object.keys(r).forEach(g=>{const I=r[g];e[s][g]=n(I),e[s][g].raw=o(I)})}),shA=e,shA}var rhA,Hie;function VUt(){if(Hie)return rhA;Hie=1;const t=OUt(),A=ZUt(),e=["keyword","gray","hex"],i={};for(const B of Object.keys(A))i[[...A[B].labels].sort().join("")]=B;const o={};function n(B,l){if(!(this instanceof n))return new n(B,l);if(l&&l in e&&(l=null),l&&!(l in A))throw new Error("Unknown model: "+l);let C,Q;if(B==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(B instanceof n)this.model=B.model,this.color=[...B.color],this.valpha=B.valpha;else if(typeof B=="string"){const E=t.get(B);if(E===null)throw new Error("Unable to parse color from string: "+B);this.model=E.model,Q=A[this.model].channels,this.color=E.value.slice(0,Q),this.valpha=typeof E.value[Q]=="number"?E.value[Q]:1}else if(B.length>0){this.model=l||"rgb",Q=A[this.model].channels;const E=Array.prototype.slice.call(B,0,Q);this.color=c(E,Q),this.valpha=typeof B[Q]=="number"?B[Q]:1}else if(typeof B=="number")this.model="rgb",this.color=[B>>16&255,B>>8&255,B&255],this.valpha=1;else{this.valpha=1;const E=Object.keys(B);"alpha"in B&&(E.splice(E.indexOf("alpha"),1),this.valpha=typeof B.alpha=="number"?B.alpha:0);const h=E.sort().join("");if(!(h in i))throw new Error("Unable to parse color from object: "+JSON.stringify(B));this.model=i[h];const{labels:u}=A[this.model],d=[];for(C=0;C<u.length;C++)d.push(B[u[C]]);this.color=c(d)}if(o[this.model])for(Q=A[this.model].channels,C=0;C<Q;C++){const E=o[this.model][C];E&&(this.color[C]=E(this.color[C]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}n.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(B){let l=this.model in t.to?this:this.rgb();l=l.round(typeof B=="number"?B:1);const C=l.valpha===1?l.color:[...l.color,this.valpha];return t.to[l.model](C)},percentString(B){const l=this.rgb().round(typeof B=="number"?B:1),C=l.valpha===1?l.color:[...l.color,this.valpha];return t.to.rgb.percent(C)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const B={},{channels:l}=A[this.model],{labels:C}=A[this.model];for(let Q=0;Q<l;Q++)B[C[Q]]=this.color[Q];return this.valpha!==1&&(B.alpha=this.valpha),B},unitArray(){const B=this.rgb().color;return B[0]/=255,B[1]/=255,B[2]/=255,this.valpha!==1&&B.push(this.valpha),B},unitObject(){const B=this.rgb().object();return B.r/=255,B.g/=255,B.b/=255,this.valpha!==1&&(B.alpha=this.valpha),B},round(B){return B=Math.max(B||0,0),new n([...this.color.map(r(B)),this.valpha],this.model)},alpha(B){return B!==void 0?new n([...this.color,Math.max(0,Math.min(1,B))],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,B=>(B%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(B){return B!==void 0?new n(B):A[this.model].keyword(this.color)},hex(B){return B!==void 0?new n(B):t.to.hex(this.rgb().round().color)},hexa(B){if(B!==void 0)return new n(B);const l=this.rgb().round().color;let C=Math.round(this.valpha*255).toString(16).toUpperCase();return C.length===1&&(C="0"+C),t.to.hex(l)+C},rgbNumber(){const B=this.rgb().color;return(B[0]&255)<<16|(B[1]&255)<<8|B[2]&255},luminosity(){const B=this.rgb().color,l=[];for(const[C,Q]of B.entries()){const E=Q/255;l[C]=E<=.04045?E/12.92:((E+.055)/1.055)**2.4}return .2126*l[0]+.7152*l[1]+.0722*l[2]},contrast(B){const l=this.luminosity(),C=B.luminosity();return l>C?(l+.05)/(C+.05):(C+.05)/(l+.05)},level(B){const l=this.contrast(B);return l>=7?"AAA":l>=4.5?"AA":""},isDark(){const B=this.rgb().color;return(B[0]*2126+B[1]*7152+B[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const B=this.rgb();for(let l=0;l<3;l++)B.color[l]=255-B.color[l];return B},lighten(B){const l=this.hsl();return l.color[2]+=l.color[2]*B,l},darken(B){const l=this.hsl();return l.color[2]-=l.color[2]*B,l},saturate(B){const l=this.hsl();return l.color[1]+=l.color[1]*B,l},desaturate(B){const l=this.hsl();return l.color[1]-=l.color[1]*B,l},whiten(B){const l=this.hwb();return l.color[1]+=l.color[1]*B,l},blacken(B){const l=this.hwb();return l.color[2]+=l.color[2]*B,l},grayscale(){const B=this.rgb().color,l=B[0]*.3+B[1]*.59+B[2]*.11;return n.rgb(l,l,l)},fade(B){return this.alpha(this.valpha-this.valpha*B)},opaquer(B){return this.alpha(this.valpha+this.valpha*B)},rotate(B){const l=this.hsl();let C=l.color[0];return C=(C+B)%360,C=C<0?360+C:C,l.color[0]=C,l},mix(B,l){if(!B||!B.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof B);const C=B.rgb(),Q=this.rgb(),E=l===void 0?.5:l,h=2*E-1,u=C.alpha()-Q.alpha(),d=((h*u===-1?h:(h+u)/(1+h*u))+1)/2,f=1-d;return n.rgb(d*C.red()+f*Q.red(),d*C.green()+f*Q.green(),d*C.blue()+f*Q.blue(),C.alpha()*E+Q.alpha()*(1-E))}};for(const B of Object.keys(A)){if(e.includes(B))continue;const{channels:l}=A[B];n.prototype[B]=function(...C){return this.model===B?new n(this):C.length>0?new n(C,B):new n([...I(A[this.model][B].raw(this.color)),this.valpha],B)},n[B]=function(...C){let Q=C[0];return typeof Q=="number"&&(Q=c(C,l)),new n(Q,B)}}function s(B,l){return Number(B.toFixed(l))}function r(B){return function(l){return s(l,B)}}function a(B,l,C){B=Array.isArray(B)?B:[B];for(const Q of B)(o[Q]||(o[Q]=[]))[l]=C;return B=B[0],function(Q){let E;return Q!==void 0?(C&&(Q=C(Q)),E=this[B](),E.color[l]=Q,E):(E=this[B]().color[l],C&&(E=C(E)),E)}}function g(B){return function(l){return Math.max(0,Math.min(B,l))}}function I(B){return Array.isArray(B)?B:[B]}function c(B,l){for(let C=0;C<l;C++)typeof B[C]!="number"&&(B[C]=0);return B}return rhA=n,rhA}var jUt=VUt();const Yie=vp(jUt);function zUt(t){if(t.sheet)return t.sheet;for(var A=0;A<document.styleSheets.length;A++)if(document.styleSheets[A].ownerNode===t)return document.styleSheets[A]}function XUt(t){var A=document.createElement("style");return A.setAttribute("data-emotion",t.key),t.nonce!==void 0&&A.setAttribute("nonce",t.nonce),A.appendChild(document.createTextNode("")),A.setAttribute("data-s",""),A}var $Ut=(function(){function t(e){var i=this;this._insertTag=function(o){var n;i.tags.length===0?i.insertionPoint?n=i.insertionPoint.nextSibling:i.prepend?n=i.container.firstChild:n=i.before:n=i.tags[i.tags.length-1].nextSibling,i.container.insertBefore(o,n),i.tags.push(o)},this.isSpeedy=e.speedy===void 0?!0:e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var A=t.prototype;return A.hydrate=function(i){i.forEach(this._insertTag)},A.insert=function(i){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(XUt(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var n=zUt(o);try{n.insertRule(i,n.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(i));this.ctr++},A.flush=function(){this.tags.forEach(function(i){var o;return(o=i.parentNode)==null?void 0:o.removeChild(i)}),this.tags=[],this.ctr=0},t})(),Mu="-ms-",GW="-moz-",Ka="-webkit-",Jie="comm",ahA="rule",ghA="decl",ALt="@import",Tie="@keyframes",eLt="@layer",tLt=Math.abs,FW=String.fromCharCode,iLt=Object.assign;function oLt(t,A){return fh(t,0)^45?(((A<<2^fh(t,0))<<2^fh(t,1))<<2^fh(t,2))<<2^fh(t,3):0}function Kie(t){return t.trim()}function nLt(t,A){return(t=A.exec(t))?t[0]:t}function qa(t,A,e){return t.replace(A,e)}function IhA(t,A){return t.indexOf(A)}function fh(t,A){return t.charCodeAt(A)|0}function wH(t,A,e){return t.slice(A,e)}function AD(t){return t.length}function chA(t){return t.length}function _W(t,A){return A.push(t),t}function sLt(t,A){return t.map(A).join("")}var RW=1,LM=1,qie=0,tf=0,GC=0,HM="";function NW(t,A,e,i,o,n,s){return{value:t,root:A,parent:e,type:i,props:o,children:n,line:RW,column:LM,length:s,return:""}}function DH(t,A){return iLt(NW("",null,null,"",null,null,0),t,{length:-t.length},A)}function rLt(){return GC}function aLt(){return GC=tf>0?fh(HM,--tf):0,LM--,GC===10&&(LM=1,RW--),GC}function l0(){return GC=tf<qie?fh(HM,tf++):0,LM++,GC===10&&(LM=1,RW++),GC}function eD(){return fh(HM,tf)}function MW(){return tf}function SH(t,A){return wH(HM,t,A)}function bH(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Pie(t){return RW=LM=1,qie=AD(HM=t),tf=0,[]}function Oie(t){return HM="",t}function vW(t){return Kie(SH(tf-1,BhA(t===91?t+2:t===40?t+1:t)))}function gLt(t){for(;(GC=eD())&&GC<33;)l0();return bH(t)>2||bH(GC)>3?"":" "}function ILt(t,A){for(;--A&&l0()&&!(GC<48||GC>102||GC>57&&GC<65||GC>70&&GC<97););return SH(t,MW()+(A<6&&eD()==32&&l0()==32))}function BhA(t){for(;l0();)switch(GC){case t:return tf;case 34:case 39:t!==34&&t!==39&&BhA(GC);break;case 40:t===41&&BhA(t);break;case 92:l0();break}return tf}function cLt(t,A){for(;l0()&&t+GC!==57;)if(t+GC===84&&eD()===47)break;return"/*"+SH(A,tf-1)+"*"+FW(t===47?t:l0())}function BLt(t){for(;!bH(eD());)l0();return SH(t,tf)}function lLt(t){return Oie(UW("",null,null,null,[""],t=Pie(t),0,[0],t))}function UW(t,A,e,i,o,n,s,r,a){for(var g=0,I=0,c=s,B=0,l=0,C=0,Q=1,E=1,h=1,u=0,d="",f=o,w=n,D=i,S=d;E;)switch(C=u,u=l0()){case 40:if(C!=108&&fh(S,c-1)==58){IhA(S+=qa(vW(u),"&","&\f"),"&\f")!=-1&&(h=-1);break}case 34:case 39:case 91:S+=vW(u);break;case 9:case 10:case 13:case 32:S+=gLt(C);break;case 92:S+=ILt(MW()-1,7);continue;case 47:switch(eD()){case 42:case 47:_W(CLt(cLt(l0(),MW()),A,e),a);break;default:S+="/"}break;case 123*Q:r[g++]=AD(S)*h;case 125*Q:case 59:case 0:switch(u){case 0:case 125:E=0;case 59+I:h==-1&&(S=qa(S,/\f/g,"")),l>0&&AD(S)-c&&_W(l>32?Zie(S+";",i,e,c-1):Zie(qa(S," ","")+";",i,e,c-2),a);break;case 59:S+=";";default:if(_W(D=Wie(S,A,e,g,I,o,r,d,f=[],w=[],c),n),u===123)if(I===0)UW(S,A,D,D,f,n,c,r,w);else switch(B===99&&fh(S,3)===110?100:B){case 100:case 108:case 109:case 115:UW(t,D,D,i&&_W(Wie(t,D,D,0,0,o,r,d,o,f=[],c),w),o,w,c,r,i?f:w);break;default:UW(S,D,D,D,[""],w,0,r,w)}}g=I=l=0,Q=h=1,d=S="",c=s;break;case 58:c=1+AD(S),l=C;default:if(Q<1){if(u==123)--Q;else if(u==125&&Q++==0&&aLt()==125)continue}switch(S+=FW(u),u*Q){case 38:h=I>0?1:(S+="\f",-1);break;case 44:r[g++]=(AD(S)-1)*h,h=1;break;case 64:eD()===45&&(S+=vW(l0())),B=eD(),I=c=AD(d=S+=BLt(MW())),u++;break;case 45:C===45&&AD(S)==2&&(Q=0)}}return n}function Wie(t,A,e,i,o,n,s,r,a,g,I){for(var c=o-1,B=o===0?n:[""],l=chA(B),C=0,Q=0,E=0;C<i;++C)for(var h=0,u=wH(t,c+1,c=tLt(Q=s[C])),d=t;h<l;++h)(d=Kie(Q>0?B[h]+" "+u:qa(u,/&\f/g,B[h])))&&(a[E++]=d);return NW(t,A,e,o===0?ahA:r,a,g,I)}function CLt(t,A,e){return NW(t,A,e,Jie,FW(rLt()),wH(t,2,-2),0)}function Zie(t,A,e,i){return NW(t,A,e,ghA,wH(t,0,i),wH(t,i+1,-1),i)}function YM(t,A){for(var e="",i=chA(t),o=0;o<i;o++)e+=A(t[o],o,t,A)||"";return e}function QLt(t,A,e,i){switch(t.type){case eLt:if(t.children.length)break;case ALt:case ghA:return t.return=t.return||t.value;case Jie:return"";case Tie:return t.return=t.value+"{"+YM(t.children,i)+"}";case ahA:t.value=t.props.join(",")}return AD(e=YM(t.children,i))?t.return=t.value+"{"+e+"}":""}function ELt(t){var A=chA(t);return function(e,i,o,n){for(var s="",r=0;r<A;r++)s+=t[r](e,i,o,n)||"";return s}}function hLt(t){return function(A){A.root||(A=A.return)&&t(A)}}function uLt(t){var A=Object.create(null);return function(e){return A[e]===void 0&&(A[e]=t(e)),A[e]}}var dLt=function(A,e,i){for(var o=0,n=0;o=n,n=eD(),o===38&&n===12&&(e[i]=1),!bH(n);)l0();return SH(A,tf)},pLt=function(A,e){var i=-1,o=44;do switch(bH(o)){case 0:o===38&&eD()===12&&(e[i]=1),A[i]+=dLt(tf-1,e,i);break;case 2:A[i]+=vW(o);break;case 4:if(o===44){A[++i]=eD()===58?"&\f":"",e[i]=A[i].length;break}default:A[i]+=FW(o)}while(o=l0());return A},fLt=function(A,e){return Oie(pLt(Pie(A),e))},Vie=new WeakMap,yLt=function(A){if(!(A.type!=="rule"||!A.parent||A.length<1)){for(var e=A.value,i=A.parent,o=A.column===i.column&&A.line===i.line;i.type!=="rule";)if(i=i.parent,!i)return;if(!(A.props.length===1&&e.charCodeAt(0)!==58&&!Vie.get(i))&&!o){Vie.set(A,!0);for(var n=[],s=fLt(e,n),r=i.props,a=0,g=0;a<s.length;a++)for(var I=0;I<r.length;I++,g++)A.props[g]=n[a]?s[a].replace(/&\f/g,r[I]):r[I]+" "+s[a]}}},mLt=function(A){if(A.type==="decl"){var e=A.value;e.charCodeAt(0)===108&&e.charCodeAt(2)===98&&(A.return="",A.value="")}};function jie(t,A){switch(oLt(t,A)){case 5103:return Ka+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ka+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Ka+t+GW+t+Mu+t+t;case 6828:case 4268:return Ka+t+Mu+t+t;case 6165:return Ka+t+Mu+"flex-"+t+t;case 5187:return Ka+t+qa(t,/(\w+).+(:[^]+)/,Ka+"box-$1$2"+Mu+"flex-$1$2")+t;case 5443:return Ka+t+Mu+"flex-item-"+qa(t,/flex-|-self/,"")+t;case 4675:return Ka+t+Mu+"flex-line-pack"+qa(t,/align-content|flex-|-self/,"")+t;case 5548:return Ka+t+Mu+qa(t,"shrink","negative")+t;case 5292:return Ka+t+Mu+qa(t,"basis","preferred-size")+t;case 6060:return Ka+"box-"+qa(t,"-grow","")+Ka+t+Mu+qa(t,"grow","positive")+t;case 4554:return Ka+qa(t,/([^-])(transform)/g,"$1"+Ka+"$2")+t;case 6187:return qa(qa(qa(t,/(zoom-|grab)/,Ka+"$1"),/(image-set)/,Ka+"$1"),t,"")+t;case 5495:case 3959:return qa(t,/(image-set\([^]*)/,Ka+"$1$`$1");case 4968:return qa(qa(t,/(.+:)(flex-)?(.*)/,Ka+"box-pack:$3"+Mu+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ka+t+t;case 4095:case 3583:case 4068:case 2532:return qa(t,/(.+)-inline(.+)/,Ka+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(AD(t)-1-A>6)switch(fh(t,A+1)){case 109:if(fh(t,A+4)!==45)break;case 102:return qa(t,/(.+:)(.+)-([^]+)/,"$1"+Ka+"$2-$3$1"+GW+(fh(t,A+3)==108?"$3":"$2-$3"))+t;case 115:return~IhA(t,"stretch")?jie(qa(t,"stretch","fill-available"),A)+t:t}break;case 4949:if(fh(t,A+1)!==115)break;case 6444:switch(fh(t,AD(t)-3-(~IhA(t,"!important")&&10))){case 107:return qa(t,":",":"+Ka)+t;case 101:return qa(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ka+(fh(t,14)===45?"inline-":"")+"box$3$1"+Ka+"$2$3$1"+Mu+"$2box$3")+t}break;case 5936:switch(fh(t,A+11)){case 114:return Ka+t+Mu+qa(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Ka+t+Mu+qa(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Ka+t+Mu+qa(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Ka+t+Mu+t+t}return t}var wLt=function(A,e,i,o){if(A.length>-1&&!A.return)switch(A.type){case ghA:A.return=jie(A.value,A.length);break;case Tie:return YM([DH(A,{value:qa(A.value,"@","@"+Ka)})],o);case ahA:if(A.length)return sLt(A.props,function(n){switch(nLt(n,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return YM([DH(A,{props:[qa(n,/:(read-\w+)/,":"+GW+"$1")]})],o);case"::placeholder":return YM([DH(A,{props:[qa(n,/:(plac\w+)/,":"+Ka+"input-$1")]}),DH(A,{props:[qa(n,/:(plac\w+)/,":"+GW+"$1")]}),DH(A,{props:[qa(n,/:(plac\w+)/,Mu+"input-$1")]})],o)}return""})}},DLt=[wLt],SLt=function(A){var e=A.key;if(e==="css"){var i=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(i,function(Q){var E=Q.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(Q),Q.setAttribute("data-s",""))})}var o=A.stylisPlugins||DLt,n={},s,r=[];s=A.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+e+' "]'),function(Q){for(var E=Q.getAttribute("data-emotion").split(" "),h=1;h<E.length;h++)n[E[h]]=!0;r.push(Q)});var a,g=[yLt,mLt];{var I,c=[QLt,hLt(function(Q){I.insert(Q)})],B=ELt(g.concat(o,c)),l=function(E){return YM(lLt(E),B)};a=function(E,h,u,d){I=u,l(E?E+"{"+h.styles+"}":h.styles),d&&(C.inserted[h.name]=!0)}}var C={key:e,sheet:new $Ut({key:e,container:s,nonce:A.nonce,speedy:A.speedy,prepend:A.prepend,insertionPoint:A.insertionPoint}),nonce:A.nonce,inserted:n,registered:{},insert:a};return C.sheet.hydrate(r),C};function bLt(t){for(var A=0,e,i=0,o=t.length;o>=4;++i,o-=4)e=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,e=(e&65535)*1540483477+((e>>>16)*59797<<16),e^=e>>>24,A=(e&65535)*1540483477+((e>>>16)*59797<<16)^(A&65535)*1540483477+((A>>>16)*59797<<16);switch(o){case 3:A^=(t.charCodeAt(i+2)&255)<<16;case 2:A^=(t.charCodeAt(i+1)&255)<<8;case 1:A^=t.charCodeAt(i)&255,A=(A&65535)*1540483477+((A>>>16)*59797<<16)}return A^=A>>>13,A=(A&65535)*1540483477+((A>>>16)*59797<<16),((A^A>>>15)>>>0).toString(36)}var xLt={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},kLt=/[A-Z]|^ms/g,GLt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,zie=function(A){return A.charCodeAt(1)===45},Xie=function(A){return A!=null&&typeof A!="boolean"},lhA=uLt(function(t){return zie(t)?t:t.replace(kLt,"-$&").toLowerCase()}),$ie=function(A,e){switch(A){case"animation":case"animationName":if(typeof e=="string")return e.replace(GLt,function(i,o,n){return Px={name:o,styles:n,next:Px},o})}return xLt[A]!==1&&!zie(A)&&typeof e=="number"&&e!==0?e+"px":e};function LW(t,A,e){if(e==null)return"";var i=e;if(i.__emotion_styles!==void 0)return i;switch(typeof e){case"boolean":return"";case"object":{var o=e;if(o.anim===1)return Px={name:o.name,styles:o.styles,next:Px},o.name;var n=e;if(n.styles!==void 0){var s=n.next;if(s!==void 0)for(;s!==void 0;)Px={name:s.name,styles:s.styles,next:Px},s=s.next;var r=n.styles+";";return r}return FLt(t,A,e)}}var a=e;if(A==null)return a;var g=A[a];return g!==void 0?g:a}function FLt(t,A,e){var i="";if(Array.isArray(e))for(var o=0;o<e.length;o++)i+=LW(t,A,e[o])+";";else for(var n in e){var s=e[n];if(typeof s!="object"){var r=s;A!=null&&A[r]!==void 0?i+=n+"{"+A[r]+"}":Xie(r)&&(i+=lhA(n)+":"+$ie(n,r)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&(A==null||A[s[0]]===void 0))for(var a=0;a<s.length;a++)Xie(s[a])&&(i+=lhA(n)+":"+$ie(n,s[a])+";");else{var g=LW(t,A,s);switch(n){case"animation":case"animationName":{i+=lhA(n)+":"+g+";";break}default:i+=n+"{"+g+"}"}}}return i}var Aoe=/label:\s*([^\s;{]+)\s*(;|$)/g,Px;function ChA(t,A,e){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var i=!0,o="";Px=void 0;var n=t[0];if(n==null||n.raw===void 0)i=!1,o+=LW(e,A,n);else{var s=n;o+=s[0]}for(var r=1;r<t.length;r++)if(o+=LW(e,A,t[r]),i){var a=n;o+=a[r]}Aoe.lastIndex=0;for(var g="",I;(I=Aoe.exec(o))!==null;)g+="-"+I[1];var c=bLt(o)+g;return{name:c,styles:o,next:Px}}function eoe(t,A,e){var i="";return e.split(" ").forEach(function(o){t[o]!==void 0?A.push(t[o]+";"):o&&(i+=o+" ")}),i}var _Lt=function(A,e,i){var o=A.key+"-"+e.name;A.registered[o]===void 0&&(A.registered[o]=e.styles)},RLt=function(A,e,i){_Lt(A,e);var o=A.key+"-"+e.name;if(A.inserted[e.name]===void 0){var n=e;do A.insert(e===n?"."+o:"",n,A.sheet,!0),n=n.next;while(n!==void 0)}};function toe(t,A){if(t.inserted[A.name]===void 0)return t.insert("",A,t.sheet,!0)}function ioe(t,A,e){var i=[],o=eoe(t,i,e);return i.length<2?e:o+A(i)}var NLt=function(A){var e=SLt(A);e.sheet.speedy=function(r){this.isSpeedy=r},e.compat=!0;var i=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];var c=ChA(g,e.registered,void 0);return RLt(e,c),e.key+"-"+c.name},o=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];var c=ChA(g,e.registered),B="animation-"+c.name;return toe(e,{name:c.name,styles:"@keyframes "+B+"{"+c.styles+"}"}),B},n=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];var c=ChA(g,e.registered);toe(e,c)},s=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];return ioe(e.registered,i,MLt(g))};return{css:i,cx:s,injectGlobal:n,keyframes:o,hydrate:function(a){a.forEach(function(g){e.inserted[g]=!0})},flush:function(){e.registered={},e.inserted={},e.sheet.flush()},sheet:e.sheet,cache:e,getRegisteredStyles:eoe.bind(null,e.registered),merge:ioe.bind(null,e.registered,i)}},MLt=function t(A){for(var e="",i=0;i<A.length;i++){var o=A[i];if(o!=null){var n=void 0;switch(typeof o){case"boolean":break;case"object":{if(Array.isArray(o))n=t(o);else{n="";for(var s in o)o[s]&&s&&(n&&(n+=" "),n+=s)}break}default:n=o}n&&(e&&(e+=" "),e+=n)}}return e},vLt=NLt({key:"css"}),JM=vLt.css,ULt=Object.create,ooe=Object.defineProperty,LLt=Object.getOwnPropertyDescriptor,noe=Object.getOwnPropertyNames,HLt=Object.getPrototypeOf,YLt=Object.prototype.hasOwnProperty,Ga=(t,A)=>function(){return A||(0,t[noe(t)[0]])((A={exports:{}}).exports,A),A.exports},JLt=(t,A,e,i)=>{if(A&&typeof A=="object"||typeof A=="function")for(let o of noe(A))!YLt.call(t,o)&&o!==e&&ooe(t,o,{get:()=>A[o],enumerable:!(i=LLt(A,o))||i.enumerable});return t},soe=(t,A,e)=>(e=t!=null?ULt(HLt(t)):{},JLt(ooe(e,"default",{value:t,enumerable:!0}),t)),TLt=Ga({"node_modules/svgson/dist/svgson.umd.js"(t,A){(function(e,i){typeof t=="object"&&typeof A<"u"?A.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.svgson=i())})(t,function(){var e=function(tA){return tA!=null&&(i(tA)||o(tA)||!!tA._isBuffer)};function i(tA){return!!tA.constructor&&typeof tA.constructor.isBuffer=="function"&&tA.constructor.isBuffer(tA)}function o(tA){return typeof tA.readFloatLE=="function"&&typeof tA.slice=="function"&&i(tA.slice(0,0))}var n=Object.prototype.toString,s=function(iA){if(typeof iA>"u")return"undefined";if(iA===null)return"null";if(iA===!0||iA===!1||iA instanceof Boolean)return"boolean";if(typeof iA=="string"||iA instanceof String)return"string";if(typeof iA=="number"||iA instanceof Number)return"number";if(typeof iA=="function"||iA instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(iA))return"array";if(iA instanceof RegExp)return"regexp";if(iA instanceof Date)return"date";var rA=n.call(iA);return rA==="[object RegExp]"?"regexp":rA==="[object Date]"?"date":rA==="[object Arguments]"?"arguments":rA==="[object Error]"?"error":e(iA)?"buffer":rA==="[object Set]"?"set":rA==="[object WeakSet]"?"weakset":rA==="[object Map]"?"map":rA==="[object WeakMap]"?"weakmap":rA==="[object Symbol]"?"symbol":rA==="[object Int8Array]"?"int8array":rA==="[object Uint8Array]"?"uint8array":rA==="[object Uint8ClampedArray]"?"uint8clampedarray":rA==="[object Int16Array]"?"int16array":rA==="[object Uint16Array]"?"uint16array":rA==="[object Int32Array]"?"int32array":rA==="[object Uint32Array]"?"uint32array":rA==="[object Float32Array]"?"float32array":rA==="[object Float64Array]"?"float64array":"object"};function r(tA,iA){return iA={exports:{}},tA(iA,iA.exports),iA.exports}var a=r(function(tA){(function(){function iA(rA,CA){if(typeof CA!="function")return rA;var pA={};for(var kA in rA)Object.prototype.hasOwnProperty.call(rA,kA)&&(pA[CA(kA,rA[kA])||kA]=rA[kA]);return pA}tA.exports?tA.exports=iA:window.rename=iA})()}),g=function tA(iA,rA){var CA=s(iA);if(CA!=="object"&&CA!=="array")throw new Error("expected an object");var pA=[];CA==="object"&&(iA=a(iA,rA),pA={});for(var kA in iA)if(iA.hasOwnProperty(kA)){var _A=iA[kA];s(_A)==="object"||s(_A)==="array"?pA[kA]=tA(_A,rA):pA[kA]=_A}return pA},I=r(function(tA){var iA=Object.prototype.hasOwnProperty,rA="~";function CA(){}Object.create&&(CA.prototype=Object.create(null),new CA().__proto__||(rA=!1));function pA(_A,TA,gA){this.fn=_A,this.context=TA,this.once=gA||!1}function kA(){this._events=new CA,this._eventsCount=0}kA.prototype.eventNames=function(){var TA=[],gA,mA;if(this._eventsCount===0)return TA;for(mA in gA=this._events)iA.call(gA,mA)&&TA.push(rA?mA.slice(1):mA);return Object.getOwnPropertySymbols?TA.concat(Object.getOwnPropertySymbols(gA)):TA},kA.prototype.listeners=function(TA,gA){var mA=rA?rA+TA:TA,dA=this._events[mA];if(gA)return!!dA;if(!dA)return[];if(dA.fn)return[dA.fn];for(var PA=0,Ae=dA.length,ne=new Array(Ae);PA<Ae;PA++)ne[PA]=dA[PA].fn;return ne},kA.prototype.emit=function(TA,gA,mA,dA,PA,Ae){var ne=rA?rA+TA:TA;if(!this._events[ne])return!1;var wA=this._events[ne],OA=arguments.length,KA,YA;if(wA.fn){switch(wA.once&&this.removeListener(TA,wA.fn,void 0,!0),OA){case 1:return wA.fn.call(wA.context),!0;case 2:return wA.fn.call(wA.context,gA),!0;case 3:return wA.fn.call(wA.context,gA,mA),!0;case 4:return wA.fn.call(wA.context,gA,mA,dA),!0;case 5:return wA.fn.call(wA.context,gA,mA,dA,PA),!0;case 6:return wA.fn.call(wA.context,gA,mA,dA,PA,Ae),!0}for(YA=1,KA=new Array(OA-1);YA<OA;YA++)KA[YA-1]=arguments[YA];wA.fn.apply(wA.context,KA)}else{var jA=wA.length,RA;for(YA=0;YA<jA;YA++)switch(wA[YA].once&&this.removeListener(TA,wA[YA].fn,void 0,!0),OA){case 1:wA[YA].fn.call(wA[YA].context);break;case 2:wA[YA].fn.call(wA[YA].context,gA);break;case 3:wA[YA].fn.call(wA[YA].context,gA,mA);break;case 4:wA[YA].fn.call(wA[YA].context,gA,mA,dA);break;default:if(!KA)for(RA=1,KA=new Array(OA-1);RA<OA;RA++)KA[RA-1]=arguments[RA];wA[YA].fn.apply(wA[YA].context,KA)}}return!0},kA.prototype.on=function(TA,gA,mA){var dA=new pA(gA,mA||this),PA=rA?rA+TA:TA;return this._events[PA]?this._events[PA].fn?this._events[PA]=[this._events[PA],dA]:this._events[PA].push(dA):(this._events[PA]=dA,this._eventsCount++),this},kA.prototype.once=function(TA,gA,mA){var dA=new pA(gA,mA||this,!0),PA=rA?rA+TA:TA;return this._events[PA]?this._events[PA].fn?this._events[PA]=[this._events[PA],dA]:this._events[PA].push(dA):(this._events[PA]=dA,this._eventsCount++),this},kA.prototype.removeListener=function(TA,gA,mA,dA){var PA=rA?rA+TA:TA;if(!this._events[PA])return this;if(!gA)return--this._eventsCount===0?this._events=new CA:delete this._events[PA],this;var Ae=this._events[PA];if(Ae.fn)Ae.fn===gA&&(!dA||Ae.once)&&(!mA||Ae.context===mA)&&(--this._eventsCount===0?this._events=new CA:delete this._events[PA]);else{for(var ne=0,wA=[],OA=Ae.length;ne<OA;ne++)(Ae[ne].fn!==gA||dA&&!Ae[ne].once||mA&&Ae[ne].context!==mA)&&wA.push(Ae[ne]);wA.length?this._events[PA]=wA.length===1?wA[0]:wA:--this._eventsCount===0?this._events=new CA:delete this._events[PA]}return this},kA.prototype.removeAllListeners=function(TA){var gA;return TA?(gA=rA?rA+TA:TA,this._events[gA]&&(--this._eventsCount===0?this._events=new CA:delete this._events[gA])):(this._events=new CA,this._eventsCount=0),this},kA.prototype.off=kA.prototype.removeListener,kA.prototype.addListener=kA.prototype.on,kA.prototype.setMaxListeners=function(){return this},kA.prefixed=rA,kA.EventEmitter=kA,tA.exports=kA});function c(tA,iA,rA){return iA in tA?Object.defineProperty(tA,iA,{value:rA,enumerable:!0,configurable:!0,writable:!0}):tA[iA]=rA,tA}var B=function(){},l={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},C={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},Q={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},E={" ":C.space," ":C.space,"\n":C.space,"\r":C.space,"<":C.lt,">":C.gt,'"':C.quote,"'":C.quote,"=":C.equal,"/":C.slash},h=function(iA){return E[iA]||C.char},u=function(iA){var rA,CA,pA,kA,_A,TA,gA,mA,dA,PA;iA=Object.assign({debug:!1},iA);var Ae=new I,ne=l.data,wA="",OA="",KA="",YA="",jA="",RA="",bA=function(qA,WA){if(!(OA[0]==="?"||OA[0]==="!")){var ie={type:qA,value:WA};iA.debug&&console.log("emit:",ie),Ae.emit("data",ie)}};Ae.stateMachine=(PA={},c(PA,l.data,(rA={},c(rA,C.lt,function(){wA.trim()&&bA(Q.text,wA),OA="",jA=!1,ne=l.tagBegin}),c(rA,C.char,function(FA){wA+=FA}),rA)),c(PA,l.cdata,c({},C.char,function(FA){wA+=FA,wA.substr(-3)==="]]>"&&(bA(Q.text,wA.slice(0,-3)),wA="",ne=l.data)})),c(PA,l.tagBegin,(CA={},c(CA,C.space,B),c(CA,C.char,function(FA){OA=FA,ne=l.tagName}),c(CA,C.slash,function(){OA="",jA=!0}),CA)),c(PA,l.tagName,(pA={},c(pA,C.space,function(){jA?ne=l.tagEnd:(ne=l.attributeNameStart,bA(Q.openTag,OA))}),c(pA,C.gt,function(){bA(jA?Q.closeTag:Q.openTag,OA),wA="",ne=l.data}),c(pA,C.slash,function(){ne=l.tagEnd,bA(Q.openTag,OA)}),c(pA,C.char,function(FA){OA+=FA,OA==="![CDATA["&&(ne=l.cdata,wA="",OA="")}),pA)),c(PA,l.tagEnd,(kA={},c(kA,C.gt,function(){bA(Q.closeTag,OA),wA="",ne=l.data}),c(kA,C.char,B),kA)),c(PA,l.attributeNameStart,(_A={},c(_A,C.char,function(FA){KA=FA,ne=l.attributeName}),c(_A,C.gt,function(){wA="",ne=l.data}),c(_A,C.space,B),c(_A,C.slash,function(){jA=!0,ne=l.tagEnd}),_A)),c(PA,l.attributeName,(TA={},c(TA,C.space,function(){ne=l.attributeNameEnd}),c(TA,C.equal,function(){bA(Q.attributeName,KA),ne=l.attributeValueBegin}),c(TA,C.gt,function(){YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),wA="",ne=l.data}),c(TA,C.slash,function(){jA=!0,YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),ne=l.tagEnd}),c(TA,C.char,function(FA){KA+=FA}),TA)),c(PA,l.attributeNameEnd,(gA={},c(gA,C.space,B),c(gA,C.equal,function(){bA(Q.attributeName,KA),ne=l.attributeValueBegin}),c(gA,C.gt,function(){YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),wA="",ne=l.data}),c(gA,C.char,function(FA){YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),KA=FA,ne=l.attributeName}),gA)),c(PA,l.attributeValueBegin,(mA={},c(mA,C.space,B),c(mA,C.quote,function(FA){RA=FA,YA="",ne=l.attributeValue}),c(mA,C.gt,function(){YA="",bA(Q.attributeValue,YA),wA="",ne=l.data}),c(mA,C.char,function(FA){RA="",YA=FA,ne=l.attributeValue}),mA)),c(PA,l.attributeValue,(dA={},c(dA,C.space,function(FA){RA?YA+=FA:(bA(Q.attributeValue,YA),ne=l.attributeNameStart)}),c(dA,C.quote,function(FA){RA===FA?(bA(Q.attributeValue,YA),ne=l.attributeNameStart):YA+=FA}),c(dA,C.gt,function(FA){RA?YA+=FA:(bA(Q.attributeValue,YA),wA="",ne=l.data)}),c(dA,C.slash,function(FA){RA?YA+=FA:(bA(Q.attributeValue,YA),jA=!0,ne=l.tagEnd)}),c(dA,C.char,function(FA){YA+=FA}),dA)),PA);var LA=function(qA){iA.debug&&console.log(ne,qA);var WA=Ae.stateMachine[ne],ie=WA[h(qA)]||WA[C.error]||WA[C.char];ie(qA)};return Ae.write=function(FA){for(var qA=FA.length,WA=0;WA<qA;WA++)LA(FA[WA])},Ae},d={State:l,Action:C,Type:Q,create:u},f=d.Type,w={element:"element",text:"text"},D=function(iA){return Object.assign({name:"",type:w.element,value:"",parent:null,attributes:{},children:[]},iA)},S=function(iA){iA=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},iA);var rA=void 0,CA=void 0,pA=void 0,kA=void 0,_A=new I,TA=function(mA){switch(mA.type){case f.openTag:if(pA===null)pA=CA,pA.name=mA.value;else{var dA=D({name:mA.value,parent:pA});pA.children.push(dA),pA=dA}break;case f.closeTag:var PA=pA.parent;if(iA.parentNodes||(pA.parent=null),pA.name!==mA.value)break;iA.stream&&PA===CA&&(CA.children=[],pA.parent=null),(!iA.emitTopLevelOnly||PA===CA)&&(_A.emit(iA.tagPrefix+pA.name,pA),_A.emit("tag",pA.name,pA)),pA===CA&&(rA.removeAllListeners("data"),_A.emit(iA.doneEvent,pA),CA=null),pA=PA;break;case f.text:pA&&pA.children.push(D({type:w.text,value:mA.value,parent:iA.parentNodes?pA:null}));break;case f.attributeName:kA=mA.value,pA.attributes[kA]="";break;case f.attributeValue:pA.attributes[kA]=mA.value;break}};return _A.reset=function(){rA=d.create({debug:iA.debug}),rA.on("data",TA),CA=D(),pA=null,kA="",_A.parse=rA.write},_A.reset(),_A},x=function(iA,rA){rA=Object.assign({},rA,{stream:!1,tagPrefix:":"});var CA=S(rA),pA=void 0;return CA.on("done",function(kA){pA=kA}),CA.parse(iA),pA},F={parseSync:x},k=F.parseSync,U=function(iA){var rA=k("<root>".concat(iA,"</root>"),{parentNodes:!1}),CA=rA.children&&rA.children.length>0&&rA.children.every(function(pA){return pA.name==="svg"});if(CA)return rA.children.length===1?rA.children[0]:rA.children;throw Error("nothing to parse")},N=function(iA){return g(iA,function(rA){return K(rA)?rA:Y(rA)})},Y=function(iA){return iA.replace(/[-|:]([a-z])/gi,function(rA,CA){return CA.toUpperCase()})},K=function(iA){return/^(data|aria)(-\w+)/.test(iA)},J=function(iA){if(iA){var rA=String(iA);return/[&<>]/.test(rA)?"<![CDATA[".concat(rA.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):rA}return""},W=function(iA){return String(iA).replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},Z=function(iA){var rA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},CA=rA.transformNode,pA=CA===void 0?function(gA){return gA}:CA,kA=rA.camelcase,_A=kA===void 0?!1:kA,TA=function(mA){var dA;return dA=pA(mA),_A&&(dA=N(dA)),dA};return TA(U(iA))};function AA(){for(var tA=arguments.length,iA=new Array(tA),rA=0;rA<tA;rA++)iA[rA]=arguments[rA];return new Promise(function(CA,pA){try{var kA=Z.apply(void 0,iA);CA(kA)}catch(_A){pA(_A)}})}var nA=function tA(iA){var rA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},CA=rA.transformAttr,pA=CA===void 0?function(ne,wA,OA){return"".concat(ne,'="').concat(OA(wA),'"')}:CA,kA=rA.transformNode,_A=kA===void 0?function(ne){return ne}:kA,TA=rA.selfClose,gA=TA===void 0?!0:TA;if(Array.isArray(iA))return iA.map(function(ne){return tA(ne,{transformAttr:pA,selfClose:gA,transformNode:_A})}).join("");var mA=_A(iA);if(mA.type==="text")return J(mA.value);var dA="";for(var PA in mA.attributes){var Ae=pA(PA,mA.attributes[PA],W,mA.name);dA+=Ae?" ".concat(Ae):""}return mA.children&&mA.children.length>0||!gA?"<".concat(mA.name).concat(dA,">").concat(tA(mA.children,{transformAttr:pA,transformNode:_A,selfClose:gA}),"</").concat(mA.name,">"):"<".concat(mA.name).concat(dA,"/>")},cA=Object.assign({},{parse:AA,parseSync:Z,stringify:nA});return cA})}}),QhA=Ga({"node_modules/js-beautify/js/src/core/output.js"(t,A){function e(n){this.__parent=n,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}e.prototype.clone_empty=function(){var n=new e(this.__parent);return n.set_indent(this.__indent_count,this.__alignment_count),n},e.prototype.item=function(n){return n<0?this.__items[this.__items.length+n]:this.__items[n]},e.prototype.has_match=function(n){for(var s=this.__items.length-1;s>=0;s--)if(this.__items[s].match(n))return!0;return!1},e.prototype.set_indent=function(n,s){this.is_empty()&&(this.__indent_count=n||0,this.__alignment_count=s||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},e.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},e.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},e.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var n=this.__parent.current_line;return n.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),n.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),n.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,n.__items[0]===" "&&(n.__items.splice(0,1),n.__character_count-=1),!0}return!1},e.prototype.is_empty=function(){return this.__items.length===0},e.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},e.prototype.push=function(n){this.__items.push(n);var s=n.lastIndexOf(`
5303
+ `)},N2t=(t,A)=>{if(typeof window>"u")return A;try{const e=localStorage.getItem(t);return e!==null?JSON.parse(e):A}catch{return A}},M2t=(t,A)=>{if(!(typeof window>"u"))try{localStorage.setItem(t,JSON.stringify(A))}catch{}},fEA=z.createContext(null),v2t=5,U2t=(t,A)=>!t&&!A?!0:!t||!A?!1:t.minX===A.minX&&t.maxX===A.maxX&&t.minY===A.minY&&t.maxY===A.maxY,L2t=({children:t})=>{if(z.useContext(fEA))return O.jsx(O.Fragment,{children:t});const e=z.useRef({pointer:null,boundingBoxes:new Map,hoveringIds:new Set,subscribers:new Set,mouseDownPosition:null}),i=z.useCallback(()=>{for(const c of e.current.subscribers)c()},[]),o=z.useCallback(()=>{const c=e.current.pointer,B=new Set;if(c)for(const[C,Q]of e.current.boundingBoxes){const E=Q.bounds;E&&c.x>=E.minX&&c.x<=E.maxX&&c.y>=E.minY&&c.y<=E.maxY&&B.add(C)}const l=e.current.hoveringIds;B.size===l.size&&[...B].every(C=>l.has(C))||(e.current.hoveringIds=B,i())},[i]),n=z.useCallback((c,B)=>{e.current.boundingBoxes.set(c,B),o()},[o]),s=z.useCallback((c,B)=>{const l=e.current.boundingBoxes.get(c);l&&U2t(l.bounds,B.bounds)&&l.onClick===B.onClick||(e.current.boundingBoxes.set(c,B),o())},[o]),r=z.useCallback(c=>{e.current.boundingBoxes.delete(c)&&o()},[o]),a=z.useCallback(c=>(e.current.subscribers.add(c),()=>{e.current.subscribers.delete(c)}),[]),g=z.useCallback(c=>e.current.hoveringIds.has(c),[]);z.useEffect(()=>{const c=Q=>{const{clientX:E,clientY:h}=Q,u=e.current.pointer;u&&u.x===E&&u.y===h||(e.current.pointer={x:E,y:h},o())},B=()=>{e.current.pointer!==null&&(e.current.pointer=null,e.current.mouseDownPosition=null,o())},l=Q=>{e.current.mouseDownPosition={x:Q.clientX,y:Q.clientY}},C=Q=>{const{clientX:E,clientY:h}=Q,u=e.current.mouseDownPosition;if(u&&Math.sqrt(Math.pow(E-u.x,2)+Math.pow(h-u.y,2))>v2t){e.current.mouseDownPosition=null;return}e.current.mouseDownPosition=null;for(const d of e.current.boundingBoxes.values()){const f=d.bounds;f&&E>=f.minX&&E<=f.maxX&&h>=f.minY&&h<=f.maxY&&d.onClick?.(Q)}};return window.addEventListener("pointermove",c,{passive:!0}),window.addEventListener("pointerdown",c,{passive:!0}),window.addEventListener("pointerup",c,{passive:!0}),window.addEventListener("pointerleave",B),window.addEventListener("pointercancel",B),window.addEventListener("blur",B),window.addEventListener("mousedown",l,{passive:!0}),window.addEventListener("click",C,{passive:!0}),()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerdown",c),window.removeEventListener("pointerup",c),window.removeEventListener("pointerleave",B),window.removeEventListener("pointercancel",B),window.removeEventListener("blur",B),window.removeEventListener("mousedown",l),window.removeEventListener("click",C)}},[o]);const I=z.useMemo(()=>({registerBoundingBox:n,updateBoundingBox:s,unregisterBoundingBox:r,subscribe:a,isHovering:g}),[n,s,r,a,g]);return O.jsx(fEA.Provider,{value:I,children:t})},H2t=t=>{const A=z.useContext(fEA);if(!A)throw new Error("useMouseEventsOverBoundingBox must be used within a MouseTracker");const e=z.useId(),i=z.useRef(t);i.current=t;const o=z.useMemo(()=>s=>{i.current.onClick?.(s)},[]);return z.useEffect(()=>(A.registerBoundingBox(e,{bounds:i.current.bounds,onClick:i.current.onClick?o:void 0}),()=>{A.unregisterBoundingBox(e)}),[A,o,e]),z.useEffect(()=>{A.updateBoundingBox(e,{bounds:i.current.bounds,onClick:i.current.onClick?o:void 0})},[A,o,e,t.bounds?.minX,t.bounds?.maxX,t.bounds?.minY,t.bounds?.maxY,t.onClick]),{hovering:z.useSyncExternalStore(A.subscribe,()=>A.isHovering(e),()=>!1)}},Y2t=(t,A)=>!t&&!A?!0:!t||!A?!1:Math.abs(t.bounds.minX-A.bounds.minX)<.5&&Math.abs(t.bounds.maxX-A.bounds.maxX)<.5&&Math.abs(t.bounds.minY-A.bounds.minY)<.5&&Math.abs(t.bounds.maxY-A.bounds.maxY)<.5&&Math.abs(t.rect.left-A.rect.left)<.5&&Math.abs(t.rect.top-A.rect.top)<.5&&Math.abs(t.rect.width-A.rect.width)<.5&&Math.abs(t.rect.height-A.rect.height)<.5,J2t=({componentId:t,svgDivRef:A,containerRef:e,onComponentClick:i,onHoverChange:o,showOutline:n,circuitJsonKey:s})=>{const[r,a]=z.useState(null),g=z.useRef(null),I=z.useCallback(()=>{g.current=null;const E=A.current,h=e.current;if(!E||!h){a(D=>D&&null);return}const u=E.querySelector(`[data-schematic-component-id="${t}"]`);if(!u){a(D=>D&&null);return}const d=u.getBoundingClientRect(),f=h.getBoundingClientRect(),w={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(D=>Y2t(D,w)?D:w)},[t,e,A]),c=z.useCallback(()=>{g.current===null&&(g.current=window.requestAnimationFrame(I))},[I]);z.useEffect(()=>{c()},[c,s]),z.useEffect(()=>{c();const E=A.current,h=e.current;if(!E||!h)return;const u=typeof ResizeObserver<"u"?new ResizeObserver(()=>{c()}):null;u?.observe(h),u?.observe(E);const d=typeof MutationObserver<"u"?new MutationObserver(()=>{c()}):null;return d?.observe(E,{attributes:!0,attributeFilter:["style","transform"],subtree:!0,childList:!0}),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{u?.disconnect(),d?.disconnect(),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c),g.current!==null&&(cancelAnimationFrame(g.current),g.current=null)}},[c,A,e]);const B=z.useCallback(E=>{i&&i(t,E)},[t,i]),l=r?.bounds??null,{hovering:C}=H2t({bounds:l,onClick:i?B:void 0});if(z.useEffect(()=>{o&&o(t,C)},[C,t,o]),!r||!C||!n)return null;const Q=r.rect;return O.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:Kx.schematicComponentHoverOutline}})},T2t=({circuitJson:t,containerStyle:A,editEvents:e=[],onEditEvent:i,defaultEditMode:o=!1,debugGrid:n=!1,editingEnabled:s=!1,debug:r=!1,clickToInteractEnabled:a=!1,colorOverrides:g,spiceSimulationEnabled:I=!1,disableGroups:c=!1,onSchematicComponentClicked:B})=>{r&&E2t();const[l,C]=z.useState(!1),[Q,E]=z.useState({showVoltage:!0,showCurrent:!1,startTime:0,duration:20}),h=lA=>`${lA?.length||0}_${lA?.editCount||0}`,u=z.useMemo(()=>h(t),[t]),d=z.useMemo(()=>{if(!I)return null;try{return R2t(t,Q)}catch(lA){return console.error("Failed to generate SPICE string",lA),null}},[u,I,Q.startTime,Q.duration]),[f,w]=z.useState(!1);z.useEffect(()=>{w(!1)},[u]);const{plotData:D,nodes:S,isLoading:x,error:F}=_2t(f?d:null),[k,U]=z.useState(o),[N,Y]=z.useState(!0),[K,J]=z.useState(!a),[W,Z]=z.useState(!1),[AA,nA]=z.useState(()=>c?!1:N2t("schematic_viewer_show_groups",!1)),[cA,tA]=z.useState(!1),iA=z.useRef(new Set),rA=z.useCallback((lA,EA)=>{EA?iA.current.add(lA):iA.current.delete(lA),tA(iA.current.size>0)},[]),CA=z.useRef(null),pA=z.useRef(null),kA=z.useMemo(()=>{try{return Hp(t).schematic_component?.list()?.map(lA=>lA.schematic_component_id)??[]}catch(lA){return console.error("Failed to derive schematic component ids",lA),[]}},[u,t]),_A=lA=>{const EA=lA.touches[0];pA.current={x:EA.clientX,y:EA.clientY}},TA=lA=>{const EA=lA.changedTouches[0],JA=pA.current;if(!JA)return;const re=Math.abs(EA.clientX-JA.x),he=Math.abs(EA.clientY-JA.y);re<10&&he<10&&(lA.preventDefault(),J(!0)),pA.current=null},[gA,mA]=z.useState([]),dA=z.useRef(t);z.useEffect(()=>{const lA=h(t),EA=h(dA.current);lA!==EA&&(mA([]),dA.current=t)},[t]);const{ref:PA,cancelDrag:Ae,transform:ne}=zL({onSetTransform(lA){CA.current&&(CA.current.style.transform=rh(lA))},enabled:K&&!l}),{containerWidth:wA,containerHeight:OA}=vAe(PA),KA=z.useMemo(()=>!wA||!OA?"":Y8(t,{width:wA,height:OA||720,grid:n?{cellSize:1,labelCells:!0}:void 0,colorOverrides:g}),[u,wA,OA]),YA=z.useMemo(()=>KA.match(/<svg[^>]*style="[^"]*background-color:\s*([^;\"]+)/i)?.[1]??"transparent",[KA]),jA=z.useMemo(()=>{if(!KA)return ug();const lA=KA.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return hT(lA)}catch(EA){return console.error(EA),ug()}},[KA]),RA=lA=>{mA(EA=>[...EA,lA]),i&&i(lA)},bA=z.useMemo(()=>[...e,...gA],[e,gA]),{handleMouseDown:LA,handleTouchStart:FA,isDragging:qA,activeEditEvent:WA}=d2t({onEditEvent:RA,cancelDrag:Ae,realToSvgProjection:jA,svgToScreenProjection:ne,circuitJson:t,editEvents:bA,enabled:k&&K&&!l,snapToGrid:N});c2t({svgDivRef:CA,editEvents:bA,realToSvgProjection:jA,svgToScreenProjection:ne,activeEditEvent:WA}),B2t({svgDivRef:CA,circuitJson:t,activeEditEvent:WA,editEvents:bA}),l2t({svgDivRef:CA,circuitJson:t,circuitJsonKey:u,showGroups:AA&&!c});const ie=z.useRef(FA);z.useEffect(()=>{ie.current=FA},[FA]);const SA=z.useMemo(()=>O.jsx("div",{ref:CA,style:{pointerEvents:a?K?"auto":"none":"auto",transformOrigin:"0 0"},className:B?"schematic-component-clickable":void 0,onTouchStart:lA=>{k&&K&&!l&&ie.current(lA)},dangerouslySetInnerHTML:{__html:KA}}),[KA,K,a,k,l]);return O.jsxs(L2t,{children:[B&&O.jsx("style",{children:".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }"}),O.jsxs("div",{ref:PA,style:{position:"relative",backgroundColor:YA,overflow:"hidden",cursor:l?"auto":qA?"grabbing":a&&!K||cA&&B?"pointer":"grab",minHeight:"300px",...A},onWheelCapture:lA=>{l&&lA.stopPropagation()},onMouseDown:lA=>{if(a&&!K){lA.preventDefault(),lA.stopPropagation();return}LA(lA)},onMouseDownCapture:lA=>{if(a&&!K){lA.preventDefault(),lA.stopPropagation();return}},onTouchStart:lA=>{l||_A(lA)},onTouchEnd:lA=>{l||TA(lA)},children:[!K&&a&&O.jsx("div",{onClick:lA=>{lA.preventDefault(),lA.stopPropagation(),J(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Kx.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"all",touchAction:"pan-x pan-y pinch-zoom"},children:O.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"})}),O.jsx(y2t,{active:W,onClick:()=>Z(!W)}),s&&O.jsx(p2t,{active:k,onClick:()=>U(!k)}),s&&k&&O.jsx(f2t,{active:N,onClick:()=>Y(!N)}),O.jsx(w2t,{circuitJson:t,circuitJsonKey:u,isVisible:W,onClose:()=>Z(!1),showGroups:AA,onToggleGroups:lA=>{c||(nA(lA),M2t("schematic_viewer_show_groups",lA))}}),I&&O.jsx(S2t,{onClick:()=>C(!0)}),l&&O.jsx(x2t,{spiceString:d,onClose:()=>C(!1),plotData:D,nodes:S,isLoading:x,error:F,simOptions:Q,onSimOptionsChange:lA=>{w(!0),E(lA)},hasRun:f}),B&&kA.map(lA=>O.jsx(J2t,{componentId:lA,svgDivRef:CA,containerRef:PA,showOutline:!0,circuitJsonKey:u,onHoverChange:rA,onComponentClick:(EA,JA)=>{B?.({schematicComponentId:EA,event:JA})}},lA)),SA]})]})},K2t=({circuitJson:t,containerStyle:A,colorOverrides:e,width:i,height:o,className:n})=>{const[s,r]=z.useState(null),[a,g]=z.useState(!0),[I,c]=z.useState(null),[B,l]=z.useState(null),C=z.useRef(null),Q=z.useRef(null),{containerWidth:E,containerHeight:h}=vAe(C),[u,d]=z.useState(!1),{ref:f}=zL({onSetTransform(Y){Q.current&&(Q.current.style.transform=rh(Y))}}),w=i||E||1e3,D=o||h||600;z.useEffect(()=>{g(!0),c(null),r(t),g(!1)},[t]);const S=z.useMemo(()=>s&&s.find(K=>K.type==="simulation_experiment")?.simulation_experiment_id||null,[s]),x=z.useMemo(()=>s?s.filter(Y=>Y.type==="simulation_transient_voltage_graph").map(Y=>Y.simulation_transient_voltage_graph_id):[],[s]),F=z.useMemo(()=>{if(!s||!w||!D||!S)return"";try{return x7A({circuitJson:s,simulation_experiment_id:S,simulation_transient_voltage_graph_ids:x,width:w,height:D,schematicOptions:{colorOverrides:e}})}catch(Y){return console.error("Failed to generate fallback schematic SVG:",Y),""}},[s,w,D,e,S,x]);z.useEffect(()=>{if(!F){l(null);return}try{const Y=new Blob([F],{type:"image/svg+xml"}),K=URL.createObjectURL(Y);return l(K),()=>{URL.revokeObjectURL(K)}}catch(Y){console.error("Failed to create SVG object URL:",Y),l(null)}},[F]);const k=z.useMemo(()=>F?F.match(/<svg[^>]*style="[^"]*background-color:\s*([^;\"]+)/i)?.[1]??"transparent":"transparent",[F]),U=Y=>{d(!0)},N=Y=>{d(!0)};return z.useEffect(()=>{const Y=()=>{d(!1)},K=()=>{d(!1)};return window.addEventListener("mouseup",Y),window.addEventListener("touchend",K),()=>{window.removeEventListener("mouseup",Y),window.removeEventListener("touchend",K)}},[]),a?O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f5f5f5",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#666",...A},className:n,children:"Loading circuit..."}):I?O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#fef2f2",minHeight:"300px",fontFamily:"sans-serif",fontSize:"16px",color:"#dc2626",...A},className:n,children:O.jsxs("div",{style:{textAlign:"center",padding:"20px"},children:[O.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:"Circuit Conversion Error"}),O.jsx("div",{style:{fontSize:"14px"},children:I})]})}):F?O.jsx("div",{ref:Y=>{C.current=Y,f.current=Y},style:{position:"relative",backgroundColor:k,overflow:"hidden",minHeight:"300px",cursor:u?"grabbing":"grab",...A},className:n,onMouseDown:U,onTouchStart:N,children:B?O.jsx("img",{ref:Q,src:B,alt:"Circuit Simulation",style:{transformOrigin:"0 0",width:"100%",height:"100%",display:"block",objectFit:"contain"}}):O.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"300px",color:"#666",fontFamily:"sans-serif"},children:"Failed to render SVG"})}):O.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:"#f8fafc",minHeight:"300px",fontFamily:"sans-serif",gap:"12px",...A},className:n,children:[O.jsx("div",{style:{fontSize:"16px",color:"#475569",fontWeight:500},children:"No Simulation Found"}),O.jsxs("div",{style:{fontSize:"14px",color:"#64748b"},children:["Use"," ",O.jsx("code",{style:{backgroundColor:"#e2e8f0",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace",fontSize:"13px"},children:"<analogsimulation />"})," ","to create simulations"]})]})},LAe=t=>{const[A,e]=z.useState(0),[i,o]=z.useState(0);return z.useEffect(()=>{if(!t.current)return;const n=()=>{const r=t.current?.getBoundingClientRect();e(r?.width||0),o(r?.height||0)};n();const s=new ResizeObserver(n);return s.observe(t.current),window.addEventListener("resize",n),()=>{s.disconnect(),window.removeEventListener("resize",n)}},[]),{containerWidth:A,containerHeight:i}};Ba("assembly-viewer");var HAe=()=>{Ba.enable("assembly-viewer*")},q2t=({circuitJson:t,containerStyle:A,debugGrid:e=!1,debug:i=!1})=>{i&&HAe();const o=z.useRef(null),{ref:n}=zL({onSetTransform(I){o.current&&(o.current.style.transform=rh(I))}}),{containerWidth:s,containerHeight:r}=LAe(n),a=z.useMemo(()=>!s||!r?"":o7A(t,{width:s,height:r||720}),[t,s,r]);z.useMemo(()=>{if(!a)return ug();const I=a.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return hT(I)}catch(c){return console.error(c),ug()}},[a]);const g=z.useMemo(()=>O.jsx("div",{ref:o,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:a}}),[a]);return O.jsx("div",{ref:n,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...A},children:g})},P2t=({circuitJson:t,containerStyle:A,debugGrid:e=!1,debug:i=!1})=>{i&&HAe();const o=z.useRef(null),{ref:n}=zL({onSetTransform(I){o.current&&(o.current.style.transform=rh(I))}}),{containerWidth:s,containerHeight:r}=LAe(n),a=z.useMemo(()=>!s||!r?"":vQA(t,{width:s,height:r||720}),[t,s,r]);z.useMemo(()=>{if(!a)return ug();const I=a.match(/data-real-to-screen-transform="([^"]+)"/)?.[1];try{return hT(I)}catch(c){return console.error(c),ug()}},[a]);const g=z.useMemo(()=>O.jsx("div",{ref:o,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:a}}),[a]);return O.jsx("div",{ref:n,style:{position:"relative",backgroundColor:"#FFFFFF",overflow:"hidden",minHeight:"300px",...A},children:g})};const YAe=["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."],O2t=(()=>{let t=YAe[Math.floor(Math.random()*YAe.length)];return t=t.replace(/</g,"&lt;"),t=t.replace(/>/g,"&gt;"),t=t.replace(new RegExp('(?<!href=")(?<!\\()(?<!\\]\\()(https?:\\/\\/[^\\s\\)\\]]+)',"g"),(A,e)=>`<a class="rf-text-blue-500 rf-underline" href="${A}" target="_blank">${A}</a>`),t=t.replace(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/g,'<a class="rf-text-blue-500 rf-underline" href="$2" target="_blank">$1</a>'),t})(),GS=({onRunClicked:t})=>O.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:[O.jsx(OSt,{className:"rf-size-14 rf-mb-4"}),O.jsxs("p",{className:"rf-text-md rf-break-words rf-max-w-xl rf-text-center",children:["Tip: ",O.jsx("span",{dangerouslySetInnerHTML:{__html:O2t}})]}),t&&O.jsxs(Ja,{className:"rf-mt-4 rf-bg-blue-600 rf-hover:bg-blue-500",onClick:t,children:["Run Code",O.jsx(_zA,{className:"rf-w-3 rf-h-3 rf-ml-2"})]})]}),EW=({text:t,onClick:A})=>O.jsx("span",{className:"rf-cursor-pointer rf-underline rf-text-blue-600 rf-mx-2",onClick:A,children:t}),hW=t=>O.jsxs("div",{className:"rf-leading-5",children:[O.jsx("div",{className:"rf-py-2 rf-font-bold",children:t.column.name}),O.jsx("div",{children:t.field?.()??O.jsx("input",{type:"text",className:"rf-border rf-rounded rf-p-1 rf-w-full",onChange:A=>{t.onTextChange?.(A.target.value)}})})]}),W2t=({open:t,children:A,title:e,onClose:i})=>t?O.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:O.jsxs("div",{className:"rf-bg-white rf-p-5 rf-rounded-lg rf-relative rf-w-11/12 rf-max-w-2xl",onClick:o=>{o.preventDefault(),o.stopPropagation()},children:[O.jsx("h2",{className:"rf-mt-0 rf-text-md rf-pb-4",children:e}),O.jsx("button",{type:"button",className:"rf-absolute rf-top-2 rf-right-4 rf-text-2xl rf-font-bold",onClick:i,children:"×"}),A]})}):null,Z2t=({elements:t})=>{const[A,e]=z.useState({open:!1}),[i,o]=z.useReducer((I,c)=>({...I,...c}),{}),n=[...new Set(t.map(I=>I.type))],s=t.map(I=>{const c=I[`${I.type}_id`],B=Object.fromEntries(Object.entries(I).filter(([C])=>!(C===`${I.type}_id`||!C.endsWith("_id")))),l=Object.fromEntries(Object.entries(I).filter(([C])=>!C.endsWith("_id")));return{primary_id:c,other_ids:B,...l,_og_elm:I}}),r=s.map(I=>{let c="";const B=l=>{const C=Object.keys(l.other_ids).find(h=>h.startsWith("source_"));if(!C)return`.${l.name}`;const Q=C.slice(0,-3),E=s.find(h=>h.type===Q&&h.primary_id===l.other_ids[C]);return E?"name"in E?`${B(E)} > .${l.name}`:`#${E.primary_id} > .${l.name}`:`??? > .${l.name}`};return"name"in I&&(c=B(I)),{...I,selector_path:c}}),a=[{key:"primary_id",name:"primary_id",renderCell:I=>O.jsxs("div",{className:"rf-flex rf-items-center",children:[O.jsx(EW,{text:I.primary_id,onClick:()=>o({focused_id:I.primary_id,id_search:void 0,selector_search:void 0})}),O.jsx("span",{className:"rf-flex-grow"}),O.jsx(EW,{text:"(JSON)",onClick:()=>e({open:!0,element:I._og_elm,title:I.primary_id})})]}),renderHeaderCell:I=>O.jsx(hW,{column:I,onTextChange:c=>o({id_search:c}),field:i.focused_id?()=>O.jsxs("div",{children:["Focus:"," ",O.jsx("span",{className:"rf-underline",children:i.focused_id}),O.jsx(EW,{text:"(unfocus)",onClick:()=>o({focused_id:void 0})})]}):void 0})},{key:"type",name:"type",renderHeaderCell:I=>O.jsx(hW,{column:I,field:()=>O.jsxs("select",{onChange:c=>o({component_type_filter:c.target.value}),className:"rf-border rf-rounded rf-p-1 rf-w-full",children:[O.jsx("option",{value:"any",children:"any"},"any"),O.jsx("option",{value:"source",children:"source"},"source"),O.jsx("option",{value:"source/pcb",children:"source/pcb"},"source/pcb"),O.jsx("option",{value:"source/schematic",children:"source/schematic"},"source/schematic"),n.map(c=>O.jsx("option",{value:c,children:c},c))]})})},{key:"name",name:"name",renderHeaderCell:I=>O.jsx(hW,{column:I,onTextChange:c=>o({name_search:c})})},{key:"selector_path",name:"selector_path",renderHeaderCell:I=>O.jsx(hW,{column:I,onTextChange:c=>o({selector_search:c})})},{key:"other_ids",name:"other_ids",renderCell:I=>O.jsx("div",{className:"rf-space-x-2",children:Object.entries(I.other_ids).map(([c,B])=>O.jsx(EW,{text:B,onClick:()=>o({focused_id:B})},B))})}],g=r.filter(I=>i.name_search?I.name?.toLowerCase()?.includes(i.name_search.toLowerCase()):!0).filter(I=>!i.component_type_filter||i.component_type_filter==="any"?!0:i.component_type_filter==="source"?I.type.startsWith("source_"):i.component_type_filter==="source/pcb"?I.type.startsWith("source_")||I.type.startsWith("pcb_"):i.component_type_filter==="source/schematic"?I.type.startsWith("source_")||I.type.startsWith("schematic_"):I.type?.includes(i.component_type_filter)).filter(I=>i.selector_search?i.selector_search.split(" ").filter(B=>B.length>0).every(B=>I.selector_path?.includes(B)):!0).filter(I=>i.id_search?I.primary_id?.includes(i.id_search):!0).filter(I=>!!(!i.focused_id||I.primary_id===i.focused_id||Object.values(I.other_ids).includes(i.focused_id)));return O.jsxs("div",{className:"rf-font-mono rf-text-xs rf-bg-white",children:[O.jsx("div",{className:"rf-overflow-x-auto",children:O.jsxs("table",{className:"rf-table-auto rf-w-full rf-text-left",children:[O.jsx("thead",{children:O.jsx("tr",{children:a.map(I=>O.jsx("th",{className:"rf-px-4 rf-py-2 rf-border-b",children:I.renderHeaderCell?I.renderHeaderCell(I):I.name},I.key))})}),O.jsx("tbody",{children:g.map((I,c)=>O.jsx("tr",{className:"rf-hover:bg-gray-100",children:a.map(B=>O.jsx("td",{className:"rf-px-4 rf-py-2 rf-border-b",children:B.renderCell?B.renderCell(I):I[B.key]},B.key))},c))})]})}),O.jsx(W2t,{open:A.open,onClose:()=>e({open:!1}),title:A.open?A.title:"",children:O.jsx("div",{className:"rf-bg-gray-800 rf-p-3 rf-text-white rf-rounded",children:O.jsx("pre",{className:"rf-whitespace-pre-wrap",children:A.open?JSON.stringify(A.element,null,2):""})})})]})},V2t=(t,A)=>t==="jlcpcb"?O.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${A}`,children:A}):A,j2t=({circuitJson:t})=>{const A=t.filter(i=>i.type==="source_component"),e=new Set;for(const i of A)if(i.supplier_part_numbers)for(const o of Object.keys(i.supplier_part_numbers))e.add(o);return O.jsx("div",{className:"rf-overflow-x-auto",children:O.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"rf-border-b",children:[O.jsx("th",{className:"rf-p-2",children:"Name"}),Array.from(e).map(i=>O.jsx("th",{className:"rf-p-2 rf-capitalize",children:i},i))]})}),O.jsx("tbody",{children:A.map(i=>O.jsxs("tr",{className:"rf-border-b",children:[O.jsx("td",{className:"rf-p-2",children:i.name}),Array.from(e).map(o=>O.jsx("td",{className:"rf-p-2",children:V2t(o,i.supplier_part_numbers?.[o]?.[0]||"")},o))]},i.source_component_id))})]})})},yEA=z.forwardRef(({className:t,type:A,...e},i)=>O.jsx("input",{type:A,className:Hi("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",t),ref:i,...e}));yEA.displayName="Input";var JAe={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}}},mEA=new Set;for(const[t,A]of Object.entries(JAe)){mEA.add(t);for(const e of Object.keys(A.variants))mEA.add(e)}function z2t(t){for(const[A,e]of Object.entries(JAe))if(t in e.variants)return{baseUnit:e.baseUnit,conversionFactor:e.variants[t]};return{baseUnit:t,conversionFactor:1}}var TAe={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 vm(t){if(t==null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof t=="string"&&t.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(t),parsedUnit:null,unitOfValue:null};if(typeof t=="number")return{value:t,parsedUnit:null,unitOfValue:null};if(typeof t=="object"&&"x"in t&&"y"in t){const{parsedUnit:r,unitOfValue:a}=vm(t.x),g=vm(t.x),I=vm(t.y);return g.value===null||I.value===null?{parsedUnit:null,unitOfValue:null,value:null}:{parsedUnit:r,unitOfValue:a,value:{x:g.value,y:I.value}}}const e=t.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!e)throw new Error(`Could not determine unit: "${t}"`);const i=e.split("").reverse().join(""),o=t.slice(0,-i.length);if(i in TAe&&!mEA.has(i)){const r=TAe[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(o)*r}}const{baseUnit:n,conversionFactor:s}=z2t(i);return{parsedUnit:i,unitOfValue:n,value:s*Number.parseFloat(o)}}var uW=v().or(MA()).transform(t=>vm(t).value),wEA=v().or(MA()).transform(t=>vm(t).value).transform(t=>Number.parseFloat(t.toPrecision(12))),KAe=v().or(MA()).transform(t=>vm(t).value),QF=v().or(MA()).transform(t=>vm(t).value),Pi=v().or(MA()).transform(t=>vm(t).value),uH=v().or(MA()).transform(t=>vm(t).value),ut=Pi,dW=v().or(MA()).transform(t=>vm(t).value),dH=v().or(MA()).transform(t=>vm(t).value),X2t=dH,EF=dH,qAe=v().datetime(),Gd=v().or(MA()).transform(t=>typeof t=="number"?t:t.endsWith("deg")?Number.parseFloat(t.split("deg")[0]):t.endsWith("rad")?Number.parseFloat(t.split("rad")[0])*180/Math.PI:Number.parseFloat(t)),PAe=MA().or(v().endsWith("mAh")).transform(t=>{if(typeof t=="string"){const A=t.replace("mAh",""),e=Number.parseFloat(A);if(Number.isNaN(e))throw new Error("Invalid capacity");return e}return t}).describe("Battery capacity in mAh"),bo=xA({x:ut,y:ut}),$2t=bo,pH=xA({x:ut,y:ut,z:ut}),AUt=pH,DEA=xA({width:MA(),height:MA()}),eUt=t=>{const A="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:t},()=>A[Math.floor(Math.random()*A.length)]).join("")},zt=t=>v().optional().default(()=>`${t}_${eUt(10)}`),qx=Ze(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),OAe=Ze(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),bB=xA({type:QA("source_component"),ftype:v().optional(),source_component_id:v(),name:v(),manufacturer_part_number:v().optional(),supplier_part_numbers:Aa(OAe,fe(v())).optional(),display_value:v().optional(),are_pins_interchangeable:te().optional(),internally_connected_source_port_ids:fe(fe(v())).optional(),source_group_id:v().optional(),subcircuit_id:v().optional()}),SEA=bB.extend({ftype:QA("simple_capacitor"),capacitance:wEA,max_voltage_rating:QF.optional(),display_capacitance:v().optional(),max_decoupling_trace_length:ut.optional()}),bEA=bB.extend({ftype:QA("simple_resistor"),resistance:uW,display_resistance:v().optional()}),pW=bB.extend({ftype:QA("simple_diode")}),WAe=bB.extend({ftype:QA("simple_fiducial")}),xEA=pW.extend({ftype:QA("simple_led"),color:v().optional(),wavelength:v().optional()}),ZAe=bB.extend({ftype:QA("simple_ground")}),kEA=bB.extend({ftype:QA("simple_chip")}),GEA=bB.extend({ftype:QA("simple_power_source"),voltage:QF}),tUt=bB.extend({ftype:QA("simple_fuse"),current_rating_amps:MA().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:MA().describe("Voltage rating in volts, e.g. ±5V would be 5")}),FEA=bB.extend({ftype:QA("simple_battery"),capacity:PAe}),_EA=bB.extend({ftype:QA("simple_inductor"),inductance:KAe,max_current_rating:MA().optional()}),REA=bB.extend({ftype:QA("simple_push_button")}),NEA=bB.extend({ftype:QA("simple_potentiometer"),max_resistance:uW}),VAe=bB.extend({ftype:QA("simple_crystal"),frequency:MA().describe("Frequency in Hz"),load_capacitance:MA().optional().describe("Load capacitance in pF")}),MEA=bB.extend({ftype:QA("simple_pin_header"),pin_count:MA(),gender:Ze(["male","female"]).optional().default("male")}),vEA=bB.extend({ftype:QA("simple_pinout")}),UEA=bB.extend({ftype:QA("simple_resonator"),load_capacitance:wEA,equivalent_series_resistance:uW.optional(),frequency:uH}),LEA=bB.extend({ftype:QA("simple_transistor"),transistor_type:Ze(["npn","pnp"])}),HEA=bB.extend({ftype:QA("simple_test_point"),footprint_variant:Ze(["pad","through_hole"]).optional(),pad_shape:Ze(["rect","circle"]).optional(),pad_diameter:Wt([MA(),v()]).optional(),hole_diameter:Wt([MA(),v()]).optional(),width:Wt([MA(),v()]).optional(),height:Wt([MA(),v()]).optional()}),YEA=bB.extend({ftype:QA("simple_mosfet"),channel_type:Ze(["n","p"]),mosfet_mode:Ze(["enhancement","depletion"])}),JEA=bB.extend({ftype:QA("simple_switch")}),TEA=xA({type:QA("source_project_metadata"),name:v().optional(),software_used_string:v().optional(),project_url:v().optional(),created_at:qAe.optional()}),jAe=xA({type:QA("source_missing_property_error"),source_missing_property_error_id:zt("source_missing_property_error"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_missing_property_error").default("source_missing_property_error"),message:v()}).describe("The source code is missing a property"),zAe=xA({type:QA("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:zt("source_failed_to_create_component_error"),error_type:QA("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:v().optional(),subcircuit_id:v().optional(),parent_source_component_id:v().optional(),message:v(),pcb_center:xA({x:MA().optional(),y:MA().optional()}).optional(),schematic_center:xA({x:MA().optional(),y:MA().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),KEA=xA({type:QA("source_trace_not_connected_error"),source_trace_not_connected_error_id:zt("source_trace_not_connected_error"),error_type:QA("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:v(),subcircuit_id:v().optional(),source_group_id:v().optional(),source_trace_id:v().optional(),connected_source_port_ids:fe(v()).optional(),selectors_not_found:fe(v()).optional()}).describe("Occurs when a source trace selector does not match any ports"),XAe=xA({type:QA("source_property_ignored_warning"),source_property_ignored_warning_id:zt("source_property_ignored_warning"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_property_ignored_warning").default("source_property_ignored_warning"),message:v()}).describe("The source property was ignored"),qEA=xA({type:QA("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:zt("source_pin_missing_trace_warning"),warning_type:QA("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),$Ae=bB.extend({ftype:QA("simple_voltage_probe")}),Aee=bB.extend({ftype:QA("interconnect")}),eee=Wt([bEA,SEA,pW,WAe,xEA,ZAe,kEA,GEA,FEA,_EA,REA,NEA,VAe,MEA,vEA,UEA,JEA,LEA,HEA,YEA,tUt,$Ae,Aee,TEA,jAe,zAe,KEA,XAe,qEA]),tee=xA({type:QA("source_port"),pin_number:MA().optional(),port_hints:fe(v()).optional(),name:v(),source_port_id:v(),source_component_id:v().optional(),source_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),must_be_connected:te().optional()}),iee=xA({type:QA("source_component_internal_connection"),source_component_internal_connection_id:v(),source_component_id:v(),source_port_ids:fe(v()),subcircuit_id:v().optional()}),oee=xA({type:QA("source_trace"),source_trace_id:v(),connected_source_port_ids:fe(v()),connected_source_net_ids:fe(v()),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),max_length:MA().optional(),min_trace_thickness:MA().optional(),display_name:v().optional()}),nee=xA({type:QA("source_group"),source_group_id:v(),subcircuit_id:v().optional(),parent_subcircuit_id:v().optional(),parent_source_group_id:v().optional(),is_subcircuit:te().optional(),show_as_schematic_box:te().optional(),name:v().optional(),was_automatically_named:te().optional()}),see=xA({type:QA("source_net"),source_net_id:v(),name:v(),member_source_group_ids:fe(v()),is_power:te().optional(),is_ground:te().optional(),is_digital_signal:te().optional(),is_analog_signal:te().optional(),is_positive_voltage_source:te().optional(),trace_width:MA().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),ree=xA({type:QA("source_board"),source_board_id:v(),source_group_id:v(),title:v().optional()}).describe("Defines a board in the source domain"),aee=xA({type:QA("source_pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional()}).describe("Defines a ground plane in the source domain"),gee=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],PEA=Ze(gee),xr=PEA.or(xA({name:PEA})).transform(t=>typeof t=="string"?t:t.name),Um=Ze(["top","bottom"]),Iee=xA({type:QA("source_manually_placed_via"),source_manually_placed_via_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional()}).describe("Defines a via that is manually placed in the source domain"),cee=xA({type:QA("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:zt("source_pin_must_be_connected_error"),error_type:QA("source_pin_must_be_connected_error").default("source_pin_must_be_connected_error"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when a pin with mustBeConnected attribute is not connected to any trace"),Bee=xA({type:QA("unknown_error_finding_part"),unknown_error_finding_part_id:zt("unknown_error_finding_part"),error_type:QA("unknown_error_finding_part").default("unknown_error_finding_part"),message:v(),source_component_id:v().optional(),subcircuit_id:v().optional()}).describe("Error emitted when an unexpected error occurs while finding a part"),lee=xA({type:QA("schematic_box"),schematic_component_id:v().optional(),width:ut,height:ut,is_dashed:te().default(!1),x:ut,y:ut,subcircuit_id:v().optional()}).describe("Draws a box on the schematic"),Cee=xA({type:QA("schematic_path"),schematic_component_id:v(),fill_color:Ze(["red","blue"]).optional(),is_filled:te().optional(),points:fe(bo),subcircuit_id:v().optional()}),Qee=Aa(xA({left_margin:Pi.optional(),right_margin:Pi.optional(),top_margin:Pi.optional(),bottom_margin:Pi.optional()})),Eee=xA({left_size:MA(),right_size:MA(),top_size:MA().optional(),bottom_size:MA().optional()}),hee=xA({left_side:xA({pins:fe(MA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:xA({pins:fe(MA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:xA({pins:fe(MA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:xA({pins:fe(MA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional()}),uee=Wt([Eee,hee]),dee=xA({type:QA("schematic_component"),size:DEA,center:bo,source_component_id:v().optional(),schematic_component_id:v(),pin_spacing:Pi.optional(),pin_styles:Qee.optional(),box_width:Pi.optional(),symbol_name:v().optional(),port_arrangement:uee.optional(),port_labels:Aa(v()).optional(),symbol_display_value:v().optional(),subcircuit_id:v().optional(),schematic_group_id:v().optional(),is_schematic_group:te().optional(),source_group_id:v().optional(),is_box_with_pins:te().optional().default(!0)}),pee=xA({type:QA("schematic_line"),schematic_line_id:zt("schematic_line"),schematic_component_id:v(),x1:ut,y1:ut,x2:ut,y2:ut,stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled line on the schematic"),fee=xA({type:QA("schematic_rect"),schematic_rect_id:zt("schematic_rect"),schematic_component_id:v(),center:bo,width:ut,height:ut,rotation:Gd.default(0),stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled rectangle on the schematic"),yee=xA({type:QA("schematic_circle"),schematic_circle_id:zt("schematic_circle"),schematic_component_id:v(),center:bo,radius:ut,stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled circle on the schematic"),mee=xA({type:QA("schematic_arc"),schematic_arc_id:zt("schematic_arc"),schematic_component_id:v(),center:bo,radius:ut,start_angle_degrees:Gd,end_angle_degrees:Gd,direction:Ze(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:ut.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled arc on the schematic"),wee=xA({type:QA("schematic_trace"),schematic_trace_id:v(),source_trace_id:v().optional(),junctions:fe(xA({x:MA(),y:MA()})),edges:fe(xA({from:xA({x:MA(),y:MA()}),to:xA({x:MA(),y:MA()}),is_crossing:te().optional(),from_schematic_port_id:v().optional(),to_schematic_port_id:v().optional()})),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),iUt=Ze(["center","left","right","top","bottom"]),Dee=xA({type:QA("schematic_text"),schematic_component_id:v().optional(),schematic_text_id:v(),text:v(),font_size:MA().default(.18),position:xA({x:ut,y:ut}),rotation:MA().default(0),anchor:Wt([iUt.describe("legacy"),qx]).default("center"),color:v().default("#000000"),subcircuit_id:v().optional()}),See=xA({type:QA("schematic_port"),schematic_port_id:v(),source_port_id:v(),schematic_component_id:v().optional(),center:bo,facing_direction:Ze(["up","down","left","right"]).optional(),distance_from_component_edge:MA().optional(),side_of_component:Ze(["top","bottom","left","right"]).optional(),true_ccw_index:MA().optional(),pin_number:MA().optional(),display_pin_label:v().optional(),subcircuit_id:v().optional(),is_connected:te().optional(),has_input_arrow:te().optional(),has_output_arrow:te().optional()}).describe("Defines a port on a schematic component"),bee=xA({type:QA("schematic_net_label"),schematic_net_label_id:zt("schematic_net_label"),schematic_trace_id:v().optional(),source_trace_id:v().optional(),source_net_id:v(),center:bo,anchor_position:bo.optional(),anchor_side:Ze(["top","bottom","left","right"]),text:v(),symbol_name:v().optional(),is_movable:te().optional(),subcircuit_id:v().optional()}),xee=xA({type:QA("schematic_error"),schematic_error_id:v(),error_type:QA("schematic_port_not_found").default("schematic_port_not_found"),message:v(),subcircuit_id:v().optional()}).describe("Defines a schematic error on the schematic"),kee=xA({type:QA("schematic_layout_error"),schematic_layout_error_id:zt("schematic_layout_error"),error_type:QA("schematic_layout_error").default("schematic_layout_error"),message:v(),source_group_id:v(),schematic_group_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when schematic layout fails for a group"),fW=xA({type:QA("schematic_debug_object"),label:v().optional(),subcircuit_id:v().optional()}),Gee=fW.extend({shape:QA("rect"),center:bo,size:DEA}),Fee=fW.extend({shape:QA("line"),start:bo,end:bo}),_ee=fW.extend({shape:QA("point"),center:bo}),Ree=nE("shape",[Gee,Fee,_ee]),Nee=xA({type:QA("schematic_voltage_probe"),schematic_voltage_probe_id:v(),source_component_id:v().optional(),name:v().optional(),position:bo,schematic_trace_id:v(),voltage:QF.optional(),subcircuit_id:v().optional(),color:v().optional(),label_alignment:qx.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),Mee=xA({type:QA("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:zt("schematic_manual_edit_conflict_warning"),warning_type:QA("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:v(),schematic_component_id:v(),schematic_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),vee=xA({type:QA("schematic_group"),schematic_group_id:zt("schematic_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:Pi,height:Pi,center:bo,schematic_component_ids:fe(v()),show_as_schematic_box:te().optional(),name:v().optional(),description:v().optional()}).describe("Defines a group of components on the schematic"),Uee=xA({type:QA("schematic_table"),schematic_table_id:zt("schematic_table"),anchor_position:bo,column_widths:fe(ut),row_heights:fe(ut),cell_padding:ut.optional(),border_width:ut.optional(),subcircuit_id:v().optional(),schematic_component_id:v().optional(),anchor:qx.optional()}).describe("Defines a table on the schematic"),Lee=xA({type:QA("schematic_table_cell"),schematic_table_cell_id:zt("schematic_table_cell"),schematic_table_id:v(),start_row_index:MA(),end_row_index:MA(),start_column_index:MA(),end_column_index:MA(),text:v().optional(),center:bo,width:ut,height:ut,horizontal_align:Ze(["left","center","right"]).optional(),vertical_align:Ze(["top","middle","bottom"]).optional(),font_size:ut.optional(),subcircuit_id:v().optional()}).describe("Defines a cell within a schematic_table"),Hee=xA({type:QA("schematic_sheet"),schematic_sheet_id:zt("schematic_sheet"),name:v().optional(),subcircuit_id:v().optional()}).describe("Defines a schematic sheet or page that components can be placed on"),Yee=xA({x:ut,y:ut,bulge:MA().optional()}),OEA=xA({vertices:fe(Yee)}),Jee=xA({outer_ring:OEA,inner_rings:fe(OEA).default([])}),Tee=xA({x:ut,y:ut,via:te().optional(),via_to_layer:xr.optional()}),oUt=fe(Tee),Kee=xA({x:ut,y:ut,via:te().optional(),to_layer:xr.optional(),trace_width:ut.optional()}),qee=xA({type:QA("pcb_component"),pcb_component_id:zt("pcb_component"),source_component_id:v(),center:bo,layer:xr,rotation:Gd,display_offset_x:v().optional().describe("How to display the x offset for this part, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this part, usually corresponding with how the user specified it"),width:Pi,height:Pi,do_not_place:te().optional(),subcircuit_id:v().optional(),pcb_group_id:v().optional(),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),obstructs_within_bounds:te().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"),Pee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("circle"),hole_diameter:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),nUt=Pee.describe("Defines a circular hole on the PCB"),Oee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("rect"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),sUt=Oee.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),Wee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:Ze(["circle","square"]),hole_diameter:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),rUt=Wee.describe("Defines a circular or square hole on the PCB"),Zee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("oval"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),aUt=Zee.describe("Defines an oval hole on the PCB"),Vee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("pill"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),gUt=Vee.describe("Defines a pill-shaped hole on the PCB"),jee=xA({type:QA("pcb_hole"),pcb_hole_id:zt("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("rotated_pill"),hole_width:MA(),hole_height:MA(),x:ut,y:ut,ccw_rotation:Gd,is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),IUt=jee.describe("Defines a rotated pill-shaped hole on the PCB"),zee=Wee.or(Zee).or(Vee).or(jee).or(Pee).or(Oee),cUt=xA({type:QA("pcb_plated_hole"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_diameter:MA(),hole_diameter:MA(),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),BUt=xA({type:QA("pcb_plated_hole"),shape:Ze(["oval","pill"]),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_width:MA(),outer_height:MA(),hole_width:MA(),hole_height:MA(),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,ccw_rotation:Gd,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),lUt=xA({type:QA("pcb_plated_hole"),shape:QA("circular_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("circle"),pad_shape:QA("rect"),hole_diameter:MA(),rect_pad_width:MA(),rect_pad_height:MA(),rect_border_radius:MA().optional(),hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),CUt=xA({type:QA("pcb_plated_hole"),shape:QA("pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("pill"),pad_shape:QA("rect"),hole_width:MA(),hole_height:MA(),rect_pad_width:MA(),rect_pad_height:MA(),rect_border_radius:MA().optional(),hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),QUt=xA({type:QA("pcb_plated_hole"),shape:QA("rotated_pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("rotated_pill"),pad_shape:QA("rect"),hole_width:MA(),hole_height:MA(),hole_ccw_rotation:Gd,rect_pad_width:MA(),rect_pad_height:MA(),rect_border_radius:MA().optional(),rect_ccw_rotation:Gd,hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),EUt=xA({type:QA("pcb_plated_hole"),shape:QA("hole_with_polygon_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:Ze(["circle","oval","pill","rotated_pill"]),hole_diameter:MA().optional(),hole_width:MA().optional(),hole_height:MA().optional(),pad_outline:fe(xA({x:ut,y:ut})).min(3),hole_offset_x:ut.default(0),hole_offset_y:ut.default(0),is_covered_with_solder_mask:te().optional(),x:ut,y:ut,layers:fe(xr),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:zt("pcb_plated_hole"),soldermask_margin:MA().optional()}),Xee=Wt([cUt,BUt,lUt,CUt,QUt,EUt]),$ee=xA({type:QA("pcb_port"),pcb_port_id:zt("pcb_port"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_port_id:v(),pcb_component_id:v().optional(),x:ut,y:ut,layers:fe(xr),is_board_pinout:te().optional()}).describe("Defines a port on the PCB"),hUt=xA({type:QA("pcb_smtpad"),shape:QA("circle"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,radius:MA(),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),uUt=xA({type:QA("pcb_smtpad"),shape:QA("rect"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),rect_border_radius:MA().optional(),corner_radius:MA().optional(),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),dUt=xA({type:QA("pcb_smtpad"),shape:QA("rotated_rect"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),rect_border_radius:MA().optional(),corner_radius:MA().optional(),ccw_rotation:Gd,layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),Ate=xA({type:QA("pcb_smtpad"),shape:QA("pill"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),radius:MA(),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),pUt=xA({type:QA("pcb_smtpad"),shape:QA("rotated_pill"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),radius:MA(),ccw_rotation:Gd,layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),fUt=xA({type:QA("pcb_smtpad"),shape:QA("polygon"),pcb_smtpad_id:zt("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),points:fe(bo),layer:xr,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:MA().optional()}),ete=nE("shape",[hUt,uUt,dUt,pUt,Ate,fUt]).describe("Defines an SMT pad on the PCB"),yUt=xA({type:QA("pcb_solder_paste"),shape:QA("circle"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,radius:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),mUt=xA({type:QA("pcb_solder_paste"),shape:QA("rect"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),wUt=xA({type:QA("pcb_solder_paste"),shape:QA("pill"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),radius:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),DUt=xA({type:QA("pcb_solder_paste"),shape:QA("rotated_rect"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),ccw_rotation:ut,layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),SUt=xA({type:QA("pcb_solder_paste"),shape:QA("oval"),pcb_solder_paste_id:zt("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ut,y:ut,width:MA(),height:MA(),layer:xr,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),tte=Wt([yUt,mUt,wUt,DUt,SUt]).describe("Defines solderpaste on the PCB"),ite=xA({type:QA("pcb_text"),pcb_text_id:zt("pcb_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),text:v(),center:bo,layer:xr,width:Pi,height:Pi,lines:MA(),align:Ze(["bottom-left"])}).describe("Defines text on the PCB"),ote=xA({route_type:QA("wire"),x:ut,y:ut,width:ut,start_pcb_port_id:v().optional(),end_pcb_port_id:v().optional(),layer:xr}),nte=xA({route_type:QA("via"),x:ut,y:ut,hole_diameter:ut.optional(),outer_diameter:ut.optional(),from_layer:v(),to_layer:v()}),ste=Wt([ote,nte]),rte=xA({type:QA("pcb_trace"),source_trace_id:v().optional(),pcb_component_id:v().optional(),pcb_trace_id:zt("pcb_trace"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),route_thickness_mode:Ze(["constant","interpolated"]).default("constant").optional(),route_order_index:MA().optional(),should_round_corners:te().optional(),trace_length:MA().optional(),highlight_color:v().optional(),route:fe(ste)}).describe("Defines a trace on the PCB"),ate=xA({type:QA("pcb_trace_error"),pcb_trace_error_id:zt("pcb_trace_error"),error_type:QA("pcb_trace_error").default("pcb_trace_error"),message:v(),center:bo.optional(),pcb_trace_id:v(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB"),gte=xA({type:QA("pcb_trace_missing_error"),pcb_trace_missing_error_id:zt("pcb_trace_missing_error"),error_type:QA("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:v(),center:bo.optional(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),Ite=xA({type:QA("pcb_port_not_matched_error"),pcb_error_id:zt("pcb_error"),error_type:QA("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:v(),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),cte=xA({type:QA("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:zt("pcb_port_not_connected_error"),error_type:QA("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:v(),pcb_port_ids:fe(v()),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),Bte=xA({type:QA("pcb_net"),pcb_net_id:zt("pcb_net"),source_net_id:v().optional(),highlight_color:v().optional()}).describe("Defines a net on the PCB"),lte=xA({type:QA("pcb_via"),pcb_via_id:zt("pcb_via"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),x:ut,y:ut,outer_diameter:ut.default("0.6mm"),hole_diameter:ut.default("0.25mm"),from_layer:xr.optional(),to_layer:xr.optional(),layers:fe(xr),pcb_trace_id:v().optional(),net_is_assignable:te().optional(),net_assigned:te().optional(),is_tented:te().optional()}).describe("Defines a via on the PCB"),Cte=xA({type:QA("pcb_board"),pcb_board_id:zt("pcb_board"),pcb_panel_id:v().optional(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:Pi.optional(),height:Pi.optional(),center:bo,display_offset_x:v().optional().describe("How to display the x offset for this board, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this board, usually corresponding with how the user specified it"),thickness:Pi.optional().default(1.4),num_layers:MA().optional().default(4),outline:fe(bo).optional(),shape:Ze(["rect","polygon"]).optional(),material:Ze(["fr4","fr1"]).default("fr4"),anchor_position:bo.optional(),anchor_alignment:qx.optional(),position_mode:Ze(["relative_to_panel_anchor","none"]).optional()}).describe("Defines the board outline of the PCB"),Qte=xA({type:QA("pcb_panel"),pcb_panel_id:zt("pcb_panel"),width:Pi,height:Pi,center:bo,covered_with_solder_mask:te().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards"),Ete=xA({type:QA("pcb_placement_error"),pcb_placement_error_id:zt("pcb_placement_error"),error_type:QA("pcb_placement_error").default("pcb_placement_error"),message:v(),subcircuit_id:v().optional()}).describe("Defines a placement error on the PCB"),hte=xA({type:QA("pcb_trace_hint"),pcb_trace_hint_id:zt("pcb_trace_hint"),pcb_port_id:v(),pcb_component_id:v(),route:fe(Kee),subcircuit_id:v().optional()}).describe("A hint that can be used during generation of a PCB trace"),ute=xA({type:QA("pcb_silkscreen_line"),pcb_silkscreen_line_id:zt("pcb_silkscreen_line"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),stroke_width:ut.default("0.1mm"),x1:ut,y1:ut,x2:ut,y2:ut,layer:Um}).describe("Defines a silkscreen line on the PCB"),dte=xA({type:QA("pcb_silkscreen_path"),pcb_silkscreen_path_id:zt("pcb_silkscreen_path"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,route:fe(bo),stroke_width:Pi}).describe("Defines a silkscreen path on the PCB"),pte=xA({type:QA("pcb_silkscreen_text"),pcb_silkscreen_text_id:zt("pcb_silkscreen_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:Pi,top:Pi,bottom:Pi,right:Pi}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:MA().optional(),layer:xr,is_mirrored:te().default(!1).optional(),anchor_position:bo.default({x:0,y:0}),anchor_alignment:qx.default("center")}).describe("Defines silkscreen text on the PCB"),fte=xA({type:QA("pcb_copper_text"),pcb_copper_text_id:zt("pcb_copper_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:Pi,top:Pi,bottom:Pi,right:Pi}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:MA().optional(),layer:xr,is_mirrored:te().default(!1).optional(),anchor_position:bo.default({x:0,y:0}),anchor_alignment:qx.default("center")}).describe("Defines copper text on the PCB"),yte=xA({type:QA("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:zt("pcb_silkscreen_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:xr,stroke_width:Pi.default("1mm"),corner_radius:Pi.optional(),is_filled:te().default(!0).optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional()}).describe("Defines a silkscreen rect on the PCB"),mte=xA({type:QA("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:zt("pcb_silkscreen_circle"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,radius:Pi,layer:Um,stroke_width:Pi.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),wte=xA({type:QA("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:zt("pcb_silkscreen_oval"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,radius_x:ut,radius_y:ut,layer:Um}).describe("Defines a silkscreen oval on the PCB"),Dte=xA({type:QA("pcb_silkscreen_pill"),pcb_silkscreen_pill_id:zt("pcb_silkscreen_pill"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:xr}).describe("Defines a silkscreen pill on the PCB"),Ste=xA({type:QA("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:zt("pcb_fabrication_note_text"),subcircuit_id:v().optional(),pcb_group_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("1mm"),pcb_component_id:v(),text:v(),layer:Um,anchor_position:bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),bte=xA({type:QA("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:zt("pcb_fabrication_note_path"),pcb_component_id:v(),subcircuit_id:v().optional(),layer:xr,route:fe(bo),stroke_width:Pi,color:v().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),xte=xA({type:QA("pcb_fabrication_note_rect"),pcb_fabrication_note_rect_id:zt("pcb_fabrication_note_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:Um,stroke_width:Pi.default("0.1mm"),corner_radius:Pi.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a fabrication note rectangle on the PCB"),kte=xA({type:QA("pcb_fabrication_note_dimension"),pcb_fabrication_note_dimension_id:zt("pcb_fabrication_note_dimension"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,from:bo,to:bo,text:v().optional(),text_ccw_rotation:MA().optional(),offset:Pi.optional(),offset_distance:Pi.optional(),offset_direction:xA({x:MA(),y:MA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:Pi.default("1mm"),color:v().optional(),arrow_size:Pi.default("1mm")}).describe("Defines a measurement annotation within PCB fabrication notes"),Gte=xA({type:QA("pcb_note_text"),pcb_note_text_id:zt("pcb_note_text"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ut.default("1mm"),text:v().optional(),anchor_position:bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a documentation note in text on the PCB"),Fte=xA({type:QA("pcb_note_rect"),pcb_note_rect_id:zt("pcb_note_rect"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),center:bo,width:Pi,height:Pi,stroke_width:Pi.default("0.1mm"),corner_radius:Pi.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a rectangular documentation note on the PCB"),_te=xA({type:QA("pcb_note_path"),pcb_note_path_id:zt("pcb_note_path"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),route:fe(bo),stroke_width:Pi.default("0.1mm"),color:v().optional()}).describe("Defines a polyline documentation note on the PCB"),Rte=xA({type:QA("pcb_note_line"),pcb_note_line_id:zt("pcb_note_line"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),x1:ut,y1:ut,x2:ut,y2:ut,stroke_width:ut.default("0.1mm"),color:v().optional(),is_dashed:te().optional()}).describe("Defines a straight documentation note line on the PCB"),Nte=xA({type:QA("pcb_note_dimension"),pcb_note_dimension_id:zt("pcb_note_dimension"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),from:bo,to:bo,text:v().optional(),text_ccw_rotation:MA().optional(),offset_distance:Pi.optional(),offset_direction:xA({x:MA(),y:MA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:Pi.default("1mm"),color:v().optional(),arrow_size:Pi.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes"),Mte=xA({type:QA("pcb_footprint_overlap_error"),pcb_error_id:zt("pcb_error"),error_type:QA("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:v(),pcb_smtpad_ids:fe(v()).optional(),pcb_plated_hole_ids:fe(v()).optional(),pcb_hole_ids:fe(v()).optional(),pcb_keepout_ids:fe(v()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),vte=xA({type:QA("pcb_keepout"),shape:QA("rect"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:ut,height:ut,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()}).or(xA({type:QA("pcb_keepout"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,radius:ut,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()})),yW=xA({type:QA("pcb_cutout"),pcb_cutout_id:zt("pcb_cutout"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_board_id:v().optional(),pcb_panel_id:v().optional()}),Ute=yW.extend({shape:QA("rect"),center:bo,width:Pi,height:Pi,rotation:Gd.optional(),corner_radius:Pi.optional()}),Lte=yW.extend({shape:QA("circle"),center:bo,radius:Pi}),Hte=yW.extend({shape:QA("polygon"),points:fe(bo)}),Yte=yW.extend({shape:QA("path"),route:fe(bo),slot_width:Pi,slot_length:Pi.optional(),space_between_slots:Pi.optional(),slot_corner_radius:Pi.optional()}),Jte=nE("shape",[Ute,Lte,Hte,Yte]).describe("Defines a cutout on the PCB, removing board material."),Tte=xA({type:QA("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:zt("pcb_missing_footprint_error"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:v(),message:v()}).describe("Defines a missing footprint error on the PCB"),Kte=xA({type:QA("external_footprint_load_error"),external_footprint_load_error_id:zt("external_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),error_type:QA("external_footprint_load_error").default("external_footprint_load_error"),message:v()}).describe("Defines an error when an external footprint fails to load"),qte=xA({type:QA("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:zt("circuit_json_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),message:v(),circuit_json:fe(Kg()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),Pte=xA({type:QA("pcb_group"),pcb_group_id:zt("pcb_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:Pi.optional(),height:Pi.optional(),center:bo,display_offset_x:v().optional().describe("How to display the x offset for this group, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this group, usually corresponding with how the user specified it"),outline:fe(bo).optional(),anchor_position:bo.optional(),anchor_alignment:qx.default("center"),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),pcb_component_ids:fe(v()),child_layout_mode:Ze(["packed","none"]).optional(),name:v().optional(),description:v().optional(),layout_mode:v().optional(),autorouter_configuration:xA({trace_clearance:Pi}).optional(),autorouter_used_string:v().optional()}).describe("Defines a group of components on the PCB"),Ote=xA({type:QA("pcb_autorouting_error"),pcb_error_id:zt("pcb_autorouting_error"),error_type:QA("pcb_autorouting_error").default("pcb_autorouting_error"),message:v(),subcircuit_id:v().optional()}).describe("The autorouting has failed to route a portion of the board"),Wte=xA({type:QA("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:zt("pcb_manual_edit_conflict_warning"),warning_type:QA("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:v(),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),Zte=xA({type:QA("pcb_breakout_point"),pcb_breakout_point_id:zt("pcb_breakout_point"),pcb_group_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional(),source_port_id:v().optional(),source_net_id:v().optional(),x:ut,y:ut}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),Vte=xA({type:QA("pcb_ground_plane"),pcb_ground_plane_id:zt("pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_net_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional()}).describe("Defines a ground plane on the PCB"),jte=xA({type:QA("pcb_ground_plane_region"),pcb_ground_plane_region_id:zt("pcb_ground_plane_region"),pcb_ground_plane_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:xr,points:fe(bo)}).describe("Defines a polygon region of a ground plane"),zte=xA({type:QA("pcb_thermal_spoke"),pcb_thermal_spoke_id:zt("pcb_thermal_spoke"),pcb_ground_plane_id:v(),shape:v(),spoke_count:MA(),spoke_thickness:ut,spoke_inner_diameter:ut,spoke_outer_diameter:ut,pcb_plated_hole_id:v().optional(),subcircuit_id:v().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),WEA=xA({type:QA("pcb_copper_pour"),pcb_copper_pour_id:zt("pcb_copper_pour"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:xr,source_net_id:v().optional(),covered_with_solder_mask:te().optional().default(!0)}),Xte=WEA.extend({shape:QA("rect"),center:bo,width:Pi,height:Pi,rotation:Gd.optional()}),$te=WEA.extend({shape:QA("brep"),brep_shape:Jee}),Aie=WEA.extend({shape:QA("polygon"),points:fe(bo)}),eie=nE("shape",[Xte,$te,Aie]).describe("Defines a copper pour on the PCB."),tie=xA({type:QA("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:zt("pcb_component_outside_board_error"),error_type:QA("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),message:v(),pcb_component_id:v(),pcb_board_id:v(),component_center:bo,component_bounds:xA({min_x:MA(),max_x:MA(),min_y:MA(),max_y:MA()}),subcircuit_id:v().optional(),source_component_id:v().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),iie=xA({type:QA("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:zt("pcb_component_invalid_layer_error"),error_type:QA("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),message:v(),pcb_component_id:v().optional(),source_component_id:v(),layer:xr,subcircuit_id:v().optional()}).describe("Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)"),oie=xA({type:QA("pcb_via_clearance_error"),pcb_error_id:zt("pcb_error"),error_type:QA("pcb_via_clearance_error").default("pcb_via_clearance_error"),message:v(),pcb_via_ids:fe(v()).min(2),minimum_clearance:ut.optional(),actual_clearance:ut.optional(),pcb_center:xA({x:MA().optional(),y:MA().optional()}).optional(),subcircuit_id:v().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),nie=xA({type:QA("pcb_courtyard_rect"),pcb_courtyard_rect_id:zt("pcb_courtyard_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:bo,width:Pi,height:Pi,layer:Um,color:v().optional()}).describe("Defines a courtyard rectangle on the PCB"),sie=xA({type:QA("pcb_courtyard_outline"),pcb_courtyard_outline_id:zt("pcb_courtyard_outline"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,outline:fe(bo).min(2),stroke_width:Pi.default("0.1mm"),is_closed:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a courtyard outline on the PCB"),rie=xA({type:QA("pcb_courtyard_polygon"),pcb_courtyard_polygon_id:zt("pcb_courtyard_polygon"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:Um,points:fe(bo).min(3),color:v().optional()}).describe("Defines a courtyard polygon on the PCB"),aie=xA({type:QA("cad_component"),cad_component_id:v(),pcb_component_id:v(),source_component_id:v(),position:pH,rotation:pH.optional(),size:pH.optional(),layer:xr.optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),model_obj_url:v().optional(),model_stl_url:v().optional(),model_3mf_url:v().optional(),model_gltf_url:v().optional(),model_glb_url:v().optional(),model_step_url:v().optional(),model_wrl_url:v().optional(),model_unit_to_mm_scale_factor:MA().optional(),model_jscad:Kg().optional(),show_as_translucent_model:te().optional()}).describe("Defines a component on the PCB"),ZEA=Ze(["sinewave","square","triangle","sawtooth"]),bUt=Wt([v(),MA()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(MA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),gie=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:zt("simulation_voltage_source"),is_dc_source:QA(!0).optional().default(!0),positive_source_port_id:v().optional(),negative_source_port_id:v().optional(),positive_source_net_id:v().optional(),negative_source_net_id:v().optional(),voltage:QF}).describe("Defines a DC voltage source for simulation"),Iie=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:zt("simulation_voltage_source"),is_dc_source:QA(!1),terminal1_source_port_id:v().optional(),terminal2_source_port_id:v().optional(),terminal1_source_net_id:v().optional(),terminal2_source_net_id:v().optional(),voltage:QF.optional(),frequency:uH.optional(),peak_to_peak_voltage:QF.optional(),wave_shape:ZEA.optional(),phase:Gd.optional(),duty_cycle:bUt.optional()}).describe("Defines an AC voltage source for simulation"),cie=Wt([gie,Iie]).describe("Defines a voltage source for simulation"),xUt=Wt([v(),MA()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(MA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),Bie=xA({type:QA("simulation_current_source"),simulation_current_source_id:zt("simulation_current_source"),is_dc_source:QA(!0).optional().default(!0),positive_source_port_id:v().optional(),negative_source_port_id:v().optional(),positive_source_net_id:v().optional(),negative_source_net_id:v().optional(),current:dW}).describe("Defines a DC current source for simulation"),lie=xA({type:QA("simulation_current_source"),simulation_current_source_id:zt("simulation_current_source"),is_dc_source:QA(!1),terminal1_source_port_id:v().optional(),terminal2_source_port_id:v().optional(),terminal1_source_net_id:v().optional(),terminal2_source_net_id:v().optional(),current:dW.optional(),frequency:uH.optional(),peak_to_peak_current:dW.optional(),wave_shape:ZEA.optional(),phase:Gd.optional(),duty_cycle:xUt.optional()}).describe("Defines an AC current source for simulation"),Cie=Wt([Bie,lie]).describe("Defines a current source for simulation"),Qie=Wt([QA("spice_dc_sweep"),QA("spice_dc_operating_point"),QA("spice_transient_analysis"),QA("spice_ac_analysis")]),Eie=xA({type:QA("simulation_experiment"),simulation_experiment_id:zt("simulation_experiment"),name:v(),experiment_type:Qie,time_per_step:dH.optional(),start_time_ms:EF.optional(),end_time_ms:EF.optional()}).describe("Defines a simulation experiment configuration"),hie=xA({type:QA("simulation_transient_voltage_graph"),simulation_transient_voltage_graph_id:zt("simulation_transient_voltage_graph"),simulation_experiment_id:v(),timestamps_ms:fe(MA()).optional(),voltage_levels:fe(MA()),source_component_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),time_per_step:dH,start_time_ms:EF,end_time_ms:EF,name:v().optional(),color:v().optional()}).describe("Stores voltage measurements over time for a simulation"),uie=xA({type:QA("simulation_switch"),simulation_switch_id:zt("simulation_switch"),source_component_id:v().optional(),closes_at:EF.optional(),opens_at:EF.optional(),starts_closed:te().optional(),switching_frequency:uH.optional()}).describe("Defines a switch for simulation timing control"),die=xA({type:QA("simulation_voltage_probe"),simulation_voltage_probe_id:zt("simulation_voltage_probe"),source_component_id:v().optional(),name:v().optional(),signal_input_source_port_id:v().optional(),signal_input_source_net_id:v().optional(),reference_input_source_port_id:v().optional(),reference_input_source_net_id:v().optional(),subcircuit_id:v().optional(),color:v().optional()}).describe("Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.").superRefine((t,A)=>{if(t.reference_input_source_port_id||t.reference_input_source_net_id){const i=!!t.signal_input_source_port_id||!!t.reference_input_source_port_id,o=!!t.signal_input_source_net_id||!!t.reference_input_source_net_id;i&&o?A.addIssue({code:Zt.custom,message:"Cannot mix port and net connections in a differential probe."}):i?(!t.signal_input_source_port_id||!t.reference_input_source_port_id)&&A.addIssue({code:Zt.custom,message:"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."}):o&&(!t.signal_input_source_net_id||!t.reference_input_source_net_id)&&A.addIssue({code:Zt.custom,message:"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."})}else!!t.signal_input_source_port_id==!!t.signal_input_source_net_id&&A.addIssue({code:Zt.custom,message:"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."})}),pie=xA({type:QA("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:zt("simulation_unknown_experiment_error"),error_type:QA("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),message:v(),simulation_experiment_id:v().optional(),subcircuit_id:v().optional()}).describe("An unknown error occurred during the simulation experiment."),fie=Wt([oee,tee,iee,eee,see,nee,kEA,SEA,pW,xEA,bEA,GEA,FEA,_EA,MEA,vEA,UEA,JEA,LEA,HEA,YEA,NEA,REA,aee,Iee,ree,TEA,KEA,qEA,cee,Bee,qee,zee,Tte,Kte,qte,Wte,Xee,vte,$ee,Bte,ite,rte,lte,ete,tte,Cte,Qte,Pte,hte,ute,dte,pte,Dte,fte,yte,mte,wte,ate,gte,Ete,Ite,cte,oie,bte,Ste,xte,kte,Gte,Fte,_te,Rte,Nte,Ote,Mte,Zte,Jte,Vte,jte,zte,eie,tie,iie,nie,sie,rie,lee,Dee,pee,fee,yee,mee,dee,See,wee,Cee,xee,kee,bee,Ree,Nee,Mee,vee,Hee,Uee,Lee,aie,cie,Cie,Eie,hie,uie,die,pie]),VEA=fie;const yie=Object.freeze(Object.defineProperty({__proto__:null,all_layers:gee,any_circuit_element:fie,any_soup_element:VEA,any_source_component:eee,battery_capacity:PAe,brep_shape:Jee,cad_component:aie,capacitance:wEA,circuit_json_footprint_load_error:qte,current:dW,distance:ut,duration_ms:dH,experiment_type:Qie,external_footprint_load_error:Kte,frequency:uH,getZodPrefixedIdWithDefault:zt,inductance:KAe,layer_ref:xr,layer_string:PEA,length:Pi,ms:EF,ninePointAnchor:qx,pcb_autorouting_error:Ote,pcb_board:Cte,pcb_breakout_point:Zte,pcb_component:qee,pcb_component_invalid_layer_error:iie,pcb_component_outside_board_error:tie,pcb_copper_pour:eie,pcb_copper_pour_brep:$te,pcb_copper_pour_polygon:Aie,pcb_copper_pour_rect:Xte,pcb_copper_text:fte,pcb_courtyard_outline:sie,pcb_courtyard_polygon:rie,pcb_courtyard_rect:nie,pcb_cutout:Jte,pcb_cutout_circle:Lte,pcb_cutout_path:Yte,pcb_cutout_polygon:Hte,pcb_cutout_rect:Ute,pcb_fabrication_note_dimension:kte,pcb_fabrication_note_path:bte,pcb_fabrication_note_rect:xte,pcb_fabrication_note_text:Ste,pcb_footprint_overlap_error:Mte,pcb_ground_plane:Vte,pcb_ground_plane_region:jte,pcb_group:Pte,pcb_hole:zee,pcb_hole_circle_or_square_shape:rUt,pcb_hole_circle_shape:nUt,pcb_hole_oval_shape:aUt,pcb_hole_pill_shape:gUt,pcb_hole_rect_shape:sUt,pcb_hole_rotated_pill_shape:IUt,pcb_keepout:vte,pcb_manual_edit_conflict_warning:Wte,pcb_missing_footprint_error:Tte,pcb_net:Bte,pcb_note_dimension:Nte,pcb_note_line:Rte,pcb_note_path:_te,pcb_note_rect:Fte,pcb_note_text:Gte,pcb_panel:Qte,pcb_placement_error:Ete,pcb_plated_hole:Xee,pcb_port:$ee,pcb_port_not_connected_error:cte,pcb_port_not_matched_error:Ite,pcb_route_hint:Tee,pcb_route_hints:oUt,pcb_silkscreen_circle:mte,pcb_silkscreen_line:ute,pcb_silkscreen_oval:wte,pcb_silkscreen_path:dte,pcb_silkscreen_pill:Dte,pcb_silkscreen_rect:yte,pcb_silkscreen_text:pte,pcb_smtpad:ete,pcb_smtpad_pill:Ate,pcb_solder_paste:tte,pcb_text:ite,pcb_thermal_spoke:zte,pcb_trace:rte,pcb_trace_error:ate,pcb_trace_hint:hte,pcb_trace_missing_error:gte,pcb_trace_route_point:ste,pcb_trace_route_point_via:nte,pcb_trace_route_point_wire:ote,pcb_via:lte,pcb_via_clearance_error:oie,point:bo,point3:pH,point_with_bulge:Yee,port_arrangement:uee,position:$2t,position3:AUt,resistance:uW,ring:OEA,rotation:Gd,route_hint_point:Kee,schematic_arc:mee,schematic_box:lee,schematic_circle:yee,schematic_component:dee,schematic_component_port_arrangement_by_sides:hee,schematic_component_port_arrangement_by_size:Eee,schematic_debug_line:Fee,schematic_debug_object:Ree,schematic_debug_object_base:fW,schematic_debug_point:_ee,schematic_debug_rect:Gee,schematic_error:xee,schematic_group:vee,schematic_layout_error:kee,schematic_line:pee,schematic_manual_edit_conflict_warning:Mee,schematic_net_label:bee,schematic_path:Cee,schematic_pin_styles:Qee,schematic_port:See,schematic_rect:fee,schematic_sheet:Hee,schematic_table:Uee,schematic_table_cell:Lee,schematic_text:Dee,schematic_trace:wee,schematic_voltage_probe:Nee,simulation_ac_current_source:lie,simulation_ac_voltage_source:Iie,simulation_current_source:Cie,simulation_dc_current_source:Bie,simulation_dc_voltage_source:gie,simulation_experiment:Eie,simulation_switch:uie,simulation_transient_voltage_graph:hie,simulation_unknown_experiment_error:pie,simulation_voltage_probe:die,simulation_voltage_source:cie,size:DEA,source_board:ree,source_component_base:bB,source_component_internal_connection:iee,source_failed_to_create_component_error:zAe,source_group:nee,source_interconnect:Aee,source_manually_placed_via:Iee,source_missing_property_error:jAe,source_net:see,source_pcb_ground_plane:aee,source_pin_missing_trace_warning:qEA,source_pin_must_be_connected_error:cee,source_port:tee,source_project_metadata:TEA,source_property_ignored_warning:XAe,source_simple_battery:FEA,source_simple_capacitor:SEA,source_simple_chip:kEA,source_simple_crystal:VAe,source_simple_diode:pW,source_simple_fiducial:WAe,source_simple_ground:ZAe,source_simple_inductor:_EA,source_simple_led:xEA,source_simple_mosfet:YEA,source_simple_pin_header:MEA,source_simple_pinout:vEA,source_simple_potentiometer:NEA,source_simple_power_source:GEA,source_simple_push_button:REA,source_simple_resistor:bEA,source_simple_resonator:UEA,source_simple_switch:JEA,source_simple_test_point:HEA,source_simple_transistor:LEA,source_simple_voltage_probe:$Ae,source_trace:oee,source_trace_not_connected_error:KEA,supplier_name:OAe,time:X2t,timestamp:qAe,unknown_error_finding_part:Bee,visible_layer:Um,voltage:QF,wave_shape:ZEA},Symbol.toStringTag,{value:"Module"})),fH=t=>typeof t=="number"&&!isNaN(t),hF=t=>typeof t=="string",B0=t=>typeof t=="function",mW=t=>hF(t)||B0(t)?t:null,jEA=t=>z.isValidElement(t)||hF(t)||B0(t)||fH(t);function kUt(t,A,e){e===void 0&&(e=300);const{scrollHeight:i,style:o}=t;requestAnimationFrame(()=>{o.minHeight="initial",o.height=i+"px",o.transition=`all ${e}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(A,e)})})}function wW(t){let{enter:A,exit:e,appendPosition:i=!1,collapse:o=!0,collapseDuration:n=300}=t;return function(s){let{children:r,position:a,preventExitTransition:g,done:I,nodeRef:c,isIn:B,playToast:l}=s;const C=i?`${A}--${a}`:A,Q=i?`${e}--${a}`:e,E=z.useRef(0);return z.useLayoutEffect(()=>{const h=c.current,u=C.split(" "),d=f=>{f.target===c.current&&(l(),h.removeEventListener("animationend",d),h.removeEventListener("animationcancel",d),E.current===0&&f.type!=="animationcancel"&&h.classList.remove(...u))};h.classList.add(...u),h.addEventListener("animationend",d),h.addEventListener("animationcancel",d)},[]),z.useEffect(()=>{const h=c.current,u=()=>{h.removeEventListener("animationend",u),o?kUt(h,I,n):I()};B||(g?u():(E.current=1,h.className+=` ${Q}`,h.addEventListener("animationend",u)))},[B]),to.createElement(to.Fragment,null,r)}}function mie(t,A){return t!=null?{content:t.content,containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,status:A}:{}}const Fd=new Map;let yH=[];const zEA=new Set,GUt=t=>zEA.forEach(A=>A(t)),wie=()=>Fd.size>0;function Die(t,A){var e;if(A)return!((e=Fd.get(A))==null||!e.isToastActive(t));let i=!1;return Fd.forEach(o=>{o.isToastActive(t)&&(i=!0)}),i}function Sie(t,A){jEA(t)&&(wie()||yH.push({content:t,options:A}),Fd.forEach(e=>{e.buildToast(t,A)}))}function bie(t,A){Fd.forEach(e=>{A!=null&&A!=null&&A.containerId?A?.containerId===e.id&&e.toggle(t,A?.id):e.toggle(t,A?.id)})}function FUt(t){const{subscribe:A,getSnapshot:e,setProps:i}=z.useRef((function(n){const s=n.containerId||1;return{subscribe(r){const a=(function(I,c,B){let l=1,C=0,Q=[],E=[],h=[],u=c;const d=new Map,f=new Set,w=()=>{h=Array.from(d.values()),f.forEach(x=>x())},D=x=>{E=x==null?[]:E.filter(F=>F!==x),w()},S=x=>{const{toastId:F,onOpen:k,updateId:U,children:N}=x.props,Y=U==null;x.staleId&&d.delete(x.staleId),d.set(F,x),E=[...E,x.props.toastId].filter(K=>K!==x.staleId),w(),B(mie(x,Y?"added":"updated")),Y&&B0(k)&&k(z.isValidElement(N)&&N.props)};return{id:I,props:u,observe:x=>(f.add(x),()=>f.delete(x)),toggle:(x,F)=>{d.forEach(k=>{F!=null&&F!==k.props.toastId||B0(k.toggle)&&k.toggle(x)})},removeToast:D,toasts:d,clearQueue:()=>{C-=Q.length,Q=[]},buildToast:(x,F)=>{if((iA=>{let{containerId:rA,toastId:CA,updateId:pA}=iA;const kA=rA?rA!==I:I!==1,_A=d.has(CA)&&pA==null;return kA||_A})(F))return;const{toastId:k,updateId:U,data:N,staleId:Y,delay:K}=F,J=()=>{D(k)},W=U==null;W&&C++;const Z={...u,style:u.toastStyle,key:l++,...Object.fromEntries(Object.entries(F).filter(iA=>{let[rA,CA]=iA;return CA!=null})),toastId:k,updateId:U,data:N,closeToast:J,isIn:!1,className:mW(F.className||u.toastClassName),bodyClassName:mW(F.bodyClassName||u.bodyClassName),progressClassName:mW(F.progressClassName||u.progressClassName),autoClose:!F.isLoading&&(AA=F.autoClose,nA=u.autoClose,AA===!1||fH(AA)&&AA>0?AA:nA),deleteToast(){const iA=d.get(k),{onClose:rA,children:CA}=iA.props;B0(rA)&&rA(z.isValidElement(CA)&&CA.props),B(mie(iA,"removed")),d.delete(k),C--,C<0&&(C=0),Q.length>0?S(Q.shift()):w()}};var AA,nA;Z.closeButton=u.closeButton,F.closeButton===!1||jEA(F.closeButton)?Z.closeButton=F.closeButton:F.closeButton===!0&&(Z.closeButton=!jEA(u.closeButton)||u.closeButton);let cA=x;z.isValidElement(x)&&!hF(x.type)?cA=z.cloneElement(x,{closeToast:J,toastProps:Z,data:N}):B0(x)&&(cA=x({closeToast:J,toastProps:Z,data:N}));const tA={content:cA,props:Z,staleId:Y};u.limit&&u.limit>0&&C>u.limit&&W?Q.push(tA):fH(K)?setTimeout(()=>{S(tA)},K):S(tA)},setProps(x){u=x},setToggle:(x,F)=>{d.get(x).toggle=F},isToastActive:x=>E.some(F=>F===x),getSnapshot:()=>h}})(s,n,GUt);Fd.set(s,a);const g=a.observe(r);return yH.forEach(I=>Sie(I.content,I.options)),yH=[],()=>{g(),Fd.delete(s)}},setProps(r){var a;(a=Fd.get(s))==null||a.setProps(r)},getSnapshot(){var r;return(r=Fd.get(s))==null?void 0:r.getSnapshot()}}})(t)).current;i(t);const o=z.useSyncExternalStore(A,e,e);return{getToastToRender:function(n){if(!o)return[];const s=new Map;return t.newestOnTop&&o.reverse(),o.forEach(r=>{const{position:a}=r.props;s.has(a)||s.set(a,[]),s.get(a).push(r)}),Array.from(s,r=>n(r[0],r[1]))},isToastActive:Die,count:o?.length}}function _Ut(t){const[A,e]=z.useState(!1),[i,o]=z.useState(!1),n=z.useRef(null),s=z.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:r,pauseOnHover:a,closeToast:g,onClick:I,closeOnClick:c}=t;var B,l;function C(){e(!0)}function Q(){e(!1)}function E(d){const f=n.current;s.canDrag&&f&&(s.didMove=!0,A&&Q(),s.delta=t.draggableDirection==="x"?d.clientX-s.start:d.clientY-s.start,s.start!==d.clientX&&(s.canCloseOnClick=!1),f.style.transform=`translate3d(${t.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 h(){document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",h);const d=n.current;if(s.canDrag&&s.didMove&&d){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return o(!0),t.closeToast(),void t.collapseAll();d.style.transition="transform 0.2s, opacity 0.2s",d.style.removeProperty("transform"),d.style.removeProperty("opacity")}}(l=Fd.get((B={id:t.toastId,containerId:t.containerId,fn:e}).containerId||1))==null||l.setToggle(B.id,B.fn),z.useEffect(()=>{if(t.pauseOnFocusLoss)return document.hasFocus()||Q(),window.addEventListener("focus",C),window.addEventListener("blur",Q),()=>{window.removeEventListener("focus",C),window.removeEventListener("blur",Q)}},[t.pauseOnFocusLoss]);const u={onPointerDown:function(d){if(t.draggable===!0||t.draggable===d.pointerType){s.didMove=!1,document.addEventListener("pointermove",E),document.addEventListener("pointerup",h);const f=n.current;s.canCloseOnClick=!0,s.canDrag=!0,f.style.transition="none",t.draggableDirection==="x"?(s.start=d.clientX,s.removalDistance=f.offsetWidth*(t.draggablePercent/100)):(s.start=d.clientY,s.removalDistance=f.offsetHeight*(t.draggablePercent===80?1.5*t.draggablePercent:t.draggablePercent)/100)}},onPointerUp:function(d){const{top:f,bottom:w,left:D,right:S}=n.current.getBoundingClientRect();d.nativeEvent.type!=="touchend"&&t.pauseOnHover&&d.clientX>=D&&d.clientX<=S&&d.clientY>=f&&d.clientY<=w?Q():C()}};return r&&a&&(u.onMouseEnter=Q,t.stacked||(u.onMouseLeave=C)),c&&(u.onClick=d=>{I&&I(d),s.canCloseOnClick&&g()}),{playToast:C,pauseToast:Q,isRunning:A,preventExitTransition:i,toastRef:n,eventHandlers:u}}function RUt(t){let{delay:A,isRunning:e,closeToast:i,type:o="default",hide:n,className:s,style:r,controlledProgress:a,progress:g,rtl:I,isIn:c,theme:B}=t;const l=n||a&&g===0,C={...r,animationDuration:`${A}ms`,animationPlayState:e?"running":"paused"};a&&(C.transform=`scaleX(${g})`);const Q=gm("Toastify__progress-bar",a?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${B}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":I}),E=B0(s)?s({rtl:I,type:o,defaultClassName:Q}):gm(Q,s),h={[a&&g>=1?"onTransitionEnd":"onAnimationEnd"]:a&&g<1?null:()=>{c&&i()}};return to.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":l},to.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${B} Toastify__progress-bar--${o}`}),to.createElement("div",{role:"progressbar","aria-hidden":l?"true":"false","aria-label":"notification timer",className:E,style:C,...h}))}let NUt=1;const xie=()=>""+NUt++;function MUt(t){return t&&(hF(t.toastId)||fH(t.toastId))?t.toastId:xie()}function mH(t,A){return Sie(t,A),A.toastId}function DW(t,A){return{...A,type:A&&A.type||t,toastId:MUt(A)}}function SW(t){return(A,e)=>mH(A,DW(t,e))}function jg(t,A){return mH(t,DW("default",A))}jg.loading=(t,A)=>mH(t,DW("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...A})),jg.promise=function(t,A,e){let i,{pending:o,error:n,success:s}=A;o&&(i=hF(o)?jg.loading(o,e):jg.loading(o.render,{...e,...o}));const r={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},a=(I,c,B)=>{if(c==null)return void jg.dismiss(i);const l={type:I,...r,...e,data:B},C=hF(c)?{render:c}:c;return i?jg.update(i,{...l,...C}):jg(C.render,{...l,...C}),B},g=B0(t)?t():t;return g.then(I=>a("success",s,I)).catch(I=>a("error",n,I)),g},jg.success=SW("success"),jg.info=SW("info"),jg.error=SW("error"),jg.warning=SW("warning"),jg.warn=jg.warning,jg.dark=(t,A)=>mH(t,DW("default",{theme:"dark",...A})),jg.dismiss=function(t){(function(A){var e;if(wie()){if(A==null||hF(e=A)||fH(e))Fd.forEach(i=>{i.removeToast(A)});else if(A&&("containerId"in A||"id"in A)){const i=Fd.get(A.containerId);i?i.removeToast(A.id):Fd.forEach(o=>{o.removeToast(A.id)})}}else yH=yH.filter(i=>A!=null&&i.options.toastId!==A)})(t)},jg.clearWaitingQueue=function(t){t===void 0&&(t={}),Fd.forEach(A=>{!A.props.limit||t.containerId&&A.id!==t.containerId||A.clearQueue()})},jg.isActive=Die,jg.update=function(t,A){A===void 0&&(A={});const e=((i,o)=>{var n;let{containerId:s}=o;return(n=Fd.get(s||1))==null?void 0:n.toasts.get(i)})(t,A);if(e){const{props:i,content:o}=e,n={delay:100,...i,...A,toastId:A.toastId||t,updateId:xie()};n.toastId!==t&&(n.staleId=t);const s=n.render||o;delete n.render,mH(s,n)}},jg.done=t=>{jg.update(t,{progress:1})},jg.onChange=function(t){return zEA.add(t),()=>{zEA.delete(t)}},jg.play=t=>bie(!0,t),jg.pause=t=>bie(!1,t);const vUt=typeof window<"u"?z.useLayoutEffect:z.useEffect,bW=t=>{let{theme:A,type:e,isLoading:i,...o}=t;return to.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:A==="colored"?"currentColor":`var(--toastify-icon-color-${e})`,...o})},XEA={info:function(t){return to.createElement(bW,{...t},to.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(t){return to.createElement(bW,{...t},to.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(t){return to.createElement(bW,{...t},to.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(t){return to.createElement(bW,{...t},to.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 to.createElement("div",{className:"Toastify__spinner"})}},UUt=t=>{const{isRunning:A,preventExitTransition:e,toastRef:i,eventHandlers:o,playToast:n}=_Ut(t),{closeButton:s,children:r,autoClose:a,onClick:g,type:I,hideProgressBar:c,closeToast:B,transition:l,position:C,className:Q,style:E,bodyClassName:h,bodyStyle:u,progressClassName:d,progressStyle:f,updateId:w,role:D,progress:S,rtl:x,toastId:F,deleteToast:k,isIn:U,isLoading:N,closeOnClick:Y,theme:K}=t,J=gm("Toastify__toast",`Toastify__toast-theme--${K}`,`Toastify__toast--${I}`,{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":Y}),W=B0(Q)?Q({rtl:x,position:C,type:I,defaultClassName:J}):gm(J,Q),Z=(function(tA){let{theme:iA,type:rA,isLoading:CA,icon:pA}=tA,kA=null;const _A={theme:iA,type:rA};return pA===!1||(B0(pA)?kA=pA({..._A,isLoading:CA}):z.isValidElement(pA)?kA=z.cloneElement(pA,_A):CA?kA=XEA.spinner():(TA=>TA in XEA)(rA)&&(kA=XEA[rA](_A))),kA})(t),AA=!!S||!a,nA={closeToast:B,type:I,theme:K};let cA=null;return s===!1||(cA=B0(s)?s(nA):z.isValidElement(s)?z.cloneElement(s,nA):(function(tA){let{closeToast:iA,theme:rA,ariaLabel:CA="close"}=tA;return to.createElement("button",{className:`Toastify__close-button Toastify__close-button--${rA}`,type:"button",onClick:pA=>{pA.stopPropagation(),iA(pA)},"aria-label":CA},to.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},to.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"})))})(nA)),to.createElement(l,{isIn:U,done:k,position:C,preventExitTransition:e,nodeRef:i,playToast:n},to.createElement("div",{id:F,onClick:g,"data-in":U,className:W,...o,style:E,ref:i},to.createElement("div",{...U&&{role:D},className:B0(h)?h({type:I}):gm("Toastify__toast-body",h),style:u},Z!=null&&to.createElement("div",{className:gm("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!N})},Z),to.createElement("div",null,r)),cA,to.createElement(RUt,{...w&&!AA?{key:`pb-${w}`}:{},rtl:x,theme:K,delay:a,isRunning:A,isIn:U,closeToast:B,hide:c,type:I,style:f,className:d,controlledProgress:AA,progress:S||0})))},xW=function(t,A){return A===void 0&&(A=!1),{enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:A}},LUt=wW(xW("bounce",!0));wW(xW("slide",!0)),wW(xW("zoom")),wW(xW("flip"));const HUt={position:"top-right",transition:LUt,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function YUt(t){let A={...HUt,...t};const e=t.stacked,[i,o]=z.useState(!0),n=z.useRef(null),{getToastToRender:s,isToastActive:r,count:a}=FUt(A),{className:g,style:I,rtl:c,containerId:B}=A;function l(Q){const E=gm("Toastify__toast-container",`Toastify__toast-container--${Q}`,{"Toastify__toast-container--rtl":c});return B0(g)?g({position:Q,rtl:c,defaultClassName:E}):gm(E,mW(g))}function C(){e&&(o(!0),jg.play())}return vUt(()=>{if(e){var Q;const E=n.current.querySelectorAll('[data-in="true"]'),h=12,u=(Q=A.position)==null?void 0:Q.includes("top");let d=0,f=0;Array.from(E).reverse().forEach((w,D)=>{const S=w;S.classList.add("Toastify__toast--stacked"),D>0&&(S.dataset.collapsed=`${i}`),S.dataset.pos||(S.dataset.pos=u?"top":"bot");const x=d*(i?.2:1)+(i?0:h*D);S.style.setProperty("--y",`${u?x:-1*x}px`),S.style.setProperty("--g",`${h}`),S.style.setProperty("--s",""+(1-(i?f:0))),d+=S.offsetHeight,f+=.025})}},[i,a,e]),to.createElement("div",{ref:n,className:"Toastify",id:B,onMouseEnter:()=>{e&&(o(!1),jg.pause())},onMouseLeave:C},s((Q,E)=>{const h=E.length?{...I}:{...I,pointerEvents:"none"};return to.createElement("div",{className:l(Q),style:h,key:`container-${Q}`},E.map(u=>{let{content:d,props:f}=u;return to.createElement(UUt,{...f,stacked:e,collapseAll:C,isIn:r(f.toastId,f.containerId),style:f.style,key:`toast-${f.key}`},d)}))}))}function JUt(){var t=':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=t,document.head.appendChild(A)}const TUt=Rde(xwe);var $EA,kie;function KUt(){if(kie)return $EA;kie=1;var t=Object.defineProperty,A=Object.getOwnPropertyDescriptor,e=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(E,h)=>{for(var u in h)t(E,u,{get:h[u],enumerable:!0})},n=(E,h,u,d)=>{if(h&&typeof h=="object"||typeof h=="function")for(let f of e(h))!i.call(E,f)&&f!==u&&t(E,f,{get:()=>h[f],enumerable:!(d=A(h,f))||d.enumerable});return E},s=E=>n(t({},"__esModule",{value:!0}),E),r={};o(r,{SuperGrid:()=>Q,toMMSI:()=>C,toMeterSI:()=>l}),$EA=s(r);var a=Of(),g=TUt,I=SmA(),c=(E,h,u)=>{const d=[];if(h<E)for(let f=E;f>=h;f-=Math.abs(u))d.push(f);else for(let f=E;f<=h;f+=Math.abs(u))d.push(f);return d};function B(E,h){return{x:Math.round(h.x/E)*E,y:Math.round(h.y/E)*E}}function l(E,h=1){return E<0?"-"+l(-E):E<1e-6?"0m":E>1e3?Math.floor(E/1e3)+"km":E>1&&h>1?Math.round(E)+"m":E>1&&h<=1?E.toFixed(Math.ceil(-Math.log10(h)))+"m":E<1&&h>=1/1e3?Math.round(E*1e3)+"mm":E<1&&h<1/1e3?(E*1e3).toFixed(Math.ceil(-Math.log10(h*1e3)))+"mm":""}function C(E,h=1){return l(E/1e3,h/1e3)}var Q=E=>{var h;const u=(0,a.useRef)(null),[d,f]=(0,a.useState)({x:0,y:0}),{majorColor:w="rgba(0,0,0,0.2)",minorColor:D="rgba(0,0,0,0.1)",textColor:S=(h=E.majorColor)!=null?h:"rgba(0,0,0,0.5)",width:x,height:F,screenSpaceCellSize:k=200,stringifyCoord:U=(J,W,Z)=>`${l(J,Z)}, ${l(W,Z)}`}=E,N=Math.ceil(x/k)+2,Y=Math.ceil(F/k)+2;(0,a.useEffect)(()=>{if(!u.current)return;const J=u.current.getContext("2d");if(!J)return;const W=k/10**Math.floor(Math.log10(E.transform.a)),Z=E.transform.d<0?-1:1,nA=k/10**Math.log10(E.transform.a)/W;function cA(mA,dA,PA){const Ae=mA;let ne,wA,OA;for(ne=dA.x;ne<=PA.x;ne+=Ae)wA=(0,g.applyToPoint)(E.transform,{x:ne,y:dA.y}),OA=(0,g.applyToPoint)(E.transform,{x:ne,y:PA.y}),J.beginPath(),J.moveTo(wA.x,wA.y),J.lineTo(OA.x,OA.y),J.stroke();const KA=c(dA.y,PA.y,Ae*Z);for(const YA of KA)wA=(0,g.applyToPoint)(E.transform,{x:dA.x,y:YA}),OA=(0,g.applyToPoint)(E.transform,{x:PA.x,y:YA}),J.beginPath(),J.moveTo(wA.x,wA.y),J.lineTo(OA.x,OA.y),J.stroke()}function tA(mA,dA,PA){const Ae=mA;let ne;for(ne=dA.x;ne<=PA.x;ne+=Ae)for(const wA of c(dA.y,PA.y,Ae*Z)){const OA=(0,g.applyToPoint)(E.transform,{x:ne,y:wA});J.fillStyle=S,J.font="12px sans-serif",J.fillText(U(ne,wA,mA),OA.x+2,OA.y-2)}}J.clearRect(0,0,x,F);const iA=(0,g.applyToPoint)((0,g.inverse)(E.transform),{x:0,y:0}),rA={x:Math.floor((iA.x-W)/W)*W,y:Math.floor((iA.y-W)/W+(Z==-1?2:0))*W},CA={x:rA.x+W*N,y:rA.y+W*Y*Z},kA=W*5,_A={x:Math.floor((iA.x-kA)/kA)*kA,y:Math.floor((iA.y-kA)/kA+(Z==-1?2:0))*kA},TA={x:_A.x+kA*N,y:_A.y+kA*Y*Z};J.globalAlpha=1,J.strokeStyle=w,cA(W,rA,CA),tA(kA,_A,TA),J.globalAlpha=1-nA,cA(kA/10,_A,TA),J.globalAlpha=1-nA,J.strokeStyle=D,cA(W/10,rA,CA),J.globalAlpha=Math.max(((1-nA)*10-5)/5,0),tA(kA/10,_A,TA),J.globalAlpha=1;const gA=(0,g.applyToPoint)(E.transform,d);J.font="12px sans-serif",J.fillStyle=S,J.fillText(U(d.x,d.y,W),gA.x+2,gA.y-2),J.strokeStyle=w,J.strokeRect(gA.x-5,gA.y-5,10,10)},[u,E.transform,d,x,F]);const K=J=>{if(!u.current)return;const W=k/10/10**Math.floor(Math.log10(E.transform.a)),Z=u.current.getBoundingClientRect(),AA=(0,g.applyToPoint)((0,g.inverse)(E.transform),{x:J.clientX-Z.left,y:J.clientY-Z.top}),nA=B(W,AA);f(nA)};return(0,I.jsx)("canvas",{onMouseUp:J=>{J.button===1&&K(J)},onDoubleClick:K,ref:u,width:E.width,height:E.height})};return $EA}var kW=KUt(),AhA={exports:{}},ehA,Gie;function Fie(){return Gie||(Gie=1,ehA={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]}),ehA}var thA={exports:{}},ihA,_ie;function qUt(){return _ie||(_ie=1,ihA=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")}),ihA}var Rie;function PUt(){if(Rie)return thA.exports;Rie=1;var t=qUt(),A=Array.prototype.concat,e=Array.prototype.slice,i=thA.exports=function(n){for(var s=[],r=0,a=n.length;r<a;r++){var g=n[r];t(g)?s=A.call(s,e.call(g)):s.push(g)}return s};return i.wrap=function(o){return function(){return o(i(arguments))}},thA.exports}var Nie;function OUt(){if(Nie)return AhA.exports;Nie=1;var t=Fie(),A=PUt(),e=Object.hasOwnProperty,i=Object.create(null);for(var o in t)e.call(t,o)&&(i[t[o]]=o);var n=AhA.exports={to:{},get:{}};n.get=function(a){var g=a.substring(0,3).toLowerCase(),I,c;switch(g){case"hsl":I=n.get.hsl(a),c="hsl";break;case"hwb":I=n.get.hwb(a),c="hwb";break;default:I=n.get.rgb(a),c="rgb";break}return I?{model:c,value:I}:null},n.get.rgb=function(a){if(!a)return null;var g=/^#([a-f0-9]{3,4})$/i,I=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,c=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,B=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,l=/^(\w+)$/,C=[0,0,0,1],Q,E,h;if(Q=a.match(I)){for(h=Q[2],Q=Q[1],E=0;E<3;E++){var u=E*2;C[E]=parseInt(Q.slice(u,u+2),16)}h&&(C[3]=parseInt(h,16)/255)}else if(Q=a.match(g)){for(Q=Q[1],h=Q[3],E=0;E<3;E++)C[E]=parseInt(Q[E]+Q[E],16);h&&(C[3]=parseInt(h+h,16)/255)}else if(Q=a.match(c)){for(E=0;E<3;E++)C[E]=parseInt(Q[E+1],0);Q[4]&&(Q[5]?C[3]=parseFloat(Q[4])*.01:C[3]=parseFloat(Q[4]))}else if(Q=a.match(B)){for(E=0;E<3;E++)C[E]=Math.round(parseFloat(Q[E+1])*2.55);Q[4]&&(Q[5]?C[3]=parseFloat(Q[4])*.01:C[3]=parseFloat(Q[4]))}else return(Q=a.match(l))?Q[1]==="transparent"?[0,0,0,0]:e.call(t,Q[1])?(C=t[Q[1]],C[3]=1,C):null:null;for(E=0;E<3;E++)C[E]=s(C[E],0,255);return C[3]=s(C[3],0,1),C},n.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*)?\)$/,I=a.match(g);if(I){var c=parseFloat(I[4]),B=(parseFloat(I[1])%360+360)%360,l=s(parseFloat(I[2]),0,100),C=s(parseFloat(I[3]),0,100),Q=s(isNaN(c)?1:c,0,1);return[B,l,C,Q]}return null},n.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*)?\)$/,I=a.match(g);if(I){var c=parseFloat(I[4]),B=(parseFloat(I[1])%360+360)%360,l=s(parseFloat(I[2]),0,100),C=s(parseFloat(I[3]),0,100),Q=s(isNaN(c)?1:c,0,1);return[B,l,C,Q]}return null},n.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)):"")},n.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]+")"},n.to.rgb.percent=function(){var a=A(arguments),g=Math.round(a[0]/255*100),I=Math.round(a[1]/255*100),c=Math.round(a[2]/255*100);return a.length<4||a[3]===1?"rgb("+g+"%, "+I+"%, "+c+"%)":"rgba("+g+"%, "+I+"%, "+c+"%, "+a[3]+")"},n.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]+")"},n.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+")"},n.to.keyword=function(a){return i[a.slice(0,3)]};function s(a,g,I){return Math.min(Math.max(g,a),I)}function r(a){var g=Math.round(a).toString(16).toUpperCase();return g.length<2?"0"+g:g}return AhA.exports}var ohA,Mie;function vie(){if(Mie)return ohA;Mie=1;const t=Fie(),A={};for(const o of Object.keys(t))A[t[o]]=o;const e={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"]}};ohA=e;for(const o of Object.keys(e)){if(!("channels"in e[o]))throw new Error("missing channels property: "+o);if(!("labels"in e[o]))throw new Error("missing channel labels property: "+o);if(e[o].labels.length!==e[o].channels)throw new Error("channel and label counts mismatch: "+o);const{channels:n,labels:s}=e[o];delete e[o].channels,delete e[o].labels,Object.defineProperty(e[o],"channels",{value:n}),Object.defineProperty(e[o],"labels",{value:s})}e.rgb.hsl=function(o){const n=o[0]/255,s=o[1]/255,r=o[2]/255,a=Math.min(n,s,r),g=Math.max(n,s,r),I=g-a;let c,B;g===a?c=0:n===g?c=(s-r)/I:s===g?c=2+(r-n)/I:r===g&&(c=4+(n-s)/I),c=Math.min(c*60,360),c<0&&(c+=360);const l=(a+g)/2;return g===a?B=0:l<=.5?B=I/(g+a):B=I/(2-g-a),[c,B*100,l*100]},e.rgb.hsv=function(o){let n,s,r,a,g;const I=o[0]/255,c=o[1]/255,B=o[2]/255,l=Math.max(I,c,B),C=l-Math.min(I,c,B),Q=function(E){return(l-E)/6/C+1/2};return C===0?(a=0,g=0):(g=C/l,n=Q(I),s=Q(c),r=Q(B),I===l?a=r-s:c===l?a=1/3+n-r:B===l&&(a=2/3+s-n),a<0?a+=1:a>1&&(a-=1)),[a*360,g*100,l*100]},e.rgb.hwb=function(o){const n=o[0],s=o[1];let r=o[2];const a=e.rgb.hsl(o)[0],g=1/255*Math.min(n,Math.min(s,r));return r=1-1/255*Math.max(n,Math.max(s,r)),[a,g*100,r*100]},e.rgb.cmyk=function(o){const n=o[0]/255,s=o[1]/255,r=o[2]/255,a=Math.min(1-n,1-s,1-r),g=(1-n-a)/(1-a)||0,I=(1-s-a)/(1-a)||0,c=(1-r-a)/(1-a)||0;return[g*100,I*100,c*100,a*100]};function i(o,n){return(o[0]-n[0])**2+(o[1]-n[1])**2+(o[2]-n[2])**2}return e.rgb.keyword=function(o){const n=A[o];if(n)return n;let s=1/0,r;for(const a of Object.keys(t)){const g=t[a],I=i(o,g);I<s&&(s=I,r=a)}return r},e.keyword.rgb=function(o){return t[o]},e.rgb.xyz=function(o){let n=o[0]/255,s=o[1]/255,r=o[2]/255;n=n>.04045?((n+.055)/1.055)**2.4:n/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=n*.4124+s*.3576+r*.1805,g=n*.2126+s*.7152+r*.0722,I=n*.0193+s*.1192+r*.9505;return[a*100,g*100,I*100]},e.rgb.lab=function(o){const n=e.rgb.xyz(o);let s=n[0],r=n[1],a=n[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,I=500*(s-r),c=200*(r-a);return[g,I,c]},e.hsl.rgb=function(o){const n=o[0]/360,s=o[1]/100,r=o[2]/100;let a,g,I;if(s===0)return I=r*255,[I,I,I];r<.5?a=r*(1+s):a=r+s-r*s;const c=2*r-a,B=[0,0,0];for(let l=0;l<3;l++)g=n+1/3*-(l-1),g<0&&g++,g>1&&g--,6*g<1?I=c+(a-c)*6*g:2*g<1?I=a:3*g<2?I=c+(a-c)*(2/3-g)*6:I=c,B[l]=I*255;return B},e.hsl.hsv=function(o){const n=o[0];let s=o[1]/100,r=o[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 I=(r+s)/2,c=r===0?2*a/(g+a):2*s/(r+s);return[n,c*100,I*100]},e.hsv.rgb=function(o){const n=o[0]/60,s=o[1]/100;let r=o[2]/100;const a=Math.floor(n)%6,g=n-Math.floor(n),I=255*r*(1-s),c=255*r*(1-s*g),B=255*r*(1-s*(1-g));switch(r*=255,a){case 0:return[r,B,I];case 1:return[c,r,I];case 2:return[I,r,B];case 3:return[I,c,r];case 4:return[B,I,r];case 5:return[r,I,c]}},e.hsv.hsl=function(o){const n=o[0],s=o[1]/100,r=o[2]/100,a=Math.max(r,.01);let g,I;I=(2-s)*r;const c=(2-s)*a;return g=s*a,g/=c<=1?c:2-c,g=g||0,I/=2,[n,g*100,I*100]},e.hwb.rgb=function(o){const n=o[0]/360;let s=o[1]/100,r=o[2]/100;const a=s+r;let g;a>1&&(s/=a,r/=a);const I=Math.floor(6*n),c=1-r;g=6*n-I,(I&1)!==0&&(g=1-g);const B=s+g*(c-s);let l,C,Q;switch(I){default:case 6:case 0:l=c,C=B,Q=s;break;case 1:l=B,C=c,Q=s;break;case 2:l=s,C=c,Q=B;break;case 3:l=s,C=B,Q=c;break;case 4:l=B,C=s,Q=c;break;case 5:l=c,C=s,Q=B;break}return[l*255,C*255,Q*255]},e.cmyk.rgb=function(o){const n=o[0]/100,s=o[1]/100,r=o[2]/100,a=o[3]/100,g=1-Math.min(1,n*(1-a)+a),I=1-Math.min(1,s*(1-a)+a),c=1-Math.min(1,r*(1-a)+a);return[g*255,I*255,c*255]},e.xyz.rgb=function(o){const n=o[0]/100,s=o[1]/100,r=o[2]/100;let a,g,I;return a=n*3.2406+s*-1.5372+r*-.4986,g=n*-.9689+s*1.8758+r*.0415,I=n*.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,I=I>.0031308?1.055*I**(1/2.4)-.055:I*12.92,a=Math.min(Math.max(0,a),1),g=Math.min(Math.max(0,g),1),I=Math.min(Math.max(0,I),1),[a*255,g*255,I*255]},e.xyz.lab=function(o){let n=o[0],s=o[1],r=o[2];n/=95.047,s/=100,r/=108.883,n=n>.008856?n**(1/3):7.787*n+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*(n-s),I=200*(s-r);return[a,g,I]},e.lab.xyz=function(o){const n=o[0],s=o[1],r=o[2];let a,g,I;g=(n+16)/116,a=s/500+g,I=g-r/200;const c=g**3,B=a**3,l=I**3;return g=c>.008856?c:(g-16/116)/7.787,a=B>.008856?B:(a-16/116)/7.787,I=l>.008856?l:(I-16/116)/7.787,a*=95.047,g*=100,I*=108.883,[a,g,I]},e.lab.lch=function(o){const n=o[0],s=o[1],r=o[2];let a;a=Math.atan2(r,s)*360/2/Math.PI,a<0&&(a+=360);const I=Math.sqrt(s*s+r*r);return[n,I,a]},e.lch.lab=function(o){const n=o[0],s=o[1],a=o[2]/360*2*Math.PI,g=s*Math.cos(a),I=s*Math.sin(a);return[n,g,I]},e.rgb.ansi16=function(o,n=null){const[s,r,a]=o;let g=n===null?e.rgb.hsv(o)[2]:n;if(g=Math.round(g/50),g===0)return 30;let I=30+(Math.round(a/255)<<2|Math.round(r/255)<<1|Math.round(s/255));return g===2&&(I+=60),I},e.hsv.ansi16=function(o){return e.rgb.ansi16(e.hsv.rgb(o),o[2])},e.rgb.ansi256=function(o){const n=o[0],s=o[1],r=o[2];return n===s&&s===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(s/255*5)+Math.round(r/255*5)},e.ansi16.rgb=function(o){let n=o%10;if(n===0||n===7)return o>50&&(n+=3.5),n=n/10.5*255,[n,n,n];const s=(~~(o>50)+1)*.5,r=(n&1)*s*255,a=(n>>1&1)*s*255,g=(n>>2&1)*s*255;return[r,a,g]},e.ansi256.rgb=function(o){if(o>=232){const g=(o-232)*10+8;return[g,g,g]}o-=16;let n;const s=Math.floor(o/36)/5*255,r=Math.floor((n=o%36)/6)/5*255,a=n%6/5*255;return[s,r,a]},e.rgb.hex=function(o){const s=(((Math.round(o[0])&255)<<16)+((Math.round(o[1])&255)<<8)+(Math.round(o[2])&255)).toString(16).toUpperCase();return"000000".substring(s.length)+s},e.hex.rgb=function(o){const n=o.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];let s=n[0];n[0].length===3&&(s=s.split("").map(c=>c+c).join(""));const r=parseInt(s,16),a=r>>16&255,g=r>>8&255,I=r&255;return[a,g,I]},e.rgb.hcg=function(o){const n=o[0]/255,s=o[1]/255,r=o[2]/255,a=Math.max(Math.max(n,s),r),g=Math.min(Math.min(n,s),r),I=a-g;let c,B;return I<1?c=g/(1-I):c=0,I<=0?B=0:a===n?B=(s-r)/I%6:a===s?B=2+(r-n)/I:B=4+(n-s)/I,B/=6,B%=1,[B*360,I*100,c*100]},e.hsl.hcg=function(o){const n=o[1]/100,s=o[2]/100,r=s<.5?2*n*s:2*n*(1-s);let a=0;return r<1&&(a=(s-.5*r)/(1-r)),[o[0],r*100,a*100]},e.hsv.hcg=function(o){const n=o[1]/100,s=o[2]/100,r=n*s;let a=0;return r<1&&(a=(s-r)/(1-r)),[o[0],r*100,a*100]},e.hcg.rgb=function(o){const n=o[0]/360,s=o[1]/100,r=o[2]/100;if(s===0)return[r*255,r*255,r*255];const a=[0,0,0],g=n%1*6,I=g%1,c=1-I;let B=0;switch(Math.floor(g)){case 0:a[0]=1,a[1]=I,a[2]=0;break;case 1:a[0]=c,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=I;break;case 3:a[0]=0,a[1]=c,a[2]=1;break;case 4:a[0]=I,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=c}return B=(1-s)*r,[(s*a[0]+B)*255,(s*a[1]+B)*255,(s*a[2]+B)*255]},e.hcg.hsv=function(o){const n=o[1]/100,s=o[2]/100,r=n+s*(1-n);let a=0;return r>0&&(a=n/r),[o[0],a*100,r*100]},e.hcg.hsl=function(o){const n=o[1]/100,r=o[2]/100*(1-n)+.5*n;let a=0;return r>0&&r<.5?a=n/(2*r):r>=.5&&r<1&&(a=n/(2*(1-r))),[o[0],a*100,r*100]},e.hcg.hwb=function(o){const n=o[1]/100,s=o[2]/100,r=n+s*(1-n);return[o[0],(r-n)*100,(1-r)*100]},e.hwb.hcg=function(o){const n=o[1]/100,r=1-o[2]/100,a=r-n;let g=0;return a<1&&(g=(r-a)/(1-a)),[o[0],a*100,g*100]},e.apple.rgb=function(o){return[o[0]/65535*255,o[1]/65535*255,o[2]/65535*255]},e.rgb.apple=function(o){return[o[0]/255*65535,o[1]/255*65535,o[2]/255*65535]},e.gray.rgb=function(o){return[o[0]/100*255,o[0]/100*255,o[0]/100*255]},e.gray.hsl=function(o){return[0,0,o[0]]},e.gray.hsv=e.gray.hsl,e.gray.hwb=function(o){return[0,100,o[0]]},e.gray.cmyk=function(o){return[0,0,0,o[0]]},e.gray.lab=function(o){return[o[0],0,0]},e.gray.hex=function(o){const n=Math.round(o[0]/100*255)&255,r=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(r.length)+r},e.rgb.gray=function(o){return[(o[0]+o[1]+o[2])/3/255*100]},ohA}var nhA,Uie;function WUt(){if(Uie)return nhA;Uie=1;const t=vie();function A(){const n={},s=Object.keys(t);for(let r=s.length,a=0;a<r;a++)n[s[a]]={distance:-1,parent:null};return n}function e(n){const s=A(),r=[n];for(s[n].distance=0;r.length;){const a=r.pop(),g=Object.keys(t[a]);for(let I=g.length,c=0;c<I;c++){const B=g[c],l=s[B];l.distance===-1&&(l.distance=s[a].distance+1,l.parent=a,r.unshift(B))}}return s}function i(n,s){return function(r){return s(n(r))}}function o(n,s){const r=[s[n].parent,n];let a=t[s[n].parent][n],g=s[n].parent;for(;s[g].parent;)r.unshift(s[g].parent),a=i(t[s[g].parent][g],a),g=s[g].parent;return a.conversion=r,a}return nhA=function(n){const s=e(n),r={},a=Object.keys(s);for(let g=a.length,I=0;I<g;I++){const c=a[I];s[c].parent!==null&&(r[c]=o(c,s))}return r},nhA}var shA,Lie;function ZUt(){if(Lie)return shA;Lie=1;const t=vie(),A=WUt(),e={},i=Object.keys(t);function o(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 n(s){const r=function(...a){const g=a[0];if(g==null)return g;g.length>1&&(a=g);const I=s(a);if(typeof I=="object")for(let c=I.length,B=0;B<c;B++)I[B]=Math.round(I[B]);return I};return"conversion"in s&&(r.conversion=s.conversion),r}return i.forEach(s=>{e[s]={},Object.defineProperty(e[s],"channels",{value:t[s].channels}),Object.defineProperty(e[s],"labels",{value:t[s].labels});const r=A(s);Object.keys(r).forEach(g=>{const I=r[g];e[s][g]=n(I),e[s][g].raw=o(I)})}),shA=e,shA}var rhA,Hie;function VUt(){if(Hie)return rhA;Hie=1;const t=OUt(),A=ZUt(),e=["keyword","gray","hex"],i={};for(const B of Object.keys(A))i[[...A[B].labels].sort().join("")]=B;const o={};function n(B,l){if(!(this instanceof n))return new n(B,l);if(l&&l in e&&(l=null),l&&!(l in A))throw new Error("Unknown model: "+l);let C,Q;if(B==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(B instanceof n)this.model=B.model,this.color=[...B.color],this.valpha=B.valpha;else if(typeof B=="string"){const E=t.get(B);if(E===null)throw new Error("Unable to parse color from string: "+B);this.model=E.model,Q=A[this.model].channels,this.color=E.value.slice(0,Q),this.valpha=typeof E.value[Q]=="number"?E.value[Q]:1}else if(B.length>0){this.model=l||"rgb",Q=A[this.model].channels;const E=Array.prototype.slice.call(B,0,Q);this.color=c(E,Q),this.valpha=typeof B[Q]=="number"?B[Q]:1}else if(typeof B=="number")this.model="rgb",this.color=[B>>16&255,B>>8&255,B&255],this.valpha=1;else{this.valpha=1;const E=Object.keys(B);"alpha"in B&&(E.splice(E.indexOf("alpha"),1),this.valpha=typeof B.alpha=="number"?B.alpha:0);const h=E.sort().join("");if(!(h in i))throw new Error("Unable to parse color from object: "+JSON.stringify(B));this.model=i[h];const{labels:u}=A[this.model],d=[];for(C=0;C<u.length;C++)d.push(B[u[C]]);this.color=c(d)}if(o[this.model])for(Q=A[this.model].channels,C=0;C<Q;C++){const E=o[this.model][C];E&&(this.color[C]=E(this.color[C]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}n.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(B){let l=this.model in t.to?this:this.rgb();l=l.round(typeof B=="number"?B:1);const C=l.valpha===1?l.color:[...l.color,this.valpha];return t.to[l.model](C)},percentString(B){const l=this.rgb().round(typeof B=="number"?B:1),C=l.valpha===1?l.color:[...l.color,this.valpha];return t.to.rgb.percent(C)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const B={},{channels:l}=A[this.model],{labels:C}=A[this.model];for(let Q=0;Q<l;Q++)B[C[Q]]=this.color[Q];return this.valpha!==1&&(B.alpha=this.valpha),B},unitArray(){const B=this.rgb().color;return B[0]/=255,B[1]/=255,B[2]/=255,this.valpha!==1&&B.push(this.valpha),B},unitObject(){const B=this.rgb().object();return B.r/=255,B.g/=255,B.b/=255,this.valpha!==1&&(B.alpha=this.valpha),B},round(B){return B=Math.max(B||0,0),new n([...this.color.map(r(B)),this.valpha],this.model)},alpha(B){return B!==void 0?new n([...this.color,Math.max(0,Math.min(1,B))],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,B=>(B%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(B){return B!==void 0?new n(B):A[this.model].keyword(this.color)},hex(B){return B!==void 0?new n(B):t.to.hex(this.rgb().round().color)},hexa(B){if(B!==void 0)return new n(B);const l=this.rgb().round().color;let C=Math.round(this.valpha*255).toString(16).toUpperCase();return C.length===1&&(C="0"+C),t.to.hex(l)+C},rgbNumber(){const B=this.rgb().color;return(B[0]&255)<<16|(B[1]&255)<<8|B[2]&255},luminosity(){const B=this.rgb().color,l=[];for(const[C,Q]of B.entries()){const E=Q/255;l[C]=E<=.04045?E/12.92:((E+.055)/1.055)**2.4}return .2126*l[0]+.7152*l[1]+.0722*l[2]},contrast(B){const l=this.luminosity(),C=B.luminosity();return l>C?(l+.05)/(C+.05):(C+.05)/(l+.05)},level(B){const l=this.contrast(B);return l>=7?"AAA":l>=4.5?"AA":""},isDark(){const B=this.rgb().color;return(B[0]*2126+B[1]*7152+B[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const B=this.rgb();for(let l=0;l<3;l++)B.color[l]=255-B.color[l];return B},lighten(B){const l=this.hsl();return l.color[2]+=l.color[2]*B,l},darken(B){const l=this.hsl();return l.color[2]-=l.color[2]*B,l},saturate(B){const l=this.hsl();return l.color[1]+=l.color[1]*B,l},desaturate(B){const l=this.hsl();return l.color[1]-=l.color[1]*B,l},whiten(B){const l=this.hwb();return l.color[1]+=l.color[1]*B,l},blacken(B){const l=this.hwb();return l.color[2]+=l.color[2]*B,l},grayscale(){const B=this.rgb().color,l=B[0]*.3+B[1]*.59+B[2]*.11;return n.rgb(l,l,l)},fade(B){return this.alpha(this.valpha-this.valpha*B)},opaquer(B){return this.alpha(this.valpha+this.valpha*B)},rotate(B){const l=this.hsl();let C=l.color[0];return C=(C+B)%360,C=C<0?360+C:C,l.color[0]=C,l},mix(B,l){if(!B||!B.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof B);const C=B.rgb(),Q=this.rgb(),E=l===void 0?.5:l,h=2*E-1,u=C.alpha()-Q.alpha(),d=((h*u===-1?h:(h+u)/(1+h*u))+1)/2,f=1-d;return n.rgb(d*C.red()+f*Q.red(),d*C.green()+f*Q.green(),d*C.blue()+f*Q.blue(),C.alpha()*E+Q.alpha()*(1-E))}};for(const B of Object.keys(A)){if(e.includes(B))continue;const{channels:l}=A[B];n.prototype[B]=function(...C){return this.model===B?new n(this):C.length>0?new n(C,B):new n([...I(A[this.model][B].raw(this.color)),this.valpha],B)},n[B]=function(...C){let Q=C[0];return typeof Q=="number"&&(Q=c(C,l)),new n(Q,B)}}function s(B,l){return Number(B.toFixed(l))}function r(B){return function(l){return s(l,B)}}function a(B,l,C){B=Array.isArray(B)?B:[B];for(const Q of B)(o[Q]||(o[Q]=[]))[l]=C;return B=B[0],function(Q){let E;return Q!==void 0?(C&&(Q=C(Q)),E=this[B](),E.color[l]=Q,E):(E=this[B]().color[l],C&&(E=C(E)),E)}}function g(B){return function(l){return Math.max(0,Math.min(B,l))}}function I(B){return Array.isArray(B)?B:[B]}function c(B,l){for(let C=0;C<l;C++)typeof B[C]!="number"&&(B[C]=0);return B}return rhA=n,rhA}var jUt=VUt();const Yie=vp(jUt);function zUt(t){if(t.sheet)return t.sheet;for(var A=0;A<document.styleSheets.length;A++)if(document.styleSheets[A].ownerNode===t)return document.styleSheets[A]}function XUt(t){var A=document.createElement("style");return A.setAttribute("data-emotion",t.key),t.nonce!==void 0&&A.setAttribute("nonce",t.nonce),A.appendChild(document.createTextNode("")),A.setAttribute("data-s",""),A}var $Ut=(function(){function t(e){var i=this;this._insertTag=function(o){var n;i.tags.length===0?i.insertionPoint?n=i.insertionPoint.nextSibling:i.prepend?n=i.container.firstChild:n=i.before:n=i.tags[i.tags.length-1].nextSibling,i.container.insertBefore(o,n),i.tags.push(o)},this.isSpeedy=e.speedy===void 0?!0:e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var A=t.prototype;return A.hydrate=function(i){i.forEach(this._insertTag)},A.insert=function(i){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(XUt(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var n=zUt(o);try{n.insertRule(i,n.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(i));this.ctr++},A.flush=function(){this.tags.forEach(function(i){var o;return(o=i.parentNode)==null?void 0:o.removeChild(i)}),this.tags=[],this.ctr=0},t})(),Mu="-ms-",GW="-moz-",Ka="-webkit-",Jie="comm",ahA="rule",ghA="decl",ALt="@import",Tie="@keyframes",eLt="@layer",tLt=Math.abs,FW=String.fromCharCode,iLt=Object.assign;function oLt(t,A){return fh(t,0)^45?(((A<<2^fh(t,0))<<2^fh(t,1))<<2^fh(t,2))<<2^fh(t,3):0}function Kie(t){return t.trim()}function nLt(t,A){return(t=A.exec(t))?t[0]:t}function qa(t,A,e){return t.replace(A,e)}function IhA(t,A){return t.indexOf(A)}function fh(t,A){return t.charCodeAt(A)|0}function wH(t,A,e){return t.slice(A,e)}function AD(t){return t.length}function chA(t){return t.length}function _W(t,A){return A.push(t),t}function sLt(t,A){return t.map(A).join("")}var RW=1,LM=1,qie=0,tf=0,GC=0,HM="";function NW(t,A,e,i,o,n,s){return{value:t,root:A,parent:e,type:i,props:o,children:n,line:RW,column:LM,length:s,return:""}}function DH(t,A){return iLt(NW("",null,null,"",null,null,0),t,{length:-t.length},A)}function rLt(){return GC}function aLt(){return GC=tf>0?fh(HM,--tf):0,LM--,GC===10&&(LM=1,RW--),GC}function l0(){return GC=tf<qie?fh(HM,tf++):0,LM++,GC===10&&(LM=1,RW++),GC}function eD(){return fh(HM,tf)}function MW(){return tf}function SH(t,A){return wH(HM,t,A)}function bH(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Pie(t){return RW=LM=1,qie=AD(HM=t),tf=0,[]}function Oie(t){return HM="",t}function vW(t){return Kie(SH(tf-1,BhA(t===91?t+2:t===40?t+1:t)))}function gLt(t){for(;(GC=eD())&&GC<33;)l0();return bH(t)>2||bH(GC)>3?"":" "}function ILt(t,A){for(;--A&&l0()&&!(GC<48||GC>102||GC>57&&GC<65||GC>70&&GC<97););return SH(t,MW()+(A<6&&eD()==32&&l0()==32))}function BhA(t){for(;l0();)switch(GC){case t:return tf;case 34:case 39:t!==34&&t!==39&&BhA(GC);break;case 40:t===41&&BhA(t);break;case 92:l0();break}return tf}function cLt(t,A){for(;l0()&&t+GC!==57;)if(t+GC===84&&eD()===47)break;return"/*"+SH(A,tf-1)+"*"+FW(t===47?t:l0())}function BLt(t){for(;!bH(eD());)l0();return SH(t,tf)}function lLt(t){return Oie(UW("",null,null,null,[""],t=Pie(t),0,[0],t))}function UW(t,A,e,i,o,n,s,r,a){for(var g=0,I=0,c=s,B=0,l=0,C=0,Q=1,E=1,h=1,u=0,d="",f=o,w=n,D=i,S=d;E;)switch(C=u,u=l0()){case 40:if(C!=108&&fh(S,c-1)==58){IhA(S+=qa(vW(u),"&","&\f"),"&\f")!=-1&&(h=-1);break}case 34:case 39:case 91:S+=vW(u);break;case 9:case 10:case 13:case 32:S+=gLt(C);break;case 92:S+=ILt(MW()-1,7);continue;case 47:switch(eD()){case 42:case 47:_W(CLt(cLt(l0(),MW()),A,e),a);break;default:S+="/"}break;case 123*Q:r[g++]=AD(S)*h;case 125*Q:case 59:case 0:switch(u){case 0:case 125:E=0;case 59+I:h==-1&&(S=qa(S,/\f/g,"")),l>0&&AD(S)-c&&_W(l>32?Zie(S+";",i,e,c-1):Zie(qa(S," ","")+";",i,e,c-2),a);break;case 59:S+=";";default:if(_W(D=Wie(S,A,e,g,I,o,r,d,f=[],w=[],c),n),u===123)if(I===0)UW(S,A,D,D,f,n,c,r,w);else switch(B===99&&fh(S,3)===110?100:B){case 100:case 108:case 109:case 115:UW(t,D,D,i&&_W(Wie(t,D,D,0,0,o,r,d,o,f=[],c),w),o,w,c,r,i?f:w);break;default:UW(S,D,D,D,[""],w,0,r,w)}}g=I=l=0,Q=h=1,d=S="",c=s;break;case 58:c=1+AD(S),l=C;default:if(Q<1){if(u==123)--Q;else if(u==125&&Q++==0&&aLt()==125)continue}switch(S+=FW(u),u*Q){case 38:h=I>0?1:(S+="\f",-1);break;case 44:r[g++]=(AD(S)-1)*h,h=1;break;case 64:eD()===45&&(S+=vW(l0())),B=eD(),I=c=AD(d=S+=BLt(MW())),u++;break;case 45:C===45&&AD(S)==2&&(Q=0)}}return n}function Wie(t,A,e,i,o,n,s,r,a,g,I){for(var c=o-1,B=o===0?n:[""],l=chA(B),C=0,Q=0,E=0;C<i;++C)for(var h=0,u=wH(t,c+1,c=tLt(Q=s[C])),d=t;h<l;++h)(d=Kie(Q>0?B[h]+" "+u:qa(u,/&\f/g,B[h])))&&(a[E++]=d);return NW(t,A,e,o===0?ahA:r,a,g,I)}function CLt(t,A,e){return NW(t,A,e,Jie,FW(rLt()),wH(t,2,-2),0)}function Zie(t,A,e,i){return NW(t,A,e,ghA,wH(t,0,i),wH(t,i+1,-1),i)}function YM(t,A){for(var e="",i=chA(t),o=0;o<i;o++)e+=A(t[o],o,t,A)||"";return e}function QLt(t,A,e,i){switch(t.type){case eLt:if(t.children.length)break;case ALt:case ghA:return t.return=t.return||t.value;case Jie:return"";case Tie:return t.return=t.value+"{"+YM(t.children,i)+"}";case ahA:t.value=t.props.join(",")}return AD(e=YM(t.children,i))?t.return=t.value+"{"+e+"}":""}function ELt(t){var A=chA(t);return function(e,i,o,n){for(var s="",r=0;r<A;r++)s+=t[r](e,i,o,n)||"";return s}}function hLt(t){return function(A){A.root||(A=A.return)&&t(A)}}function uLt(t){var A=Object.create(null);return function(e){return A[e]===void 0&&(A[e]=t(e)),A[e]}}var dLt=function(A,e,i){for(var o=0,n=0;o=n,n=eD(),o===38&&n===12&&(e[i]=1),!bH(n);)l0();return SH(A,tf)},pLt=function(A,e){var i=-1,o=44;do switch(bH(o)){case 0:o===38&&eD()===12&&(e[i]=1),A[i]+=dLt(tf-1,e,i);break;case 2:A[i]+=vW(o);break;case 4:if(o===44){A[++i]=eD()===58?"&\f":"",e[i]=A[i].length;break}default:A[i]+=FW(o)}while(o=l0());return A},fLt=function(A,e){return Oie(pLt(Pie(A),e))},Vie=new WeakMap,yLt=function(A){if(!(A.type!=="rule"||!A.parent||A.length<1)){for(var e=A.value,i=A.parent,o=A.column===i.column&&A.line===i.line;i.type!=="rule";)if(i=i.parent,!i)return;if(!(A.props.length===1&&e.charCodeAt(0)!==58&&!Vie.get(i))&&!o){Vie.set(A,!0);for(var n=[],s=fLt(e,n),r=i.props,a=0,g=0;a<s.length;a++)for(var I=0;I<r.length;I++,g++)A.props[g]=n[a]?s[a].replace(/&\f/g,r[I]):r[I]+" "+s[a]}}},mLt=function(A){if(A.type==="decl"){var e=A.value;e.charCodeAt(0)===108&&e.charCodeAt(2)===98&&(A.return="",A.value="")}};function jie(t,A){switch(oLt(t,A)){case 5103:return Ka+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ka+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Ka+t+GW+t+Mu+t+t;case 6828:case 4268:return Ka+t+Mu+t+t;case 6165:return Ka+t+Mu+"flex-"+t+t;case 5187:return Ka+t+qa(t,/(\w+).+(:[^]+)/,Ka+"box-$1$2"+Mu+"flex-$1$2")+t;case 5443:return Ka+t+Mu+"flex-item-"+qa(t,/flex-|-self/,"")+t;case 4675:return Ka+t+Mu+"flex-line-pack"+qa(t,/align-content|flex-|-self/,"")+t;case 5548:return Ka+t+Mu+qa(t,"shrink","negative")+t;case 5292:return Ka+t+Mu+qa(t,"basis","preferred-size")+t;case 6060:return Ka+"box-"+qa(t,"-grow","")+Ka+t+Mu+qa(t,"grow","positive")+t;case 4554:return Ka+qa(t,/([^-])(transform)/g,"$1"+Ka+"$2")+t;case 6187:return qa(qa(qa(t,/(zoom-|grab)/,Ka+"$1"),/(image-set)/,Ka+"$1"),t,"")+t;case 5495:case 3959:return qa(t,/(image-set\([^]*)/,Ka+"$1$`$1");case 4968:return qa(qa(t,/(.+:)(flex-)?(.*)/,Ka+"box-pack:$3"+Mu+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ka+t+t;case 4095:case 3583:case 4068:case 2532:return qa(t,/(.+)-inline(.+)/,Ka+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(AD(t)-1-A>6)switch(fh(t,A+1)){case 109:if(fh(t,A+4)!==45)break;case 102:return qa(t,/(.+:)(.+)-([^]+)/,"$1"+Ka+"$2-$3$1"+GW+(fh(t,A+3)==108?"$3":"$2-$3"))+t;case 115:return~IhA(t,"stretch")?jie(qa(t,"stretch","fill-available"),A)+t:t}break;case 4949:if(fh(t,A+1)!==115)break;case 6444:switch(fh(t,AD(t)-3-(~IhA(t,"!important")&&10))){case 107:return qa(t,":",":"+Ka)+t;case 101:return qa(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ka+(fh(t,14)===45?"inline-":"")+"box$3$1"+Ka+"$2$3$1"+Mu+"$2box$3")+t}break;case 5936:switch(fh(t,A+11)){case 114:return Ka+t+Mu+qa(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Ka+t+Mu+qa(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Ka+t+Mu+qa(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Ka+t+Mu+t+t}return t}var wLt=function(A,e,i,o){if(A.length>-1&&!A.return)switch(A.type){case ghA:A.return=jie(A.value,A.length);break;case Tie:return YM([DH(A,{value:qa(A.value,"@","@"+Ka)})],o);case ahA:if(A.length)return sLt(A.props,function(n){switch(nLt(n,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return YM([DH(A,{props:[qa(n,/:(read-\w+)/,":"+GW+"$1")]})],o);case"::placeholder":return YM([DH(A,{props:[qa(n,/:(plac\w+)/,":"+Ka+"input-$1")]}),DH(A,{props:[qa(n,/:(plac\w+)/,":"+GW+"$1")]}),DH(A,{props:[qa(n,/:(plac\w+)/,Mu+"input-$1")]})],o)}return""})}},DLt=[wLt],SLt=function(A){var e=A.key;if(e==="css"){var i=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(i,function(Q){var E=Q.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(Q),Q.setAttribute("data-s",""))})}var o=A.stylisPlugins||DLt,n={},s,r=[];s=A.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+e+' "]'),function(Q){for(var E=Q.getAttribute("data-emotion").split(" "),h=1;h<E.length;h++)n[E[h]]=!0;r.push(Q)});var a,g=[yLt,mLt];{var I,c=[QLt,hLt(function(Q){I.insert(Q)})],B=ELt(g.concat(o,c)),l=function(E){return YM(lLt(E),B)};a=function(E,h,u,d){I=u,l(E?E+"{"+h.styles+"}":h.styles),d&&(C.inserted[h.name]=!0)}}var C={key:e,sheet:new $Ut({key:e,container:s,nonce:A.nonce,speedy:A.speedy,prepend:A.prepend,insertionPoint:A.insertionPoint}),nonce:A.nonce,inserted:n,registered:{},insert:a};return C.sheet.hydrate(r),C};function bLt(t){for(var A=0,e,i=0,o=t.length;o>=4;++i,o-=4)e=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,e=(e&65535)*1540483477+((e>>>16)*59797<<16),e^=e>>>24,A=(e&65535)*1540483477+((e>>>16)*59797<<16)^(A&65535)*1540483477+((A>>>16)*59797<<16);switch(o){case 3:A^=(t.charCodeAt(i+2)&255)<<16;case 2:A^=(t.charCodeAt(i+1)&255)<<8;case 1:A^=t.charCodeAt(i)&255,A=(A&65535)*1540483477+((A>>>16)*59797<<16)}return A^=A>>>13,A=(A&65535)*1540483477+((A>>>16)*59797<<16),((A^A>>>15)>>>0).toString(36)}var xLt={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},kLt=/[A-Z]|^ms/g,GLt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,zie=function(A){return A.charCodeAt(1)===45},Xie=function(A){return A!=null&&typeof A!="boolean"},lhA=uLt(function(t){return zie(t)?t:t.replace(kLt,"-$&").toLowerCase()}),$ie=function(A,e){switch(A){case"animation":case"animationName":if(typeof e=="string")return e.replace(GLt,function(i,o,n){return Px={name:o,styles:n,next:Px},o})}return xLt[A]!==1&&!zie(A)&&typeof e=="number"&&e!==0?e+"px":e};function LW(t,A,e){if(e==null)return"";var i=e;if(i.__emotion_styles!==void 0)return i;switch(typeof e){case"boolean":return"";case"object":{var o=e;if(o.anim===1)return Px={name:o.name,styles:o.styles,next:Px},o.name;var n=e;if(n.styles!==void 0){var s=n.next;if(s!==void 0)for(;s!==void 0;)Px={name:s.name,styles:s.styles,next:Px},s=s.next;var r=n.styles+";";return r}return FLt(t,A,e)}}var a=e;if(A==null)return a;var g=A[a];return g!==void 0?g:a}function FLt(t,A,e){var i="";if(Array.isArray(e))for(var o=0;o<e.length;o++)i+=LW(t,A,e[o])+";";else for(var n in e){var s=e[n];if(typeof s!="object"){var r=s;A!=null&&A[r]!==void 0?i+=n+"{"+A[r]+"}":Xie(r)&&(i+=lhA(n)+":"+$ie(n,r)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&(A==null||A[s[0]]===void 0))for(var a=0;a<s.length;a++)Xie(s[a])&&(i+=lhA(n)+":"+$ie(n,s[a])+";");else{var g=LW(t,A,s);switch(n){case"animation":case"animationName":{i+=lhA(n)+":"+g+";";break}default:i+=n+"{"+g+"}"}}}return i}var Aoe=/label:\s*([^\s;{]+)\s*(;|$)/g,Px;function ChA(t,A,e){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var i=!0,o="";Px=void 0;var n=t[0];if(n==null||n.raw===void 0)i=!1,o+=LW(e,A,n);else{var s=n;o+=s[0]}for(var r=1;r<t.length;r++)if(o+=LW(e,A,t[r]),i){var a=n;o+=a[r]}Aoe.lastIndex=0;for(var g="",I;(I=Aoe.exec(o))!==null;)g+="-"+I[1];var c=bLt(o)+g;return{name:c,styles:o,next:Px}}function eoe(t,A,e){var i="";return e.split(" ").forEach(function(o){t[o]!==void 0?A.push(t[o]+";"):o&&(i+=o+" ")}),i}var _Lt=function(A,e,i){var o=A.key+"-"+e.name;A.registered[o]===void 0&&(A.registered[o]=e.styles)},RLt=function(A,e,i){_Lt(A,e);var o=A.key+"-"+e.name;if(A.inserted[e.name]===void 0){var n=e;do A.insert(e===n?"."+o:"",n,A.sheet,!0),n=n.next;while(n!==void 0)}};function toe(t,A){if(t.inserted[A.name]===void 0)return t.insert("",A,t.sheet,!0)}function ioe(t,A,e){var i=[],o=eoe(t,i,e);return i.length<2?e:o+A(i)}var NLt=function(A){var e=SLt(A);e.sheet.speedy=function(r){this.isSpeedy=r},e.compat=!0;var i=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];var c=ChA(g,e.registered,void 0);return RLt(e,c),e.key+"-"+c.name},o=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];var c=ChA(g,e.registered),B="animation-"+c.name;return toe(e,{name:c.name,styles:"@keyframes "+B+"{"+c.styles+"}"}),B},n=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];var c=ChA(g,e.registered);toe(e,c)},s=function(){for(var a=arguments.length,g=new Array(a),I=0;I<a;I++)g[I]=arguments[I];return ioe(e.registered,i,MLt(g))};return{css:i,cx:s,injectGlobal:n,keyframes:o,hydrate:function(a){a.forEach(function(g){e.inserted[g]=!0})},flush:function(){e.registered={},e.inserted={},e.sheet.flush()},sheet:e.sheet,cache:e,getRegisteredStyles:eoe.bind(null,e.registered),merge:ioe.bind(null,e.registered,i)}},MLt=function t(A){for(var e="",i=0;i<A.length;i++){var o=A[i];if(o!=null){var n=void 0;switch(typeof o){case"boolean":break;case"object":{if(Array.isArray(o))n=t(o);else{n="";for(var s in o)o[s]&&s&&(n&&(n+=" "),n+=s)}break}default:n=o}n&&(e&&(e+=" "),e+=n)}}return e},vLt=NLt({key:"css"}),JM=vLt.css,ULt=Object.create,ooe=Object.defineProperty,LLt=Object.getOwnPropertyDescriptor,noe=Object.getOwnPropertyNames,HLt=Object.getPrototypeOf,YLt=Object.prototype.hasOwnProperty,Ga=(t,A)=>function(){return A||(0,t[noe(t)[0]])((A={exports:{}}).exports,A),A.exports},JLt=(t,A,e,i)=>{if(A&&typeof A=="object"||typeof A=="function")for(let o of noe(A))!YLt.call(t,o)&&o!==e&&ooe(t,o,{get:()=>A[o],enumerable:!(i=LLt(A,o))||i.enumerable});return t},soe=(t,A,e)=>(e=t!=null?ULt(HLt(t)):{},JLt(ooe(e,"default",{value:t,enumerable:!0}),t)),TLt=Ga({"node_modules/svgson/dist/svgson.umd.js"(t,A){(function(e,i){typeof t=="object"&&typeof A<"u"?A.exports=i():typeof define=="function"&&define.amd?define(i):(e=typeof globalThis<"u"?globalThis:e||self,e.svgson=i())})(t,function(){var e=function(tA){return tA!=null&&(i(tA)||o(tA)||!!tA._isBuffer)};function i(tA){return!!tA.constructor&&typeof tA.constructor.isBuffer=="function"&&tA.constructor.isBuffer(tA)}function o(tA){return typeof tA.readFloatLE=="function"&&typeof tA.slice=="function"&&i(tA.slice(0,0))}var n=Object.prototype.toString,s=function(iA){if(typeof iA>"u")return"undefined";if(iA===null)return"null";if(iA===!0||iA===!1||iA instanceof Boolean)return"boolean";if(typeof iA=="string"||iA instanceof String)return"string";if(typeof iA=="number"||iA instanceof Number)return"number";if(typeof iA=="function"||iA instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(iA))return"array";if(iA instanceof RegExp)return"regexp";if(iA instanceof Date)return"date";var rA=n.call(iA);return rA==="[object RegExp]"?"regexp":rA==="[object Date]"?"date":rA==="[object Arguments]"?"arguments":rA==="[object Error]"?"error":e(iA)?"buffer":rA==="[object Set]"?"set":rA==="[object WeakSet]"?"weakset":rA==="[object Map]"?"map":rA==="[object WeakMap]"?"weakmap":rA==="[object Symbol]"?"symbol":rA==="[object Int8Array]"?"int8array":rA==="[object Uint8Array]"?"uint8array":rA==="[object Uint8ClampedArray]"?"uint8clampedarray":rA==="[object Int16Array]"?"int16array":rA==="[object Uint16Array]"?"uint16array":rA==="[object Int32Array]"?"int32array":rA==="[object Uint32Array]"?"uint32array":rA==="[object Float32Array]"?"float32array":rA==="[object Float64Array]"?"float64array":"object"};function r(tA,iA){return iA={exports:{}},tA(iA,iA.exports),iA.exports}var a=r(function(tA){(function(){function iA(rA,CA){if(typeof CA!="function")return rA;var pA={};for(var kA in rA)Object.prototype.hasOwnProperty.call(rA,kA)&&(pA[CA(kA,rA[kA])||kA]=rA[kA]);return pA}tA.exports?tA.exports=iA:window.rename=iA})()}),g=function tA(iA,rA){var CA=s(iA);if(CA!=="object"&&CA!=="array")throw new Error("expected an object");var pA=[];CA==="object"&&(iA=a(iA,rA),pA={});for(var kA in iA)if(iA.hasOwnProperty(kA)){var _A=iA[kA];s(_A)==="object"||s(_A)==="array"?pA[kA]=tA(_A,rA):pA[kA]=_A}return pA},I=r(function(tA){var iA=Object.prototype.hasOwnProperty,rA="~";function CA(){}Object.create&&(CA.prototype=Object.create(null),new CA().__proto__||(rA=!1));function pA(_A,TA,gA){this.fn=_A,this.context=TA,this.once=gA||!1}function kA(){this._events=new CA,this._eventsCount=0}kA.prototype.eventNames=function(){var TA=[],gA,mA;if(this._eventsCount===0)return TA;for(mA in gA=this._events)iA.call(gA,mA)&&TA.push(rA?mA.slice(1):mA);return Object.getOwnPropertySymbols?TA.concat(Object.getOwnPropertySymbols(gA)):TA},kA.prototype.listeners=function(TA,gA){var mA=rA?rA+TA:TA,dA=this._events[mA];if(gA)return!!dA;if(!dA)return[];if(dA.fn)return[dA.fn];for(var PA=0,Ae=dA.length,ne=new Array(Ae);PA<Ae;PA++)ne[PA]=dA[PA].fn;return ne},kA.prototype.emit=function(TA,gA,mA,dA,PA,Ae){var ne=rA?rA+TA:TA;if(!this._events[ne])return!1;var wA=this._events[ne],OA=arguments.length,KA,YA;if(wA.fn){switch(wA.once&&this.removeListener(TA,wA.fn,void 0,!0),OA){case 1:return wA.fn.call(wA.context),!0;case 2:return wA.fn.call(wA.context,gA),!0;case 3:return wA.fn.call(wA.context,gA,mA),!0;case 4:return wA.fn.call(wA.context,gA,mA,dA),!0;case 5:return wA.fn.call(wA.context,gA,mA,dA,PA),!0;case 6:return wA.fn.call(wA.context,gA,mA,dA,PA,Ae),!0}for(YA=1,KA=new Array(OA-1);YA<OA;YA++)KA[YA-1]=arguments[YA];wA.fn.apply(wA.context,KA)}else{var jA=wA.length,RA;for(YA=0;YA<jA;YA++)switch(wA[YA].once&&this.removeListener(TA,wA[YA].fn,void 0,!0),OA){case 1:wA[YA].fn.call(wA[YA].context);break;case 2:wA[YA].fn.call(wA[YA].context,gA);break;case 3:wA[YA].fn.call(wA[YA].context,gA,mA);break;case 4:wA[YA].fn.call(wA[YA].context,gA,mA,dA);break;default:if(!KA)for(RA=1,KA=new Array(OA-1);RA<OA;RA++)KA[RA-1]=arguments[RA];wA[YA].fn.apply(wA[YA].context,KA)}}return!0},kA.prototype.on=function(TA,gA,mA){var dA=new pA(gA,mA||this),PA=rA?rA+TA:TA;return this._events[PA]?this._events[PA].fn?this._events[PA]=[this._events[PA],dA]:this._events[PA].push(dA):(this._events[PA]=dA,this._eventsCount++),this},kA.prototype.once=function(TA,gA,mA){var dA=new pA(gA,mA||this,!0),PA=rA?rA+TA:TA;return this._events[PA]?this._events[PA].fn?this._events[PA]=[this._events[PA],dA]:this._events[PA].push(dA):(this._events[PA]=dA,this._eventsCount++),this},kA.prototype.removeListener=function(TA,gA,mA,dA){var PA=rA?rA+TA:TA;if(!this._events[PA])return this;if(!gA)return--this._eventsCount===0?this._events=new CA:delete this._events[PA],this;var Ae=this._events[PA];if(Ae.fn)Ae.fn===gA&&(!dA||Ae.once)&&(!mA||Ae.context===mA)&&(--this._eventsCount===0?this._events=new CA:delete this._events[PA]);else{for(var ne=0,wA=[],OA=Ae.length;ne<OA;ne++)(Ae[ne].fn!==gA||dA&&!Ae[ne].once||mA&&Ae[ne].context!==mA)&&wA.push(Ae[ne]);wA.length?this._events[PA]=wA.length===1?wA[0]:wA:--this._eventsCount===0?this._events=new CA:delete this._events[PA]}return this},kA.prototype.removeAllListeners=function(TA){var gA;return TA?(gA=rA?rA+TA:TA,this._events[gA]&&(--this._eventsCount===0?this._events=new CA:delete this._events[gA])):(this._events=new CA,this._eventsCount=0),this},kA.prototype.off=kA.prototype.removeListener,kA.prototype.addListener=kA.prototype.on,kA.prototype.setMaxListeners=function(){return this},kA.prefixed=rA,kA.EventEmitter=kA,tA.exports=kA});function c(tA,iA,rA){return iA in tA?Object.defineProperty(tA,iA,{value:rA,enumerable:!0,configurable:!0,writable:!0}):tA[iA]=rA,tA}var B=function(){},l={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},C={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},Q={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},E={" ":C.space," ":C.space,"\n":C.space,"\r":C.space,"<":C.lt,">":C.gt,'"':C.quote,"'":C.quote,"=":C.equal,"/":C.slash},h=function(iA){return E[iA]||C.char},u=function(iA){var rA,CA,pA,kA,_A,TA,gA,mA,dA,PA;iA=Object.assign({debug:!1},iA);var Ae=new I,ne=l.data,wA="",OA="",KA="",YA="",jA="",RA="",bA=function(qA,WA){if(!(OA[0]==="?"||OA[0]==="!")){var ie={type:qA,value:WA};iA.debug&&console.log("emit:",ie),Ae.emit("data",ie)}};Ae.stateMachine=(PA={},c(PA,l.data,(rA={},c(rA,C.lt,function(){wA.trim()&&bA(Q.text,wA),OA="",jA=!1,ne=l.tagBegin}),c(rA,C.char,function(FA){wA+=FA}),rA)),c(PA,l.cdata,c({},C.char,function(FA){wA+=FA,wA.substr(-3)==="]]>"&&(bA(Q.text,wA.slice(0,-3)),wA="",ne=l.data)})),c(PA,l.tagBegin,(CA={},c(CA,C.space,B),c(CA,C.char,function(FA){OA=FA,ne=l.tagName}),c(CA,C.slash,function(){OA="",jA=!0}),CA)),c(PA,l.tagName,(pA={},c(pA,C.space,function(){jA?ne=l.tagEnd:(ne=l.attributeNameStart,bA(Q.openTag,OA))}),c(pA,C.gt,function(){bA(jA?Q.closeTag:Q.openTag,OA),wA="",ne=l.data}),c(pA,C.slash,function(){ne=l.tagEnd,bA(Q.openTag,OA)}),c(pA,C.char,function(FA){OA+=FA,OA==="![CDATA["&&(ne=l.cdata,wA="",OA="")}),pA)),c(PA,l.tagEnd,(kA={},c(kA,C.gt,function(){bA(Q.closeTag,OA),wA="",ne=l.data}),c(kA,C.char,B),kA)),c(PA,l.attributeNameStart,(_A={},c(_A,C.char,function(FA){KA=FA,ne=l.attributeName}),c(_A,C.gt,function(){wA="",ne=l.data}),c(_A,C.space,B),c(_A,C.slash,function(){jA=!0,ne=l.tagEnd}),_A)),c(PA,l.attributeName,(TA={},c(TA,C.space,function(){ne=l.attributeNameEnd}),c(TA,C.equal,function(){bA(Q.attributeName,KA),ne=l.attributeValueBegin}),c(TA,C.gt,function(){YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),wA="",ne=l.data}),c(TA,C.slash,function(){jA=!0,YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),ne=l.tagEnd}),c(TA,C.char,function(FA){KA+=FA}),TA)),c(PA,l.attributeNameEnd,(gA={},c(gA,C.space,B),c(gA,C.equal,function(){bA(Q.attributeName,KA),ne=l.attributeValueBegin}),c(gA,C.gt,function(){YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),wA="",ne=l.data}),c(gA,C.char,function(FA){YA="",bA(Q.attributeName,KA),bA(Q.attributeValue,YA),KA=FA,ne=l.attributeName}),gA)),c(PA,l.attributeValueBegin,(mA={},c(mA,C.space,B),c(mA,C.quote,function(FA){RA=FA,YA="",ne=l.attributeValue}),c(mA,C.gt,function(){YA="",bA(Q.attributeValue,YA),wA="",ne=l.data}),c(mA,C.char,function(FA){RA="",YA=FA,ne=l.attributeValue}),mA)),c(PA,l.attributeValue,(dA={},c(dA,C.space,function(FA){RA?YA+=FA:(bA(Q.attributeValue,YA),ne=l.attributeNameStart)}),c(dA,C.quote,function(FA){RA===FA?(bA(Q.attributeValue,YA),ne=l.attributeNameStart):YA+=FA}),c(dA,C.gt,function(FA){RA?YA+=FA:(bA(Q.attributeValue,YA),wA="",ne=l.data)}),c(dA,C.slash,function(FA){RA?YA+=FA:(bA(Q.attributeValue,YA),jA=!0,ne=l.tagEnd)}),c(dA,C.char,function(FA){YA+=FA}),dA)),PA);var LA=function(qA){iA.debug&&console.log(ne,qA);var WA=Ae.stateMachine[ne],ie=WA[h(qA)]||WA[C.error]||WA[C.char];ie(qA)};return Ae.write=function(FA){for(var qA=FA.length,WA=0;WA<qA;WA++)LA(FA[WA])},Ae},d={State:l,Action:C,Type:Q,create:u},f=d.Type,w={element:"element",text:"text"},D=function(iA){return Object.assign({name:"",type:w.element,value:"",parent:null,attributes:{},children:[]},iA)},S=function(iA){iA=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},iA);var rA=void 0,CA=void 0,pA=void 0,kA=void 0,_A=new I,TA=function(mA){switch(mA.type){case f.openTag:if(pA===null)pA=CA,pA.name=mA.value;else{var dA=D({name:mA.value,parent:pA});pA.children.push(dA),pA=dA}break;case f.closeTag:var PA=pA.parent;if(iA.parentNodes||(pA.parent=null),pA.name!==mA.value)break;iA.stream&&PA===CA&&(CA.children=[],pA.parent=null),(!iA.emitTopLevelOnly||PA===CA)&&(_A.emit(iA.tagPrefix+pA.name,pA),_A.emit("tag",pA.name,pA)),pA===CA&&(rA.removeAllListeners("data"),_A.emit(iA.doneEvent,pA),CA=null),pA=PA;break;case f.text:pA&&pA.children.push(D({type:w.text,value:mA.value,parent:iA.parentNodes?pA:null}));break;case f.attributeName:kA=mA.value,pA.attributes[kA]="";break;case f.attributeValue:pA.attributes[kA]=mA.value;break}};return _A.reset=function(){rA=d.create({debug:iA.debug}),rA.on("data",TA),CA=D(),pA=null,kA="",_A.parse=rA.write},_A.reset(),_A},x=function(iA,rA){rA=Object.assign({},rA,{stream:!1,tagPrefix:":"});var CA=S(rA),pA=void 0;return CA.on("done",function(kA){pA=kA}),CA.parse(iA),pA},F={parseSync:x},k=F.parseSync,U=function(iA){var rA=k("<root>".concat(iA,"</root>"),{parentNodes:!1}),CA=rA.children&&rA.children.length>0&&rA.children.every(function(pA){return pA.name==="svg"});if(CA)return rA.children.length===1?rA.children[0]:rA.children;throw Error("nothing to parse")},N=function(iA){return g(iA,function(rA){return K(rA)?rA:Y(rA)})},Y=function(iA){return iA.replace(/[-|:]([a-z])/gi,function(rA,CA){return CA.toUpperCase()})},K=function(iA){return/^(data|aria)(-\w+)/.test(iA)},J=function(iA){if(iA){var rA=String(iA);return/[&<>]/.test(rA)?"<![CDATA[".concat(rA.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):rA}return""},W=function(iA){return String(iA).replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},Z=function(iA){var rA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},CA=rA.transformNode,pA=CA===void 0?function(gA){return gA}:CA,kA=rA.camelcase,_A=kA===void 0?!1:kA,TA=function(mA){var dA;return dA=pA(mA),_A&&(dA=N(dA)),dA};return TA(U(iA))};function AA(){for(var tA=arguments.length,iA=new Array(tA),rA=0;rA<tA;rA++)iA[rA]=arguments[rA];return new Promise(function(CA,pA){try{var kA=Z.apply(void 0,iA);CA(kA)}catch(_A){pA(_A)}})}var nA=function tA(iA){var rA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},CA=rA.transformAttr,pA=CA===void 0?function(ne,wA,OA){return"".concat(ne,'="').concat(OA(wA),'"')}:CA,kA=rA.transformNode,_A=kA===void 0?function(ne){return ne}:kA,TA=rA.selfClose,gA=TA===void 0?!0:TA;if(Array.isArray(iA))return iA.map(function(ne){return tA(ne,{transformAttr:pA,selfClose:gA,transformNode:_A})}).join("");var mA=_A(iA);if(mA.type==="text")return J(mA.value);var dA="";for(var PA in mA.attributes){var Ae=pA(PA,mA.attributes[PA],W,mA.name);dA+=Ae?" ".concat(Ae):""}return mA.children&&mA.children.length>0||!gA?"<".concat(mA.name).concat(dA,">").concat(tA(mA.children,{transformAttr:pA,transformNode:_A,selfClose:gA}),"</").concat(mA.name,">"):"<".concat(mA.name).concat(dA,"/>")},cA=Object.assign({},{parse:AA,parseSync:Z,stringify:nA});return cA})}}),QhA=Ga({"node_modules/js-beautify/js/src/core/output.js"(t,A){function e(n){this.__parent=n,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}e.prototype.clone_empty=function(){var n=new e(this.__parent);return n.set_indent(this.__indent_count,this.__alignment_count),n},e.prototype.item=function(n){return n<0?this.__items[this.__items.length+n]:this.__items[n]},e.prototype.has_match=function(n){for(var s=this.__items.length-1;s>=0;s--)if(this.__items[s].match(n))return!0;return!1},e.prototype.set_indent=function(n,s){this.is_empty()&&(this.__indent_count=n||0,this.__alignment_count=s||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},e.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},e.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},e.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var n=this.__parent.current_line;return n.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),n.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),n.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,n.__items[0]===" "&&(n.__items.splice(0,1),n.__character_count-=1),!0}return!1},e.prototype.is_empty=function(){return this.__items.length===0},e.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},e.prototype.push=function(n){this.__items.push(n);var s=n.lastIndexOf(`
5304
5304
  `);s!==-1?this.__character_count=n.length-s:this.__character_count+=n.length},e.prototype.pop=function(){var n=null;return this.is_empty()||(n=this.__items.pop(),this.__character_count-=n.length),n},e.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},e.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},e.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},e.prototype.toString=function(){var n="";return this.is_empty()?this.__parent.indent_empty_lines&&(n=this.__parent.get_indent_string(this.__indent_count)):(n=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),n+=this.__items.join("")),n};function i(n,s){this.__cache=[""],this.__indent_size=n.indent_size,this.__indent_string=n.indent_char,n.indent_with_tabs||(this.__indent_string=new Array(n.indent_size+1).join(n.indent_char)),s=s||"",n.indent_level>0&&(s=new Array(n.indent_level+1).join(this.__indent_string)),this.__base_string=s,this.__base_string_length=s.length}i.prototype.get_indent_size=function(n,s){var r=this.__base_string_length;return s=s||0,n<0&&(r=0),r+=n*this.__indent_size,r+=s,r},i.prototype.get_indent_string=function(n,s){var r=this.__base_string;return s=s||0,n<0&&(n=0,r=""),s+=n*this.__indent_size,this.__ensure_cache(s),r+=this.__cache[s],r},i.prototype.__ensure_cache=function(n){for(;n>=this.__cache.length;)this.__add_column()},i.prototype.__add_column=function(){var n=this.__cache.length,s=0,r="";this.__indent_size&&n>=this.__indent_size&&(s=Math.floor(n/this.__indent_size),n-=s*this.__indent_size,r=new Array(s+1).join(this.__indent_string)),n&&(r+=new Array(n+1).join(" ")),this.__cache.push(r)};function o(n,s){this.__indent_cache=new i(n,s),this.raw=!1,this._end_with_newline=n.end_with_newline,this.indent_size=n.indent_size,this.wrap_line_length=n.wrap_line_length,this.indent_empty_lines=n.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new e(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}o.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},o.prototype.get_line_number=function(){return this.__lines.length},o.prototype.get_indent_string=function(n,s){return this.__indent_cache.get_indent_string(n,s)},o.prototype.get_indent_size=function(n,s){return this.__indent_cache.get_indent_size(n,s)},o.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},o.prototype.add_new_line=function(n){return this.is_empty()||!n&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},o.prototype.get_code=function(n){this.trim(!0);var s=this.current_line.pop();s&&(s[s.length-1]===`
5305
5305
  `&&(s=s.replace(/\n+$/g,"")),this.current_line.push(s)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
5306
5306
  `);return n!==`
@@ -5602,7 +5602,7 @@ test("${g} should solve problem correctly", () => {
5602
5602
  // Add more specific assertions based on expected output
5603
5603
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5604
5604
  })
5605
- `,c=new Blob([I],{type:"text/plain"}),B=URL.createObjectURL(c),l=document.createElement("a");l.href=B,l.download=`${g}.test.ts`,l.click(),URL.revokeObjectURL(B)}catch(a){alert(`Error generating test.ts for ${t.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return O.jsxs("div",{className:`relative ${A}`,ref:o,children:[O.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!e),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),e&&O.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:[O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:n,children:"Download JSON"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},Zoe=t=>t.activeSubSolver?[t,...Zoe(t.activeSubSolver)]:[t],lTt=({solver:t})=>{const A=Zoe(t);return O.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((e,i)=>O.jsxs("div",{className:"flex items-center",children:[i>0&&O.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),O.jsx(BTt,{solver:e})]},e.constructor.name))})},CTt=({solver:t,triggerRender:A,animationSpeed:e=25,onSolverStarted:i,onSolverCompleted:o})=>{const[n,s]=z.useReducer(Q=>!Q,!1),r=z.useRef(void 0),a=()=>{!t.solved&&!t.failed&&(t.step(),A())},g=()=>{!t.solved&&!t.failed&&(i&&i(t),t.solve(),A(),o&&o(t))},I=()=>{n?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(t.solved||t.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),o&&t.solved&&o(t);return}t.step(),A()},e))},c=()=>{const Q=t;if(Q.getCurrentPhase&&!t.solved&&!t.failed){const E=Q.getCurrentPhase();for(;Q.getCurrentPhase()===E&&!t.solved&&!t.failed;)t.step();A()}},B=()=>{if(t.solved||t.failed||n)return;const Q=window.prompt("Step until which iteration?",`${t.iterations}`);if(Q===null)return;const E=Number(Q);if(!Number.isFinite(E)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<E&&!t.solved&&!t.failed;)t.step();A(),t.solved&&o&&o(t)};z.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),z.useEffect(()=>{(t.solved||t.failed)&&n&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[t.solved,t.failed,n]);const l=t.getCurrentPhase!==void 0,C=l?t.getCurrentPhase():null;return O.jsxs("div",{className:"space-y-2 p-2 border-b",children:[O.jsx("div",{className:"flex items-center",children:O.jsx(lTt,{solver:t})}),O.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[O.jsx("button",{onClick:a,disabled:t.solved||t.failed||n,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),O.jsx("button",{onClick:g,disabled:t.solved||t.failed||n,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),O.jsx("button",{onClick:I,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${n?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:n?"Stop":"Animate"}),O.jsx("button",{onClick:B,disabled:t.solved||t.failed||n,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"}),l&&O.jsx("button",{onClick:c,disabled:t.solved||t.failed||n,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),O.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),C&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",O.jsx("span",{className:"font-medium",children:C})]}),t.solved&&O.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&O.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&O.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},QTt=(t,A,e)=>{const i=t.currentPipelineStepIndex;return A<i?"Completed":A===i&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},ETt=(t,A)=>{const i=t.pipelineDef[A].solverName,o=QTt(t,A),n=t[i],s=t.firstIterationOfPhase?.[i]??null,r=t.iterations;let a=0;if(o==="Completed"){const B=t.pipelineDef[A+1],l=B?t.firstIterationOfPhase?.[B.solverName]:void 0;l!==void 0&&s!==null?a=l-s:s!==null&&(a=r-s)}else o==="In Progress"&&s!==null&&(a=r-s);const g=t.timeSpentOnPhase?.[i]??0;let I=0;o==="Completed"?I=1:o==="In Progress"&&n&&(I=n.progress??0);const c=n?.stats??null;return{index:A,name:i,status:o,firstIteration:s,iterations:a,progress:I,timeSpent:g,stats:c&&Object.keys(c).length>0?c:null,solverInstance:n??null}},hTt=({status:t})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return O.jsx("span",{className:`font-medium ${A[t]}`,children:t})},uTt=({progress:t})=>{if(t===0)return null;const A=Math.round(t*100);return O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:O.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),O.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},dTt=t=>Object.entries(t).map(([A,e])=>`${A}: ${e}`).join(", "),pTt=({stats:t})=>{if(!t||Object.keys(t).length===0)return O.jsx("span",{children:"-"});const A=Object.entries(t),e=dTt(t);return O.jsxs("details",{className:"cursor-pointer",children:[O.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:e}),O.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,o])=>O.jsxs("div",{children:[i,": ",String(o)]},i))})]})},GhA=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(GhA);const A={};for(const[e,i]of Object.entries(t))e.startsWith("_")||(A[e]=GhA(i));return A},fTt=(t,A)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const e=GhA(t.getConstructorParams()),i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),o=URL.createObjectURL(i),n=document.createElement("a");n.href=o,n.download=`${A}_input.json`,n.click(),URL.revokeObjectURL(o)}catch(e){alert(`Error downloading input for ${A}: ${e instanceof Error?e.message:String(e)}`)}},yTt=({solver:t,onStepUntilPhase:A,onDownloadInput:e})=>{const i=t.pipelineDef.map((r,a)=>ETt(t,a)),o=r=>{A?.(r)},n=r=>{r.solverInstance&&(e?e(r.solverInstance,r.name):fTt(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return O.jsxs("div",{className:"border-t border-gray-200",children:[O.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:O.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),O.jsx("div",{className:"overflow-x-auto",children:O.jsxs("table",{className:"w-full text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),O.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",O.jsx("sub",{children:"0"})]}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),O.jsx("tbody",{children:i.map(r=>O.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[O.jsx("td",{className:"px-4 py-2",children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),O.jsx("button",{onClick:()=>o(r.name),disabled:r.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.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"})})}),O.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(hTt,{status:r.status})}),O.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(uTt,{progress:r.progress})}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),O.jsx("td",{className:"px-4 py-2 text-gray-500",children:O.jsx(pTt,{stats:r.stats})}),O.jsx("td",{className:"px-4 py-2",children:r.solverInstance?O.jsxs("button",{onClick:()=>n(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.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"})}),O.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},mTt=class extends to.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function wTt({graphics:t}){const A=t.points??[],e=t.lines??[],i=t.rects??[],o=t.circles??[],n=t.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const I=(E,h)=>{typeof E=="number"&&(E<s&&(s=E),E>a&&(a=E)),typeof h=="number"&&(h<r&&(r=h),h>g&&(g=h))};for(const E of A)I(E.x,E.y);for(const E of e){const h=E.points??[];for(const u of h)I(u.x,u.y)}for(const E of i){const h=E.x??0,u=E.y??0,d=E.width??0,f=E.height??0;I(h,u),I(h+d,u+f)}for(const E of o){const h=E.x??0,u=E.y??0,d=E.radius??1;I(h-d,u-d),I(h+d,u+d)}for(const E of n)I(E.x,E.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const c=10,B=s-c,l=r-c,C=Math.max(1,a-s+2*c),Q=Math.max(1,g-r+2*c);return O.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${B} ${l} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((E,h)=>O.jsx("rect",{x:E.x??0,y:E.y??0,width:E.width??0,height:E.height??0,fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`rect-${h}`)),e.map((E,h)=>O.jsx("polyline",{fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1,points:(E.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${h}`)),o.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.fillColor??"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`circle-${h}`)),A.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.color??"black"},`point-${h}`)),n.map((E,h)=>O.jsx("text",{x:E.x??0,y:E.y??0,fontSize:E.fontSize??10,fill:E.color??"black",children:E.text??""},`text-${h}`))]})}var DTt=({solver:t,animationSpeed:A=25,onSolverStarted:e,onSolverCompleted:i})=>{const[o,n]=z.useReducer(I=>I+1,0),s=z.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(I){return console.error("Visualization error:",I),{points:[],lines:[],rects:[],circles:[]}}},[t,o]),r=z.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);z.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const I=document.createElement("script");I.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(I)}},[]);const a=t.pipelineDef!==void 0,g=I=>{const c=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&c.currentPipelineStepIndex<=c.pipelineDef.findIndex(B=>B.solverName===I);)t.step();n()}};return O.jsxs("div",{children:[O.jsx(CTt,{solver:t,triggerRender:n,animationSpeed:A,onSolverStarted:e,onSolverCompleted:i}),r?O.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):O.jsx(mTt,{fallback:O.jsx(wTt,{graphics:s}),children:O.jsx(cTt,{graphics:s})}),a&&O.jsx(yTt,{solver:t,onStepUntilPhase:g})]})};const STt=()=>{z.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const e=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),e)return;const i=document.createElement("script");i.id=t,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},bTt=t=>t.toLowerCase().includes("pack")?PSt:t.toLowerCase().includes("rout")?jSt:xSt,xTt=({solverEvents:t=[]})=>{const[A,e]=z.useState(null);STt();const i=z.useMemo(()=>{const r=new Map;for(const a of t){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[t]),o=z.useMemo(()=>Array.from(i.keys()),[i]),n=A?i.get(A):null,s=z.useMemo(()=>{if(!n)return{instance:null,error:null,classFound:!1};const r=reA[n.solverName];if(!r)return{instance:null,error:`Solver class "${n.solverName}" not found in SOLVERS registry. Available: ${Object.keys(reA).join(", ")}`,classFound:!1};try{const a=n.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}}},[n]);return t.length===0?O.jsx("div",{className:"rf-p-4",children:O.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:O.jsxs("div",{className:"rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),O.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."})]})})}):O.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[O.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[O.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:[o.length," ",o.length===1?"Solver":"Solvers"]}),o.map(r=>{const a=i.get(r),g=A===r;return O.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:()=>e(r),children:(()=>{const I=bTt(a.solverName);return O.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[O.jsx(I,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),O.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[O.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),O.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),O.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:n?s.instance?O.jsx(yy,{fallback:O.jsx("div",{className:"rf-p-4",children:O.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),O.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",n.solverName]})]})}),children:O.jsx(DTt,{solver:s.instance})}):O.jsxs("div",{className:"rf-p-4",children:[O.jsxs("div",{className:"rf-mb-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:n.solverName}),O.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",n.componentName]})]}),s.error&&O.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:O.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),O.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[O.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:O.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),O.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:O.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(n.solverParams,null,2)})})]})]}):O.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:O.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},Voe=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{z.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{Q3.captureException(i)}catch{}}},[t,A]),z.useEffect(()=>{if(e&&e.length>0)for(const i of e){const o=new Error(i.message||"Circuit JSON Error");i.stack&&(o.stack=i.stack);try{Q3.captureException(o,{error_type:i.type})}catch{}}},[e])},joe="0.0.1431",kTt={version:joe},AZ=zvA()(XvA(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),GTt=t=>{const[A,e]=z.useState([]),[i,o]=z.useState(null),[n,s]=z.useState(""),[r,a]=KM("eval-version-selection",null),g=AZ(l=>l.setLastRunEvalVersion),I=AZ(l=>l.lastRunEvalVersion);return z.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(l=>l.json()).then(l=>{if(Array.isArray(l?.versions)){let C=[...l.versions];l.tags?.latest&&(o(l.tags.latest),C=C.filter(Q=>Q!==l.tags.latest)),e(C)}}).catch(()=>{})},[t]),z.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[t,r,i]),{versions:z.useMemo(()=>A.filter(l=>l.includes(n)).slice(0,50),[A,n]),latestVersion:i,lastRunEvalVersion:I,search:n,setSearch:s,selectVersion:l=>{a(l),s("")}}},FTt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[o,n]=z.useState(""),[s,r]=z.useState("");if(!i)return null;const a=t.filter(c=>c.toLowerCase().includes(s.toLowerCase())),g=s&&!t.includes(s),I=c=>{c.key==="Enter"&&(a.length===1?n(a[0]):g&&n(s))};return O.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:O.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[O.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),O.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:c=>r(c.target.value),onKeyDown:I}),O.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[a.map(c=>O.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${o===c?"bg-blue-50":""}`,onClick:()=>n(c),children:c},c)),g&&O.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${o===s?"bg-blue-50":""}`,onClick:()=>n(s),children:['Create new "',s,'"']})]}),O.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:e,children:"Cancel"}),O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>o&&A(o),disabled:!o,children:o===s?`Create "${o}"`:`Save to ${o}`})]})]})})},_Tt=t=>{const A=z.useRef(null),e=Tc(i=>i.recentEvents);z.useEffect(()=>{if(e.length===0)return;const i=e[0];i.event_id!==A.current&&(t(i),A.current=i.event_id)},[e,t])};function RTt(t){const A=NTt(t),e=z.forwardRef((i,o)=>{const{children:n,...s}=i,r=z.Children.toArray(n),a=r.find(vTt);if(a){const g=a.props.children,I=r.map(c=>c===a?z.Children.count(g)>1?z.Children.only(null):z.isValidElement(g)?g.props.children:null:c);return O.jsx(A,{...s,ref:o,children:z.isValidElement(g)?z.cloneElement(g,void 0,I):null})}return O.jsx(A,{...s,ref:o,children:n})});return e.displayName=`${t}.Slot`,e}function NTt(t){const A=z.forwardRef((e,i)=>{const{children:o,...n}=e;if(z.isValidElement(o)){const s=LTt(o),r=UTt(n,o.props);return o.type!==z.Fragment&&(r.ref=i?Pp(i,s):s),z.cloneElement(o,r)}return z.Children.count(o)>1?z.Children.only(null):null});return A.displayName=`${t}.SlotClone`,A}var MTt=Symbol("radix.slottable");function vTt(t){return z.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===MTt}function UTt(t,A){const e={...A};for(const i in A){const o=t[i],n=A[i];/^on[A-Z]/.test(i)?o&&n?e[i]=(...r)=>{const a=n(...r);return o(...r),a}:o&&(e[i]=o):i==="style"?e[i]={...o,...n}:i==="className"&&(e[i]=[o,n].filter(Boolean).join(" "))}return{...t,...e}}function LTt(t){let A=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning;return e?t.ref:(A=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var eZ="Dialog",[zoe,Xoe]=fw(eZ),[HTt,Lm]=zoe(eZ),$oe=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:o,onOpenChange:n,modal:s=!0}=t,r=z.useRef(null),a=z.useRef(null),[g,I]=QG({prop:i,defaultProp:o??!1,onChange:n,caller:eZ});return O.jsx(HTt,{scope:A,triggerRef:r,contentRef:a,contentId:mu(),titleId:mu(),descriptionId:mu(),open:g,onOpenChange:I,onOpenToggle:z.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};$oe.displayName=eZ;var Ane="DialogTrigger",ene=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(Ane,e),n=wB(A,o.triggerRef);return O.jsx(pg.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":RhA(o.open),...i,ref:n,onClick:Qn(t.onClick,o.onOpenToggle)})});ene.displayName=Ane;var FhA="DialogPortal",[YTt,tne]=zoe(FhA,{forceMount:void 0}),ine=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:o}=t,n=Lm(FhA,A);return O.jsx(YTt,{scope:A,forceMount:e,children:z.Children.map(i,s=>O.jsx(cy,{present:e||n.open,children:O.jsx(f8,{asChild:!0,container:o,children:s})}))})};ine.displayName=FhA;var tZ="DialogOverlay",one=z.forwardRef((t,A)=>{const e=tne(tZ,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Lm(tZ,t.__scopeDialog);return n.modal?O.jsx(cy,{present:i||n.open,children:O.jsx(TTt,{...o,ref:A})}):null});one.displayName=tZ;var JTt=RTt("DialogOverlay.RemoveScroll"),TTt=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(tZ,e);return O.jsx(k8,{as:JTt,allowPinchZoom:!0,shards:[o.contentRef],children:O.jsx(pg.div,{"data-state":RhA(o.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),wF="DialogContent",nne=z.forwardRef((t,A)=>{const e=tne(wF,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Lm(wF,t.__scopeDialog);return O.jsx(cy,{present:i||n.open,children:n.modal?O.jsx(KTt,{...o,ref:A}):O.jsx(qTt,{...o,ref:A})})});nne.displayName=wF;var KTt=z.forwardRef((t,A)=>{const e=Lm(wF,t.__scopeDialog),i=z.useRef(null),o=wB(A,e.contentRef,i);return z.useEffect(()=>{const n=i.current;if(n)return sQA(n)},[]),O.jsx(sne,{...t,ref:o,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qn(t.onCloseAutoFocus,n=>{n.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:Qn(t.onPointerDownOutside,n=>{const s=n.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&n.preventDefault()}),onFocusOutside:Qn(t.onFocusOutside,n=>n.preventDefault())})}),qTt=z.forwardRef((t,A)=>{const e=Lm(wF,t.__scopeDialog),i=z.useRef(!1),o=z.useRef(!1);return O.jsx(sne,{...t,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:n=>{t.onCloseAutoFocus?.(n),n.defaultPrevented||(i.current||e.triggerRef.current?.focus(),n.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:n=>{t.onInteractOutside?.(n),n.defaultPrevented||(i.current=!0,n.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=n.target;e.triggerRef.current?.contains(s)&&n.preventDefault(),n.detail.originalEvent.type==="focusin"&&o.current&&n.preventDefault()}})}),sne=z.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:n,...s}=t,r=Lm(wF,e),a=z.useRef(null),g=wB(A,a);return JCA(),O.jsxs(O.Fragment,{children:[O.jsx(g8,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:n,children:O.jsx(a8,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":RhA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),O.jsxs(O.Fragment,{children:[O.jsx(OTt,{titleId:r.titleId}),O.jsx(ZTt,{contentRef:a,descriptionId:r.descriptionId})]})]})}),_hA="DialogTitle",rne=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(_hA,e);return O.jsx(pg.h2,{id:o.titleId,...i,ref:A})});rne.displayName=_hA;var ane="DialogDescription",gne=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(ane,e);return O.jsx(pg.p,{id:o.descriptionId,...i,ref:A})});gne.displayName=ane;var Ine="DialogClose",cne=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(Ine,e);return O.jsx(pg.button,{type:"button",...i,ref:A,onClick:Qn(t.onClick,()=>o.onOpenChange(!1))})});cne.displayName=Ine;function RhA(t){return t?"open":"closed"}var Bne="DialogTitleWarning",[PTt,lne]=R5e(Bne,{contentName:wF,titleName:_hA,docsSlug:"dialog"}),OTt=({titleId:t})=>{const A=lne(Bne),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5605
+ `,c=new Blob([I],{type:"text/plain"}),B=URL.createObjectURL(c),l=document.createElement("a");l.href=B,l.download=`${g}.test.ts`,l.click(),URL.revokeObjectURL(B)}catch(a){alert(`Error generating test.ts for ${t.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return O.jsxs("div",{className:`relative ${A}`,ref:o,children:[O.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!e),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),e&&O.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:[O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:n,children:"Download JSON"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},Zoe=t=>t.activeSubSolver?[t,...Zoe(t.activeSubSolver)]:[t],lTt=({solver:t})=>{const A=Zoe(t);return O.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((e,i)=>O.jsxs("div",{className:"flex items-center",children:[i>0&&O.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),O.jsx(BTt,{solver:e})]},e.constructor.name))})},CTt=({solver:t,triggerRender:A,animationSpeed:e=25,onSolverStarted:i,onSolverCompleted:o})=>{const[n,s]=z.useReducer(Q=>!Q,!1),r=z.useRef(void 0),a=()=>{!t.solved&&!t.failed&&(t.step(),A())},g=()=>{!t.solved&&!t.failed&&(i&&i(t),t.solve(),A(),o&&o(t))},I=()=>{n?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(t.solved||t.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),o&&t.solved&&o(t);return}t.step(),A()},e))},c=()=>{const Q=t;if(Q.getCurrentPhase&&!t.solved&&!t.failed){const E=Q.getCurrentPhase();for(;Q.getCurrentPhase()===E&&!t.solved&&!t.failed;)t.step();A()}},B=()=>{if(t.solved||t.failed||n)return;const Q=window.prompt("Step until which iteration?",`${t.iterations}`);if(Q===null)return;const E=Number(Q);if(!Number.isFinite(E)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<E&&!t.solved&&!t.failed;)t.step();A(),t.solved&&o&&o(t)};z.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),z.useEffect(()=>{(t.solved||t.failed)&&n&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[t.solved,t.failed,n]);const l=t.getCurrentPhase!==void 0,C=l?t.getCurrentPhase():null;return O.jsxs("div",{className:"space-y-2 p-2 border-b",children:[O.jsx("div",{className:"flex items-center",children:O.jsx(lTt,{solver:t})}),O.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[O.jsx("button",{onClick:a,disabled:t.solved||t.failed||n,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),O.jsx("button",{onClick:g,disabled:t.solved||t.failed||n,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),O.jsx("button",{onClick:I,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${n?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:n?"Stop":"Animate"}),O.jsx("button",{onClick:B,disabled:t.solved||t.failed||n,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"}),l&&O.jsx("button",{onClick:c,disabled:t.solved||t.failed||n,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),O.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),C&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",O.jsx("span",{className:"font-medium",children:C})]}),t.solved&&O.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&O.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&O.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},QTt=(t,A,e)=>{const i=t.currentPipelineStepIndex;return A<i?"Completed":A===i&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},ETt=(t,A)=>{const i=t.pipelineDef[A].solverName,o=QTt(t,A),n=t[i],s=t.firstIterationOfPhase?.[i]??null,r=t.iterations;let a=0;if(o==="Completed"){const B=t.pipelineDef[A+1],l=B?t.firstIterationOfPhase?.[B.solverName]:void 0;l!==void 0&&s!==null?a=l-s:s!==null&&(a=r-s)}else o==="In Progress"&&s!==null&&(a=r-s);const g=t.timeSpentOnPhase?.[i]??0;let I=0;o==="Completed"?I=1:o==="In Progress"&&n&&(I=n.progress??0);const c=n?.stats??null;return{index:A,name:i,status:o,firstIteration:s,iterations:a,progress:I,timeSpent:g,stats:c&&Object.keys(c).length>0?c:null,solverInstance:n??null}},hTt=({status:t})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return O.jsx("span",{className:`font-medium ${A[t]}`,children:t})},uTt=({progress:t})=>{if(t===0)return null;const A=Math.round(t*100);return O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:O.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),O.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},dTt=t=>Object.entries(t).map(([A,e])=>`${A}: ${e}`).join(", "),pTt=({stats:t})=>{if(!t||Object.keys(t).length===0)return O.jsx("span",{children:"-"});const A=Object.entries(t),e=dTt(t);return O.jsxs("details",{className:"cursor-pointer",children:[O.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:e}),O.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,o])=>O.jsxs("div",{children:[i,": ",String(o)]},i))})]})},GhA=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(GhA);const A={};for(const[e,i]of Object.entries(t))e.startsWith("_")||(A[e]=GhA(i));return A},fTt=(t,A)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const e=GhA(t.getConstructorParams()),i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),o=URL.createObjectURL(i),n=document.createElement("a");n.href=o,n.download=`${A}_input.json`,n.click(),URL.revokeObjectURL(o)}catch(e){alert(`Error downloading input for ${A}: ${e instanceof Error?e.message:String(e)}`)}},yTt=({solver:t,onStepUntilPhase:A,onDownloadInput:e})=>{const i=t.pipelineDef.map((r,a)=>ETt(t,a)),o=r=>{A?.(r)},n=r=>{r.solverInstance&&(e?e(r.solverInstance,r.name):fTt(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return O.jsxs("div",{className:"border-t border-gray-200",children:[O.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:O.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),O.jsx("div",{className:"overflow-x-auto",children:O.jsxs("table",{className:"w-full text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),O.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",O.jsx("sub",{children:"0"})]}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),O.jsx("tbody",{children:i.map(r=>O.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[O.jsx("td",{className:"px-4 py-2",children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),O.jsx("button",{onClick:()=>o(r.name),disabled:r.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.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"})})}),O.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(hTt,{status:r.status})}),O.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(uTt,{progress:r.progress})}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),O.jsx("td",{className:"px-4 py-2 text-gray-500",children:O.jsx(pTt,{stats:r.stats})}),O.jsx("td",{className:"px-4 py-2",children:r.solverInstance?O.jsxs("button",{onClick:()=>n(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.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"})}),O.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},mTt=class extends to.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function wTt({graphics:t}){const A=t.points??[],e=t.lines??[],i=t.rects??[],o=t.circles??[],n=t.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const I=(E,h)=>{typeof E=="number"&&(E<s&&(s=E),E>a&&(a=E)),typeof h=="number"&&(h<r&&(r=h),h>g&&(g=h))};for(const E of A)I(E.x,E.y);for(const E of e){const h=E.points??[];for(const u of h)I(u.x,u.y)}for(const E of i){const h=E.x??0,u=E.y??0,d=E.width??0,f=E.height??0;I(h,u),I(h+d,u+f)}for(const E of o){const h=E.x??0,u=E.y??0,d=E.radius??1;I(h-d,u-d),I(h+d,u+d)}for(const E of n)I(E.x,E.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const c=10,B=s-c,l=r-c,C=Math.max(1,a-s+2*c),Q=Math.max(1,g-r+2*c);return O.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${B} ${l} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((E,h)=>O.jsx("rect",{x:E.x??0,y:E.y??0,width:E.width??0,height:E.height??0,fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`rect-${h}`)),e.map((E,h)=>O.jsx("polyline",{fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1,points:(E.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${h}`)),o.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.fillColor??"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`circle-${h}`)),A.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.color??"black"},`point-${h}`)),n.map((E,h)=>O.jsx("text",{x:E.x??0,y:E.y??0,fontSize:E.fontSize??10,fill:E.color??"black",children:E.text??""},`text-${h}`))]})}var DTt=({solver:t,animationSpeed:A=25,onSolverStarted:e,onSolverCompleted:i})=>{const[o,n]=z.useReducer(I=>I+1,0),s=z.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(I){return console.error("Visualization error:",I),{points:[],lines:[],rects:[],circles:[]}}},[t,o]),r=z.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);z.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const I=document.createElement("script");I.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(I)}},[]);const a=t.pipelineDef!==void 0,g=I=>{const c=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&c.currentPipelineStepIndex<=c.pipelineDef.findIndex(B=>B.solverName===I);)t.step();n()}};return O.jsxs("div",{children:[O.jsx(CTt,{solver:t,triggerRender:n,animationSpeed:A,onSolverStarted:e,onSolverCompleted:i}),r?O.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):O.jsx(mTt,{fallback:O.jsx(wTt,{graphics:s}),children:O.jsx(cTt,{graphics:s})}),a&&O.jsx(yTt,{solver:t,onStepUntilPhase:g})]})};const STt=()=>{z.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const e=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),e)return;const i=document.createElement("script");i.id=t,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},bTt=t=>t.toLowerCase().includes("pack")?PSt:t.toLowerCase().includes("rout")?jSt:xSt,xTt=({solverEvents:t=[]})=>{const[A,e]=z.useState(null);STt();const i=z.useMemo(()=>{const r=new Map;for(const a of t){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[t]),o=z.useMemo(()=>Array.from(i.keys()),[i]),n=A?i.get(A):null,s=z.useMemo(()=>{if(!n)return{instance:null,error:null,classFound:!1};const r=reA[n.solverName];if(!r)return{instance:null,error:`Solver class "${n.solverName}" not found in SOLVERS registry. Available: ${Object.keys(reA).join(", ")}`,classFound:!1};try{const a=n.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}}},[n]);return t.length===0?O.jsx("div",{className:"rf-p-4",children:O.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:O.jsxs("div",{className:"rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),O.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."})]})})}):O.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[O.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[O.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:[o.length," ",o.length===1?"Solver":"Solvers"]}),o.map(r=>{const a=i.get(r),g=A===r;return O.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:()=>e(r),children:(()=>{const I=bTt(a.solverName);return O.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[O.jsx(I,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),O.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[O.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),O.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),O.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:n?s.instance?O.jsx(yy,{fallback:O.jsx("div",{className:"rf-p-4",children:O.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),O.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",n.solverName]})]})}),children:O.jsx(DTt,{solver:s.instance})}):O.jsxs("div",{className:"rf-p-4",children:[O.jsxs("div",{className:"rf-mb-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:n.solverName}),O.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",n.componentName]})]}),s.error&&O.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:O.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),O.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[O.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:O.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),O.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:O.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(n.solverParams,null,2)})})]})]}):O.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:O.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},Voe=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{z.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{Q3.captureException(i)}catch{}}},[t,A]),z.useEffect(()=>{if(e&&e.length>0)for(const i of e){const o=new Error(i.message||"Circuit JSON Error");i.stack&&(o.stack=i.stack);try{Q3.captureException(o,{error_type:i.type})}catch{}}},[e])},joe="0.0.1432",kTt={version:joe},AZ=zvA()(XvA(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),GTt=t=>{const[A,e]=z.useState([]),[i,o]=z.useState(null),[n,s]=z.useState(""),[r,a]=KM("eval-version-selection",null),g=AZ(l=>l.setLastRunEvalVersion),I=AZ(l=>l.lastRunEvalVersion);return z.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(l=>l.json()).then(l=>{if(Array.isArray(l?.versions)){let C=[...l.versions];l.tags?.latest&&(o(l.tags.latest),C=C.filter(Q=>Q!==l.tags.latest)),e(C)}}).catch(()=>{})},[t]),z.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[t,r,i]),{versions:z.useMemo(()=>A.filter(l=>l.includes(n)).slice(0,50),[A,n]),latestVersion:i,lastRunEvalVersion:I,search:n,setSearch:s,selectVersion:l=>{a(l),s("")}}},FTt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[o,n]=z.useState(""),[s,r]=z.useState("");if(!i)return null;const a=t.filter(c=>c.toLowerCase().includes(s.toLowerCase())),g=s&&!t.includes(s),I=c=>{c.key==="Enter"&&(a.length===1?n(a[0]):g&&n(s))};return O.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:O.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[O.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),O.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:c=>r(c.target.value),onKeyDown:I}),O.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[a.map(c=>O.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${o===c?"bg-blue-50":""}`,onClick:()=>n(c),children:c},c)),g&&O.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${o===s?"bg-blue-50":""}`,onClick:()=>n(s),children:['Create new "',s,'"']})]}),O.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:e,children:"Cancel"}),O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>o&&A(o),disabled:!o,children:o===s?`Create "${o}"`:`Save to ${o}`})]})]})})},_Tt=t=>{const A=z.useRef(null),e=Tc(i=>i.recentEvents);z.useEffect(()=>{if(e.length===0)return;const i=e[0];i.event_id!==A.current&&(t(i),A.current=i.event_id)},[e,t])};function RTt(t){const A=NTt(t),e=z.forwardRef((i,o)=>{const{children:n,...s}=i,r=z.Children.toArray(n),a=r.find(vTt);if(a){const g=a.props.children,I=r.map(c=>c===a?z.Children.count(g)>1?z.Children.only(null):z.isValidElement(g)?g.props.children:null:c);return O.jsx(A,{...s,ref:o,children:z.isValidElement(g)?z.cloneElement(g,void 0,I):null})}return O.jsx(A,{...s,ref:o,children:n})});return e.displayName=`${t}.Slot`,e}function NTt(t){const A=z.forwardRef((e,i)=>{const{children:o,...n}=e;if(z.isValidElement(o)){const s=LTt(o),r=UTt(n,o.props);return o.type!==z.Fragment&&(r.ref=i?Pp(i,s):s),z.cloneElement(o,r)}return z.Children.count(o)>1?z.Children.only(null):null});return A.displayName=`${t}.SlotClone`,A}var MTt=Symbol("radix.slottable");function vTt(t){return z.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===MTt}function UTt(t,A){const e={...A};for(const i in A){const o=t[i],n=A[i];/^on[A-Z]/.test(i)?o&&n?e[i]=(...r)=>{const a=n(...r);return o(...r),a}:o&&(e[i]=o):i==="style"?e[i]={...o,...n}:i==="className"&&(e[i]=[o,n].filter(Boolean).join(" "))}return{...t,...e}}function LTt(t){let A=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning;return e?t.ref:(A=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var eZ="Dialog",[zoe,Xoe]=fw(eZ),[HTt,Lm]=zoe(eZ),$oe=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:o,onOpenChange:n,modal:s=!0}=t,r=z.useRef(null),a=z.useRef(null),[g,I]=QG({prop:i,defaultProp:o??!1,onChange:n,caller:eZ});return O.jsx(HTt,{scope:A,triggerRef:r,contentRef:a,contentId:mu(),titleId:mu(),descriptionId:mu(),open:g,onOpenChange:I,onOpenToggle:z.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};$oe.displayName=eZ;var Ane="DialogTrigger",ene=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(Ane,e),n=wB(A,o.triggerRef);return O.jsx(pg.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":RhA(o.open),...i,ref:n,onClick:Qn(t.onClick,o.onOpenToggle)})});ene.displayName=Ane;var FhA="DialogPortal",[YTt,tne]=zoe(FhA,{forceMount:void 0}),ine=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:o}=t,n=Lm(FhA,A);return O.jsx(YTt,{scope:A,forceMount:e,children:z.Children.map(i,s=>O.jsx(cy,{present:e||n.open,children:O.jsx(f8,{asChild:!0,container:o,children:s})}))})};ine.displayName=FhA;var tZ="DialogOverlay",one=z.forwardRef((t,A)=>{const e=tne(tZ,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Lm(tZ,t.__scopeDialog);return n.modal?O.jsx(cy,{present:i||n.open,children:O.jsx(TTt,{...o,ref:A})}):null});one.displayName=tZ;var JTt=RTt("DialogOverlay.RemoveScroll"),TTt=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(tZ,e);return O.jsx(k8,{as:JTt,allowPinchZoom:!0,shards:[o.contentRef],children:O.jsx(pg.div,{"data-state":RhA(o.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),wF="DialogContent",nne=z.forwardRef((t,A)=>{const e=tne(wF,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Lm(wF,t.__scopeDialog);return O.jsx(cy,{present:i||n.open,children:n.modal?O.jsx(KTt,{...o,ref:A}):O.jsx(qTt,{...o,ref:A})})});nne.displayName=wF;var KTt=z.forwardRef((t,A)=>{const e=Lm(wF,t.__scopeDialog),i=z.useRef(null),o=wB(A,e.contentRef,i);return z.useEffect(()=>{const n=i.current;if(n)return sQA(n)},[]),O.jsx(sne,{...t,ref:o,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qn(t.onCloseAutoFocus,n=>{n.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:Qn(t.onPointerDownOutside,n=>{const s=n.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&n.preventDefault()}),onFocusOutside:Qn(t.onFocusOutside,n=>n.preventDefault())})}),qTt=z.forwardRef((t,A)=>{const e=Lm(wF,t.__scopeDialog),i=z.useRef(!1),o=z.useRef(!1);return O.jsx(sne,{...t,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:n=>{t.onCloseAutoFocus?.(n),n.defaultPrevented||(i.current||e.triggerRef.current?.focus(),n.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:n=>{t.onInteractOutside?.(n),n.defaultPrevented||(i.current=!0,n.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=n.target;e.triggerRef.current?.contains(s)&&n.preventDefault(),n.detail.originalEvent.type==="focusin"&&o.current&&n.preventDefault()}})}),sne=z.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:n,...s}=t,r=Lm(wF,e),a=z.useRef(null),g=wB(A,a);return JCA(),O.jsxs(O.Fragment,{children:[O.jsx(g8,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:n,children:O.jsx(a8,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":RhA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),O.jsxs(O.Fragment,{children:[O.jsx(OTt,{titleId:r.titleId}),O.jsx(ZTt,{contentRef:a,descriptionId:r.descriptionId})]})]})}),_hA="DialogTitle",rne=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(_hA,e);return O.jsx(pg.h2,{id:o.titleId,...i,ref:A})});rne.displayName=_hA;var ane="DialogDescription",gne=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(ane,e);return O.jsx(pg.p,{id:o.descriptionId,...i,ref:A})});gne.displayName=ane;var Ine="DialogClose",cne=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Lm(Ine,e);return O.jsx(pg.button,{type:"button",...i,ref:A,onClick:Qn(t.onClick,()=>o.onOpenChange(!1))})});cne.displayName=Ine;function RhA(t){return t?"open":"closed"}var Bne="DialogTitleWarning",[PTt,lne]=R5e(Bne,{contentName:wF,titleName:_hA,docsSlug:"dialog"}),OTt=({titleId:t})=>{const A=lne(Bne),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5606
5606
 
5607
5607
  If you want to hide the \`${A.titleName}\`, you can wrap it with our VisuallyHidden component.
5608
5608